本文整理汇总了C++中MidiMessage::isSysEx方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::isSysEx方法的具体用法?C++ MidiMessage::isSysEx怎么用?C++ MidiMessage::isSysEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::isSysEx方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleIncomingMidiMessage
void CtrlrMIDIDevice::handleIncomingMidiMessage (MidiInput* /*source*/, const MidiMessage& message)
{
_MIN(getProperty(Ids::name), message, -1);
#ifdef JUCE_LINUX
uint8 *ptr = (uint8 *)message.getRawData();
if (!message.isSysEx() && *(ptr + (message.getRawDataSize() - 1)) == 0xf7)
{
dataCollector.append (ptr, message.getRawDataSize());
deviceListeners.call (&CtrlrMIDIDevice::Listener::handleMIDIFromDevice, MidiMessage (dataCollector.getData(), dataCollector.getSize()));
return;
}
#endif
if (message.isSysEx())
{
#ifdef JUCE_LINUX
if (*(ptr + (message.getRawDataSize() - 1)) == 0xf7)
{
deviceListeners.call (&CtrlrMIDIDevice::Listener::handleMIDIFromDevice, message);
}
else
{
dataCollector = MemoryBlock (ptr, message.getRawDataSize());
}
#else
deviceListeners.call (&CtrlrMIDIDevice::Listener::handleMIDIFromDevice, message);
#endif
}
else
{
lastMessageWasSysex = false;
for (int i=0; i<deviceListeners.size(); i++)
{
const int ch = deviceListeners.getListeners() [i]->getListenerInputMidiChannel();
if (ch == message.getChannel() || ch == 0 || message.getChannel() == 0)
{
deviceListeners.getListeners() [i]->handleMIDIFromDevice (message);
}
}
}
}
示例2: ToHexString
void PGMidiDevice::PGMidiInputCallback::handleIncomingMidiMessage(MidiInput *source, const MidiMessage &msg)
{
Logger::getCurrentLogger()->writeToLog("midiin: recv message:");
string dbg = ToHexString(msg.getRawData(), msg.getRawDataSize());
Logger::getCurrentLogger()->writeToLog(dbg);
// currently, G1 should only send SysEx to app
if (!msg.isSysEx())
return;
const uint8 *buf = msg.getSysExData();
int size = msg.getSysExDataSize();
if (!PGSysExParser::IsPGSysEx(buf, size))
return;
switch (PGSysExParser::GetOpMsb(buf, size))
{
case REPLY_GRP:
OwnerMidiDevice->MidiMessageBox.NotifyReply(msg);
break;
case ACK_GRP:
case NAK_GRP:
OwnerMidiDevice->MidiMessageBox.NotifyAck(msg);
break;
default:
break;
}
}
示例3: sendMessageNow
void MidiOutput::sendMessageNow (const MidiMessage& message)
{
#if JUCE_IOS
const MIDITimeStamp timeStamp = mach_absolute_time();
#else
const MIDITimeStamp timeStamp = AudioGetCurrentHostTime();
#endif
HeapBlock<MIDIPacketList> allocatedPackets;
MIDIPacketList stackPacket;
MIDIPacketList* packetToSend = &stackPacket;
const size_t dataSize = (size_t) message.getRawDataSize();
if (message.isSysEx())
{
const int maxPacketSize = 256;
int pos = 0, bytesLeft = (int) dataSize;
const int numPackets = (bytesLeft + maxPacketSize - 1) / maxPacketSize;
allocatedPackets.malloc ((size_t) (32 * (size_t) numPackets + dataSize), 1);
packetToSend = allocatedPackets;
packetToSend->numPackets = (UInt32) numPackets;
MIDIPacket* p = packetToSend->packet;
for (int i = 0; i < numPackets; ++i)
{
p->timeStamp = timeStamp;
p->length = (UInt16) jmin (maxPacketSize, bytesLeft);
memcpy (p->data, message.getRawData() + pos, p->length);
pos += p->length;
bytesLeft -= p->length;
p = MIDIPacketNext (p);
}
}
else if (dataSize < 65536) // max packet size
{
const size_t stackCapacity = sizeof (stackPacket.packet->data);
if (dataSize > stackCapacity)
{
allocatedPackets.malloc ((sizeof (MIDIPacketList) - stackCapacity) + dataSize, 1);
packetToSend = allocatedPackets;
}
packetToSend->numPackets = 1;
MIDIPacket& p = *(packetToSend->packet);
p.timeStamp = timeStamp;
p.length = (UInt16) dataSize;
memcpy (p.data, message.getRawData(), dataSize);
}
else
{
jassertfalse; // packet too large to send!
return;
}
static_cast<CoreMidiHelpers::MidiPortAndEndpoint*> (internal)->send (packetToSend);
}
示例4: midiMessageToType
const CtrlrMidiMessageType midiMessageToType (const MidiMessage &midiMessage)
{
if (midiMessage.isController())
{
return (CC);
}
else if (midiMessage.isSysEx())
{
return (SysEx);
}
else if (midiMessage.isNoteOn())
{
return (NoteOn);
}
else if (midiMessage.isNoteOff())
{
return (NoteOff);
}
else if (midiMessage.isAftertouch())
{
return (Aftertouch);
}
else if (midiMessage.isChannelPressure())
{
return (ChannelPressure);
}
else if (midiMessage.isProgramChange())
{
return (ProgramChange);
}
else if (midiMessage.isPitchWheel())
{
return (PitchWheel);
}
else if (midiMessage.isMidiClock())
{
return (MidiClock);
}
else if (midiMessage.isMidiContinue())
{
return (MidiClockContinue);
}
else if (midiMessage.isMidiStart())
{
return (MidiClockStart);
}
else if (midiMessage.isMidiStop())
{
return (MidiClockStop);
}
else if (midiMessage.isActiveSense())
{
return (ActiveSense);
}
return (SysEx);
}
示例5: handleIncomingMidiMessage
void MIDIInputDevice::handleIncomingMidiMessage(MidiInput * source, const MidiMessage & message)
{
if (source != device)
{
DBG("different device");
return;
}
if (message.isNoteOn()) inputListeners.call(&MIDIInputListener::noteOnReceived, message.getChannel(), message.getNoteNumber(), message.getVelocity());
else if(message.isNoteOff()) inputListeners.call(&MIDIInputListener::noteOffReceived, message.getChannel(), message.getNoteNumber(), 0); //force note off to velocity 0
else if(message.isController()) inputListeners.call(&MIDIInputListener::controlChangeReceived, message.getChannel(), message.getControllerNumber(), message.getControllerValue());
else if(message.isSysEx()) inputListeners.call(&MIDIInputListener::sysExReceived, message);
}
示例6: sendMessageNow
void MidiOutput::sendMessageNow (const MidiMessage& message)
{
const MidiOutHandle* const handle = static_cast <const MidiOutHandle*> (internal);
if (message.getRawDataSize() > 3
|| message.isSysEx())
{
MIDIHDR h = { 0 };
h.lpData = (char*) message.getRawData();
h.dwBufferLength = message.getRawDataSize();
h.dwBytesRecorded = message.getRawDataSize();
if (midiOutPrepareHeader (handle->handle, &h, sizeof (MIDIHDR)) == MMSYSERR_NOERROR)
{
MMRESULT res = midiOutLongMsg (handle->handle, &h, sizeof (MIDIHDR));
if (res == MMSYSERR_NOERROR)
{
while ((h.dwFlags & MHDR_DONE) == 0)
Sleep (1);
int count = 500; // 1 sec timeout
while (--count >= 0)
{
res = midiOutUnprepareHeader (handle->handle, &h, sizeof (MIDIHDR));
if (res == MIDIERR_STILLPLAYING)
Sleep (2);
else
break;
}
}
}
}
else
{
midiOutShortMsg (handle->handle,
*(unsigned int*) message.getRawData());
}
}
示例7: sendMessageNow
void MidiOutput::sendMessageNow (const MidiMessage& message)
{
CoreMidiHelpers::MidiPortAndEndpoint* const mpe = static_cast<CoreMidiHelpers::MidiPortAndEndpoint*> (internal);
if (message.isSysEx())
{
const int maxPacketSize = 256;
int pos = 0, bytesLeft = message.getRawDataSize();
const int numPackets = (bytesLeft + maxPacketSize - 1) / maxPacketSize;
HeapBlock <MIDIPacketList> packets;
packets.malloc (32 * numPackets + message.getRawDataSize(), 1);
packets->numPackets = numPackets;
MIDIPacket* p = packets->packet;
for (int i = 0; i < numPackets; ++i)
{
p->timeStamp = 0;
p->length = jmin (maxPacketSize, bytesLeft);
memcpy (p->data, message.getRawData() + pos, p->length);
pos += p->length;
bytesLeft -= p->length;
p = MIDIPacketNext (p);
}
mpe->send (packets);
}
else
{
MIDIPacketList packets;
packets.numPackets = 1;
packets.packet[0].timeStamp = 0;
packets.packet[0].length = message.getRawDataSize();
*(int*) (packets.packet[0].data) = *(const int*) message.getRawData();
mpe->send (&packets);
}
}
示例8: timerCallback
//==============================================================================
void MidiMonitorEditor::timerCallback ()
{
MidiBuffer tmpBuffer;
int hours, minutes, seconds, frames;
MidiMessage::SmpteTimecodeType timeCode;
MidiMessageCollector* collector = owner->getMessageCollector ();
collector->removeNextBlockOfMessages (tmpBuffer, 1024);
if (! tmpBuffer.isEmpty())
{
String midiLine;
int samplePos = 0;
MidiMessage msg (0xf4, 0.0);
MidiBuffer::Iterator eventIterator (tmpBuffer);
while (eventIterator.getNextEvent (msg, samplePos))
{
midiLine.printf (T("[CH: %d] "), msg.getChannel());
if (msg.isNoteOnOrOff ())
{
midiLine += MidiMessage::getMidiNoteName (msg.getNoteNumber(),
true, true, 0);
midiLine += " ";
midiLine += String ((int) msg.getVelocity ());
if (msg.isNoteOn())
{
midiLine += " ON";
}
else
{
midiLine += " OFF";
}
}
else if (msg.isAllNotesOff())
{
midiLine += "ALL NOTES OFF";
}
else if (msg.isAllSoundOff())
{
midiLine += "ALL SOUND OFF";
}
else if (msg.isPitchWheel())
{
midiLine += "PITCHWEEL: ";
midiLine += String (msg.getPitchWheelValue());
}
else if (msg.isAftertouch())
{
midiLine += "AFTERTOUCH: ";
midiLine += String (msg.getAfterTouchValue());
}
else if (msg.isChannelPressure())
{
midiLine += "CHANNELPRESSURE: ";
midiLine += String (msg.getChannelPressureValue());
}
else if (msg.isSysEx())
{
midiLine += "SYSEX: ";
midiLine += String (msg.getSysExDataSize());
midiLine += " bytes";
}
else if (msg.isProgramChange())
{
midiLine += "PROGRAM CHANGE: ";
midiLine += String (msg.getProgramChangeNumber());
midiLine += " (";
midiLine += MidiMessage::getGMInstrumentName (msg.getProgramChangeNumber());
midiLine += ")";
}
else if (msg.isController())
{
midiLine += "CC: #";
midiLine += String (msg.getControllerNumber());
midiLine += " (";
midiLine += MidiMessage::getControllerName (msg.getControllerNumber());
midiLine += ") = ";
midiLine += String (msg.getControllerValue());
}
else if (msg.isTimeSignatureMetaEvent ())
{
int newNumerator, newDenominator;
msg.getTimeSignatureInfo (newNumerator, newDenominator);
midiLine += "TIME SIGNATURE: ";
midiLine += String (newNumerator);
midiLine += " / ";
midiLine += String (newDenominator);
}
else if (msg.isTempoMetaEvent ())
{
midiLine += "TEMPO: ";
midiLine += String (msg.getTempoSecondsPerQuarterNote ());
//midiLine += " ";
//midiLine += String (msg.getTempoMetaEventTickLength (ticksPerQuarterNote));
//.........这里部分代码省略.........
示例9: messageTypeChanged
void stepQuickEdit::messageTypeChanged()
{
MidiMessage *m = 0;
MidiBuffer *mB = 0;
if (editorComponent)
{
deleteAndZero (editorComponent);
}
if (midiMessage == 0)
{
return;
}
m = midiMessage->getMidiMessage();
if (m)
{
if (m->isNoteOn())
{
addAndMakeVisible (editorComponent = new stepEditNote(midiMessage));
typeCombo->setSelectedId (noteOn, true);
}
else if (m->isProgramChange())
{
typeCombo->setSelectedId (ProgramChange, true);
}
else if (m->isController())
{
addAndMakeVisible (editorComponent = new stepEditController(midiMessage));
typeCombo->setSelectedId (Controller, true);
}
else if (m->isMidiMachineControlMessage())
{
typeCombo->setSelectedId (MMC, true);
}
else if (m->isSysEx())
{
addAndMakeVisible (editorComponent = new stepEditSysex(midiMessage));
typeCombo->setSelectedId (SysEx, true);
}
resized();
}
mB = midiMessage->getMidiBuffer();
if (mB == 0)
return;
if (!m && mB)
{
MidiBuffer::Iterator i(*mB);
int len;
MidiMessage message (0xf4, 0.0);
if (i.getNextEvent (message, len))
{
uint8 *data = message.getRawData();
if (*data == 0xb0)
{
addAndMakeVisible (editorComponent = new stepEditController(midiMessage));
typeCombo->setSelectedId (Controller, true);
}
if (*data == 0xf0)
{
addAndMakeVisible (editorComponent = new stepEditSysex(midiMessage));
typeCombo->setSelectedId (SysEx, true);
}
resized();
}
}
}
示例10: getName
const String getName(const MidiMessage &m)
{
if (m.isActiveSense())
{
return (" [Active Sense]");
}
if (m.isAftertouch())
{
return (" [Aftertouch]");
}
if (m.isAllNotesOff())
{
return (" [All notes off]");
}
if (m.isAllSoundOff())
{
return (" [All sound off]");
}
if (m.isChannelPressure())
{
return (" [Channel pressure]");
}
if (m.isController())
{
return (" [Controller]");
}
if (m.isFullFrame())
{
return (" [Full frame]");
}
if (m.isMetaEvent())
{
return (" [Meta event]");
}
if (m.isMidiClock())
{
return (" [MIDI Clock]");
}
if (m.isMidiContinue())
{
return (" [MIDI Continue]");
}
if (m.isMidiStart())
{
return (" [MIDI Start]");
}
if (m.isMidiStop())
{
return (" [MIDI Stop]");
}
if (m.isNoteOff())
{
return (" [Note off]");
}
if (m.isNoteOn())
{
return (" [Note on]");
}
if (m.isPitchWheel())
{
return (" [Pitch wheel]");
}
if (m.isProgramChange())
{
return (" [Program change]");
}
if (m.isQuarterFrame())
{
return (" Quarter frame]");
}
if (m.isSysEx())
{
return (" [System exclusive]");
}
return (" [Yet unknown]");
}