summaryrefslogtreecommitdiff
path: root/libs/evoral
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-11-06 22:04:35 -0500
committerDavid Robillard <d@drobilla.net>2016-12-03 15:18:21 -0500
commit08fffeffec10beb708610fd35eb9e7c35365d446 (patch)
treece9c8c77e6a926b4d8be90052c32945b7718bb4b /libs/evoral
parent875b1367b2c4750ecd861424c57ed4bcc9c642d2 (diff)
Remove Evoral::MIDIEvent
It is slightly questionable whether type specific methods like velocity() belong on Event at all, these may be better off as free functions. However the code currently uses them as methods in many places, and it seems like a step in the right direction, since, for example, we might some day have events that have a velocity but aren't stored as MIDI messages (e.g. if Ardour uses an internal musical model that is more expressive). In any case, the former inheritance and plethora of sloppy casts is definitely not the right thing.
Diffstat (limited to 'libs/evoral')
-rw-r--r--libs/evoral/MSVCevoral/evoral.vcproj4
-rw-r--r--libs/evoral/evoral/Event.hpp119
-rw-r--r--libs/evoral/evoral/MIDIEvent.hpp115
-rw-r--r--libs/evoral/evoral/MIDIXML.hpp6
-rw-r--r--libs/evoral/evoral/Note.hpp6
-rw-r--r--libs/evoral/evoral/PatchChange.hpp10
-rw-r--r--libs/evoral/evoral/Sequence.hpp6
-rw-r--r--libs/evoral/src/Note.cpp1
-rw-r--r--libs/evoral/src/Sequence.cpp14
-rw-r--r--libs/evoral/test/SequenceTest.cpp4
10 files changed, 107 insertions, 178 deletions
diff --git a/libs/evoral/MSVCevoral/evoral.vcproj b/libs/evoral/MSVCevoral/evoral.vcproj
index 1f0c00f341..512438000d 100644
--- a/libs/evoral/MSVCevoral/evoral.vcproj
+++ b/libs/evoral/MSVCevoral/evoral.vcproj
@@ -284,7 +284,7 @@
>
</File>
<File
- RelativePath="..\src\MIDIEvent.cpp"
+ RelativePath="..\src\MIDIXML.cpp"
>
</File>
<File
@@ -496,7 +496,7 @@
>
</File>
<File
- RelativePath="..\evoral\MIDIEvent.hpp"
+ RelativePath="..\evoral\MIDIXML.hpp"
>
</File>
<File
diff --git a/libs/evoral/evoral/Event.hpp b/libs/evoral/evoral/Event.hpp
index cbb62e2f4c..526513b3fe 100644
--- a/libs/evoral/evoral/Event.hpp
+++ b/libs/evoral/evoral/Event.hpp
@@ -1,5 +1,5 @@
/* This file is part of Evoral.
- * Copyright (C) 2008 David Robillard <http://drobilla.net>
+ * Copyright (C) 2008-2016 David Robillard <http://drobilla.net>
* Copyright (C) 2000-2008 Paul Davis
*
* Evoral is free software; you can redistribute it and/or modify it under the
@@ -24,8 +24,9 @@
#include <sstream>
#include <stdint.h>
-#include "evoral/visibility.h"
+#include "evoral/midi_events.h"
#include "evoral/types.hpp"
+#include "evoral/visibility.h"
/** If this is not defined, all methods of MidiEvent are RT safe
* but MidiEvent will never deep copy and (depending on the scenario)
@@ -37,7 +38,7 @@ namespace Evoral {
LIBEVORAL_API event_id_t event_id_counter();
LIBEVORAL_API event_id_t next_event_id();
-LIBEVORAL_API void init_event_id_counter(event_id_t n);
+LIBEVORAL_API void init_event_id_counter(event_id_t n);
/** An event (much like a type generic jack_midi_event_t)
*
@@ -47,9 +48,9 @@ template<typename Time>
class LIBEVORAL_API Event {
public:
#ifdef EVORAL_EVENT_ALLOC
- Event (EventType type=0, Time time=Time(), uint32_t size=0, uint8_t* buf=NULL, bool alloc=false);
+ Event(EventType type=0, Time time=Time(), uint32_t size=0, uint8_t* buf=NULL, bool alloc=false);
- Event (EventType type, Time time, uint32_t size, const uint8_t* buf);
+ Event(EventType type, Time time, uint32_t size, const uint8_t* buf);
/** Copy \a copy.
*
@@ -59,33 +60,20 @@ public:
*/
Event(const Event& copy, bool alloc);
- ~Event();
+ ~Event();
- void assign (const Event& other);
+ void assign(const Event& other);
void set(const uint8_t* buf, uint32_t size, Time t);
inline bool operator==(const Event& other) const {
- if (_type != other._type)
+ if (_type != other._type ||
+ _nominal_time != other._nominal_time ||
+ _original_time != other._original_time ||
+ _size != other._size) {
return false;
-
- if (_nominal_time != other._nominal_time)
- return false;
-
- if (_original_time != other._original_time)
- return false;
-
- if (_size != other._size)
- return false;
-
- if (_buf == other._buf)
- return true;
-
- for (uint32_t i=0; i < _size; ++i)
- if (_buf[i] != other._buf[i])
- return false;
-
- return true;
+ }
+ return !memcmp(_buf, other._buf, _size);
}
inline bool operator!=(const Event& other) const { return ! operator==(other); }
@@ -127,10 +115,6 @@ public:
_buf = NULL;
}
-#else
-
- inline void set_buffer(uint8_t* buf) { _buf = buf; }
-
#endif // EVORAL_EVENT_ALLOC
inline EventType event_type() const { return _type; }
@@ -148,15 +132,76 @@ public:
inline event_id_t id() const { return _id; }
inline void set_id(event_id_t n) { _id = n; }
+ /* The following methods are type specific and only make sense for the
+ correct event type. It is the caller's responsibility to only call
+ methods which make sense for the given event type. Currently this means
+ they all only make sense for MIDI, but built-in support may be added for
+ other protocols in the future, or the internal representation may change
+ to be protocol agnostic. */
+
+ uint8_t type() const { return _buf[0] & 0xF0; }
+ uint8_t channel() const { return _buf[0] & 0x0F; }
+ bool is_note_on() const { return type() == MIDI_CMD_NOTE_ON; }
+ bool is_note_off() const { return type() == MIDI_CMD_NOTE_OFF; }
+ bool is_note() const { return is_note_on() || is_note_off(); }
+ bool is_poly_pressure() const { return type() == MIDI_CMD_NOTE_PRESSURE; }
+ bool is_channel_pressure() const { return type() == MIDI_CMD_CHANNEL_PRESSURE; }
+ bool is_cc() const { return type() == MIDI_CMD_CONTROL; }
+ bool is_pgm_change() const { return type() == MIDI_CMD_PGM_CHANGE; }
+ bool is_pitch_bender() const { return type() == MIDI_CMD_BENDER; }
+ bool is_channel_event() const { return (0x80 <= type()) && (type() <= 0xE0); }
+ bool is_smf_meta_event() const { return _buf[0] == 0xFF; }
+ bool is_sysex() const { return _buf[0] == 0xF0 || _buf[0] == 0xF7; }
+ bool is_spp() const { return _buf[0] == 0xF2 && size() == 1; }
+ bool is_mtc_quarter() const { return _buf[0] == 0xF1 && size() == 1; }
+ bool is_mtc_full() const { return (size() == 10 &&
+ _buf[0] == 0xF0 && _buf[1] == 0x7F &&
+ _buf[3] == 0x01 && _buf[4] == 0x01); }
+
+ uint8_t note() const { return _buf[1]; }
+ uint8_t velocity() const { return _buf[2]; }
+ uint8_t poly_note() const { return _buf[1]; }
+ uint8_t poly_pressure() const { return _buf[2]; }
+ uint8_t channel_pressure() const { return _buf[1]; }
+ uint8_t cc_number() const { return _buf[1]; }
+ uint8_t cc_value() const { return _buf[2]; }
+ uint8_t pgm_number() const { return _buf[1]; }
+ uint8_t pitch_bender_lsb() const { return _buf[1]; }
+ uint8_t pitch_bender_msb() const { return _buf[2]; }
+ uint16_t pitch_bender_value() const { return ((0x7F & _buf[2]) << 7 | (0x7F & _buf[1])); }
+
+ void set_channel(uint8_t channel) { _buf[0] = (0xF0 & _buf[0]) | (0x0F & channel); }
+ void set_type(uint8_t type) { _buf[0] = (0x0F & _buf[0]) | (0xF0 & type); }
+ void set_note(uint8_t num) { _buf[1] = num; }
+ void set_velocity(uint8_t val) { _buf[2] = val; }
+ void set_cc_number(uint8_t num) { _buf[1] = num; }
+ void set_cc_value(uint8_t val) { _buf[2] = val; }
+ void set_pgm_number(uint8_t num) { _buf[1] = num; }
+
+ uint16_t value() const {
+ switch (type()) {
+ case MIDI_CMD_CONTROL:
+ return cc_value();
+ case MIDI_CMD_BENDER:
+ return pitch_bender_value();
+ case MIDI_CMD_NOTE_PRESSURE:
+ return poly_pressure();
+ case MIDI_CMD_CHANNEL_PRESSURE:
+ return channel_pressure();
+ default:
+ return 0;
+ }
+ }
+
protected:
- EventType _type; /**< Type of event (application relative, NOT MIDI 'type') */
- Time _original_time; /**< Sample index (or beat time) at which event is valid */
- Time _nominal_time; /**< Quantized version of _time, used in preference */
- uint32_t _size; /**< Number of uint8_ts of data in \a buffer */
- uint8_t* _buf; /**< Raw MIDI data */
- event_id_t _id; /** UUID for each event, should probably be 64bit or at least unsigned */
+ EventType _type; ///< Type of event (application relative, NOT MIDI 'type')
+ Time _original_time; ///< Time stamp of event
+ Time _nominal_time; ///< Quantized version of _time, used in preference
+ uint32_t _size; ///< Size of buffer in bytes
+ uint8_t* _buf; ///< Event contents (e.g. raw MIDI data)
+ event_id_t _id; ///< Unique event ID
#ifdef EVORAL_EVENT_ALLOC
- bool _owns_buf; /**< Whether buffer is locally allocated */
+ bool _owns_buf; ///< Whether buffer is locally allocated
#endif
};
diff --git a/libs/evoral/evoral/MIDIEvent.hpp b/libs/evoral/evoral/MIDIEvent.hpp
deleted file mode 100644
index e8320c3e35..0000000000
--- a/libs/evoral/evoral/MIDIEvent.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/* This file is part of Evoral.
- * Copyright (C) 2008 David Robillard <http://drobilla.net>
- * Copyright (C) 2000-2008 Paul Davis
- *
- * Evoral is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef EVORAL_MIDI_EVENT_HPP
-#define EVORAL_MIDI_EVENT_HPP
-
-#include <cmath>
-#include <boost/shared_ptr.hpp>
-
-#include "evoral/visibility.h"
-#include "evoral/Event.hpp"
-#include "evoral/midi_events.h"
-
-namespace Evoral {
-
-/** MIDI helper functions for an Event.
- *
- * This class contains no data, an Evoral::Event can be cast to a MIDIEvent
- * but the application must make sure the Event actually contains
- * valid MIDI data for these functions to make sense.
- */
-template<typename Time>
-class /*LIBEVORAL_API*/ MIDIEvent : public Event<Time> {
-public:
- MIDIEvent(EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false)
- : Event<Time>(type, time, size, buf, alloc)
- {}
-
- MIDIEvent(const Event<Time>& copy, bool alloc)
- : Event<Time>(copy, alloc)
- {}
-
- inline uint8_t type() const { return (this->_buf[0] & 0xF0); }
- inline void set_type(uint8_t type) { this->_buf[0] = (0x0F & this->_buf[0])
- | (0xF0 & type); }
-
- inline uint8_t channel() const { return (this->_buf[0] & 0x0F); }
- inline void set_channel(uint8_t channel) { this->_buf[0] = (0xF0 & this->_buf[0])
- | (0x0F & channel); }
-
- inline bool is_note_on() const { return (type() == MIDI_CMD_NOTE_ON); }
- inline bool is_note_off() const { return (type() == MIDI_CMD_NOTE_OFF); }
- inline bool is_cc() const { return (type() == MIDI_CMD_CONTROL); }
- inline bool is_pitch_bender() const { return (type() == MIDI_CMD_BENDER); }
- inline bool is_pgm_change() const { return (type() == MIDI_CMD_PGM_CHANGE); }
- inline bool is_note() const { return (is_note_on() || is_note_off()); }
- inline bool is_poly_pressure() const { return (type() == MIDI_CMD_NOTE_PRESSURE); }
- inline bool is_channel_pressure() const { return (type() == MIDI_CMD_CHANNEL_PRESSURE); }
- inline uint8_t note() const { return (this->_buf[1]); }
- inline void set_note(uint8_t n) { this->_buf[1] = n; }
- inline uint8_t velocity() const { return (this->_buf[2]); }
- inline void set_velocity(uint8_t value) { this->_buf[2] = value; }
- inline void scale_velocity(float factor) {
- if (factor < 0) factor = 0;
- this->_buf[2] = (uint8_t) lrintf (this->_buf[2]*factor);
- if (this->_buf[2] > 127) this->_buf[2] = 127;
- }
- inline uint8_t cc_number() const { return (this->_buf[1]); }
- inline void set_cc_number(uint8_t number) { this->_buf[1] = number; }
- inline uint8_t cc_value() const { return (this->_buf[2]); }
- inline void set_cc_value(uint8_t value) { this->_buf[2] = value; }
- inline uint8_t pitch_bender_lsb() const { return (this->_buf[1]); }
- inline uint8_t pitch_bender_msb() const { return (this->_buf[2]); }
- inline uint16_t pitch_bender_value() const { return ( ((0x7F & this->_buf[2]) << 7)
- | (0x7F & this->_buf[1]) ); }
- inline uint8_t pgm_number() const { return (this->_buf[1]); }
- inline void set_pgm_number(uint8_t number) { this->_buf[1] = number; }
- inline uint8_t poly_note() const { return (this->_buf[1]); }
- inline uint8_t poly_pressure() const { return (this->_buf[2]); }
- inline uint8_t channel_pressure() const { return (this->_buf[1]); }
- inline bool is_channel_event() const { return (0x80 <= type()) && (type() <= 0xE0); }
- inline bool is_smf_meta_event() const { return this->_buf[0] == 0xFF; }
- inline bool is_sysex() const { return this->_buf[0] == 0xF0
- || this->_buf[0] == 0xF7; }
- inline bool is_spp() const { return this->_buf[0] == 0xF2 && this->size() == 1; }
- inline bool is_mtc_quarter() const { return this->_buf[0] == 0xF1 && this->size() == 1; }
- inline bool is_mtc_full() const {
- return this->size() == 10 && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f &&
- this->_buf[3] == 0x01 && this->_buf[4] == 0x01;
- }
-
- inline uint16_t value() const {
- switch (type()) {
- case MIDI_CMD_CONTROL:
- return cc_value();
- case MIDI_CMD_BENDER:
- return pitch_bender_value();
- case MIDI_CMD_NOTE_PRESSURE:
- return poly_pressure();
- case MIDI_CMD_CHANNEL_PRESSURE:
- return channel_pressure();
- default:
- return 0;
- }
- }
-};
-
-} // namespace Evoral
-
-#endif // EVORAL_MIDI_EVENT_HPP
diff --git a/libs/evoral/evoral/MIDIXML.hpp b/libs/evoral/evoral/MIDIXML.hpp
index 982e203e55..97f940f479 100644
--- a/libs/evoral/evoral/MIDIXML.hpp
+++ b/libs/evoral/evoral/MIDIXML.hpp
@@ -19,7 +19,7 @@
#ifndef EVORAL_MIDI_XML_HPP
#define EVORAL_MIDI_XML_HPP
-#include "evoral/MIDIEvent.hpp"
+#include "evoral/Event.hpp"
#include "pbd/xml++.h"
namespace Evoral {
@@ -27,7 +27,7 @@ namespace MIDIXML {
template<typename Time>
bool
-xml_to_midi(const XMLNode& node, Evoral::MIDIEvent<Time>& ev)
+xml_to_midi(const XMLNode& node, Evoral::Event<Time>& ev)
{
if (node.name() == "ControlChange") {
ev.set_type(MIDI_CMD_CONTROL);
@@ -45,7 +45,7 @@ xml_to_midi(const XMLNode& node, Evoral::MIDIEvent<Time>& ev)
template<typename Time>
boost::shared_ptr<XMLNode>
-midi_to_xml(const Evoral::MIDIEvent<Time>& ev)
+midi_to_xml(const Evoral::Event<Time>& ev)
{
XMLNode* result = 0;
diff --git a/libs/evoral/evoral/Note.hpp b/libs/evoral/evoral/Note.hpp
index 87c8a9fe83..43db728b0c 100644
--- a/libs/evoral/evoral/Note.hpp
+++ b/libs/evoral/evoral/Note.hpp
@@ -24,7 +24,7 @@
#include <stdint.h>
#include "evoral/visibility.h"
-#include "evoral/MIDIEvent.hpp"
+#include "evoral/Event.hpp"
namespace Evoral {
@@ -105,8 +105,8 @@ public:
private:
// Event buffers are self-contained
- MIDIEvent<Time> _on_event;
- MIDIEvent<Time> _off_event;
+ Event<Time> _on_event;
+ Event<Time> _off_event;
};
template<typename Time>
diff --git a/libs/evoral/evoral/PatchChange.hpp b/libs/evoral/evoral/PatchChange.hpp
index 39ea421242..a775a72cc3 100644
--- a/libs/evoral/evoral/PatchChange.hpp
+++ b/libs/evoral/evoral/PatchChange.hpp
@@ -22,7 +22,7 @@
#include "evoral/visibility.h"
#include "evoral/Event.hpp"
-#include "evoral/MIDIEvent.hpp"
+#include "evoral/Event.hpp"
namespace Evoral {
@@ -138,7 +138,7 @@ public:
/** The PatchChange is made up of messages() MIDI messages; this method returns them by index.
* @param i index of message to return.
*/
- MIDIEvent<Time> const & message (int i) const {
+ Event<Time> const & message (int i) const {
switch (i) {
case 0:
return _bank_change_msb;
@@ -158,9 +158,9 @@ public:
}
private:
- MIDIEvent<Time> _bank_change_msb;
- MIDIEvent<Time> _bank_change_lsb;
- MIDIEvent<Time> _program_change;
+ Event<Time> _bank_change_msb;
+ Event<Time> _bank_change_lsb;
+ Event<Time> _program_change;
};
}
diff --git a/libs/evoral/evoral/Sequence.hpp b/libs/evoral/evoral/Sequence.hpp
index 7c0818a7fb..0e0cf05ec5 100644
--- a/libs/evoral/evoral/Sequence.hpp
+++ b/libs/evoral/evoral/Sequence.hpp
@@ -335,10 +335,10 @@ private:
bool overlaps_unlocked (const NotePtr& ev, const NotePtr& ignore_this_note) const;
bool contains_unlocked (const NotePtr& ev) const;
- void append_note_on_unlocked(const MIDIEvent<Time>& event, Evoral::event_id_t);
- void append_note_off_unlocked(const MIDIEvent<Time>& event);
+ void append_note_on_unlocked(const Event<Time>& event, Evoral::event_id_t);
+ void append_note_off_unlocked(const Event<Time>& event);
void append_control_unlocked(const Parameter& param, Time time, double value, Evoral::event_id_t);
- void append_sysex_unlocked(const MIDIEvent<Time>& ev, Evoral::event_id_t);
+ void append_sysex_unlocked(const Event<Time>& ev, Evoral::event_id_t);
void append_patch_change_unlocked(const PatchChange<Time>&, Evoral::event_id_t);
void get_notes_by_pitch (Notes&, NoteOperator, uint8_t val, int chan_mask = 0) const;
diff --git a/libs/evoral/src/Note.cpp b/libs/evoral/src/Note.cpp
index a63bf43571..3b56a33241 100644
--- a/libs/evoral/src/Note.cpp
+++ b/libs/evoral/src/Note.cpp
@@ -16,6 +16,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <cassert>
#include <iostream>
#include <limits>
#include <glib.h>
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp
index b44091371b..3098d0339d 100644
--- a/libs/evoral/src/Sequence.cpp
+++ b/libs/evoral/src/Sequence.cpp
@@ -330,7 +330,7 @@ Sequence<Time>::const_iterator::operator++()
assert(_event && _event->buffer() && _event->size() > 0);
- const MIDIEvent<Time>& ev = *((const MIDIEvent<Time>*)_event.get());
+ const Event<Time>& ev = *_event.get();
if (!( ev.is_note()
|| ev.is_cc()
@@ -902,12 +902,10 @@ Sequence<Time>::remove_sysex_unlocked (const SysExPtr sysex)
*/
template<typename Time>
void
-Sequence<Time>::append(const Event<Time>& event, event_id_t evid)
+Sequence<Time>::append(const Event<Time>& ev, event_id_t evid)
{
WriteLock lock(write_lock());
- const MIDIEvent<Time>& ev = (const MIDIEvent<Time>&)event;
-
assert(_notes.empty() || ev.time() >= (*_notes.rbegin())->time());
assert(_writing);
@@ -968,7 +966,7 @@ Sequence<Time>::append(const Event<Time>& event, event_id_t evid)
template<typename Time>
void
-Sequence<Time>::append_note_on_unlocked (const MIDIEvent<Time>& ev, event_id_t evid)
+Sequence<Time>::append_note_on_unlocked (const Event<Time>& ev, event_id_t evid)
{
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 on @ %4 v=%5\n", this,
(int)ev.channel(), (int)ev.note(),
@@ -1000,7 +998,7 @@ Sequence<Time>::append_note_on_unlocked (const MIDIEvent<Time>& ev, event_id_t e
template<typename Time>
void
-Sequence<Time>::append_note_off_unlocked (const MIDIEvent<Time>& ev)
+Sequence<Time>::append_note_off_unlocked (const Event<Time>& ev)
{
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 OFF @ %4 v=%5\n",
this, (int)ev.channel(),
@@ -1067,7 +1065,7 @@ Sequence<Time>::append_control_unlocked(const Parameter& param, Time time, doubl
template<typename Time>
void
-Sequence<Time>::append_sysex_unlocked(const MIDIEvent<Time>& ev, event_id_t /* evid */)
+Sequence<Time>::append_sysex_unlocked(const Event<Time>& ev, event_id_t /* evid */)
{
#ifdef DEBUG_SEQUENCE
cerr << this << " SysEx @ " << ev.time() << " \t= \t [ " << hex;
@@ -1076,7 +1074,7 @@ Sequence<Time>::append_sysex_unlocked(const MIDIEvent<Time>& ev, event_id_t /* e
} cerr << "]" << endl;
#endif
- boost::shared_ptr<MIDIEvent<Time> > event(new MIDIEvent<Time>(ev, true));
+ boost::shared_ptr< Event<Time> > event(new Event<Time>(ev, true));
/* XXX sysex events should use IDs */
_sysexes.insert(event);
}
diff --git a/libs/evoral/test/SequenceTest.cpp b/libs/evoral/test/SequenceTest.cpp
index 39afcd3095..a3dfabe139 100644
--- a/libs/evoral/test/SequenceTest.cpp
+++ b/libs/evoral/test/SequenceTest.cpp
@@ -77,12 +77,12 @@ SequenceTest::iteratorSeekTest ()
bool on = true;
for (Sequence<Time>::const_iterator i = seq->begin(Evoral::Beats(600)); i != seq->end(); ++i) {
if (on) {
- CPPUNIT_ASSERT(((const MIDIEvent<Time>&)*i).is_note_on());
+ CPPUNIT_ASSERT((*i)->is_note_on());
CPPUNIT_ASSERT_EQUAL(i->time(), Time((num_notes + 6) * 100));
++num_notes;
on = false;
} else {
- CPPUNIT_ASSERT(((const MIDIEvent<Time>&)*i).is_note_off());
+ CPPUNIT_ASSERT((*i)->is_note_off());
on = true;
}
}