mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Add MIDI_GetDevice and use it so that the default driver value doesn't show as "Custom" in the menu
git-svn-id: https://svn.eduke32.com/eduke32@8261 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7650cbe592
commit
c6c7c91d7c
6 changed files with 32 additions and 2 deletions
|
@ -56,6 +56,7 @@ enum FX_LOOP_HOW
|
|||
const char *FX_ErrorString(int ErrorNumber);
|
||||
int FX_Init(int numvoices, int numchannels, int mixrate, void *initdata);
|
||||
int FX_Shutdown(void);
|
||||
int FX_GetDevice(void);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ extern const char *MUSIC_ErrorString(int ErrorNumber);
|
|||
|
||||
int MUSIC_Init(int SoundCard);
|
||||
int MUSIC_Shutdown(void);
|
||||
int MIDI_GetDevice(void);
|
||||
void MUSIC_SetVolume(int volume);
|
||||
int MUSIC_GetVolume(void);
|
||||
void MUSIC_SetLoopFlag(int loopflag);
|
||||
|
|
|
@ -141,6 +141,11 @@ int FX_Shutdown(void)
|
|||
return status;
|
||||
}
|
||||
|
||||
int FX_GetDevice()
|
||||
{
|
||||
return ASS_PCMSoundDriver;
|
||||
}
|
||||
|
||||
static wavefmt_t FX_DetectFormat(char const * const ptr, uint32_t length)
|
||||
{
|
||||
if (length < 12)
|
||||
|
|
|
@ -46,6 +46,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
extern int MV_MixRate;
|
||||
extern int ASS_MIDISoundDriver;
|
||||
|
||||
int MIDI_GetDevice()
|
||||
{
|
||||
return ASS_MIDISoundDriver;
|
||||
}
|
||||
|
||||
static const int _MIDI_CommandLengths[NUM_MIDI_CHANNELS] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0 };
|
||||
|
||||
static track * _MIDI_TrackPtr;
|
||||
|
|
|
@ -118,7 +118,16 @@ void S_MusicStartup(void)
|
|||
initprintf("Initializing MIDI driver... ");
|
||||
|
||||
int status;
|
||||
if ((status = MUSIC_Init(ud.config.MusicDevice)) != MUSIC_Ok && (status = MUSIC_Init(0)) != MUSIC_Ok && (status = MUSIC_Init(1)) != MUSIC_Ok)
|
||||
if ((status = MUSIC_Init(ud.config.MusicDevice)) == MUSIC_Ok)
|
||||
{
|
||||
if (ud.config.MusicDevice == ASS_AutoDetect)
|
||||
ud.config.MusicDevice = MIDI_GetDevice();
|
||||
}
|
||||
else if ((status = MUSIC_Init(ASS_AutoDetect)) == MUSIC_Ok)
|
||||
{
|
||||
ud.config.MusicDevice = MIDI_GetDevice();
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("S_MusicStartup(): failed initializing: %s\n", MUSIC_ErrorString(status));
|
||||
return;
|
||||
|
|
|
@ -1197,7 +1197,16 @@ void MusicStartup(void)
|
|||
buildprintf("Initializing MIDI driver... ");
|
||||
|
||||
int status;
|
||||
if ((status = MUSIC_Init(MusicDevice)) != MUSIC_Ok && (status = MUSIC_Init(0)) != MUSIC_Ok && (status = MUSIC_Init(1)) != MUSIC_Ok)
|
||||
if ((status = MUSIC_Init(MusicDevice)) == MUSIC_Ok)
|
||||
{
|
||||
if (MusicDevice == ASS_AutoDetect)
|
||||
MusicDevice = MIDI_GetDevice();
|
||||
}
|
||||
else if ((status = MUSIC_Init(ASS_AutoDetect)) == MUSIC_Ok)
|
||||
{
|
||||
MusicDevice = MIDI_GetDevice();
|
||||
}
|
||||
else
|
||||
{
|
||||
buildprintf("Music error: %s\n", MUSIC_ErrorString(status));
|
||||
mus_enabled = FALSE;
|
||||
|
|
Loading…
Reference in a new issue