mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +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
|
/** A single event (time-stamped value) for a control
|
||||||
*/
|
*/
|
||||||
struct ControlEvent {
|
struct ControlEvent {
|
||||||
ControlEvent (double w, double v)
|
ControlEvent (double w, double v)
|
||||||
: when (w), value (v), coeff (0)
|
: when (w), value (v), coeff (0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ControlEvent (const ControlEvent& other)
|
ControlEvent (const ControlEvent& other)
|
||||||
: when (other.when), value (other.value), coeff (0)
|
: when (other.when), value (other.value), coeff (0)
|
||||||
{
|
{
|
||||||
if (other.coeff) {
|
if (other.coeff) {
|
||||||
create_coeffs();
|
create_coeffs();
|
||||||
|
|
@ -58,9 +58,9 @@ struct ControlEvent {
|
||||||
coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.0;
|
coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double when;
|
double when;
|
||||||
double value;
|
double value;
|
||||||
double* coeff; ///< double[4] allocated by Curve as needed
|
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
|
* and allocates 8k blocks of new pointers at a time
|
||||||
*/
|
*/
|
||||||
typedef boost::fast_pool_allocator<
|
typedef boost::fast_pool_allocator<
|
||||||
ControlEvent*,
|
ControlEvent*,
|
||||||
boost::default_user_allocator_new_delete,
|
boost::default_user_allocator_new_delete,
|
||||||
boost::details::pool::null_mutex,
|
boost::details::pool::null_mutex,
|
||||||
8192>
|
8192>
|
||||||
ControlEventAllocator;
|
ControlEventAllocator;
|
||||||
|
|
||||||
|
|
||||||
/** A list (sequence) of time-stamped values for a control
|
/** A list (sequence) of time-stamped values for a control
|
||||||
|
|
@ -115,7 +115,7 @@ public:
|
||||||
void slide (iterator before, double distance);
|
void slide (iterator before, double distance);
|
||||||
void shift (double 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 rt_add (double when, double value);
|
||||||
void add (double when, double value);
|
void add (double when, double value);
|
||||||
|
|
@ -246,7 +246,7 @@ public:
|
||||||
mutable PBD::Signal0<void> Dirty;
|
mutable PBD::Signal0<void> Dirty;
|
||||||
/** Emitted when our interpolation style changes */
|
/** Emitted when our interpolation style changes */
|
||||||
PBD::Signal1<void, InterpolationStyle> InterpolationChanged;
|
PBD::Signal1<void, InterpolationStyle> InterpolationChanged;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Called by unlocked_eval() to handle cases of 3 or more control points. */
|
/** Called by unlocked_eval() to handle cases of 3 or more control points. */
|
||||||
|
|
@ -282,13 +282,13 @@ protected:
|
||||||
EventList events;
|
EventList events;
|
||||||
double start_time;
|
double start_time;
|
||||||
double end_time;
|
double end_time;
|
||||||
|
|
||||||
NascentInfo (double start = -1.0)
|
NascentInfo (double start = -1.0)
|
||||||
: start_time (start)
|
: start_time (start)
|
||||||
, end_time (-1.0)
|
, end_time (-1.0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::list<NascentInfo*> nascent;
|
std::list<NascentInfo*> nascent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ public:
|
||||||
|
|
||||||
/** @param capacity Ringbuffer capacity in bytes.
|
/** @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).
|
/** Peek at the ringbuffer (read w/o advancing read pointer).
|
||||||
* @return how much has been peeked (wraps around if read exceeds
|
* @return how much has been peeked (wraps around if read exceeds
|
||||||
|
|
@ -57,7 +57,7 @@ public:
|
||||||
* read-pointer---^
|
* read-pointer---^
|
||||||
* </pre>
|
* </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);
|
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);
|
bool read (Time* time, EventType* type, uint32_t* size, uint8_t* buf);
|
||||||
|
|
@ -67,25 +67,25 @@ template<typename Time>
|
||||||
inline bool
|
inline bool
|
||||||
EventRingBuffer<Time>::peek (uint8_t* buf, size_t size)
|
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) {
|
if (vec.len[0] + vec.len[1] < size) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vec.len[0] > 0) {
|
if (vec.len[0] > 0) {
|
||||||
memcpy (buf, vec.buf[0], min (vec.len[0], size));
|
memcpy (buf, vec.buf[0], min (vec.len[0], size));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vec.len[0] < size) {
|
if (vec.len[0] < size) {
|
||||||
if (vec.len[1]) {
|
if (vec.len[1]) {
|
||||||
memcpy (buf + vec.len[0], vec.buf[1], size - vec.len[0]);
|
memcpy (buf + vec.len[0], vec.buf[1], size - vec.len[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
|
|
@ -93,20 +93,20 @@ inline bool
|
||||||
EventRingBuffer<Time>::read(Time* time, EventType* type, uint32_t* size, uint8_t* buf)
|
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)) {
|
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)) {
|
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)type, sizeof(EventType)) != sizeof (EventType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)size, sizeof(uint32_t)) != sizeof (uint32_t)) {
|
if (PBD::RingBufferNPT<uint8_t>::read ((uint8_t*)size, sizeof(uint32_t)) != sizeof (uint32_t)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PBD::RingBufferNPT<uint8_t>::read (buf, *size) != *size) {
|
if (PBD::RingBufferNPT<uint8_t>::read (buf, *size) != *size) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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)) {
|
if (write_space() < (sizeof(Time) + sizeof(EventType) + sizeof(uint32_t) + size)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&time, sizeof(Time));
|
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*)&type, sizeof(EventType));
|
||||||
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&size, sizeof(uint32_t));
|
PBD::RingBufferNPT<uint8_t>::write ((uint8_t*)&size, sizeof(uint32_t));
|
||||||
PBD::RingBufferNPT<uint8_t>::write (buf, size);
|
PBD::RingBufferNPT<uint8_t>::write (buf, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/* This file is part of Evoral.
|
/* This file is part of Evoral.
|
||||||
* Copyright (C) 2008 David Robillard <http://drobilla.net>
|
* Copyright (C) 2008 David Robillard <http://drobilla.net>
|
||||||
* Copyright (C) 2000-2008 Paul Davis
|
* Copyright (C) 2000-2008 Paul Davis
|
||||||
|
|
@ -95,7 +94,7 @@ public:
|
||||||
inline void set_range(double min, double max, double normal, bool toggled) {
|
inline void set_range(double min, double max, double normal, bool toggled) {
|
||||||
_metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal, toggled));
|
_metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal, toggled));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Metadata& metadata() const {
|
inline Metadata& metadata() const {
|
||||||
if (_metadata)
|
if (_metadata)
|
||||||
return *_metadata.get();
|
return *_metadata.get();
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2010 Paul Davis
|
Copyright (C) 2010 Paul Davis
|
||||||
Author: Carl Hetherington <cth@carlh.net>
|
Author: Carl Hetherington <cth@carlh.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EVORAL_PATCH_CHANGE_HPP
|
#ifndef EVORAL_PATCH_CHANGE_HPP
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Evoral {
|
||||||
/** Event representing a `patch change', composed of a LSB and MSB
|
/** Event representing a `patch change', composed of a LSB and MSB
|
||||||
* bank select and then a program change.
|
* bank select and then a program change.
|
||||||
*/
|
*/
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
class PatchChange
|
class PatchChange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
_bank_change_lsb.buffer()[0] = MIDI_CMD_CONTROL | c;
|
_bank_change_lsb.buffer()[0] = MIDI_CMD_CONTROL | c;
|
||||||
_bank_change_lsb.buffer()[1] = MIDI_CTL_LSB_BANK;
|
_bank_change_lsb.buffer()[1] = MIDI_CTL_LSB_BANK;
|
||||||
_bank_change_lsb.buffer()[2] = b & 0x7f;
|
_bank_change_lsb.buffer()[2] = b & 0x7f;
|
||||||
|
|
||||||
_program_change.buffer()[0] = MIDI_CMD_PGM_CHANGE | c;
|
_program_change.buffer()[0] = MIDI_CMD_PGM_CHANGE | c;
|
||||||
_program_change.buffer()[1] = p;
|
_program_change.buffer()[1] = p;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +65,7 @@ public:
|
||||||
event_id_t id () const {
|
event_id_t id () const {
|
||||||
return _program_change.id ();
|
return _program_change.id ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_id (event_id_t id) {
|
void set_id (event_id_t id) {
|
||||||
_bank_change_msb.set_id (id);
|
_bank_change_msb.set_id (id);
|
||||||
_bank_change_lsb.set_id (id);
|
_bank_change_lsb.set_id (id);
|
||||||
|
|
@ -98,7 +98,7 @@ public:
|
||||||
void set_program (uint8_t p) {
|
void set_program (uint8_t p) {
|
||||||
_program_change.buffer()[1] = p;
|
_program_change.buffer()[1] = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bank () const {
|
int bank () const {
|
||||||
return (bank_msb() << 7) | bank_lsb();
|
return (bank_msb() << 7) | bank_lsb();
|
||||||
}
|
}
|
||||||
|
|
@ -115,14 +115,14 @@ public:
|
||||||
uint8_t bank_lsb () const {
|
uint8_t bank_lsb () const {
|
||||||
return _bank_change_lsb.buffer()[2];
|
return _bank_change_lsb.buffer()[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t channel () const { return _program_change.buffer()[0] & 0xf; }
|
uint8_t channel () const { return _program_change.buffer()[0] & 0xf; }
|
||||||
|
|
||||||
inline bool operator< (const PatchChange<Time>& o) const {
|
inline bool operator< (const PatchChange<Time>& o) const {
|
||||||
if (time() != o.time()) {
|
if (time() != o.time()) {
|
||||||
return time() < o.time();
|
return time() < o.time();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bank != o.bank()) {
|
if (bank != o.bank()) {
|
||||||
return bank() < o.bank();
|
return bank() < o.bank();
|
||||||
}
|
}
|
||||||
|
|
@ -164,5 +164,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -67,10 +67,10 @@ public:
|
||||||
|
|
||||||
double round_to_file_precision (double val) const;
|
double round_to_file_precision (double val) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_path (const std::string& p);
|
void set_path (const std::string& p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _file_path;
|
std::string _file_path;
|
||||||
smf_t* _smf;
|
smf_t* _smf;
|
||||||
smf_track_t* _smf_track;
|
smf_track_t* _smf_track;
|
||||||
|
|
|
||||||
|
|
@ -98,13 +98,13 @@ public:
|
||||||
void start_write();
|
void start_write();
|
||||||
bool writing() const { return _writing; }
|
bool writing() const { return _writing; }
|
||||||
|
|
||||||
enum StuckNoteOption {
|
enum StuckNoteOption {
|
||||||
Relax,
|
Relax,
|
||||||
DeleteStuckNotes,
|
DeleteStuckNotes,
|
||||||
ResolveStuckNotes
|
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);
|
void append(const Event<Time>& ev, Evoral::event_id_t evid);
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ public:
|
||||||
inline Notes& notes() { return _notes; }
|
inline Notes& notes() { return _notes; }
|
||||||
inline const Notes& notes() const { return _notes; }
|
inline const Notes& notes() const { return _notes; }
|
||||||
|
|
||||||
enum NoteOperator {
|
enum NoteOperator {
|
||||||
PitchEqual,
|
PitchEqual,
|
||||||
PitchLessThan,
|
PitchLessThan,
|
||||||
PitchLessThanOrEqual,
|
PitchLessThanOrEqual,
|
||||||
|
|
@ -169,7 +169,7 @@ public:
|
||||||
void trim_overlapping_notes ();
|
void trim_overlapping_notes ();
|
||||||
void remove_duplicate_notes ();
|
void remove_duplicate_notes ();
|
||||||
|
|
||||||
enum OverlapPitchResolution {
|
enum OverlapPitchResolution {
|
||||||
LastOnFirstOff,
|
LastOnFirstOff,
|
||||||
FirstOnFirstOff
|
FirstOnFirstOff
|
||||||
};
|
};
|
||||||
|
|
@ -187,7 +187,7 @@ public:
|
||||||
|
|
||||||
typedef boost::shared_ptr<PatchChange<Time> > PatchChangePtr;
|
typedef boost::shared_ptr<PatchChange<Time> > PatchChangePtr;
|
||||||
typedef boost::shared_ptr<const PatchChange<Time> > constPatchChangePtr;
|
typedef boost::shared_ptr<const PatchChange<Time> > constPatchChangePtr;
|
||||||
|
|
||||||
struct EarlierPatchChangeComparator {
|
struct EarlierPatchChangeComparator {
|
||||||
inline bool operator() (constPatchChangePtr a, constPatchChangePtr b) const {
|
inline bool operator() (constPatchChangePtr a, constPatchChangePtr b) const {
|
||||||
return a->time() < b->time();
|
return a->time() < b->time();
|
||||||
|
|
@ -198,7 +198,7 @@ public:
|
||||||
inline PatchChanges& patch_changes () { return _patch_changes; }
|
inline PatchChanges& patch_changes () { return _patch_changes; }
|
||||||
inline const PatchChanges& patch_changes () const { return _patch_changes; }
|
inline const PatchChanges& patch_changes () const { return _patch_changes; }
|
||||||
|
|
||||||
void dump (std::ostream&) const;
|
void dump (std::ostream&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::priority_queue<NotePtr, std::deque<NotePtr>, LaterNoteEndComparator> ActiveNotes;
|
typedef std::priority_queue<NotePtr, std::deque<NotePtr>, LaterNoteEndComparator> ActiveNotes;
|
||||||
|
|
@ -257,7 +257,7 @@ public:
|
||||||
std::set<Evoral::Parameter> const & f = std::set<Evoral::Parameter> ()) const {
|
std::set<Evoral::Parameter> const & f = std::set<Evoral::Parameter> ()) const {
|
||||||
return const_iterator (*this, t, force_discrete, f);
|
return const_iterator (*this, t, force_discrete, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
const const_iterator& end() const { return _end_iter; }
|
const const_iterator& end() const { return _end_iter; }
|
||||||
|
|
||||||
typename Notes::const_iterator note_lower_bound (Time t) const;
|
typename Notes::const_iterator note_lower_bound (Time t) const;
|
||||||
|
|
@ -269,7 +269,7 @@ public:
|
||||||
bool edited() const { return _edited; }
|
bool edited() const { return _edited; }
|
||||||
void set_edited(bool yn) { _edited = yn; }
|
void set_edited(bool yn) { _edited = yn; }
|
||||||
|
|
||||||
bool overlaps (const NotePtr& ev,
|
bool overlaps (const NotePtr& ev,
|
||||||
const NotePtr& ignore_this_note) const;
|
const NotePtr& ignore_this_note) const;
|
||||||
bool contains (const NotePtr& ev) const;
|
bool contains (const NotePtr& ev) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ protected:
|
||||||
template<typename A, typename B>
|
template<typename A, typename B>
|
||||||
class IdentityConverter : public TimeConverter<A,B> {
|
class IdentityConverter : public TimeConverter<A,B> {
|
||||||
public:
|
public:
|
||||||
IdentityConverter() {}
|
IdentityConverter() {}
|
||||||
B to(A a) const { return static_cast<B>(a); }
|
B to(A a) const { return static_cast<B>(a); }
|
||||||
A from(B b) const { return static_cast<A>(b); }
|
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
|
/** ID of an event (note or other). This must be operable on by glib
|
||||||
atomic ops
|
atomic ops
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef int32_t event_id_t;
|
typedef int32_t event_id_t;
|
||||||
|
|
||||||
/** Musical time: beats relative to some defined origin */
|
/** 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
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$srcdir/../../build/default/libs/evoral:$srcdir/../../build/default/libs/pbd
|
||||||
if [ ! -f './test/testdata/TakeFive.mid' ]; then
|
if [ ! -f './test/testdata/TakeFive.mid' ]; then
|
||||||
echo "This script must be run from within the libs/evoral directory";
|
echo "This script must be run from within the libs/evoral directory";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make symlink to TakeFive.mid in build directory
|
# Make symlink to TakeFive.mid in build directory
|
||||||
|
|
|
||||||
|
|
@ -107,11 +107,11 @@ ControlList::~ControlList()
|
||||||
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
||||||
delete (*x);
|
delete (*x);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list<NascentInfo*>::iterator n = nascent.begin(); n != nascent.end(); ++n) {
|
for (list<NascentInfo*>::iterator n = nascent.begin(); n != nascent.end(); ++n) {
|
||||||
for (EventList::iterator x = (*n)->events.begin(); x != (*n)->events.end(); ++x) {
|
for (EventList::iterator x = (*n)->events.begin(); x != (*n)->events.end(); ++x) {
|
||||||
delete *x;
|
delete *x;
|
||||||
}
|
}
|
||||||
delete (*n);
|
delete (*n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ ControlList::extend_to (double when)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::_x_scale (double factor)
|
ControlList::_x_scale (double factor)
|
||||||
{
|
{
|
||||||
for (iterator i = _events.begin(); i != _events.end(); ++i) {
|
for (iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||||
|
|
@ -220,7 +220,7 @@ ControlList::_x_scale (double factor)
|
||||||
void
|
void
|
||||||
ControlList::write_pass_finished (double when)
|
ControlList::write_pass_finished (double when)
|
||||||
{
|
{
|
||||||
merge_nascent (when);
|
merge_nascent (when);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -233,104 +233,104 @@ struct ControlEventTimeComparator {
|
||||||
void
|
void
|
||||||
ControlList::merge_nascent (double when)
|
ControlList::merge_nascent (double when)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (_lock);
|
Glib::Mutex::Lock lm (_lock);
|
||||||
|
|
||||||
if (nascent.empty()) {
|
if (nascent.empty()) {
|
||||||
return;
|
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;
|
NascentInfo* ninfo = *n;
|
||||||
EventList& nascent_events (ninfo->events);
|
EventList& nascent_events (ninfo->events);
|
||||||
bool need_adjacent_start_clamp;
|
bool need_adjacent_start_clamp;
|
||||||
bool need_adjacent_end_clamp;
|
bool need_adjacent_end_clamp;
|
||||||
|
|
||||||
if (nascent_events.empty()) {
|
if (nascent_events.empty()) {
|
||||||
delete ninfo;
|
delete ninfo;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
nascent_events.sort (ControlEventTimeComparator ());
|
nascent_events.sort (ControlEventTimeComparator ());
|
||||||
|
|
||||||
if (ninfo->start_time < 0.0) {
|
|
||||||
ninfo->start_time = nascent_events.front()->when;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ninfo->end_time < 0.0) {
|
|
||||||
ninfo->end_time = when;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool preexisting = !_events.empty();
|
if (ninfo->start_time < 0.0) {
|
||||||
|
ninfo->start_time = nascent_events.front()->when;
|
||||||
|
}
|
||||||
|
|
||||||
if (!preexisting) {
|
if (ninfo->end_time < 0.0) {
|
||||||
|
ninfo->end_time = when;
|
||||||
_events = nascent_events;
|
}
|
||||||
|
|
||||||
} else if (ninfo->end_time < _events.front()->when) {
|
|
||||||
|
|
||||||
/* all points in nascent are before the first existing point */
|
|
||||||
|
|
||||||
_events.insert (_events.begin(), nascent_events.begin(), nascent_events.end());
|
bool preexisting = !_events.empty();
|
||||||
|
|
||||||
} else if (ninfo->start_time > _events.back()->when) {
|
|
||||||
|
|
||||||
/* all points in nascent are after the last existing point */
|
|
||||||
|
|
||||||
_events.insert (_events.end(), nascent_events.begin(), nascent_events.end());
|
if (!preexisting) {
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
|
|
||||||
need_adjacent_end_clamp = true;
|
_events = nascent_events;
|
||||||
need_adjacent_start_clamp = true;
|
|
||||||
|
|
||||||
for (i = _events.begin(); i != _events.end(); ++i) {
|
} else if (ninfo->end_time < _events.front()->when) {
|
||||||
|
|
||||||
if ((*i)->when == ninfo->start_time) {
|
/* all points in nascent are before the first existing point */
|
||||||
/* existing point at same time, remove it
|
|
||||||
and the consider the next point instead.
|
|
||||||
*/
|
|
||||||
i = _events.erase (i);
|
|
||||||
|
|
||||||
if (i == _events.end()) {
|
_events.insert (_events.begin(), nascent_events.begin(), nascent_events.end());
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (range_begin == _events.end()) {
|
} else if (ninfo->start_time > _events.back()->when) {
|
||||||
range_begin = i;
|
|
||||||
need_adjacent_start_clamp = false;
|
|
||||||
} else {
|
|
||||||
need_adjacent_end_clamp = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((*i)->when > ninfo->end_time) {
|
|
||||||
range_end = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ((*i)->when > ninfo->start_time) {
|
/* all points in nascent are after the last existing point */
|
||||||
|
|
||||||
if (range_begin == _events.end()) {
|
_events.insert (_events.end(), nascent_events.begin(), nascent_events.end());
|
||||||
range_begin = i;
|
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if ((*i)->when > ninfo->end_time) {
|
/* find the range that overlaps with nascent events,
|
||||||
range_end = i;
|
and insert the contents of nascent events.
|
||||||
break;
|
*/
|
||||||
}
|
|
||||||
}
|
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;
|
||||||
|
|
||||||
|
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 == _events.end()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ((*i)->when > ninfo->start_time) {
|
||||||
|
|
||||||
|
if (range_begin == _events.end()) {
|
||||||
|
range_begin = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*i)->when > ninfo->end_time) {
|
||||||
|
range_end = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Now:
|
/* Now:
|
||||||
range_begin is the first event on our list after the first nascent event
|
range_begin is the first event on our list after the first nascent event
|
||||||
|
|
@ -339,59 +339,59 @@ ControlList::merge_nascent (double when)
|
||||||
range_begin may be equal to _events.end() iff the last event on our list
|
range_begin may be equal to _events.end() iff the last event on our list
|
||||||
was at the same time as the first nascent event.
|
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_events.insert (range_begin, nascent_events.begin(), nascent_events.end());
|
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_end != _events.end()) {
|
_events.insert (range_begin, nascent_events.begin(), nascent_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete ninfo;
|
if (range_end != _events.end()) {
|
||||||
}
|
/* clamp point after */
|
||||||
|
if (need_adjacent_end_clamp) {
|
||||||
|
_events.insert (range_begin, new ControlEvent (ninfo->end_time, end_value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nascent.clear ();
|
_events.erase (range_begin, range_end);
|
||||||
|
}
|
||||||
|
|
||||||
if (writing()) {
|
delete ninfo;
|
||||||
nascent.push_back (new NascentInfo ());
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
maybe_signal_changed ();
|
nascent.clear ();
|
||||||
|
|
||||||
|
if (writing()) {
|
||||||
|
nascent.push_back (new NascentInfo ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
maybe_signal_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::rt_add (double when, double value)
|
ControlList::rt_add (double when, double value)
|
||||||
{
|
{
|
||||||
// this is for automation recording
|
// this is for automation recording
|
||||||
|
|
||||||
if (touch_enabled() && !touching()) {
|
if (touch_enabled() && !touching()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//cerr << "RT: alist " << this << " add " << value << " @ " << when << endl;
|
//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()) {
|
if (lm.locked()) {
|
||||||
assert (!nascent.empty());
|
assert (!nascent.empty());
|
||||||
/* we don't worry about adding events out of time order as we will
|
/* we don't worry about adding events out of time order as we will
|
||||||
sort them in merge_nascent.
|
sort them in merge_nascent.
|
||||||
*/
|
*/
|
||||||
nascent.back()->events.push_back (new ControlEvent (when, value));
|
nascent.back()->events.push_back (new ControlEvent (when, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -405,13 +405,13 @@ ControlList::fast_simple_add (double when, double value)
|
||||||
void
|
void
|
||||||
ControlList::add (double when, double value)
|
ControlList::add (double when, double value)
|
||||||
{
|
{
|
||||||
/* this is for making changes from some kind of user interface or
|
/* this is for making changes from some kind of user interface or
|
||||||
control surface (GUI, MIDI, OSC etc)
|
control surface (GUI, MIDI, OSC etc)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!clamp_value (when, value)) {
|
if (!clamp_value (when, value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (_lock);
|
Glib::Mutex::Lock lm (_lock);
|
||||||
|
|
@ -483,7 +483,7 @@ ControlList::erase (double when, double value)
|
||||||
if (i != end ()) {
|
if (i != end ()) {
|
||||||
_events.erase (i);
|
_events.erase (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
mark_dirty ();
|
mark_dirty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -576,7 +576,7 @@ ControlList::slide (iterator before, double distance)
|
||||||
++before;
|
++before;
|
||||||
}
|
}
|
||||||
|
|
||||||
mark_dirty ();
|
mark_dirty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_signal_changed ();
|
maybe_signal_changed ();
|
||||||
|
|
@ -588,7 +588,7 @@ ControlList::shift (double pos, double frames)
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (_lock);
|
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) {
|
if ((*i)->when >= pos) {
|
||||||
(*i)->when += frames;
|
(*i)->when += frames;
|
||||||
}
|
}
|
||||||
|
|
@ -727,7 +727,7 @@ ControlList::truncate_end (double last_coordinate)
|
||||||
if (last_coordinate > _events.back()->when) {
|
if (last_coordinate > _events.back()->when) {
|
||||||
|
|
||||||
/* extending end:
|
/* extending end:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
iterator foo = _events.begin();
|
iterator foo = _events.begin();
|
||||||
bool lessthantwo;
|
bool lessthantwo;
|
||||||
|
|
@ -1129,7 +1129,7 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (double start, double& x,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No points in range */
|
/* No points in range */
|
||||||
} else {
|
} else {
|
||||||
return false;
|
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();
|
const_iterator length_check_iter = _events.begin();
|
||||||
if (_events.empty()) { // 0 events
|
if (_events.empty()) { // 0 events
|
||||||
return false;
|
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);
|
return rt_safe_earliest_event_discrete_unlocked (start, x, y, inclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack to avoid infinitely repeating the same event
|
// Hack to avoid infinitely repeating the same event
|
||||||
build_search_cache_if_necessary (start);
|
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;
|
next = *_search_cache.first;
|
||||||
|
|
||||||
/* Step is before first */
|
/* Step is before first */
|
||||||
} else {
|
} else {
|
||||||
const_iterator prev = _search_cache.first;
|
const_iterator prev = _search_cache.first;
|
||||||
--prev;
|
--prev;
|
||||||
|
|
@ -1229,11 +1229,11 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double& x, do
|
||||||
}
|
}
|
||||||
|
|
||||||
/*cerr << first->value << " @ " << first->when << " ... "
|
/*cerr << first->value << " @ " << first->when << " ... "
|
||||||
<< next->value << " @ " << next->when
|
<< next->value << " @ " << next->when
|
||||||
<< " = " << y << " @ " << x << endl;*/
|
<< " = " << y << " @ " << x << endl;*/
|
||||||
|
|
||||||
assert( (y >= first->value && y <= next->value)
|
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);
|
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;
|
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 {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1263,14 +1263,14 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<ControlList> nal = create (_parameter);
|
boost::shared_ptr<ControlList> nal = create (_parameter);
|
||||||
iterator s, e;
|
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
|
/* first, determine s & e, two iterators that define the range of points
|
||||||
affected by this operation
|
affected by this operation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((s = lower_bound (_events.begin(), _events.end(), &cp, time_comparator)) == _events.end()) {
|
if ((s = lower_bound (_events.begin(), _events.end(), &cp, time_comparator)) == _events.end()) {
|
||||||
return nal;
|
return nal;
|
||||||
|
|
@ -1281,43 +1281,43 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
||||||
e = upper_bound (_events.begin(), _events.end(), &cp, time_comparator);
|
e = upper_bound (_events.begin(), _events.end(), &cp, time_comparator);
|
||||||
|
|
||||||
|
|
||||||
/* if "start" isn't the location of an existing point,
|
/* if "start" isn't the location of an existing point,
|
||||||
evaluate the curve to get a value for the start. Add a point to
|
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,
|
both the existing event list, and if its not a "clear" operation,
|
||||||
to the copy ("nal") as well.
|
to the copy ("nal") as well.
|
||||||
|
|
||||||
Note that the time positions of the points in each list are different
|
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.
|
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".
|
|
||||||
*/
|
|
||||||
|
|
||||||
double end_value = unlocked_eval (end);
|
/* before we begin any cut/clear operations, get the value of the curve
|
||||||
|
at "end".
|
||||||
|
*/
|
||||||
|
|
||||||
if ((*s)->when != start) {
|
double end_value = unlocked_eval (end);
|
||||||
|
|
||||||
double val = unlocked_eval (start);
|
if ((*s)->when != start) {
|
||||||
|
|
||||||
|
double val = unlocked_eval (start);
|
||||||
|
|
||||||
if (op == 0) { // cut
|
if (op == 0) { // cut
|
||||||
if (start > _events.front()->when) {
|
if (start > _events.front()->when) {
|
||||||
_events.insert (s, (new ControlEvent (start, val)));
|
_events.insert (s, (new ControlEvent (start, val)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op != 2) { // ! clear
|
if (op != 2) { // ! clear
|
||||||
nal->_events.push_back (new ControlEvent (0, val));
|
nal->_events.push_back (new ControlEvent (0, val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iterator x = s; x != e; ) {
|
for (iterator x = s; x != e; ) {
|
||||||
|
|
||||||
/* adjust new points to be relative to start, which
|
/* adjust new points to be relative to start, which
|
||||||
has been set to zero.
|
has been set to zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (op != 2) {
|
if (op != 2) {
|
||||||
nal->_events.push_back (new ControlEvent ((*x)->when - start, (*x)->value));
|
nal->_events.push_back (new ControlEvent ((*x)->when - start, (*x)->value));
|
||||||
}
|
}
|
||||||
|
|
@ -1325,30 +1325,30 @@ ControlList::cut_copy_clear (double start, double end, int op)
|
||||||
if (op != 1) {
|
if (op != 1) {
|
||||||
x = _events.erase (x);
|
x = _events.erase (x);
|
||||||
} else {
|
} else {
|
||||||
++x;
|
++x;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (e == _events.end() || (*e)->when != 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 != 2 && (e != _events.end() && end < (*e)->when)) { // cut/copy
|
|
||||||
nal->_events.push_back (new ControlEvent (end - start, end_value));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mark_dirty ();
|
if (e == _events.end() || (*e)->when != 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 != 2 && (e != _events.end() && end < (*e)->when)) { // cut/copy
|
||||||
|
nal->_events.push_back (new ControlEvent (end - start, end_value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mark_dirty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op != 1) {
|
if (op != 1) {
|
||||||
maybe_signal_changed ();
|
maybe_signal_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return nal;
|
return nal;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ ControlSet::ControlSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlSet::ControlSet (const ControlSet&)
|
ControlSet::ControlSet (const ControlSet&)
|
||||||
: noncopyable ()
|
: noncopyable ()
|
||||||
{
|
{
|
||||||
/* derived class must copy controls */
|
/* derived class must copy controls */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -47,7 +47,7 @@ ControlSet::add_control(boost::shared_ptr<Control> ac)
|
||||||
|
|
||||||
ac->list()->InterpolationChanged.connect_same_thread (
|
ac->list()->InterpolationChanged.connect_same_thread (
|
||||||
_list_connections, boost::bind (&ControlSet::control_list_interpolation_changed, this, ac->parameter(), _1)
|
_list_connections, boost::bind (&ControlSet::control_list_interpolation_changed, this, ac->parameter(), _1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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();
|
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;
|
ControlList::const_iterator i;
|
||||||
boost::shared_ptr<const ControlList> alist (li->second->list());
|
boost::shared_ptr<const ControlList> alist (li->second->list());
|
||||||
ControlEvent cp (now, 0.0f);
|
ControlEvent cp (now, 0.0f);
|
||||||
|
|
||||||
for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator);
|
for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator);
|
||||||
i != alist->end() && (*i)->when < end; ++i) {
|
i != alist->end() && (*i)->when < end; ++i) {
|
||||||
if ((*i)->when > now) {
|
if ((*i)->when > now) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != alist->end() && (*i)->when < end) {
|
if (i != alist->end() && (*i)->when < end) {
|
||||||
if ((*i)->when < next_event.when) {
|
if ((*i)->when < next_event.when) {
|
||||||
next_event.when = (*i)->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
|
void
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Evoral {
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
Note<Time>::Note(uint8_t chan, Time t, Time l, uint8_t n, uint8_t v)
|
Note<Time>::Note(uint8_t chan, Time t, Time l, uint8_t n, uint8_t v)
|
||||||
// FIXME: types?
|
// FIXME: types?
|
||||||
: _on_event (0xDE, t, 3, NULL, true)
|
: _on_event (0xDE, t, 3, NULL, true)
|
||||||
, _off_event (0xAD, t + l, 3, NULL, true)
|
, _off_event (0xAD, t + l, 3, NULL, true)
|
||||||
{
|
{
|
||||||
assert(chan < 16);
|
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>
|
template<typename Time>
|
||||||
Note<Time>::Note(const Note<Time>& copy)
|
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)
|
, _off_event(copy._off_event, true)
|
||||||
{
|
{
|
||||||
set_id (copy.id());
|
set_id (copy.id());
|
||||||
|
|
||||||
assert(_on_event.buffer());
|
assert(_on_event.buffer());
|
||||||
assert(_off_event.buffer());
|
assert(_off_event.buffer());
|
||||||
/*
|
/*
|
||||||
assert(copy._on_event.size == 3);
|
assert(copy._on_event.size == 3);
|
||||||
_on_event.buffer = _on_event_buffer;
|
_on_event.buffer = _on_event_buffer;
|
||||||
memcpy(_on_event_buffer, copy._on_event_buffer, 3);
|
memcpy(_on_event_buffer, copy._on_event_buffer, 3);
|
||||||
|
|
||||||
assert(copy._off_event.size == 3);
|
assert(copy._off_event.size == 3);
|
||||||
_off_event.buffer = _off_event_buffer;
|
_off_event.buffer = _off_event_buffer;
|
||||||
memcpy(_off_event_buffer, copy._off_event_buffer, 3);
|
memcpy(_off_event_buffer, copy._off_event_buffer, 3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assert(time() == copy.time());
|
assert(time() == copy.time());
|
||||||
|
|
@ -84,8 +84,8 @@ Note<Time>::~Note()
|
||||||
template<typename Time> void
|
template<typename Time> void
|
||||||
Note<Time>::set_id (event_id_t id)
|
Note<Time>::set_id (event_id_t id)
|
||||||
{
|
{
|
||||||
_on_event.set_id (id);
|
_on_event.set_id (id);
|
||||||
_off_event.set_id (id);
|
_off_event.set_id (id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
|
|
|
||||||
|
|
@ -88,14 +88,14 @@ SMF::open(const std::string& path, int track) THROW_FILE_ERROR
|
||||||
if (f == 0) {
|
if (f == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_smf = smf_load (f)) == 0) {
|
if ((_smf = smf_load (f)) == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_smf_track = smf_get_track_by_number(_smf, track)) == 0) {
|
if ((_smf_track = smf_get_track_by_number(_smf, track)) == 0) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//cerr << "Track " << track << " # events: " << _smf_track->number_of_events << endl;
|
//cerr << "Track " << track << " # events: " << _smf_track->number_of_events << endl;
|
||||||
if (_smf_track->number_of_events == 0) {
|
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();
|
_smf = smf_new();
|
||||||
|
|
||||||
if (_smf == NULL) {
|
if (_smf == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smf_set_ppqn(_smf, ppqn) != 0) {
|
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;
|
_smf_track->next_event_number = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
/* put a stub file on disk */
|
/* put a stub file on disk */
|
||||||
|
|
||||||
PBD::StdioFileDescriptor d (_file_path, "w+");
|
PBD::StdioFileDescriptor d (_file_path, "w+");
|
||||||
FILE* f = d.allocate ();
|
FILE* f = d.allocate ();
|
||||||
if (f == 0) {
|
if (f == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smf_save (_smf, f)) {
|
if (smf_save (_smf, f)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_empty = true;
|
_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(delta_t);
|
||||||
assert(size);
|
assert(size);
|
||||||
assert(buf);
|
assert(buf);
|
||||||
assert(note_id);
|
assert(note_id);
|
||||||
|
|
||||||
if ((event = smf_track_get_next_event(_smf_track)) != NULL) {
|
if ((event = smf_track_get_next_event(_smf_track)) != NULL) {
|
||||||
|
|
||||||
*delta_t = event->delta_time_pulses;
|
*delta_t = event->delta_time_pulses;
|
||||||
|
|
||||||
if (smf_event_is_metadata(event)) {
|
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 evsize;
|
||||||
uint32_t lenlen;
|
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
|
if (event->midi_buffer[2+lenlen] == 0x99 && // Evoral
|
||||||
event->midi_buffer[3+lenlen] == 0x1) { // Evoral Note ID
|
event->midi_buffer[3+lenlen] == 0x1) { // Evoral Note ID
|
||||||
|
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t idlen;
|
uint32_t idlen;
|
||||||
|
|
||||||
if (smf_extract_vlq (&event->midi_buffer[4+lenlen], event->midi_buffer_length-(4+lenlen), &id, &idlen) == 0) {
|
if (smf_extract_vlq (&event->midi_buffer[4+lenlen], event->midi_buffer_length-(4+lenlen), &id, &idlen) == 0) {
|
||||||
*note_id = id;
|
*note_id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; /* this is a meta-event */
|
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));
|
assert(midi_event_is_valid(*buf, *size));
|
||||||
|
|
||||||
/* printf("SMF::read_event @ %u: ", *delta_t);
|
/* printf("SMF::read_event @ %u: ", *delta_t);
|
||||||
for (size_t i = 0; i < *size; ++i) {
|
for (size_t i = 0; i < *size; ++i) {
|
||||||
printf("%X ", (*buf)[i]);
|
printf("%X ", (*buf)[i]);
|
||||||
} printf("\n") */
|
} printf("\n") */
|
||||||
|
|
||||||
return event_size;
|
return event_size;
|
||||||
} else {
|
} 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);
|
/* printf("SMF::append_event_delta @ %u:", delta_t);
|
||||||
for (size_t i = 0; i < size; ++i) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
printf("%X ", buf[i]);
|
printf("%X ", buf[i]);
|
||||||
} printf("\n"); */
|
} printf("\n"); */
|
||||||
|
|
||||||
if (!midi_event_is_valid(buf, size)) {
|
if (!midi_event_is_valid(buf, size)) {
|
||||||
cerr << "WARNING: SMF ignoring illegal MIDI event" << endl;
|
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;
|
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;
|
uint8_t const c = buf[0] & 0xf0;
|
||||||
bool const store_id = (
|
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_NOTE_OFF ||
|
||||||
c == MIDI_CMD_PGM_CHANGE ||
|
c == MIDI_CMD_PGM_CHANGE ||
|
||||||
(c == MIDI_CMD_CONTROL && (buf[1] == MIDI_CTL_MSB_BANK || buf[1] == MIDI_CTL_LSB_BANK))
|
(c == MIDI_CMD_CONTROL && (buf[1] == MIDI_CTL_MSB_BANK || buf[1] == MIDI_CTL_LSB_BANK))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (store_id && note_id >= 0) {
|
if (store_id && note_id >= 0) {
|
||||||
int idlen;
|
int idlen;
|
||||||
int lenlen;
|
int lenlen;
|
||||||
uint8_t idbuf[16];
|
uint8_t idbuf[16];
|
||||||
uint8_t lenbuf[16];
|
uint8_t lenbuf[16];
|
||||||
|
|
||||||
event = smf_event_new ();
|
event = smf_event_new ();
|
||||||
assert(event != NULL);
|
assert(event != NULL);
|
||||||
|
|
||||||
/* generate VLQ representation of note ID */
|
/* generate VLQ representation of note ID */
|
||||||
idlen = smf_format_vlq (idbuf, sizeof(idbuf), note_id);
|
idlen = smf_format_vlq (idbuf, sizeof(idbuf), note_id);
|
||||||
|
|
||||||
/* generate VLQ representation of meta event length,
|
/* generate VLQ representation of meta event length,
|
||||||
which is the idlen + 2 bytes (Evoral type ID plus Note ID type)
|
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
|
/* this should be allocated by malloc(3) because libsmf will
|
||||||
call free(3) on it
|
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[0] = 0xff; // Meta-event
|
||||||
event->midi_buffer[1] = 0x7f; // Sequencer-specific
|
event->midi_buffer[1] = 0x7f; // Sequencer-specific
|
||||||
memcpy (&event->midi_buffer[2], lenbuf, lenlen);
|
memcpy (&event->midi_buffer[2], lenbuf, lenlen);
|
||||||
event->midi_buffer[2+lenlen] = 0x99; // Evoral type ID
|
event->midi_buffer[2+lenlen] = 0x99; // Evoral type ID
|
||||||
event->midi_buffer[3+lenlen] = 0x1; // Evoral type Note ID
|
event->midi_buffer[3+lenlen] = 0x1; // Evoral type Note ID
|
||||||
memcpy (&event->midi_buffer[4+lenlen], idbuf, idlen);
|
memcpy (&event->midi_buffer[4+lenlen], idbuf, idlen);
|
||||||
|
|
||||||
assert(_smf_track);
|
assert(_smf_track);
|
||||||
smf_track_add_event_delta_pulses(_smf_track, event, 0);
|
smf_track_add_event_delta_pulses(_smf_track, event, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
event = smf_event_new_from_pointer(buf, size);
|
event = smf_event_new_from_pointer(buf, size);
|
||||||
assert(event != NULL);
|
assert(event != NULL);
|
||||||
|
|
@ -373,7 +373,7 @@ SMF::round_to_file_precision (double val) const
|
||||||
void
|
void
|
||||||
SMF::set_path (const std::string& p)
|
SMF::set_path (const std::string& p)
|
||||||
{
|
{
|
||||||
_file_path = p;
|
_file_path = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Evoral
|
} // namespace Evoral
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -251,7 +251,7 @@ smf_event_new_from_pointer(const void *midi_data, size_t len)
|
||||||
g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
|
g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
|
||||||
smf_event_delete(event);
|
smf_event_delete(event);
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(event->midi_buffer, midi_data, len);
|
memcpy(event->midi_buffer, midi_data, len);
|
||||||
|
|
@ -269,7 +269,7 @@ smf_event_new_from_pointer(const void *midi_data, size_t len)
|
||||||
* like this:
|
* like this:
|
||||||
*
|
*
|
||||||
* smf_event_new_from_bytes(0xC0, 0x42, -1);
|
* smf_event_new_from_bytes(0xC0, 0x42, -1);
|
||||||
*
|
*
|
||||||
* \param first_byte First byte of MIDI message. Must be valid status byte.
|
* \param first_byte First byte of MIDI message. Must be valid status byte.
|
||||||
* \param second_byte Second byte of MIDI message or -1, if message is one byte long.
|
* \param second_byte Second byte of MIDI message or -1, if message is one byte long.
|
||||||
* \param third_byte Third byte of MIDI message or -1, if message is two bytes long.
|
* \param third_byte Third byte of MIDI message or -1, if message is two bytes long.
|
||||||
|
|
@ -341,7 +341,7 @@ smf_event_new_from_bytes(int first_byte, int second_byte, int third_byte)
|
||||||
g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
|
g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
|
||||||
smf_event_delete(event);
|
smf_event_delete(event);
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
event->midi_buffer[0] = first_byte;
|
event->midi_buffer[0] = first_byte;
|
||||||
|
|
@ -378,7 +378,7 @@ static gint
|
||||||
events_array_compare_function(gconstpointer aa, gconstpointer bb)
|
events_array_compare_function(gconstpointer aa, gconstpointer bb)
|
||||||
{
|
{
|
||||||
smf_event_t *a, *b;
|
smf_event_t *a, *b;
|
||||||
|
|
||||||
/* "The comparison function for g_ptr_array_sort() doesn't take the pointers
|
/* "The comparison function for g_ptr_array_sort() doesn't take the pointers
|
||||||
from the array as arguments, it takes pointers to the pointers in the array." */
|
from the array as arguments, it takes pointers to the pointers in the array." */
|
||||||
a = (smf_event_t *)*(gpointer *)aa;
|
a = (smf_event_t *)*(gpointer *)aa;
|
||||||
|
|
@ -790,7 +790,7 @@ smf_track_get_last_event(const smf_track_t *track)
|
||||||
|
|
||||||
if (track->number_of_events == 0)
|
if (track->number_of_events == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
event = smf_track_get_event_by_number(track, track->number_of_events);
|
event = smf_track_get_event_by_number(track, track->number_of_events);
|
||||||
|
|
||||||
return (event);
|
return (event);
|
||||||
|
|
@ -845,7 +845,7 @@ smf_get_next_event(smf_t *smf)
|
||||||
}
|
}
|
||||||
|
|
||||||
event = smf_track_get_next_event(track);
|
event = smf_track_get_next_event(track);
|
||||||
|
|
||||||
assert(event != NULL);
|
assert(event != NULL);
|
||||||
|
|
||||||
event->track->smf->last_seek_position = -1.0;
|
event->track->smf->last_seek_position = -1.0;
|
||||||
|
|
@ -884,7 +884,7 @@ smf_peek_next_event(smf_t *smf)
|
||||||
}
|
}
|
||||||
|
|
||||||
event = smf_peek_next_event_from_track(track);
|
event = smf_peek_next_event_from_track(track);
|
||||||
|
|
||||||
assert(event != NULL);
|
assert(event != NULL);
|
||||||
|
|
||||||
return (event);
|
return (event);
|
||||||
|
|
@ -950,7 +950,7 @@ smf_seek_to_event(smf_t *smf, const smf_event_t *target)
|
||||||
smf_skip_next_event(smf);
|
smf_skip_next_event(smf);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
smf->last_seek_position = event->time_seconds;
|
smf->last_seek_position = event->time_seconds;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,20 +12,20 @@ main()
|
||||||
{
|
{
|
||||||
Glib::thread_init();
|
Glib::thread_init();
|
||||||
|
|
||||||
CppUnit::TestResult testresult;
|
CppUnit::TestResult testresult;
|
||||||
|
|
||||||
CppUnit::TestResultCollector collectedresults;
|
CppUnit::TestResultCollector collectedresults;
|
||||||
testresult.addListener (&collectedresults);
|
testresult.addListener (&collectedresults);
|
||||||
|
|
||||||
CppUnit::BriefTestProgressListener progress;
|
CppUnit::BriefTestProgressListener progress;
|
||||||
testresult.addListener (&progress);
|
testresult.addListener (&progress);
|
||||||
|
|
||||||
CppUnit::TestRunner testrunner;
|
CppUnit::TestRunner testrunner;
|
||||||
testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ());
|
testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ());
|
||||||
testrunner.run (testresult);
|
testrunner.run (testresult);
|
||||||
|
|
||||||
CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
|
CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
|
||||||
compileroutputter.write ();
|
compileroutputter.write ();
|
||||||
|
|
||||||
return collectedresults.wasSuccessful () ? 0 : 1;
|
return collectedresults.wasSuccessful () ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue