Skip to content

Commit

Permalink
Use Mix_GetSoundFonts(); (#78)
Browse files Browse the repository at this point in the history
* Use Mix_GetSoundFonts();

* Write soundfonts to sound.rot

* set boolean here

* Don't save soundfonts to CFG, and have sane fallback
  • Loading branch information
erysdren authored Jul 24, 2024
1 parent a65f4dc commit e193170
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 17 additions & 0 deletions rott/dukemusc.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ static unsigned char *music_songdata = NULL;
static Mix_Music *music_musicchunk = NULL;
static size_t music_songdatasize = 0;

static char MUSIC_SoundFonts[2048];
static const char soundfonts_fallback[] = "/usr/share/soundfonts/default.sf2;/usr/share/sounds/sf2/default-GM.sf2;/usr/share/sounds/sf2/FluidR3_GM.sf2";

int MUSIC_Init(int SoundCard, int Address)
{
init_debugging();
Expand All @@ -169,6 +172,20 @@ int MUSIC_Init(int SoundCard, int Address)
return(MUSIC_Error);
} // if

// add soundfonts
const char *soundfonts = Mix_GetSoundFonts();
if (soundfonts)
{
M_snprintf(MUSIC_SoundFonts, sizeof(MUSIC_SoundFonts), "%s", soundfonts);
}
else
{
M_snprintf(MUSIC_SoundFonts, sizeof(MUSIC_SoundFonts), "%s", soundfonts_fallback);
}

printf("Using soundfonts path string \"%s\"\n", MUSIC_SoundFonts);
Mix_SetSoundFonts(MUSIC_SoundFonts);

music_initialized = 1;
return(MUSIC_Ok);
} // MUSIC_Init
Expand Down
2 changes: 0 additions & 2 deletions rott/rt_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ boolean ParseSoundFile (void)
return (retval);
}



//******************************************************************************
//
// SetSoundDefaultValues ()
Expand Down

0 comments on commit e193170

Please sign in to comment.