本文整理汇总了C++中fmod::Sound::release方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::release方法的具体用法?C++ Sound::release怎么用?C++ Sound::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::Sound
的用法示例。
在下文中一共展示了Sound::release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnregisterMusic
void USwFMOD::UnregisterMusic( UMusic* Music )
{
guard(USwFMOD::UnregisterMusic);
//SWF_LOG( NAME_DevSound, TEXT("%s -- %s :: [%s]"), SWF_LOGP, *ToStr(Music) );
FMOD_RESULT result;
check(Music);
if( Music->Handle )
{
SWF_LOG( NAME_DevSound, TEXT("Unregister music: %s"), Music->GetFullName() );
// Stop this sound.
FMOD::Sound* sound = GetMusicSample(Music);
if( sound )
{
SWF_FMOD_CALL( sound->setUserData(NULL) );
SWF_FMOD_CALL( sound->release() );
}
// Reset handle
Music->Handle = NULL;
// Unload
Music->Data.Unload();
}
unguard;
}
示例2: UnregisterSound
void USwFMOD::UnregisterSound( USound* Sound )
{
guard(USwFMOD::UnregisterSound);
//SWF_LOG( NAME_DevSound, TEXT("%s -- %s :: [%s]"), SWF_LOGP, *ToStr(Sound) );
FMOD_RESULT result;
check(Sound);
if( Sound->Handle )
{
SWF_LOG( NAME_DevSound, TEXT("Unregister sound: %s"), Sound->GetFullName() );
// Stop this sound.
FMOD::Sound* sound = GetSoundSample(Sound);
if( sound )
{
SWF_FMOD_CALL( sound->setUserData(NULL) );
SWF_FMOD_CALL( sound->release() );
}
// Reset handle
Sound->Handle = NULL;
}
unguard;
}
示例3: playEnvironment
int Game::playEnvironment()
{
bool soundDone=false;
FMOD::System* system;
FMOD_RESULT result = FMOD::System_Create(&system);
system->init(32, FMOD_INIT_NORMAL, NULL);
FMOD::Sound* sound;
result = system->createSound("Ocean.WAV",FMOD_LOOP_NORMAL,NULL, &sound);
FMOD::Channel* channel = 0;
bool pauseSound = false;
channel->isPlaying(&pauseSound);
result = system->playSound(FMOD_CHANNEL_FREE, sound,false, &channel);
soundDone=true;
while (soundDone!=true)
{
channel->setPaused(false);
system->update();
result = sound->release();
result = system->close();
result = system->release();
}
return 0;
}
示例4:
FMOD::Sound *SoundManager::CreatePlayList(std::string &fileName)
{
FMOD_RESULT result;
FMOD::Sound *playlist;
std::string fullPathName;
bool isPlayList = false;
FMOD_SOUND_TYPE soundType;
fullPathName = SOUND_DIRECTORY + fileName;
result = system->createSound(fullPathName.c_str(), FMOD_DEFAULT, 0, &playlist);
if(result != FMOD_OK)
{
Ogre::LogManager::getSingleton().logMessage(
"SoundManager::CreateSound could not load sound '" + fileName + "' (invalid soundType)");
return NULL;
}
result = playlist->getFormat(&soundType,0,0,0);
isPlayList = (soundType == FMOD_SOUND_TYPE_PLAYLIST);
if(isPlayList)
{
return playlist;
}
else
{
playlist->release();
return NULL;
}
}
示例5: programmerSoundCallback
FMOD_RESULT F_CALLBACK programmerSoundCallback(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE* event, void *parameters)
{
FMOD::Studio::EventInstance* eventInstance = (FMOD::Studio::EventInstance*)event;
if (type == FMOD_STUDIO_EVENT_CALLBACK_CREATE_PROGRAMMER_SOUND)
{
FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES* props = (FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES*)parameters;
// Get our context from the event instance user data
ProgrammerSoundContext* context = NULL;
CHECK_RESULT( eventInstance->getUserData((void**)&context) );
// Create the sound
FMOD::Sound* sound = NULL;
CHECK_RESULT( context->system->createSound(context->soundName, FMOD_CREATECOMPRESSEDSAMPLE | FMOD_NONBLOCKING, NULL, &sound) );
// Pass the sound to FMOD
props->sound = (FMOD_SOUND*)sound;
}
else if (type == FMOD_STUDIO_EVENT_CALLBACK_DESTROY_PROGRAMMER_SOUND)
{
FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES* props = (FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES*)parameters;
// Obtain the sound
FMOD::Sound* sound = (FMOD::Sound*)props->sound;
// Release the sound
CHECK_RESULT( sound->release() );
}
return FMOD_OK;
}
示例6: _ObtenerTiempoCancion
UINT64 InformacionArchivoEx::_ObtenerTiempoCancion(const TCHAR *Path, FMOD::System *InstanciaFMOD) {
UINT Milisegundos = 0;
FMOD::Sound *Stream;
InstanciaFMOD->createStream(reinterpret_cast<const char *>(Path), FMOD_OPENONLY | FMOD_UNICODE, 0, &Stream);
Stream->getLength(&Milisegundos, FMOD_TIMEUNIT_MS);
FMOD_RESULT R = Stream->release();
return Milisegundos;
}
示例7: ReleaseSound
bool cgFMODSoundPlayerImpl::ReleaseSound( cgID sound )
{
FMOD::Sound * pkSound = m_pkSoundStorage->Remove(sound);
if (!pkSound)
return false;
pkSound->release();
return true;
}
示例8: _ObtenerTiempoCancionCDAudio
UINT64 InformacionArchivoEx::_ObtenerTiempoCancionCDAudio(const TCHAR *Path, FMOD::System *InstanciaFMOD) {
char Letra[3];
Letra[0] = static_cast<char>(Path[0]);
Letra[1] = ':';
Letra[2] = '\0';
UINT Milisegundos = 0;
FMOD::Sound *Stream = NULL;
FMOD::Sound *PistaCD = NULL;
FMOD_RESULT Error = InstanciaFMOD->createStream(Letra, FMOD_OPENONLY, 0, &Stream);
if (Stream != NULL) {
Stream->getSubSound(InfoPath.Pista - 1, &PistaCD); // no s'identifica la pista en els cds d'audio posible error en funcio Info
if (PistaCD != NULL) {
PistaCD->getLength(&Milisegundos, FMOD_TIMEUNIT_MS);
PistaCD->release();
Stream->release();
}
}
return Milisegundos;
}
示例9: uncache
void AudioEngineImpl::uncache(const std::string& path){
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
std::map<std::string, FMOD::Sound *>::const_iterator it = mapSound.find(fullPath);
if(it!=mapSound.end()){
FMOD::Sound * sound = it->second;
if(sound){
sound->release();
}
mapSound.erase(it);
}
};
示例10: clearLocalSounds
void SoundManager::clearLocalSounds()
{
#ifdef BBGE_BUILD_FMODEX
for (LocalSounds::iterator i = localSounds.begin(); i != localSounds.end(); i++)
{
std::string snd = (*i);
debugLog("unloading sound [" + snd + "]");
FMOD::Sound *samp = (FMOD::Sound*)soundMap[snd];
samp->release();
soundMap[snd] = 0;
}
localSounds.clear();
#endif
}
示例11: unloadEffect
void FmodAudioPlayer::unloadEffect(const char* pszFilePath) {
FMOD::Sound* pSound;
pSystem->update();
map<string, FMOD::Sound*>::iterator l_it = mapEffectSound.find(
string(pszFilePath));
if (l_it == mapEffectSound.end()) {
//no load yet
return;
}
pSound = l_it->second;
//release the sound;
pSound->release();
//delete from the map
mapEffectSound.erase(string(pszFilePath));
}
示例12: playSound
int Game::playSound(bool Sound)
{
bool soundDone= false;
//declare variable for FMOD system object
FMOD::System* system;
//allocate memory for the FMOD system object
FMOD_RESULT result = FMOD::System_Create(&system);
//initialize the FMOD system object
system->init(32, FMOD_INIT_NORMAL, NULL);
//declare variable for the sound object
FMOD::Sound* sound;
//created sound object and specify the sound
result = system->createSound("Cathedral_of_Light.mp3",FMOD_LOOP_NORMAL,NULL, &sound);
// play sound - 1st parameter can be combined flags (| separator)
FMOD::Channel* channel = 0;
//start sound
bool pauseSound=false;
channel->isPlaying(&pauseSound);
result = system->playSound(FMOD_CHANNEL_FREE, sound, Sound, &channel);
soundDone=true;
while (soundDone!=true)
{
channel->setPaused(false);
system->update();
//}
// release resources
result = sound->release();
result = system->close();
result = system->release();
}
return 0;
}
示例13: loadPlaylist
void SoundManager::loadPlaylist(std::string filename)
{
FMOD::Sound* playlist;
mSystem->createSound(filename.c_str(), FMOD_DEFAULT, 0, &playlist);
FMOD_SOUND_TYPE type;
playlist->getFormat(&type, 0, 0, 0);
if(type != FMOD_SOUND_TYPE_PLAYLIST)
{
printf("%s, wasn't a playlist! Make sure it exists and it's in .m3u format.\n", filename.c_str());
return;
}
printf("loading playlist %s\n", filename.c_str());
int count = 0;
FMOD_TAG tag;
result = FMOD_OK;
//go through the m3u file and extract the playlist info
result = playlist->getTag("FILE", count, &tag);
while(result == FMOD_OK)
{
unsigned int trackTime = 0;
FMOD::Sound* music; //attempt to load the song
result = mSystem->createSound((char*)tag.data, FMOD_CREATESTREAM | FMOD_SOFTWARE | FMOD_2D, 0, &music);
//if we successfully found the file, get its length and close it
if(result == FMOD_OK)
{
music->getLength(&trackTime, FMOD_TIMEUNIT_MS);
music->release();
PlayListEntry p(std::string((char*)tag.data), 0.001 * trackTime + 2.f);
mPlayList.push_back(p);
// printf("our file is...%s at %f seconds\n", p.filename.c_str(), p.trackTime);
}
else printf("%s not found, but is listed in the playlist\n", (char*)tag.data);
count++;
//check to see if we have another file in the playlist
result = playlist->getTag("FILE", count, &tag);
}
mUsePlayList = true;
}
示例14: stopAudio
void AudioVisualizerApp::stopAudio()
{
FMOD_RESULT err;
mIsAudioPlaying = false;
if( !mFMODChannel || !mFMODSound )
return;
// we don't want to be notified of channel events any longer
mFMODChannel->setCallback( 0 );
bool isPlaying;
err = mFMODChannel->isPlaying( &isPlaying );
if( isPlaying )
err = mFMODChannel->stop();
err = mFMODSound->release();
mFMODSound = nullptr;
mFMODChannel = nullptr;
}
示例15:
SoundManager::~SoundManager()
{
// release
if (!enabled) return;
for (SoundMap::iterator i = soundMap.begin(); i != soundMap.end(); i++)
{
std::string snd = (*i).first;
debugLog("unloading sound [" + snd + "]");
#ifndef BBGE_DISABLE_SOUND_CACHE
FMOD::Sound *samp = (FMOD::Sound*)((*i).second);
samp->release();
#else
SoundInfo *info = (SoundInfo*)((*i).second);
delete info;
#endif
}
soundMap.clear();
#ifdef BBGE_BUILD_FMODEX
SoundCore::system->release();
#endif
}