playmidi instead of tmidity [linux]

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
ChrisHuebsch
Engineer
Engineer
Posts: 75
Joined: 10 Jun 2004 12:46

playmidi instead of tmidity [linux]

Post by ChrisHuebsch »

Hello,

i have a EMU10K1-Based soundcard (SB-Live!), which has hardware-midiplay. Instead of tmidity I can use "playmidi -a" to play midi-files in hardware and save on or two cpu-cycles.

I can read that in extmidi.c is a #defined EXTERNAL_PLAYER. To use playmidi, i had to change the execl-function too by adding a "-a" parameter.

Furtermore before playing any midi-song, a soundfont has to be loaded into the card by "sfxload".

I am thinking about a morge general way to specify the midi-player. What about a config-entry like
midiplayer="command -options %s"
or someting like that instead of hardcoding the command into the programm?[/code]
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

I guess you can try (in makefile.config)
MIDI:="playmidi -a"
I think it will work, but I'm not sure. I would like a reply with the result
of cause this needs an unmodified extmidi.c
svn revert extmidi.c
will do the trick
ChrisHuebsch
Engineer
Engineer
Posts: 75
Joined: 10 Jun 2004 12:46

Post by ChrisHuebsch »

no, it won't work, i tried that.

the problem is, that execl needs each argument for the new process as a separate parameter.

So execl ("playmidi -a", "extmidi", filename, NULL); will not work. execl does not parse the first parameter. One might even wants to start an executable with whitespaces in the name.

execl("playmidi", "extmidi", "-a", filename, NULL); works

the system-call named "system" calls /bin/sh which parses its arguments, but i believe it won't raise SIGCHLD, but just block.

Chris
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

update to newest svn version and run
make upgradeconf
then edit makefile.config
MIDI:=playmidi
MIDI_ARG:=-a

and it should work
ChrisHuebsch
Engineer
Engineer
Posts: 75
Joined: 10 Jun 2004 12:46

Post by ChrisHuebsch »

great. that will work.

thank you
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

minor issues are easy to fix, but we have to be aware of them

of cause this was quicker to fix, since you gave the right line. We want more of that kind of problem reports :wink:
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 7 guests