本文整理汇总了C++中MidiMessage::getControllerNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::getControllerNumber方法的具体用法?C++ MidiMessage::getControllerNumber怎么用?C++ MidiMessage::getControllerNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::getControllerNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleMidiEvent
void Synthesiser::handleMidiEvent (const MidiMessage& m)
{
if (m.isNoteOn())
{
noteOn (m.getChannel(),
m.getNoteNumber(),
m.getFloatVelocity());
}
else if (m.isNoteOff())
{
noteOff (m.getChannel(),
m.getNoteNumber(),
true);
}
else if (m.isAllNotesOff() || m.isAllSoundOff())
{
allNotesOff (m.getChannel(), true);
}
else if (m.isPitchWheel())
{
const int channel = m.getChannel();
const int wheelPos = m.getPitchWheelValue();
lastPitchWheelValues [channel - 1] = wheelPos;
handlePitchWheel (channel, wheelPos);
}
else if (m.isController())
{
handleController (m.getChannel(),
m.getControllerNumber(),
m.getControllerValue());
}
}
示例2: eventRemoved
//==============================================================================
bool MidiSequencePlugin::eventRemoved (const int controller, const double automationValue, const float beatNumber)
{
DBG ("Removing:" + String (automationValue) + " " + String (beatNumber));
double noteOnBeats = beatNumber - NOTE_PREFRAMES;
int eventIndex = midiSequence->getNextIndexAtTime (noteOnBeats);
while (eventIndex < midiSequence->getNumEvents ())
{
MidiMessage* eventOn = &midiSequence->getEventPointer (eventIndex)->message;
if (eventOn->isController() && eventOn->getControllerNumber() == controller && eventOn->getControllerValue() == floor(automationValue * 127))
{
{
const ScopedLock sl (parentHost->getCallbackLock());
midiSequence->deleteEvent (eventIndex, true);
}
DBG ("Removed:" + String (eventIndex) + " > " + String (automationValue) + " @ " + String (beatNumber));
if (transport->isPlaying ())
doAllNotesOff = true;
return true;
}
eventIndex++;
}
DBG (">>> Remove failed:" + String (automationValue) + " @ " + String (beatNumber));
return false;
}
示例3: PK_STRING
static PyObject *
PyMidiMessage_str(PyObject *self) {
MidiMessage *m = ((PyMidiMessage*)self)->m;
static char s[256];
if(m->isNoteOn()) {
sprintf(s, "<NOTE ON, note: %d (%s), velocity: %d, channel: %d>",
m->getNoteNumber(),
m->getMidiNoteName(m->getNoteNumber(), true, true, 3),
m->getVelocity(),
m->getChannel());
} else if(m->isNoteOff()) {
sprintf(s, "<NOTE OFF, note: %d (%s), channel: %d>",
m->getNoteNumber(),
m->getMidiNoteName(m->getNoteNumber(), true, true, 3),
m->getChannel());
} else if(m->isProgramChange()) {
sprintf(s, "<PROGRAM CHANGE: program: %d, channel: %d>", m->getProgramChangeNumber(), m->getChannel());
} else if(m->isPitchWheel()) {
sprintf(s, "<PITCH WHEEL: value: %d, channel: %d>", m->getPitchWheelValue(), m->getChannel());
} else if(m->isAftertouch()) {
sprintf(s, "<AFTERTOUCH: note: %d (%s) value: %d, channel: %d>",
m->getNoteNumber(),
m->getMidiNoteName(m->getNoteNumber(), true, true, 3),
m->getAfterTouchValue(),
m->getChannel());
} else if(m->isChannelPressure()) {
sprintf(s, "<CHANNEL PRESSURE: pressure: %d, channel: %d>", m->getChannelPressureValue(), m->getChannel());
} else if(m->isController()) {
const char *name = m->getControllerName(m->getControllerNumber());
if(strlen(name) > 0) {
sprintf(s, "<CONTROLLER: %d (\"%s\"), value: %d, channel: %d>",
m->getControllerNumber(),
m->getControllerName(m->getControllerNumber()),
m->getControllerValue(),
m->getChannel());
} else {
sprintf(s, "<CONTROLLER: %d, value: %d, channel: %d>",
m->getControllerNumber(),
m->getControllerValue(),
m->getChannel());
}
} else {
sprintf(s, "<MidiMessage (misc type)>");
}
return PK_STRING(s);
}
示例4: processMidiMessage
void MidiManager::processMidiMessage(const MidiMessage& midi_message, int sample_position) {
if (midi_message.isProgramChange()) {
current_patch_ = midi_message.getProgramChangeNumber();
File patch = LoadSave::loadPatch(current_bank_, current_folder_, current_patch_,
synth_, *gui_state_);
PatchLoadedCallback* callback = new PatchLoadedCallback(listener_, patch);
callback->post();
return;
}
if (midi_message.isNoteOn()) {
engine_->noteOn(midi_message.getNoteNumber(),
midi_message.getVelocity() / (mopo::MIDI_SIZE - 1.0),
0, midi_message.getChannel() - 1);
}
else if (midi_message.isNoteOff())
engine_->noteOff(midi_message.getNoteNumber());
else if (midi_message.isAllNotesOff())
engine_->allNotesOff();
else if (midi_message.isSustainPedalOn())
engine_->sustainOn();
else if (midi_message.isSustainPedalOff())
engine_->sustainOff();
else if (midi_message.isAftertouch()) {
mopo::mopo_float note = midi_message.getNoteNumber();
mopo::mopo_float value = (1.0 * midi_message.getAfterTouchValue()) / mopo::MIDI_SIZE;
engine_->setAftertouch(note, value);
}
else if (midi_message.isPitchWheel()) {
double percent = (1.0 * midi_message.getPitchWheelValue()) / PITCH_WHEEL_RESOLUTION;
double value = 2 * percent - 1.0;
engine_->setPitchWheel(value, midi_message.getChannel());
}
else if (midi_message.isController()) {
int controller_number = midi_message.getControllerNumber();
if (controller_number == MOD_WHEEL_CONTROL_NUMBER) {
double percent = (1.0 * midi_message.getControllerValue()) / MOD_WHEEL_RESOLUTION;
engine_->setModWheel(percent, midi_message.getChannel());
}
else if (controller_number == BANK_SELECT_NUMBER)
current_bank_ = midi_message.getControllerValue();
else if (controller_number == FOLDER_SELECT_NUMBER)
current_folder_ = midi_message.getControllerValue();
midiInput(midi_message.getControllerNumber(), midi_message.getControllerValue());
}
}
示例5: handleMidiEvent
void MPESynthesiser::handleMidiEvent (const MidiMessage& m)
{
if (m.isController())
handleController (m.getChannel(), m.getControllerNumber(), m.getControllerValue());
else if (m.isProgramChange())
handleProgramChange (m.getChannel(), m.getProgramChangeNumber());
MPESynthesiserBase::handleMidiEvent (m);
}
示例6: handleIncomingMidiMessage
void VoicerUGenInternal::handleIncomingMidiMessage (MidiInput* /*source*/, const MidiMessage& message) throw()
{
if(message.isForChannel(midiChannel_) == false) return;
if(message.isNoteOnOrOff())
{
const ScopedLock sl(lock);
sendMidiNote(message.getChannel(), message.getNoteNumber(), message.getVelocity());
}
else if(message.isController())
{
if((message.getControllerNumber() == 123) && (message.getControllerValue() == 0))
{
const ScopedLock sl(lock);
initEvents();
}
getController(message.getControllerNumber()) =
(message.getControllerValue() * (1.f / 127.f));
}
else if(message.isPitchWheel())
{
getPitchWheel() = (jlimit(-8191, 8191, message.getPitchWheelValue() - 8192) * (1.f / 8191.f));
}
else if(message.isChannelPressure())
{
getChannelPressure() = (message.getChannelPressureValue() * (1.f / 127.f));
}
else if(message.isAftertouch())
{
getKeyPressure(message.getNoteNumber()) =
(message.getAfterTouchValue() * (1.f / 127.f));
}
else if(message.isProgramChange())
{
getProgram() = (message.getProgramChangeNumber());
}
else if(message.isAllNotesOff())
{
const ScopedLock sl(lock);
initEvents();
}
}
示例7: handleIncomingMidiMessage
void MidiPedalCallback::handleIncomingMidiMessage (MidiInput *source, const MidiMessage &message)
{
if (message.isController()) {
int x = message.getControllerNumber();
bool button_check = is_item_in_list(x, button_check_list);
if (button_check == true) {
buttonPressed = x;
sendActionMessage("To audio_midi from midiPedalCallback: grab buttonPressed");
}
}
}
示例8: getMidiMessageDescription
String ZenMidiVisualiserComponent::getMidiMessageDescription(const MidiMessage& m)
{
if (m.isNoteOn()) return "Note on: " + S(m.getNoteNumber()) + " (" + MidiMessage::getMidiNoteName(m.getNoteNumber(), true, true, 3) + ") Vel: " + S(m.getVelocity());
if (m.isNoteOff()) return "Note off: " + S(m.getNoteNumber()) + " (" + MidiMessage::getMidiNoteName(m.getNoteNumber(), true, true, 3) + ")";
if (m.isProgramChange()) return "Program change (Number): " + String(m.getProgramChangeNumber());
if (m.isPitchWheel()) return "Pitch wheel: " + String(m.getPitchWheelValue());
if (m.isAftertouch()) return "After touch: " + MidiMessage::getMidiNoteName(m.getNoteNumber(), true, true, 3) + ": " + String(m.getAfterTouchValue());
if (m.isChannelPressure()) return "Channel pressure: " + String(m.getChannelPressureValue());
if (m.isAllNotesOff()) return "All notes off";
if (m.isAllSoundOff()) return "All sound off";
if (m.isMetaEvent()) return "Meta event";
if (m.isController())
{
String temp = MidiMessage::getControllerName(m.getControllerNumber());
String name = "Controller [" + S(m.getControllerNumber()) + "]";
if (!temp.isEmpty())
name += " " + temp;
return name + ": " + String(m.getControllerValue());
}
return String::toHexString(m.getRawData(), m.getRawDataSize());
}
示例9: getMidiMessageDescription
static String getMidiMessageDescription (const MidiMessage& m)
{
if (m.isNoteOn()) return "Note on " + MidiMessage::getMidiNoteName (m.getNoteNumber(), true, true, 3);
if (m.isNoteOff()) return "Note off " + MidiMessage::getMidiNoteName (m.getNoteNumber(), true, true, 3);
if (m.isProgramChange()) return "Program change " + String (m.getProgramChangeNumber());
if (m.isPitchWheel()) return "Pitch wheel " + String (m.getPitchWheelValue());
if (m.isAftertouch()) return "After touch " + MidiMessage::getMidiNoteName (m.getNoteNumber(), true, true, 3) + ": " + String (m.getAfterTouchValue());
if (m.isChannelPressure()) return "Channel pressure " + String (m.getChannelPressureValue());
if (m.isAllNotesOff()) return "All notes off";
if (m.isAllSoundOff()) return "All sound off";
if (m.isMetaEvent()) return "Meta event";
if (m.isController())
{
String name (MidiMessage::getControllerName (m.getControllerNumber()));
if (name.isEmpty())
name = "[" + String (m.getControllerNumber()) + "]";
return "Controler " + name + ": " + String (m.getControllerValue());
}
return String::toHexString (m.getRawData(), m.getRawDataSize());
}
示例10: processNextMidiEvent
//==============================================================================
void MPEZoneLayout::processNextMidiEvent (const MidiMessage& message)
{
if (! message.isController())
return;
MidiRPNMessage rpn;
if (rpnDetector.parseControllerMessage (message.getChannel(),
message.getControllerNumber(),
message.getControllerValue(),
rpn))
{
processRpnMessage (rpn);
}
}
示例11: midiIterator
void Pfm2AudioProcessor::handleIncomingMidiBuffer(MidiBuffer &buffer, int numberOfSamples) {
if (!buffer.isEmpty()) {
MidiBuffer newBuffer;
MidiMessage midiMessage;
int samplePosition;
MidiBuffer::Iterator midiIterator(buffer);
while (midiIterator.getNextEvent(midiMessage, samplePosition)) {
bool copyMessageInNewBuffer = true;
if (midiMessage.isController() && midiMessage.getChannel() == currentMidiChannel) {
switch (midiMessage.getControllerNumber()) {
case 99:
currentNrpn.paramMSB = midiMessage.getControllerValue();
copyMessageInNewBuffer = false;
break;
case 98:
currentNrpn.paramLSB = midiMessage.getControllerValue();
copyMessageInNewBuffer = false;
break;
case 6:
currentNrpn.valueMSB = midiMessage.getControllerValue();
copyMessageInNewBuffer = false;
break;
case 38:
{
currentNrpn.valueLSB = midiMessage.getControllerValue();
copyMessageInNewBuffer = false;
int param = (int)(currentNrpn.paramMSB << 7) + currentNrpn.paramLSB;
int value = (int)(currentNrpn.valueMSB << 7) + currentNrpn.valueLSB;
const MessageManagerLock mmLock;
handleIncomingNrpn(param, value);
break;
}
}
}
if (copyMessageInNewBuffer) {
newBuffer.addEvent(midiMessage, samplePosition);
}
}
buffer.swapWith(newBuffer);
}
}
示例12: getControllerIndexed
//==============================================================================
void MidiSequencePlugin::getControllerIndexed (const int index, int& controllerNum, double& value, double& beat)
{
int numNoteOn = 0;
for (int i = 0; i < midiSequence->getNumEvents (); i++)
{
MidiMessageSequence::MidiEventHolder* eventOn = midiSequence->getEventPointer (i);
MidiMessage* msgOn = & eventOn->message;
if (eventOn->message.isController ())
{
if (index == numNoteOn)
{
controllerNum = msgOn->getControllerNumber();
value = msgOn->getControllerValue () / 127.0;
beat = msgOn->getTimeStamp ();
break;
}
numNoteOn++;
}
}
}
示例13: eventMoved
//==============================================================================
bool MidiSequencePlugin::eventMoved (
const int controllerNum,
const double oldValue,
const float oldBeat,
const double automationValue,
const float beatNumber)
{
DBG ("Moving:" + String (oldValue) + " " + String (oldBeat));
double noteOnBeats = oldBeat - NOTE_PREFRAMES;
int eventIndex = midiSequence->getNextIndexAtTime (noteOnBeats);
while (eventIndex < midiSequence->getNumEvents ())
{
MidiMessage* eventOn = &midiSequence->getEventPointer (eventIndex)->message;
if (eventOn->isController() && eventOn->getControllerNumber() == controllerNum && eventOn->getControllerValue() == floor(oldValue * 127)) // should make this a "matches controller" method
{
MidiMessage msgOn = MidiMessage::controllerEvent (NOTE_CHANNEL, controllerNum, automationValue * 127);
msgOn.setTimeStamp (beatNumber);
{
const ScopedLock sl (parentHost->getCallbackLock());
// remove old events
midiSequence->deleteEvent (eventIndex, true);
midiSequence->addEvent (msgOn);
}
return true;
}
eventIndex++;
}
DBG (">>> Move failed:" + String (oldValue) + " @ " + String (oldBeat));
return false;
}
示例14: handleMidiEvent
void Synthesiser::handleMidiEvent (const MidiMessage& m)
{
const int channel = m.getChannel();
if (m.isNoteOn())
{
noteOn (channel, m.getNoteNumber(), m.getFloatVelocity());
}
else if (m.isNoteOff())
{
noteOff (channel, m.getNoteNumber(), m.getFloatVelocity(), true);
}
else if (m.isAllNotesOff() || m.isAllSoundOff())
{
allNotesOff (channel, true);
}
else if (m.isPitchWheel())
{
const int wheelPos = m.getPitchWheelValue();
lastPitchWheelValues [channel - 1] = wheelPos;
handlePitchWheel (channel, wheelPos);
}
else if (m.isAftertouch())
{
handleAftertouch (channel, m.getNoteNumber(), m.getAfterTouchValue());
}
else if (m.isChannelPressure())
{
handleChannelPressure (channel, m.getChannelPressureValue());
}
else if (m.isController())
{
handleController (channel, m.getControllerNumber(), m.getControllerValue());
}
else if (m.isProgramChange())
{
handleProgramChange (channel, m.getProgramChangeNumber());
}
}
示例15: getMidiNumber
const String getMidiNumber(const MidiMessage &m)
{
if (m.isAftertouch())
{
return (String::formatted (" No:[%4d]", m.getNoteNumber()));
}
if (m.isController())
{
return (String::formatted (" No:[%4d]", m.getControllerNumber()));
}
if (m.isNoteOnOrOff())
{
return (String::formatted (" No:[%4d]", m.getNoteNumber()));
}
if (m.isProgramChange())
{
return (String::formatted (" No:[%4d]", m.getProgramChangeNumber()));
}
return (" No:[----]");
}