summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/midiplugins/trigg
diff options
context:
space:
mode:
Diffstat (limited to 'attic/muse_qt4_evolution/midiplugins/trigg')
-rw-r--r--attic/muse_qt4_evolution/midiplugins/trigg/CMakeLists.txt47
-rw-r--r--attic/muse_qt4_evolution/midiplugins/trigg/trigg.cpp131
-rw-r--r--attic/muse_qt4_evolution/midiplugins/trigg/trigg.h49
-rw-r--r--attic/muse_qt4_evolution/midiplugins/trigg/trigggui.cpp56
-rw-r--r--attic/muse_qt4_evolution/midiplugins/trigg/trigggui.h48
-rw-r--r--attic/muse_qt4_evolution/midiplugins/trigg/trigggui.ui109
6 files changed, 440 insertions, 0 deletions
diff --git a/attic/muse_qt4_evolution/midiplugins/trigg/CMakeLists.txt b/attic/muse_qt4_evolution/midiplugins/trigg/CMakeLists.txt
new file mode 100644
index 00000000..397ccf81
--- /dev/null
+++ b/attic/muse_qt4_evolution/midiplugins/trigg/CMakeLists.txt
@@ -0,0 +1,47 @@
+#=============================================================================
+# 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 ( trigg_mocs trigggui.h )
+QT4_WRAP_UI ( trigg_uis trigggui.ui )
+
+add_library ( trigg SHARED
+ trigg.cpp
+ trigggui.cpp
+ trigggui.h
+ ${trigg_mocs}
+ ${trigg_uis}
+ )
+
+target_link_libraries( trigg
+ midiplugin awl
+ ${QT_LIBRARIES}
+ )
+
+# - tell cmake to name target name.so instead of
+# libname.so
+# - use precompiled header files
+#
+set_target_properties ( trigg
+ PROPERTIES PREFIX ""
+ COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all-pic.h"
+ )
+
+install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/midiplugins/ trigg )
+
diff --git a/attic/muse_qt4_evolution/midiplugins/trigg/trigg.cpp b/attic/muse_qt4_evolution/midiplugins/trigg/trigg.cpp
new file mode 100644
index 00000000..fb3703cb
--- /dev/null
+++ b/attic/muse_qt4_evolution/midiplugins/trigg/trigg.cpp
@@ -0,0 +1,131 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: filter.cpp,v 1.10 2005/11/06 17:49:34 wschweer Exp $
+//
+// filter - simple midi filter
+//
+// (C) Copyright 2005 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "trigggui.h"
+#include "trigg.h"
+#include "midi.h"
+#include "midievent.h"
+
+//---------------------------------------------------------
+// Trigg
+//---------------------------------------------------------
+
+Trigg::Trigg(const char* name, const MempiHost* h)
+ : Mempi(name, h)
+ {
+ data.note=30; // allow any events
+ data.velocity=127;
+ gui = 0;
+ }
+
+//---------------------------------------------------------
+// Trigg
+//---------------------------------------------------------
+
+Trigg::~Trigg()
+ {
+ if (gui)
+ delete gui;
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+bool Trigg::init()
+ {
+ gui = new TriggGui(this, 0);
+ gui->setWindowTitle("MusE: "+QString(name()));
+ gui->show();
+ return false;
+ }
+
+//---------------------------------------------------------
+// getGeometry
+//---------------------------------------------------------
+
+void Trigg::getGeometry(int* x, int* y, int* w, int* h) const
+ {
+ QPoint pos(gui->pos());
+ QSize size(gui->size());
+ *x = pos.x();
+ *y = pos.y();
+ *w = size.width();
+ *h = size.height();
+ }
+
+//---------------------------------------------------------
+// setGeometry
+//---------------------------------------------------------
+
+void Trigg::setGeometry(int x, int y, int w, int h)
+ {
+ gui->resize(QSize(w, h));
+ gui->move(QPoint(x, y));
+ }
+
+//---------------------------------------------------------
+// process
+//---------------------------------------------------------
+
+void Trigg::process(unsigned , unsigned , MidiEventList* il, MidiEventList* ol)
+ {
+
+ for (iMidiEvent i = il->begin(); i != il->end(); ++i) {
+ MidiEvent temp=*i;
+ if (temp.isNote() || temp.isNoteOff())
+ {
+ // for each event modify note and velocity
+ printf("a=%d b=%d isNote=%d isNoteOff=%d\n",temp.dataA(),temp.dataB(),temp.isNote(),temp.isNoteOff());
+ temp.setA(data.note);
+ if (!temp.isNoteOff())
+ temp.setB(data.velocity);
+ printf("AFTER a=%d b=%d\n",temp.dataA(),temp.dataB());
+ }
+ ol->insert(temp);
+ }
+ }
+
+void Trigg::getInitData(int* n, const unsigned char** p) const
+ {
+ *n = sizeof(data);
+ *p = (unsigned char*)&data;
+ printf("::getInitData note=%d vel=%d\n",data.note,data.velocity);
+ }
+
+void Trigg::setInitData(int n, const unsigned char* p)
+ {
+ memcpy((void*)&data, p, n);
+ if (gui)
+ gui->init();
+ }
+
+//---------------------------------------------------------
+// inst
+//---------------------------------------------------------
+
+static Mempi* instantiate(const char* name, const MempiHost* h)
+ {
+ return new Trigg(name, h);
+ }
+
+extern "C" {
+ static MEMPI descriptor = {
+ "Trigg",
+ "Any note triggers a specified note with specified velocity",
+ "1.0", // filter version string
+ MEMPI_FILTER, // plugin type
+ MEMPI_MAJOR_VERSION, MEMPI_MINOR_VERSION,
+ instantiate
+ };
+
+ const MEMPI* mempi_descriptor() { return &descriptor; }
+ }
+
diff --git a/attic/muse_qt4_evolution/midiplugins/trigg/trigg.h b/attic/muse_qt4_evolution/midiplugins/trigg/trigg.h
new file mode 100644
index 00000000..c29a06a0
--- /dev/null
+++ b/attic/muse_qt4_evolution/midiplugins/trigg/trigg.h
@@ -0,0 +1,49 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: filter.h,v 1.4 2005/06/12 08:18:37 wschweer Exp $
+//
+// filter - simple midi filter
+//
+// (C) Copyright 2005 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TRIGG_H__
+#define __TRIGG_H__
+
+#include "../libmidiplugin/mempi.h"
+
+//---------------------------------------------------------
+// filter - simple midi filter
+//---------------------------------------------------------
+class Trigg : public Mempi {
+ struct initData {
+ int note;
+ int velocity;
+ } data;
+ friend class TriggGui;
+
+ TriggGui* gui;
+
+ virtual void process(unsigned, unsigned, MidiEventList*, MidiEventList*);
+
+ public:
+ Trigg(const char* name, const MempiHost*);
+ ~Trigg();
+ virtual bool init();
+
+ void setNote(int t) { data.note = t; }
+ void setVelocity(int t) { data.velocity = t; }
+
+ virtual bool hasGui() const { return true; }
+ virtual bool guiVisible() const { return gui->isVisible(); }
+ virtual void showGui(bool val) { gui->setShown(val); }
+ virtual void getGeometry(int* x, int* y, int* w, int* h) const;
+ virtual void setGeometry(int, int, int, int);
+
+ virtual void getInitData(int*, const unsigned char**) const;
+ virtual void setInitData(int, const unsigned char*);
+ };
+
+#endif
+
diff --git a/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.cpp b/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.cpp
new file mode 100644
index 00000000..0fd3c4c6
--- /dev/null
+++ b/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.cpp
@@ -0,0 +1,56 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: filtergui.cpp,v 1.4 2005/11/06 17:49:34 wschweer Exp $
+//
+// (C) Copyright 2005 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "trigggui.h"
+#include "trigg.h"
+
+//---------------------------------------------------------
+// MidiTriggConfig
+//---------------------------------------------------------
+
+TriggGui::TriggGui(Trigg* f, QWidget* parent)
+ : QDialog(parent)
+ {
+ setupUi(this);
+ filter = f;
+
+ connect(noteEntry, SIGNAL(valueChanged(int)), SLOT(setNote(int)));
+ connect(velocityEntry, SIGNAL(valueChanged(int)), SLOT(setVelocity(int)));
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+void TriggGui::init()
+ {
+ Trigg::initData *data;
+ int n;
+ filter->getInitData(&n,(const unsigned char **)&data);
+ printf("::init note=%d vel=%d\n",data->note,data->velocity);
+ noteEntry->setValue(data->note);
+ velocityEntry->setValue(data->velocity);
+ }
+
+//---------------------------------------------------------
+// setNote
+//---------------------------------------------------------
+void TriggGui::setNote(int value)
+ {
+ printf("TriggGui::setNote %d\n",value);
+ filter->setNote(value);
+ }
+
+//---------------------------------------------------------
+// setVelocity
+//---------------------------------------------------------
+void TriggGui::setVelocity(int value)
+ {
+ printf("TriggGui::setVelocity %d\n",value);
+ filter->setVelocity(value);
+ }
+
diff --git a/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.h b/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.h
new file mode 100644
index 00000000..f4c597fa
--- /dev/null
+++ b/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.h
@@ -0,0 +1,48 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: filtergui.h,v 1.4 2005/11/06 17:49:34 wschweer Exp $
+//
+// (C) Copyright 2005 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __FILTERGUI_H__
+#define __FILTERGUI_H__
+
+#include "ui_trigggui.h"
+
+class Trigg;
+
+enum {
+ MIDI_FILTER_NOTEON = 1,
+ MIDI_FILTER_POLYP = 2,
+ MIDI_FILTER_CTRL = 4,
+ MIDI_FILTER_PROGRAM = 8,
+ MIDI_FILTER_AT = 16,
+ MIDI_FILTER_PITCH = 32,
+ MIDI_FILTER_SYSEX = 64
+ };
+
+//---------------------------------------------------------
+// TriggGui
+//---------------------------------------------------------
+
+class TriggGui : public QDialog, public Ui::TriggBase {
+ Q_OBJECT
+
+ Trigg* filter;
+
+ signals:
+ void hideWindow();
+
+ private slots:
+ void setNote(int );
+ void setVelocity(int );
+
+ public:
+ TriggGui(Trigg*, QWidget* parent=0);
+ void init();
+ };
+
+#endif
+
diff --git a/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.ui b/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.ui
new file mode 100644
index 00000000..5c096e24
--- /dev/null
+++ b/attic/muse_qt4_evolution/midiplugins/trigg/trigggui.ui
@@ -0,0 +1,109 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>TriggBase</class>
+ <widget class="QDialog" name="TriggBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>233</width>
+ <height>125</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>MusE: Midi Input Trigg</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <widget class="QGroupBox" name="GroupBoxx" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title" >
+ <string>Trigg</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Velocity</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QSpinBox" name="noteEntry" >
+ <property name="maximum" >
+ <number>127</number>
+ </property>
+ <property name="value" >
+ <number>30</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QSpinBox" name="velocityEntry" >
+ <property name="maximum" >
+ <number>127</number>
+ </property>
+ <property name="minimum" >
+ <number>0</number>
+ </property>
+ <property name="value" >
+ <number>127</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Note</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>