Debian Codegraph @

src/engine/platform/sound/swan_mdfn.h

raw
1 /******************************************************************************/
2 /* Mednafen - Multi-system Emulator */
3 /******************************************************************************/
4 /* sound.h - WonderSwan Sound Emulation
5 ** Copyright (C) 2007-2016 Mednafen Team
6 **
7 ** This program is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU General Public License
9 ** as published by the Free Software Foundation; either version 2
10 ** of the License, or (at your option) any later version.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software Foundation, Inc.,
19 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22 #ifndef __WSWAN_SOUND_H
23 #define __WSWAN_SOUND_H
24
25 #include <stdint.h>
26 #include "blip_buf.h"
27 #include "../../dispatch.h"
28
29 class WSwan
30 {
31 public:
32 int32_t SoundFlush(int16_t *SoundBuf, const int32_t MaxSoundFrames);
33
34 void SoundWrite(uint32_t, uint8_t);
35 uint8_t SoundRead(uint32_t);
36 void SoundReset(void);
37 void SoundCheckRAMWrite(uint32_t A);
38
39 void SoundUpdate();
40 void RAMWrite(uint32_t, uint8_t);
41
42 int32_t sample_cache[4][2];
43
44 // Blip_Synth<blip_good_quality, 4096> WaveSynth;
45
46 // Blip_Buffer *sbuf[2] = { NULL };
47 blip_buffer_t* sbuf[2];
48 DivDispatchOscBuffer* oscBuf[4];
49
50 uint16_t period[4];
51 uint8_t volume[4]; // left volume in upper 4 bits, right in lower 4 bits
52 uint8_t voice_volume;
53
54 uint8_t sweep_step, sweep_value;
55 uint8_t noise_control;
56 uint8_t control;
57 uint8_t output_control;
58
59 int32_t sweep_8192_divider;
60 uint8_t sweep_counter;
61 uint8_t SampleRAMPos;
62
63 int32_t last_v_val;
64
65 uint8_t HyperVoice;
66 int32_t last_hv_val[2];
67 uint8_t HVoiceCtrl, HVoiceChanCtrl;
68
69 int32_t period_counter[4];
70 int32_t last_val[4][2]; // Last outputted value, l&r
71 uint8_t sample_pos[4];
72 uint16_t nreg;
73 uint32_t last_ts;
74 uint32_t v30mz_timestamp;
75
76 uint8_t wsRAM[64];
77 };
78
79 #endif