Debian Codegraph @

android/app/jni/extern/SAASound/src/SAASound.h

raw
1 // Part of SAASound copyright 1998-2018 Dave Hooper <[email protected]>
2 //
3 // SAASound.h: interface for the CSAASound class.
4 //
5 // This corresponds to the public (exported) DLL interface, so all
6 // APIs and client factory methods beint here.
7 //
8 // Compatibility notes : the intention is for this to be fully backwards
9 // compatible across minor and patch versions. Any backwards breaking changes
10 // should be reflected as a major version increment. New functionality can be added
11 // in minor versions so int as backwards compatiblity is maintained
12 //
13 // Version 3.3.0 (4th Dec 2018)
14 //
15 //////////////////////////////////////////////////////////////////////
16
17 #ifndef SAASOUND_H_INCLUDED
18 #define SAASOUND_H_INCLUDED
19
20 // define this if you want to output diagnostic text and PCM files
21 //#define DEBUGSAA
22
23 // Parameters for use with SetSoundParameters, for example,
24 // SetSoundParameters(SAAP_NOFILTER | SAAP_44100 | SAA_16BIT | SAA_STEREO);
25 // SAAP_FILTER_HIGHPASS_SIMPLE can be ORd with SAAP_FILTER_OVERSAMPLE64x/2x
26 #define SAAP_FILTER_HIGHPASS_SIMPLE 0x00000400
27 #define SAAP_FILTER_OVERSAMPLE64x 0x00000300
28 #define SAAP_FILTER_OVERSAMPLE2x 0x00000200
29 #define SAAP_FILTER SAAP_FILTER_OVERSAMPLE2x
30 #define SAAP_NOFILTER 0x00000100
31 #define SAAP_44100 0x00000030
32 #define SAAP_22050 0x00000020
33 #define SAAP_11025 0x00000010
34 #define SAAP_16BIT 0x0000000c
35 #define SAAP_8BIT 0x00000004
36 #define SAAP_STEREO 0x00000003
37 #define SAAP_MONO 0x00000001
38
39 // Bitmasks for use with GetCurrentSoundParameters, for example,
40 // unsigned int CurrentSampleRateParameter = GetCurrentSoundParameters()
41 #define SAAP_MASK_FILTER 0x00000f00
42 #define SAAP_MASK_FILTER_HIGHPASS 0x00000c00
43 #define SAAP_MASK_FILTER_OVERSAMPLE 0x00000300
44 #define SAAP_MASK_SAMPLERATE 0x000000030
45 #define SAAP_MASK_BITDEPTH 0x0000000c
46 #define SAAP_MASK_CHANNELS 0x00000003
47
48 typedef unsigned int SAAPARAM;
49
50
51 #ifndef BYTE
52 #define BYTE unsigned char
53 #endif
54
55 #ifdef _WIN32
56 #define SAAAPI __stdcall
57 #else
58 #define SAAAPI
59 #endif
60
61
62 #ifdef __cplusplus
63
64 #include "../../src/engine/dispatch.h"
65
66 class CSAASound
67 {
68 public:
69 virtual ~CSAASound() { }
70
71 virtual void SetSoundParameters (SAAPARAM uParam) = 0;
72 virtual void WriteAddress (BYTE nReg) = 0;
73 virtual void WriteData (BYTE nData) = 0;
74 virtual void WriteAddressData (BYTE nReg, BYTE nData) = 0;
75 virtual void Clear () = 0;
76 virtual BYTE ReadAddress () = 0;
77
78 virtual SAAPARAM GetCurrentSoundParameters () = 0;
79 virtual unsigned int GetCurrentSampleRate () = 0;
80 static unsigned int GetSampleRate (SAAPARAM uParam);
81 virtual unsigned short GetCurrentBytesPerSample () = 0;
82 static unsigned short GetBytesPerSample (SAAPARAM uParam);
83
84 virtual void GenerateMany (BYTE * pBuffer, unsigned int nSamples, DivDispatchOscBuffer** oscBuf) = 0;
85
86 virtual void SetClockRate(unsigned int nClockRate) = 0;
87 virtual void SetSampleRate(unsigned int nSampleRate) = 0;
88 virtual void SetOversample(unsigned int nOversample) = 0;
89 };
90
91 typedef class CSAASound * LPCSAASOUND;
92
93 LPCSAASOUND SAAAPI CreateCSAASound(void);
94 void SAAAPI DestroyCSAASound(LPCSAASOUND object);
95
96 #endif // __cplusplus
97
98
99 #ifdef __cplusplus
100 extern "C" {
101 #endif
102
103 typedef void * SAASND;
104
105 // "C-style" interface for the CSAASound class
106 SAASND SAAAPI newSAASND(void);
107 void SAAAPI deleteSAASND(SAASND object);
108
109 void SAAAPI SAASNDSetSoundParameters(SAASND object, SAAPARAM uParam);
110 void SAAAPI SAASNDWriteAddress(SAASND object, BYTE nReg);
111 void SAAAPI SAASNDWriteData(SAASND object, BYTE nData);
112 void SAAAPI SAASNDWriteAddressData(SAASND object, BYTE nReg, BYTE nData);
113 void SAAAPI SAASNDClear(SAASND object);
114
115 SAAPARAM SAAAPI SAASNDGetCurrentSoundParameters(SAASND object);
116 unsigned short SAAAPI SAASNDGetCurrentBytesPerSample(SAASND object);
117 unsigned short SAAAPI SAASNDGetBytesPerSample(SAAPARAM uParam);
118 unsigned int SAAAPI SAASNDGetCurrentSampleRate(SAASND object);
119 unsigned int SAAAPI SAASNDGetSampleRate(SAAPARAM uParam);
120
121 void SAAAPI SAASNDGenerateMany(SAASND object, BYTE * pBuffer, unsigned int nSamples);
122 void SAAAPI SAASNDSetClockRate(SAASND object, unsigned int nClockRate);
123 void SAAAPI SAASNDSetSampleRate(SAASND object, unsigned int nSampleRate);
124 void SAAAPI SAASNDSetOversample(SAASND object, unsigned int nOversample);
125
126
127 #ifdef __cplusplus
128 }; // extern "C"
129 #endif
130
131 #endif // SAASOUND_H_INCLUDED