| 1 |
// Part of SAASound copyright 1998-2018 Dave Hooper <[email protected]> |
| 2 |
// |
| 3 |
// This is the internal implementation (header file) of the SAASound object. |
| 4 |
// This is done so that the external interface to the object always stays the same |
| 5 |
// (SAASound.h) even though the internal object can change |
| 6 |
// .. Meaning future releases don't require relinking everyone elses code against |
| 7 |
// the updated saasound stuff |
| 8 |
// |
| 9 |
////////////////////////////////////////////////////////////////////// |
| 10 |
|
| 11 |
#ifndef SAAIMPL_H_INCLUDED |
| 12 |
#define SAAIMPL_H_INCLUDED |
| 13 |
|
| 14 |
#include "SAASound.h" |
| 15 |
#include "SAADevice.h" |
| 16 |
#ifdef USE_CONFIG_FILE |
| 17 |
#include "SAAConfig.h" |
| 18 |
#endif |
| 19 |
|
| 20 |
#if defined(DEBUGSAA) || defined(USE_CONFIG_FILE) |
| 21 |
#include <ios> |
| 22 |
#include <iostream> |
| 23 |
#include <fstream> |
| 24 |
|
| 25 |
#if defined(USE_CONFIG_FILE) |
| 26 |
const int CHANNEL_BUFFER_SIZE=1024; |
| 27 |
#endif |
| 28 |
#endif |
| 29 |
|
| 30 |
class CSAASoundInternal : public CSAASound |
| 31 |
{ |
| 32 |
private: |
| 33 |
CSAADevice m_chip; |
| 34 |
int m_uParam, m_uParamRate; |
| 35 |
unsigned int m_nClockRate; |
| 36 |
unsigned int m_nSampleRate; |
| 37 |
unsigned int m_nOversample; |
| 38 |
bool m_bHighpass; |
| 39 |
double filterout_z1_left_mixed, filterout_z1_right_mixed; |
| 40 |
#ifdef USE_CONFIG_FILE |
| 41 |
SAAConfig m_Config; |
| 42 |
#endif |
| 43 |
#if defined(DEBUGSAA) || defined(USE_CONFIG_FILE) |
| 44 |
unsigned int m_nDebugSample; |
| 45 |
std::ofstream m_dbgfile, m_pcmfile; |
| 46 |
#if defined(USE_CONFIG_FILE) |
| 47 |
std::ofstream m_channel_pcmfile[6]; |
| 48 |
BYTE m_pChannelBuffer[6][CHANNEL_BUFFER_SIZE]; |
| 49 |
#endif |
| 50 |
#endif |
| 51 |
|
| 52 |
public: |
| 53 |
CSAASoundInternal(); |
| 54 |
~CSAASoundInternal(); |
| 55 |
|
| 56 |
void SetClockRate(unsigned int nClockRate); |
| 57 |
void SetSampleRate(unsigned int nClockRate); |
| 58 |
void SetOversample(unsigned int nOversample); |
| 59 |
void SetSoundParameters(SAAPARAM uParam); |
| 60 |
void WriteAddress(BYTE nReg); |
| 61 |
void WriteData(BYTE nData); |
| 62 |
void WriteAddressData(BYTE nReg, BYTE nData); |
| 63 |
BYTE ReadAddress(void); |
| 64 |
void Clear(void); |
| 65 |
|
| 66 |
SAAPARAM GetCurrentSoundParameters(void); |
| 67 |
unsigned int GetCurrentSampleRate(void); |
| 68 |
static unsigned int GetSampleRate(SAAPARAM uParam); |
| 69 |
unsigned short GetCurrentBytesPerSample(void); |
| 70 |
static unsigned short GetBytesPerSample(SAAPARAM uParam); |
| 71 |
|
| 72 |
void GenerateMany(BYTE * pBuffer, unsigned int nSamples, DivDispatchOscBuffer** oscBuf); |
| 73 |
|
| 74 |
}; |
| 75 |
|
| 76 |
#endif // SAAIMPL_H_INCLUDED |