-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneopopsound.h
88 lines (64 loc) · 2.52 KB
/
neopopsound.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Flavor modified sound.c and sound.h from NEOPOP
// which was originally based on sn76496.c from MAME
// some ideas also taken from NeoPop-SDL code
//---------------------------------------------------------------------------
// Originally from
// NEOPOP : Emulator as in Dreamland
//
// Copyright (c) 2001-2002 by neopop_uk
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. See also the license.txt file for
// additional informations.
//---------------------------------------------------------------------------
#ifndef __NEOPOPSOUND__
#define __NEOPOPSOUND__
//=============================================================================
#ifdef __GP32__
#include "main.h"
#endif
#include "StdAfx.h"
typedef struct
{
int LastRegister; /* last register written */
int Register[8]; /* registers */
int Volume[4];
int Period[4];
int Count[4];
int Output[4];
unsigned int RNG; /* noise generator */
int NoiseFB; /* noise feedback mask */
} SoundChip;
//=============================================================================
extern SoundChip toneChip;
extern SoundChip noiseChip;
void WriteSoundChip(SoundChip* chip, _u8 data);
int sound_system_init();
BOOL system_sound_init(void);
void system_sound_chipreset(void);
//void system_sound_update(void);
void system_sound_update(int nframes);
void system_VBL(void);
#define Write_SoundChipTone(VALUE) (WriteSoundChip(&toneChip, VALUE))
#define Write_SoundChipNoise(VALUE) (WriteSoundChip(&noiseChip, VALUE))
//=============================================================================
//void dac_writeL(unsigned char);
//void dac_writeR(unsigned char);
void sound_init(int SampleRate);
extern BOOL mute;
void dac_update(_u16* dac_buffer, int length_bytes);
void sound_update(_u16* chip_buffer, int length_bytes);
#ifndef __GP32__
void increaseVolume();
void decreaseVolume();
#endif
//#define dac_writeL dac_write
//#define dac_writeR dac_write
void dac_writeL(unsigned char);
//void dac_writeR(unsigned char);
void dac_write(unsigned char);
//=============================================================================
#endif