#include #include #include #include #include #include #include void DumpSamplesWORD(PureSampleEx &pureSample); void main() { String wavePathFileName3="f:\\AudioBounce.wav"; // int length = sizeof(SampleData); // length = sizeof(int); // 4 BYTES 32 BITS // length = sizeof(BYTE); // 1 BYTE 8 BITS // length = sizeof(DWORD); // 4 BYTES 32 BITS // length = sizeof(WORD); // 2 BYTES 16 BITS SmartPointer waveForm(::new WaveForm(wavePathFileName3),PointerDisposition::Delete); ::OutputDebugString((*waveForm).toString()); PureSampleEx &pureSample=waveForm->getPureSample(); DWORD sizeBytes=pureSample.getSizeBytes(); DWORD numSamples=pureSample.getNumSamples(); PureSampleEx::BitsPerSample bitsPerSample=pureSample.getBitsPerSample(); switch(bitsPerSample) { case PureSampleEx::Bit4 : break; case PureSampleEx::Bit8 : break; case PureSampleEx::Bit16 : DumpSamplesWORD(pureSample); break; case PureSampleEx::Bit32 : break; } //BitsPerSample{Bit4=4,Bit8=8,Bit16=16,Bit32=32}; SmartPointer pureWave(new PureWave(),PointerDisposition::Delete); pureWave->play(*waveForm); ::OutputDebugString("Here"); } void DumpSamplesWORD(PureSampleEx &pureSample) { String crlf("\r\n"); SmartPointer outFile(::new FileHandle("c:\\work\\proto\\debug\\samples.csv",FileHandle::Access::Write,FileHandle::Share::ShareNone,FileHandle::Mode::Create), PointerDisposition::Delete); outFile.disposition(PointerDisposition::Disposition::Delete); outFile->disposition(FileHandle::Disposition::CloseHandle); WORD *pSampleDataWORD=(WORD*)pureSample.getSampleData(); DWORD numSamples=pureSample.getNumSamples(); outFile->write("Index,Sample"); outFile->write(crlf); for(long index=0;index sb(::new StringBuffer(),PointerDisposition::Delete); sb->append(String().fromInt(index+1)); sb->append(","); sb->append(String().fromUShort(pSampleDataWORD[index])); sb->append(crlf); outFile->write(sb->toString()); } outFile->flush(); outFile->close(); } /* // (*waveForm).save("c:\\work\\exe\\DSPDIEHI_2.WAV"); // WaveForm *pWaveForm = new WaveForm(wavePathFileName); // PureWave *pPureWave = new PureWave(); // pPureWave->play(*pWaveForm); // ::delete[] pWaveForm; // ::delete[] pPureWave; // String wavePathFileName="c:\\work\\exe\\DSPDIEHI.WAV"; // String wavePathFileName2="C:\\Program Files\\Activision\\A-10Cuba\\Media\\Afterburner.wav"; // SmartPointer waveForm(new WaveForm(wavePathFileName),PointerDisposition::Delete); // ::OutputDebugString((*waveForm).toString()); // waveForm.destroy(); // waveForm=new WaveForm(wavePathFileName2); // waveForm.disposition(PointerDisposition::Delete); // waveForm->save("c:\\work\\exe\\Afterburner.WAV"); // ::OutputDebugString((*waveForm).toString()); // SimpleObject *pSimpleObject; // pSimpleObject=::new SimpleObject(vector3D,(Ship<<16)|pureObjects.size()); */