Skip to content
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

Add a function to create a sequencer event from a midi event #1078

Closed
jimhen3ry opened this issue Apr 8, 2022 · 4 comments
Closed

Add a function to create a sequencer event from a midi event #1078

jimhen3ry opened this issue Apr 8, 2022 · 4 comments

Comments

@jimhen3ry
Copy link
Contributor

Related discussion

This idea was suggested by Tom M. at the end of Discussion #1072 .

Is your feature request related to a problem?

MIDI input can be in the form of a FluidSynth MIDI Event (fluid_midi_event_t), e.g. input from the MIDI Player. An application that receives FluidSynth MIDI Events can send them to the synthesizer with fluid_synth_handle_midi_event(). Alternatively, MIDI Events can be sent to the FluidSynth Sequencer with fluid_sequencer_add_midi_event_to_buffer().

fluid_sequencer_add_midi_event_to_buffer() "[t]ransforms an incoming MIDI event (from a MIDI driver or MIDI router) to a sequencer event and adds it to the sequencer queue for sending as soon as possible." There is no straightforward way of sending a MIDI Event to the Sequencer for sending at a later time.

Describe the solution you'd like

Add a function to transform an incoming MIDI event to a sequencer event without adding the event to a sequencer queue. This would allow an application to use fluid_sequencer_send_at() to send a MIDI Event to the Sequencer for sending at a later time.

fluid_event_from_midi_event(fluid_event_t*, const fluid_midi_event_t*) is the proposed function to be added.

Additional context

It is proposed that the added function would only add the provided MIDI Event to the provided Sequencer Event. The application would need to add additional items to the Sequencer Event, e.g. a destination sequencer with fluid_event_set_dest(), before adding the Sequencer Event to a sequencer queue.

The current fluid_sequencer_add_midi_event_to_buffer() would be rewritten to place its current code for transforming an incoming MIDI event to a sequencer event in the new function and use that new function.

@jimhen3ry
Copy link
Contributor Author

jimhen3ry commented Apr 9, 2022

I have added fluid_event_from_midi_event(fluid_event_t*, const fluid_midi_event_t*) to midi/fluid_seqbind.c and added a FLUIDSYNTH_API line to include/seqbind.h. I have rewritten fluid_sequencer_add_midi_event_to_buffer() to use fluid_event_from_midi_event(). I did a commit of these changes in an issue1078 branch based on the 2.2.X branch. I did what I could think of to test these changes on a 64 bit Windows machine.

I have not contributed to an open source project before. I need some hand holding on how you would like me to proceed from here.

@jimhen3ry
Copy link
Contributor Author

jimhen3ry commented Apr 11, 2022

Attached is a patch file for my proposed changes:
patch1078.txt

derselbst pushed a commit that referenced this issue Apr 12, 2022
…event_t *event) to create a sequencer event from a midi event. Issue #1078
@derselbst
Copy link
Member

Looks good, thanks. Ofc, it doesn't compile because the const qualifier is being discarded. I will fix this by next week.

I have not contributed to an open source project before. I need some hand holding on how you would like me to proceed from here.

You could have also forked this repo, commit and push your changes to your fork, and then create a PullRequest to propose the changes. But this way is fine either, now I opened the PullRequest: #1080

@derselbst
Copy link
Member

derselbst commented Apr 21, 2022

Merged and will be part of 2.2.7, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants