예제 #1
0
void AudiereMusicInterface::PlayMusic(int theSongId, int theOffset, bool noLoop)
{
    AudiereMusicMap::iterator anItr = mMusicMap.find(theSongId);
    if (anItr != mMusicMap.end())
    {
        AudiereMusicInfo* aMusicInfo = &anItr->second;
        aMusicInfo->mVolume = aMusicInfo->mVolumeCap;
        aMusicInfo->mVolumeAdd = 0.0f;

        if (aMusicInfo->mStream) {
            OutputStreamPtr aStream = aMusicInfo->mStream;
            aStream->setVolume(float(mMasterVolume * aMusicInfo->mVolume));
            aStream->setRepeat(!noLoop);
            if (theOffset != 0)
                aStream->setPosition(theOffset);
            aStream->play();
        }
        else if (aMusicInfo->mMIDIStream) {
            MIDIStreamPtr aStream = aMusicInfo->mMIDIStream;
            aStream->setRepeat(!noLoop);
            if (theOffset != 0)
                aStream->setPosition(theOffset);
            aStream->play();
        }
    }
}
예제 #2
0
void PlaySong(const std::string& filename)
{
	// Since this file is background music, we don't need to load the
	// whole thing into memory.
	std::string soundpath = FilePathMgr::Instance().GetSoundPath() + filename;
	g_currSong = OpenSound(g_device, soundpath.c_str(), true);
	if (!g_currSong)
	{
		assert(false);
	}

	// Great, we have some opened streams!  What do we do with them?
	// let's start the background music first
	g_currSong->setRepeat(true);
	g_currSong->setVolume(g_volume);
	g_currSong->play();	
}
예제 #3
0
void LoopSong(const bool loop)
{
	g_currSong->setRepeat(loop);
}