Previous 15994 Revisions Next

r14510 Saturday 18th February, 2012 at 11:46:56 UTC by Barry Rodewald
isa_gus: Attempt at clearing pops at the end of some samples. (no whatsnew)
[src/mess/machine]isa_gus.c

src/mess/machine/isa_gus.c
r14509r14510
229229
230230   for(x=0;x<32;x++)  // for each voice
231231   {
232      if(!(m_voice[x].voice_ctrl & 0x01))
232      stream_sample_t* left = outputl;
233      stream_sample_t* right = outputr;
234      UINT16 vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]);
235      for(y=samples-1; y>=0; y--)
233236      {
234         stream_sample_t* left = outputl;
235         stream_sample_t* right = outputr;
236         UINT16 vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]);
237         for(y=samples-1; y>=0; y--)
237         UINT32 current = m_voice[x].current_addr >> 9;
238         // TODO: implement proper panning
239         (*left) += ((m_voice[x].sample) * (vol/8192.0));
240         (*right) += ((m_voice[x].sample) * (vol/8192.0));
241         left++;
242         right++;
243         if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01))
238244         {
239            UINT32 current = m_voice[x].current_addr >> 9;
240            // TODO: implement proper panning
241            (*left) += ((m_voice[x].sample) * (vol/8192.0));
242            (*right) += ((m_voice[x].sample) * (vol/8192.0));
243            left++;
244            right++;
245            if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01))
245            if(m_voice[x].vol_ramp_ctrl & 0x04)
246246            {
247               if(m_voice[x].vol_ramp_ctrl & 0x04)
247               m_voice[x].rollover = true;  // set roll over condition - generate IRQ, but keep voice playing
248            }
249
250            if(m_voice[x].voice_ctrl & 0x20)
251               set_irq(IRQ_WAVETABLE,x);
252
253            // end voice, unless looping, or rollover is active, which disables looping
254            if(!m_voice[x].rollover)
255            {
256               if(!(m_voice[x].voice_ctrl & 0x08))
248257               {
249                  m_voice[x].rollover = true;  // set roll over condition - generate IRQ, but keep voice playing
258                  m_voice[x].voice_ctrl |= 0x01;
259//                     m_voice[x].current_addr = m_voice[x].end_addr;
250260               }
251
252               // end voice, unless looping, or rollover is active, which disables looping
253               if(!m_voice[x].rollover)
261               else
254262               {
255                  if(!(m_voice[x].voice_ctrl & 0x08))
256                     m_voice[x].voice_ctrl |= 0x01;
263                  if(m_voice[x].voice_ctrl & 0x10)
264                     m_voice[x].voice_ctrl |= 0x40; // change direction
257265                  else
258                  {
259                     if(m_voice[x].voice_ctrl & 0x10)
260                        m_voice[x].voice_ctrl |= 0x40; // change direction
261                     else
262                        m_voice[x].current_addr = m_voice[x].start_addr; // start sample again
263                  }
266                     m_voice[x].current_addr = m_voice[x].start_addr; // start sample again
264267               }
265               if(m_voice[x].voice_ctrl & 0x20)
266                  set_irq(IRQ_WAVETABLE,x);
267268            }
268            if((m_voice[x].voice_ctrl & 0x40) && (m_voice[x].current_addr <= m_voice[x].start_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01))
269         }
270         if((m_voice[x].voice_ctrl & 0x40) && (m_voice[x].current_addr <= m_voice[x].start_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01))
271         {
272            if(m_voice[x].vol_ramp_ctrl & 0x04)
269273            {
270               if(m_voice[x].vol_ramp_ctrl & 0x04)
274               m_voice[x].rollover = true;  // set roll over condition - generate IRQ, but keep voice playing
275            }
276
277            if(m_voice[x].voice_ctrl & 0x20)
278               set_irq(IRQ_WAVETABLE,x);
279
280            // end voice, unless looping, or rollover is active, which disables looping
281            if(!m_voice[x].rollover)
282            {
283               // end voice, unless looping
284               if(!(m_voice[x].voice_ctrl & 0x08))
271285               {
272                  m_voice[x].rollover = true;  // set roll over condition - generate IRQ, but keep voice playing
286                  m_voice[x].voice_ctrl |= 0x01;
287//                     m_voice[x].current_addr = m_voice[x].start_addr;
273288               }
274
275               // end voice, unless looping, or rollover is active, which disables looping
276               if(!m_voice[x].rollover)
289               else
277290               {
278                  // end voice, unless looping
279                  if(!(m_voice[x].voice_ctrl & 0x08))
280                     m_voice[x].voice_ctrl |= 0x01;
291                  if(m_voice[x].voice_ctrl & 0x10)
292                     m_voice[x].voice_ctrl &= ~0x40; // change direction
281293                  else
282                  {
283                     if(m_voice[x].voice_ctrl & 0x10)
284                        m_voice[x].voice_ctrl &= ~0x40; // change direction
285                     else
286                        m_voice[x].current_addr = m_voice[x].end_addr; // start sample again
287                  }
294                     m_voice[x].current_addr = m_voice[x].end_addr; // start sample again
288295               }
289               if(m_voice[x].voice_ctrl & 0x20)
290                  set_irq(IRQ_WAVETABLE,x);
291296            }
297         }
298         if(!(m_voice[x].voice_ctrl & 0x01))
299         {
292300            if(m_voice[x].voice_ctrl & 0x04)
293301            {  // 16-bit PCM
294302               current = ((m_voice[x].current_addr >> 9) & 0xc0000) + (((m_voice[x].current_addr >> 9) & 0x1ffff) << 1);
r14509r14510
302310               m_voice[x].current_addr -= (m_voice[x].freq_ctrl >> 1);
303311            else
304312               m_voice[x].current_addr += (m_voice[x].freq_ctrl >> 1);
313         }
305314#ifdef LOG_SOUND
306            INT16 smp = (m_voice[x].sample) * (vol / 8192.0);
307            fwrite(&smp,4,1,f);
315         INT16 smp = (m_voice[x].sample) * (vol / 8192.0);
316         fwrite(&smp,4,1,f);
308317#endif
309         }
310318      }
311319   }
312320}
r14509r14510
411419   {
412420      m_voice[x].voice_ctrl = 0x01;  // stop all voices
413421      m_voice[x].vol_ramp_ctrl = 0x01; // stop all volume ramps
422      m_voice[x].current_vol = 0;  // silence all voices
414423   }
415424   m_irq_source = 0xe0;
416425   m_reg_ctrl = 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team