summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog3
-rw-r--r--muse2/muse/app.cpp6
-rw-r--r--muse2/muse/app.h5
-rw-r--r--muse2/muse/arranger/tlist.cpp2
-rw-r--r--muse2/muse/audiotrack.cpp40
-rw-r--r--muse2/muse/song.h2
-rw-r--r--muse2/muse/synth.cpp14
-rw-r--r--muse2/muse/synth.h3
-rw-r--r--muse2/muse/track.cpp13
-rw-r--r--muse2/muse/track.h37
-rw-r--r--muse2/muse/widgets/CMakeLists.txt4
-rw-r--r--muse2/muse/widgets/visibletracks.cpp113
-rw-r--r--muse2/muse/widgets/visibletracks.h49
13 files changed, 279 insertions, 12 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index db63a184..7795f353 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+01.03.2011:
+ - Added feature to show/hide track-types from arranger, this far only with toolbuttons
+ and no persistent storage (rj)
28.02.2011:
- Added progress dialog for loading projects (rj)
- Aligned meters on mixer strip (rj)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index a2b5102a..0a8bb658 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -52,6 +52,8 @@
#include "waveedit.h"
#include "widgets/projectcreateimpl.h"
#include "widgets/menutitleitem.h"
+#include "tools.h"
+#include "visibletracks.h"
#ifdef DSSI_SUPPORT
#include "dssihost.h"
@@ -1248,6 +1250,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
panicToolbar->setObjectName("Panic");
panicToolbar->addAction(panicAction);
+ visTracks = new VisibleTracks(this);
+ addToolBar(visTracks);
+
//rlimit lim;
//getrlimit(RLIMIT_RTPRIO, &lim);
@@ -1487,6 +1492,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
setCentralWidget(arranger);
connect(tools1, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int)));
+ connect(visTracks, SIGNAL(visibilityChanged()), song, SLOT(update()) );
connect(arranger, SIGNAL(editPart(Track*)), SLOT(startEditor(Track*)));
connect(arranger, SIGNAL(dropSongFile(const QString&)), SLOT(loadProjectFile(const QString&)));
connect(arranger, SIGNAL(dropMidiFile(const QString&)), SLOT(importMidi(const QString&)));
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index 9d758fc2..77b1794e 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -11,7 +11,7 @@
#include "config.h"
#include "cobject.h"
-#include "tools.h"
+//#include "tools.h"
#include <QFileInfo>
@@ -27,6 +27,8 @@ class QString;
class QToolBar;
class QToolButton;
class QProgressDialog;
+class VisibleTracks;
+class EditToolBar;
class Part;
class PartList;
@@ -145,6 +147,7 @@ class MusE : public QMainWindow
QFileInfo project;
QToolBar *tools;
EditToolBar *tools1;
+ VisibleTracks *visTracks;
Transport* transport;
BigTime* bigtime;
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index 4a9d3d32..b13f2ab0 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -175,6 +175,8 @@ void TList::paint(const QRect& r)
Track* track = *i;
Track::TrackType type = track->type();
int trackHeight = track->height();
+ if (trackHeight==0) // not visible
+ continue;
if (yy >= (y + h))
break;
if ((yy + trackHeight) < y)
diff --git a/muse2/muse/audiotrack.cpp b/muse2/muse/audiotrack.cpp
index 11404993..28020caf 100644
--- a/muse2/muse/audiotrack.cpp
+++ b/muse2/muse/audiotrack.cpp
@@ -21,6 +21,12 @@
#include "plugin.h"
#include "audiodev.h"
+bool AudioAux::_isVisible=true;
+bool AudioInput::_isVisible=true;
+bool AudioOutput::_isVisible=true;
+bool AudioGroup::_isVisible = true;
+bool WaveTrack::_isVisible=true;
+
// By T356. For caching jack in/out routing names BEFORE file save.
// Jack often shuts down during file save, causing the routes to be lost in the file.
// cacheJackRouteNames() is ONLY called from MusE::save() in app.cpp
@@ -1667,3 +1673,37 @@ void AudioTrack::setAuxSend(int idx, double v)
_auxSend[idx] = v;
}
+//---------------------------------------------------------
+// height
+//---------------------------------------------------------
+int AudioOutput::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+int AudioInput::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+int AudioAux::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+int AudioGroup::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+int WaveTrack::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
index adcbc0ae..c735dfd5 100644
--- a/muse2/muse/song.h
+++ b/muse2/muse/song.h
@@ -170,7 +170,6 @@ class Song : public QObject {
// If clear_all is false, it will not touch things like midi ports.
void clear(bool signal, bool clear_all = true);
- void update(int flags = -1);
void cleanupForQuit();
int globalPitchShift() const { return _globalPitchShift; }
@@ -363,6 +362,7 @@ class Song : public QObject {
void executeScript(const char* scriptfile, PartList* parts, int quant, bool onlyIfSelected);
public slots:
+ void update(int flags = -1);
void beat();
void undo();
diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp
index 72785c02..349707c9 100644
--- a/muse2/muse/synth.cpp
+++ b/muse2/muse/synth.cpp
@@ -39,6 +39,7 @@
std::vector<Synth*> synthis; // array of available synthis
extern void connectNodes(AudioTrack*, AudioTrack*);
+bool SynthI::_isVisible=true;
/*
//---------------------------------------------------------
@@ -242,6 +243,18 @@ SynthI::SynthI()
setPan(0.0);
}
+
+//---------------------------------------------------------
+// height in arranger
+//---------------------------------------------------------
+int SynthI::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+
+
//---------------------------------------------------------
// open
//---------------------------------------------------------
@@ -989,3 +1002,4 @@ bool MessSynthIF::putEvent(const MidiPlayEvent& ev)
return _mess->processEvent(ev);
return true;
}
+
diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h
index 1e06682c..9053f7af 100644
--- a/muse2/muse/synth.h
+++ b/muse2/muse/synth.h
@@ -153,6 +153,7 @@ class SynthIF {
class SynthI : public AudioTrack, public MidiDevice,
public MidiInstrument
{
+ static bool _isVisible;
SynthIF* _sif;
protected:
@@ -246,6 +247,8 @@ class SynthI : public AudioTrack, public MidiDevice,
void deactivate3();
bool isActivated() const { return synthesizer && _sif; }
virtual bool hasAuxSend() const { return true; }
+ static void setVisible(bool t) { _isVisible = t; }
+ virtual int height() const;
};
//---------------------------------------------------------
diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp
index bd3d7548..6f83357a 100644
--- a/muse2/muse/track.cpp
+++ b/muse2/muse/track.cpp
@@ -18,6 +18,9 @@
#include "globaldefs.h"
#include "route.h"
+bool MidiTrack::_isVisible=true;
+bool Track::_isVisible=true;
+
unsigned int Track::_soloRefCnt = 0;
Track* Track::_tmpSoloChainTrack = 0;
bool Track::_tmpSoloChainDoIns = false;
@@ -415,6 +418,16 @@ void MidiTrack::init()
}
//---------------------------------------------------------
+// height
+//---------------------------------------------------------
+int MidiTrack::height() const
+{
+ if (_isVisible)
+ return _height;
+ return 0;
+}
+
+//---------------------------------------------------------
// setOutChanAndUpdate
//---------------------------------------------------------
diff --git a/muse2/muse/track.h b/muse2/muse/track.h
index 531dd2d5..dbd6bbcf 100644
--- a/muse2/muse/track.h
+++ b/muse2/muse/track.h
@@ -45,6 +45,7 @@ class Track {
PartList _parts;
void init();
+ static bool _isVisible;
protected:
static unsigned int _soloRefCnt;
@@ -98,7 +99,7 @@ class Track {
int y() const;
void setY(int n) { _y = n; }
- int height() const { return _height; }
+ virtual int height() const = 0;
void setHeight(int n) { _height = n; }
bool selected() const { return _selected; }
@@ -186,6 +187,8 @@ class Track {
virtual bool canRecord() const { return false; }
virtual AutomationType automationType() const = 0;
virtual void setAutomationType(AutomationType t) = 0;
+ static void setVisible(bool t) { }
+
};
//---------------------------------------------------------
@@ -205,6 +208,7 @@ class MidiTrack : public Track {
EventList* _events; // tmp Events during midi import
MPEventList* _mpevents; // tmp Events druring recording
+ static bool _isVisible;
public:
MidiTrack();
@@ -232,6 +236,7 @@ class MidiTrack : public Track {
virtual void read(Xml&);
virtual void write(int, Xml&) const;
+ virtual int height() const;
virtual MidiTrack* newTrack() const { return new MidiTrack(); }
//virtual MidiTrack* clone() const { return new MidiTrack(*this); }
virtual MidiTrack* clone(bool cloneParts) const { return new MidiTrack(*this, cloneParts); }
@@ -267,6 +272,7 @@ class MidiTrack : public Track {
//bool soloMode() const { return _soloRefCnt; }
virtual bool canRecord() const { return true; }
+ static void setVisible(bool t) { _isVisible = t; }
};
//---------------------------------------------------------
@@ -299,6 +305,7 @@ class AudioTrack : public Track {
//void readRecfile(Xml& xml);
void readAuxSend(Xml& xml);
+
protected:
float** outBuffers;
//float* outBuffers[MAX_CHANNELS];
@@ -425,6 +432,7 @@ class AudioTrack : public Track {
class AudioInput : public AudioTrack {
void* jackPorts[MAX_CHANNELS];
virtual bool getData(unsigned, int, unsigned, float**);
+ static bool _isVisible;
public:
AudioInput();
@@ -441,7 +449,9 @@ class AudioInput : public AudioTrack {
void setJackPort(int channel, void*p) { jackPorts[channel] = p; }
virtual void setChannels(int n);
virtual bool hasAuxSend() const { return true; }
- };
+ static void setVisible(bool t) { _isVisible = t; }
+ virtual int height() const;
+ };
//---------------------------------------------------------
// AudioOutput
@@ -452,6 +462,7 @@ class AudioOutput : public AudioTrack {
float* buffer[MAX_CHANNELS];
float* buffer1[MAX_CHANNELS];
unsigned long _nframes;
+ static bool _isVisible;
float* _monitorBuffer[MAX_CHANNELS];
@@ -470,7 +481,6 @@ class AudioOutput : public AudioTrack {
void setJackPort(int channel, void*p) { jackPorts[channel] = p; }
virtual void setChannels(int n);
// virtual bool isMute() const;
-
void processInit(unsigned);
void process(unsigned pos, unsigned offset, unsigned);
void processWrite();
@@ -478,13 +488,16 @@ class AudioOutput : public AudioTrack {
virtual bool canRecord() const { return true; }
float** monitorBuffer() { return _monitorBuffer; }
- };
+ static void setVisible(bool t) { _isVisible = t; }
+ virtual int height() const;
+ };
//---------------------------------------------------------
// AudioGroup
//---------------------------------------------------------
class AudioGroup : public AudioTrack {
+ static bool _isVisible;
public:
AudioGroup() : AudioTrack(AUDIO_GROUP) { }
//AudioGroup* clone() const { return new AudioGroup(*this); }
@@ -493,7 +506,9 @@ class AudioGroup : public AudioTrack {
virtual void read(Xml&);
virtual void write(int, Xml&) const;
virtual bool hasAuxSend() const { return true; }
- };
+ static void setVisible(bool t) { _isVisible = t; }
+ virtual int height() const;
+ };
//---------------------------------------------------------
// AudioAux
@@ -501,7 +516,7 @@ class AudioGroup : public AudioTrack {
class AudioAux : public AudioTrack {
float* buffer[MAX_CHANNELS];
-
+ static bool _isVisible;
public:
AudioAux();
//AudioAux* clone() const { return new AudioAux(*this); }
@@ -513,7 +528,9 @@ class AudioAux : public AudioTrack {
virtual bool getData(unsigned, int, unsigned, float**);
virtual void setChannels(int n);
float** sendBuffer() { return buffer; }
- };
+ static void setVisible(bool t) { _isVisible = t; }
+ virtual int height() const;
+ };
//---------------------------------------------------------
// WaveTrack
@@ -521,9 +538,9 @@ class AudioAux : public AudioTrack {
class WaveTrack : public AudioTrack {
Fifo _prefetchFifo; // prefetch Fifo
+ static bool _isVisible;
public:
- static bool firstWaveTrack;
WaveTrack() : AudioTrack(Track::WAVE) { }
//WaveTrack(const WaveTrack& wt) : AudioTrack(wt) {}
@@ -548,7 +565,9 @@ class WaveTrack : public AudioTrack {
virtual bool hasAuxSend() const { return true; }
bool canEnableRecord() const;
virtual bool canRecord() const { return true; }
- };
+ static void setVisible(bool t) { _isVisible = t; }
+ virtual int height() const;
+ };
//---------------------------------------------------------
// TrackList
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt
index cb3125d0..e3921f70 100644
--- a/muse2/muse/widgets/CMakeLists.txt
+++ b/muse2/muse/widgets/CMakeLists.txt
@@ -76,7 +76,8 @@ QT4_WRAP_CPP (widget_mocs
ttoolbutton.h
velocity.h
view.h
- vscale.h
+ vscale.h
+ visibletracks.h
)
##
@@ -175,6 +176,7 @@ file (GLOB widgets_source_files
velocity.cpp
view.cpp
vscale.cpp
+ visibletracks.cpp
)
##
diff --git a/muse2/muse/widgets/visibletracks.cpp b/muse2/muse/widgets/visibletracks.cpp
new file mode 100644
index 00000000..b2a88d1c
--- /dev/null
+++ b/muse2/muse/widgets/visibletracks.cpp
@@ -0,0 +1,113 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tools.cpp,v 1.2 2004/04/28 21:56:13 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+// (C) Copyright 2011 Robert Jonsson (rj@spamatica.se)
+//=========================================================
+
+#include <QActionGroup>
+
+#include <stdio.h>
+#include "visibletracks.h"
+#include "icons.h"
+#include "action.h"
+#include "track.h"
+#include "synth.h"
+
+const char* waveTrack = QT_TRANSLATE_NOOP("@default", "Show wave tracks");
+const char* groupTrack = QT_TRANSLATE_NOOP("@default", "Show group tracks");
+const char* auxTrack = QT_TRANSLATE_NOOP("@default", "Show aux tracks");
+const char* inputTrack = QT_TRANSLATE_NOOP("@default", "Show input tracks");
+const char* outputTrack = QT_TRANSLATE_NOOP("@default", "Show output tracks");
+const char* midiTrack = QT_TRANSLATE_NOOP("@default", "Show midi tracks");
+const char* synthTrack = QT_TRANSLATE_NOOP("@default", "Show synth tracks");
+
+VisibleToolB visTrackList[] = {
+ {&addtrack_wavetrackIcon, QT_TRANSLATE_NOOP("@default", "Show wave tracks"), waveTrack },
+ {&addtrack_audiogroupIcon, QT_TRANSLATE_NOOP("@default", "Show group tracks"), groupTrack },
+ {&addtrack_auxsendIcon, QT_TRANSLATE_NOOP("@default", "Show aux tracks"), auxTrack },
+ {&addtrack_audioinputIcon, QT_TRANSLATE_NOOP("@default", "Show input tracks"), inputTrack },
+ {&addtrack_audiooutputIcon, QT_TRANSLATE_NOOP("@default", "Show output tracks"), outputTrack },
+ {&addtrack_addmiditrackIcon,QT_TRANSLATE_NOOP("@default", "Show midi tracks"), midiTrack },
+ {&synthIcon, QT_TRANSLATE_NOOP("@default", "Show synth tracks"), midiTrack },
+ };
+
+//---------------------------------------------------------
+// VisibleTracks
+//---------------------------------------------------------
+
+
+VisibleTracks::VisibleTracks(QWidget* parent, const char*)
+ : QToolBar(tr("Visible track types"), parent)
+ {
+ setObjectName("Visible track types");
+ QActionGroup* action = new QActionGroup(parent); // Parent needed.
+ action->setExclusive(false);
+
+ actions = new Action*[sizeof(visTrackList)];
+ int n = 0;
+ for (unsigned i = 0; i < sizeof(visTrackList)/sizeof(*visTrackList); ++i) {
+ VisibleToolB* t = &visTrackList[i];
+
+ Action* a = new Action(action, i, t->tip, true);
+ actions[n] = a;
+ //a->setIconSet(QIcon(**(t->icon)));
+ a->setIcon(QIcon(**(t->icon)));
+ a->setToolTip(tr(t->tip));
+ a->setWhatsThis(tr(t->ltip));
+ a->setChecked(true);
+ ++n;
+ }
+ action->setVisible(true);
+ //action->addTo(this);
+ // Note: Does not take ownership.
+ addActions(action->actions());
+
+ connect(action, SIGNAL(selected(QAction*)), SLOT(visibilityChanged(QAction*)));
+ }
+
+//---------------------------------------------------------
+// toolChanged
+//---------------------------------------------------------
+
+void VisibleTracks::visibilityChanged(QAction* action)
+{
+ printf("update visibility\n");
+ switch (((Action*)action)->id()) {
+ case 0:
+ WaveTrack::setVisible(action->isChecked());
+ break;
+ case 1:
+ AudioGroup::setVisible(action->isChecked());
+ break;
+ case 2:
+ AudioAux::setVisible(action->isChecked());
+ break;
+ case 3:
+ AudioInput::setVisible(action->isChecked());
+ break;
+ case 4:
+ AudioOutput::setVisible(action->isChecked());
+ break;
+ case 5:
+ MidiTrack::setVisible(action->isChecked());
+ break;
+ case 6:
+ SynthI::setVisible(action->isChecked());
+ break;
+ default:
+ break;
+ }
+ emit visibilityChanged();
+}
+
+//---------------------------------------------------------
+// ~VisibleTracks
+//---------------------------------------------------------
+
+VisibleTracks::~VisibleTracks()
+ {
+ delete actions;
+ }
+
diff --git a/muse2/muse/widgets/visibletracks.h b/muse2/muse/widgets/visibletracks.h
new file mode 100644
index 00000000..75ec06ae
--- /dev/null
+++ b/muse2/muse/widgets/visibletracks.h
@@ -0,0 +1,49 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tools.h,v 1.1.1.1 2003/10/27 18:54:49 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+// (C) Copyright 2011 Robert Jonsson (rj@spamatica.se)
+//=========================================================
+#ifndef VISIBLETRACKS_H
+#define VISIBLETRACKS_H
+
+#include <QToolBar>
+
+class Action;
+
+class QAction;
+class QPixmap;
+class QWidget;
+
+struct VisibleToolB {
+ QPixmap** icon;
+ const char* tip;
+ const char* ltip;
+ };
+
+extern VisibleToolB visTrackList[];
+
+//---------------------------------------------------------
+// EditToolBar
+//---------------------------------------------------------
+
+class VisibleTracks : public QToolBar {
+ Q_OBJECT
+ Action** actions;
+ int nactions;
+
+ private slots:
+ void visibilityChanged(QAction* action);
+
+ signals:
+ void visibilityChanged();
+
+ public:
+ VisibleTracks(QWidget* /*parent*/, const char* name = 0); // Needs a parent !
+ ~VisibleTracks();
+ };
+
+
+
+#endif // VISIBLETRACKS_H