예제 #1
0
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();
}
예제 #2
0
void SoundPlayer::PlaySoundFile(const char* pFileName, Int32 nTimes)
{
    if (OpenAudioFile(pFileName))
    {
        m_pPlayer->Start();
        m_pPlayer->SetLoopTimes(nTimes);
    }
}
예제 #3
0
void test_save()
{
    printf("Test file save...\n");
	char* fn = GetNewAudioFileName(FALSE);	
	//char fn2[] = "/Users/stephentenniswood/SocketServer/TEST.wav";
	OpenAudioFile( fn );
	CloseAudioFile( );
}
예제 #4
0
Int32 SoundPlayer::GetFileBufferSize(const char* pszFilePath)
{
    Int32 nRet = -1;

    if (OpenAudioFile(pszFilePath))
    {
        nRet = m_pPlayer->GetDecodedAudioSize();
        m_pPlayer->Close();
    }

    return nRet;
}
예제 #5
0
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;
}