mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Add a cvar array for audiolib
git-svn-id: https://svn.eduke32.com/eduke32@8222 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a2ab5492cc
commit
8a61ceeb36
3 changed files with 38 additions and 0 deletions
|
@ -48,11 +48,39 @@ const char *FX_ErrorString(int ErrorNumber)
|
|||
return ErrorString;
|
||||
}
|
||||
|
||||
static int osdcmd_cvar_set_audiolib(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t r = osdcmd_cvar_set(parm);
|
||||
|
||||
if (r != OSDCMD_OK) return r;
|
||||
|
||||
if (!Bstrcasecmp(parm->name, "mus_emidicard"))
|
||||
{
|
||||
MIDI_Restart();
|
||||
return r;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int FX_Init(int numvoices, int numchannels, unsigned mixrate, void *initdata)
|
||||
{
|
||||
if (FX_Installed)
|
||||
FX_Shutdown();
|
||||
else
|
||||
{
|
||||
static int init;
|
||||
|
||||
static osdcvardata_t cvars_audiolib[] = {
|
||||
{ "mus_emidicard", "force a specific EMIDI instrument set", (void *)&ASS_EMIDICard, CVAR_INT | CVAR_FUNCPTR, 0, 10 },
|
||||
};
|
||||
|
||||
if (!init++)
|
||||
{
|
||||
for (auto &i : cvars_audiolib)
|
||||
OSD_RegisterCvar(&i, (i.flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_audiolib : osdcmd_cvar_set);
|
||||
}
|
||||
}
|
||||
int SoundCard = ASS_AutoDetect;
|
||||
|
||||
if (SoundCard == ASS_AutoDetect) {
|
||||
|
|
|
@ -89,6 +89,13 @@ static int _MIDI_Reset;
|
|||
int MV_MIDIRenderTempo = -1;
|
||||
int MV_MIDIRenderTimer;
|
||||
|
||||
static char *_MIDI_SongPtr;
|
||||
|
||||
void MIDI_Restart(void)
|
||||
{
|
||||
MIDI_PlaySong(_MIDI_SongPtr, _MIDI_Loop);
|
||||
}
|
||||
|
||||
static int _MIDI_ReadNumber(void *from, size_t size)
|
||||
{
|
||||
if (size > 4)
|
||||
|
@ -702,6 +709,8 @@ int MIDI_PlaySong(char *song, int loopflag)
|
|||
if (B_UNBUF32(song) != MIDI_HEADER_SIGNATURE)
|
||||
return MIDI_InvalidMidiFile;
|
||||
|
||||
_MIDI_SongPtr = song;
|
||||
|
||||
song += 4;
|
||||
int const headersize = _MIDI_ReadNumber(song, 4);
|
||||
song += 4;
|
||||
|
|
|
@ -65,5 +65,6 @@ void MIDI_PauseSong(void);
|
|||
void MIDI_StopSong(void);
|
||||
int MIDI_PlaySong(char *song, int loopflag);
|
||||
void MIDI_SetTempo(int tempo);
|
||||
void MIDI_Restart(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue