Debian Codegraph @

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

raw
1 // Part of SAASound copyright 1998-2018 Dave Hooper <[email protected]>
2 //
3 // SAAFreq.h: interface for the CSAAFreq class.
4 // Note about Samplerates: 0=44100, 1=22050; 2=11025
5 //
6 //////////////////////////////////////////////////////////////////////
7
8 #ifndef SAAFREQ_H_INCLUDE
9 #define SAAFREQ_H_INCLUDE
10
11 #include "defns.h"
12
13 class CSAAFreq
14 {
15 private:
16 #ifdef SAAFREQ_FIXED_CLOCKRATE
17 // 'load in' the data for the static frequency lookup table
18 // precomputed for a fixed clockrate
19 // See: tools/freqdat.py
20 const static unsigned int m_FreqTable[2048];
21 #else
22 // we'll calculate the frequency lookup table at runtime.
23 unsigned int m_FreqTable[2048];
24 unsigned int m_nClockRate;
25 #endif
26
27 uint64_t m_nCounter;
28 uint64_t m_nAdd;
29 unsigned int m_nCounter_low;
30 unsigned int m_nOversample;
31 unsigned int m_nCounterLimit_low;
32 int m_nLevel;
33
34 int m_nCurrentOffset;
35 int m_nCurrentOctave;
36 int m_nNextOffset;
37 int m_nNextOctave;
38 bool m_bIgnoreOffsetData;
39 bool m_bNewData;
40 bool m_bSync;
41
42 uint64_t m_nSampleRate;
43 CSAANoise * const m_pcConnectedNoiseGenerator;
44 CSAAEnv * const m_pcConnectedEnvGenerator;
45 const int m_nConnectedMode; // 0 = nothing; 1 = envgenerator; 2 = noisegenerator
46
47 void UpdateOctaveOffsetData(void);
48 void SetAdd(void);
49
50 public:
51 CSAAFreq(CSAANoise * const pcNoiseGenerator, CSAAEnv * const pcEnvGenerator);
52 ~CSAAFreq();
53 void SetFreqOffset(BYTE nOffset);
54 void SetFreqOctave(BYTE nOctave);
55 void _SetSampleRate(unsigned int nSampleRate);
56 void _SetOversample(unsigned int oversample);
57 void _SetClockRate(int nClockRate);
58 void Sync(bool bSync);
59 int Tick(void);
60 int Level(void) const;
61
62 };
63
64 inline int CSAAFreq::Level(void) const
65 {
66 if (m_bSync)
67 return 1;
68
69 return m_nLevel;
70 }
71
72 #endif // SAAFREQ_H_INCLUDE