diff options
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/common.h b/src/common.h index d78f11a..f0c0886 100644 --- a/src/common.h +++ b/src/common.h | |||
@@ -561,8 +561,8 @@ int bios_div(int num, int denom); | |||
561 | typedef enum { | 561 | typedef enum { |
562 | SOUND_SQUARE1 = (0x1 << 0), | 562 | SOUND_SQUARE1 = (0x1 << 0), |
563 | SOUND_SQUARE2 = (0x1 << 1), | 563 | SOUND_SQUARE2 = (0x1 << 1), |
564 | SOUND_WAVE = (0x4 << 2), | 564 | SOUND_WAVE = (0x1 << 2), |
565 | SOUND_NOISE = (0x8 << 3), | 565 | SOUND_NOISE = (0x1 << 3), |
566 | } SoundChannel; | 566 | } SoundChannel; |
567 | 567 | ||
568 | u16 | 568 | u16 |
@@ -602,9 +602,33 @@ sound_volume(SoundChannel channels, u8 volume) { | |||
602 | #define SOUND_SWEEP_DIR(N) ((N) << 0x3) | 602 | #define SOUND_SWEEP_DIR(N) ((N) << 0x3) |
603 | #define SOUND_SWEEP_TIME(N) ((N) << 0x4) | 603 | #define SOUND_SWEEP_TIME(N) ((N) << 0x4) |
604 | 604 | ||
605 | // DMG square frequency bits. | 605 | // DMG frequency bits (Square/Wave). |
606 | #define SOUND_SQUARE_TIMED (1 << 0xE) | 606 | #define SOUND_FREQ_TIMED (1 << 0xE) |
607 | #define SOUND_SQUARE_RESET (1 << 0xF) | 607 | #define SOUND_FREQ_RESET (1 << 0xF) |
608 | |||
609 | // DMG wave ram. | ||
610 | #define SOUND_WAVE_RAM_0 *((vu32*)(MEM_IO + 0x90)) | ||
611 | #define SOUND_WAVE_RAM_1 *((vu32*)(MEM_IO + 0x94)) | ||
612 | #define SOUND_WAVE_RAM_2 *((vu32*)(MEM_IO + 0x98)) | ||
613 | #define SOUND_WAVE_RAM_3 *((vu32*)(MEM_IO + 0x9C)) | ||
614 | |||
615 | // DMG wave control bits. | ||
616 | #define SOUND_WAVE_LENGTH(N) (N) | ||
617 | #define SOUND_WAVE_MUTE 0x0 | ||
618 | #define SOUND_WAVE_VOL_100 (0x1 << 0xD) | ||
619 | #define SOUND_WAVE_VOL_75 (0x4 << 0xD) | ||
620 | #define SOUND_WAVE_VOL_50 (0x2 << 0xD) | ||
621 | #define SOUND_WAVE_VOL_25 (0x3 << 0xD) | ||
622 | |||
623 | // DMG wave mode bits. | ||
624 | #define SOUND_WAVE_BANK_MODE(N) ((N) << 0x5) | ||
625 | #define SOUND_WAVE_BANK_SELECT(N) ((N) << 0x6) | ||
626 | #define SOUND_WAVE_ENABLE (1 << 0x7) | ||
627 | |||
628 | typedef u8 WaveBank[32]; | ||
629 | |||
630 | // typedef u32 WaveBank[4]; | ||
631 | #define SOUND_WAVE_RAM ((WaveBank*)(MEM_IO + 0x90)) | ||
608 | 632 | ||
609 | typedef enum { | 633 | typedef enum { |
610 | NOTE_C_2 , NOTE_C_SHARP_2 , NOTE_D_2 , NOTE_D_SHARP_2 , | 634 | NOTE_C_2 , NOTE_C_SHARP_2 , NOTE_D_2 , NOTE_D_SHARP_2 , |