142d5044665b4c50ff5276cec8255950f7c0cd1d
[fceu.git] / sound.h
1 /* FCE Ultra - NES/Famicom Emulator
2  *
3  * Copyright notice for this file:
4  *  Copyright (C) 2002 Ben Parnell
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #define OVERSAMPLESHIFT 4
22 #define OVERSAMPLE *16
23 #define SND_BUFSIZE 256
24
25
26 typedef struct {
27            void (*Fill)(int Count);
28            void (*RChange)(void);
29            void (*Kill)(void);
30
31            // from 0.98.15, currently unused
32            void (*NeoFill)(int32 *Wave, int Count);
33            void (*HiFill)(void);
34            void (*HiSync)(int32 ts);
35 } EXPSOUND;
36
37 extern EXPSOUND GameExpSound;
38
39 //extern int64 nesincsizeLL;
40 extern int32 nesincsize;
41 extern uint8 PSG[0x18];
42 extern uint32 PSG_base;
43 extern int32 PCMIRQCount;
44
45 extern void (*SetSoundVariables)(void);
46
47 void SetSoundVariables081(void);
48 void PowerSound(void);
49 void ResetSound(void);
50 extern uint8 decvolume[];
51
52 extern int vdis;
53 extern uint8 sqnon;
54 extern uint16 nreg;
55
56 extern uint8 trimode;
57 extern uint8 tricoop;
58 extern uint8 PCMBitIndex;
59 extern uint32 PCMAddressIndex;
60 extern int32 PCMSizeIndex;
61 extern uint8 PCMBuffer;
62
63 extern uint8 sweepon[2];
64 extern int32 curfreq[2];
65
66 extern uint8 SweepCount[2];
67 extern uint8 DecCountTo1[3];
68
69 extern uint8 fcnt;
70 extern int32 fhcnt;
71 extern int32 fhinc;
72
73 uint8 FCEU_GetJoyJoy(void);
74
75 int GetSoundBuffer(int16 **W);
76 int FlushEmulateSound(void);
77 extern uint32 Wave[2048+512];
78 extern int16 WaveFinalMono[2048+512];
79 extern uint32 soundtsinc;
80
81 extern uint32 soundtsoffs;
82 #define SOUNDTS (timestamp + soundtsoffs)
83
84 void SetNESSoundMap(void);
85 void FrameSoundUpdate(void);
86 void FixOldSaveStateSFreq(void);
87