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

Setting clocks per tick and 32nd notes per beat in Time Signature meta event #120

Closed
sevagh opened this issue Oct 24, 2024 · 3 comments
Closed

Comments

@sevagh
Copy link

sevagh commented Oct 24, 2024

Hello!

II noticed the time signature meta-event hardcodes the last 2 arguments (clocks per tick, 32nd notes per beat) to the values {1, 96} in the time_signature meta-event:

  static message time_signature(int numerator, int denominator)
  {
    int n = 1;
    int powTwo = 0;

    while (n < denominator)
    {
      n <<= 1;
      ++powTwo;
    }

    return {0xff, 0x58, 0x04, static_cast<uint8_t>(numerator), static_cast<uint8_t>(powTwo),
            1,    96};
  }

Maybe it can take optional parameters with defaults? e.g. int clocks_per_tick = 24, int 32nd_notes_per_beat = 8?

Also, are {1, 96} placeholders? From my research, {24, 8} are more typical.

@jcelerier
Copy link
Member

heya! this can be traced back to https://github.com/ddiakopoulos/modern-midi/blob/67944e958483af32d5c39eabf6c59d4d5ec81866/src/midi_message.h#L295 ; i honestly never used these functions so didn't notice it. I'm going to add them as custom parameters - the default will not change though in order to not break silently for current users.

@sevagh
Copy link
Author

sevagh commented Oct 26, 2024

I see you made the change: 58ba0f8

Thanks! Let me test this in my project and I'll close the issue asap.

@sevagh sevagh closed this as completed Oct 26, 2024
@jcelerier
Copy link
Member

yep, thanks for the notice and suggestion !

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

No branches or pull requests

2 participants