Warhorse ScripBind documentation
ContentsIndexHome
PreviousUpNext
PlaySound
Syntax
C++
int PlaySound(IFunctionHandler * pH);
Parameters 
Description 
sound 
Sound identifier. 
volumeScale 
Volume scale amount. 

Syntax: Sound.PlaySound(ISound *sound, float volumeScale) 

Plays a sound. 

! Load a streaming sound @param sSound filename of the sound @return nil or sound ID in case of success 

int CScriptBind_Sound::LoadStreamSoundLocalized(IFunctionHandler *pH) { if (pH->GetParamCount()<1 || pH->GetParamCount()>2) { m_pSS->RaiseError("System.LoadStreamSound wrong number of arguments"); return pH->EndFunction(); }; 

const char *sSound; // int nID; ISound *pSound; pH->GetParam(1,sSound); 

int nFlags=0; if (pH->GetParamCount()>1) pH->GetParam(2, nFlags); 

string szPath; 

ICVar *g_language = gEnv->pConsole->GetCVar("g_language"); assert(g_language); 

szPath = "LANGUAGES/"; szPath += g_language->GetString(); szPath += "/"; szPath += sSound; 

pSound = m_pSoundSystem->LoadSound(szPath.c_str(),FLAG_SOUND_STREAM | nFlags); if (pSound) { pSound->AddRef(); 

return pH->EndFunction(ScriptHandle(pSound)); } 

return pH->EndFunction(); 

////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ! Start playing a sound, loops is if enabled @param nID ID of the sound @see CScriptBind_Sound::SetSoundLoop

Copyright (c) 2012. All rights reserved.