diff --git a/include/note.h b/include/note.h index 9927bcc11..acfe6267e 100644 --- a/include/note.h +++ b/include/note.h @@ -2,7 +2,7 @@ * note.h - declaration of class note which contains all informations about a * note + definitions of several constants and enums * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -119,27 +119,27 @@ public: // using qSort return (bool) ((int) ( *lhs ).pos() < (int) ( *rhs ).pos()); } - + inline bool selected( void ) const { return m_selected; } - + inline int oldKey( void ) const { return m_oldKey; } - + inline midiTime oldPos( void ) const { return m_oldPos; } - + inline midiTime oldLength( void ) const { return m_oldLength; } - + inline bool isPlaying( void ) const { return m_isPlaying; @@ -153,12 +153,12 @@ public: inline const midiTime & length( void ) const { - return( m_length ); + return m_length; } inline const midiTime & pos( void ) const { - return( m_pos ); + return m_pos; } inline midiTime pos( midiTime _base_pos ) const @@ -169,34 +169,34 @@ public: inline int key( void ) const { - return( m_key ); + return m_key; } inline volume getVolume( void ) const { - return( m_volume ); + return m_volume; } inline panning getPanning( void ) const { - return( m_panning ); + return m_panning; } static QString classNodeName( void ) { - return( "note" ); + return "note"; } inline virtual QString nodeName( void ) const { - return( classNodeName() ); + return classNodeName(); } static midiTime quantized( const midiTime & _m, const int _q_grid ); detuningHelper * detuning( void ) const { - return( m_detuning ); + return m_detuning; } void editDetuningPattern( void ); diff --git a/src/core/note.cpp b/src/core/note.cpp index f37c32403..5f2f40f90 100644 --- a/src/core/note.cpp +++ b/src/core/note.cpp @@ -3,7 +3,7 @@ /* * note.cpp - implementation of class note * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -49,7 +49,8 @@ note::note( const midiTime & _length, const midiTime & _pos, m_volume( tLimit( _volume, MinVolume, MaxVolume ) ), m_panning( tLimit( _panning, PanningLeft, PanningRight ) ), m_length( _length ), - m_pos( _pos ) + m_pos( _pos ), + m_detuning( NULL ) { //saveJournallingState( FALSE ); // setJournalling( FALSE ); @@ -78,9 +79,17 @@ note::note( const note & _note ) : m_volume( _note.m_volume ), m_panning( _note.m_panning ), m_length( _note.m_length ), - m_pos( _note.m_pos ) + m_pos( _note.m_pos ), + m_detuning( NULL ) { - m_detuning = sharedObject::ref( _note.m_detuning ); + if( _note.m_detuning ) + { + m_detuning = sharedObject::ref( _note.m_detuning ); + } + else + { + createDetuning(); + } } @@ -88,7 +97,10 @@ note::note( const note & _note ) : note::~note() { - sharedObject::unref( m_detuning ); + if( m_detuning ) + { + sharedObject::unref( m_detuning ); + } } @@ -269,7 +281,7 @@ void note::createDetuning( void ) bool note::hasDetuningInfo( void ) const { - return( m_detuning && m_detuning->hasAutomation() ); + return m_detuning && m_detuning->hasAutomation(); }