Clean up MSU-1 audio file derivation.

This commit is contained in:
qwertymodo 2016-11-07 11:18:32 -08:00
parent 0832528d9f
commit 941ce40193

View File

@ -200,7 +200,6 @@
std::ifstream dataFile, audioFile; std::ifstream dataFile, audioFile;
uint32 audioLoopPos; uint32 audioLoopPos;
char fName[64];
uint32 partial_samples; uint32 partial_samples;
// Sample buffer // Sample buffer
@ -213,13 +212,11 @@ bool AudioOpen()
if (audioFile.is_open()) if (audioFile.is_open())
audioFile.close(); audioFile.close();
// This is an ugly hack... need to see if there's a better way to get the base name without extension char ext[_MAX_EXT];
sprintf(fName, "%s", S9xGetFilename(".msu", ROMFILENAME_DIR)); snprintf(ext, _MAX_EXT, "-%d.pcm", MSU1.MSU1_CURRENT_TRACK);
fName[strlen(fName) - 4] = '\0';
sprintf(fName, "%s-%d.pcm", fName, MSU1.MSU1_CURRENT_TRACK);
audioFile.clear(); audioFile.clear();
audioFile.open(fName, std::ios::in | std::ios::binary); audioFile.open(S9xGetFilename(ext, ROMFILENAME_DIR), std::ios::in | std::ios::binary);
if (audioFile.good()) if (audioFile.good())
{ {
if (audioFile.get() != 'M') if (audioFile.get() != 'M')