mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Added another MidiMessageSequence::addSequence method
This commit is contained in:
parent
3a8f6d0300
commit
08788c3e05
2 changed files with 26 additions and 6 deletions
|
|
@ -156,23 +156,34 @@ struct MidiMessageSequenceSorter
|
|||
}
|
||||
};
|
||||
|
||||
void MidiMessageSequence::addSequence (const MidiMessageSequence& other, double timeAdjustment)
|
||||
{
|
||||
for (int i = 0; i < other.list.size(); ++i)
|
||||
{
|
||||
const MidiMessage& m = other.list.getUnchecked(i)->message;
|
||||
|
||||
MidiEventHolder* const newOne = new MidiEventHolder (m);
|
||||
newOne->message.addToTimeStamp (timeAdjustment);
|
||||
list.add (newOne);
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
void MidiMessageSequence::addSequence (const MidiMessageSequence& other,
|
||||
double timeAdjustment,
|
||||
double firstAllowableTime,
|
||||
double endOfAllowableDestTimes)
|
||||
{
|
||||
firstAllowableTime -= timeAdjustment;
|
||||
endOfAllowableDestTimes -= timeAdjustment;
|
||||
|
||||
for (int i = 0; i < other.list.size(); ++i)
|
||||
{
|
||||
const MidiMessage& m = other.list.getUnchecked(i)->message;
|
||||
const double t = m.getTimeStamp();
|
||||
const double t = m.getTimeStamp() + timeAdjustment;
|
||||
|
||||
if (t >= firstAllowableTime && t < endOfAllowableDestTimes)
|
||||
{
|
||||
MidiEventHolder* const newOne = new MidiEventHolder (m);
|
||||
newOne->message.setTimeStamp (timeAdjustment + t);
|
||||
newOne->message.setTimeStamp (t);
|
||||
|
||||
list.add (newOne);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ public:
|
|||
void deleteEvent (int index, bool deleteMatchingNoteUp);
|
||||
|
||||
/** Merges another sequence into this one.
|
||||
|
||||
Remember to call updateMatchedPairs() after using this method.
|
||||
|
||||
@param other the sequence to add from
|
||||
|
|
@ -178,6 +177,16 @@ public:
|
|||
double firstAllowableDestTime,
|
||||
double endOfAllowableDestTimes);
|
||||
|
||||
/** Merges another sequence into this one.
|
||||
Remember to call updateMatchedPairs() after using this method.
|
||||
|
||||
@param other the sequence to add from
|
||||
@param timeAdjustmentDelta an amount to add to the timestamps of the midi events
|
||||
as they are read from the other sequence
|
||||
*/
|
||||
void addSequence (const MidiMessageSequence& other,
|
||||
double timeAdjustmentDelta);
|
||||
|
||||
//==============================================================================
|
||||
/** Makes sure all the note-on and note-off pairs are up-to-date.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue