diff options
author | twinaphex | 2014-12-12 17:33:29 +0100 |
---|---|---|
committer | twinaphex | 2014-12-12 17:33:29 +0100 |
commit | 320bf35a8c44448d9ed75110c0be50164361982a (patch) | |
tree | 77d0767fd8fb4cd63219ba85ed303ab177d87211 | |
parent | 24eef7a3ff1ea6fa6e93326b5b1b58760111a4ec (diff) | |
download | picogpsp-320bf35a8c44448d9ed75110c0be50164361982a.tar.gz picogpsp-320bf35a8c44448d9ed75110c0be50164361982a.tar.bz2 picogpsp-320bf35a8c44448d9ed75110c0be50164361982a.zip |
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
-rw-r--r-- | sound.c | 37 |
1 files changed, 25 insertions, 12 deletions
@@ -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; } |