#if defined __round_end_music_included #endinput #endif #define __round_end_music_included public SharedPlugin __pl_round_end_music = { name = "round-end-music", file = "round_end_music.smx", #if defined REQUIRE_PLUGIN required = 1, #else required = 0, #endif }; methodmap MusicEntry < KeyValues { public MusicEntry() { return view_as(new KeyValues("music_entry")); } public void SetFilePath(const char[] filePath) { this.SetString("filepath", filePath); } public void GetFilePath(char[] buffer, int maxlen) { this.GetString("filepath", buffer, maxlen); } public void SetTitle(const char[] title) { this.SetString("title", title); } public void GetTitle(char[] buffer, int maxlen) { this.GetString("title", buffer, maxlen); } public void SetSource(const char[] source) { this.SetString("source", source); } public void GetSource(char[] buffer, int maxlen) { this.GetString("source", buffer, maxlen); } } typedef OnSongsRequested = function void (); /** * Register a function in this plugin as a music source. * * @param callback A function called whenever music is requested. */ native void REM_RegisterSource(OnSongsRequested callback); /** * Adds a song to the Round End Music plugin's queued playlist. * This function can only be called during REM_RegisterSource. * * @param song A song to add. This handle is cloned, so you will also need to close your * copy of the handle. * * @return True if adding the song was successful, false if not (playlist full or song * with same filepath is already queued). */ native bool REM_AddSong(MusicEntry song); /** * Returns the maximum number of songs that can be played on this map. Has the correct number * after OnAutoConfigsBuffered, but you'll probably only end up using it in an OnSongsRequested * callback. */ native int REM_GetActiveSongCount(); /** * Called when a song is about to be played. * * @param song The KeyValues data for the song about to be played. * * @return Plugin_Continue for default song playback, Plugin_Handled if another plugin * handled the playback, Plugin_Stop if the song should not be considered * played. */ forward Action OnRoundEndMusicWillPlay(MusicEntry song); /** * Called when a song has been played (or playback is handled by another plugin). */ forward void OnRoundEndMusicPlayed(MusicEntry song);