static mrb_value SimpleAudioEngine_playBackgroundMusic(mrb_state *mrb, mrb_value self) {
  mrb_value* args;
  int arg_count;
  mrb_get_args(mrb, "*", &args, &arg_count);
  if (arg_count == 1) {
    const char* p0 = mrb_string_value_ptr(mrb, args[0]);
    SimpleAudioEngine* instance = static_cast<SimpleAudioEngine*>(DATA_PTR(self));
    instance->playBackgroundMusic(p0);
    return mrb_nil_value();
  } else if (arg_count == 2) {
    const char* p0 = mrb_string_value_ptr(mrb, args[0]);
    bool p1 = get_bool(args[1]);
    SimpleAudioEngine* instance = static_cast<SimpleAudioEngine*>(DATA_PTR(self));
    instance->playBackgroundMusic(p0, p1);
    return mrb_nil_value();
  } else {
    mrb_raise(mrb, E_ARGUMENT_ERROR, "SimpleAudioEngine#playBackgroundMusic Wrong count of arguments.");
    return mrb_nil_value();
  }
}
Example #2
0
void MainScene::PlayStopBGM()
{
	SimpleAudioEngine* audio = SimpleAudioEngine::getInstance();
	if (audio->isBackgroundMusicPlaying())
	{
		audio->stopBackgroundMusic();
	}
	else
	{
		audio->playBackgroundMusic("musics/bgm.mp3");
	}
}
Example #3
0
void LoadingScene::preloadSounds()
{
    SimpleAudioEngine* audioEngine = SimpleAudioEngine::getInstance();
    audioEngine->stopBackgroundMusic();
    
    audioEngine->preloadEffect(EFFECT_SPACESHIP_CREATION);
    audioEngine->preloadEffect(EFFECT_BOOM_2);
    audioEngine->preloadEffect(EFFECT_BOOM);
    
    audioEngine->playBackgroundMusic(MUSIC_GAME);
    
}