-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callback function for (custom) midi events #146
Comments
Thank you for this! We're in the middle of figuring out how to deal with looping in general, for things like XMI and other file formats. So this will likely end up in the next release. :) Thanks. |
Cool. Thanks :) CC @fdelapena (one of our devs): |
Are these MIDI Type 2 files by any chance? If a file is 'broken' then there is little that we can do at the moment, we're aiming to be strict on MIDI rendering. Is there anyway that you can remake your 'broken' item.mid file? |
Thank you for the support! The channel 1 controller change (0xB0) with param1 with 111 (0x6F) value is a propietary way used by RPG Maker 2000 to specify this. It seems to be allowed to be placed in any track (usually in track 1 but still works even in track 0, which is clearly incorrect for MIDI format type 1). The event time where is placed is the loop start place. I remember other MIDI files using their own propietary way by using text markers with specific values to do the same, but for unrelated projects. For this reason, a possible way to handle these is public API to read midi events and parameters to handle them, and then some API for setting/getting start/end loop for WildMIDI playback control or just play from a specific position (by midi ticks or equivalent), could be a way do this. |
I am considering using an api to specify a loop type to enable looping for the different looping instructions. This would enable us to manage looping instructions sanely. In addition to this I am considering adding support to wildmidi MIDI file output to add the loop instructions to the file data along with a meta event to identify the loop instruction format. Keep in mind this is just one of the options being considered. Other options may come to light as we explore this further. Chris Sent from my iPhone
|
Take your time. Until this is implemented, I have created a hack to suffice for us now: master...carstene1ns:rpgmakerloops |
You know what, I like this idea. The only issue is do we say something like WildMidi_CustomEventCallback(some function, WMCBO_CONTROLER or _WMCBO_META, event data) ... Or something else ... In the above example the event data would be the byte[s] following the first byte of the event in big endian order. Chris Sent from my iPhone
|
@carstene1ns would this be useful for you guys? |
Yeah, that should be okay. One problem though, we would need to know from this, when the event occurred. So that we have a sample position we can feed into |
First up, looping itself would be handled elsewhere, I am currently looking into that. The callback would be intended as a way to setup post-processing of an audio chunk with standard or custom events triggering the setup parameters. However I can see a possible way that callbacks could be used to alter the internal data being used by the lib ... This would be an at your own risk way of using callbacks and completely unsupported by us as we do not intend the lib or its data to be used in such a way. Sent from my iPhone
|
Caffeine is slowly making its way into my brain. How about something like WildMidi_SetLoopEvent(WMSLE_LOOPSTART|LOOPEND|RETURNTOBEGINING, char* event, int event length) To tell wildmidi lib that such and such is a loopevent so please do ... Added bonus is that since you can tell it what event are looping event you could use EOT events to loop tracks that have no looping information *** WITH CAUTION AND USUAL DISCLAIMERS |
Add into the previous LOOPCOUNT since I think xmi have a loop count event |
Well, these are 2 different things.
In the second case, the library handles the loop point, so our audio_decoder will:
While the second approach is of course simpler for us, we do not know when the music has looped at all. |
They could also work together, with the lib handling the looping and the callback being used to notify the player that the loop event has occurred I like both ideas so much that I aim to have this done for the next feature release. Sent from my iPhone
|
This works very well, also for handling formats with looping built in. |
Great, looking forward to that! |
Hello, I'm one of the https://github.com/EasyRPG/Player developers which is a reimplementation of the RPG Maker 2000/2003 engine.
We support WildMidi for Midi playback but it lacks one special feature that we need:
MIDI tracks in this engine use midi message 0xB0 (controller change) with argument "111" (0x6F) which is used for defining loop points (when the track ends it loops from the position where it encountered 0x6F) in the MIDI file and we need a way to know when this event happens so we can handle it.
Would it be possible to add a callback function for reacting to midi events from external code or is there any API available in WildMidi that allows us to detect this? Thx.
The text was updated successfully, but these errors were encountered: