本文整理汇总了C++中MidiMessage::setVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::setVelocity方法的具体用法?C++ MidiMessage::setVelocity怎么用?C++ MidiMessage::setVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::setVelocity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendCurrentNoteToBuffer
void Loop::sendCurrentNoteToBuffer(MidiBuffer& buffer, int sample_number, int velocity)
{
MidiMessage m = this->getEventPointer(currentIndex)->message;
//playingNote[m.getNoteNumber()][m.getChannel()-1][0] = jlimit(0,127,m.getNoteNumber()+getTransposition());
m.setNoteNumber(jlimit(0,127,m.getNoteNumber()+getTransposition()));
m.setVelocity((((float)velocity*midiScaler * velocitySensitivity) + (1.f-velocitySensitivity)));
if (outChannel>0) m.setChannel(outChannel);
buffer.addEvent(m,sample_number);
indexOfLastNoteOn=currentIndex;
}
示例2: processEvents
//==============================================================================
void MidiTransform::processEvents (MidiBuffer& midiMessages, const int blockSize)
{
int timeStamp;
MidiMessage message (0xf4, 0.0);
MidiBuffer::Iterator it (midiMessages);
MidiBuffer midiOutput;
switch (command)
{
case MidiTransform::KeepEvents:
break;
case MidiTransform::DiscardEvents:
{
midiMessages.clear ();
break;
}
case MidiTransform::RemapChannel:
{
while (it.getNextEvent (message, timeStamp))
{
message.setChannel (channelNumber);
midiOutput.addEvent (message, timeStamp);
}
midiMessages = midiOutput;
break;
}
case MidiTransform::ScaleNotes:
{
while (it.getNextEvent (message, timeStamp))
{
if (message.isNoteOnOrOff ())
{
message.setNoteNumber (roundFloatToInt (message.getNoteNumber () * noteScale));
midiOutput.addEvent (message, timeStamp);
}
}
midiMessages = midiOutput;
break;
}
case MidiTransform::InvertNotes:
{
while (it.getNextEvent (message, timeStamp))
{
if (message.isNoteOnOrOff ())
{
message.setNoteNumber (127 - message.getNoteNumber ());
midiOutput.addEvent (message, timeStamp);
}
}
midiMessages = midiOutput;
}
case MidiTransform::TransposeNotes:
{
while (it.getNextEvent (message, timeStamp))
{
if (message.isNoteOnOrOff ())
{
message.setNoteNumber (jmax (0, jmin (127, message.getNoteNumber () - noteTranspose)));
midiOutput.addEvent (message, timeStamp);
}
}
midiMessages = midiOutput;
break;
}
case MidiTransform::ScaleVelocity:
{
while (it.getNextEvent (message, timeStamp))
{
if (message.isNoteOn ())
{
message.setVelocity ((message.getVelocity () / 127.0f) * velocityScale);
midiOutput.addEvent (message, timeStamp);
}
}
midiMessages = midiOutput;
break;
}
case MidiTransform::InvertVelocity:
{
while (it.getNextEvent (message, timeStamp))
{
if (message.isNoteOn ())
{
message.setVelocity ((uint8) (127 - message.getVelocity ()));
midiOutput.addEvent (message, timeStamp);
}
}
midiMessages = midiOutput;
break;
}
case MidiTransform::TransposeVelocity:
{
while (it.getNextEvent (message, timeStamp))
{
if (message.isNoteOn ())
{
message.setVelocity (jmax (0, jmin (127, message.getVelocity () - velocityTranspose)));
midiOutput.addEvent (message, timeStamp);
//.........这里部分代码省略.........