Simplify sound_timer function

This commit is contained in:
twinaphex 2014-12-09 19:02:07 +01:00
parent 5fc2752771
commit a6905d9da2
1 changed files with 11 additions and 11 deletions

22
sound.c
View File

@ -100,6 +100,7 @@ void sound_timer_queue32(u32 channel, u32 value)
void sound_timer(fixed8_24 frequency_step, u32 channel) void sound_timer(fixed8_24 frequency_step, u32 channel)
{ {
unsigned sample_status = DIRECT_SOUND_INACTIVE;
direct_sound_struct *ds = direct_sound_channel + channel; direct_sound_struct *ds = direct_sound_channel + channel;
fixed8_24 fifo_fractional = ds->fifo_fractional; fixed8_24 fifo_fractional = ds->fifo_fractional;
@ -118,28 +119,27 @@ void sound_timer(fixed8_24 frequency_step, u32 channel)
next_sample >>= 1; next_sample >>= 1;
} }
switch(ds->status) sample_status = ds->status;
{
case DIRECT_SOUND_INACTIVE: }
switch(sample_status)
{
case DIRECT_SOUND_INACTIVE:
render_samples(null); render_samples(null);
break; break;
case DIRECT_SOUND_RIGHT: case DIRECT_SOUND_RIGHT:
render_samples(right); render_samples(right);
break; break;
case DIRECT_SOUND_LEFT: case DIRECT_SOUND_LEFT:
render_samples(left); render_samples(left);
break; break;
case DIRECT_SOUND_LEFTRIGHT: case DIRECT_SOUND_LEFTRIGHT:
render_samples(both); render_samples(both);
break; break;
}
}
else
{
render_samples(null);
} }
ds->buffer_index = buffer_index; ds->buffer_index = buffer_index;