예제 #1
0
PinSound *PinDirectSound::LoadWaveFile(TCHAR* strFileName)
{
    PinSound * const pps = new PinSound();

    // Create the sound buffer object from the wave file data
    if (FAILED(CreateStaticBuffer(strFileName, pps)))
    {
        ShowError("Could not create static sound buffer.");
        delete pps;
        return NULL;
        //SetFileUI( hDlg, TEXT("Couldn't create sound buffer.") ); 
    }
    else // The sound buffer was successfully created
    {
        // Fill the buffer with wav data
        FillBuffer(pps);

        // Update the UI controls to show the sound as the file is loaded
        //SetFileUI( hDlg, strFileName );
        //OnEnablePlayUI( hDlg, TRUE );
    }

    lstrcpy(pps->m_szPath, strFileName);

    TitleFromFilename(strFileName, pps->m_szName);

    lstrcpy(pps->m_szInternalName, pps->m_szName);

    CharLowerBuff(pps->m_szInternalName, lstrlen(pps->m_szInternalName));

    return pps;
}
예제 #2
0
int CDxSound::InitFile(const string& name)
{
	if(m_pDS==0) {
		return -1;
	}

	// Create the sound buffer object from the wave file data
	if(!CreateStaticBuffer(name.c_str()) )
	{   
		logOutput << "no such sound: " << name.c_str() << "\n";
		return -1;
	}

	waveid[name]=loadedSounds.size();
	buf2id.push_back(loadedSounds.size());
	SoundInfo* si=SAFE_NEW SoundInfo;
	si->firstBuf=buffers.size()-1;
	si->freebufs.push_back(buffers.size()-1);
	loadedSounds.push_back(si);

	return buffers.size()-1;
}
예제 #3
0
int CDxSound::InitFile(const string& name)
{
	if((m_pDS==0) || noSound)
		return -1;

	// Create the sound buffer object from the wave file data
	if( !CreateStaticBuffer(name.c_str()) )
	{        
		MessageBox(0,"Couldnt create sound buffer","Sound error",0);
		noSound=true;
		return -1;
	}

	waveid[name]=loadedSounds.size();
	buf2id.push_back(loadedSounds.size());
	SoundInfo* si=new SoundInfo;
	si->firstBuf=buffers.size()-1;
	si->freebufs.push_back(buffers.size()-1);
	loadedSounds.push_back(si);

	return buffers.size()-1;
}