forked from LokkoLori/muddyGB-DSD
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsound.h
49 lines (34 loc) · 946 Bytes
/
sound.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* sound.h -- playing sound
*/
#include "muddygb_rvl.h"
#include <gb/gb.h>
#ifndef SOUND_H
#define SOUND_H
#define ON 0xFF
#define OFF 0x00
#define RESET 0x80
#define HIGH 0xFF
#define LOW 0x00
#define MED 0xA4
#define SOUND_CHIP NR52_REG
#define SOUND_OUTPUT NR51_REG
#define INIT_SOUND SOUND_CHIP=RESET; SOUND_OUTPUT=ON;
#define MASTER_VOLUME NR50_REG
#define CH1_SWEEP NR10_REG
#define CH1_DUTY_CYCLE NR11_REG
#define CH1_VOL NR12_REG
#define CH1 NR14_REG
#define CH2_SWEEP NR20_REG
#define CH2_DUTY_CYCLE NR21_REG
#define CH2_VOL NR22_REG
#define CH2 NR24_REG
#define PULSE_WIDTH_12_5 0x00
#define PULSE_WIDTH_25 0x40
#define PULSE_WIDTH_50 0x80
#define PULSE_WIDTH_75 0xc0
#define SET_PULSE_WIDTH(CH, DUTY) (CH## _DUTY_CYCLE) = (PULSE_WIDTH_## DUTY);
UINT getFrequencies(int note, int bend);
extern const UINT note_frequencies[];
void play_freq_ch1 (UINT f, UINT8 newNote);
void play_freq_ch2 (UINT f, UINT8 newNote);
#endif