dxx-rebirth/common/include/rbaudio.h
Kp f491059ed7 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

81 lines
2.5 KiB
C++

/*
* Portions of this file are copyright Rebirth contributors and licensed as
* described in COPYING.txt.
* Portions of this file are copyright Parallax Software and licensed
* according to the Parallax license below.
* See COPYING.txt for license details.
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#pragma once
#define RBA_MEDIA_CHANGED -1
#ifdef __cplusplus
#include <SDL_version.h>
namespace dcx {
#if SDL_MAJOR_VERSION == 1
struct RBACHANNELCTL
{
unsigned int out0in, out0vol;
unsigned int out1in, out1vol;
unsigned int out2in, out2vol;
unsigned int out3in, out3vol;
};
extern void RBAInit(void);
extern void RBAExit();
extern long RBAGetDeviceStatus(void);
extern int RBAPlayTrack(int track);
extern int RBAPlayTracks(int first, int last, void (*hook_finished)(void)); //plays tracks first through last, inclusive
extern int RBACheckMediaChange();
extern long RBAGetHeadLoc(int *min, int *sec, int *frame);
extern int RBAPeekPlayStatus(void);
extern void RBAStop(void);
extern void RBAEjectDisk(void);
extern void RBASetStereoAudio(RBACHANNELCTL *channels);
extern void RBASetQuadAudio(RBACHANNELCTL *channels);
extern void RBAGetAudioInfo(RBACHANNELCTL *channels);
extern void RBASetChannelVolume(int channel, int volume);
#ifdef __linux__
extern void RBASetVolume(int volume);
#else
static inline void RBASetVolume(int)
{
}
#endif
extern int RBAEnabled(void);
extern void RBADisable(void);
extern void RBAEnable(void);
extern int RBAGetNumberOfTracks(void);
extern void RBACheckFinishedHook();
extern void RBAPause();
extern int RBAResume();
extern int RBAPauseResume();
//return the track number currently playing. Useful if RBAPlayTracks()
//is called. Returns 0 if no track playing, else track number
int RBAGetTrackNum();
// get the cddb discid for the current cd.
unsigned long RBAGetDiscID();
// List the tracks on the CD
void RBAList(void);
#endif
}
#endif