Fix broken whitespace via merciless application of the emacs hammer.
authorDavid Robillard <d@drobilla.net>
Wed, 23 Nov 2011 00:17:31 +0000 (00:17 +0000)
committerDavid Robillard <d@drobilla.net>
Wed, 23 Nov 2011 00:17:31 +0000 (00:17 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10782 d708f5d6-7413-0410-9779-e7cbd77b26cf

16 files changed:
libs/evoral/evoral/ControlList.hpp
libs/evoral/evoral/EventRingBuffer.hpp
libs/evoral/evoral/Parameter.hpp
libs/evoral/evoral/PatchChange.hpp
libs/evoral/evoral/SMF.hpp
libs/evoral/evoral/Sequence.hpp
libs/evoral/evoral/TimeConverter.hpp
libs/evoral/evoral/types.hpp
libs/evoral/run-tests.sh
libs/evoral/src/ControlList.cpp
libs/evoral/src/ControlSet.cpp
libs/evoral/src/Note.cpp
libs/evoral/src/SMF.cpp
libs/evoral/src/Sequence.cpp
libs/evoral/src/libsmf/smf.c
libs/evoral/test/testrunner.cpp

index 87f214a60155d8ab703347e017f7b19f665b11b9..792de036a61bc76092e5dc1b0e60500875dd0c21 100644 (file)
@@ -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);
@@ -246,7 +246,7 @@ public:
        mutable PBD::Signal0<void> Dirty;
        /** Emitted when our interpolation style changes */
        PBD::Signal1<void, InterpolationStyle> InterpolationChanged;
-       
+
 protected:
 
        /** Called by unlocked_eval() to handle cases of 3 or more control points. */
@@ -282,13 +282,13 @@ protected:
                EventList events;
                double start_time;
                double end_time;
-            
+
                NascentInfo (double start = -1.0)
                        : start_time (start)
-                       , end_time (-1.0) 
-                       {}
+                       , end_time (-1.0)
+               {}
        };
-    
+
        std::list<NascentInfo*> nascent;
 };
 
index cc58d27bed67008108bf07f3be42de6fd8370c00..11d487f778e3a330f568351749e9f797a73f3b55 100644 (file)
@@ -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;
        }
 }
index e81870f6eaf3bb2cbec066eb795f5fe358c706c4..7142574dbd8b6f9cb600b55e58a86d5e4f3558f7 100644 (file)
@@ -1,4 +1,3 @@
-
 /* This file is part of Evoral.
  * Copyright (C) 2008 David Robillard <http://drobilla.net>
  * Copyright (C) 2000-2008 Paul Davis
@@ -95,7 +94,7 @@ public:
        inline void set_range(double min, double max, double normal, bool toggled) {
                _metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal, toggled));
        }
-    
+
        inline Metadata& metadata() const {
                if (_metadata)
                        return *_metadata.get();
index aaa481516fee4fb5c3bed80f4eae6606e5090747..82e20239417d6cb094f38911168d63d388fb8a55 100644 (file)
@@ -1,20 +1,20 @@
 /*
-    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 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.
+  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 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.
 */
 
 #ifndef EVORAL_PATCH_CHANGE_HPP
@@ -28,7 +28,7 @@ namespace Evoral {
 /** Event representing a `patch change', composed of a LSB and MSB
  *  bank select and then a program change.
  */
-template<typename Time>        
+template<typename Time>
 class PatchChange
 {
 public:
@@ -49,7 +49,7 @@ public:
                _bank_change_lsb.buffer()[0] = MIDI_CMD_CONTROL | c;
                _bank_change_lsb.buffer()[1] = MIDI_CTL_LSB_BANK;
                _bank_change_lsb.buffer()[2] = b & 0x7f;
-               
+
                _program_change.buffer()[0] = MIDI_CMD_PGM_CHANGE | c;
                _program_change.buffer()[1] = p;
        }
@@ -65,7 +65,7 @@ public:
        event_id_t id () const {
                return _program_change.id ();
        }
-       
+
        void set_id (event_id_t id) {
                _bank_change_msb.set_id (id);
                _bank_change_lsb.set_id (id);
@@ -98,7 +98,7 @@ public:
        void set_program (uint8_t p) {
                _program_change.buffer()[1] = p;
        }
-       
+
        int bank () const {
                return (bank_msb() << 7) | bank_lsb();
        }
@@ -115,14 +115,14 @@ public:
        uint8_t bank_lsb () const {
                return _bank_change_lsb.buffer()[2];
        }
-       
+
        uint8_t channel () const { return _program_change.buffer()[0] & 0xf; }
 
        inline bool operator< (const PatchChange<Time>& o) const {
                if (time() != o.time()) {
                        return time() < o.time();
                }
-               
+
                if (bank != o.bank()) {
                        return bank() < o.bank();
                }
@@ -164,5 +164,5 @@ private:
 };
 
 }
-       
+
 #endif
index 063ae69f095a378b76332fe80f75d6abe50559ce..67ea42fe7d31529c6d784b03194bce4459b4b6c0 100644 (file)
@@ -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;
index 9f12de292adbe84014d92928c9bf6fb503469cb8..6c859d03208c3aa41f7abe83af23b3ea77ae4b9d 100644 (file)
@@ -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);
 
