made rendering happen with one global working-buffer per thread - hopefully improves L1/L2-cache-efficiency

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@890 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-04-05 19:06:32 +00:00
parent 7f72593f06
commit c8c5382b35
38 changed files with 286 additions and 218 deletions

View File

@@ -43,6 +43,9 @@ public:
{
}
virtual void playNote( notePlayHandle *, bool, sampleFrame * )
{
}
virtual void saveSettings( QDomDocument &, QDomElement & )
{

View File

@@ -54,25 +54,26 @@ public:
// --------------------------------------------------------------------
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes it's
// play-handle and re-implement this method, so that it mixes its
// output buffer only once per mixer-period
virtual void play( bool _try_parallelizing = FALSE );
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
// to be overloaded by actual plugin
virtual void FASTCALL playNote( notePlayHandle * note_to_play,
bool _try_parallelizing );
// to be implemented by actual plugin
virtual void playNote( notePlayHandle * _note_to_play,
bool _try_parallelizing,
sampleFrame * _working_buf ) = 0;
// needed for deleting plugin-specific-data of a note - plugin has to
// cast void-ptr so that the plugin-data is deleted properly
// (call of dtor if it's a class etc.)
virtual void FASTCALL deleteNotePluginData( notePlayHandle *
_note_to_play );
virtual void deleteNotePluginData( notePlayHandle * _note_to_play );
// Get number of sample-frames that should be used when playing beat
// (note with unspecified length)
// Per default this function returns 0. In this case, channel is using
// the length of the longest envelope (if one active).
virtual f_cnt_t FASTCALL beatLen( notePlayHandle * _n ) const;
virtual f_cnt_t beatLen( notePlayHandle * _n ) const;
// some instruments need a certain number of release-frames even
@@ -91,6 +92,7 @@ public:
return( FALSE );
}
// instrument-play-handle-based instruments should return FALSE
inline virtual bool notePlayHandleBased( void ) const
{
return( TRUE );
@@ -111,7 +113,7 @@ public:
// instantiate instrument-plugin with given name or return NULL
// on failure
static instrument * FASTCALL instantiate( const QString & _plugin_name,
static instrument * instantiate( const QString & _plugin_name,
instrumentTrack * _instrument_track );
virtual bool isFromTrack( const track * _track ) const;

View File

@@ -44,9 +44,10 @@ public:
}
inline virtual void play( bool _try_parallelizing )
inline virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer )
{
m_instrument->play( _try_parallelizing );
m_instrument->play( _try_parallelizing, _working_buffer );
}
inline virtual bool done( void ) const

View File

@@ -85,7 +85,8 @@ public:
// for capturing note-play-events -> need that for arpeggio,
// filter and so on
void playNote( notePlayHandle * _n, bool _try_parallelizing );
void playNote( notePlayHandle * _n, bool _try_parallelizing,
sampleFrame * _working_buffer );
QString instrumentName( void ) const;
inline const instrument * getInstrument( void ) const

View File

@@ -38,7 +38,6 @@
#include "types.h"
#include "note.h"
#include "play_handle.h"
#include "fifo_buffer.h"
@@ -87,6 +86,9 @@ const Keys BaseKey = Key_A;
const Octaves BaseOctave = DefaultOctave;
#include "play_handle.h"
class mixerWorkerThread;
@@ -342,6 +344,8 @@ private:
fpp_t m_framesPerPeriod;
sampleFrame * m_workingBuf;
surroundSampleFrame * m_readBuf;
surroundSampleFrame * m_writeBuf;

View File

@@ -2,7 +2,7 @@
* note_play_handle.h - declaration of class notePlayHandle which is needed
* by LMMS-Play-Engine
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,7 +27,7 @@
#ifndef _NOTE_PLAY_HANDLE_H
#define _NOTE_PLAY_HANDLE_H
#include "play_handle.h"
#include "mixer.h"
#include "basic_filters.h"
#include "bb_track.h"
#include "note.h"
@@ -63,7 +63,8 @@ public:
void updateFrequency( void );
virtual void play( bool _try_parallelizing );
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual inline bool done( void ) const
{

View File

@@ -2,7 +2,7 @@
* play_handle.h - base-class playHandle which is needed by
* LMMS-Player-Engine
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -60,7 +60,8 @@ public:
return( m_type );
}
virtual void play( bool _try_parallelizing = FALSE ) = 0;
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer ) = 0;
virtual bool done( void ) const = 0;
// returns how many frames this play-handle is aligned ahead, i.e.

View File

@@ -2,7 +2,7 @@
* preset_preview_play_handle.h - play-handle for playing a short preview-sound
* of a preset
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -40,7 +40,8 @@ public:
presetPreviewPlayHandle( const QString & _preset_file );
virtual ~presetPreviewPlayHandle();
virtual void play( bool _try_parallelizing );
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual bool done( void ) const;
virtual bool isFromTrack( const track * _track ) const;

View File

@@ -1,7 +1,7 @@
/*
* sample_play_handle.h - play-handle for playing a sample
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,7 +28,7 @@
#include <qobject.h>
#include "play_handle.h"
#include "mixer.h"
#include "sample_buffer.h"
#include "automatable_model.h"
@@ -48,7 +48,8 @@ public:
samplePlayHandle( pattern * _pattern );
virtual ~samplePlayHandle();
virtual void play( bool _try_parallelizing );
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual bool done( void ) const;
virtual bool isFromTrack( const track * _track ) const;