Skip to content

MIDI_CREATE_CUSTOM_INSTANCE does not forward custom settings to MidiInterface #372

Description

@niklasdahlheimer

DISCLAIMER I noticed this issue has already been fixed in #154 , but since the commit is quite old and there has not been a release for years, I’m posting this bug report anyway as a note for other users of the latest release (5.0.1); it can be closed once a release containing the fix is available.

Context

  • What board are you using?
    • ESP32 NodeMCU-32S
    • Hardware MIDI via Serial2
  • What version of the Arduino IDE are you using?
    • PlatformIO with Arduino framework
  • How are you using MIDI?
    • Hardware Serial (DIN plugs)
    • USB
    • Other
  • Is your problem related to:
    • MIDI Input
    • MIDI Output
  • How comfortable are you with code?
    • Complete beginner
    • Basic projects
    • C/C++ comfortable
    • Advanced / professional

Describe your project and what you expect to happen

I am using the Arduino MIDI Library with custom settings for a HardwareSerial MIDI input.
I expect MIDI_CREATE_CUSTOM_INSTANCE(...) to apply my custom settings to the MIDI parser as well as the serial transport, or to clearly support separate settings for both.

Describe your problem (what does not work)

MIDI_CREATE_CUSTOM_INSTANCE(...) only forwards the custom settings to SerialMIDI, but not to MidiInterface.

As a result, parser settings like Use1ByteParsing = false are ignored unless I modify midi_Settings.h directly.
This makes the custom settings API incomplete and inconsistent.

Steps to reproduce

  1. Define a custom settings class derived from midi::DefaultSettings
  2. Set Use1ByteParsing = false
  3. Create the instance with MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial2, MIDI, MyMIDISettings)
  4. Call read()
  5. Observe that the parser still behaves as if DefaultSettings were used

Expected behavior

Custom settings passed to the macro should also be used by MidiInterface, or the macro should support two explicit settings classes: one for MidiInterface and one for SerialMIDI.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions