Mercurial > repos > blastem
comparison psg.h @ 483:3e1573fa22cf
Implement turbo/slow motion feature that overclocks or underclocks the entire system at the push of a button
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 01 Oct 2013 23:51:16 -0700 |
parents | 140af5509ce7 |
children | 9a5dc22297f2 |
comparison
equal
deleted
inserted
replaced
482:4b24260125f3 | 483:3e1573fa22cf |
---|---|
1 /* | 1 /* |
2 Copyright 2013 Michael Pavone | 2 Copyright 2013 Michael Pavone |
3 This file is part of BlastEm. | 3 This file is part of BlastEm. |
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. | 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. |
5 */ | 5 */ |
6 #ifndef PSG_CONTEXT_H_ | 6 #ifndef PSG_CONTEXT_H_ |
7 #define PSG_CONTEXT_H_ | 7 #define PSG_CONTEXT_H_ |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 typedef struct { | 11 typedef struct { |
12 int16_t *audio_buffer; | 12 int16_t *audio_buffer; |
13 int16_t *back_buffer; | 13 int16_t *back_buffer; |
14 double buffer_fraction; | 14 uint64_t buffer_fraction; |
15 double buffer_inc; | 15 uint64_t buffer_inc; |
16 uint32_t buffer_pos; | 16 uint32_t buffer_pos; |
17 uint32_t clock_inc; | 17 uint32_t clock_inc; |
18 uint32_t cycles; | 18 uint32_t cycles; |
19 uint32_t sample_rate; | |
19 uint32_t samples_frame; | 20 uint32_t samples_frame; |
20 uint16_t lsfr; | 21 uint16_t lsfr; |
21 uint16_t counter_load[4]; | 22 uint16_t counter_load[4]; |
22 uint16_t counters[4]; | 23 uint16_t counters[4]; |
23 uint8_t volume[4]; | 24 uint8_t volume[4]; |
28 uint8_t latch; | 29 uint8_t latch; |
29 } psg_context; | 30 } psg_context; |
30 | 31 |
31 | 32 |
32 void psg_init(psg_context * context, uint32_t sample_rate, uint32_t master_clock, uint32_t clock_div, uint32_t samples_frame); | 33 void psg_init(psg_context * context, uint32_t sample_rate, uint32_t master_clock, uint32_t clock_div, uint32_t samples_frame); |
34 void psg_adjust_master_clock(psg_context * context, uint32_t master_clock); | |
33 void psg_write(psg_context * context, uint8_t value); | 35 void psg_write(psg_context * context, uint8_t value); |
34 void psg_run(psg_context * context, uint32_t cycles); | 36 void psg_run(psg_context * context, uint32_t cycles); |
35 | 37 |
36 #endif //PSG_CONTEXT_H_ | 38 #endif //PSG_CONTEXT_H_ |
37 | 39 |