1 // Private oscillators used by Sms_Apu
2 
3 // Sms_Snd_Emu 0.1.4
4 #ifndef SMS_OSCS_H
5 #define SMS_OSCS_H
6 
7 #include "blargg_common.h"
8 #include "Blip_Buffer.h"
9 
10 struct Sms_Osc
11 {
12 	Blip_Buffer* outputs [4]; // nullptr, right, left, center
13 	Blip_Buffer* output;
14 	int output_select;
15 
16 	int delay;
17 	int last_amp;
18 	int volume;
19 
20 	Sms_Osc();
21 	void reset();
22 };
23 
24 struct Sms_Square : Sms_Osc
25 {
26 	int period;
27 	int phase;
28 
29 	typedef Blip_Synth<blip_good_quality,1> Synth;
30 	const Synth* synth;
31 
32 	void reset();
33 	void run( blip_time_t, blip_time_t );
34 };
35 
36 struct Sms_Noise : Sms_Osc
37 {
38 	const int* period;
39 	unsigned shifter;
40 	unsigned feedback;
41 
42 	typedef Blip_Synth<blip_med_quality,1> Synth;
43 	Synth synth;
44 
45 	void reset();
46 	void run( blip_time_t, blip_time_t );
47 };
48 
49 #endif
50