@@ -150,7 +150,7 @@ public:
        inline       Notes& notes()       { return _notes; }
        inline const Notes& notes() const { return _notes; }
 
-       enum NoteOperator { 
+       enum NoteOperator {
                PitchEqual,
                PitchLessThan,
                PitchLessThanOrEqual,
@@ -169,7 +169,7 @@ public:
        void trim_overlapping_notes ();
        void remove_duplicate_notes ();
 
-       enum OverlapPitchResolution { 
+       enum OverlapPitchResolution {
                LastOnFirstOff,
                FirstOnFirstOff
        };
@@ -187,7 +187,7 @@ public:
 
        typedef boost::shared_ptr<PatchChange<Time> > PatchChangePtr;
        typedef boost::shared_ptr<const PatchChange<Time> > constPatchChangePtr;
-       
+
        struct EarlierPatchChangeComparator {
                inline bool operator() (constPatchChangePtr a, constPatchChangePtr b) const {
                        return a->time() < b->time();
@@ -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;
@@ -257,7 +257,7 @@ public:
                std::set<Evoral::Parameter> const & f = std::set<Evoral::Parameter> ()) const {
                return const_iterator (*this, t, force_discrete, f);
        }
-       
+
        const const_iterator& end() const { return _end_iter; }
 
        typename Notes::const_iterator note_lower_bound (Time t) const;
@@ -269,7 +269,7 @@ public:
        bool edited() const      { return _edited; }
        void set_edited(bool yn) { _edited = yn; }
 
-       bool overlaps (const NotePtr& ev, 
+       bool overlaps (const NotePtr& ev,
                       const NotePtr& ignore_this_note) const;
        bool contains (const NotePtr& ev) const;
 
index 5fcfbfcf2b79e253b8eb575b04b4256ccc6fafc9..3f30570905d558ed4d93ee803decab9152ea8aeb 100644 (file)
@@ -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); }
 };
index e09e276b9a04027d06da2ba0b7668b818f51c332..c3cb6a9c21bc18c127fb75ec332b02291c16cdaf 100644 (file)
@@ -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 */
index eb6375a03b19fd93f51eb96273e748cbd3d1f8a6..35531a613e10c4561f13a71bfcc7e13fde33aa61 100755 (executable)
@@ -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
index 6e428144a99cf88b98b5c6cd951d7e2627f79ca5..222f72958f90650b2a8fc4dc11cdac8c67907853 100644 (file)
@@ -107,11 +107,11 @@ ControlList::~ControlList()
        for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
                delete (*x);
        }
-        
+
        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);
        }
 
@@ -207,7 +207,7 @@ ControlList::extend_to (double when)
        return true;
 }
 
-void 
+void
 ControlList::_x_scale (double factor)
 {
        for (iterator i = _events.begin(); i != _events.end(); ++i) {
@@ -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->end_time < 0.0) {
-                                ninfo->end_time = when;
-                        }
-
-                        bool preexisting = !_events.empty();
-
-                        if (!preexisting) {
-                                
-                                _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());
-                                
-                        } 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());
-                                
-                        } 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;
-                                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;
-                                                }
-                                        }
-                                }
+
+                       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 (!preexisting) {
+
+                               _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());
+
+                       } 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());
+
+                       } 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;
+                               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:
                                   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
                                   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_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);
-                        }
-
-                        delete ninfo;
-                }
-
-                nascent.clear ();
-
-                if (writing()) {
-                        nascent.push_back (new NascentInfo ());
-                }
-        }
-
-        maybe_signal_changed ();
+
+                               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_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);
+                       }
+
+                       delete ninfo;
+               }
+
+               nascent.clear ();
+
+               if (writing()) {
+                       nascent.push_back (new NascentInfo ());
+               }
+       }
+
+       maybe_signal_changed ();
 }
 
 void
 ControlList::rt_add (double when, double value)
 {
-        // this is for automation recording 
-        
-        if (touch_enabled() && !touching()) {
-                return;
-        }
+       // this is for automation recording
+
+       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);
@@ -483,7 +483,7 @@ ControlList::erase (double when, double value)
                if (i != end ()) {
                        _events.erase (i);
                }
