summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse/muse/CMakeLists.txt21
-rw-r--r--muse/muse/ctrl/CMakeLists.txt7
-rw-r--r--muse/muse/midiedit/CMakeLists.txt65
-rw-r--r--muse/muse/midiedit/dcanvas.cpp2
-rw-r--r--muse/muse/midiedit/gatetime.cpp (renamed from muse/muse/widgets/gatetime.cpp)4
-rw-r--r--muse/muse/midiedit/gatetime.h (renamed from muse/muse/widgets/gatetime.h)3
-rw-r--r--muse/muse/midiedit/gatetime.ui (renamed from muse/muse/widgets/gatetime.ui)0
-rw-r--r--muse/muse/midiedit/midicmd.cpp154
-rw-r--r--muse/muse/midiedit/midicmd.h22
-rw-r--r--muse/muse/midiedit/prcanvas.cpp4
-rw-r--r--muse/muse/midiedit/velocity.cpp (renamed from muse/muse/widgets/velocity.cpp)4
-rw-r--r--muse/muse/midiedit/velocity.h (renamed from muse/muse/widgets/velocity.h)3
-rw-r--r--muse/muse/midiedit/velocity.ui (renamed from muse/muse/widgets/velocity.ui)0
-rw-r--r--muse/muse/muse.cpp14
-rw-r--r--muse/muse/muse.h10
-rw-r--r--muse/muse/muse.ui87
-rw-r--r--muse/muse/widgets/CMakeLists.txt7
-rw-r--r--muse/muse/widgets/noteinfo.cpp2
18 files changed, 262 insertions, 147 deletions
diff --git a/muse/muse/CMakeLists.txt b/muse/muse/CMakeLists.txt
index a0b5f7d3..d1a6c806 100644
--- a/muse/muse/CMakeLists.txt
+++ b/muse/muse/CMakeLists.txt
@@ -41,11 +41,10 @@ MACRO(WRAP_UI outfiles )
ENDMACRO(WRAP_UI)
subdirs(
- ctrl widgets master driver instruments marker liste
+ ctrl midiedit widgets master driver instruments marker liste
)
set (muse_uics
- muse
preferences
exportmididialog
configmidifile
@@ -55,7 +54,6 @@ set (muse_uics
projectpropsdialog
projectdialog
templatedialog
- midiedit/quantconfig
mixer/routedialog
arranger/configtrack
arranger/miditrackinfo
@@ -71,14 +69,6 @@ set(muse_mocs
cobject transpose track midisynti
miditrack wavetrack audiotrack audioaux audiooutput
audioinput audiogroup exportmidi
- midiedit/pianoroll
- midiedit/prcanvas
- midiedit/quantconfig
- midiedit/drumedit
- midiedit/dcanvas
- midiedit/ecanvas
- midiedit/ctrledit
- midiedit/midieditor
mixer/mixer
mixer/rack
mixer/midirack
@@ -124,11 +114,6 @@ add_executable ( muse
gconfig.cpp midirc.cpp midififo.cpp
midiport.cpp
- midiedit/drummap.cpp
- midiedit/citem.cpp
- midiedit/midicmd.h
- midiedit/midicmd.cpp
-
${muse_mocCPP}
${muse_moc_headers}
${ui_headers}
@@ -139,8 +124,8 @@ set_target_properties( muse
)
target_link_libraries(muse
- widgets ctrl master driver instruments marker liste
- al awl synti
+ ctrl midiedit master driver instruments marker liste
+ al synti widgets awl
${QT_LIBRARIES}
${ALSA_LIB}
${JACK_LIB}
diff --git a/muse/muse/ctrl/CMakeLists.txt b/muse/muse/ctrl/CMakeLists.txt
index d2916fb4..d71bbede 100644
--- a/muse/muse/ctrl/CMakeLists.txt
+++ b/muse/muse/ctrl/CMakeLists.txt
@@ -19,10 +19,13 @@
#=============================================================================
QT4_WRAP_CPP (ctrl_mocs
- configmidictrl.h ctrleditor.h ctrldialog.h
+ configmidictrl.h
+ ctrleditor.h
+ ctrldialog.h
)
QT4_WRAP_UI (ctrl_ui_headers
- configmidictrl.ui ctrldialog.ui
+ configmidictrl.ui
+ ctrldialog.ui
)
add_library ( ctrl STATIC
diff --git a/muse/muse/midiedit/CMakeLists.txt b/muse/muse/midiedit/CMakeLists.txt
new file mode 100644
index 00000000..c48d0f24
--- /dev/null
+++ b/muse/muse/midiedit/CMakeLists.txt
@@ -0,0 +1,65 @@
+#=============================================================================
+# MusE
+# Linux Music Editor
+# $Id:$
+#
+# Copyright (C) 2002-2006 by Werner Schweer and others
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
+
+QT4_WRAP_CPP ( midiedit_mocs
+ gatetime.h
+ velocity.h
+ quantconfig.h
+ ctrledit.h
+ dcanvas.h
+ drumedit.h
+ ecanvas.h
+ midieditor.h
+ pianoroll.h
+ prcanvas.h
+ )
+
+QT4_WRAP_UI ( midiedit_ui_headers
+ gatetime.ui
+ velocity.ui
+ quantconfig.ui
+ )
+
+add_library ( midiedit STATIC
+ gatetime.cpp
+ velocity.cpp
+ quantconfig.cpp
+ citem.h
+ cmd.h
+ drummap.h
+ midicmd.h
+ citem.cpp
+ ctrledit.cpp
+ dcanvas.cpp
+ drumedit.cpp
+ drummap.cpp
+ ecanvas.cpp
+ midicmd.cpp
+ midieditor.cpp
+ pianoroll.cpp
+ prcanvas.cpp
+ ${midiedit_mocs}
+ ${midiedit_ui_headers}
+ )
+
+set_target_properties( midiedit
+ PROPERTIES COMPILE_FLAGS "-include ${PROJECT_SOURCE_DIR}/all.h"
+ )
+
diff --git a/muse/muse/midiedit/dcanvas.cpp b/muse/muse/midiedit/dcanvas.cpp
index 4a068c1a..d3ee766b 100644
--- a/muse/muse/midiedit/dcanvas.cpp
+++ b/muse/muse/midiedit/dcanvas.cpp
@@ -23,7 +23,7 @@
#include "midieditor.h"
#include "drummap.h"
#include "audio.h"
-#include "widgets/velocity.h"
+#include "velocity.h"
#include "gconfig.h"
#include "part.h"
diff --git a/muse/muse/widgets/gatetime.cpp b/muse/muse/midiedit/gatetime.cpp
index 83624fa8..e75710c8 100644
--- a/muse/muse/widgets/gatetime.cpp
+++ b/muse/muse/midiedit/gatetime.cpp
@@ -26,8 +26,8 @@
// GateTime
//---------------------------------------------------------
-GateTime::GateTime(QWidget* parent)
- : QDialog(parent)
+GateTime::GateTime(QWidget*)
+ : MidiCmdDialog()
{
setupUi(this);
rangeGroup = new QButtonGroup(this);
diff --git a/muse/muse/widgets/gatetime.h b/muse/muse/midiedit/gatetime.h
index cf0d6ff7..f438fc1d 100644
--- a/muse/muse/widgets/gatetime.h
+++ b/muse/muse/midiedit/gatetime.h
@@ -22,12 +22,13 @@
#define __GATETIME_H__
#include "ui_gatetime.h"
+#include "midicmd.h"
//---------------------------------------------------------
// GateTime
//---------------------------------------------------------
-class GateTime : public QDialog, public Ui::GateTimeBase {
+class GateTime : public MidiCmdDialog, public Ui::GateTimeBase {
Q_OBJECT
QButtonGroup* rangeGroup;
diff --git a/muse/muse/widgets/gatetime.ui b/muse/muse/midiedit/gatetime.ui
index 76d45ddc..76d45ddc 100644
--- a/muse/muse/widgets/gatetime.ui
+++ b/muse/muse/midiedit/gatetime.ui
diff --git a/muse/muse/midiedit/midicmd.cpp b/muse/muse/midiedit/midicmd.cpp
index fd3f29ed..231a442f 100644
--- a/muse/muse/midiedit/midicmd.cpp
+++ b/muse/muse/midiedit/midicmd.cpp
@@ -20,8 +20,35 @@
#include "midicmd.h"
#include "song.h"
-#include "widgets/gatetime.h"
+#include "gatetime.h"
+#include "velocity.h"
#include "audio.h"
+#include "midieditor.h"
+
+//==========================================================
+// class MidiCmd is an attempt to formalize the
+// interface between midi command code and MusE.
+// Maybe this can be extended to an specialized
+// plugin interface
+//==========================================================
+
+//---------------------------------------------------------
+// MidiCmdDialog
+//---------------------------------------------------------
+
+MidiCmdDialog::MidiCmdDialog()
+ : QDialog(0)
+ {
+ }
+
+//---------------------------------------------------------
+// MidiCmd
+//---------------------------------------------------------
+
+MidiCmd::MidiCmd(MidiEditor* e)
+ {
+ editor = e;
+ }
//---------------------------------------------------------
// processEvents
@@ -29,11 +56,21 @@
void MidiCmd::processEvents(CItemList* items)
{
+ MidiCmdDialog* dialog = guiDialog();
+ editor->applyTo();
+ dialog->setRange(range);
+ bool rv = dialog->exec();
+ if (!rv) {
+ delete dialog;
+ return;
+ }
+ range = dialog->range(); // all, selected, looped, sel+loop
+ editor->setApplyTo(range);
+ delete dialog;
+
modified = 0;
song->startUndo();
- range = 0; //editor->applyTo();
- process(items, &range);
-// editor->setApplyTo(range);
+ process(items);
song->endUndo(modified);
}
@@ -65,6 +102,8 @@ void MidiCmd::changeEvent(Event oldEvent, Event newEvent, Part* part)
}
//==================================================================
+// process midi event lists
+//==================================================================
//---------------------------------------------------------
// ModifyGateTimeCmd
@@ -72,27 +111,43 @@ void MidiCmd::changeEvent(Event oldEvent, Event newEvent, Part* part)
class ModifyGateTimeCmd : public MidiCmd
{
- protected:
- virtual void process(CItemList* items, int* range);
+ GateTime* dialog;
+ virtual MidiCmdDialog* guiDialog();
+ virtual void process(CItemList* items);
public:
- ModifyGateTimeCmd() {}
+ ModifyGateTimeCmd(MidiEditor* e);
};
//---------------------------------------------------------
+// MidifyGateTime
+//---------------------------------------------------------
+
+ModifyGateTimeCmd::ModifyGateTimeCmd(MidiEditor* e)
+ : MidiCmd(e)
+ {
+ dialog = 0;
+ }
+
+//---------------------------------------------------------
+// guiDialog
+//---------------------------------------------------------
+
+MidiCmdDialog* ModifyGateTimeCmd::guiDialog()
+ {
+ if (dialog == 0)
+ dialog = new GateTime(0);
+ return dialog;
+ }
+
+//---------------------------------------------------------
// process
-// return true if events are modified
//---------------------------------------------------------
-void ModifyGateTimeCmd::process(CItemList* items, int* range)
+void ModifyGateTimeCmd::process(CItemList* items)
{
- GateTime w(0);
- w.setRange(*range);
- if (!w.exec())
- return;
- *range = w.range(); // all, selected, looped, sel+loop
- int rate = w.rateVal();
- int offset = w.offsetVal();
+ int rate = dialog->rateVal();
+ int offset = dialog->offsetVal();
for (iCItem k = items->begin(); k != items->end(); ++k) {
CItem* item = k->second;
@@ -116,3 +171,70 @@ void ModifyGateTimeCmd::process(CItemList* items, int* range)
}
}
+//---------------------------------------------------------
+// ModifyVelocityCmd
+//---------------------------------------------------------
+
+class ModifyVelocityCmd : public MidiCmd
+ {
+ Velocity* dialog;
+ virtual MidiCmdDialog* guiDialog();
+ virtual void process(CItemList* items);
+
+ public:
+ ModifyVelocityCmd(MidiEditor* e);
+ };
+
+//---------------------------------------------------------
+// ModifyVelocityCmd
+//---------------------------------------------------------
+
+ModifyVelocityCmd::ModifyVelocityCmd(MidiEditor* e)
+ : MidiCmd(e)
+ {
+ dialog = 0;
+ }
+
+//---------------------------------------------------------
+// guiDialog
+//---------------------------------------------------------
+
+MidiCmdDialog* ModifyVelocityCmd::guiDialog()
+ {
+ if (dialog == 0)
+ dialog = new Velocity(0);
+ return dialog;
+ }
+
+//---------------------------------------------------------
+// process
+//---------------------------------------------------------
+
+void ModifyVelocityCmd::process(CItemList* items)
+ {
+ int rate = dialog->rateVal();
+ int offset = dialog->offsetVal();
+
+ for (iCItem k = items->begin(); k != items->end(); ++k) {
+ CItem* item = k->second;
+ Event event = item->event;
+ if (event.type() != Note)
+ continue;
+ if (itemInRange(item)) {
+ int velo = event.velo();
+ velo = (velo * rate) / 100;
+ velo += offset;
+
+ if (velo <= 0)
+ velo = 1;
+ if (velo > 127)
+ velo = 127;
+ if (event.velo() != velo) {
+ Event newEvent = event.clone();
+ newEvent.setVelo(velo);
+ audio->msgChangeEvent(event, newEvent, item->part, false);
+ }
+ }
+ }
+ }
+
diff --git a/muse/muse/midiedit/midicmd.h b/muse/muse/midiedit/midicmd.h
index 2cfabb26..0e4a9b43 100644
--- a/muse/muse/midiedit/midicmd.h
+++ b/muse/muse/midiedit/midicmd.h
@@ -23,6 +23,22 @@
#include "citem.h"
+class MidiEditor;
+class MidiCmdDialog;
+
+//---------------------------------------------------------
+// MidiCmdDialog
+//---------------------------------------------------------
+
+class MidiCmdDialog : public QDialog
+ {
+
+ public:
+ MidiCmdDialog();
+ int range() const { return 0; }
+ void setRange(int /*val*/) { }
+ };
+
//---------------------------------------------------------
// MidiCmd
// abstract base class for midi commands
@@ -32,6 +48,7 @@ class MidiCmd {
int modified;
protected:
+ MidiEditor* editor;
int range;
// convenience classes for derived classes
@@ -39,10 +56,11 @@ class MidiCmd {
void changeEvent(Event oldEvent, Event newEvent, Part* part);
// virtual functions provided by derived classes
- virtual void process(CItemList*, int*) = 0;
+ virtual void process(CItemList*) = 0;
+ virtual MidiCmdDialog* guiDialog() { return 0; }
public:
- MidiCmd() {}
+ MidiCmd(MidiEditor*);
virtual ~MidiCmd() {}
void processEvents(CItemList*);
};
diff --git a/muse/muse/midiedit/prcanvas.cpp b/muse/muse/midiedit/prcanvas.cpp
index 2b5b12f0..df674e0e 100644
--- a/muse/muse/midiedit/prcanvas.cpp
+++ b/muse/muse/midiedit/prcanvas.cpp
@@ -21,8 +21,8 @@
#include "midieditor.h"
#include "prcanvas.h"
#include "cmd.h"
-#include "widgets/gatetime.h"
-#include "widgets/velocity.h"
+#include "gatetime.h"
+#include "velocity.h"
#include "song.h"
#include "audio.h"
#include "part.h"
diff --git a/muse/muse/widgets/velocity.cpp b/muse/muse/midiedit/velocity.cpp
index ed2cac4e..a011317d 100644
--- a/muse/muse/widgets/velocity.cpp
+++ b/muse/muse/midiedit/velocity.cpp
@@ -26,8 +26,8 @@
// Velocity
//---------------------------------------------------------
-Velocity::Velocity(QWidget* parent)
- : QDialog(parent)
+Velocity::Velocity(QWidget*)
+ : MidiCmdDialog()
{
setupUi(this);
rangeGroup = new QButtonGroup(this);
diff --git a/muse/muse/widgets/velocity.h b/muse/muse/midiedit/velocity.h
index f479bc0f..8cbf1e26 100644
--- a/muse/muse/widgets/velocity.h
+++ b/muse/muse/midiedit/velocity.h
@@ -22,12 +22,13 @@
#define __VELOCITY_H__
#include "ui_velocity.h"
+#include "midicmd.h"
//---------------------------------------------------------
// Velocity
//---------------------------------------------------------
-class Velocity : public QDialog, public Ui::VelocityBase {
+class Velocity : public MidiCmdDialog, public Ui::VelocityBase {
Q_OBJECT
QButtonGroup* rangeGroup;
diff --git a/muse/muse/widgets/velocity.ui b/muse/muse/midiedit/velocity.ui
index e0122520..e0122520 100644
--- a/muse/muse/widgets/velocity.ui
+++ b/muse/muse/midiedit/velocity.ui
diff --git a/muse/muse/muse.cpp b/muse/muse/muse.cpp
index ba7db90f..35861a0c 100644
--- a/muse/muse/muse.cpp
+++ b/muse/muse/muse.cpp
@@ -41,7 +41,7 @@
#include "marker/markerview.h"
#include "transpose.h"
#include "preferences.h"
-#include "widgets/gatetime.h"
+// #include "widgets/gatetime.h"
#include "audio.h"
#include "midiseq.h"
#include "audioprefetch.h"
@@ -441,7 +441,7 @@ void MusE::setupTransportToolbar(QToolBar* tb) const
MusE::MusE()
: QMainWindow()
{
- setupUi(this);
+// setupUi(this);
setIconSize(ICON_SIZE);
setFocusPolicy(Qt::WheelFocus);
@@ -470,6 +470,12 @@ MusE::MusE()
exportMidiDialog = 0;
projectPropsDialog = 0;
+ startAction = new QAction(QIcon(":/xpm/start.xpm"), "start", this);
+ rewindAction = new QAction(QIcon(":/xpm/frewind.xpm"), "rewind", this);
+ forwardAction = new QAction(QIcon(":/xpm/fforward.xpm"), "forward", this);
+ stopAction = new QAction(QIcon(":/xpm/stop.xpm"), "stop", this);
+ playAction = new QAction(QIcon(":/xpm/play.xpm"), "play", this);
+
song->blockSignals(true);
heartBeatTimer = new QTimer(this);
connect(heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat()));
@@ -1954,8 +1960,8 @@ void MusE::transpose()
void MusE::modifyGateTime()
{
- GateTime* w = new GateTime(this);
- w->show();
+//TODO GateTime* w = new GateTime(this);
+// w->show();
}
//---------------------------------------------------------
diff --git a/muse/muse/muse.h b/muse/muse/muse.h
index bcd13af9..43f5551e 100644
--- a/muse/muse/muse.h
+++ b/muse/muse/muse.h
@@ -21,7 +21,6 @@
#ifndef __APP_H__
#define __APP_H__
-#include "ui_muse.h"
#include "cobject.h"
#include "widgets/tools.h"
@@ -61,7 +60,7 @@ extern void configMidiController();
// MusE
//---------------------------------------------------------
-class MusE : public QMainWindow, public Ui::MuseBase
+class MusE : public QMainWindow // , public Ui::MuseBase
{
Q_OBJECT
enum {
@@ -93,6 +92,7 @@ class MusE : public QMainWindow, public Ui::MuseBase
QAction* fileOpenAction;
QAction* pianoAction;
QAction* fileNewAction;
+
QString appName;
QToolBar *tools;
@@ -292,6 +292,12 @@ class MusE : public QMainWindow, public Ui::MuseBase
int raster() const { return _raster; }
void setupTransportToolbar(QToolBar* tb) const;
void readToplevels(QDomNode);
+
+ QAction* startAction;
+ QAction* rewindAction;
+ QAction* forwardAction;
+ QAction* stopAction;
+ QAction* playAction;
};
extern MusE* muse;
diff --git a/muse/muse/muse.ui b/muse/muse/muse.ui
deleted file mode 100644
index e8fda401..00000000
--- a/muse/muse/muse.ui
+++ /dev/null
@@ -1,87 +0,0 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>MuseBase</class>
- <widget class="QMainWindow" name="MuseBase" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>600</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>MusE</string>
- </property>
- <widget class="QWidget" name="centralwidget" />
- <widget class="QMenuBar" name="menubar" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>35</height>
- </rect>
- </property>
- </widget>
- <action name="startAction" >
- <property name="icon" >
- <iconset resource="../muse.qrc" >:/xpm/start.xpm</iconset>
- </property>
- <property name="text" >
- <string>start action</string>
- </property>
- </action>
- <action name="rewindAction" >
- <property name="icon" >
- <iconset resource="../muse.qrc" >:/xpm/frewind.xpm</iconset>
- </property>
- <property name="text" >
- <string>rewind</string>
- </property>
- </action>
- <action name="forwardAction" >
- <property name="icon" >
- <iconset resource="../muse.qrc" >:/xpm/fforward.xpm</iconset>
- </property>
- <property name="text" >
- <string>forward</string>
- </property>
- </action>
- <action name="stopAction" >
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- <property name="icon" >
- <iconset resource="../muse.qrc" >:/xpm/stop.xpm</iconset>
- </property>
- <property name="text" >
- <string>stop</string>
- </property>
- </action>
- <action name="playAction" >
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="checked" >
- <bool>false</bool>
- </property>
- <property name="icon" >
- <iconset resource="../muse.qrc" >:/xpm/play.xpm</iconset>
- </property>
- <property name="text" >
- <string>play</string>
- </property>
- </action>
- </widget>
- <pixmapfunction></pixmapfunction>
- <resources>
- <include location="../muse.qrc" />
- </resources>
- <connections/>
-</ui>
diff --git a/muse/muse/widgets/CMakeLists.txt b/muse/muse/widgets/CMakeLists.txt
index 5bdaacdf..03866a0c 100644
--- a/muse/muse/widgets/CMakeLists.txt
+++ b/muse/muse/widgets/CMakeLists.txt
@@ -34,8 +34,7 @@ QT4_WRAP_CPP (widget_mocs
comboQuant.h bigtime.h
midisync.h
mixdowndialog.h
- comment.h gatetime.h
- velocity.h
+ comment.h
shortcutconfig.h
shortcutcapturedialog.h
greendotbutton.h recordbutton.h
@@ -47,8 +46,6 @@ QT4_WRAP_UI (widget_ui_headers
mixdowndialog.ui
shortcutcapturedialog.ui
shortcutconfig.ui
- gatetime.ui
- velocity.ui
)
# add_custom_command(OUTPUT ui_midisync.h
@@ -70,8 +67,6 @@ add_library ( widgets STATIC
midisync.cpp
comment.cpp
mixdowndialog.cpp
- velocity.cpp
- gatetime.cpp
tools.cpp
doublelabel.cpp
noteinfo.cpp
diff --git a/muse/muse/widgets/noteinfo.cpp b/muse/muse/widgets/noteinfo.cpp
index b495005f..9ae02ab0 100644
--- a/muse/muse/widgets/noteinfo.cpp
+++ b/muse/muse/widgets/noteinfo.cpp
@@ -27,7 +27,7 @@
//---------------------------------------------------
// NoteInfo
// ToolBar
-// Start, Länge, Note, Velo an, Velo aus, Kanal
+// Start, Len, Note, Velo on, Velo off, Channel
//---------------------------------------------------
NoteInfo::NoteInfo(QMainWindow* parent)