Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 14th Jan 2015 09:57 Edited at: 14th Jan 2015 10:03
Hey people,

If you grab the Enhanced Audio Plugin (ver1.55) from this thread, you'll then be able to double check my problem with me.

http://forum.thegamecreators.com/?m=forum_view&t=84732

Now, the fun part, here's my code which demonstrates the bug;



So what's the problem? There's a couple of minor issues, but the main one is that upon employing either;

- Resume Midi Audio
- Audio Set Midi Position

The instrument data seems to reset, resulting in a default piano sound.

Can you reproduce this bug? Any suggestions on how to program midi playback with DBPro?

For extra points, try comparing EAP155 to default DBPro mid load file commands, and let me know if the EAP155 loading takes 10x longer than the default DBPro midi load command (which is almost instant). In my testing, loading midi via EAP155 takes almost 10 seconds per song. Doesn't seem... right.

Cheers in advance, and happy new year everyone! Oh, if you lack a midi file, I've added one as an attachment.

EDIT: Extra EXTRA bonus-bonus points if you can pick the midi file and where it's from.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia

Attachments

Login to view attachments
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 14th Jan 2015 11:49
Quote: "The instrument data seems to reset, resulting in a default piano sound. "

This is quite common in very expensive music software as well; the reason is most likely that a RESET_ALL message is sent before stopping the playback; this ensures that all notes get turned off (otherwise they linger until a NOTE_OFF message is received by the midi playback device), however it also resets all other controllers such as volume and program (instrument) changes. You can work around this by storing the latest settings for all midi controllers and resend them before resuming playback, or you can just turn off all notes manually instead of resetting the device. Beware that if you chose the latter approach, another program acquiring the midi device can still change its settings before your program will resume playback so I would recommend the first approach.

If you want a do-it-yourself kind of solution, you might want to take a look at my midi plugin.

Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 14th Jan 2015 23:45
Thanks for helping me on this Rudolpho. From my game project point of view, I'm just going through the ropes of loading game resources, such as;

- 3D Models
- 2D Images
- Midi
- WAV
- CSV Datasheets

In reading up on the train this morning, your Midi DLL plugin looks to be very much in depth, and I believe once I get my head around it I'll be using it for;

- Playing Midi music
- Cross fading Midi music between levels & menus

