meltysynth
meltysynth copied to clipboard
Add InstrumentChange constant
In alternative to #25, we can add single constant InstrumentChange
inside Synthesizer?
Sample:
Before
// Change the instrument to electric guitar (#30).
synthesizer.ProcessMidiMessage(0, 0xC0, 30, 0);
After
// Change the instrument to electric guitar (#30).
synthesizer.ProcessMidiMessage(0, Synthesizer.InstrumentChange, 30, 0);
There are a number of commands defined in the General MIDI specifications. Is there a particular reason to add a constant only for instrument change?
0xC0
its a unique code i'm using in HGS-Tone:
public void SetInstrument(MidiInstrumentCode code)
{
SetInstrument((int)code);
}
public void SetInstrument(int id)
{
_synthesizer.ProcessMidiMessage(0, 0xC0, id, 0);
}
I was thinking of creating a constant InstrumentChange
in my code, but I think having this constant in MeltySynth
could help other people. My library is too simple, I don't think I will manage MIDI codes.
Here is my opinion:
I believe that this library should provide only what users cannot easily achieve. Since adding a constant for convenience is not hard for users, that should not be in the library. This is mainly to keep the API simple.
Hey, sorry for delay, i agree with you, i'll keep the constants in my code base.
Thank you! :D