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

Publish MIDI event constants and add functions to get text/lyrics #468

Closed
wants to merge 1 commit into from

Conversation

RangelReale
Copy link

  • Move MIDI event definitions to public include
  • Functions to get text/lyrics text

The MIDI events are useful when using the library with a player callback, otherwise every user would need to copy all the events to its our source every time.

* Functions to get text/lyrics text
@derselbst
Copy link
Member

derselbst commented Nov 22, 2018 via email

@RangelReale
Copy link
Author

I am creating a karaoke player, for this I need to get the text data on the player callback, so I need to get the MIDI_TEXT event and its text data. This is the function I am testing with.

int player_callback(void* data, fluid_midi_event_t* event)
{
    int type = fluid_midi_event_get_type(event);

    if (type == MIDI_TEXT) {
        void *data;
        int data_size;
        fluid_midi_event_get_text(event, &data, &data_size);

        std::cout << "MIDI_TEXT: " << std::string((const char*)data, data_size) << std::endl;
    }

    return fluid_synth_handle_midi_event(data, event);
}

@derselbst
Copy link
Member

In this case it should be sufficient to only export enum midi_meta_event. Why do suggest to make all the other enums public?

@RangelReale
Copy link
Author

My thought was that all these constants have the possibility of being used on a player callback, like for example displaying the notes. As all this data can be extracted from the "fluid_midi_event_t", like for example "fluid_midi_event_get_control", I think the constants can be public, as using this method would't be useful if you don't know the values for the event control.

Maybe 'fluid_midi_event_type', 'fluid_midi_control_change' and 'midi_meta_event' should be enough.

@derselbst
Copy link
Member

Maybe 'fluid_midi_event_type', 'fluid_midi_control_change' and 'midi_meta_event' should be enough.

Ok. I can't decide this by myself though. Discussion pending:

https://lists.nongnu.org/archive/html/fluid-dev/2018-11/msg00027.html

@derselbst
Copy link
Member

I will add the two getters you suggested. But currently I can't publish the enums, sry.

@derselbst derselbst closed this in d0813be Dec 20, 2018
@derselbst
Copy link
Member

Perhaps as a compromise I've made the getters typesafe, so that you wouldn't need to check the type explicitly for text and lyric events.

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

Successfully merging this pull request may close these issues.

None yet

2 participants