void CDPlay(int track) { if (trackNum == track && stream != NULL && isPlaying) { return; // Already playing that track } char buf[32]; sprintf(buf, "sound/mus%03d.ogg", track); trackNum = track; if (stream != NULL) logg_destroy_stream(stream); stream = logg_get_stream(buf, 128, 128, 0); }
void startMusic(const char* name) { char resName[1000]; strcpy(resName, getResource("music/%s", name)); int music_size = music.size(); int music_end = music_size-1; if (music_size != 0 && music[music_end] && !strcmp(music[music_end]->filename, resName)) { return; } LOGG_Stream* s = logg_get_stream(resName, config.getMusicVolume(), 128, 1); if (music_size == 0) { music.push_back(s); } else { if (music[music_end]) { logg_destroy_stream(music[music_end]); } music[music_end] = s; } }