diff options
author | Mike Pavone <pavone@retrodev.com> | 2013-05-23 23:42:42 -0700 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2013-05-23 23:42:42 -0700 |
commit | 9e33979cee499191c05fa63262327f7f17a70305 (patch) | |
tree | 771a02d03f4a9b82b5a5ebe94b3df8cd12d6bba3 /psg.h | |
parent | cd89c2bf86b59b7685c3ed92c613a14eb4240f84 (diff) |
Initial PSG support. Mostly works, noise channel is borked though.
Diffstat (limited to 'psg.h')
-rw-r--r-- | psg.h | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +#ifndef PSG_CONTEXT_H_ +#define PSG_CONTEXT_H_ + +#include <stdint.h> + +typedef struct { + int16_t *audio_buffer; + int16_t *back_buffer; + double buffer_fraction; + double buffer_inc; + uint32_t buffer_pos; + uint32_t back_pos; + uint32_t cycles; + uint32_t samples_frame; + uint16_t lsfr; + uint16_t counter_load[4]; + uint16_t counters[4]; + uint8_t volume[4]; + uint8_t output_state[4]; + uint8_t noise_out; + uint8_t noise_use_tone; + uint8_t noise_type; + uint8_t latch; +} psg_context; + + +void psg_init(psg_context * context, uint32_t sample_rate, uint32_t clock_rate, uint32_t samples_frame); +void psg_write(psg_context * context, uint8_t value); +void psg_run(psg_context * context, uint32_t cycles); + +#endif //PSG_CONTEXT_H_ + |