-               
+
                mark_dirty ();
        }
 
@@ -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,43 +1281,43 @@ 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".
-                */
 
-                double end_value = unlocked_eval (end);
+               /* before we begin any cut/clear operations, get the value of the curve
+                  at "end".
+               */
+
+               double end_value = unlocked_eval (end);
 
-                if ((*s)->when != start) {
-                        
-                        double val = unlocked_eval (start);
+               if ((*s)->when != start) {
+
+                       double val = unlocked_eval (start);
 
                        if (op == 0) { // cut
                                if (start > _events.front()->when) {
                                        _events.insert (s, (new ControlEvent (start, val)));
                                }
                        }
-                        
-                        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; ) {
 
                        /* adjust new points to be relative to start, which
                           has been set to zero.
                        */
-                       
+
                        if (op != 2) {
                                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) {
                                x = _events.erase (x);
                        } else {
-                                ++x;
-                        }
+                               ++x;
+                       }
                }
-                
-                if (e == _events.end() || (*e)->when != end) {
 
-                        /* only add a boundary point if there is a point after "end"
-                         */
+               if (e == _events.end() || (*e)->when != end) {
 
-                        if (op == 0 && (e != _events.end() && end < (*e)->when)) { // cut
-                                _events.insert (e, new ControlEvent (end, end_value));
-                        }
+                       /* 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));
-                        }
+                       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;
 }
index bdc73121d246cbcb568f11c67d6bc351b9ef7597..d4480c2897859d048eb3d014ef68c16ba0ffe038 100644 (file)
@@ -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;
-                       }
-               }
-
-               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();
+               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;
+                       }
+               }
+       }
+
+       return next_event.when != std::numeric_limits<double>::max();
 }
 
 void
index 49af0fa9e6ec36a739a1be9026ae2b8b78bad8c2..01820b70e7210526b6642fe4a719a72b41f65004 100644 (file)
@@ -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>
index a9b71726925414f344d91ce0925a69613116f827..ffc21a947f4034b9ef3935fb19788a6a92a5818b 100644 (file)
@@ -88,14 +88,14 @@ SMF::open(const std::string& path, int track) THROW_FILE_ERROR
        if (f == 0) {
                return -1;
        }
-       
+
        if ((_smf = smf_load (f)) == 0) {
                return -1;
        }
 
        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 */
-
-                        if (event->midi_buffer[1] == 0x7f) { // Sequencer-specific
-
-                                uint32_t evsize;
-                                uint32_t lenlen;
-                                
-                                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
-                                                
-                                                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;
-                                                }
-                                        }
-                                }
-                        }
+                       *note_id = -1; // "no note id in this meta-event */
+
+                       if (event->midi_buffer[1] == 0x7f) { // Sequencer-specific
+
+                               uint32_t evsize;
+                               uint32_t lenlen;
+
+                               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
+
+                                               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;
+                                               }
+                                       }
+                               }
+                       }
                        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
index 1001898a7cbf32aaeb60a3c74df8e8119721b959..a3e0afd2d1d2c6f8d5c69713cb9bcecbb7c5a259 100644 (file)
@@ -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;
@@ -117,7 +117,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
                        /* this parameter is filtered, so don't bother setting up an iterator for it */
                        continue;
                }
-               
+
                DEBUG_TRACE (DEBUG::Sequence, string_compose ("Iterator: control: %1\n", seq._type_map.to_symbol(i->first)));
                double x, y;
                bool ret;
