Métodos públicos estáticos | |
| static bool | openDevice () |
| static Sound * | openSound (string &filename, bool stream, int type=(int) SNDTYPE_SOUND) |
| static void | closeSounds () |
| static void | setSoundActive (bool active) |
| static bool | getSoundActive () |
| static void | setGlobalVolume (float volume) |
| static float | getGlobalVolume () |
| static void | setSoundVolume (float volume) |
| static float | getSoundVolume () |
| static void | setMusicVolume (float volume) |
| static float | getMusicVolume () |
| static bool | RegisterSoundMgr (char *className=NULL) |
Amigas | |
| class | Game |
bool TestGame::OnInit() { // Intentamos inicializar el // dispositivo de sonido if (!SoundMgr::openDevice()) return false; // Abrimos un archivo de música // en caso de error, el método // retornará NULL _music = SoundMgr::openSound("./data/machinae_supremacy_-_steves_quest.mp3", true); // Si hubo algún error, // retornamos false if (!_music) { return false; } // Indicamos que deseamos que // se repita indefinidamente _music->setRepeat(true); // Corremos la música _music->play(); // Abrimos un nuevo sonido _sound = SoundMgr::openSound("./data/Bubble.wav", false); // Verificamos si hubo algún error if (!_sound) { return false; } // Indicamos que no deseamos que // se repita _sound->setRepeat(false); // Indicamos el volumen al máximo // para todos los sonidos SoundMgr::setGlobalVolume(0.5f); return true; } void TestGame::OnFrame() { if (KeyDown(DIK_ESCAPE)) PostQuitMessage(0); // Si mantenemos presionada la tecla S // y el sonido no se está reproduciendo // lo reproducimos de nuevo if (KeyPressed(DIK_S) && !_sound->isPlaying()) { _sound->stop(); _sound->play(); } // Si presionamos P pausaremos y // volveremos a reproducir la música if (KeyDown(DIK_P)) { if(_music->isPlaying()) { _music->pause(); } else { _music->play(); } } // Si presionamos la barra espaciadora // cortaremos la reproduccion de la música // y volveremos a iniciarla if (KeyDown(DIK_SPACE)) { if(_music->isPlaying()) { _music->stop(); } else { _music->play(); } } } bool TestGame::OnShutdown() { SoundMgr::closeSound(_music); SoundMgr::closeSound(_sound); return true; }
| bool zak::SoundMgr::openDevice | ( | ) | [static] |
Inicializa el controlador de sonido
| Sound * zak::SoundMgr::openSound | ( | string & | filename, | |
| bool | stream, | |||
| int | type = (int) SNDTYPE_SOUND | |||
| ) | [static] |
Abre un nuevo sonido
| filename | nombre del archivo a abrir | |
| stream | si deseamos que se reproduzca por streaming o no | |
| type | Tipo del sonido (efecto sonoro y música). |
| void zak::SoundMgr::closeSounds | ( | ) | [static] |
Destruye el sonido pasado por parámetro
| sound | sonido que se desea destruir |
| static void zak::SoundMgr::setSoundActive | ( | bool | active | ) | [inline, static] |
Permite indicar si el sonido está activo o no
| active | indicar si el sonido está activo o no |
| static bool zak::SoundMgr::getSoundActive | ( | ) | [inline, static] |
Devuelve si el sonido está activo o no
| void zak::SoundMgr::setGlobalVolume | ( | float | volume | ) | [static] |
Permite indicar el volumen global para todos los sonidos
| volume | volumen global de los sonidos (entre 0.0f y 1.0f) |
| static float zak::SoundMgr::getGlobalVolume | ( | ) | [inline, static] |
Devuelve el volumen global para todos los sonidos
| void zak::SoundMgr::setSoundVolume | ( | float | volume | ) | [static] |
Permite indicar el volumen para los efectos sonoros
| volume | volumen de los sonidos (entre 0.0f y 1.0f) |
| static float zak::SoundMgr::getSoundVolume | ( | ) | [inline, static] |
Devuelve el volumen de los efectos sonoros
| void zak::SoundMgr::setMusicVolume | ( | float | volume | ) | [static] |
Permite indicar el volumen para la música
| volume | volumen de la música (entre 0.0f y 1.0f) |
| static float zak::SoundMgr::getMusicVolume | ( | ) | [inline, static] |
Devuelve el volumen de la música
1.5.1-p1