splitted source-files for FX-mixer and its view, create FX-mixer after song, improved layouting of FX-mixer and made FX-lines being organized in 4 banks instead of one big scrollarea
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@934 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
40
ChangeLog
40
ChangeLog
@@ -1,3 +1,43 @@
|
||||
2008-04-20 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* src/gui/widgets/group_box.cpp:
|
||||
* plugins/sf2_player/sf2_player.cpp:
|
||||
small cleanups
|
||||
|
||||
* data/themes/default/style.css:
|
||||
* include/fx_mixer_view.h:
|
||||
* src/gui/fx_mixer_view.cpp:
|
||||
improved layouting and made FX-lines being organized in 4 banks
|
||||
instead of one big scrollarea
|
||||
|
||||
* src/core/engine.cpp:
|
||||
create FX-mixer after song
|
||||
|
||||
* Makefile.am:
|
||||
* include/fx_mixer.h:
|
||||
* include/fx_mixer_view.h:
|
||||
* src/core/fx_mixer.cpp:
|
||||
* src/core/song.cpp:
|
||||
* src/gui/fx_mixer_view.cpp:
|
||||
splitted source-files for FX-mixer and its view
|
||||
|
||||
* include/fader.h:
|
||||
* src/gui/widgets/fader.cpp:
|
||||
made faders automatable
|
||||
|
||||
* include/song.h:
|
||||
made automation-track public accessible
|
||||
|
||||
* include/visualization_widget.h:
|
||||
* src/gui/widgets/visualization_widget.cpp:
|
||||
use new timer-framework
|
||||
|
||||
* include/song_editor.h:
|
||||
* src/gui/song_editor.cpp:
|
||||
added fast and leightweight timer-framework - widgets requiring
|
||||
periodic updates can simply connect their update-slots to
|
||||
songEditor::periodicUpdate()
|
||||
|
||||
2008-04-20 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* plugins/stereo_matrix/stereomatrix_controls.cpp:
|
||||
|
||||
@@ -74,7 +74,7 @@ lmms_MOC = \
|
||||
./fade_button.moc \
|
||||
./fader.moc \
|
||||
./file_browser.moc \
|
||||
./fx_mixer.moc \
|
||||
./fx_mixer_view.moc \
|
||||
./graph.moc \
|
||||
./group_box.moc \
|
||||
./instrument_functions.moc \
|
||||
@@ -225,6 +225,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/src/gui/embed.cpp \
|
||||
$(srcdir)/src/gui/export_project_dialog.cpp \
|
||||
$(srcdir)/src/gui/file_browser.cpp \
|
||||
$(srcdir)/src/gui/fx_mixer_view.cpp \
|
||||
$(srcdir)/src/gui/lfo_controller_dialog.cpp \
|
||||
$(srcdir)/src/gui/lmms_style.cpp \
|
||||
$(srcdir)/src/gui/main_window.cpp \
|
||||
@@ -315,6 +316,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/include/bb_track_container.h \
|
||||
$(srcdir)/include/piano.h \
|
||||
$(srcdir)/include/fx_mixer.h \
|
||||
$(srcdir)/include/fx_mixer_view.h \
|
||||
$(srcdir)/include/pixmap_button.h \
|
||||
$(srcdir)/include/rename_dialog.h \
|
||||
$(srcdir)/include/export_project_dialog.h \
|
||||
|
||||
@@ -41,3 +41,9 @@ trackWidget {
|
||||
QWidget#mainToolbar {
|
||||
background-image: url(resources:main_toolbar_bg.png);
|
||||
}
|
||||
|
||||
fxMixerView QPushButton {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,21 +30,34 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "types.h"
|
||||
#include "mv_base.h"
|
||||
#include "mixer.h"
|
||||
#include "effect_chain.h"
|
||||
#include "journalling_object.h"
|
||||
|
||||
|
||||
const int NumFxChannels = 64;
|
||||
|
||||
class fader;
|
||||
class fxLine;
|
||||
class effectRackView;
|
||||
class pixmapButton;
|
||||
struct fxChannel;
|
||||
|
||||
struct fxChannel
|
||||
{
|
||||
fxChannel( model * _parent );
|
||||
~fxChannel();
|
||||
|
||||
effectChain m_fxChain;
|
||||
bool m_used;
|
||||
bool m_stillRunning;
|
||||
float m_peakLeft;
|
||||
float m_peakRight;
|
||||
sampleFrame * m_buffer;
|
||||
boolModel m_muteModel;
|
||||
boolModel m_soloModel;
|
||||
floatModel m_volumeModel;
|
||||
QString m_name;
|
||||
QMutex m_lock;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class fxMixer : public journallingObject, public model
|
||||
@@ -82,41 +95,4 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
class fxMixerView : public QWidget, public modelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
fxMixerView();
|
||||
virtual ~fxMixerView();
|
||||
|
||||
fxLine * currentFxLine( void )
|
||||
{
|
||||
return( m_currentFxLine );
|
||||
}
|
||||
void setCurrentFxLine( fxLine * _line );
|
||||
|
||||
void clear( void );
|
||||
|
||||
|
||||
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[NumFxChannels+1];
|
||||
|
||||
QWidget * m_fxRackArea;
|
||||
fxLine * m_currentFxLine;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
80
include/fx_mixer_view.h
Normal file
80
include/fx_mixer_view.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* fx_mixer_view.h - effect-mixer-view for LMMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FX_MIXER_VIEW_H
|
||||
#define _FX_MIXER_VIEW_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "fx_mixer.h"
|
||||
|
||||
|
||||
class QStackedLayout;
|
||||
class fader;
|
||||
class fxLine;
|
||||
class effectRackView;
|
||||
class pixmapButton;
|
||||
|
||||
|
||||
|
||||
class fxMixerView : public QWidget, public modelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
fxMixerView();
|
||||
virtual ~fxMixerView();
|
||||
|
||||
fxLine * currentFxLine( void )
|
||||
{
|
||||
return( m_currentFxLine );
|
||||
}
|
||||
void setCurrentFxLine( fxLine * _line );
|
||||
|
||||
void clear( void );
|
||||
|
||||
|
||||
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[NumFxChannels+1];
|
||||
|
||||
QStackedLayout * m_fxRacksLayout;
|
||||
QStackedLayout * m_fxLineBanks;
|
||||
fxLine * m_currentFxLine;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "config_mgr.h"
|
||||
#include "controller_rack_view.h"
|
||||
#include "fx_mixer.h"
|
||||
#include "fx_mixer_view.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
#include "main_window.h"
|
||||
#include "mixer.h"
|
||||
@@ -74,15 +75,15 @@ void engine::init( const bool _has_gui )
|
||||
|
||||
s_projectJournal = new projectJournal;
|
||||
s_mixer = new mixer;
|
||||
s_fxMixer = new fxMixer;
|
||||
s_song = new song;
|
||||
s_fxMixer = new fxMixer;
|
||||
s_bbTrackContainer = new bbTrackContainer;
|
||||
|
||||
if( s_hasGUI )
|
||||
{
|
||||
s_mainWindow = new mainWindow;
|
||||
s_songEditor = new songEditor( s_song, s_songEditor );
|
||||
s_fxMixerView = new fxMixerView;
|
||||
s_songEditor = new songEditor( s_song );
|
||||
s_controllerRackView = new controllerRackView;
|
||||
s_projectNotes = new projectNotes;
|
||||
s_bbEditor = new bbEditor( s_bbTrackContainer );
|
||||
|
||||
@@ -25,61 +25,39 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QScrollBar>
|
||||
|
||||
#include "fx_mixer.h"
|
||||
#include "fader.h"
|
||||
#include "effect.h"
|
||||
#include "effect_chain.h"
|
||||
#include "effect_rack_view.h"
|
||||
#include "embed.h"
|
||||
#include "main_window.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "gui_templates.h"
|
||||
#include "song.h"
|
||||
|
||||
|
||||
struct fxChannel
|
||||
fxChannel::fxChannel( model * _parent ) :
|
||||
m_fxChain( NULL ),
|
||||
m_used( FALSE ),
|
||||
m_stillRunning( FALSE ),
|
||||
m_peakLeft( 0.0f ),
|
||||
m_peakRight( 0.0f ),
|
||||
m_buffer( new sampleFrame[engine::getMixer()->framesPerPeriod()] ),
|
||||
m_muteModel( FALSE, _parent ),
|
||||
m_soloModel( FALSE, _parent ),
|
||||
m_volumeModel( 1.0, 0.0, 2.0, 0.01, _parent ),
|
||||
m_name(),
|
||||
m_lock()
|
||||
{
|
||||
fxChannel( model * _parent ) :
|
||||
m_fxChain( NULL ),
|
||||
m_used( FALSE ),
|
||||
m_stillRunning( FALSE ),
|
||||
m_peakLeft( 0.0f ),
|
||||
m_peakRight( 0.0f ),
|
||||
m_buffer( new sampleFrame[
|
||||
engine::getMixer()->framesPerPeriod()] ),
|
||||
m_muteModel( FALSE, _parent ),
|
||||
m_soloModel( FALSE, _parent ),
|
||||
m_volumeModel( 1.0, 0.0, 2.0, 0.01, _parent ),
|
||||
m_name(),
|
||||
m_lock()
|
||||
{
|
||||
engine::getMixer()->clearAudioBuffer( m_buffer,
|
||||
engine::getMixer()->framesPerPeriod() );
|
||||
}
|
||||
~fxChannel()
|
||||
{
|
||||
delete[] m_buffer;
|
||||
}
|
||||
engine::getMixer()->clearAudioBuffer( m_buffer,
|
||||
engine::getMixer()->framesPerPeriod() );
|
||||
m_volumeModel.setTrack( engine::getSong()->getAutomationTrack() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fxChannel::~fxChannel()
|
||||
{
|
||||
delete[] m_buffer;
|
||||
}
|
||||
|
||||
|
||||
effectChain m_fxChain;
|
||||
bool m_used;
|
||||
bool m_stillRunning;
|
||||
float m_peakLeft;
|
||||
float m_peakRight;
|
||||
sampleFrame * m_buffer;
|
||||
boolModel m_muteModel;
|
||||
boolModel m_soloModel;
|
||||
floatModel m_volumeModel;
|
||||
QString m_name;
|
||||
QMutex m_lock;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -124,6 +102,7 @@ void fxMixer::mixToChannel( const sampleFrame * _buf, fx_ch_t _ch )
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixer::processChannel( fx_ch_t _ch )
|
||||
{
|
||||
if( m_fxChannels[_ch]->m_used || m_fxChannels[_ch]->m_stillRunning ||
|
||||
@@ -183,7 +162,9 @@ const surroundSampleFrame * fxMixer::masterMix( void )
|
||||
m_fxChannels[i]->m_used = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
processChannel( 0 );
|
||||
|
||||
const float v = m_fxChannels[0]->m_volumeModel.value();
|
||||
for( f_cnt_t f = 0; f < engine::getMixer()->framesPerPeriod(); ++f )
|
||||
{
|
||||
@@ -192,8 +173,10 @@ const surroundSampleFrame * fxMixer::masterMix( void )
|
||||
m_out[f][ch] = buf[f][ch%DEFAULT_CHANNELS] * v;
|
||||
}
|
||||
}
|
||||
|
||||
m_fxChannels[0]->m_peakLeft *= engine::getMixer()->masterGain();
|
||||
m_fxChannels[0]->m_peakRight *= engine::getMixer()->masterGain();
|
||||
|
||||
return( m_out );
|
||||
}
|
||||
|
||||
@@ -252,231 +235,4 @@ void fxMixer::loadSettings( const QDomElement & _this )
|
||||
}
|
||||
|
||||
|
||||
class fxLine : public QWidget
|
||||
{
|
||||
public:
|
||||
fxLine( QWidget * _parent, fxMixerView * _mv, QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
m_mv( _mv ),
|
||||
m_name( _name )
|
||||
{
|
||||
setFixedSize( 32, 232 );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, TRUE );
|
||||
}
|
||||
|
||||
virtual void paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
p.fillRect( rect(), QColor( 72, 76, 88 ) );
|
||||
/* p.setPen( QColor( 144, 152, 176 ) );
|
||||
p.drawLine( 0, 0, width()-1, 0 );
|
||||
p.drawLine( 0, 0, 0, height()-1 );
|
||||
p.setPen( QColor( 36, 38, 44 ) );
|
||||
p.drawLine( 0, height()-1, width()-1, height()-1 );
|
||||
p.drawLine( width()-1, 0, width()-1, height()-1 );*/
|
||||
p.setPen( QColor( 40, 42, 48 ) );
|
||||
p.drawRect( 0, 0, width()-2, height()-2 );
|
||||
p.setPen( QColor( 108, 114, 132 ) );
|
||||
p.drawRect( 1, 1, width()-2, height()-2 );
|
||||
p.setPen( QColor( 20, 24, 32 ) );
|
||||
p.drawRect( 0, 0, width()-1, height()-1 );
|
||||
|
||||
p.rotate( -90 );
|
||||
p.setPen( m_mv->currentFxLine() == this ?
|
||||
QColor( 0, 255, 0 ) : Qt::white );
|
||||
p.setFont( pointSizeF( font(), 7.5f ) );
|
||||
p.drawText( -70, 20, m_name );
|
||||
}
|
||||
|
||||
virtual void mousePressEvent( QMouseEvent * )
|
||||
{
|
||||
m_mv->setCurrentFxLine( this );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * )
|
||||
{
|
||||
bool ok;
|
||||
QString new_name = QInputDialog::getText( this,
|
||||
fxMixerView::tr( "Rename FX channel" ),
|
||||
fxMixerView::tr( "Enter the new name for this "
|
||||
"FX channel" ),
|
||||
QLineEdit::Normal, m_name, &ok );
|
||||
if( ok && !new_name.isEmpty() )
|
||||
{
|
||||
m_name = new_name;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
fxMixerView * m_mv;
|
||||
QString & m_name;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
fxMixerView::fxMixerView() :
|
||||
QWidget(),
|
||||
modelView( NULL )
|
||||
{
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
|
||||
fxMixer * m = engine::getFxMixer();
|
||||
|
||||
QPalette pal = palette();
|
||||
pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
|
||||
setPalette( pal );
|
||||
setAutoFillBackground( TRUE );
|
||||
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
|
||||
|
||||
setWindowTitle( tr( "FX-Mixer" ) );
|
||||
// setWindowIcon( embed::getIconPixmap( "fxmixer" ) );
|
||||
|
||||
QHBoxLayout * ml = new QHBoxLayout;
|
||||
ml->setMargin( 0 );
|
||||
ml->setSpacing( 0 );
|
||||
|
||||
QScrollArea * a = new QScrollArea( this );
|
||||
a->setFrameShape( QFrame::NoFrame );
|
||||
a->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
a->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
|
||||
a->setFixedHeight( 250 );
|
||||
ml->addWidget( a );
|
||||
|
||||
QWidget * base = new QWidget;
|
||||
QHBoxLayout * bl = new QHBoxLayout( base );
|
||||
bl->setSpacing( 0 );
|
||||
bl->setMargin( 0 );
|
||||
a->setWidget( base );
|
||||
|
||||
base->setFixedSize( (NumFxChannels+1)*33+6+10, 236 );
|
||||
pal = base->palette();
|
||||
pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
|
||||
base->setPalette( pal );
|
||||
base->setAutoFillBackground( TRUE );
|
||||
|
||||
|
||||
m_fxRackArea = new QWidget;
|
||||
ml->addSpacing( 10 );
|
||||
ml->addWidget( m_fxRackArea );
|
||||
setLayout( ml );
|
||||
|
||||
QHBoxLayout * fxl = new QHBoxLayout;
|
||||
fxl->setSpacing( 0 );
|
||||
fxl->setMargin( 0 );
|
||||
|
||||
|
||||
bl->addSpacing( 6 );
|
||||
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
fxChannelView * cv = &m_fxChannelViews[i];
|
||||
cv->m_fxLine = new fxLine( base, this,
|
||||
m->m_fxChannels[i]->m_name );
|
||||
bl->addWidget( cv->m_fxLine );
|
||||
bl->addSpacing( i == 0 ? 10 : 1 );
|
||||
lcdSpinBox * l = new lcdSpinBox( 2, cv->m_fxLine );
|
||||
l->model()->setRange( i, i );
|
||||
l->model()->setValue( i );
|
||||
l->move( 2, 4 );
|
||||
l->setMarginWidth( 1 );
|
||||
|
||||
cv->m_fader = new fader( &m->m_fxChannels[i]->m_volumeModel,
|
||||
cv->m_fxLine );
|
||||
cv->m_fader->move( 15-cv->m_fader->width()/2,
|
||||
cv->m_fxLine->height()-130 );
|
||||
cv->m_rackView = new effectRackView(
|
||||
&m->m_fxChannels[i]->m_fxChain, NULL );
|
||||
fxl->addWidget( cv->m_rackView );
|
||||
}
|
||||
fxl->addStretch();
|
||||
|
||||
m_fxRackArea->setLayout( fxl );
|
||||
|
||||
setCurrentFxLine( m_fxChannelViews[0].m_fxLine );
|
||||
|
||||
QTimer * t = new QTimer( this );
|
||||
connect( t, SIGNAL( timeout() ), this, SLOT( updateFaders() ) );
|
||||
t->start( 50 );
|
||||
|
||||
// we want to receive dataChanged-signals in order to update
|
||||
setModel( m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fxMixerView::~fxMixerView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixerView::setCurrentFxLine( fxLine * _line )
|
||||
{
|
||||
m_currentFxLine = _line;
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
if( m_fxChannelViews[i].m_fxLine == _line )
|
||||
{
|
||||
m_fxChannelViews[i].m_rackView->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fxChannelViews[i].m_rackView->hide();
|
||||
}
|
||||
m_fxChannelViews[i].m_fxLine->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixerView::clear( void )
|
||||
{
|
||||
for( int i = 0; i <= NumFxChannels; ++i )
|
||||
{
|
||||
m_fxChannelViews[i].m_rackView->clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixerView::updateFaders( void )
|
||||
{
|
||||
fxMixer * m = engine::getFxMixer();
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
const float opl = m_fxChannelViews[i].m_fader->getPeak_L();
|
||||
const float opr = m_fxChannelViews[i].m_fader->getPeak_R();
|
||||
const float fall_off = 1.1;
|
||||
if( m->m_fxChannels[i]->m_peakLeft > opl )
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_L(
|
||||
m->m_fxChannels[i]->m_peakLeft );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_L( opl/fall_off );
|
||||
}
|
||||
if( m->m_fxChannels[i]->m_peakRight > opr )
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_R(
|
||||
m->m_fxChannels[i]->m_peakRight );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_R( opr/fall_off );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "fx_mixer.moc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "envelope_and_lfo_parameters.h"
|
||||
#include "export_project_dialog.h"
|
||||
#include "fx_mixer.h"
|
||||
#include "fx_mixer_view.h"
|
||||
#include "import_filter.h"
|
||||
#include "instrument_track.h"
|
||||
#include "main_window.h"
|
||||
|
||||
296
src/gui/fx_mixer_view.cpp
Normal file
296
src/gui/fx_mixer_view.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* fx_mixer_view.cpp - effect-mixer-view for LMMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QStackedLayout>
|
||||
|
||||
#include "fx_mixer_view.h"
|
||||
#include "fader.h"
|
||||
#include "effect_rack_view.h"
|
||||
#include "embed.h"
|
||||
#include "main_window.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "gui_templates.h"
|
||||
#include "song_editor.h"
|
||||
|
||||
|
||||
|
||||
class fxLine : public QWidget
|
||||
{
|
||||
public:
|
||||
fxLine( QWidget * _parent, fxMixerView * _mv, QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
m_mv( _mv ),
|
||||
m_name( _name )
|
||||
{
|
||||
setFixedSize( 32, 232 );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, TRUE );
|
||||
}
|
||||
|
||||
virtual void paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
p.fillRect( rect(), QColor( 72, 76, 88 ) );
|
||||
/* p.setPen( QColor( 144, 152, 176 ) );
|
||||
p.drawLine( 0, 0, width()-1, 0 );
|
||||
p.drawLine( 0, 0, 0, height()-1 );
|
||||
p.setPen( QColor( 36, 38, 44 ) );
|
||||
p.drawLine( 0, height()-1, width()-1, height()-1 );
|
||||
p.drawLine( width()-1, 0, width()-1, height()-1 );*/
|
||||
p.setPen( QColor( 40, 42, 48 ) );
|
||||
p.drawRect( 0, 0, width()-2, height()-2 );
|
||||
p.setPen( QColor( 108, 114, 132 ) );
|
||||
p.drawRect( 1, 1, width()-2, height()-2 );
|
||||
p.setPen( QColor( 20, 24, 32 ) );
|
||||
p.drawRect( 0, 0, width()-1, height()-1 );
|
||||
|
||||
p.rotate( -90 );
|
||||
p.setPen( m_mv->currentFxLine() == this ?
|
||||
QColor( 0, 255, 0 ) : Qt::white );
|
||||
p.setFont( pointSizeF( font(), 7.5f ) );
|
||||
p.drawText( -70, 20, m_name );
|
||||
}
|
||||
|
||||
virtual void mousePressEvent( QMouseEvent * )
|
||||
{
|
||||
m_mv->setCurrentFxLine( this );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * )
|
||||
{
|
||||
bool ok;
|
||||
QString new_name = QInputDialog::getText( this,
|
||||
fxMixerView::tr( "Rename FX channel" ),
|
||||
fxMixerView::tr( "Enter the new name for this "
|
||||
"FX channel" ),
|
||||
QLineEdit::Normal, m_name, &ok );
|
||||
if( ok && !new_name.isEmpty() )
|
||||
{
|
||||
m_name = new_name;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
fxMixerView * m_mv;
|
||||
QString & m_name;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
fxMixerView::fxMixerView() :
|
||||
QWidget(),
|
||||
modelView( NULL )
|
||||
{
|
||||
fxMixer * m = engine::getFxMixer();
|
||||
|
||||
QPalette pal = palette();
|
||||
pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
|
||||
setPalette( pal );
|
||||
setAutoFillBackground( TRUE );
|
||||
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
|
||||
|
||||
setWindowTitle( tr( "FX-Mixer" ) );
|
||||
// setWindowIcon( embed::getIconPixmap( "fxmixer" ) );
|
||||
|
||||
m_fxLineBanks = new QStackedLayout;
|
||||
m_fxLineBanks->setSpacing( 0 );
|
||||
m_fxLineBanks->setMargin( 1 );
|
||||
|
||||
m_fxRacksLayout = new QStackedLayout;
|
||||
m_fxRacksLayout->setSpacing( 0 );
|
||||
m_fxRacksLayout->setMargin( 0 );
|
||||
|
||||
// main-layout
|
||||
QHBoxLayout * ml = new QHBoxLayout;
|
||||
ml->setMargin( 0 );
|
||||
ml->setSpacing( 0 );
|
||||
ml->addSpacing( 6 );
|
||||
|
||||
|
||||
QHBoxLayout * banks[NumFxChannels/16];
|
||||
for( int i = 0; i < NumFxChannels/16; ++i )
|
||||
{
|
||||
QWidget * w = new QWidget( this );
|
||||
banks[i] = new QHBoxLayout( w );
|
||||
banks[i]->setMargin( 5 );
|
||||
banks[i]->setSpacing( 1 );
|
||||
m_fxLineBanks->addWidget( w );
|
||||
}
|
||||
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
fxChannelView * cv = &m_fxChannelViews[i];
|
||||
if( i == 0 )
|
||||
{
|
||||
cv->m_fxLine = new fxLine( NULL, this,
|
||||
m->m_fxChannels[i]->m_name );
|
||||
ml->addWidget( cv->m_fxLine );
|
||||
ml->addSpacing( 10 );
|
||||
}
|
||||
else
|
||||
{
|
||||
const int bank = (i-1) / 16;
|
||||
cv->m_fxLine = new fxLine( NULL, this,
|
||||
m->m_fxChannels[i]->m_name );
|
||||
banks[bank]->addWidget( cv->m_fxLine );
|
||||
}
|
||||
lcdSpinBox * l = new lcdSpinBox( 2, cv->m_fxLine );
|
||||
l->model()->setRange( i, i );
|
||||
l->model()->setValue( i );
|
||||
l->move( 2, 4 );
|
||||
l->setMarginWidth( 1 );
|
||||
|
||||
cv->m_fader = new fader( &m->m_fxChannels[i]->m_volumeModel,
|
||||
cv->m_fxLine );
|
||||
cv->m_fader->move( 15-cv->m_fader->width()/2,
|
||||
cv->m_fxLine->height()-130 );
|
||||
cv->m_rackView = new effectRackView(
|
||||
&m->m_fxChannels[i]->m_fxChain, this );
|
||||
m_fxRacksLayout->addWidget( cv->m_rackView );
|
||||
if( i == 0 )
|
||||
{
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->addSpacing( 10 );
|
||||
QButtonGroup * g = new QButtonGroup( this );
|
||||
g->setExclusive( TRUE );
|
||||
for( int j = 0; j < 4; ++j )
|
||||
{
|
||||
QToolButton * btn = new QToolButton;
|
||||
btn->setText( QString( 'A'+j ) );
|
||||
btn->setCheckable( TRUE );
|
||||
l->addWidget( btn );
|
||||
g->addButton( btn, j );
|
||||
btn->setChecked( j == 0);
|
||||
}
|
||||
l->addStretch( 1 );
|
||||
ml->addLayout( l );
|
||||
connect( g, SIGNAL( buttonClicked( int ) ),
|
||||
m_fxLineBanks, SLOT( setCurrentIndex( int ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
ml->addLayout( m_fxLineBanks );
|
||||
ml->addLayout( m_fxRacksLayout );
|
||||
|
||||
setLayout( ml );
|
||||
updateGeometry();
|
||||
|
||||
m_fxLineBanks->setCurrentIndex( 0 );
|
||||
setCurrentFxLine( m_fxChannelViews[0].m_fxLine );
|
||||
|
||||
// timer for updating faders
|
||||
connect( engine::getSongEditor(), SIGNAL( periodicUpdate() ),
|
||||
this, SLOT( updateFaders() ) );
|
||||
|
||||
|
||||
// add ourself to workspace
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
|
||||
// we want to receive dataChanged-signals in order to update
|
||||
setModel( m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fxMixerView::~fxMixerView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixerView::setCurrentFxLine( fxLine * _line )
|
||||
{
|
||||
m_currentFxLine = _line;
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
if( m_fxChannelViews[i].m_fxLine == _line )
|
||||
{
|
||||
m_fxRacksLayout->setCurrentIndex( i );
|
||||
}
|
||||
m_fxChannelViews[i].m_fxLine->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixerView::clear( void )
|
||||
{
|
||||
for( int i = 0; i <= NumFxChannels; ++i )
|
||||
{
|
||||
m_fxChannelViews[i].m_rackView->clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fxMixerView::updateFaders( void )
|
||||
{
|
||||
fxMixer * m = engine::getFxMixer();
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
const float opl = m_fxChannelViews[i].m_fader->getPeak_L();
|
||||
const float opr = m_fxChannelViews[i].m_fader->getPeak_R();
|
||||
const float fall_off = 1.2;
|
||||
if( m->m_fxChannels[i]->m_peakLeft > opl )
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_L(
|
||||
m->m_fxChannels[i]->m_peakLeft );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_L( opl/fall_off );
|
||||
}
|
||||
if( m->m_fxChannels[i]->m_peakRight > opr )
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_R(
|
||||
m->m_fxChannels[i]->m_peakRight );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_R( opr/fall_off );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "fx_mixer_view.moc"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user