Now please excuse my ignorance (it's not bliss, trust me), but are you able to assist me with the commands that I'll need to use to simply load a midi file into my DBPro exe and play it, using your plug in?

I noticed a stark contrast between your command set & the EAP command set. I appear to be slightly daunted by your plugin. In comparison I love how straight forward EAP is to do what I was trying to do, but the midi playback issues that I encountered simply means I can't use it in my games to be...

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 15th Jan 2015 19:50
You're welcome.

Quote: "your Midi DLL plugin looks to be very much in depth...
I appear to be slightly daunted by your plugin. In comparison I love how straight forward EAP is to do what I was trying to do, but the midi playback issues that I encountered simply means I can't use it in my games to be..."

Ah, yes, the intent of my plugin wasn't directly standard midi file playback (although it can be used to achieve this) but rather a means to write your own midi-compliant sequencer type program such as SoftMotion3D's QMidi projects. It also supports reading input midi signals, allowing you to communicate with an external synthesizer / musical keyboard.

Quote: "- Cross fading Midi music between levels & menus"

This won't be as straight forward as you think; Midi is based on having 16 channels (you don't need to use all of them but that's the max you can have). You can change channel volume, meaning that you could technically crossfade between two midi files that use 8 channels each. However, drums are locked to channel 10 on standard Midi playback devices (some allow changing it as you see fit though) making this more complicated.
It can be solved by instead gradually altering the note velocity of the tracks you are fading between. However you can only use 16 channels of unique instruments meaning that if you have different instruments and need more than 8 channels per sequence you are crossfading between it won't be possible sadly.

Quote: "are you able to assist me with the commands that I'll need to use to simply load a midi file into my DBPro exe and play it, using your plug in?"

I'm a bit occupied with my studies at the moment but I can give it a try when I get the time if you still want to pursue this knowing the limitations I stated above about simultaneous midi instruments and channels?

Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 16th Jan 2015 03:36 Edited at: 16th Jan 2015 03:36
At this stage, I'm getting distracted from my main objective (make a damn game!) so I'll probably give your plugin a miss for now. Back on to testing EAP155.dll, I've briefly tested the .OGG format with the EAP plugin and that seems to operate without complications.

However, if you were to take interest in a new midi project, may I suggest a simple functional midi file playback DLL for DBPro?

I'll donate a case of beer/coffee to your cause if you're up to it. But... the more I think about it, .Ogg is probably a better format to ship an indie title with in comparison to midi.

I've updated my snippet code below for testing the .ogg format, with no real problems to report of. I'll update it tonight with a cross-fade function if I can figure one out.



Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia

Attachments

Login to view attachments
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 16th Jan 2015 11:09
Quote: "However, if you were to take interest in a new midi project, may I suggest a simple functional midi file playback DLL for DBPro? "

I was under the impression that DBPro already did this for you using the music commands?

Quote: "I'll donate a case of beer/coffee to your cause if you're up to it."

That does sound incentative however....

Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 16th Jan 2015 12:38
In my testing of 1.077, the stock DarkBASIC Pro midi compatible commands were limited to;

Load Music Filename, TrackNo
Play Music TrackNo
Stop Music TrackNo

All the other DBPro Music commands that I tested silently (hehe) failed. That's when I hit up the forums, found EAP and got all excited, only to find the commands that I were after "Pause/Resume/Seek" only half worked for midi files, introducing that instrument reset bug.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Torrey
19
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 18th Jan 2015 18:00 Edited at: 19th Jan 2015 00:41
Hey Burning Feet Man,

I've found the old source code for the version of the plugin you're using and will try to see if I can figure out what is causing the issues you've experienced.
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 19th Jan 2015 10:36
OMg omg omg omg omg omg! Thank you! How exciting!

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Torrey
19
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 19th Jan 2015 21:09
Burning Feet Man,

Upon researching the issue I found that MCI reads the instrument information when the song starts, but when it's paused and told to play again MCI loses the instrument information. Because of this I updated EAP155 to inform MCI that we're starting from a different position so it reads the instrument information. None of that may make sense to you, but know that it works.

Attachments

Login to view attachments
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 9th Mar 2015 11:34
Update; I noticed that when I call the command;

"Load Midi Audio"

I then pre-load say 5 midi songs, and after playing around, that the DBPro app causes a crash error upon exiting. I've tried performing a clean up routine on exit with the command;

"Delete Midi Audio"

But this doesn't seem to make a difference. Is there something simple that I'm forgetting here? I know that if I REM out "Load Midi Audio" that my application no longer crashes after exiting.

WOW, further to this, I've just isolated the bug (which is why I only discovered it tonight), in that the DBPro application seems to crash if the playing midi is in the "stopped", "Paused" or "unplayed" state.

LOL, so my current workaround is to play music on exit to prevent my game from crashing on exit! XD Note that this bug works with the original EAP155 and the recently revised release.

As a side note, I'm noticing ~ a 1 second per 10KB wait per midi song with EAP (so 30KB midi is 3 seconds), compared with next to no load time for the default DBPro music load command. Is there some extra processing going on during the "Load midi audio" with EAP, or could this also be another minor bug?

PS: You never sent me your address for that case of beer/coffee

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Torrey
19
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 11th Mar 2015 00:47
I updated the plugin's deconstructor and with local tests I didn't experience any crashes after the update. To answer your question about the loading times per midi song, my machines don't experience any noticeable lag, so I'll go out on a limb and say it could be machine related.

Remember to delete the old plugin before copying this one over. I named this one eap156, whereas the old one is named eap155. Let me know how this works for you.

Attachments

Login to view attachments
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 12th Mar 2015 03:08
After updating to EAP156, recompiling and executing my example code no longer resulted in a crash whilst exiting the application if a midi file is loaded in either an unplayed, stopped or paused state.

Regarding the load times, I might put together a speed test which compares EAP156 midi loading time & default DBPro midi loading times and see if there's more to this when running on different computers. If I don't get roped into the pub tonight, I'll post something in a couple of hours.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Torrey
19
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 12th Mar 2015 03:49
Great news about the crash fix working for you! If you do create that speed test sample, share the code for. Myself and possibly others can test it.

Login to post a reply

Server time is: 2024-03-29 13:33:58
Your offset time is: 2024-03-29 13:33:58