coding style fixes, improved handling of shared detuningHelper object (stable backport)

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2049 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2009-02-19 13:40:24 +00:00
parent c720c1f4c8
commit 4c93249aae
2 changed files with 32 additions and 20 deletions

View File

@@ -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 <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 );

View File

@@ -3,7 +3,7 @@
/*
* note.cpp - implementation of class note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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();
}