I’m having troubles with Midi playback under Linux (Ubuntu 8.04). First up I just want to check officially if Midi playback is supported under Linux? I’ve read a number of conflicting things in my quest to solve my problem.
If playback is supported on Linux here is my problem: My code compiles and plays midis fine under windows. When I first tried to compile and run it under Linux the error "A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback)" when attempting to create a stream. After seeing this I searched the documentation to find that I can specify a .dls file in the FMOD_CREATESOUNDEXINFO structure with the dlsname field. So I grabbed the gm.dls from my windows installation for testing and filled dlsname with the correct path to gm.dls; but now createStream throws a segmentation fault.
I would appreciate any tips/help getting this to work. Cheers.
- tayzor asked 9 years ago
I have ruled out my reader already because I also get a seg fault when I try just using an ordinary midi file such as:
FMOD_RESULT result = system_->createStream("./test.mid", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, &exinfo, &music_);
and also because it works correctly under windows.
Other formats appear to be fine, because I can compile and run the FMOD examples (i.e. playsound) without problems.
Any other suggestions? Are there any settings/configurations in other Linux libraries that could affect FMOD in this way?
Could you possibly email email@example.com a test application that reproduces the segfault, the midi file you are using and the DLS file. That way I can run it here and see whats going on.
I cant think of anything off the top of my head as to why loading your midi would seg fault and mine does not. What version of FMOD are you using?
Thanks for the fast reponse guys, I’m relieved to hear that Linux is supported. Here is the relevant code which works as expected on windows but seg faults at createStream on my Linux box.
void Audio::playMusic(int track)
// Extract midi chunk from flx archive
unsigned char* data = 0;
int size = fr.getMid(track, &data);
// Create FMOD stream from midi chunk FMOD_CREATESOUNDEXINFO exinfo; memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); exinfo.length = size; exinfo.dlsname = "./gm.dls"; FMOD_RESULT result = system_->createStream((const char*)data, FMOD_SOFTWARE | FMOD_OPENMEMORY | FMOD_LOOP_NORMAL, &exinfo, &music_); // FMOD duplicates the data so we can free it now delete  data; // If all is ok then play it if (result == FMOD_OK) system_->playSound(FMOD_CHANNEL_FREE, music_, false, &channel_); else logger.write(LOG_INFO, "%s", FMOD_ErrorString(result));
As you can see I’m creating the stream from memory. My Audio class contains the 3 private members:
and I initialise FMOD with:
// Initialise sound system (FMOD)
system_->init(1, FMOD_INIT_NORMAL, 0);
gm.dls is in the same directory as the executable and this is also the current working directory. Backtrace on seg fault:
Program received signal SIGSEGV, Segmentation fault.
In FMOD::ChannelI::play () (/usr/local/lib/libfmodex.so)
0 0xb7dc2c1e FMOD::ChannelI::play() (/usr/local/lib/libfmodex.so:??)
1 0xb7d73f5c ??() (/usr/local/lib/libfmodex.so:??)
Thanks for the code, unfortunately it does’t reveal any problem. I have basically recreated what you have on our linux box (via reading the file into a memory buffer and loading it from there) and it works perfectly.
This makes me think maybe there is something wrong with your reader that extracts the MIDI data to feed to FMOD or perhaps the size being returned is incorrect? Have you tried just loading the MIDI file directly into FMOD (without using your reader)?
Also is this problem exclusive to MIDI? or does it happen with other formats too?
Please login first to submit.