Get rid of unnecessary macros for sound_timer_queue functions - it

is pretty apparent what this does on its face, and a macro is somewhat
unnecessary for so few invocations
This commit is contained in:
twinaphex 2014-12-12 17:33:29 +01:00
parent 24eef7a3ff
commit 320bf35a8c
1 changed files with 25 additions and 12 deletions

37
sound.c
View File

@ -33,33 +33,46 @@ static u32 sound_buffer_base;
static u32 sound_last_cpu_ticks;
static fixed16_16 gbc_sound_tick_step;
// Queue 1, 2, or 4 samples to the top of the DS FIFO, wrap around circularly
#define sound_timer_queue(size, value) \
*((s##size *)(ds->fifo + ds->fifo_top)) = value; \
ds->fifo_top = (ds->fifo_top + 1) % 32; \
/* Queue 1 sample to the top of the DS FIFO, wrap around circularly */
void sound_timer_queue8(u32 channel, u8 value)
{
direct_sound_struct *ds = direct_sound_channel + channel;
sound_timer_queue(8, value);
*((s8 *)(ds->fifo + ds->fifo_top)) = value;
ds->fifo_top = (ds->fifo_top + 1) % 32;
}
/* Queue 2 samples to the top of the DS FIFO, wrap around circularly */
void sound_timer_queue16(u32 channel, u16 value)
{
direct_sound_struct *ds = direct_sound_channel + channel;
sound_timer_queue(8, value & 0xFF);
sound_timer_queue(8, value >> 8);
*((s8 *)(ds->fifo + ds->fifo_top)) = value & 0xFF;
ds->fifo_top = (ds->fifo_top + 1) % 32;
*((s8 *)(ds->fifo + ds->fifo_top)) = value >> 8;
ds->fifo_top = (ds->fifo_top + 1) % 32;
}
/* Queue 4 samples to the top of the DS FIFO, wrap around circularly */
void sound_timer_queue32(u32 channel, u32 value)
{
direct_sound_struct *ds = direct_sound_channel + channel;
sound_timer_queue(8, value & 0xFF);
sound_timer_queue(8, (value >> 8) & 0xFF);
sound_timer_queue(8, (value >> 16) & 0xFF);
sound_timer_queue(8, value >> 24);
*((s8 *)(ds->fifo + ds->fifo_top)) = value & 0xFF;
ds->fifo_top = (ds->fifo_top + 1) % 32;
*((s8 *)(ds->fifo + ds->fifo_top)) = (value >> 8) & 0xFF;
ds->fifo_top = (ds->fifo_top + 1) % 32;
*((s8 *)(ds->fifo + ds->fifo_top)) = (value >> 16) & 0xFF;
ds->fifo_top = (ds->fifo_top + 1) % 32;
*((s8 *)(ds->fifo + ds->fifo_top)) = (value >> 24);
ds->fifo_top = (ds->fifo_top + 1) % 32;
}