introduced engine-technology

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@81 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-02-10 10:48:27 +00:00
parent 94d5107450
commit 5fd05b16e4
130 changed files with 2528 additions and 1260 deletions

View File

@@ -45,6 +45,7 @@
#include "settings.h"
#include "types.h"
#include "engine.h"
class QPixmap;
@@ -62,7 +63,8 @@ class tempoSyncKnob;
const int MAX_CHORD_POLYPHONY = 10;
class arpAndChordsTabWidget : public QWidget, public settings
class arpAndChordsTabWidget : public QWidget, public settings,
public engineObject
{
Q_OBJECT
public:

View File

@@ -51,8 +51,9 @@ class QLineEdit;
class audioALSA : public audioDevice, public QThread
{
public:
audioALSA( const sample_rate_t _sample_rate, bool & _success_ful );
~audioALSA();
audioALSA( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer );
virtual ~audioALSA();
inline static QString name( void )
{

View File

@@ -64,7 +64,7 @@ class audioDevice
{
public:
audioDevice( const sample_rate_t _sample_rate,
const ch_cnt_t _channels );
const ch_cnt_t _channels, mixer * _mixer );
virtual ~audioDevice();
inline void lock( void )
@@ -163,10 +163,17 @@ protected:
m_sampleRate = _new_sr;
}
mixer * getMixer( void )
{
return( m_mixer );
}
private:
sample_rate_t m_sampleRate;
ch_cnt_t m_channels;
mixer * m_mixer;
QMutex m_devMutex;
#ifdef HAVE_SAMPLERATE_H

View File

@@ -1,7 +1,7 @@
/*
* audio_dummy.h - dummy-audio-device
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,8 +33,9 @@
class audioDummy : public audioDevice, public QThread
{
public:
audioDummy( Uint32 _sample_rate, bool & _success_ful ) :
audioDevice( _sample_rate, DEFAULT_CHANNELS ),
audioDummy( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer ) :
audioDevice( _sample_rate, DEFAULT_CHANNELS, _mixer ),
m_quit( FALSE )
{
_success_ful = TRUE;
@@ -94,9 +95,8 @@ private:
timer.reset();
processNextBuffer();
const Sint32 microseconds = static_cast<Sint32>(
mixer::inst()->framesPerAudioBuffer() *
1000000.0f /
mixer::inst()->sampleRate() -
getMixer()->framesPerAudioBuffer() *
1000000.0f / getMixer()->sampleRate() -
timer.elapsed() );
if( microseconds > 0 )
{

View File

@@ -52,7 +52,8 @@ public:
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate );
const bitrate_t _max_bitrate,
mixer * _mixer );
virtual ~audioFileDevice();

View File

@@ -49,7 +49,8 @@ public:
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate );
const bitrate_t _max_bitrate,
mixer * _mixer );
virtual ~audioFileOgg();
static audioFileDevice * getInst( const sample_rate_t _sample_rate,
@@ -59,11 +60,13 @@ public:
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate )
const bitrate_t _max_bitrate,
mixer * _mixer )
{
return( new audioFileOgg( _sample_rate, _channels, _success_ful,
_file, _use_vbr, _nom_bitrate,
_min_bitrate, _max_bitrate ) );
_min_bitrate, _max_bitrate,
_mixer ) );
}

View File

@@ -42,7 +42,8 @@ public:
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate );
const bitrate_t _max_bitrate,
mixer * _mixer );
virtual ~audioFileWave();
static audioFileDevice * getInst( const sample_rate_t _sample_rate,
@@ -52,12 +53,14 @@ public:
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate )
const bitrate_t _max_bitrate,
mixer * _mixer )
{
return( new audioFileWave( _sample_rate, _channels,
_success_ful, _file, _use_vbr,
_nom_bitrate, _min_bitrate,
_max_bitrate ) );
_max_bitrate,
_mixer ) );
}

View File

@@ -1,7 +1,7 @@
/*
* audio_jack.h - support for JACK-transport
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -67,8 +67,9 @@ class lcdSpinBox;
class audioJACK : public audioDevice
{
public:
audioJACK( Uint32 _sample_rate, bool & _success_ful );
~audioJACK();
audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer );
virtual ~audioJACK();
inline static QString name( void )
{
@@ -113,8 +114,8 @@ private:
surroundSampleFrame * m_outBuf;
Uint32 m_framesDoneInCurBuf;
Uint32 m_framesToDoInCurBuf;
f_cnt_t m_framesDoneInCurBuf;
f_cnt_t m_framesToDoInCurBuf;
struct stereoPort

View File

@@ -47,7 +47,8 @@ class QLineEdit;
class audioOSS : public audioDevice, public QThread
{
public:
audioOSS( const sample_rate_t _sample_rate, bool & _success_ful );
audioOSS( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer );
virtual ~audioOSS();
inline static QString name( void )

View File

@@ -43,10 +43,10 @@
#include "effect_board.h"
class audioPort
class audioPort : public engineObject
{
public:
audioPort( const QString & _name );
audioPort( const QString & _name, engine * _engine );
~audioPort();
inline surroundSampleFrame * firstBuffer( void )

View File

@@ -54,11 +54,12 @@ class audioSampleRecorder : public audioDevice
{
public:
audioSampleRecorder( const sample_rate_t _sample_rate,
const ch_cnt_t _channels, bool & _success_ful );
const ch_cnt_t _channels, bool & _success_ful,
mixer * _mixer );
virtual ~audioSampleRecorder();
f_cnt_t framesRecorded( void ) const;
void FASTCALL createSampleBuffer( sampleBuffer * * _sample_buf ) const;
void FASTCALL createSampleBuffer( sampleBuffer * * _sample_buf );
private:

View File

@@ -51,7 +51,8 @@ class QLineEdit;
class audioSDL : public audioDevice
{
public:
audioSDL( const sample_rate_t _sample_rate, bool & _success_ful );
audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer );
virtual ~audioSDL();
inline static QString name( void )

View File

@@ -27,16 +27,12 @@
#define _BB_EDITOR_H
#include "qt3support.h"
#include "track_container.h"
#include "lmms_main_win.h"
class QPixmap;
class comboBox;
class songEditor;
class toolButton;
@@ -44,17 +40,9 @@ class bbEditor : public trackContainer
{
Q_OBJECT
public:
static inline bbEditor * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new bbEditor();
}
return( s_instanceOfMe );
}
virtual bool FASTCALL play( midiTime _start, Uint32 _start_frame,
Uint32 _frames, Uint32 _frame_base,
virtual bool FASTCALL play( midiTime _start, const f_cnt_t _start_frame,
const f_cnt_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
@@ -73,20 +61,22 @@ public:
}
csize currentBB( void ) const;
tact FASTCALL lengthOfBB( csize _bb );
tact FASTCALL lengthOfBB( const csize _bb );
inline tact lengthOfCurrentBB( void )
{
return( lengthOfBB( currentBB() ) );
}
void FASTCALL removeBB( csize _bb );
void FASTCALL removeBB( const csize _bb );
csize numOfBBs( void ) const;
void FASTCALL swapBB( csize _bb1, csize _bb2 );
void FASTCALL swapBB( const csize _bb1, const csize _bb2 );
void updateBBTrack( trackContentObject * _tco );
public slots:
void play( void );
void stop( void );
void updateComboBox( void );
void setCurrentBB( int _bb );
@@ -99,21 +89,14 @@ protected:
virtual QRect scrollAreaRect( void ) const;
protected slots:
void play( void );
void stop( void );
private:
bbEditor();
bbEditor( engine * _engine );
//bbEditor( const bbEditor & );
~bbEditor();
virtual ~bbEditor();
void FASTCALL createTCOsForBB( csize _bb );
void FASTCALL createTCOsForBB( const csize _bb );
static bbEditor * s_instanceOfMe;
QWidget * m_toolBar;
toolButton * m_playButton;
@@ -122,8 +105,7 @@ private:
comboBox * m_bbComboBox;
friend class songEditor;
friend lmmsMainWin::~lmmsMainWin();
friend class engine;
} ;

View File

@@ -100,8 +100,9 @@ public:
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
Uint32 _start_frame, Uint32 _frames,
Uint32 _frame_base,
const f_cnt_t _start_frame,
const fpab_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
@@ -111,7 +112,7 @@ public:
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
static bbTrack * FASTCALL findBBTrack( csize _bb_num );
static bbTrack * FASTCALL findBBTrack( csize _bb_num, engine * _engine );
static csize FASTCALL numOfBBTrack( track * _track );
static void FASTCALL swapBBTracks( track * _track1, track * _track2 );

View File

@@ -38,10 +38,10 @@
namespace bufferAllocator
{
void * FASTCALL allocBytes( Uint32 _bytes );
void * FASTCALL allocBytes( const Uint32 _bytes );
template<class T>
inline T * FASTCALL alloc( Uint32 _n )
inline T * FASTCALL alloc( const Uint32 _n )
{
return( (T *) allocBytes( sizeof( T ) * _n ) );
}
@@ -50,10 +50,10 @@ namespace bufferAllocator
void FASTCALL free( void * _buf );
// try to cleanup _level unused buffers
void FASTCALL cleanUp( Uint16 _level );
void FASTCALL cleanUp( const Uint16 _level );
// disable autocleanup-mechanisms
void FASTCALL disableAutoCleanup( bool _disabled );
void FASTCALL disableAutoCleanup( const bool _disabled );
// simple class for automatically freeing buffer in complex functions

View File

@@ -51,9 +51,6 @@
#endif
#include "lmms_main_win.h"
class QLineEdit;
class QLabel;
class QRadioButton;
@@ -61,6 +58,8 @@ class QHBoxLayout;
class QVBoxLayout;
class QFrame;
class engine;
const QString PROJECTS_PATH = "projects/";
const QString PRESETS_PATH = "presets/";
@@ -207,8 +206,7 @@ private:
QVBoxLayout * m_contentLayout;
// lmmsMainWin-dtor is allowed to destroy us...
friend lmmsMainWin::~lmmsMainWin();
friend class engine;
} ;

View File

@@ -2,7 +2,7 @@
* cpuload_widget.h - widget for displaying CPU-load (partly based on
* Hydrogen's CPU-load-widget)
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -44,18 +44,19 @@
#endif
#include "types.h"
#include "engine.h"
class cpuloadWidget : public QWidget
class cpuloadWidget : public QWidget, public engineObject
{
Q_OBJECT
public:
cpuloadWidget( QWidget * _parent );
~cpuloadWidget();
cpuloadWidget( QWidget * _parent, engine * _engine );
virtual ~cpuloadWidget();
protected:
void paintEvent( QPaintEvent * _ev );
virtual void paintEvent( QPaintEvent * _ev );
protected slots:

View File

@@ -33,8 +33,8 @@
class dummyPlugin : public plugin
{
public:
inline dummyPlugin( void ) :
plugin( NULL )
inline dummyPlugin( engine * _engine = NULL ) :
plugin( NULL, _engine )
{
}

View File

@@ -26,17 +26,21 @@
#ifndef _ENGINE_H
#define _ENGINE_H
class mixer;
class lmmsMainWin;
class songEditor;
#include "qt3support.h"
class bbEditor;
class mainWindow;
class mixer;
class pianoRoll;
class projectNotes;
class songEditor;
class engine
{
public:
engine( bool _has_gui = TRUE );
engine( const bool _has_gui = TRUE );
engine( const engine & _engine );
~engine();
@@ -55,7 +59,12 @@ public:
return( m_mixer );
}
inline lmmsMainWin * getMainWindow( void )
inline const mixer * getMixer( void ) const
{
return( m_mixer );
}
inline mainWindow * getMainWindow( void )
{
return( m_mainWindow );
}
@@ -65,6 +74,11 @@ public:
return( m_songEditor );
}
inline const songEditor * getSongEditor( void ) const
{
return( m_songEditor );
}
inline bbEditor * getBBEditor( void )
{
return( m_bbEditor );
@@ -75,15 +89,21 @@ public:
return( m_pianoRoll );
}
inline projectNotes * getProjectNotes( void )
{
return( m_projectNotes );
}
private:
bool m_hasGUI;
mixer * m_mixer;
lmmsMainWin * m_mainWindow;
mainWindow * m_mainWindow;
songEditor * m_songEditor;
bbEditor * m_bbEditor;
pianoRoll * m_pianoRoll;
projectNotes * m_projectNotes;
} ;
@@ -100,6 +120,11 @@ public:
return( m_engine );
}
inline const engine * eng( void ) const
{
return( m_engine );
}
inline bool hasGUI( void ) const
{
return( m_engine->hasGUI() );

View File

@@ -3,7 +3,7 @@
* is used by envelope/lfo/filter-tab of
* channel-window
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -37,10 +37,14 @@
#ifdef QT4
#include <QWidget>
#include <QMap>
#include <QVector>
#else
#include <qwidget.h>
#include <qmap.h>
#include <qvaluevector.h>
#endif
@@ -63,22 +67,26 @@ class tempoSyncKnob;
class envelopeAndLFOWidget : public QWidget, public settings,
public specialBgHandlingWidget
public specialBgHandlingWidget,
public engineObject
{
Q_OBJECT
public:
envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent );
~envelopeAndLFOWidget();
envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent,
engine * _engine );
virtual ~envelopeAndLFOWidget();
static inline float expKnobVal( float val )
{
return( ( ( val < 0 ) ? -1 : 1 ) * val*val );
}
static void triggerLFO( void );
static void resetLFO( void );
float FASTCALL level( Uint32 _frame, Uint32 _release_begin,
Uint32 _frame_offset ) const;
static void triggerLFO( engine * _engine );
static void resetLFO( engine * _engine );
float FASTCALL level( f_cnt_t _frame,
const f_cnt_t _release_begin,
const f_cnt_t _frame_offset ) const;
inline bool used( void ) const
{
@@ -105,7 +113,8 @@ protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
float FASTCALL lfoLevel( Uint32 _frame, Uint32 _frame_offset ) const;
float FASTCALL lfoLevel( f_cnt_t _frame,
const f_cnt_t _frame_offset ) const;
protected slots:
@@ -122,10 +131,11 @@ private:
static QPixmap * s_envGraph;
static QPixmap * s_lfoGraph;
static Uint32 s_lfoFrame;
static QMap<engine *, vvector<envelopeAndLFOWidget *> > s_EaLWidgets;
bool m_used;
// envelope-stuff
knob * m_predelayKnob;
knob * m_attackKnob;
@@ -139,10 +149,10 @@ private:
float m_amount;
float m_valueForZeroAmount;
float m_amountAdd;
Uint32 m_pahdFrames;
Uint32 m_rFrames;
float * m_pahdEnv;
float * m_rEnv;
f_cnt_t m_pahdFrames;
f_cnt_t m_rFrames;
sample_t * m_pahdEnv;
sample_t * m_rEnv;
// LFO-stuff
knob * m_lfoPredelayKnob;
@@ -158,12 +168,13 @@ private:
ledCheckBox * m_x100Cb;
ledCheckBox * m_controlEnvAmountCb;
Uint32 m_lfoPredelayFrames;
Uint32 m_lfoAttackFrames;
Uint32 m_lfoOscillationFrames;
f_cnt_t m_lfoPredelayFrames;
f_cnt_t m_lfoAttackFrames;
f_cnt_t m_lfoOscillationFrames;
f_cnt_t m_lfoFrame;
float m_lfoAmount;
bool m_lfoAmountIsZero;
float * m_lfoShapeData;
sample_t * m_lfoShapeData;
sampleBuffer m_userWave;
enum lfoShapes

View File

@@ -57,14 +57,16 @@ class pixmapButton;
class tabWidget;
class envelopeTabWidget : public QWidget, public settings
class envelopeTabWidget : public QWidget, public settings,
public engineObject
{
Q_OBJECT
public:
envelopeTabWidget( channelTrack * _channel_track );
virtual ~envelopeTabWidget();
void FASTCALL processAudioBuffer( sampleFrame * _ab, Uint32 _frames,
void FASTCALL processAudioBuffer( sampleFrame * _ab,
const fpab_t _frames,
notePlayHandle * _n );
enum targets
@@ -77,10 +79,10 @@ public:
TARGET_COUNT
} ;
Uint32 envFrames( void );
Uint32 releaseFrames( void );
f_cnt_t envFrames( void );
f_cnt_t releaseFrames( void );
float FASTCALL volumeLevel( notePlayHandle * _n, Uint32 _frame );
float FASTCALL volumeLevel( notePlayHandle * _n, const f_cnt_t _frame );
virtual void FASTCALL saveSettings( QDomDocument & _doc,

View File

@@ -29,6 +29,7 @@
class audioFileDevice;
class mixer;
typedef audioFileDevice * ( * getDeviceInst)( const sample_rate_t _sample_rate,
@@ -38,7 +39,8 @@ typedef audioFileDevice * ( * getDeviceInst)( const sample_rate_t _sample_rate,
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate );
const bitrate_t _max_bitrate,
mixer * _mixer );
enum fileTypes

View File

@@ -44,6 +44,7 @@
#endif
#include "export.h"
#include "engine.h"
class QLabel;
@@ -55,12 +56,13 @@ class ledCheckBox;
class pixmapButton;
class exportProjectDialog : public QDialog
class exportProjectDialog : public QDialog, public engineObject
{
Q_OBJECT
public:
exportProjectDialog( const QString & _file_name, QWidget * _parent );
~exportProjectDialog();
exportProjectDialog( const QString & _file_name, QWidget * _parent,
engine * _engine );
virtual ~exportProjectDialog();
public slots:
@@ -68,8 +70,8 @@ public slots:
protected:
void keyPressEvent( QKeyEvent * _ke );
void closeEvent( QCloseEvent * _ce );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void closeEvent( QCloseEvent * _ce );
private slots:
@@ -85,6 +87,7 @@ private:
_ext );
static Sint16 s_availableBitrates[];
QString m_fileName;
QLabel * m_typeLbl;
comboBox * m_typeCombo;

View File

@@ -1,7 +1,7 @@
/*
* fade_button.h - declaration of class fadeButton
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*

View File

@@ -1,7 +1,7 @@
/*
* file_browser.h - include file for fileBrowser
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -46,7 +46,7 @@
#include "side_bar_widget.h"
#include "engine.h"
class fileItem;
@@ -57,13 +57,13 @@ class trackContainer;
class fileBrowser : public sideBarWidget
class fileBrowser : public sideBarWidget, public engineObject
{
Q_OBJECT
public:
fileBrowser( const QString & _path, const QString & _filter,
const QString & _title, const QPixmap & _pm,
QWidget * _parent );
QWidget * _parent, engine * _engine );
virtual ~fileBrowser();
@@ -100,12 +100,12 @@ private:
class listView : public Q3ListView
class listView : public Q3ListView, public engineObject
{
Q_OBJECT
public:
listView( QWidget * _parent );
~listView();
listView( QWidget * _parent, engine * _engine );
virtual ~listView();
protected:

View File

@@ -82,7 +82,7 @@ public:
// (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 Uint32 FASTCALL beatLen( notePlayHandle * _n ) const;
virtual f_cnt_t FASTCALL beatLen( notePlayHandle * _n ) const;
// instrument-play-handles use this for checking whether they can mark
@@ -110,7 +110,7 @@ protected:
inline void invalidate( void )
{
m_valid = FALSE;
mixer::inst()->checkValidityOfPlayHandles();
eng()->getMixer()->checkValidityOfPlayHandles();
}

View File

@@ -1,7 +1,7 @@
/*
* instrument_play_handle.h - play-handle for playing an instrument
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,8 +33,8 @@
class instrumentPlayHandle : public playHandle
{
public:
inline instrumentPlayHandle( instrument * _instrument ) :
playHandle( INSTRUMENT_PLAY_HANDLE ),
inline instrumentPlayHandle( instrument * _instrument ) FASTCALL :
playHandle( INSTRUMENT_PLAY_HANDLE, _instrument->eng() ),
m_instrument( _instrument )
{
}

View File

@@ -4,7 +4,7 @@
* This file is based on the knob-widget of the Qwt Widget Library by
* Josef Wilgen
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -44,6 +44,9 @@
#endif
#include "engine.h"
class QPixmap;
class textFloat;
@@ -55,11 +58,12 @@ enum knobTypes
class knob : public QWidget
class knob : public QWidget, public engineObject
{
Q_OBJECT
public:
knob( int _knob_num, QWidget * _parent, const QString & _name );
knob( int _knob_num, QWidget * _parent, const QString & _name,
engine * _engine );
virtual ~knob();

165
include/main_window.h Normal file
View File

@@ -0,0 +1,165 @@
/*
* main_window.h - declaration of class mainWindow, the main window of LMMS
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _MAIN_WINDOW_H
#define _MAIN_WINDOW_H
#include "qt3support.h"
#ifdef QT4
#include <QMainWindow>
#include <QWorkspace>
#include <QWhatsThis>
#else
#include <qmainwindow.h>
#include <qworkspace.h>
#include <qwhatsthis.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "types.h"
#include "engine.h"
class QGridLayout;
class QSplashScreen;
class configManager;
class toolButton;
class mainWindow : public QMainWindow, public engineObject
{
Q_OBJECT
public:
inline QWorkspace * workspace( void )
{
return( m_workspace );
}
inline QWidget * toolBar( void )
{
return( m_toolBar );
}
int addWidgetToToolBar( QWidget * _w, int _row = -1, int _col = -1 );
void addSpacingToToolBar( int _size );
void FASTCALL resetWindowTitle( const QString & _add = "" );
void clearKeyModifiers( void );
inline bool isCtrlPressed( void )
{
return( m_keyMods.m_ctrl );
}
inline bool isShiftPressed( void )
{
return( m_keyMods.m_shift );
}
inline bool isAltPressed( void )
{
return( m_keyMods.m_alt );
}
static QSplashScreen * s_splashScreen;
public slots:
inline void emptySlot( void )
{
}
inline void enterWhatsThisMode( void )
{
QWhatsThis::enterWhatsThisMode();
}
void createNewProject( void );
void createNewProjectFromTemplate( int _idx );
void openProject( void );
bool saveProject( void );
bool saveProjectAs( void );
void showSettingsDialog( void );
void aboutLMMS( void );
void help( void );
void toggleBBEditorWin( void );
void toggleSongEditorWin( void );
void toggleProjectNotesWin( void );
void togglePianoRollWin( void );
protected:
virtual void closeEvent( QCloseEvent * _ce );
virtual void focusOutEvent( QFocusEvent * _fe );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void keyReleaseEvent( QKeyEvent * _ke );
private:
mainWindow( engine * _engine );
mainWindow( const mainWindow & );
virtual ~mainWindow();
void finalize( void );
QWorkspace * m_workspace;
QWidget * m_toolBar;
QGridLayout * m_toolBarLayout;
QMenu * m_templatesMenu;
struct keyModifiers
{
keyModifiers() :
m_ctrl( FALSE ),
m_shift( FALSE ),
m_alt( FALSE )
{
}
bool m_ctrl;
bool m_shift;
bool m_alt;
} m_keyMods;
friend class engine;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* micro_timer.h - simple high-precision timer
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*

View File

@@ -1,7 +1,7 @@
/*
* midi_alsa_raw.h - midi-client for RawMIDI via ALSA
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -61,8 +61,8 @@ class QLineEdit;
class midiALSARaw : public midiClientRaw, public QThread
{
public:
midiALSARaw( void );
~midiALSARaw();
midiALSARaw( engine * _engine );
virtual ~midiALSARaw();
static QString probeDevice( void );

View File

@@ -1,7 +1,7 @@
/*
* midi_alsa_seq.h - ALSA-sequencer-client
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -71,8 +71,8 @@ class midiALSASeq :
{
Q_OBJECT
public:
midiALSASeq( void );
~midiALSASeq();
midiALSASeq( engine * _engine );
virtual ~midiALSASeq();
static QString probeDevice( void );
@@ -143,7 +143,7 @@ public:
private slots:
void changeQueueTempo( int _bpm );
void changeQueueTempo( bpm_t _bpm );
void updatePortList( void );

View File

@@ -44,16 +44,17 @@
#include "midi.h"
#include "midi_event_processor.h"
#include "tab_widget.h"
#include "engine.h"
class midiPort;
// base-class for all MIDI-clients
class midiClient
class midiClient : public engineObject
{
public:
midiClient( void );
midiClient( engine * _engine );
virtual ~midiClient();
// to be implemented by sub-classes
@@ -143,7 +144,7 @@ const Uint8 RAW_MIDI_PARSE_BUF_SIZE = 16;
class midiClientRaw : public midiClient
{
public:
midiClientRaw( void );
midiClientRaw( engine * _engine );
virtual ~midiClientRaw();
// we are raw-clients for sure!

View File

@@ -1,7 +1,7 @@
/*
* midi_dummy.h - dummy MIDI-driver
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -35,11 +35,11 @@
class midiDummy : public midiClientRaw
{
public:
midiDummy() :
midiClientRaw()
midiDummy( engine * _engine ) :
midiClientRaw( _engine )
{
}
~midiDummy()
virtual ~midiDummy()
{
}

View File

@@ -1,7 +1,7 @@
/*
* midi_oss.h - OSS-raw-midi-client
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -43,8 +43,8 @@ class QLineEdit;
class midiOSS : public midiClientRaw, public QThread
{
public:
midiOSS( void );
~midiOSS();
midiOSS( engine * _engine );
virtual ~midiOSS();
static QString probeDevice( void );

View File

@@ -2,7 +2,7 @@
* midi_port.h - abstraction of MIDI-ports which are part of LMMS's MIDI-
* sequencing system
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*

View File

@@ -44,6 +44,7 @@
#endif
#include "settings.h"
#include "engine.h"
class QMenu;
@@ -57,12 +58,12 @@ class lcdSpinBox;
class midiPort;
class midiTabWidget : public QWidget, public settings
class midiTabWidget : public QWidget, public settings, public engineObject
{
Q_OBJECT
public:
midiTabWidget( channelTrack * _channel_track, midiPort * _port );
~midiTabWidget();
virtual ~midiTabWidget();
virtual void FASTCALL saveSettings( QDomDocument & _doc,

View File

@@ -2,7 +2,7 @@
* midi_time.h - declaration of class midiTime which provides data-type for
* position- and length-variables
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -98,11 +98,11 @@ public:
}
// calculate number of frame that are needed this time
inline Uint32 frames( const float _frames_per_tact ) const
inline f_cnt_t frames( const float _frames_per_tact ) const
{
if( m_tact >= 0 )
{
return( static_cast<Uint32>( m_tact *
return( static_cast<f_cnt_t>( m_tact *
_frames_per_tact +
m_tact64th *
_frames_per_tact /
@@ -111,7 +111,7 @@ public:
return( 0 );
}
static inline midiTime fromFrames( Uint32 _frames,
static inline midiTime fromFrames( const f_cnt_t _frames,
const float _frames_per_tact )
{
return( midiTime( static_cast<Sint32>( _frames * 64.0f /

View File

@@ -52,12 +52,11 @@
#include "note.h"
#include "play_handle.h"
#include "effect_board.h"
#include "engine.h"
class audioDevice;
class midiClient;
class lmmsMainWin;
class plugin;
class audioPort;
@@ -107,47 +106,14 @@ const octaves BASE_OCTAVE = OCTAVE_4;
class mixer : public QObject
class mixer : public QObject, public engineObject
{
Q_OBJECT
public:
static inline mixer * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new mixer();
}
return( s_instanceOfMe );
}
void initDevices( void );
void FASTCALL clear( const bool _everything = FALSE );
void FASTCALL bufferToPort( const sampleFrame * _buf,
const fpab_t _frames,
const fpab_t _framesAhead,
const volumeVector & _volumeVector,
audioPort * _port );
inline fpab_t framesPerAudioBuffer( void ) const
{
return( m_framesPerAudioBuffer );
}
inline Uint8 cpuLoad( void ) const
{
return( m_cpuLoad );
}
inline bool highQuality( void ) const
{
return( m_qualityLevel > DEFAULT_QUALITY_LEVEL );
}
inline const surroundSampleFrame * currentAudioBuffer( void ) const
{
return( m_curBuf );
}
// audio-device-stuff
inline const QString & audioDevName( void ) const
{
@@ -181,6 +147,7 @@ public:
}
}
// MIDI-client-stuff
inline const QString & midiClientName( void ) const
{
@@ -193,6 +160,7 @@ public:
}
// play-handle stuff
inline void addPlayHandle( playHandle * _ph )
{
if( criticalXRuns() == FALSE )
@@ -217,9 +185,36 @@ public:
void checkValidityOfPlayHandles( void );
inline bool haveNoRunningNotes( void ) const
{
return( m_playHandles.size() == 0 );
}
inline sample_rate_t sampleRate( void )
// methods providing information for other classes
inline fpab_t framesPerAudioBuffer( void ) const
{
return( m_framesPerAudioBuffer );
}
inline const surroundSampleFrame * currentAudioBuffer( void ) const
{
return( m_curBuf );
}
inline Uint8 cpuLoad( void ) const
{
return( m_cpuLoad );
}
inline bool highQuality( void ) const
{
return( m_qualityLevel > DEFAULT_QUALITY_LEVEL );
}
inline sample_rate_t sampleRate( void ) const
{
return( SAMPLE_RATES[m_qualityLevel] );
}
@@ -250,6 +245,7 @@ public:
}
// methods for controlling mixer-state
void pause( void )
{
if( m_mixMutexLockLevel == 0 )
@@ -269,8 +265,12 @@ public:
}
void FASTCALL clear( const bool _everything = FALSE );
// audio-buffer-mgm
void FASTCALL bufferToPort( const sampleFrame * _buf,
const fpab_t _frames,
const fpab_t _framesAhead,
const volumeVector & _volumeVector,
audioPort * _port );
void FASTCALL clearAudioBuffer( sampleFrame * _ab,
const f_cnt_t _frames );
@@ -279,11 +279,6 @@ public:
const f_cnt_t _frames );
#endif
inline bool haveNoRunningNotes( void ) const
{
return( m_playHandles.size() == 0 );
}
bool criticalXRuns( void ) const;
const surroundSampleFrame * renderNextBuffer( void );
@@ -300,17 +295,16 @@ signals:
private:
static mixer * s_instanceOfMe;
mixer();
mixer( engine * _engine );
~mixer();
void startProcessing( void );
void stopProcessing( void );
// we don't allow to create mixer by using copy-ctor
mixer( const mixer & )
mixer( const mixer & ) :
engineObject( NULL )
{
}
@@ -353,7 +347,7 @@ private:
Uint8 m_mixMutexLockLevel;
friend class lmmsMainWin;
friend class engine;
} ;

View File

@@ -41,13 +41,16 @@
#endif
#include "engine.h"
class nameLabel : public QLabel
class nameLabel : public QLabel, public engineObject
{
Q_OBJECT
public:
nameLabel( const QString & _initial_name, QWidget * _parent );
~nameLabel();
nameLabel( const QString & _initial_name, QWidget * _parent,
engine * _engine );
virtual ~nameLabel();
const QPixmap & pixmap( void ) const
{

View File

@@ -27,8 +27,6 @@
#ifndef _NOTE_PLAY_HANDLE_H
#define _NOTE_PLAY_HANDLE_H
#include <qpair.h>
#include "play_handle.h"
#include "basic_filters.h"
#include "note.h"
@@ -47,10 +45,10 @@ public:
void * m_pluginData;
basicFilters<> * m_filter;
notePlayHandle( channelTrack * _chnl_trk, const Uint32 _frames_ahead,
const Uint32 _frames, note * _n,
notePlayHandle( channelTrack * _chnl_trk, const f_cnt_t _frames_ahead,
const f_cnt_t _frames, note * _n,
const bool _arp_note = FALSE ) FASTCALL;
~notePlayHandle();
virtual ~notePlayHandle();
virtual void play( void );
@@ -65,34 +63,34 @@ public:
virtual void checkValidity( void );
void FASTCALL noteOff( Uint32 _s = 0 );
void FASTCALL noteOff( const f_cnt_t _s = 0 );
inline Uint32 framesBeforeRelease( void ) const
inline f_cnt_t framesBeforeRelease( void ) const
{
return( m_framesBeforeRelease );
}
inline Uint32 releaseFramesDone( void ) const
inline f_cnt_t releaseFramesDone( void ) const
{
return( m_releaseFramesDone );
}
Uint32 actualReleaseFramesToDo( void ) const;
f_cnt_t actualReleaseFramesToDo( void ) const;
// returns how many samples this note is aligned ahead, i.e.
// at which position it is inserted in the according buffer
inline Uint32 framesAhead( void ) const
inline f_cnt_t framesAhead( void ) const
{
return ( m_framesAhead );
}
// returns total numbers of frames to play
inline Uint32 frames( void ) const
inline f_cnt_t frames( void ) const
{
return( m_frames );
}
void setFrames( Uint32 _frames );
void setFrames( const f_cnt_t _frames );
// returns whether note was released
inline bool released( void ) const
@@ -101,13 +99,13 @@ public:
}
// returns total numbers of played frames
inline Uint32 totalFramesPlayed( void ) const
inline f_cnt_t totalFramesPlayed( void ) const
{
return( m_totalFramesPlayed );
}
// returns volume-level at frame _frame (envelope/LFO)
float FASTCALL volumeLevel( Uint32 _frame );
float FASTCALL volumeLevel( const f_cnt_t _frame );
// adds note-play-handle _n as subnote
inline void addSubNote( notePlayHandle * _n )
@@ -139,7 +137,7 @@ public:
return( m_arpNote );
}
inline void setArpNote( bool _on )
inline void setArpNote( const bool _on )
{
m_arpNote = _on;
}
@@ -172,17 +170,17 @@ public:
private:
channelTrack * m_channelTrack; // needed for calling
// channelTrack::playNote
Uint32 m_frames; // total frames to play
Uint32 m_framesAhead; // numbers of frames ahead in buffer
f_cnt_t m_frames; // total frames to play
f_cnt_t m_framesAhead; // numbers of frames ahead in buffer
// to mix in
Uint32 m_totalFramesPlayed; // total frame-counter - used for
f_cnt_t m_totalFramesPlayed; // total frame-counter - used for
// figuring out whether a whole note
// has been played
Uint32 m_framesBeforeRelease; // number of frames after which note
f_cnt_t m_framesBeforeRelease; // number of frames after which note
// is released
Uint32 m_releaseFramesToDo; // total numbers of frames to be
f_cnt_t m_releaseFramesToDo; // total numbers of frames to be
// played after release
Uint32 m_releaseFramesDone; // number of frames done after
f_cnt_t m_releaseFramesDone; // number of frames done after
// release of note
notePlayHandleVector m_subNotes;// used for chords and arpeggios
bool m_released; // indicates whether note is released

View File

@@ -71,7 +71,8 @@ public:
oscillator( const modulationAlgos _modulation_algo, const float _freq,
const Sint16 _phase_offset, const float _volume_factor,
oscillator * _m_subOsc ) FASTCALL;
const sample_rate_t _sample_rate,
oscillator * _m_subOsc ) FASTCALL;
virtual ~oscillator()
{
delete m_subOsc;
@@ -112,6 +113,7 @@ public:
const float _freq,
const Sint16 _phase_offset,
const float _volume_factor,
const sample_rate_t _sample_rate,
oscillator * _m_subOsc = NULL );
inline bool syncOk( void )
{
@@ -212,6 +214,7 @@ protected:
float m_freq;
float m_volumeFactor;
Sint16 m_phaseOffset;
const sample_rate_t m_sampleRate;
oscillator * m_subOsc;
f_cnt_t m_sample;
float m_oscCoeff;

View File

@@ -78,8 +78,8 @@ public:
BEAT_PATTERN, MELODY_PATTERN/*, AUTOMATION_PATTERN*/
} ;
pattern( channelTrack * _channel_track ) FASTCALL;
pattern( const pattern & _pat_to_copy ) FASTCALL;
pattern( channelTrack * _channel_track );
pattern( const pattern & _pat_to_copy );
virtual ~pattern();
void init( void );
@@ -139,8 +139,9 @@ public:
// if channel-track recognizes that this pattern is frozen, it calls
// this instead of playing all the notes
void FASTCALL playFrozenData( sampleFrame * _ab, Uint32 _start_frame,
Uint32 _frames );
void FASTCALL playFrozenData( sampleFrame * _ab,
const f_cnt_t _start_frame,
const fpab_t _frames );
// settings-management
virtual void FASTCALL saveSettings( QDomDocument & _doc,
@@ -269,7 +270,7 @@ signals:
class patternFreezeThread : public QThread
class patternFreezeThread : public QThread, public engineObject
{
public:
patternFreezeThread( pattern * _pattern );

View File

@@ -45,6 +45,7 @@
#include "types.h"
#include "note.h"
#include "engine.h"
class QPainter;
@@ -52,26 +53,16 @@ class QPixmap;
class QScrollBar;
class comboBox;
class lmmsMainWin;
class notePlayHandle;
class pattern;
class timeLine;
class toolButton;
class pianoRoll : public QWidget
class pianoRoll : public QWidget, public engineObject
{
Q_OBJECT
public:
static inline pianoRoll * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new pianoRoll();
}
return( s_instanceOfMe );
}
void FASTCALL setCurrentPattern( pattern * _new_pattern );
inline bool isRecording( void ) const
@@ -170,14 +161,11 @@ private:
} ;
pianoRoll( void );
pianoRoll( engine * _engine );
pianoRoll( const pianoRoll & );
~pianoRoll();
virtual ~pianoRoll();
static pianoRoll * s_instanceOfMe;
static QPixmap * s_whiteKeyBigPm;
static QPixmap * s_whiteKeySmallPm;
static QPixmap * s_blackKeyPm;
@@ -251,7 +239,7 @@ private:
friend class lmmsMainWin;
friend class engine;
signals:

View File

@@ -44,7 +44,10 @@
#endif
class playHandle
#include "engine.h"
class playHandle : public engineObject
{
public:
enum types
@@ -53,7 +56,8 @@ public:
PRESET_PREVIEW_PLAY_HANDLE
} ;
inline playHandle( types _type ) :
inline playHandle( const types _type, engine * _engine ) FASTCALL :
engineObject( _engine ),
m_type( _type )
{
}

View File

@@ -49,6 +49,7 @@
#include "types.h"
#include "settings.h"
#include "embed.h"
#include "engine.h"
#define STRINGIFY_PLUGIN_NAME(s) STR(s)
@@ -58,7 +59,7 @@
class QPixmap;
class plugin : public settings
class plugin : public settings, public engineObject
{
public:
enum pluginTypes
@@ -85,7 +86,7 @@ public:
} ;
// contructor of a plugin
plugin( const descriptor * _descriptor );
plugin( const descriptor * _descriptor, engine * _engine );
virtual ~plugin();
// returns public-name out of descriptor

View File

@@ -1,7 +1,7 @@
/*
* plugin_browser.h - include file for pluginBrowser
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -53,11 +53,11 @@
class trackContainer;
class pluginBrowser : public sideBarWidget
class pluginBrowser : public sideBarWidget, public engineObject
{
Q_OBJECT
public:
pluginBrowser( QWidget * _parent );
pluginBrowser( QWidget * _parent, engine * _engine );
virtual ~pluginBrowser();
@@ -71,10 +71,11 @@ private:
class pluginDescWidget : public QWidget
class pluginDescWidget : public QWidget, public engineObject
{
public:
pluginDescWidget( const plugin::descriptor & _pd, QWidget * _parent );
pluginDescWidget( const plugin::descriptor & _pd, QWidget * _parent,
engine * _engine );
virtual ~pluginDescWidget();

View File

@@ -27,31 +27,49 @@
#ifndef _PRESET_PREVIEW_PLAY_HANDLE_H
#define _PRESET_PREVIEW_PLAY_HANDLE_H
#include "note_play_handle.h"
#include "qt3support.h"
#ifdef QT4
#include <QMutex>
#include <QMap>
#else
#include <qmutex.h>
#include <qmap.h>
#endif
#include "note_play_handle.h"
class previewTrackContainer;
class channelTrack;
class QMutex;
class presetPreviewPlayHandle : public playHandle
{
public:
presetPreviewPlayHandle( const QString & _preset_file );
presetPreviewPlayHandle( const QString & _preset_file,
engine * _engine ) FASTCALL;
virtual ~presetPreviewPlayHandle();
virtual void play( void );
virtual bool done( void ) const;
static void cleanUp( void );
static void cleanUp( engine * _engine );
static constNotePlayHandleVector nphsOfChannelTrack(
const channelTrack * _ct );
private:
static channelTrack * s_globalChannelTrack;
static notePlayHandle * s_globalPreviewNote;
static QMutex s_globalDataMutex;
inline previewTrackContainer * previewTC( void )
{
return( s_previewTCs[eng()] );
}
static QMap<const engine *, previewTrackContainer *> s_previewTCs;
notePlayHandle * m_previewNote;

View File

@@ -1,7 +1,7 @@
/*
* project_notes.h - header for project-notes-editor
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -39,6 +39,7 @@
#endif
#include "settings.h"
#include "engine.h"
class QAction;
@@ -46,11 +47,13 @@ class QComboBox;
class QTextEdit;
class projectNotes : public QMainWindow, public settings
class projectNotes : public QMainWindow, public settings, public engineObject
{
Q_OBJECT
public:
projectNotes();
projectNotes( engine * _engine );
virtual ~projectNotes();
void clear( void );
virtual void FASTCALL saveSettings( QDomDocument & _doc,

View File

@@ -57,7 +57,7 @@
class QPainter;
class sampleBuffer : public QObject
class sampleBuffer : public QObject, public engineObject
{
Q_OBJECT
public:
@@ -69,16 +69,16 @@ public:
// constructor which either loads sample _audio_file or decodes
// base64-data out of string
sampleBuffer( const QString & _audio_file = "",
sampleBuffer( engine * _engine, const QString & _audio_file = "",
bool _is_base64_data = FALSE );
sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames );
sampleBuffer( const f_cnt_t _frames );
sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames,
engine * _engine );
sampleBuffer( const f_cnt_t _frames, engine * _engine );
~sampleBuffer();
virtual ~sampleBuffer();
bool FASTCALL play( sampleFrame * _ab, const f_cnt_t _start_frame,
const fpab_t _frames =
mixer::inst()->framesPerAudioBuffer(),
const fpab_t _frames,
const float _freq = BASE_FREQ,
const bool _looped = FALSE,
void * * _resampling_data = NULL );
@@ -131,15 +131,16 @@ public:
static sampleBuffer * FASTCALL resample( sampleFrame * _data,
const f_cnt_t _frames,
const sample_rate_t _src_sr,
const sample_rate_t _dst_sr );
const sample_rate_t _dst_sr,
engine * _engine );
static inline sampleBuffer * FASTCALL resample(
const sampleBuffer * _buf,
sampleBuffer * _buf,
const sample_rate_t _src_sr,
const sample_rate_t _dst_sr )
{
return( resample( _buf->m_data, _buf->m_frames, _src_sr,
_dst_sr ) );
_dst_sr, _buf->eng() ) );
}

View File

@@ -1,7 +1,7 @@
/*
* sample_play_handle.h - play-handle for playing a sample
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -37,15 +37,16 @@ class audioPort;
class samplePlayHandle : public playHandle
{
public:
samplePlayHandle( const QString & _sample_file );
samplePlayHandle( sampleBuffer * _sample_buffer );
samplePlayHandle( const QString & _sample_file, engine * _engine )
FASTCALL;
samplePlayHandle( sampleBuffer * _sample_buffer ) FASTCALL;
virtual ~samplePlayHandle();
virtual void play( void );
virtual bool done( void ) const;
Uint32 totalFrames( void ) const;
inline Uint32 framesDone( void ) const
f_cnt_t totalFrames( void ) const;
inline f_cnt_t framesDone( void ) const
{
return( m_frame );
}
@@ -60,7 +61,7 @@ private:
const bool m_ownSampleBuffer;
bool m_doneMayReturnTrue;
Uint32 m_frame;
f_cnt_t m_frame;
audioPort * m_audioPort;

View File

@@ -2,7 +2,7 @@
* sample_track.h - class sampleTrack, a track which provides arrangement of
* samples
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -58,8 +58,8 @@ public:
virtual ~sampleTCO();
virtual void FASTCALL changeLength( const midiTime & _length );
void FASTCALL play( sampleFrame * _ab, Uint32 _start_frame,
Uint32 _frames );
void FASTCALL play( sampleFrame * _ab, f_cnt_t _start_frame,
const fpab_t _frames );
const QString & sampleFile( void ) const;
virtual void FASTCALL saveSettings( QDomDocument & _doc,
@@ -73,7 +73,7 @@ public:
public slots:
void setSampleFile( const QString & _sf );
void updateLength( int = 0 );
void updateLength( bpm_t = 0 );
protected:
@@ -127,8 +127,9 @@ public:
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
Uint32 _start_frame, Uint32 _frames,
Uint32 _frame_base,
const f_cnt_t _start_frame,
const fpab_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );

View File

@@ -53,7 +53,7 @@ class QSlider;
class tabBar;
class setupDialog : public QDialog
class setupDialog : public QDialog, public engineObject
{
Q_OBJECT
public:
@@ -63,7 +63,8 @@ public:
AUDIO_SETTINGS, MIDI_SETTINGS
} ;
setupDialog( configTabs _tab_to_open = GENERAL_SETTINGS );
setupDialog( engine * _engine,
configTabs _tab_to_open = GENERAL_SETTINGS );
virtual ~setupDialog();

View File

@@ -38,16 +38,14 @@ class QSlider;
class comboBox;
class lcdSpinBox;
class lmmsMainWin;
class pattern;
class projectNotes;
class textFloat;
class timeLine;
const int MIN_BPM = 10;
const int DEFAULT_BPM = 140;
const int MAX_BPM = 999;
const bpm_t MIN_BPM = 10;
const bpm_t DEFAULT_BPM = 140;
const bpm_t MAX_BPM = 999;
const Uint16 MAX_SONG_LENGTH = 9999;
@@ -75,11 +73,11 @@ public:
m_currentFrame( 0 )
{
}
inline void setCurrentFrame( Uint32 _f )
inline void setCurrentFrame( const f_cnt_t _f )
{
m_currentFrame = _f;
}
inline Uint32 currentFrame( void ) const
inline f_cnt_t currentFrame( void ) const
{
return( m_currentFrame );
}
@@ -87,20 +85,11 @@ public:
bool m_timeLineUpdate;
private:
Uint32 m_currentFrame;
f_cnt_t m_currentFrame;
} ;
static inline songEditor * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new songEditor();
}
return( s_instanceOfMe );
}
void processNextBuffer( void );
@@ -140,7 +129,8 @@ public:
tact lengthInTacts( void ) const;
int getBPM( void );
bpm_t getTempo( void );
// every function that replaces current file (e.g. creates new file,
// opens another file...) has to call this before and may only process
@@ -175,11 +165,6 @@ public:
int masterPitch( void ) const;
projectNotes * getProjectNotesWindow( void )
{
return( m_projectNotes );
}
public slots:
void play( void );
@@ -195,8 +180,9 @@ public slots:
void startExport( void );
void stopExport( void );
// set BPM (beats per minute)
void setBPM( int _new_bpm = DEFAULT_BPM );
// set tempo in BPM (beats per minute)
void setTempo( int _new_bpm = DEFAULT_BPM );
inline void setModified( void )
{
@@ -244,7 +230,7 @@ protected slots:
private:
songEditor();
songEditor( engine * _engine );
songEditor( const songEditor & );
virtual ~songEditor();
@@ -266,8 +252,6 @@ private:
static songEditor * s_instanceOfMe;
QScrollBar * m_leftRightScroll;
QWidget * m_toolBar;
@@ -310,9 +294,6 @@ private:
bool m_scrollBack;
projectNotes * m_projectNotes;
enum ACTIONS
{
@@ -322,12 +303,11 @@ private:
vvector<ACTIONS> m_actions;
friend class lmmsMainWin;
friend class engine;
signals:
void bpmChanged( int _new_bpm );
void tempoChanged( bpm_t _new_bpm );
} ;

View File

@@ -2,7 +2,7 @@
* string_pair_drag.h - class stringPairDrag which provides general support
* for drag'n'drop of string-pairs
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -39,19 +39,23 @@
#endif
#include "engine.h"
class QPixmap;
class stringPairDrag : public
#ifdef QT4
QDrag
QDrag,
#else
QStoredDrag
QStoredDrag,
#endif
public engineObject
{
public:
stringPairDrag( const QString & _key, const QString & _value,
const QPixmap & _icon, QWidget * _w );
const QPixmap & _icon, QWidget * _w, engine * _engine );
~stringPairDrag();
static bool processDragEnterEvent( QDragEnterEvent * _dee,

View File

@@ -37,6 +37,7 @@
#endif
#include "knob.h"
#include "types.h"
class QAction;
@@ -59,8 +60,8 @@ public:
} ;
tempoSyncKnob( int _knob_num, QWidget * _parent, const QString & _name,
float _scale = 1.0f );
tempoSyncKnob( int _knob_num, QWidget * _parent, const QString & _name,
engine * _engine, float _scale = 1.0f );
virtual ~tempoSyncKnob();
tempoSyncMode getSyncMode( void );
@@ -95,7 +96,7 @@ protected:
protected slots:
void calculateTempoSyncTime( int _bpm );
void calculateTempoSyncTime( bpm_t _bpm );
private:

View File

@@ -1,7 +1,7 @@
/*
* timeline.h - class timeLine, representing a time-line with position marker
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -47,7 +47,7 @@ class nStateButton;
class textFloat;
class timeLine : public QWidget
class timeLine : public QWidget, public engineObject
{
Q_OBJECT
public:
@@ -68,7 +68,7 @@ public:
timeLine( int _xoff, int _yoff, float _ppt, songEditor::playPos & _pos,
const midiTime & _begin, QWidget * _parent );
const midiTime & _begin, QWidget * _parent, engine * _engine );
virtual ~timeLine();
inline songEditor::playPos & pos( void )

View File

@@ -2,7 +2,7 @@
* track.h - declaration of classes concerning tracks -> neccessary for all
* track-like objects (beat/bassline, sample-track...)
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -56,6 +56,7 @@
#include "midi_time.h"
#include "settings.h"
#include "rubberband.h"
#include "engine.h"
class QMenu;
@@ -77,7 +78,8 @@ const Uint16 TRACK_OP_WIDTH = 70;
const Uint16 TCO_BORDER_WIDTH = 1;
class trackContentObject : public selectableObject, public settings
class trackContentObject : public selectableObject, public settings,
public engineObject
{
Q_OBJECT
public:
@@ -345,7 +347,7 @@ private:
// base-class for all tracks
class track : public settings
class track : public settings, public engineObject
{
public:
enum trackTypes
@@ -361,6 +363,7 @@ public:
track( trackContainer * _tc );
virtual ~track();
static track * FASTCALL create( trackTypes _tt, trackContainer * _tc );
static track * FASTCALL create( const QDomElement & _this,
trackContainer * _tc );
@@ -383,9 +386,9 @@ public:
virtual trackTypes type( void ) const = 0;
virtual bool FASTCALL play( const midiTime & _start,
Uint32 _start_frame,
Uint32 _frames,
Uint32 _frame_base,
const f_cnt_t _start_frame,
const fpab_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 ) = 0;

View File

@@ -47,19 +47,21 @@
#include "track.h"
#include "settings.h"
#include "rubberband.h"
#include "engine.h"
const Uint16 DEFAULT_PIXELS_PER_TACT = 16;
const Uint16 DEFAULT_SCROLLBAR_SIZE = 16;
class trackContainer : public QMainWindow, public settings
class trackContainer : public QMainWindow, public settings, public engineObject
{
Q_OBJECT
public:
trackContainer( void );
~trackContainer();
trackContainer( engine * _engine );
virtual ~trackContainer();
inline QWidget * containerWidget( void )
{
@@ -100,7 +102,9 @@ public:
void FASTCALL removeTrack( track * _track );
void FASTCALL moveTrackUp( track * _track );
void FASTCALL moveTrackDown( track * _track );
void FASTCALL realignTracks( bool _complete_update = FALSE );
void clearAllTracks( void );
const trackWidget * trackWidgetAt( const int _y ) const;

View File

@@ -1,7 +1,7 @@
/*
* visualization_widget.h - widget for visualization of sound-data
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -23,8 +23,8 @@
*/
#ifndef _OUTPUT_GRAPH_H
#define _OUTPUT_GRAPH_H
#ifndef _VISUALIZATION_WIDGET
#define _VISUALIZATION_WIDGET
#include "qt3support.h"
@@ -43,10 +43,11 @@
#include "mixer.h"
class QTimer;
class visualizationWidget : public QWidget
class visualizationWidget : public QWidget, public engineObject
{
Q_OBJECT
public:
@@ -55,6 +56,7 @@ public:
SIMPLE // add more here
} ;
visualizationWidget( const QPixmap & _bg, QWidget * _parent,
engine * _engine,
visualizationTypes _vtype = SIMPLE );
virtual ~visualizationWidget();