I recently started using FMOD (I’m using Delphi) and I can’t seem to get a MIDI file to load. I have no idea what I could be doing wrong as the code is this simple:
FSOUND_Init(44100, 32, 0);
TempMusicModule := FMUSIC_LoadSong(pchar(‘canyon.mid’));
if TempMusicModule = nil then
MessageDlg(FMOD_ErrorString(FSound_GetError), mtError, [mbOk], 0);
I’ve tried this with several different midi files, and verified the problem doesn’t only occur on my machine. LoadSong always returns nil, and the last error is “Unknown file format”. Is there some additional initialization or flags I should be using?
- Questor asked 15 years ago
I’m finding the same problem – no matter what I do, FMUSIC_LoadSong( “c:\idea5.mid” ); always returns 0. (I’m using VC++ 6.0)
I’ve tried this on FMOD v. 3.5 and 3.61 – same result.
I’ve tried everything I can think of:
– removing spaces from filename
– other midi files (including canyon.mid that comes with FMOD 3.61)
– NOT calling [b:3ja6x7js]FSOUND[/b:3ja6x7js]_Init
– When I mangle the filename, FMOD gives error 9 – file not found, as expected
– The sample app SIMPLE produces the same error – “Unknown file format”
What gives? I’m on a WinXP Home laptop – I can load and play MIDI’s fine through Win MCI – but I want to switch to FMOD for my latest project (for other reasons)
Here’s a complete program which demonstrates the problem:
int main( int ac, char *av )
int t = FSOUND_Init(44100, 32, 0);
printf( “FSOUND_Init = %d\n”, t );
fmm = FMUSIC_LoadSong( “c:\canyon.mid” );
// fmm is always NULL
printf( “fmm = %d (%s)\n”, fmm, “null” );
// FSOUND_GetError() always returns 10
printf( “Error = %d (%s)\n”,
FMOD_ErrorString( FSOUND_GetError() ) );
FMUSIC_PlaySong( fmm );
Am I doing something wrong? Can FMOD play MIDI’s or not?
- JupiterDude answered 15 years ago
I am using FMOD with C++ and I have the same problems as Questor and JupiterDude.
If I try the provide example programs, the fmod example works.
The simple examples do not work when trying to play midi files (eg canyon.mid).
Having looked at the fmod example code, I think what is happening is that the code to load the midi file fails, so it plays it using streaming. Its been a while since I’ve looked at it, but this is what I seem to recall was the problem.
- Kenshi answered 15 years ago
Please login first to submit.