Previous 199869 Revisions Next

r26463 Sunday 1st December, 2013 at 12:39:54 UTC by hap
fix possible lockup
[src/emu/sound]ymz770.c ymz770.h

trunk/src/emu/sound/ymz770.c
r26462r26463
4040   // create the stream
4141   m_stream = machine().sound().stream_alloc(*this, 0, 2, 16000, this);
4242   m_rom_base = device().machine().root_device().memregion(":ymz770")->base();
43   m_rom_size = device().machine().root_device().memregion(":ymz770")->bytes() * 8;
43   m_rom_limit = device().machine().root_device().memregion(":ymz770")->bytes() * 8;
4444
4545   for (int i = 0; i < 8; i++)
4646   {
r26462r26463
6767      save_item(NAME(m_channels[i].last_block), i);
6868      save_item(NAME(m_channels[i].output_remaining), i);
6969      save_item(NAME(m_channels[i].output_ptr), i);
70      save_item(NAME(m_channels[i].atbl), i);
7071      save_item(NAME(m_channels[i].pptr), i);
7172      save_item(NAME(m_channels[i].sequence), i);
7273      save_item(NAME(m_channels[i].seqcontrol), i);
r26462r26463
131132                  case 0x0f:
132133                     if (m_channels[ch].seqcontrol & 1)
133134                     {
135                        // loop sequence
134136                        UINT8 sqn = m_channels[ch].sequence;
135137                        UINT32 pptr = m_rom_base[(4*sqn)+1+0x400]<<16 | m_rom_base[(4*sqn)+2+0x400]<<8 | m_rom_base[(4*sqn)+3+0x400];
136138                        m_channels[ch].seqdata = &m_rom_base[pptr];
r26462r26463
163165               {
164166                  if (m_channels[ch].control & 1)
165167                  {
168                     // loop sample
166169                     UINT8 phrase = m_channels[ch].phrase;
170                     m_channels[ch].atbl = m_rom_base[(4*phrase)+0] >> 4 & 7;
167171                     m_channels[ch].pptr = 8*(m_rom_base[(4*phrase)+1]<<16 | m_rom_base[(4*phrase)+2]<<8 | m_rom_base[(4*phrase)+3]);
168172                  }
169173                  else
r26462r26463
175179               if (m_channels[ch].is_playing)
176180               {
177181                  int sample_rate, channel_count;
178                  if(!m_channels[ch].decoder->decode_buffer(m_channels[ch].pptr,
179                                                m_rom_size,
182                  if (!m_channels[ch].decoder->decode_buffer(m_channels[ch].pptr,
183                                                m_rom_limit,
180184                                                m_channels[ch].output_data,
181185                                                m_channels[ch].output_remaining,
182186                                                sample_rate,
183187                                                channel_count))
184188                  {
189                     m_channels[ch].is_playing = !m_channels[ch].last_block; // detect infinite retry loop
185190                     m_channels[ch].last_block = true;
186191                     goto retry;
187192                  }
r26462r26463
269274            if (data & 6)
270275            {
271276               UINT8 phrase = m_channels[voice].phrase;
277               m_channels[voice].atbl = m_rom_base[(4*phrase)+0] >> 4 & 7;
272278               m_channels[voice].pptr = 8*(m_rom_base[(4*phrase)+1]<<16 | m_rom_base[(4*phrase)+2]<<8 | m_rom_base[(4*phrase)+3]);
273279               m_channels[voice].output_remaining = 0;
274280               m_channels[voice].output_ptr = 0;
trunk/src/emu/sound/ymz770.h
r26462r26463
4848      INT16 output_data[1152];
4949      int output_remaining;
5050      int output_ptr;
51      int atbl;
5152      int pptr;
5253
5354      UINT8 sequence;
r26462r26463
8485   UINT8 m_bsl;          // boost level
8586   UINT8 m_cpl;          // clip limiter
8687   UINT8 *m_rom_base;
87   int m_rom_size;
88   int m_rom_limit;
8889
8990   ymz_channel m_channels[8];
9091};

Previous 199869 Revisions Next


© 1997-2024 The MAME Team