fixed piano roll notes not playing glitch - pattern::rearrangeAllNotes failed to sort notes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1852 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Andrew Kelley
2008-11-25 01:25:25 +00:00
parent 59544b109e
commit 103b4c8e7d
4 changed files with 31 additions and 9 deletions

View File

@@ -1,3 +1,11 @@
2008-11-24 Andrew Kelley <superjoe30/at/gmail/dot/com>
* 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 <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/basic_ops.cpp:

View File

@@ -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;

View File

@@ -133,6 +133,10 @@ public:
using model::dataChanged;
void printNotes( void ); // for debugging purposes
protected:

View File

@@ -34,6 +34,8 @@
#include <QtGui/QPainter>
#include <QtGui/QProgressBar>
#include <QtGui/QPushButton>
#include <QtAlgorithms>
#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();