added initial FX-mixer implementation - not perfect and very usable yet but the basics work so far

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@789 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-03-14 21:45:10 +00:00
parent a4f3d5d267
commit b682b30146
17 changed files with 864 additions and 67 deletions

View File

@@ -32,7 +32,7 @@
class effectChain : public journallingObject, public model
{
public:
effectChain( audioPort * _port, track * _track );
effectChain( track * _track );
virtual ~effectChain();
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
@@ -52,11 +52,6 @@ public:
void startRunning( void );
bool isRunning( void );
/* inline const effect_list_t & getEffects( void )
{
return( m_effects );
}*/
void deleteAllPlugins( void );
@@ -64,7 +59,6 @@ private:
typedef QVector<effect *> effectList;
effectList m_effects;
audioPort * m_port;
track * m_track;
boolModel m_enabledModel;

View File

@@ -35,6 +35,8 @@
class automationEditor;
class bbEditor;
class bbTrackContainer;
class fxMixer;
class fxMixerView;
class projectJournal;
class mainWindow;
class mixer;
@@ -62,6 +64,11 @@ public:
return( s_mixer );
}
static fxMixer * getFxMixer( void )
{
return( s_fxMixer );
}
static song * getSong( void )
{
return( s_song );
@@ -83,6 +90,11 @@ public:
return( s_mainWindow );
}
static fxMixerView * getFxMixerView( void )
{
return( s_fxMixerView );
}
static songEditor * getSongEditor( void )
{
return( s_songEditor );
@@ -131,12 +143,14 @@ private:
// core
static mixer * s_mixer;
static fxMixer * s_fxMixer;
static song * s_song;
static bbTrackContainer * s_bbTrackContainer;
static projectJournal * s_projectJournal;
// GUI
static mainWindow * s_mainWindow;
static fxMixerView * s_fxMixerView;
static songEditor * s_songEditor;
static automationEditor * s_automationEditor;
static bbEditor * s_bbEditor;

93
include/fader.h Normal file
View File

@@ -0,0 +1,93 @@
/*
* fader.h - fader-widget used in FX-mixer - partly taken from Hydrogen
*
* Copyright (c) 2008 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
/*
* Hydrogen
* Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
*
* http://www.hydrogen-music.org
*
* 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; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _FADER_H
#define _FADER_H
#include <QtGui/QWidget>
#include <QtGui/QPixmap>
#include "automatable_model.h"
class fader : public QWidget, public floatModelView
{
Q_OBJECT
public:
fader( floatModel * _model, QWidget * _parent );
virtual ~fader();
void setMaxPeak( float _max );
void setMinPeak( float _min );
void setPeak_L( float peak );
float getPeak_L() { return m_fPeakValue_L; }
void setPeak_R( float peak );
float getPeak_R() { return m_fPeakValue_R; }
private:
virtual void mousePressEvent( QMouseEvent *ev );
virtual void mouseMoveEvent( QMouseEvent *ev );
virtual void wheelEvent( QWheelEvent *ev );
virtual void paintEvent( QPaintEvent *ev );
floatModel * m_model;
float m_fPeakValue_L;
float m_fPeakValue_R;
float m_fMinPeak;
float m_fMaxPeak;
QPixmap m_back;
QPixmap m_leds;
QPixmap m_knob;
} ;
#endif

View File

@@ -30,15 +30,22 @@
#include <config.h>
#endif
#include <QtGui/QWidget>
#include "types.h"
#include "effect_chain.h"
#include "mv_base.h"
#include "mixer.h"
#include "journalling_object.h"
const int NUM_FX_CHANNELS = 64;
class fader;
class fxLine;
class effectRackView;
class pixmapButton;
struct fxChannel;
class fxMixer : public journallingObject, public model
{
@@ -49,7 +56,8 @@ public:
void mixToChannel( const surroundSampleFrame * _buf, fx_ch_t _ch );
void processChannel( fx_ch_t _ch );
void masterMix( surroundSampleFrame * _dest );
void prepareMasterMix( void );
const surroundSampleFrame * masterMix( void );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
@@ -62,17 +70,7 @@ public:
private:
struct fxChannel
{
effectChain m_fxChain;
surroundSampleFrame * m_buffer;
boolModel m_muteModel;
boolModel m_soloModel;
QMutex m_lock;
} ;
fxChannel m_fxChannels[NUM_FX_CHANNELS];
fxChannel m_masterChannel;
fxChannel * m_fxChannels[NUM_FX_CHANNELS+1]; // +1 = master
friend class mixerWorkerThread;
@@ -83,20 +81,36 @@ private:
class fxMixerView : public QWidget, public modelView
{
Q_OBJECT
public:
fxMixerView();
virtual ~fxMixerView();
fxLine * currentFxLine( void )
{
return( m_currentFxLine );
}
void setCurrentFxLine( fxLine * _line );
private slots:
void updateFaders( void );
private:
struct fxChannelView
{
fxLine * m_fxLine;
effectRackView * m_rackView;
pixmapButton * m_muteButton;
pixmapButton * m_soloButton;
fader * m_fader;
} ;
fxChannelView m_fxChannelViews[NUM_FX_CHANNELS];
fxChannelView m_masterChannelView;
fxChannelView m_fxChannelViews[NUM_FX_CHANNELS+1];
QWidget * m_fxRackArea;
fxLine * m_currentFxLine;
} ;

View File

@@ -1,7 +1,7 @@
/*
* mixer.h - audio-device-independent mixer for LMMS
*
* 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
*
@@ -286,6 +286,10 @@ public:
const f_cnt_t _offset = 0 );
#endif
float peakValueLeft( surroundSampleFrame * _ab, const f_cnt_t _frames );
float peakValueRight( surroundSampleFrame * _ab, const f_cnt_t _frames );
bool criticalXRuns( void ) const;
const surroundSampleFrame * nextBuffer( void )