Skip to content

Commit

Permalink
Merge pull request #1572 from badosu/assign-instrument-to-fx-channel
Browse files Browse the repository at this point in the history
Add "Assign to FX Channel" context button to track
  • Loading branch information
tresf committed Jan 13, 2015
2 parents 21f5bb0 + 2eb420c commit 6e899d3
Show file tree
Hide file tree
Showing 22 changed files with 202 additions and 6 deletions.
8 changes: 8 additions & 0 deletions data/locale/ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7930,6 +7930,14 @@ Latència: %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7932,6 +7932,14 @@ Zpoždění %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8177,6 +8177,14 @@ Latenz: %2 ms</translation>
<source>Clear this track</source>
<translation>Diese Spur leeren</translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>vestigeInstrument</name>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7969,6 +7969,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7912,6 +7912,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/fa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7911,6 +7911,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7946,6 +7946,14 @@ Latence : %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7945,6 +7945,14 @@ Latencia: %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7970,6 +7970,14 @@ Latenza: %2 ms</translation>
<source>Clear this track</source>
<translation>Pulisci questa traccia</translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation>Accendi tutti i processi di registrazione</translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7947,6 +7947,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished">このトラックをクリア</translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7916,6 +7916,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7915,6 +7915,14 @@ Vertraging: %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7951,6 +7951,14 @@ Latencja: %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7949,6 +7949,14 @@ Latência: %2 ms</translation>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation>Associar a um novo Mixer de Efeitos</translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7984,6 +7984,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7914,6 +7914,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 8 additions & 0 deletions data/locale/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7924,6 +7924,14 @@ Latency: %2 ms</source>
<source>Clear this track</source>
<translation>清除此轨道</translation>
</message>
<message>
<source>Assign to new FX Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FX %1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn all recording on</source>
<translation>打开所有录制</translation>
Expand Down
5 changes: 5 additions & 0 deletions include/FxMixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ class EXPORT FxMixer : public Model, public JournallingObject
return m_fxChannels.size();
}

inline QVector<FxChannel *> fxChannels() const
{
return m_fxChannels;
}

FxRouteVector m_fxRoutes;

private:
Expand Down
4 changes: 3 additions & 1 deletion include/FxMixerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ class EXPORT FxMixerView : public QWidget, public ModelView,
// useful for loading projects
void refreshDisplay();

public slots:
int addNewChannel();

protected:
virtual void closeEvent( QCloseEvent * _ce );

private slots:
void updateFaders();
void addNewChannel();
void toggledSolo();

private:
Expand Down
3 changes: 3 additions & 0 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QWidget>
#include <QSignalMapper>
#include <QColor>
#include <QMimeData>

Expand Down Expand Up @@ -390,6 +391,8 @@ private slots:
void recordingOn();
void recordingOff();
void clearTrack();
void assignFxLine( int channelIndex );
void createFxLine();

private:
static QPixmap * s_grip;
Expand Down
56 changes: 52 additions & 4 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "FxMixerView.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
#include "MainWindow.h"
Expand Down Expand Up @@ -1706,6 +1707,29 @@ void TrackOperationsWidget::clearTrack()



/*! \brief Create and assign a new FX Channel for this track */
void TrackOperationsWidget::createFxLine()
{
int channelIndex = gui->fxMixerView()->addNewChannel();

Engine::fxMixer()->effectChannel( channelIndex )->m_name = m_trackView->getTrack()->name();

assignFxLine(channelIndex);
}



/*! \brief Assign a specific FX Channel for this track */
void TrackOperationsWidget::assignFxLine(int channelIndex)
{
Track * track = m_trackView->getTrack();
dynamic_cast<InstrumentTrack *>( track )->effectChannelModel()->setValue( channelIndex );

gui->fxMixerView()->setCurrentFxLine( channelIndex );
}



/*! \brief Remove this track from the track list
*
*/
Expand Down Expand Up @@ -1740,12 +1764,36 @@ void TrackOperationsWidget::updateMenu()
{
to_menu->addAction( tr( "Clear this track" ), this, SLOT( clearTrack() ) );
}

if( dynamic_cast<InstrumentTrackView *>( m_trackView ) )
if( InstrumentTrackView * trackView = dynamic_cast<InstrumentTrackView *>( m_trackView ) )
{
int channelIndex = trackView->model()->effectChannelModel()->value();

FxChannel * fxChannel = Engine::fxMixer()->effectChannel( channelIndex );

QMenu * fxMenu = new QMenu( tr( "FX %1: %2" ).arg( channelIndex ).arg( fxChannel->m_name ), to_menu );
QSignalMapper * fxMenuSignalMapper = new QSignalMapper(this);

fxMenu->addAction("Assign to new FX Channel" , this, SLOT( createFxLine() ) );
fxMenu->addSeparator();


for (int i = 0; i < Engine::fxMixer()->fxChannels().size(); ++i)
{
FxChannel * currentChannel = Engine::fxMixer()->fxChannels()[i];

if ( currentChannel != fxChannel )
{
QString label = tr( "FX %1: %2" ).arg( currentChannel->m_channelIndex ).arg( currentChannel->m_name );
QAction * action = fxMenu->addAction( label, fxMenuSignalMapper, SLOT( map() ) );
fxMenuSignalMapper->setMapping(action, currentChannel->m_channelIndex);
}
}

to_menu->addMenu(fxMenu);
connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int)));

to_menu->addSeparator();
to_menu->addMenu( dynamic_cast<InstrumentTrackView *>(
m_trackView )->midiMenu() );
to_menu->addMenu( trackView->midiMenu() );
}
if( dynamic_cast<AutomationTrackView *>( m_trackView ) )
{
Expand Down
4 changes: 3 additions & 1 deletion src/gui/FxMixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ FxMixerView::~FxMixerView()



void FxMixerView::addNewChannel()
int FxMixerView::addNewChannel()
{
// add new fx mixer channel and redraw the form.
FxMixer * mix = Engine::fxMixer();
Expand All @@ -186,6 +186,8 @@ void FxMixerView::addNewChannel()
updateFxLine(newChannelIndex);

updateMaxChannelSelector();

return newChannelIndex;
}


Expand Down

0 comments on commit 6e899d3

Please sign in to comment.