///////////////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 1998 Active Voice Corporation. All Rights Reserved. // // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation. // // Other brand and product names used herein are trademarks of their respective owners. // // The entire program and user interface including the structure, sequence, selection, // and arrangement of the dialog, the exclusively "yes" and "no" choices represented // by "1" and "2," and each dialog message are protected by copyrights registered in // the United States and by international treaties. // // Protected by one or more of the following United States patents: 5,070,526, 5,488,650, // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054. // // Active Voice Corporation // Seattle, Washington // USA // ///////////////////////////////////////////////////////////////////////////////////////// //// // pcm.h - interface to pcm functions in pcm.c //// #ifndef __PCM_H__ #define __PCM_H__ #include "winlocal.h" #include "wavfmt.h" #define PCM_VERSION 0x00000100 // handle to pcm engine // DECLARE_HANDLE32(HPCM); // param in PcmFilter and PcmConvert // #define PCMFILTER_LOWPASS 0x00000001 #ifdef __cplusplus extern "C" { #endif // PcmInit - initialize pcm engine // (i) must be PCM_VERSION // (i) instance handle of calling module // (i) reserved; must be 0 // return handle (NULL if error) // HPCM DLLEXPORT WINAPI PcmInit(DWORD dwVersion, HINSTANCE hInst, DWORD dwFlags); // PcmTerm - shut down pcm engine // (i) handle returned from PcmInit // return 0 if success // int DLLEXPORT WINAPI PcmTerm(HPCM hPcm); // PcmReset - reset pcm engine // (i) handle returned from PcmInit // return 0 if success // int DLLEXPORT WINAPI PcmReset(HPCM hPcm); // PcmCalcSizBufSrc - calculate source buffer size // (i) handle returned from PcmInit // (i) size of destination buffer in bytes // (i) source wav format // (i) destination wav format // return source buffer size, -1 if error // long DLLEXPORT WINAPI PcmCalcSizBufSrc(HPCM hPcm, long sizBufDst, LPWAVEFORMATEX lpwfxSrc, LPWAVEFORMATEX lpwfxDst); // PcmCalcSizBufDst - calculate destination buffer size // (i) handle returned from PcmInit // (i) size of source buffer in bytes // (i) source wav format // (i) destination wav format // return destination buffer size, -1 if error // long DLLEXPORT WINAPI PcmCalcSizBufDst(HPCM hPcm, long sizBufSrc, LPWAVEFORMATEX lpwfxSrc, LPWAVEFORMATEX lpwfxDst); // PcmConvert - convert pcm data from one format to another // (i) handle returned from PcmInit // (i) buffer containing bytes to reformat // (i) size of buffer in bytes // (i) source wav format // (o) buffer to contain new format // (i) size of buffer in bytes // (i) destination wav format // (i) control flags // PCMFILTER_LOWPASS perform lowpass filter // return count of bytes in destination buffer (-1 if error) // // NOTE: the destination buffer must be large enough to hold the result // long DLLEXPORT WINAPI PcmConvert(HPCM hPcm, void _huge *hpBufSrc, long sizBufSrc, LPWAVEFORMATEX lpwfxSrc, void _huge *hpBufDst, long sizBufDst, LPWAVEFORMATEX lpwfxDst, DWORD dwFlags); // Pcm16To8 - convert 16-bit samples to 8-bit samples // (i) handle returned from PcmInit // (i) buffer of source samples // (o) buffer to hold destination samples // (i) count of source samples to convert // return 0 if success // int DLLEXPORT WINAPI Pcm16To8(HPCM hPcm, LPPCM16 lppcm16Src, LPPCM8 lppcm8Dst, UINT uSamples); // Pcm8To16 - convert 8-bit samples to 16-bit samples // (i) handle returned from PcmInit // (i) buffer of source samples // (o) buffer to hold destination samples // (i) count of source samples to convert // return 0 if success // int DLLEXPORT WINAPI Pcm8To16(HPCM hPcm, LPPCM8 lppcm8Src, LPPCM16 lppcm16Dst, UINT uSamples); // PcmFilter - filter pcm samples // (i) handle returned from PcmInit // (i) buffer of source samples // (o) buffer to hold destination samples // (i) count of source samples to filter // (i) control flags // PCMFILTER_LOWPASS perform a low pass filter // return 0 if success // // NOTE: and can point to the same buffer // int DLLEXPORT WINAPI PcmFilter(HPCM hPcm, LPPCM16 lppcm16Src, LPPCM16 lppcm16Dst, UINT uSamples, DWORD dwFlags); // PcmResample - resample pcm samples // (i) handle returned from PcmInit // (i) buffer of source samples // (i) sample rate of source samples // (o) buffer to hold destination samples // (i) sample rate of destination samples // (i) count of source samples to resample // (i) control flags // 0 reserved, must be zero // return count of samples in destination buffer (0 if error) // // NOTE: the destination buffer must be large enough to hold the result. // Call PcmResampleCalcDstMax() to calculate max destination samples // UINT DLLEXPORT WINAPI PcmResample(HPCM hPcm, LPPCM16 lppcm16Src, long nSamplesPerSecSrc, LPPCM16 lppcm16Dst, long nSamplesPerSecDst, UINT uSamples, DWORD dwFlags); #ifdef __cplusplus } #endif #endif // __PCM_H__