/** * Round End Music: Sample Sources * * An example plugin showing how to add songs to the Round End Music playlist. */ #pragma semicolon 1 #include #pragma newdecls required #include #define PLUGIN_VERSION "0.1.4" public Plugin myinfo = { name = "Round End Music: Sample Source and Handler", author = "nosoop", description = "Loads hard-coded music entries. Mostly for testing.", version = PLUGIN_VERSION, url = "https://git.csrd.science/" } char SONGS[][][] = { { "You're at the Party", "Lemon Demon", "nomnomnomsongs/pikapoo/attheparty.mp3" }, { "Come on Down", "The Price is Right", "nomnomnomsongs/tpir.mp3" }, { "1812 Overture", "Tchaikovsky", "nomnomnomsongs/1812.mp3" }, { "Back to the Future", "The Outatime Orchestra", "nomnomnomsongs/bttf.mp3" }, { "Blinded by Light", "Final Fantasy 13", "nomnomnomsongs/blindedbylight.mp3" }, { "Yatta!", "Green Leaves", "nomnomnomsongs/yatta.mp3" }, { "Hydroponics Lab", "Escape From Puppy Death Factory", "nomnomnomsongs/pikapoo/puppydeathfactory.mp3" }, { "Theme", "Jackie Chan Adventures", "nomnomnomsongs/jchana.mp3" }, { "Throwback Galaxy", "Super Mario Galaxy 2", "nomnomnomsongs/throwback.mp3" }, }; public void OnRoundEndSongsRequested() { // Load song data from array for (int i = 0; i < sizeof(SONGS); i++) { MusicEntry entry = GenerateSong(SONGS[i][0], SONGS[i][1], SONGS[i][2]); if (!REM_AddSong(entry)) { PrintToServer("[rem-sample] Song %s could not be queued.", SONGS[i][2]); } delete entry; } PrintToServer("[rem-sample] %d songs requested", REM_GetActiveSongCount()); } MusicEntry GenerateSong(const char[] title, const char[] source, const char[] filePath) { MusicEntry song = new MusicEntry(); song.SetTitle(title); song.SetSource(source); song.SetFilePath(filePath); return song; } public void OnRoundEndMusicPlayed(MusicEntry song) { char title[64], source[64], filePath[PLATFORM_MAX_PATH]; song.GetTitle(title, sizeof(title)); song.GetSource(source, sizeof(source)); PrintToChatAll("You're now listening to: %s from %s!", title, source); song.GetFilePath(filePath, sizeof(filePath)); PrintToServer("[rem-sample] Played %s (replay? %b)", filePath, REM_SongWasRecentlyPlayed(song)); }