mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
Fix broken whitespace via merciless application of the emacs hammer.
git-svn-id: svn://localhost/ardour2/branches/3.0@10782 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2929cd1c36
commit
efe14fbd52
16 changed files with 733 additions and 735 deletions
|
|
@ -35,12 +35,12 @@ class Curve;
|
|||
/** A single event (time-stamped value) for a control
|
||||
*/
|
||||
struct ControlEvent {
|
||||
ControlEvent (double w, double v)
|
||||
: when (w), value (v), coeff (0)
|
||||
ControlEvent (double w, double v)
|
||||
: when (w), value (v), coeff (0)
|
||||
{}
|
||||
|
||||
ControlEvent (const ControlEvent& other)
|
||||
: when (other.when), value (other.value), coeff (0)
|
||||
ControlEvent (const ControlEvent& other)
|
||||
: when (other.when), value (other.value), coeff (0)
|
||||
{
|
||||
if (other.coeff) {
|
||||
create_coeffs();
|
||||
|
|
@ -58,9 +58,9 @@ struct ControlEvent {
|
|||
coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.0;
|
||||
}
|
||||
|
||||
double when;
|
||||
double value;
|
||||
double* coeff; ///< double[4] allocated by Curve as needed
|
||||
double when;
|
||||
double value;
|
||||
double* coeff; ///< double[4] allocated by Curve as needed
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -68,11 +68,11 @@ struct ControlEvent {
|
|||
* and allocates 8k blocks of new pointers at a time
|
||||
*/
|
||||
typedef boost::fast_pool_allocator<
|
||||
ControlEvent*,
|
||||
boost::default_user_allocator_new_delete,
|
||||
boost::details::pool::null_mutex,
|
||||
8192>
|
||||
ControlEventAllocator;
|
||||
ControlEvent*,
|
||||
boost::default_user_allocator_new_delete,
|
||||
boost::details::pool::null_mutex,
|
||||
8192>
|
||||
ControlEventAllocator;
|
||||
|
||||
|
||||
/** A list (sequence) of time-stamped values for a control
|
||||
|
|
@ -115,7 +115,7 @@ public:
|
|||
void slide (iterator before, double distance);
|
||||
void shift (double before, double distance);
|
||||
|
||||
virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; }
|
||||
virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; }
|
||||
|
||||
void rt_add (double when, double value);
|
||||
void add (double when, double value);
|
||||
|
|
@ -286,7 +286,7 @@ protected:
|
|||
NascentInfo (double start = -1.0)
|
||||
: start_time (start)
|
||||
, end_time (-1.0)
|
||||
{}
|
||||
{}
|
||||
};
|
||||
|
||||
std::list<NascentInfo*> nascent;
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ public:
|
|||
|
||||
/** @param capacity Ringbuffer capacity in bytes.
|
||||
*/
|
||||
EventRingBuffer(size_t capacity) : PBD::RingBufferNPT<uint8_t>(capacity)
|
||||
EventRingBuffer(size_t capacity) : PBD::RingBufferNPT<uint8_t>(capacity)
|
||||
{}
|
||||
|
||||
size_t capacity() const { return bufsize(); }
|
||||
size_t capacity() const { return bufsize(); }
|
||||
|
||||
/** Peek at the ringbuffer (read w/o advancing read pointer).
|
||||
* @return how much has been peeked (wraps around if read exceeds
|
||||
|
|
@ -57,7 +57,7 @@ public:
|
|||
* read-pointer---^
|
||||
* </pre>
|
||||
*/
|
||||
bool peek (uint8_t*, size_t size);
|
||||
bool peek (uint8_t*, size_t size);
|
||||
|
||||
uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf);
|
||||
bool read (Time* time, EventType* type, uint32_t* size, uint8_t* buf);
|
||||
|
|
@ -67,25 +67,25 @@ template<typename Time>
|
|||
inline bool
|
||||
EventRingBuffer<Time>::peek (uint8_t* buf, size_t size)
|
||||
{
|
||||
PBD::RingBufferNPT<uint8_t>::rw_vector vec;
|
||||
PBD::RingBufferNPT<uint8_t>::rw_vector vec;
|
||||
|
||||
get_read_vector (&vec);
|
||||
get_read_vector (&vec);
|
||||
|
||||
if (vec.len[0] + vec.len[1] < size) {
|
||||
return false;
|
||||
}
|
||||
if (vec.len[0] + vec.len[1] < size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vec.len[0] > 0) {
|
||||
memcpy (buf, vec.buf[0], min (vec.len[0], size));
|
||||
}
|
||||
if (vec.len[0] > 0) {
|
||||
memcpy (buf, vec.buf[0], min (vec.len[0], size));
|
||||
}
|
||||
|
||||
if (vec.len[0] < size) {
|
||||
if (vec.len[1]) {
|
||||
memcpy (buf + vec.len[0], vec.buf[1], size - vec.len[0]);
|
||||
}
|
||||
}
|
||||
if (vec.len[0] < size) {
|
||||
if (vec.len[1]) {
|
||||
memcpy (buf + vec.len[0], vec.buf[1], size - vec.len[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
|
|
@ -93,20 +93,20 @@ inline bool
|
|||
EventRingBuffer<Time>::read(Time* time, EventType* type, uint32_t* size, uint8_t* buf)
|
||||
{
|
||||
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)time, sizeof (Time)) != sizeof (Time)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)type, sizeof(EventType)) != sizeof (EventType)) {
|
||||
return false;
|
||||
}
|
||||
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)type, sizeof(EventType)) != sizeof (EventType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)size, sizeof(uint32_t)) != sizeof (uint32_t)) {
|
||||
return false;
|
||||
}
|
||||
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)size, sizeof(uint32_t)) != sizeof (uint32_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PBD::RingBufferNPT<uint8_t>::read (buf, *size) != *size) {
|
||||
return false;
|
||||
}
|
||||
if (PBD::RingBufferNPT<uint8_t>::read (buf, *size) != *size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -119,10 +119,10 @@ EventRingBuffer<Time>::write(Time time, EventType type, uint32_t size, const uin
|
|||
if (write_space() < (sizeof(Time) + sizeof(EventType) + sizeof(uint32_t) + size)) {
|
||||
return 0;
|
||||
} else {
|
||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&time, sizeof(Time));
|
||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&type, sizeof(EventType));
|
||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&size, sizeof(uint32_t));
|
||||
PBD::RingBufferNPT<uint8_t>::write (buf, size);
|
||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&time, sizeof(Time));
|
||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&type, sizeof(EventType));
|
||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&size, sizeof(uint32_t));
|
||||
PBD::RingBufferNPT<uint8_t>::write (buf, size);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* This file is part of Evoral.
|
||||
* Copyright (C) 2008 David Robillard <http://drobilla.net>
|
||||
* Copyright (C) 2000-2008 Paul Davis
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
/*
|
||||
Copyright (C) 2010 Paul Davis
|
||||
Author: Carl Hetherington <cth@carlh.net>
|
||||
Copyright (C) 2010 Paul Davis
|
||||
Author: Carl Hetherington <cth@carlh.net>
|
||||
|
||||
This program 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.
|
||||
This program 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.
|
||||
|
||||
This program 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 more details.
|
||||
This program 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 more 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef EVORAL_PATCH_CHANGE_HPP
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ public:
|
|||
|
||||
double round_to_file_precision (double val) const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void set_path (const std::string& p);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string _file_path;
|
||||
smf_t* _smf;
|
||||
smf_track_t* _smf_track;
|
||||
|
|
|
|||
|
|
@ -98,13 +98,13 @@ public:
|
|||
void start_write();
|
||||
bool writing() const { return _writing; }
|
||||
|
||||
enum StuckNoteOption {
|
||||
enum StuckNoteOption {
|
||||
Relax,
|
||||
DeleteStuckNotes,
|
||||
ResolveStuckNotes
|
||||
};
|
||||
|
||||
void end_write (StuckNoteOption, Time when = 0);
|
||||
void end_write (StuckNoteOption, Time when = 0);
|
||||
|
||||
void append(const Event<Time>& ev, Evoral::event_id_t evid);
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ public:
|
|||
inline PatchChanges& patch_changes () { return _patch_changes; }
|
||||
inline const PatchChanges& patch_changes () const { return _patch_changes; }
|
||||
|
||||
void dump (std::ostream&) const;
|
||||
void dump (std::ostream&) const;
|
||||
|
||||
private:
|
||||
typedef std::priority_queue<NotePtr, std::deque<NotePtr>, LaterNoteEndComparator> ActiveNotes;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ protected:
|
|||
template<typename A, typename B>
|
||||
class IdentityConverter : public TimeConverter<A,B> {
|
||||
public:
|
||||
IdentityConverter() {}
|
||||
IdentityConverter() {}
|
||||
B to(A a) const { return static_cast<B>(a); }
|
||||
A from(B b) const { return static_cast<A>(b); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ namespace Evoral {
|
|||
/** ID of an event (note or other). This must be operable on by glib
|
||||
atomic ops
|
||||
*/
|
||||
|
||||
typedef int32_t event_id_t;
|
||||
|
||||
/** Musical time: beats relative to some defined origin */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ srcdir=`pwd`
|
|||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$srcdir/../../build/default/libs/evoral:$srcdir/../../build/default/libs/pbd
|
||||
if [ ! -f './test/testdata/TakeFive.mid' ]; then
|
||||
echo "This script must be run from within the libs/evoral directory";
|
||||
exit 1;
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# Make symlink to TakeFive.mid in build directory
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ ControlList::~ControlList()
|
|||
}
|
||||
|
||||
for (list<NascentInfo*>::iterator n = nascent.begin(); n != nascent.end(); ++n) {
|
||||
for (EventList::iterator x = (*n)->events.begin(); x != (*n)->events.end(); ++x) {
|
||||
delete *x;
|
||||
}
|
||||
for (EventList::iterator x = (*n)->events.begin(); x != (*n)->events.end(); ++x) {
|
||||
delete *x;
|
||||
}
|
||||
delete (*n);
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ ControlList::_x_scale (double factor)
|
|||
void
|
||||
ControlList::write_pass_finished (double when)
|
||||
{
|
||||
merge_nascent (when);
|
||||
merge_nascent (when);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -233,104 +233,104 @@ struct ControlEventTimeComparator {
|
|||
void
|
||||
ControlList::merge_nascent (double when)
|
||||
{
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
if (nascent.empty()) {
|
||||
return;
|
||||
}
|
||||
if (nascent.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (list<NascentInfo*>::iterator n = nascent.begin(); n != nascent.end(); ++n) {
|
||||
for (list<NascentInfo*>::iterator n = nascent.begin(); n != nascent.end(); ++n) {
|
||||
|
||||
NascentInfo* ninfo = *n;
|
||||
EventList& nascent_events (ninfo->events);
|
||||
bool need_adjacent_start_clamp;
|
||||
bool need_adjacent_end_clamp;
|
||||
NascentInfo* ninfo = *n;
|
||||
EventList& nascent_events (ninfo->events);
|
||||
bool need_adjacent_start_clamp;
|
||||
bool need_adjacent_end_clamp;
|
||||
|
||||
if (nascent_events.empty()) {
|
||||
delete ninfo;
|
||||
continue;
|
||||
}
|
||||
if (nascent_events.empty()) {
|
||||
delete ninfo;
|
||||
continue;
|
||||
}
|
||||
|
||||
nascent_events.sort (ControlEventTimeComparator ());
|
||||
|
||||
if (ninfo->start_time < 0.0) {
|
||||
ninfo->start_time = nascent_events.front()->when;
|
||||
}
|
||||
if (ninfo->start_time < 0.0) {
|
||||
ninfo->start_time = nascent_events.front()->when;
|
||||
}
|
||||
|
||||
if (ninfo->end_time < 0.0) {
|
||||
ninfo->end_time = when;
|
||||
}
|
||||
if (ninfo->end_time < 0.0) {
|
||||
ninfo->end_time = when;
|
||||
}
|
||||
|
||||
bool preexisting = !_events.empty();
|
||||
bool preexisting = !_events.empty();
|
||||
|
||||
if (!preexisting) {
|
||||
if (!preexisting) {
|
||||
|
||||
_events = nascent_events;
|
||||
_events = nascent_events;
|
||||
|
||||
} else if (ninfo->end_time < _events.front()->when) {
|
||||
} else if (ninfo->end_time < _events.front()->when) {
|
||||
|
||||
/* all points in nascent are before the first existing point */
|
||||
/* all points in nascent are before the first existing point */
|
||||
|
||||
_events.insert (_events.begin(), nascent_events.begin(), nascent_events.end());
|
||||
_events.insert (_events.begin(), nascent_events.begin(), nascent_events.end());
|
||||
|
||||
} else if (ninfo->start_time > _events.back()->when) {
|
||||
} else if (ninfo->start_time > _events.back()->when) {
|
||||
|
||||
/* all points in nascent are after the last existing point */
|
||||
/* all points in nascent are after the last existing point */
|
||||
|
||||
_events.insert (_events.end(), nascent_events.begin(), nascent_events.end());
|
||||
_events.insert (_events.end(), nascent_events.begin(), nascent_events.end());
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
/* find the range that overlaps with nascent events,
|
||||
and insert the contents of nascent events.
|
||||
*/
|
||||
/* find the range that overlaps with nascent events,
|
||||
and insert the contents of nascent events.
|
||||
*/
|
||||
|
||||
iterator i;
|
||||
iterator range_begin = _events.end();
|
||||
iterator range_end = _events.end();
|
||||
double end_value = unlocked_eval (ninfo->end_time);
|
||||
double start_value = unlocked_eval (ninfo->start_time - 1);
|
||||
iterator i;
|
||||
iterator range_begin = _events.end();
|
||||
iterator range_end = _events.end();
|
||||
double end_value = unlocked_eval (ninfo->end_time);
|
||||
double start_value = unlocked_eval (ninfo->start_time - 1);
|
||||
|
||||
need_adjacent_end_clamp = true;
|
||||
need_adjacent_start_clamp = true;
|
||||
need_adjacent_end_clamp = true;
|
||||
need_adjacent_start_clamp = true;
|
||||
|
||||
for (i = _events.begin(); i != _events.end(); ++i) {
|
||||
for (i = _events.begin(); i != _events.end(); ++i) {
|
||||
|
||||
if ((*i)->when == ninfo->start_time) {
|
||||
/* existing point at same time, remove it
|
||||
and the consider the next point instead.
|
||||
*/
|
||||
i = _events.erase (i);
|
||||
if ((*i)->when == ninfo->start_time) {
|
||||
/* existing point at same time, remove it
|
||||
and the consider the next point instead.
|
||||
*/
|
||||
i = _events.erase (i);
|
||||
|
||||
if (i == _events.end()) {
|
||||
break;
|
||||
}
|
||||
if (i == _events.end()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (range_begin == _events.end()) {
|
||||
range_begin = i;
|
||||
need_adjacent_start_clamp = false;
|
||||
} else {
|
||||
need_adjacent_end_clamp = false;
|
||||
}
|
||||
if (range_begin == _events.end()) {
|
||||
range_begin = i;
|
||||
need_adjacent_start_clamp = false;
|
||||
} else {
|
||||
need_adjacent_end_clamp = false;
|
||||
}
|
||||
|
||||
if ((*i)->when > ninfo->end_time) {
|
||||
range_end = i;
|
||||
break;
|
||||
}
|
||||
if ((*i)->when > ninfo->end_time) {
|
||||
range_end = i;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if ((*i)->when > ninfo->start_time) {
|
||||
} else if ((*i)->when > ninfo->start_time) {
|
||||
|
||||
if (range_begin == _events.end()) {
|
||||
range_begin = i;
|
||||
}
|
||||
if (range_begin == _events.end()) {
|
||||
range_begin = i;
|
||||
}
|
||||
|
||||
if ((*i)->when > ninfo->end_time) {
|
||||
range_end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((*i)->when > ninfo->end_time) {
|
||||
range_end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now:
|
||||
range_begin is the first event on our list after the first nascent event
|
||||
|
|
@ -340,58 +340,58 @@ ControlList::merge_nascent (double when)
|
|||
was at the same time as the first nascent event.
|
||||
*/
|
||||
|
||||
if (range_begin != _events.begin()) {
|
||||
/* clamp point before */
|
||||
if (need_adjacent_start_clamp) {
|
||||
_events.insert (range_begin, new ControlEvent (ninfo->start_time, start_value));
|
||||
}
|
||||
}
|
||||
if (range_begin != _events.begin()) {
|
||||
/* clamp point before */
|
||||
if (need_adjacent_start_clamp) {
|
||||
_events.insert (range_begin, new ControlEvent (ninfo->start_time, start_value));
|
||||
}
|
||||
}
|
||||
|
||||
_events.insert (range_begin, nascent_events.begin(), nascent_events.end());
|
||||
_events.insert (range_begin, nascent_events.begin(), nascent_events.end());
|
||||
|
||||
if (range_end != _events.end()) {
|
||||
/* clamp point after */
|
||||
if (need_adjacent_end_clamp) {
|
||||
_events.insert (range_begin, new ControlEvent (ninfo->end_time, end_value));
|
||||
}
|
||||
}
|
||||
if (range_end != _events.end()) {
|
||||
/* clamp point after */
|
||||
if (need_adjacent_end_clamp) {
|
||||
_events.insert (range_begin, new ControlEvent (ninfo->end_time, end_value));
|
||||
}
|
||||
}
|
||||
|
||||
_events.erase (range_begin, range_end);
|
||||
}
|
||||
_events.erase (range_begin, range_end);
|
||||
}
|
||||
|
||||
delete ninfo;
|
||||
}
|
||||
delete ninfo;
|
||||
}
|
||||
|
||||
nascent.clear ();
|
||||
nascent.clear ();
|
||||
|
||||
if (writing()) {
|
||||
nascent.push_back (new NascentInfo ());
|
||||
}
|
||||
}
|
||||
if (writing()) {
|
||||
nascent.push_back (new NascentInfo ());
|
||||
}
|
||||
}
|
||||
|
||||
maybe_signal_changed ();
|
||||
maybe_signal_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
ControlList::rt_add (double when, double value)
|
||||
{
|
||||
// this is for automation recording
|
||||
// this is for automation recording
|
||||
|
||||
if (touch_enabled() && !touching()) {
|
||||
return;
|
||||
}
|
||||
if (touch_enabled() && !touching()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//cerr << "RT: alist " << this << " add " << value << " @ " << when << endl;
|
||||
|
||||
Glib::Mutex::Lock lm (_lock, Glib::TRY_LOCK);
|
||||
Glib::Mutex::Lock lm (_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (lm.locked()) {
|
||||
assert (!nascent.empty());
|
||||
if (lm.locked()) {
|
||||
assert (!nascent.empty());
|
||||
/* we don't worry about adding events out of time order as we will
|
||||
sort them in merge_nascent.
|
||||
*/
|
||||
nascent.back()->events.push_back (new ControlEvent (when, value));
|
||||
}
|
||||
nascent.back()->events.push_back (new ControlEvent (when, value));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -405,13 +405,13 @@ ControlList::fast_simple_add (double when, double value)
|
|||
void
|
||||
ControlList::add (double when, double value)
|
||||
{
|
||||
/* this is for making changes from some kind of user interface or
|
||||
control surface (GUI, MIDI, OSC etc)
|
||||
*/
|
||||
/* this is for making changes from some kind of user interface or
|
||||
control surface (GUI, MIDI, OSC etc)
|
||||
*/
|
||||
|
||||
if (!clamp_value (when, value)) {
|
||||
return;
|
||||
}
|
||||
if (!clamp_value (when, value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
|
@ -576,7 +576,7 @@ ControlList::slide (iterator before, double distance)
|
|||
++before;
|
||||
}
|
||||
|
||||
mark_dirty ();
|
||||
mark_dirty ();
|
||||
}
|
||||
|
||||
maybe_signal_changed ();
|
||||
|
|
@ -588,7 +588,7 @@ ControlList::shift (double pos, double frames)
|
|||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
for (iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||
for (iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||
if ((*i)->when >= pos) {
|
||||
(*i)->when += frames;
|
||||
}
|
||||
|
|
@ -727,7 +727,7 @@ ControlList::truncate_end (double last_coordinate)
|
|||
if (last_coordinate > _events.back()->when) {
|
||||
|
||||
/* extending end:
|
||||
*/
|
||||
*/
|
||||
|
||||
iterator foo = _events.begin();
|
||||
bool lessthantwo;
|
||||
|
|
@ -1129,7 +1129,7 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (double start, double& x,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* No points in range */
|
||||
/* No points in range */
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1150,9 +1150,9 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double& x, do
|
|||
const_iterator length_check_iter = _events.begin();
|
||||
if (_events.empty()) { // 0 events
|
||||
return false;
|
||||
} else if (_events.end() == ++length_check_iter) { // 1 event
|
||||
} else if (_events.end() == ++length_check_iter) { // 1 event
|
||||
return rt_safe_earliest_event_discrete_unlocked (start, x, y, inclusive);
|
||||
}
|
||||
}
|
||||
|
||||
// Hack to avoid infinitely repeating the same event
|
||||
build_search_cache_if_necessary (start);
|
||||
|
|
@ -1171,7 +1171,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double& x, do
|
|||
}
|
||||
next = *_search_cache.first;
|
||||
|
||||
/* Step is before first */
|
||||
/* Step is before first */
|
||||
} else {
|
||||
const_iterator prev = _search_cache.first;
|
||||
--prev;
|
||||
|
|
@ -1229,11 +1229,11 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double& x, do
|
|||
}
|
||||
|
||||
/*cerr << first->value << " @ " << first->when << " ... "
|
||||
<< next->value << " @ " << next->when
|
||||
<< " = " << y << " @ " << x << endl;*/
|
||||
<< next->value << " @ " << next->when
|
||||
<< " = " << y << " @ " << x << endl;*/
|
||||
|
||||
assert( (y >= first->value && y <= next->value)
|
||||
|| (y <= first->value && y >= next->value) );
|
||||
|| (y <= first->value && y >= next->value) );
|
||||
|
||||
|
||||
const bool past_start = (inclusive ? x >= start : x > start);
|
||||
|
|
@ -1247,7 +1247,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double& x, do
|
|||
return false;
|
||||
}
|
||||
|
||||
/* No points in the future, so no steps (towards them) in the future */
|
||||
/* No points in the future, so no steps (towards them) in the future */
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1263,14 +1263,14 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
|||
{
|
||||
boost::shared_ptr<ControlList> nal = create (_parameter);
|
||||
iterator s, e;
|
||||
ControlEvent cp (start, 0.0);
|
||||
ControlEvent cp (start, 0.0);
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
/* first, determine s & e, two iterators that define the range of points
|
||||
affected by this operation
|
||||
*/
|
||||
/* first, determine s & e, two iterators that define the range of points
|
||||
affected by this operation
|
||||
*/
|
||||
|
||||
if ((s = lower_bound (_events.begin(), _events.end(), &cp, time_comparator)) == _events.end()) {
|
||||
return nal;
|
||||
|
|
@ -1281,25 +1281,25 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
|||
e = upper_bound (_events.begin(), _events.end(), &cp, time_comparator);
|
||||
|
||||
|
||||
/* if "start" isn't the location of an existing point,
|
||||
evaluate the curve to get a value for the start. Add a point to
|
||||
both the existing event list, and if its not a "clear" operation,
|
||||
to the copy ("nal") as well.
|
||||
/* if "start" isn't the location of an existing point,
|
||||
evaluate the curve to get a value for the start. Add a point to
|
||||
both the existing event list, and if its not a "clear" operation,
|
||||
to the copy ("nal") as well.
|
||||
|
||||
Note that the time positions of the points in each list are different
|
||||
because we want the copy ("nal") to have a zero time reference.
|
||||
*/
|
||||
Note that the time positions of the points in each list are different
|
||||
because we want the copy ("nal") to have a zero time reference.
|
||||
*/
|
||||
|
||||
|
||||
/* before we begin any cut/clear operations, get the value of the curve
|
||||
at "end".
|
||||
*/
|
||||
/* before we begin any cut/clear operations, get the value of the curve
|
||||
at "end".
|
||||
*/
|
||||
|
||||
double end_value = unlocked_eval (end);
|
||||
double end_value = unlocked_eval (end);
|
||||
|
||||
if ((*s)->when != start) {
|
||||
if ((*s)->when != start) {
|
||||
|
||||
double val = unlocked_eval (start);
|
||||
double val = unlocked_eval (start);
|
||||
|
||||
if (op == 0) { // cut
|
||||
if (start > _events.front()->when) {
|
||||
|
|
@ -1307,10 +1307,10 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
|||
}
|
||||
}
|
||||
|
||||
if (op != 2) { // ! clear
|
||||
nal->_events.push_back (new ControlEvent (0, val));
|
||||
}
|
||||
}
|
||||
if (op != 2) { // ! clear
|
||||
nal->_events.push_back (new ControlEvent (0, val));
|
||||
}
|
||||
}
|
||||
|
||||
for (iterator x = s; x != e; ) {
|
||||
|
||||
|
|
@ -1325,30 +1325,30 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
|||
if (op != 1) {
|
||||
x = _events.erase (x);
|
||||
} else {
|
||||
++x;
|
||||
}
|
||||
++x;
|
||||
}
|
||||
}
|
||||
|
||||
if (e == _events.end() || (*e)->when != end) {
|
||||
if (e == _events.end() || (*e)->when != end) {
|
||||
|
||||
/* only add a boundary point if there is a point after "end"
|
||||
*/
|
||||
/* only add a boundary point if there is a point after "end"
|
||||
*/
|
||||
|
||||
if (op == 0 && (e != _events.end() && end < (*e)->when)) { // cut
|
||||
_events.insert (e, new ControlEvent (end, end_value));
|
||||
}
|
||||
if (op == 0 && (e != _events.end() && end < (*e)->when)) { // cut
|
||||
_events.insert (e, new ControlEvent (end, end_value));
|
||||
}
|
||||
|
||||
if (op != 2 && (e != _events.end() && end < (*e)->when)) { // cut/copy
|
||||
nal->_events.push_back (new ControlEvent (end - start, end_value));
|
||||
}
|
||||
if (op != 2 && (e != _events.end() && end < (*e)->when)) { // cut/copy
|
||||
nal->_events.push_back (new ControlEvent (end - start, end_value));
|
||||
}
|
||||
}
|
||||
|
||||
mark_dirty ();
|
||||
mark_dirty ();
|
||||
}
|
||||
|
||||
if (op != 1) {
|
||||
maybe_signal_changed ();
|
||||
}
|
||||
if (op != 1) {
|
||||
maybe_signal_changed ();
|
||||
}
|
||||
|
||||
return nal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ ControlSet::ControlSet()
|
|||
}
|
||||
|
||||
ControlSet::ControlSet (const ControlSet&)
|
||||
: noncopyable ()
|
||||
: noncopyable ()
|
||||
{
|
||||
/* derived class must copy controls */
|
||||
/* derived class must copy controls */
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -47,7 +47,7 @@ ControlSet::add_control(boost::shared_ptr<Control> ac)
|
|||
|
||||
ac->list()->InterpolationChanged.connect_same_thread (
|
||||
_list_connections, boost::bind (&ControlSet::control_list_interpolation_changed, this, ac->parameter(), _1)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -91,26 +91,26 @@ ControlSet::find_next_event (double now, double end, ControlEvent& next_event) c
|
|||
|
||||
next_event.when = std::numeric_limits<double>::max();
|
||||
|
||||
for (li = _controls.begin(); li != _controls.end(); ++li) {
|
||||
for (li = _controls.begin(); li != _controls.end(); ++li) {
|
||||
ControlList::const_iterator i;
|
||||
boost::shared_ptr<const ControlList> alist (li->second->list());
|
||||
ControlEvent cp (now, 0.0f);
|
||||
|
||||
for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator);
|
||||
i != alist->end() && (*i)->when < end; ++i) {
|
||||
if ((*i)->when > now) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator);
|
||||
i != alist->end() && (*i)->when < end; ++i) {
|
||||
if ((*i)->when > now) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != alist->end() && (*i)->when < end) {
|
||||
if ((*i)->when < next_event.when) {
|
||||
next_event.when = (*i)->when;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != alist->end() && (*i)->when < end) {
|
||||
if ((*i)->when < next_event.when) {
|
||||
next_event.when = (*i)->when;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return next_event.when != std::numeric_limits<double>::max();
|
||||
return next_event.when != std::numeric_limits<double>::max();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Evoral {
|
|||
template<typename Time>
|
||||
Note<Time>::Note(uint8_t chan, Time t, Time l, uint8_t n, uint8_t v)
|
||||
// FIXME: types?
|
||||
: _on_event (0xDE, t, 3, NULL, true)
|
||||
: _on_event (0xDE, t, 3, NULL, true)
|
||||
, _off_event (0xAD, t + l, 3, NULL, true)
|
||||
{
|
||||
assert(chan < 16);
|
||||
|
|
@ -50,21 +50,21 @@ Note<Time>::Note(uint8_t chan, Time t, Time l, uint8_t n, uint8_t v)
|
|||
|
||||
template<typename Time>
|
||||
Note<Time>::Note(const Note<Time>& copy)
|
||||
: _on_event(copy._on_event, true)
|
||||
: _on_event(copy._on_event, true)
|
||||
, _off_event(copy._off_event, true)
|
||||
{
|
||||
set_id (copy.id());
|
||||
set_id (copy.id());
|
||||
|
||||
assert(_on_event.buffer());
|
||||
assert(_off_event.buffer());
|
||||
/*
|
||||
assert(copy._on_event.size == 3);
|
||||
_on_event.buffer = _on_event_buffer;
|
||||
memcpy(_on_event_buffer, copy._on_event_buffer, 3);
|
||||
assert(copy._on_event.size == 3);
|
||||
_on_event.buffer = _on_event_buffer;
|
||||
memcpy(_on_event_buffer, copy._on_event_buffer, 3);
|
||||
|
||||
assert(copy._off_event.size == 3);
|
||||
_off_event.buffer = _off_event_buffer;
|
||||
memcpy(_off_event_buffer, copy._off_event_buffer, 3);
|
||||
assert(copy._off_event.size == 3);
|
||||
_off_event.buffer = _off_event_buffer;
|
||||
memcpy(_off_event_buffer, copy._off_event_buffer, 3);
|
||||
*/
|
||||
|
||||
assert(time() == copy.time());
|
||||
|
|
@ -84,8 +84,8 @@ Note<Time>::~Note()
|
|||
template<typename Time> void
|
||||
Note<Time>::set_id (event_id_t id)
|
||||
{
|
||||
_on_event.set_id (id);
|
||||
_off_event.set_id (id);
|
||||
_on_event.set_id (id);
|
||||
_off_event.set_id (id);
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ SMF::open(const std::string& path, int track) THROW_FILE_ERROR
|
|||
|
||||
if ((_smf_track = smf_get_track_by_number(_smf, track)) == 0) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
//cerr << "Track " << track << " # events: " << _smf_track->number_of_events << endl;
|
||||
if (_smf_track->number_of_events == 0) {
|
||||
|
|
@ -129,7 +129,7 @@ SMF::create(const std::string& path, int track, uint16_t ppqn) THROW_FILE_ERROR
|
|||
_smf = smf_new();
|
||||
|
||||
if (_smf == NULL) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (smf_set_ppqn(_smf, ppqn) != 0) {
|
||||
|
|
@ -148,19 +148,19 @@ SMF::create(const std::string& path, int track, uint16_t ppqn) THROW_FILE_ERROR
|
|||
|
||||
_smf_track->next_event_number = 0;
|
||||
|
||||
{
|
||||
/* put a stub file on disk */
|
||||
{
|
||||
/* put a stub file on disk */
|
||||
|
||||
PBD::StdioFileDescriptor d (_file_path, "w+");
|
||||
FILE* f = d.allocate ();
|
||||
if (f == 0) {
|
||||
return -1;
|
||||
}
|
||||
PBD::StdioFileDescriptor d (_file_path, "w+");
|
||||
FILE* f = d.allocate ();
|
||||
if (f == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (smf_save (_smf, f)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (smf_save (_smf, f)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
_empty = true;
|
||||
|
||||
|
|
@ -208,34 +208,34 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf, event_id_t* no
|
|||
assert(delta_t);
|
||||
assert(size);
|
||||
assert(buf);
|
||||
assert(note_id);
|
||||
assert(note_id);
|
||||
|
||||
if ((event = smf_track_get_next_event(_smf_track)) != NULL) {
|
||||
|
||||
*delta_t = event->delta_time_pulses;
|
||||
|
||||
if (smf_event_is_metadata(event)) {
|
||||
*note_id = -1; // "no note id in this meta-event */
|
||||
*note_id = -1; // "no note id in this meta-event */
|
||||
|
||||
if (event->midi_buffer[1] == 0x7f) { // Sequencer-specific
|
||||
if (event->midi_buffer[1] == 0x7f) { // Sequencer-specific
|
||||
|
||||
uint32_t evsize;
|
||||
uint32_t lenlen;
|
||||
uint32_t evsize;
|
||||
uint32_t lenlen;
|
||||
|
||||
if (smf_extract_vlq (&event->midi_buffer[2], event->midi_buffer_length-2, &evsize, &lenlen) == 0) {
|
||||
if (smf_extract_vlq (&event->midi_buffer[2], event->midi_buffer_length-2, &evsize, &lenlen) == 0) {
|
||||
|
||||
if (event->midi_buffer[2+lenlen] == 0x99 && // Evoral
|
||||
event->midi_buffer[3+lenlen] == 0x1) { // Evoral Note ID
|
||||
if (event->midi_buffer[2+lenlen] == 0x99 && // Evoral
|
||||
event->midi_buffer[3+lenlen] == 0x1) { // Evoral Note ID
|
||||
|
||||
uint32_t id;
|
||||
uint32_t idlen;
|
||||
uint32_t id;
|
||||
uint32_t idlen;
|
||||
|
||||
if (smf_extract_vlq (&event->midi_buffer[4+lenlen], event->midi_buffer_length-(4+lenlen), &id, &idlen) == 0) {
|
||||
*note_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (smf_extract_vlq (&event->midi_buffer[4+lenlen], event->midi_buffer_length-(4+lenlen), &id, &idlen) == 0) {
|
||||
*note_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0; /* this is a meta-event */
|
||||
}
|
||||
|
||||
|
|
@ -252,9 +252,9 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf, event_id_t* no
|
|||
assert(midi_event_is_valid(*buf, *size));
|
||||
|
||||
/* printf("SMF::read_event @ %u: ", *delta_t);
|
||||
for (size_t i = 0; i < *size; ++i) {
|
||||
printf("%X ", (*buf)[i]);
|
||||
} printf("\n") */
|
||||
for (size_t i = 0; i < *size; ++i) {
|
||||
printf("%X ", (*buf)[i]);
|
||||
} printf("\n") */
|
||||
|
||||
return event_size;
|
||||
} else {
|
||||
|
|
@ -270,9 +270,9 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf, eve
|
|||
}
|
||||
|
||||
/* printf("SMF::append_event_delta @ %u:", delta_t);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
printf("%X ", buf[i]);
|
||||
} printf("\n"); */
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
printf("%X ", buf[i]);
|
||||
} printf("\n"); */
|
||||
|
||||
if (!midi_event_is_valid(buf, size)) {
|
||||
cerr << "WARNING: SMF ignoring illegal MIDI event" << endl;
|
||||
|
|
@ -281,8 +281,8 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf, eve
|
|||
|
||||
smf_event_t* event;
|
||||
|
||||
/* XXX july 2010: currently only store event ID's for notes, program changes and bank changes
|
||||
*/
|
||||
/* XXX july 2010: currently only store event ID's for notes, program changes and bank changes
|
||||
*/
|
||||
|
||||
uint8_t const c = buf[0] & 0xf0;
|
||||
bool const store_id = (
|
||||
|
|
@ -290,42 +290,42 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf, eve
|
|||
c == MIDI_CMD_NOTE_OFF ||
|
||||
c == MIDI_CMD_PGM_CHANGE ||
|
||||
(c == MIDI_CMD_CONTROL && (buf[1] == MIDI_CTL_MSB_BANK || buf[1] == MIDI_CTL_LSB_BANK))
|
||||
);
|
||||
);
|
||||
|
||||
if (store_id && note_id >= 0) {
|
||||
int idlen;
|
||||
int lenlen;
|
||||
uint8_t idbuf[16];
|
||||
uint8_t lenbuf[16];
|
||||
int idlen;
|
||||
int lenlen;
|
||||
uint8_t idbuf[16];
|
||||
uint8_t lenbuf[16];
|
||||
|
||||
event = smf_event_new ();
|
||||
assert(event != NULL);
|
||||
event = smf_event_new ();
|
||||
assert(event != NULL);
|
||||
|
||||
/* generate VLQ representation of note ID */
|
||||
idlen = smf_format_vlq (idbuf, sizeof(idbuf), note_id);
|
||||
/* generate VLQ representation of note ID */
|
||||
idlen = smf_format_vlq (idbuf, sizeof(idbuf), note_id);
|
||||
|
||||
/* generate VLQ representation of meta event length,
|
||||
which is the idlen + 2 bytes (Evoral type ID plus Note ID type)
|
||||
*/
|
||||
/* generate VLQ representation of meta event length,
|
||||
which is the idlen + 2 bytes (Evoral type ID plus Note ID type)
|
||||
*/
|
||||
|
||||
lenlen = smf_format_vlq (lenbuf, sizeof(lenbuf), idlen+2);
|
||||
lenlen = smf_format_vlq (lenbuf, sizeof(lenbuf), idlen+2);
|
||||
|
||||
event->midi_buffer_length = 2 + lenlen + 2 + idlen;
|
||||
event->midi_buffer_length = 2 + lenlen + 2 + idlen;
|
||||
/* this should be allocated by malloc(3) because libsmf will
|
||||
call free(3) on it
|
||||
*/
|
||||
event->midi_buffer = (uint8_t*) malloc (sizeof (uint8_t*) * event->midi_buffer_length);
|
||||
event->midi_buffer = (uint8_t*) malloc (sizeof (uint8_t*) * event->midi_buffer_length);
|
||||
|
||||
event->midi_buffer[0] = 0xff; // Meta-event
|
||||
event->midi_buffer[1] = 0x7f; // Sequencer-specific
|
||||
memcpy (&event->midi_buffer[2], lenbuf, lenlen);
|
||||
event->midi_buffer[2+lenlen] = 0x99; // Evoral type ID
|
||||
event->midi_buffer[3+lenlen] = 0x1; // Evoral type Note ID
|
||||
memcpy (&event->midi_buffer[4+lenlen], idbuf, idlen);
|
||||
event->midi_buffer[0] = 0xff; // Meta-event
|
||||
event->midi_buffer[1] = 0x7f; // Sequencer-specific
|
||||
memcpy (&event->midi_buffer[2], lenbuf, lenlen);
|
||||
event->midi_buffer[2+lenlen] = 0x99; // Evoral type ID
|
||||
event->midi_buffer[3+lenlen] = 0x1; // Evoral type Note ID
|
||||
memcpy (&event->midi_buffer[4+lenlen], idbuf, idlen);
|
||||
|
||||
assert(_smf_track);
|
||||
smf_track_add_event_delta_pulses(_smf_track, event, 0);
|
||||
}
|
||||
assert(_smf_track);
|
||||
smf_track_add_event_delta_pulses(_smf_track, event, 0);
|
||||
}
|
||||
|
||||
event = smf_event_new_from_pointer(buf, size);
|
||||
assert(event != NULL);
|
||||
|
|
@ -373,7 +373,7 @@ SMF::round_to_file_precision (double val) const
|
|||
void
|
||||
SMF::set_path (const std::string& p)
|
||||
{
|
||||
_file_path = p;
|
||||
_file_path = p;
|
||||
}
|
||||
|
||||
} // namespace Evoral
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
|
||||
// Find first sysex event at or after t
|
||||
for (typename Sequence<Time>::SysExes::const_iterator i = seq.sysexes().begin();
|
||||
i != seq.sysexes().end(); ++i) {
|
||||
i != seq.sysexes().end(); ++i) {
|
||||
if ((*i)->time() >= t) {
|
||||
_sysex_iter = i;
|
||||
break;
|
||||
|
|
@ -128,7 +128,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
}
|
||||
if (!ret) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("Iterator: CC %1 (size %2) has no events past %3\n",
|
||||
i->first.id(), i->second->list()->size(), t));
|
||||
i->first.id(), i->second->list()->size(), t));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -136,8 +136,8 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
|
||||
if (y < i->first.min() || y > i->first.max()) {
|
||||
cerr << "ERROR: Controller value " << y
|
||||
<< " out of range [" << i->first.min() << "," << i->first.max()
|
||||
<< "], event ignored" << endl;
|
||||
<< " out of range [" << i->first.min() << "," << i->first.max()
|
||||
<< "], event ignored" << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
}
|
||||
|
||||
if (_sysex_iter != seq.sysexes().end()
|
||||
&& ((*_sysex_iter)->time() < earliest_t || _type == NIL)) {
|
||||
&& ((*_sysex_iter)->time() < earliest_t || _type == NIL)) {
|
||||
_type = SYSEX;
|
||||
earliest_t = (*_sysex_iter)->time();
|
||||
}
|
||||
|
|
@ -181,8 +181,8 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
}
|
||||
|
||||
if (_control_iter != _control_iters.end()
|
||||
&& earliest_control.list && earliest_control.x >= t
|
||||
&& (earliest_control.x < earliest_t || _type == NIL)) {
|
||||
&& earliest_control.list && earliest_control.x >= t
|
||||
&& (earliest_control.x < earliest_t || _type == NIL)) {
|
||||
_type = CONTROL;
|
||||
earliest_t = earliest_control.x;
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
case SYSEX:
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("Starting at sysex event @ %1\n", earliest_t));
|
||||
_event = boost::shared_ptr< Event<Time> >(
|
||||
new Event<Time>(*(*_sysex_iter), true));
|
||||
new Event<Time>(*(*_sysex_iter), true));
|
||||
break;
|
||||
case CONTROL:
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("Starting at control event @ %1\n", earliest_t));
|
||||
|
|
@ -216,9 +216,9 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
|
|||
_is_end = true;
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("New iterator = 0x%1 : 0x%2 @ %3\n",
|
||||
(int)_event->event_type(),
|
||||
(int)((MIDIEvent<Time>*)_event.get())->type(),
|
||||
_event->time()));
|
||||
(int)_event->event_type(),
|
||||
(int)((MIDIEvent<Time>*)_event.get())->type(),
|
||||
_event->time()));
|
||||
|
||||
assert(midi_event_is_valid(_event->buffer(), _event->size()));
|
||||
}
|
||||
|
|
@ -263,13 +263,13 @@ Sequence<Time>::const_iterator::operator++()
|
|||
const MIDIEvent<Time>& ev = *((MIDIEvent<Time>*)_event.get());
|
||||
|
||||
if (!( ev.is_note()
|
||||
|| ev.is_cc()
|
||||
|| ev.is_pgm_change()
|
||||
|| ev.is_pitch_bender()
|
||||
|| ev.is_channel_pressure()
|
||||
|| ev.is_sysex()) ) {
|
||||
|| ev.is_cc()
|
||||
|| ev.is_pgm_change()
|
||||
|| ev.is_pitch_bender()
|
||||
|| ev.is_channel_pressure()
|
||||
|| ev.is_sysex()) ) {
|
||||
cerr << "WARNING: Unknown event (type " << _type << "): " << hex
|
||||
<< int(ev.buffer()[0]) << int(ev.buffer()[1]) << int(ev.buffer()[2]) << endl;
|
||||
<< int(ev.buffer()[0]) << int(ev.buffer()[1]) << int(ev.buffer()[2]) << endl;
|
||||
}
|
||||
|
||||
double x = 0.0;
|
||||
|
|
@ -288,11 +288,11 @@ Sequence<Time>::const_iterator::operator++()
|
|||
if (_force_discrete || _control_iter->list->interpolation() == ControlList::Discrete) {
|
||||
ret = _control_iter->list->rt_safe_earliest_event_discrete_unlocked (
|
||||
_control_iter->x, x, y, false
|
||||
);
|
||||
);
|
||||
} else {
|
||||
ret = _control_iter->list->rt_safe_earliest_event_linear_unlocked (
|
||||
_control_iter->x + time_between_interpolated_controller_outputs, x, y, false
|
||||
);
|
||||
);
|
||||
}
|
||||
assert(!ret || x > _control_iter->x);
|
||||
if (ret) {
|
||||
|
|
@ -307,7 +307,7 @@ Sequence<Time>::const_iterator::operator++()
|
|||
// Find the controller with the next earliest event time
|
||||
_control_iter = _control_iters.begin();
|
||||
for (ControlIterators::iterator i = _control_iters.begin();
|
||||
i != _control_iters.end(); ++i) {
|
||||
i != _control_iters.end(); ++i) {
|
||||
if (i->x < _control_iter->x) {
|
||||
_control_iter = i;
|
||||
}
|
||||
|
|
@ -372,22 +372,22 @@ Sequence<Time>::const_iterator::operator++()
|
|||
// Set event to reflect new position
|
||||
switch (_type) {
|
||||
case NOTE_ON:
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = note on\n");
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = note on\n");
|
||||
*_event = (*_note_iter)->on_event();
|
||||
_active_notes.push(*_note_iter);
|
||||
break;
|
||||
case NOTE_OFF:
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = note off\n");
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = note off\n");
|
||||
assert(!_active_notes.empty());
|
||||
*_event = _active_notes.top()->off_event();
|
||||
_active_notes.pop();
|
||||
break;
|
||||
case CONTROL:
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = control\n");
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = control\n");
|
||||
_seq->control_to_midi_event(_event, *_control_iter);
|
||||
break;
|
||||
case SYSEX:
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = sysex\n");
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = sysex\n");
|
||||
*_event = *(*_sysex_iter);
|
||||
break;
|
||||
case PATCH_CHANGE:
|
||||
|
|
@ -395,7 +395,7 @@ Sequence<Time>::const_iterator::operator++()
|
|||
*_event = (*_patch_change_iter)->message (_active_patch_change_message);
|
||||
break;
|
||||
default:
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = end\n");
|
||||
DEBUG_TRACE(DEBUG::Sequence, "iterator = end\n");
|
||||
_is_end = true;
|
||||
}
|
||||
|
||||
|
|
@ -456,8 +456,8 @@ Sequence<Time>::const_iterator::operator=(const const_iterator& other)
|
|||
template<typename Time>
|
||||
Sequence<Time>::Sequence(const TypeMap& type_map)
|
||||
: _edited(false)
|
||||
, _overlapping_pitches_accepted (true)
|
||||
, _overlap_pitch_resolution (FirstOnFirstOff)
|
||||
, _overlapping_pitches_accepted (true)
|
||||
, _overlap_pitch_resolution (FirstOnFirstOff)
|
||||
, _writing(false)
|
||||
, _type_map(type_map)
|
||||
, _end_iter(*this, DBL_MAX, false, std::set<Evoral::Parameter> ())
|
||||
|
|
@ -477,9 +477,9 @@ Sequence<Time>::Sequence(const TypeMap& type_map)
|
|||
template<typename Time>
|
||||
Sequence<Time>::Sequence(const Sequence<Time>& other)
|
||||
: ControlSet (other)
|
||||
, _edited(false)
|
||||
, _overlapping_pitches_accepted (other._overlapping_pitches_accepted)
|
||||
, _overlap_pitch_resolution (other._overlap_pitch_resolution)
|
||||
, _edited(false)
|
||||
, _overlapping_pitches_accepted (other._overlapping_pitches_accepted)
|
||||
, _overlap_pitch_resolution (other._overlap_pitch_resolution)
|
||||
, _writing(false)
|
||||
, _type_map(other._type_map)
|
||||
, _end_iter(*this, DBL_MAX, false, std::set<Evoral::Parameter> ())
|
||||
|
|
@ -487,15 +487,15 @@ Sequence<Time>::Sequence(const Sequence<Time>& other)
|
|||
, _lowest_note(other._lowest_note)
|
||||
, _highest_note(other._highest_note)
|
||||
{
|
||||
for (typename Notes::const_iterator i = other._notes.begin(); i != other._notes.end(); ++i) {
|
||||
NotePtr n (new Note<Time> (**i));
|
||||
_notes.insert (n);
|
||||
}
|
||||
for (typename Notes::const_iterator i = other._notes.begin(); i != other._notes.end(); ++i) {
|
||||
NotePtr n (new Note<Time> (**i));
|
||||
_notes.insert (n);
|
||||
}
|
||||
|
||||
for (typename SysExes::const_iterator i = other._sysexes.begin(); i != other._sysexes.end(); ++i) {
|
||||
boost::shared_ptr<Event<Time> > n (new Event<Time> (**i, true));
|
||||
_sysexes.push_back (n);
|
||||
}
|
||||
for (typename SysExes::const_iterator i = other._sysexes.begin(); i != other._sysexes.end(); ++i) {
|
||||
boost::shared_ptr<Event<Time> > n (new Event<Time> (**i, true));
|
||||
_sysexes.push_back (n);
|
||||
}
|
||||
|
||||
for (typename PatchChanges::const_iterator i = other._patch_changes.begin(); i != other._patch_changes.end(); ++i) {
|
||||
PatchChangePtr n (new PatchChange<Time> (**i));
|
||||
|
|
@ -519,8 +519,8 @@ Sequence<Time>::Sequence(const Sequence<Time>& other)
|
|||
template<typename Time>
|
||||
bool
|
||||
Sequence<Time>::control_to_midi_event(
|
||||
boost::shared_ptr< Event<Time> >& ev,
|
||||
const ControlIterator& iter) const
|
||||
boost::shared_ptr< Event<Time> >& ev,
|
||||
const ControlIterator& iter) const
|
||||
{
|
||||
assert(iter.list.get());
|
||||
const uint32_t event_type = iter.list->parameter().type();
|
||||
|
|
@ -636,13 +636,13 @@ Sequence<Time>::end_write (StuckNoteOption option, Time when)
|
|||
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 : end_write (%2 notes) delete stuck option %3 @ %4\n", this, _notes.size(), option, when));
|
||||
|
||||
if (!_percussive) {
|
||||
if (!_percussive) {
|
||||
|
||||
for (typename Notes::iterator n = _notes.begin(); n != _notes.end() ;) {
|
||||
typename Notes::iterator next = n;
|
||||
++next;
|
||||
for (typename Notes::iterator n = _notes.begin(); n != _notes.end() ;) {
|
||||
typename Notes::iterator next = n;
|
||||
++next;
|
||||
|
||||
if ((*n)->length() == 0) {
|
||||
if ((*n)->length() == 0) {
|
||||
switch (option) {
|
||||
case Relax:
|
||||
break;
|
||||
|
|
@ -663,9 +663,9 @@ Sequence<Time>::end_write (StuckNoteOption option, Time when)
|
|||
}
|
||||
}
|
||||
|
||||
n = next;
|
||||
}
|
||||
}
|
||||
n = next;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
_write_notes[i].clear();
|
||||
|
|
@ -679,19 +679,19 @@ template<typename Time>
|
|||
bool
|
||||
Sequence<Time>::add_note_unlocked(const NotePtr note, void* arg)
|
||||
{
|
||||
/* This is the core method to add notes to a Sequence
|
||||
*/
|
||||
/* This is the core method to add notes to a Sequence
|
||||
*/
|
||||
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 add note %2 @ %3 dur %4\n", this, (int)note->note(), note->time(), note->length()));
|
||||
|
||||
if (resolve_overlaps_unlocked (note, arg)) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 DISALLOWED: note %2 @ %3\n", this, (int)note->note(), note->time()));
|
||||
return false;
|
||||
if (resolve_overlaps_unlocked (note, arg)) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 DISALLOWED: note %2 @ %3\n", this, (int)note->note(), note->time()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (note->id() < 0) {
|
||||
note->set_id (Evoral::next_event_id());
|
||||
}
|
||||
if (note->id() < 0) {
|
||||
note->set_id (Evoral::next_event_id());
|
||||
}
|
||||
|
||||
if (note->note() < _lowest_note)
|
||||
_lowest_note = note->note();
|
||||
|
|
@ -699,7 +699,7 @@ Sequence<Time>::add_note_unlocked(const NotePtr note, void* arg)
|
|||
_highest_note = note->note();
|
||||
|
||||
_notes.insert (note);
|
||||
_pitches[note->channel()].insert (note);
|
||||
_pitches[note->channel()].insert (note);
|
||||
|
||||
_edited = true;
|
||||
|
||||
|
|
@ -710,7 +710,7 @@ template<typename Time>
|
|||
void
|
||||
Sequence<Time>::remove_note_unlocked(const constNotePtr note)
|
||||
{
|
||||
bool erased = false;
|
||||
bool erased = false;
|
||||
|
||||
_edited = true;
|
||||
|
||||
|
|
@ -726,48 +726,48 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
|
|||
|
||||
NotePtr n = *i;
|
||||
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1\terasing note %2 @ %3\n", this, (int)(*i)->note(), (*i)->time()));
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1\terasing note %2 @ %3\n", this, (int)(*i)->note(), (*i)->time()));
|
||||
_notes.erase (i);
|
||||
|
||||
if (n->note() == _lowest_note || n->note() == _highest_note) {
|
||||
if (n->note() == _lowest_note || n->note() == _highest_note) {
|
||||
|
||||
_lowest_note = 127;
|
||||
_highest_note = 0;
|
||||
_lowest_note = 127;
|
||||
_highest_note = 0;
|
||||
|
||||
for (typename Sequence<Time>::Notes::iterator ii = _notes.begin(); ii != _notes.end(); ++ii) {
|
||||
if ((*ii)->note() < _lowest_note)
|
||||
_lowest_note = (*ii)->note();
|
||||
if ((*ii)->note() > _highest_note)
|
||||
_highest_note = (*ii)->note();
|
||||
}
|
||||
}
|
||||
for (typename Sequence<Time>::Notes::iterator ii = _notes.begin(); ii != _notes.end(); ++ii) {
|
||||
if ((*ii)->note() < _lowest_note)
|
||||
_lowest_note = (*ii)->note();
|
||||
if ((*ii)->note() > _highest_note)
|
||||
_highest_note = (*ii)->note();
|
||||
}
|
||||
}
|
||||
|
||||
erased = true;
|
||||
}
|
||||
erased = true;
|
||||
}
|
||||
|
||||
i = tmp;
|
||||
}
|
||||
|
||||
Pitches& p (pitches (note->channel()));
|
||||
Pitches& p (pitches (note->channel()));
|
||||
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, note->note(), 0));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, note->note(), 0));
|
||||
|
||||
typename Pitches::iterator j = p.lower_bound (search_note);
|
||||
typename Pitches::iterator j = p.lower_bound (search_note);
|
||||
while (j != p.end() && (*j)->note() == note->note()) {
|
||||
typename Pitches::iterator tmp = j;
|
||||
++tmp;
|
||||
|
||||
if (*j == note) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1\terasing pitch %2 @ %3\n", this, (int)(*j)->note(), (*j)->time()));
|
||||
p.erase (j);
|
||||
}
|
||||
if (*j == note) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1\terasing pitch %2 @ %3\n", this, (int)(*j)->note(), (*j)->time()));
|
||||
p.erase (j);
|
||||
}
|
||||
|
||||
j = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!erased) {
|
||||
cerr << "Unable to find note to erase matching " << *note.get() << endl;
|
||||
}
|
||||
if (!erased) {
|
||||
cerr << "Unable to find note to erase matching " << *note.get() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
|
|
@ -808,29 +808,29 @@ template<typename Time>
|
|||
void
|
||||
Sequence<Time>::append(const Event<Time>& event, event_id_t evid)
|
||||
{
|
||||
WriteLock lock(write_lock());
|
||||
WriteLock lock(write_lock());
|
||||
|
||||
const MIDIEvent<Time>& ev = (const MIDIEvent<Time>&)event;
|
||||
const MIDIEvent<Time>& ev = (const MIDIEvent<Time>&)event;
|
||||
|
||||
assert(_notes.empty() || ev.time() >= (*_notes.rbegin())->time());
|
||||
assert(_writing);
|
||||
assert(_notes.empty() || ev.time() >= (*_notes.rbegin())->time());
|
||||
assert(_writing);
|
||||
|
||||
if (!midi_event_is_valid(ev.buffer(), ev.size())) {
|
||||
cerr << "WARNING: Sequence ignoring illegal MIDI event" << endl;
|
||||
return;
|
||||
}
|
||||
if (!midi_event_is_valid(ev.buffer(), ev.size())) {
|
||||
cerr << "WARNING: Sequence ignoring illegal MIDI event" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.is_note_on()) {
|
||||
NotePtr note(new Note<Time>(ev.channel(), ev.time(), 0, ev.note(), ev.velocity()));
|
||||
append_note_on_unlocked (note, evid);
|
||||
} else if (ev.is_note_off()) {
|
||||
NotePtr note(new Note<Time>(ev.channel(), ev.time(), 0, ev.note(), ev.velocity()));
|
||||
/* XXX note: event ID is discarded because we merge the on+off events into
|
||||
a single note object
|
||||
*/
|
||||
append_note_off_unlocked (note);
|
||||
} else if (ev.is_sysex()) {
|
||||
append_sysex_unlocked(ev, evid);
|
||||
if (ev.is_note_on()) {
|
||||
NotePtr note(new Note<Time>(ev.channel(), ev.time(), 0, ev.note(), ev.velocity()));
|
||||
append_note_on_unlocked (note, evid);
|
||||
} else if (ev.is_note_off()) {
|
||||
NotePtr note(new Note<Time>(ev.channel(), ev.time(), 0, ev.note(), ev.velocity()));
|
||||
/* XXX note: event ID is discarded because we merge the on+off events into
|
||||
a single note object
|
||||
*/
|
||||
append_note_off_unlocked (note);
|
||||
} else if (ev.is_sysex()) {
|
||||
append_sysex_unlocked(ev, evid);
|
||||
} else if (ev.is_cc() && (ev.cc_number() == MIDI_CTL_MSB_BANK || ev.cc_number() == MIDI_CTL_LSB_BANK)) {
|
||||
/* note bank numbers in our _bank[] array, so that we can write an event when the program change arrives */
|
||||
if (ev.cc_number() == MIDI_CTL_MSB_BANK) {
|
||||
|
|
@ -840,44 +840,44 @@ Sequence<Time>::append(const Event<Time>& event, event_id_t evid)
|
|||
_bank[ev.channel()] &= ~0x7f;
|
||||
_bank[ev.channel()] |= ev.cc_value();
|
||||
}
|
||||
} else if (ev.is_cc()) {
|
||||
append_control_unlocked(
|
||||
Evoral::MIDI::ContinuousController(ev.event_type(), ev.channel(), ev.cc_number()),
|
||||
ev.time(), ev.cc_value(), evid);
|
||||
} else if (ev.is_pgm_change()) {
|
||||
} else if (ev.is_cc()) {
|
||||
append_control_unlocked(
|
||||
Evoral::MIDI::ContinuousController(ev.event_type(), ev.channel(), ev.cc_number()),
|
||||
ev.time(), ev.cc_value(), evid);
|
||||
} else if (ev.is_pgm_change()) {
|
||||
/* write a patch change with this program change and any previously set-up bank number */
|
||||
append_patch_change_unlocked (PatchChange<Time> (ev.time(), ev.channel(), ev.pgm_number(), _bank[ev.channel()]), evid);
|
||||
} else if (ev.is_pitch_bender()) {
|
||||
append_control_unlocked(
|
||||
Evoral::MIDI::PitchBender(ev.event_type(), ev.channel()),
|
||||
ev.time(), double ((0x7F & ev.pitch_bender_msb()) << 7
|
||||
| (0x7F & ev.pitch_bender_lsb())),
|
||||
evid);
|
||||
} else if (ev.is_channel_pressure()) {
|
||||
append_control_unlocked(
|
||||
Evoral::MIDI::ChannelPressure(ev.event_type(), ev.channel()),
|
||||
ev.time(), ev.channel_pressure(), evid);
|
||||
} else if (!_type_map.type_is_midi(ev.event_type())) {
|
||||
printf("WARNING: Sequence: Unknown event type %X: ", ev.event_type());
|
||||
for (size_t i=0; i < ev.size(); ++i) {
|
||||
printf("%X ", ev.buffer()[i]);
|
||||
}
|
||||
printf("\n");
|
||||
} else {
|
||||
printf("WARNING: Sequence: Unknown MIDI event type %X\n", ev.type());
|
||||
}
|
||||
} else if (ev.is_pitch_bender()) {
|
||||
append_control_unlocked(
|
||||
Evoral::MIDI::PitchBender(ev.event_type(), ev.channel()),
|
||||
ev.time(), double ((0x7F & ev.pitch_bender_msb()) << 7
|
||||
| (0x7F & ev.pitch_bender_lsb())),
|
||||
evid);
|
||||
} else if (ev.is_channel_pressure()) {
|
||||
append_control_unlocked(
|
||||
Evoral::MIDI::ChannelPressure(ev.event_type(), ev.channel()),
|
||||
ev.time(), ev.channel_pressure(), evid);
|
||||
} else if (!_type_map.type_is_midi(ev.event_type())) {
|
||||
printf("WARNING: Sequence: Unknown event type %X: ", ev.event_type());
|
||||
for (size_t i=0; i < ev.size(); ++i) {
|
||||
printf("%X ", ev.buffer()[i]);
|
||||
}
|
||||
printf("\n");
|
||||
} else {
|
||||
printf("WARNING: Sequence: Unknown MIDI event type %X\n", ev.type());
|
||||
}
|
||||
|
||||
_edited = true;
|
||||
_edited = true;
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::append_note_on_unlocked (NotePtr note, event_id_t evid)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 on @ %4 v=%5\n", this,
|
||||
(int) note->channel(), (int) note->note(),
|
||||
note->time(), (int) note->velocity()));
|
||||
assert(_writing);
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 on @ %4 v=%5\n", this,
|
||||
(int) note->channel(), (int) note->note(),
|
||||
note->time(), (int) note->velocity()));
|
||||
assert(_writing);
|
||||
|
||||
if (note->note() > 127) {
|
||||
error << string_compose (_("illegal note number (%1) used in Note on event - event will be ignored"), (int) note->note()) << endmsg;
|
||||
|
|
@ -888,34 +888,34 @@ Sequence<Time>::append_note_on_unlocked (NotePtr note, event_id_t evid)
|
|||
return;
|
||||
}
|
||||
|
||||
if (note->id() < 0) {
|
||||
note->set_id (evid);
|
||||
}
|
||||
if (note->id() < 0) {
|
||||
note->set_id (evid);
|
||||
}
|
||||
|
||||
if (note->velocity() == 0) {
|
||||
append_note_off_unlocked (note);
|
||||
return;
|
||||
}
|
||||
if (note->velocity() == 0) {
|
||||
append_note_off_unlocked (note);
|
||||
return;
|
||||
}
|
||||
|
||||
add_note_unlocked (note);
|
||||
add_note_unlocked (note);
|
||||
|
||||
if (!_percussive) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("Sustained: Appending active note on %1 channel %2\n",
|
||||
(unsigned)(uint8_t)note->note(), note->channel()));
|
||||
_write_notes[note->channel()].insert (note);
|
||||
} else {
|
||||
DEBUG_TRACE(DEBUG::Sequence, "Percussive: NOT appending active note on\n");
|
||||
}
|
||||
if (!_percussive) {
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("Sustained: Appending active note on %1 channel %2\n",
|
||||
(unsigned)(uint8_t)note->note(), note->channel()));
|
||||
_write_notes[note->channel()].insert (note);
|
||||
} else {
|
||||
DEBUG_TRACE(DEBUG::Sequence, "Percussive: NOT appending active note on\n");
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::append_note_off_unlocked (NotePtr note)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 OFF @ %4 v=%5\n",
|
||||
this, (int)note->channel(),
|
||||
(int)note->note(), note->time(), (int)note->velocity()));
|
||||
assert(_writing);
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 c=%2 note %3 OFF @ %4 v=%5\n",
|
||||
this, (int)note->channel(),
|
||||
(int)note->note(), note->time(), (int)note->velocity()));
|
||||
assert(_writing);
|
||||
|
||||
if (note->note() > 127) {
|
||||
error << string_compose (_("illegal note number (%1) used in Note off event - event will be ignored"), (int) note->note()) << endmsg;
|
||||
|
|
@ -926,59 +926,59 @@ Sequence<Time>::append_note_off_unlocked (NotePtr note)
|
|||
return;
|
||||
}
|
||||
|
||||
_edited = true;
|
||||
_edited = true;
|
||||
|
||||
if (_percussive) {
|
||||
DEBUG_TRACE(DEBUG::Sequence, "Sequence Ignoring note off (percussive mode)\n");
|
||||
return;
|
||||
}
|
||||
if (_percussive) {
|
||||
DEBUG_TRACE(DEBUG::Sequence, "Sequence Ignoring note off (percussive mode)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
bool resolved = false;
|
||||
bool resolved = false;
|
||||
|
||||
/* _write_notes is sorted earliest-latest, so this will find the first matching note (FIFO) that
|
||||
matches this note (by pitch & channel). the MIDI specification doesn't provide any guidance
|
||||
whether to use FIFO or LIFO for this matching process, so SMF is fundamentally a lossy
|
||||
format.
|
||||
*/
|
||||
/* _write_notes is sorted earliest-latest, so this will find the first matching note (FIFO) that
|
||||
matches this note (by pitch & channel). the MIDI specification doesn't provide any guidance
|
||||
whether to use FIFO or LIFO for this matching process, so SMF is fundamentally a lossy
|
||||
format.
|
||||
*/
|
||||
|
||||
/* XXX use _overlap_pitch_resolution to determine FIFO/LIFO ... */
|
||||
/* XXX use _overlap_pitch_resolution to determine FIFO/LIFO ... */
|
||||
|
||||
for (typename WriteNotes::iterator n = _write_notes[note->channel()].begin(); n != _write_notes[note->channel()].end(); ) {
|
||||
for (typename WriteNotes::iterator n = _write_notes[note->channel()].begin(); n != _write_notes[note->channel()].end(); ) {
|
||||
|
||||
typename WriteNotes::iterator tmp = n;
|
||||
++tmp;
|
||||
|
||||
NotePtr nn = *n;
|
||||
if (note->note() == nn->note() && nn->channel() == note->channel()) {
|
||||
assert(note->time() >= nn->time());
|
||||
NotePtr nn = *n;
|
||||
if (note->note() == nn->note() && nn->channel() == note->channel()) {
|
||||
assert(note->time() >= nn->time());
|
||||
|
||||
nn->set_length (note->time() - nn->time());
|
||||
nn->set_off_velocity (note->velocity());
|
||||
nn->set_length (note->time() - nn->time());
|
||||
nn->set_off_velocity (note->velocity());
|
||||
|
||||
_write_notes[note->channel()].erase(n);
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("resolved note @ %2 length: %1\n", nn->length(), nn->time()));
|
||||
resolved = true;
|
||||
break;
|
||||
}
|
||||
_write_notes[note->channel()].erase(n);
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("resolved note @ %2 length: %1\n", nn->length(), nn->time()));
|
||||
resolved = true;
|
||||
break;
|
||||
}
|
||||
|
||||
n = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
cerr << this << " spurious note off chan " << (int)note->channel()
|
||||
<< ", note " << (int)note->note() << " @ " << note->time() << endl;
|
||||
}
|
||||
if (!resolved) {
|
||||
cerr << this << " spurious note off chan " << (int)note->channel()
|
||||
<< ", note " << (int)note->note() << " @ " << note->time() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::append_control_unlocked(const Parameter& param, Time time, double value, event_id_t /* evid */)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 %2 @ %3\t=\t%4 # controls: %5\n",
|
||||
this, _type_map.to_symbol(param), time, value, _controls.size()));
|
||||
boost::shared_ptr<Control> c = control(param, true);
|
||||
c->list()->add (time, value);
|
||||
/* XXX control events should use IDs */
|
||||
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 %2 @ %3\t=\t%4 # controls: %5\n",
|
||||
this, _type_map.to_symbol(param), time, value, _controls.size()));
|
||||
boost::shared_ptr<Control> c = control(param, true);
|
||||
c->list()->add (time, value);
|
||||
/* XXX control events should use IDs */
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
|
|
@ -986,15 +986,15 @@ void
|
|||
Sequence<Time>::append_sysex_unlocked(const MIDIEvent<Time>& ev, event_id_t /* evid */)
|
||||
{
|
||||
#ifdef DEBUG_SEQUENCE
|
||||
cerr << this << " SysEx @ " << ev.time() << " \t= \t [ " << hex;
|
||||
for (size_t i=0; i < ev.size(); ++i) {
|
||||
cerr << int(ev.buffer()[i]) << " ";
|
||||
} cerr << "]" << endl;
|
||||
cerr << this << " SysEx @ " << ev.time() << " \t= \t [ " << hex;
|
||||
for (size_t i=0; i < ev.size(); ++i) {
|
||||
cerr << int(ev.buffer()[i]) << " ";
|
||||
} cerr << "]" << endl;
|
||||
#endif
|
||||
|
||||
boost::shared_ptr<MIDIEvent<Time> > event(new MIDIEvent<Time>(ev, true));
|
||||
/* XXX sysex events should use IDs */
|
||||
_sysexes.push_back(event);
|
||||
boost::shared_ptr<MIDIEvent<Time> > event(new MIDIEvent<Time>(ev, true));
|
||||
/* XXX sysex events should use IDs */
|
||||
_sysexes.push_back(event);
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
|
|
@ -1014,72 +1014,72 @@ template<typename Time>
|
|||
bool
|
||||
Sequence<Time>::contains (const NotePtr& note) const
|
||||
{
|
||||
ReadLock lock (read_lock());
|
||||
return contains_unlocked (note);
|
||||
ReadLock lock (read_lock());
|
||||
return contains_unlocked (note);
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
bool
|
||||
Sequence<Time>::contains_unlocked (const NotePtr& note) const
|
||||
{
|
||||
const Pitches& p (pitches (note->channel()));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, note->note()));
|
||||
const Pitches& p (pitches (note->channel()));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, note->note()));
|
||||
|
||||
for (typename Pitches::const_iterator i = p.lower_bound (search_note);
|
||||
i != p.end() && (*i)->note() == note->note(); ++i) {
|
||||
for (typename Pitches::const_iterator i = p.lower_bound (search_note);
|
||||
i != p.end() && (*i)->note() == note->note(); ++i) {
|
||||
|
||||
if (**i == *note) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (**i == *note) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
bool
|
||||
Sequence<Time>::overlaps (const NotePtr& note, const NotePtr& without) const
|
||||
{
|
||||
ReadLock lock (read_lock());
|
||||
return overlaps_unlocked (note, without);
|
||||
ReadLock lock (read_lock());
|
||||
return overlaps_unlocked (note, without);
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
bool
|
||||
Sequence<Time>::overlaps_unlocked (const NotePtr& note, const NotePtr& without) const
|
||||
{
|
||||
Time sa = note->time();
|
||||
Time ea = note->end_time();
|
||||
Time sa = note->time();
|
||||
Time ea = note->end_time();
|
||||
|
||||
const Pitches& p (pitches (note->channel()));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, note->note()));
|
||||
const Pitches& p (pitches (note->channel()));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, note->note()));
|
||||
|
||||
for (typename Pitches::const_iterator i = p.lower_bound (search_note);
|
||||
i != p.end() && (*i)->note() == note->note(); ++i) {
|
||||
for (typename Pitches::const_iterator i = p.lower_bound (search_note);
|
||||
i != p.end() && (*i)->note() == note->note(); ++i) {
|
||||
|
||||
if (without && (**i) == *without) {
|
||||
continue;
|
||||
}
|
||||
if (without && (**i) == *without) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Time sb = (*i)->time();
|
||||
Time eb = (*i)->end_time();
|
||||
Time sb = (*i)->time();
|
||||
Time eb = (*i)->end_time();
|
||||
|
||||
if (((sb > sa) && (eb <= ea)) ||
|
||||
((eb >= sa) && (eb <= ea)) ||
|
||||
((sb > sa) && (sb <= ea)) ||
|
||||
((sa >= sb) && (sa <= eb) && (ea <= eb))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (((sb > sa) && (eb <= ea)) ||
|
||||
((eb >= sa) && (eb <= ea)) ||
|
||||
((sb > sa) && (sb <= ea)) ||
|
||||
((sa >= sb) && (sa <= eb) && (ea <= eb))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::set_notes (const Sequence<Time>::Notes& n)
|
||||
{
|
||||
_notes = n;
|
||||
_notes = n;
|
||||
}
|
||||
|
||||
/** Return the earliest note with time >= t */
|
||||
|
|
@ -1087,10 +1087,10 @@ template<typename Time>
|
|||
typename Sequence<Time>::Notes::const_iterator
|
||||
Sequence<Time>::note_lower_bound (Time t) const
|
||||
{
|
||||
NotePtr search_note(new Note<Time>(0, t, 0, 0, 0));
|
||||
typename Sequence<Time>::Notes::const_iterator i = _notes.lower_bound(search_note);
|
||||
assert(i == _notes.end() || (*i)->time() >= t);
|
||||
return i;
|
||||
NotePtr search_note(new Note<Time>(0, t, 0, 0, 0));
|
||||
typename Sequence<Time>::Notes::const_iterator i = _notes.lower_bound(search_note);
|
||||
assert(i == _notes.end() || (*i)->time() >= t);
|
||||
return i;
|
||||
}
|
||||
|
||||
/** Return the earliest patch change with time >= t */
|
||||
|
|
@ -1098,142 +1098,142 @@ template<typename Time>
|
|||
typename Sequence<Time>::PatchChanges::const_iterator
|
||||
Sequence<Time>::patch_change_lower_bound (Time t) const
|
||||
{
|
||||
PatchChangePtr search (new PatchChange<Time> (t, 0, 0, 0));
|
||||
typename Sequence<Time>::PatchChanges::const_iterator i = _patch_changes.lower_bound (search);
|
||||
assert (i == _patch_changes.end() || (*i)->time() >= t);
|
||||
return i;
|
||||
PatchChangePtr search (new PatchChange<Time> (t, 0, 0, 0));
|
||||
typename Sequence<Time>::PatchChanges::const_iterator i = _patch_changes.lower_bound (search);
|
||||
assert (i == _patch_changes.end() || (*i)->time() >= t);
|
||||
return i;
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::get_notes (Notes& n, NoteOperator op, uint8_t val, int chan_mask) const
|
||||
{
|
||||
switch (op) {
|
||||
case PitchEqual:
|
||||
case PitchLessThan:
|
||||
case PitchLessThanOrEqual:
|
||||
case PitchGreater:
|
||||
case PitchGreaterThanOrEqual:
|
||||
get_notes_by_pitch (n, op, val, chan_mask);
|
||||
break;
|
||||
switch (op) {
|
||||
case PitchEqual:
|
||||
case PitchLessThan:
|
||||
case PitchLessThanOrEqual:
|
||||
case PitchGreater:
|
||||
case PitchGreaterThanOrEqual:
|
||||
get_notes_by_pitch (n, op, val, chan_mask);
|
||||
break;
|
||||
|
||||
case VelocityEqual:
|
||||
case VelocityLessThan:
|
||||
case VelocityLessThanOrEqual:
|
||||
case VelocityGreater:
|
||||
case VelocityGreaterThanOrEqual:
|
||||
get_notes_by_velocity (n, op, val, chan_mask);
|
||||
break;
|
||||
}
|
||||
case VelocityEqual:
|
||||
case VelocityLessThan:
|
||||
case VelocityLessThanOrEqual:
|
||||
case VelocityGreater:
|
||||
case VelocityGreaterThanOrEqual:
|
||||
get_notes_by_velocity (n, op, val, chan_mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::get_notes_by_pitch (Notes& n, NoteOperator op, uint8_t val, int chan_mask) const
|
||||
{
|
||||
for (uint8_t c = 0; c < 16; ++c) {
|
||||
for (uint8_t c = 0; c < 16; ++c) {
|
||||
|
||||
if (chan_mask != 0 && !((1<<c) & chan_mask)) {
|
||||
continue;
|
||||
}
|
||||
if (chan_mask != 0 && !((1<<c) & chan_mask)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Pitches& p (pitches (c));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, val, 0));
|
||||
typename Pitches::const_iterator i;
|
||||
switch (op) {
|
||||
case PitchEqual:
|
||||
i = p.lower_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() == val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchLessThan:
|
||||
i = p.upper_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() < val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchLessThanOrEqual:
|
||||
i = p.upper_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() <= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchGreater:
|
||||
i = p.lower_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() > val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchGreaterThanOrEqual:
|
||||
i = p.lower_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() >= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
const Pitches& p (pitches (c));
|
||||
NotePtr search_note(new Note<Time>(0, 0, 0, val, 0));
|
||||
typename Pitches::const_iterator i;
|
||||
switch (op) {
|
||||
case PitchEqual:
|
||||
i = p.lower_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() == val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchLessThan:
|
||||
i = p.upper_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() < val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchLessThanOrEqual:
|
||||
i = p.upper_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() <= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchGreater:
|
||||
i = p.lower_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() > val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case PitchGreaterThanOrEqual:
|
||||
i = p.lower_bound (search_note);
|
||||
while (i != p.end() && (*i)->note() >= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//fatal << string_compose (_("programming error: %1 %2", X_("get_notes_by_pitch() called with illegal operator"), op)) << endmsg;
|
||||
abort ();
|
||||
/* NOTREACHED*/
|
||||
}
|
||||
}
|
||||
default:
|
||||
//fatal << string_compose (_("programming error: %1 %2", X_("get_notes_by_pitch() called with illegal operator"), op)) << endmsg;
|
||||
abort ();
|
||||
/* NOTREACHED*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::get_notes_by_velocity (Notes& n, NoteOperator op, uint8_t val, int chan_mask) const
|
||||
{
|
||||
ReadLock lock (read_lock());
|
||||
ReadLock lock (read_lock());
|
||||
|
||||
for (typename Notes::const_iterator i = _notes.begin(); i != _notes.end(); ++i) {
|
||||
for (typename Notes::const_iterator i = _notes.begin(); i != _notes.end(); ++i) {
|
||||
|
||||
if (chan_mask != 0 && !((1<<((*i)->channel())) & chan_mask)) {
|
||||
continue;
|
||||
}
|
||||
if (chan_mask != 0 && !((1<<((*i)->channel())) & chan_mask)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (op) {
|
||||
case VelocityEqual:
|
||||
if ((*i)->velocity() == val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityLessThan:
|
||||
if ((*i)->velocity() < val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityLessThanOrEqual:
|
||||
if ((*i)->velocity() <= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityGreater:
|
||||
if ((*i)->velocity() > val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityGreaterThanOrEqual:
|
||||
if ((*i)->velocity() >= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// fatal << string_compose (_("programming error: %1 %2", X_("get_notes_by_velocity() called with illegal operator"), op)) << endmsg;
|
||||
abort ();
|
||||
/* NOTREACHED*/
|
||||
switch (op) {
|
||||
case VelocityEqual:
|
||||
if ((*i)->velocity() == val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityLessThan:
|
||||
if ((*i)->velocity() < val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityLessThanOrEqual:
|
||||
if ((*i)->velocity() <= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityGreater:
|
||||
if ((*i)->velocity() > val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
case VelocityGreaterThanOrEqual:
|
||||
if ((*i)->velocity() >= val) {
|
||||
n.insert (*i);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// fatal << string_compose (_("programming error: %1 %2", X_("get_notes_by_velocity() called with illegal operator"), op)) << endmsg;
|
||||
abort ();
|
||||
/* NOTREACHED*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::set_overlap_pitch_resolution (OverlapPitchResolution opr)
|
||||
{
|
||||
_overlap_pitch_resolution = opr;
|
||||
_overlap_pitch_resolution = opr;
|
||||
|
||||
/* XXX todo: clean up existing overlaps in source data? */
|
||||
/* XXX todo: clean up existing overlaps in source data? */
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
|
|
|
|||
|
|
@ -12,20 +12,20 @@ main()
|
|||
{
|
||||
Glib::thread_init();
|
||||
|
||||
CppUnit::TestResult testresult;
|
||||
CppUnit::TestResult testresult;
|
||||
|
||||
CppUnit::TestResultCollector collectedresults;
|
||||
testresult.addListener (&collectedresults);
|
||||
CppUnit::TestResultCollector collectedresults;
|
||||
testresult.addListener (&collectedresults);
|
||||
|
||||
CppUnit::BriefTestProgressListener progress;
|
||||
testresult.addListener (&progress);
|
||||
CppUnit::BriefTestProgressListener progress;
|
||||
testresult.addListener (&progress);
|
||||
|
||||
CppUnit::TestRunner testrunner;
|
||||
testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ());
|
||||
testrunner.run (testresult);
|
||||
CppUnit::TestRunner testrunner;
|
||||
testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ());
|
||||
testrunner.run (testresult);
|
||||
|
||||
CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
|
||||
compileroutputter.write ();
|
||||
CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
|
||||
compileroutputter.write ();
|
||||
|
||||
return collectedresults.wasSuccessful () ? 0 : 1;
|
||||
return collectedresults.wasSuccessful () ? 0 : 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue