Simplify sound_timer function

This commit is contained in:
twinaphex 2014-12-09 19:02:07 +01:00
parent 5fc2752771
commit a6905d9da2

12
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,7 +119,11 @@ void sound_timer(fixed8_24 frequency_step, u32 channel)
next_sample >>= 1; next_sample >>= 1;
} }
switch(ds->status) sample_status = ds->status;
}
switch(sample_status)
{ {
case DIRECT_SOUND_INACTIVE: case DIRECT_SOUND_INACTIVE:
render_samples(null); render_samples(null);
@ -136,11 +141,6 @@ void sound_timer(fixed8_24 frequency_step, u32 channel)
render_samples(both); render_samples(both);
break; break;
} }
}
else
{
render_samples(null);
}
ds->buffer_index = buffer_index; ds->buffer_index = buffer_index;
ds->fifo_fractional = fp8_24_fractional_part(fifo_fractional); ds->fifo_fractional = fp8_24_fractional_part(fifo_fractional);