diff --git a/ChangeLog b/ChangeLog index 0cdadee9c..a39f4a3ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-24 Andrew Kelley + + * src/core/basic_ops.cpp: + * include/note.h: + * include/pattern.h: + * src/tracks/pattern.cpp: + fixed piano roll not playing notes glitch + 2008-11-24 Tobias Doerffel * src/core/basic_ops.cpp: diff --git a/include/note.h b/include/note.h index e126712c8..50b6f0520 100644 --- a/include/note.h +++ b/include/note.h @@ -100,11 +100,13 @@ public: void quantizeLength( const int _q_grid ); void quantizePos( const int _q_grid ); - inline bool operator<(const note & rhs) + static inline bool lessThan(note * &lhs, note * &rhs) { - return m_pos < rhs.pos(); + // function to compare two notes - must be called explictly when + // using qSort + return (bool) ((int) ( *lhs ).pos() < (int) ( *rhs ).pos()); } - + inline bool getSelected( void ) const { return m_selected; diff --git a/include/pattern.h b/include/pattern.h index d256e90a4..cb75581ae 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -133,6 +133,10 @@ public: using model::dataChanged; + + + void printNotes( void ); // for debugging purposes + protected: diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index c6ff2c064..d6f4a141f 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -34,6 +34,8 @@ #include #include #include +#include + #include "pattern.h" @@ -96,8 +98,6 @@ pattern::pattern( const pattern & _pat_to_copy ) : } - - pattern::~pattern() { for( noteVector::iterator it = m_notes.begin(); @@ -183,6 +183,17 @@ midiTime pattern::beatPatternLength( void ) const +void pattern::printNotes( void ) +{ + for( noteVector::iterator it = m_notes.begin(); it != m_notes.end(); + ++it ) + { + printf("note (pos = %i)\n", (int) ( *it )->pos() ); + } + printf("\n"); +} + + note * pattern::addNote( const note & _new_note, const bool _quant_pos ) { @@ -270,17 +281,14 @@ note * pattern::rearrangeNote( const note * _note_to_proc, - void pattern::rearrangeAllNotes( void ) { // sort notes by start time - qSort(m_notes.begin(), m_notes.end()); - + qSort(m_notes.begin(), m_notes.end(), note::lessThan ); } - void pattern::clearNotes( void ) { engine::getMixer()->lock();