Exemplo n.º 1
0
  void Sound::set_BGM(const String &filename) {
    Sound_Source &bgm_source = get_BGM_Source();

    bool playing = bgm_source.is_playing() ? true : false;

    bgm_source.stop();
    bgm_source.set_buffer(get_Hello_World_Buffer());
    delete m_bgm;
    m_bgm = 0;

    m_bgmusic = filename;
    m_bgm = new Sound_Buffer(m_bgmusic);
    bgm_source.set_buffer(*m_bgm);
    bgm_source.set_time(0.0f);

    if(playing)
      bgm_source.play();
  }
  void Sound::set_BGM(const string &
#ifndef DISABLE_AL
    filename
#endif
    ) {
#ifndef DISABLE_AL
    assert_m_bgm();

    bool playing = m_bgm_source->is_playing() ? true : false;

    m_bgm_source->stop();
    m_bgm_source->set_buffer(get_Hello_World_Buffer());
    delete m_bgm;
    m_bgm = 0;

    m_bgmusic = filename;
    m_bgm = new Sound_Buffer(m_bgmusic);
    m_bgm_source->set_buffer(*m_bgm);
    m_bgm_source->set_time(0.0f);

    if(playing)
      m_bgm_source->play();
#endif
  }