OSDN Git Service

[VM][DEVICE] Add "get_device_name()" feature.This is useful for debugging VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pcm1bit.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Date   : 2007.02.09 -
6
7         [ 1bit PCM ]
8 */
9
10 #ifndef _PCM1BIT_H_
11 #define _PCM1BIT_H_
12
13 #include "vm.h"
14 #include "../emu.h"
15 #include "device.h"
16
17 #define SIG_PCM1BIT_SIGNAL      0
18 #define SIG_PCM1BIT_ON          1
19 #define SIG_PCM1BIT_MUTE        2
20
21 class PCM1BIT : public DEVICE
22 {
23 private:
24         bool signal, on, mute;
25         int changed;
26         uint32 prev_clock;
27         int positive_clocks, negative_clocks;
28         int max_vol, last_vol;
29         
30 public:
31         PCM1BIT(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
32         ~PCM1BIT() {}
33         
34         // common functions
35         void initialize();
36         void reset();
37         void write_signal(int id, uint32 data, uint32 mask);
38         void event_frame();
39         void mix(int32* buffer, int cnt);
40         void save_state(FILEIO* state_fio);
41         bool load_state(FILEIO* state_fio);
42         const _TCHAR *get_device_name(void)
43         {
44                 return "SOUND_PCM1BIT";
45         }
46         
47         // unique function
48         void init(int rate, int volume);
49 };
50
51 #endif
52