123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #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<MusicEntry>(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);
- }
-
- public bool HasFilePath(const char[] filePath) {
- char thisFilePath[PLATFORM_MAX_PATH];
- this.GetFilePath(thisFilePath, sizeof(thisFilePath));
-
- return StrEqual(thisFilePath, filePath);
- }
-
- public bool Equals(MusicEntry other) {
- char otherFilePath[PLATFORM_MAX_PATH];
- other.GetFilePath(otherFilePath, sizeof(otherFilePath));
-
- return this.HasFilePath(otherFilePath);
- }
- }
- /**
- * 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();
- /**
- * Returns whether or not the song's file path exists in the played songs list.
- *
- * A song is recently played if it was already played on the current map (i.e., the first time
- * it was played since being queued). A song is considered played after OnRoundEndMusicPlayed
- * is done being called, so you can determine if it was recently played through that forward.
- */
- native bool REM_SongWasRecentlyPlayed(MusicEntry song);
- /**
- * 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);
- /**
- * Called when the Round End Music plugin is available and in need of songs.
- */
- forward void OnRoundEndSongsRequested();
|