@@ -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,10 +216,10 @@ 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;
-                       
-                        if ((*n)->length() == 0) {
+               for (typename Notes::iterator n = _notes.begin(); n != _notes.end() ;) {
+                       typename Notes::iterator next = n;
+                       ++next;
+
+                       if ((*n)->length() == 0) {
                                switch (option) {
                                case Relax:
                                        break;
@@ -652,7 +652,7 @@ Sequence<Time>::end_write (StuckNoteOption option, Time when)
                                        break;
                                case ResolveStuckNotes:
                                        if (when <= (*n)->time()) {
-                                               cerr << "WARNING: Stuck note resolution - end time @ " 
+                                               cerr << "WARNING: Stuck note resolution - end time @ "
                                                     << when << " is before note on: " << (**n) << endl;
                                                _notes.erase (*n);
                                        } else {
@@ -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,8 +699,8 @@ 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;
 
        return 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;
 
@@ -725,49 +725,49 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
                if (*i == 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()));
-        
-        NotePtr search_note(new Note<Time>(0, 0, 0, note->note(), 0));
+       Pitches& p (pitches (note->channel()));
 
-        typename Pitches::iterator j = p.lower_bound (search_note);
+       NotePtr search_note(new Note<Time>(0, 0, 0, note->note(), 0));
+
+       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());
-
-        const MIDIEvent<Time>& ev = (const MIDIEvent<Time>&)event;
-
-        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 (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);
+       WriteLock lock(write_lock());
+
+       const MIDIEvent<Time>& ev = (const MIDIEvent<Time>&)event;
+
+       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 (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());
-        }
-
-        _edited = true;
+       } 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;
 }
 
 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->velocity() == 0) {
-                append_note_off_unlocked (note);
-                return;
-        }
-
-        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 (note->id() < 0) {
+               note->set_id (evid);
+       }
+
+       if (note->velocity() == 0) {
+               append_note_off_unlocked (note);
+               return;
+       }
+
+       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");
+       }
 }
 
 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());
 
-                        nn->set_length (note->time() - nn->time());
-                        nn->set_off_velocity (note->velocity());
+               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());
 
-                        _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>
@@ -1002,11 +1002,11 @@ void
 Sequence<Time>::append_patch_change_unlocked (const PatchChange<Time>& ev, event_id_t id)
 {
        PatchChangePtr p (new PatchChange<Time> (ev));
-       
+
        if (p->id() < 0) {
                p->set_id (id);
        }
-       
+
        _patch_changes.insert (p);
 }
 
@@ -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();
-         
-        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) {
-
-                if (without && (**i) == *without) {
-                        continue;
-                }
-
-                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;
-                }
-        }
-
-        return false;
+       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()));
+
+       for (typename Pitches::const_iterator i = p.lower_bound (search_note);
+            i != p.end() && (*i)->note() == note->note(); ++i) {
+
+               if (without && (**i) == *without) {
+                       continue;
+               }
+
+               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;
+               }
+       }
+
+       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;
-                
-        case VelocityEqual:
-        case VelocityLessThan:
-        case VelocityLessThanOrEqual:
-        case VelocityGreater:
-        case VelocityGreaterThanOrEqual:
-                get_notes_by_velocity (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;
+       }
 }
 
 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) {
-
-                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;
-                        
-                default:
-                        //fatal << string_compose (_("programming error: %1 %2", X_("get_notes_by_pitch() called with illegal operator"), op)) << endmsg;
-                        abort ();
-                        /* NOTREACHED*/
-                }
-        }
+       for (uint8_t c = 0; c < 16; ++c) {
+
+               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;
+
+               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());
-        
-        for (typename Notes::const_iterator i = _notes.begin(); i != _notes.end(); ++i) {
-
-                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*/
-
-                }
-        }
+       ReadLock lock (read_lock());
+
+       for (typename Notes::const_iterator i = _notes.begin(); i != _notes.end(); ++i) {
+
+               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*/
+
+               }
+       }
 }
 
 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>
index 7bd75b10148cf4786fec41c7c571da619229a59a..d62dc6d7eb30000a107f5fccf44e9713c3c3c7cf 100644 (file)
@@ -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));
                smf_event_delete(event);
 
-               return (NULL); 
+               return (NULL);
        }
 
        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:
  *
  * smf_event_new_from_bytes(0xC0, 0x42, -1);
- * 
+ *
  * \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 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));
                smf_event_delete(event);
 
-               return (NULL); 
+               return (NULL);
        }
 
        event->midi_buffer[0] = first_byte;
@@ -378,7 +378,7 @@ static gint
 events_array_compare_function(gconstpointer aa, gconstpointer bb)
 {
        smf_event_t *a, *b;
-       
+
        /* "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." */
        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)
                return (NULL);
-       
+
        event = smf_track_get_event_by_number(track, track->number_of_events);
 
        return (event);
@@ -845,7 +845,7 @@ smf_get_next_event(smf_t *smf)
        }
 
        event = smf_track_get_next_event(track);
-       
+
        assert(event != NULL);
 
        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);
-       
+
        assert(event != NULL);
 
        return (event);
@@ -950,7 +950,7 @@ smf_seek_to_event(smf_t *smf, const smf_event_t *target)
                        smf_skip_next_event(smf);
                else
                        break;
-       }       
+       }
 
        smf->last_seek_position = event->time_seconds;
 
index f1cbaecf5ab81742ff5b085b5d9aac2cc5294427..b1c63172c411dd0bb6f42e92c3ead32f37258ff9 100644 (file)
@@ -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;
 }