0
0

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.

  • You must to post comments
0
0

Yes midi is supported on all platforms. We’ll try what you said and see if we can reproduce the same problem

  • You must to post comments
0
0

I have just tested a MIDI file here on our linux box using the gm.dls file that ships with Windows, it played correctly as expected. Could you post the code you are using which causes the segfault.

  • You must to post comments
0
0

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.

[code:uc5bnb00]
void Audio::playMusic(int track)
{
// Extract midi chunk from flx archive
FlxReader fr;
fr.load("./MUSIC/MUSIC.FLX");
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));

}
[/code:uc5bnb00]

As you can see I’m creating the stream from memory. My Audio class contains the 3 private members:

[code:uc5bnb00]
FMOD::System* system_;
FMOD::Sound* music_;
FMOD::Channel* channel_;
[/code:uc5bnb00]

and I initialise FMOD with:

[code:uc5bnb00]
void Audio::init()
{
// Initialise sound system (FMOD)
FMOD::System_Create(&system_);
system_->init(1, FMOD_INIT_NORMAL, 0);
}
[/code:uc5bnb00]

gm.dls is in the same directory as the executable and this is also the current working directory. Backtrace on seg fault:

[code:uc5bnb00]
Program received signal SIGSEGV, Segmentation fault.
In FMOD::ChannelI::play () (/usr/local/lib/libfmodex.so)
Call Stack:

0 0xb7dc2c1e FMOD::ChannelI::play() (/usr/local/lib/libfmodex.so:??)

1 0xb7d73f5c ??() (/usr/local/lib/libfmodex.so:??)

[/code:uc5bnb00]

  • You must to post comments
0
0

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?

  • You must to post comments
0
0

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:

[code:2387808w]
FMOD_RESULT result = system_->createStream("./test.mid", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, &exinfo, &music_);
[/code:2387808w]

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?

  • You must to post comments
0
0

Could you possibly email support@fmod.org 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?

  • You must to post comments
0
0

Thanks for your help Matthew!

I was using FMOD Ex 4.16.00, I hadn’t seen any related fixes in recent builds so assumed they wouldn’t make any difference, but I upgraded to 4.16.10 and now it’s working.

  • You must to post comments
0
0

Good to hear, just looking back at our revision history I notice an entry for version 4.16.01 that talks about a fix to crashes with MIDI files. This could have been your problem.

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.