/*************************************************************************/ /* Speicher, Laden und Erzeugen von WAV und PCM Dateien /* /* Datum : 27.03.2002 /* Autor : Jens Ahrensfeld /* Datei : wav.h /* /*************************************************************************/ #ifndef AVWAV_H #define AVWAV_H #include #define bs 18 #define WAVE_FORMAT_PCM 1 #define FILETYPE_RAW 0 #define FILETYPE_WAV 1 /******************************************************************************/ typedef struct _sWAVEHEADER { uint16_t wFormatTag; uint16_t nChannels; uint32_t nSamplesPerSec; uint32_t nAvgBytesPerSec; uint16_t nBlockAlign; uint16_t wBitsPerSample; uint16_t cbSize; } WAVEHEADER; /******************************************************************************/ typedef struct _sWAV { char m_Name[257]; WAVEHEADER m_Format; uint32_t m_DataSize, m_FileSize, m_HeaderSize, m_FileType, m_numSamples; FILE *pHndWavFile; uint32_t WREAD; uint16_t m_nChannels; uint32_t m_SampleRate; uint16_t m_nBits; } WAV; /******************************************************************************/ /* Global Functions /******************************************************************************/ #ifdef __cplusplus extern "C" { #endif void WavInit(struct _sWAV*, uint32_t nSamplesPerSec, uint16_t nBits, uint16_t nChannels, uint16_t format); uint32_t WavSetFormat(struct _sWAV*, uint32_t, uint16_t, uint16_t, uint16_t format); uint32_t WavOpen (struct _sWAV*, char*); uint32_t WavCreate(struct _sWAV*, char*, uint32_t); uint32_t WavClose(struct _sWAV*); uint32_t WavRead(struct _sWAV*, void*, uint32_t); uint32_t WavWrite(struct _sWAV*, void*, uint32_t); uint32_t ReadHeader(struct _sWAV*); uint32_t WriteHeader(struct _sWAV*); uint16_t WavGetnBits(struct _sWAV *pObj); uint32_t WavGetRate(struct _sWAV *pObj); uint16_t WavGetnChannels(struct _sWAV *pObj); char* WavGetFileName(struct _sWAV *pObj); void WavDeIlvd(struct _sWAV *pObj, int16_t *pIn, int16_t **ppOut, uint32_t len); void WavDeIlvdDouble(struct _sWAV *pObj, int16_t *pIn, double **ppOut, uint32_t len); void WavDeIlvdFloat(struct _sWAV *pObj, int16_t *pIn, float **ppOut, uint32_t len); void WavIlvd(struct _sWAV *pObj, int16_t **ppIn, int16_t *pOut, uint32_t len); void WavIlvdDouble(struct _sWAV *pObj, double **ppIn, int16_t *pOut, uint32_t len); void WavIlvdFloat(struct _sWAV *pObj, float **ppIn, int16_t *pOut, uint32_t len); #ifdef __cplusplus } #endif #endif /* AVWAV_H */