dxx-rebirth/common/main/songs.h

81 lines
1.8 KiB
C
Raw Normal View History

2014-06-01 17:55:23 +00:00
/*
* This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
2014-06-01 17:55:23 +00:00
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
2006-03-20 17:12:09 +00:00
/*
*
* Header for songs.c
*
*/
#ifndef _SONGS_H
#define _SONGS_H
Enable building with SDL2 This commit enables Rebirth to build with SDL2, but the result is not perfect. - SDL2 removed some sticky key support. Rebirth may behave differently now in this area. - SDL2 removed some key-repeat related support. Rebirth may behave differently now in this area. - SDL2 gained the ability to make a window fullscreen by sizing it to the desktop instead of by changing the desktop resolution. Rebirth uses this, and it mostly works. - Resizing while in the automap does not notify the automap code, so the view is wrong until the player switches out of automap mode and back in. - SDL2 changed how to enumerate available resolutions. Since fitting the window to the desktop is generally more useful than fitting the desktop to the window, I chose to drop support for enumerating resolutions instead of porting to the new API. Users can now enter an arbitrary window dimension and Rebirth will make an attempt to use it. - It might be useful to cap the window dimension at the desktop dimension, but that is not done yet. - Entering fullscreen mode through the Controls->Graphics submenu failed to notify the relevant subsystems, causing the rendered content not to rescale. For now, compile out the option to toggle full screen through that menu. Toggling through Alt+Enter works properly. Despite these quirks, this is a substantial improvement over the prior commit, where SDL2 cannot be used at all. The remaining issues can be resolved in future work. References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
#include <SDL_version.h>
#ifdef __cplusplus
#include "dxxsconf.h"
struct bim_song_info
{
2006-03-20 17:12:09 +00:00
char filename[16];
};
2006-03-20 17:12:09 +00:00
#define SONG_TITLE 0
#define SONG_BRIEFING 1
#define SONG_ENDLEVEL 2
#define SONG_ENDGAME 3
#define SONG_CREDITS 4
#define SONG_FIRST_LEVEL_SONG 5
2013-11-26 22:19:52 +00:00
#define SONG_EXT_HMP "hmp"
#if DXX_USE_SDLMIXER
2013-11-26 22:19:52 +00:00
#define SONG_EXT_MID "mid"
#define SONG_EXT_OGG "ogg"
#define SONG_EXT_FLAC "flac"
#define SONG_EXT_MP3 "mp3"
#endif
2017-11-25 01:56:51 +00:00
#if !DXX_USE_SDLMIXER
#ifdef _WIN32
#define songs_play_file(filename,repeat,hook_finished_track) songs_play_file(filename,repeat)
#else
#define songs_play_file(filename,repeat,hook_finished_track) songs_play_file()
#endif
Enable building with SDL2 This commit enables Rebirth to build with SDL2, but the result is not perfect. - SDL2 removed some sticky key support. Rebirth may behave differently now in this area. - SDL2 removed some key-repeat related support. Rebirth may behave differently now in this area. - SDL2 gained the ability to make a window fullscreen by sizing it to the desktop instead of by changing the desktop resolution. Rebirth uses this, and it mostly works. - Resizing while in the automap does not notify the automap code, so the view is wrong until the player switches out of automap mode and back in. - SDL2 changed how to enumerate available resolutions. Since fitting the window to the desktop is generally more useful than fitting the desktop to the window, I chose to drop support for enumerating resolutions instead of porting to the new API. Users can now enter an arbitrary window dimension and Rebirth will make an attempt to use it. - It might be useful to cap the window dimension at the desktop dimension, but that is not done yet. - Entering fullscreen mode through the Controls->Graphics submenu failed to notify the relevant subsystems, causing the rendered content not to rescale. For now, compile out the option to toggle full screen through that menu. Toggling through Alt+Enter works properly. Despite these quirks, this is a substantial improvement over the prior commit, where SDL2 cannot be used at all. The remaining issues can be resolved in future work. References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
#if SDL_MAJOR_VERSION == 2
#define songs_play_song(songnum,repeat) songs_play_song(songnum)
#endif
2017-11-25 01:56:51 +00:00
#endif
int songs_play_file(const char *filename, int repeat, void (*hook_finished_track)());
#ifdef dsx
namespace dsx {
int songs_play_song( int songnum, int repeat );
int songs_play_level_song( int levelnum, int offset );
2006-03-20 17:12:09 +00:00
//stop any songs - midi, redbook or jukebox - that are currently playing
}
#endif
2006-03-20 17:12:09 +00:00
void songs_stop_all(void);
// check which song is playing, or -1 if not playing anything
int songs_is_playing();
void songs_pause(void);
void songs_resume(void);
void songs_pause_resume(void);
namespace dcx {
// set volume for selected music playback system
void songs_set_volume(int volume);
}
void songs_uninit();
#endif
#endif