void CAL_SetupAudioFile (void) { bstone::FileStream handle; Sint32 length; char fname[13]; // // load maphead.ext (offsets and tileinfo for map file) // #ifndef AUDIOHEADERLINKED strcpy(fname,aheadname); strcat(fname,extension); handle.open(fname); if (!handle.is_open()) CA_CannotOpen(fname); length = static_cast<Sint32>(handle.get_size()); audiostarts = new Sint32[length / 4]; handle.read(audiostarts, length); handle.close(); #else audiohuffman = (huffnode *)&audiodict; CAL_OptimizeNodes (audiohuffman); audiostarts = (Sint32 *)FP_SEG(&audiohead); #endif // // open the data file // OpenAudioFile(); }
void SoundPlayer::PlaySoundFile(const char* pFileName, Int32 nTimes) { if (OpenAudioFile(pFileName)) { m_pPlayer->Start(); m_pPlayer->SetLoopTimes(nTimes); } }
void test_save() { printf("Test file save...\n"); char* fn = GetNewAudioFileName(FALSE); //char fn2[] = "/Users/stephentenniswood/SocketServer/TEST.wav"; OpenAudioFile( fn ); CloseAudioFile( ); }
Int32 SoundPlayer::GetFileBufferSize(const char* pszFilePath) { Int32 nRet = -1; if (OpenAudioFile(pszFilePath)) { nRet = m_pPlayer->GetDecodedAudioSize(); m_pPlayer->Close(); } return nRet; }
Int32 SoundPlayer::DecodeFile(void* buffer, Int32 bufferLen, const char* pszFilePath) { Int32 nRet = -1; UInt8* pBuffer = (UInt8*) buffer; if (OpenAudioFile(pszFilePath)) { nRet = m_pPlayer->DecodeAudioToBuffer(pBuffer, bufferLen, TMM_AUDIO_FILE_WAV); m_pPlayer->Close(); } return nRet; }