From e40fc849149dd97c248866a4a1d026dda5e57b62 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Mon, 7 Mar 2011 19:01:11 +0000 Subject: clean3 --- .../midiplugins/filter/CMakeLists.txt | 49 ++++ .../midiplugins/filter/ctrlcombo.cpp | 56 +++++ .../midiplugins/filter/ctrlcombo.h | 24 ++ .../midiplugins/filter/filter.cpp | 167 +++++++++++++ .../muse_qt4_evolution/midiplugins/filter/filter.h | 51 ++++ .../midiplugins/filter/filtergui.cpp | 187 ++++++++++++++ .../midiplugins/filter/filtergui.h | 57 +++++ .../midiplugins/filter/filtergui.ui | 269 +++++++++++++++++++++ 8 files changed, 860 insertions(+) create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/CMakeLists.txt create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.cpp create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.h create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/filter.cpp create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/filter.h create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/filtergui.cpp create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/filtergui.h create mode 100644 attic/muse_qt4_evolution/midiplugins/filter/filtergui.ui (limited to 'attic/muse_qt4_evolution/midiplugins/filter') diff --git a/attic/muse_qt4_evolution/midiplugins/filter/CMakeLists.txt b/attic/muse_qt4_evolution/midiplugins/filter/CMakeLists.txt new file mode 100644 index 00000000..7bdb8544 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/CMakeLists.txt @@ -0,0 +1,49 @@ +#============================================================================= +# 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 ( filter_mocs filtergui.h ctrlcombo.h ) +QT4_WRAP_UI ( filter_uis filtergui.ui ) + +add_library ( filter SHARED + filter.cpp + filtergui.cpp + filtergui.h + ctrlcombo.cpp + ctrlcombo.h + ${filter_mocs} + ${filter_uis} + ) + +target_link_libraries( filter + midiplugin awl + ${QT_LIBRARIES} + ) + +# - tell cmake to name target filter.so instead of +# libfilter.so +# - use precompiled header files +# +set_target_properties ( filter + PROPERTIES PREFIX "" + COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all-pic.h" + ) + +install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/midiplugins/ filter ) + diff --git a/attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.cpp b/attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.cpp new file mode 100644 index 00000000..b4c436c6 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.cpp @@ -0,0 +1,56 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: ctrlcombo.cpp,v 1.2 2005/11/06 17:49:34 wschweer Exp $ +// +// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de) +//========================================================= + +#include "ctrlcombo.h" + +//--------------------------------------------------------- +// CtrlComboBox +//--------------------------------------------------------- + +CtrlComboBox::CtrlComboBox(QWidget* parent) + : QComboBox(parent) + { + const char* ctxt[] = { + "No Ctrl", "BankSelMSB", "Modulation", "BreathCtrl", + "Control 3", "Foot Ctrl", "Porta Time", "DataEntMSB", + "MainVolume", "Balance", "Control 9", "Pan", + "Expression", "Control 12", "Control 13", "Control 14", + "Control 15", "Gen.Purp.1", "Gen.Purp.2", "Gen.Purp.3", + "Gen.Purp.4", "Control 20", "Control 21", "Control 22", + "Control 23", "Control 24", "Control 25", "Control 26", + "Control 27", "Control 28", "Control 29", "Control 30", + "Control 31", "BankSelLSB", "Modul. LSB", "BrthCt.LSB", + "Control 35", "FootCt.LSB", "Port.T LSB", "DataEntLSB", + "MainVolLSB", "BalanceLSB", "Control 41", "Pan LSB", + "Expr. LSB", "Control 44", "Control 45", "Control 46", + "Control 47", "Gen.P.1LSB", "Gen.P.2LSB", "Gen.P.3LSB", + "Gen.P.4LSB", "Control 52", "Control 53", "Control 54", + "Control 55", "Control 56", "Control 57", "Control 58", + "Control 59", "Control 60", "Control 61", "Control 62", + "Control 63", "Sustain", "Porta Ped", "Sostenuto", + "Soft Pedal", "Control 68", "Hold 2", "Control 70", + "HarmonicCo", "ReleaseTime", "Attack Time", "Brightness", + "Control 75", "Control 76", "Control 77", "Control 78", + "Control 79", "Gen.Purp.5", "Gen.Purp.6", "Gen.Purp.7", + "Gen.Purp.8", "Porta Ctrl", "Control 85", "Control 86", + "Control 87", "Control 88", "Control 89", "Control 90", + "Effect1Dep", "Effect2Dep", "Effect3Dep", "Effect4Dep", + "Phaser Dep", "Data Incr", "Data Decr", "NRPN LSB", + "NRPN MSB", "RPN LSB", "RPN MSB", "Control102", + "Control103", "Control104", "Control105", "Control106", + "Control107", "Control108", "Control109", "Control110", + "Control111", "Control112", "Control113", "Control114", + "Control115", "Control116", "Control117", "Control118", + "Control119", "AllSndOff", "Reset Ctrl", "Local Ctrl", + "AllNoteOff", "OmniModOff", "OmniModeOn", "MonoModeOn", + "PolyModeOn" + }; + for (unsigned int i = 0; i < sizeof(ctxt)/sizeof(*ctxt); ++i) + addItem(QString(ctxt[i])); + } + diff --git a/attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.h b/attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.h new file mode 100644 index 00000000..53044b20 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/ctrlcombo.h @@ -0,0 +1,24 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: ctrlcombo.h,v 1.2 2005/11/06 17:49:34 wschweer Exp $ +// +// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __CTRLGRP_H__ +#define __CTRLGRP_H__ + +//--------------------------------------------------------- +// CtrlComboBox +//--------------------------------------------------------- + +class CtrlComboBox : public QComboBox { + Q_OBJECT + public: + CtrlComboBox(QWidget* parent = 0); + }; + + +#endif + diff --git a/attic/muse_qt4_evolution/midiplugins/filter/filter.cpp b/attic/muse_qt4_evolution/midiplugins/filter/filter.cpp new file mode 100644 index 00000000..ac99449e --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/filter.cpp @@ -0,0 +1,167 @@ +//========================================================= +// 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 "filtergui.h" +#include "filter.h" +#include "midi.h" + +//--------------------------------------------------------- +// Filter +//--------------------------------------------------------- + +Filter::Filter(const char* name, const MempiHost* h) + : Mempi(name, h) + { + data.type = 0; // allow any events + for (int i = 0; i < 4; ++i) + data.ctrl[i] = -1; + gui = 0; + } + +//--------------------------------------------------------- +// Filter +//--------------------------------------------------------- + +Filter::~Filter() + { + if (gui) + delete gui; + } + +//--------------------------------------------------------- +// init +//--------------------------------------------------------- + +bool Filter::init() + { + gui = new FilterGui(this, 0); + gui->setWindowTitle("MusE: "+QString(name())); + gui->show(); + return false; + } + +//--------------------------------------------------------- +// getGeometry +//--------------------------------------------------------- + +void Filter::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 Filter::setGeometry(int x, int y, int w, int h) + { + gui->resize(QSize(w, h)); + gui->move(QPoint(x, y)); + } + +//--------------------------------------------------------- +// process +//--------------------------------------------------------- + +void Filter::process(unsigned, unsigned, MidiEventList* il, MidiEventList* ol) + { + for (iMidiEvent i = il->begin(); i != il->end(); ++i) { + if (!filterEvent(*i)) + ol->insert(*i); + } + } + +//--------------------------------------------------------- +// filterEvent +// return true if event filtered +//--------------------------------------------------------- + +bool Filter::filterEvent(const MidiEvent& event) + { + switch(event.type()) { + case ME_NOTEON: + case ME_NOTEOFF: + if (data.type & MIDI_FILTER_NOTEON) + return true; + break; + case ME_POLYAFTER: + if (data.type & MIDI_FILTER_POLYP) + return true; + break; + case ME_CONTROLLER: + if (data.type & MIDI_FILTER_CTRL) + return true; + for (int i = 0; i < 4; ++i) { + if (data.ctrl[i] == event.dataA()) + return true; + } + break; + case ME_PROGRAM: + if (data.type & MIDI_FILTER_PROGRAM) + return true; + break; + case ME_AFTERTOUCH: + if (data.type & MIDI_FILTER_AT) + return true; + break; + case ME_PITCHBEND: + if (data.type & MIDI_FILTER_PITCH) + return true; + break; + case ME_SYSEX: + if (data.type & MIDI_FILTER_SYSEX) + return true; + break; + default: + break; + } + return false; + } + +void Filter::getInitData(int* n, const unsigned char** p) const + { + *n = sizeof(data); + *p = (unsigned char*)&data; + } + +void Filter::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 Filter(name, h); + } + +extern "C" { + static MEMPI descriptor = { + "Filter", + "MusE Simple Midi Filter", + "0.1", // 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/filter/filter.h b/attic/muse_qt4_evolution/midiplugins/filter/filter.h new file mode 100644 index 00000000..c8a357b4 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/filter.h @@ -0,0 +1,51 @@ +//========================================================= +// 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 __FILTER_H__ +#define __FILTER_H__ + +#include "../libmidiplugin/mempi.h" + +//--------------------------------------------------------- +// filter - simple midi filter +//--------------------------------------------------------- + +class Filter : public Mempi { + struct initData { + int type; + int ctrl[4]; + } data; + FilterGui* gui; + + bool filterEvent(const MidiEvent& event); + virtual void process(unsigned, unsigned, MidiEventList*, MidiEventList*); + + public: + Filter(const char* name, const MempiHost*); + ~Filter(); + virtual bool init(); + + int midiType() const { return data.type; } + void setMidiType(int t) { data.type = t; } + int midiCtrl(int i) const { return data.ctrl[i]; } + void setMidiCtrl(int i, int val) { data.ctrl[i] = val; } + + 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/filter/filtergui.cpp b/attic/muse_qt4_evolution/midiplugins/filter/filtergui.cpp new file mode 100644 index 00000000..306ae392 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/filtergui.cpp @@ -0,0 +1,187 @@ +//========================================================= +// 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 "filtergui.h" +#include "filter.h" +#include "ctrlcombo.h" + +//--------------------------------------------------------- +// MidiFilterConfig +//--------------------------------------------------------- + +FilterGui::FilterGui(Filter* f, QWidget* parent) + : QDialog(parent) + { + setupUi(this); + filter = f; + connect(rf1, SIGNAL(toggled(bool)), SLOT(rf1Toggled(bool))); + connect(rf2, SIGNAL(toggled(bool)), SLOT(rf2Toggled(bool))); + connect(rf3, SIGNAL(toggled(bool)), SLOT(rf3Toggled(bool))); + connect(rf4, SIGNAL(toggled(bool)), SLOT(rf4Toggled(bool))); + connect(rf5, SIGNAL(toggled(bool)), SLOT(rf5Toggled(bool))); + connect(rf6, SIGNAL(toggled(bool)), SLOT(rf6Toggled(bool))); + connect(rf7, SIGNAL(toggled(bool)), SLOT(rf7Toggled(bool))); + connect(cb1, SIGNAL(activated(int)), SLOT(cb1Activated(int))); + connect(cb2, SIGNAL(activated(int)), SLOT(cb2Activated(int))); + connect(cb3, SIGNAL(activated(int)), SLOT(cb3Activated(int))); + connect(cb4, SIGNAL(activated(int)), SLOT(cb4Activated(int))); + } + +//--------------------------------------------------------- +// init +//--------------------------------------------------------- + +void FilterGui::init() + { + int midiType = filter->midiType(); + rf1->setChecked(midiType & MIDI_FILTER_NOTEON); + rf2->setChecked(midiType & MIDI_FILTER_POLYP); + rf3->setChecked(midiType & MIDI_FILTER_CTRL); + rf4->setChecked(midiType & MIDI_FILTER_PROGRAM); + rf5->setChecked(midiType & MIDI_FILTER_AT); + rf6->setChecked(midiType & MIDI_FILTER_PITCH); + rf7->setChecked(midiType & MIDI_FILTER_SYSEX); + cb1->setCurrentIndex(filter->midiCtrl(0) + 1); + cb2->setCurrentIndex(filter->midiCtrl(1) + 1); + cb3->setCurrentIndex(filter->midiCtrl(2) + 1); + cb4->setCurrentIndex(filter->midiCtrl(3) + 1); + } + +//--------------------------------------------------------- +// cb1Activated +//--------------------------------------------------------- + +void FilterGui::cb1Activated(int idx) + { + filter->setMidiCtrl(0, idx - 1); + } + +//--------------------------------------------------------- +// cb2Activated +//--------------------------------------------------------- + +void FilterGui::cb2Activated(int idx) + { + filter->setMidiCtrl(1, idx - 1); + } + +//--------------------------------------------------------- +// cb3Activated +//--------------------------------------------------------- + +void FilterGui::cb3Activated(int idx) + { + filter->setMidiCtrl(2, idx - 1); + } + +//--------------------------------------------------------- +// cb4Activated +//--------------------------------------------------------- + +void FilterGui::cb4Activated(int idx) + { + filter->setMidiCtrl(3, idx - 1); + } + +//--------------------------------------------------------- +// rf1Toggled +//--------------------------------------------------------- + +void FilterGui::rf1Toggled(bool) + { + int midiType = filter->midiType(); + if (rf1->isChecked()) + midiType |= MIDI_FILTER_NOTEON; + else + midiType &= ~MIDI_FILTER_NOTEON; + filter->setMidiType(midiType); + } + +//--------------------------------------------------------- +// rf2Toggled +//--------------------------------------------------------- + +void FilterGui::rf2Toggled(bool) + { + int midiType = filter->midiType(); + if (rf2->isChecked()) + midiType |= MIDI_FILTER_POLYP; + else + midiType &= ~MIDI_FILTER_POLYP; + filter->setMidiType(midiType); + } + +//--------------------------------------------------------- +// rf3Toggled +//--------------------------------------------------------- + +void FilterGui::rf3Toggled(bool) + { + int midiType = filter->midiType(); + if (rf3->isChecked()) + midiType |= MIDI_FILTER_CTRL; + else + midiType &= ~MIDI_FILTER_CTRL; + filter->setMidiType(midiType); + } + +//--------------------------------------------------------- +// rf4Toggled +//--------------------------------------------------------- + +void FilterGui::rf4Toggled(bool) + { + int midiType = filter->midiType(); + if (rf4->isChecked()) + midiType |= MIDI_FILTER_PROGRAM; + else + midiType &= ~MIDI_FILTER_PROGRAM; + filter->setMidiType(midiType); + } + +//--------------------------------------------------------- +// rf5Toggled +//--------------------------------------------------------- + +void FilterGui::rf5Toggled(bool) + { + int midiType = filter->midiType(); + if (rf5->isChecked()) + midiType |= MIDI_FILTER_AT; + else + midiType &= ~MIDI_FILTER_AT; + filter->setMidiType(midiType); + } + +//--------------------------------------------------------- +// rf6Toggled +//--------------------------------------------------------- + +void FilterGui::rf6Toggled(bool) + { + int midiType = filter->midiType(); + if (rf1->isChecked()) + midiType |= MIDI_FILTER_PITCH; + else + midiType &= ~MIDI_FILTER_PITCH; + filter->setMidiType(midiType); + } + +//--------------------------------------------------------- +// rf7Toggled +//--------------------------------------------------------- + +void FilterGui::rf7Toggled(bool) + { + int midiType = filter->midiType(); + if (rf7->isChecked()) + midiType |= MIDI_FILTER_SYSEX; + else + midiType &= ~MIDI_FILTER_SYSEX; + filter->setMidiType(midiType); + } diff --git a/attic/muse_qt4_evolution/midiplugins/filter/filtergui.h b/attic/muse_qt4_evolution/midiplugins/filter/filtergui.h new file mode 100644 index 00000000..701bfec9 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/filtergui.h @@ -0,0 +1,57 @@ +//========================================================= +// 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_filtergui.h" + +class Filter; + +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 + }; + +//--------------------------------------------------------- +// FilterGui +//--------------------------------------------------------- + +class FilterGui : public QDialog, public Ui::FilterBase { + Q_OBJECT + + Filter* filter; + + signals: + void hideWindow(); + + private slots: + void rf1Toggled(bool); + void rf2Toggled(bool); + void rf3Toggled(bool); + void rf4Toggled(bool); + void rf5Toggled(bool); + void rf6Toggled(bool); + void rf7Toggled(bool); + void cb1Activated(int); + void cb2Activated(int); + void cb3Activated(int); + void cb4Activated(int); + + public: + FilterGui(Filter*, QWidget* parent=0); + void init(); + }; + +#endif + diff --git a/attic/muse_qt4_evolution/midiplugins/filter/filtergui.ui b/attic/muse_qt4_evolution/midiplugins/filter/filtergui.ui new file mode 100644 index 00000000..8e1693f2 --- /dev/null +++ b/attic/muse_qt4_evolution/midiplugins/filter/filtergui.ui @@ -0,0 +1,269 @@ + + + + + FilterBase + + + + 0 + 0 + 388 + 213 + + + + + 3 + 5 + 0 + 0 + + + + MusE: Midi Input Filter + + + + 6 + + + 2 + + + + + + 5 + 5 + 0 + 0 + + + + Event Filter + + + + 6 + + + 2 + + + + + + 5 + 0 + 0 + 0 + + + + Note On + + + + + + + + 5 + 0 + 0 + 0 + + + + Poly Pressure + + + + + + + + 5 + 0 + 0 + 0 + + + + Controller + + + + + + + + 1 + 0 + 0 + 0 + + + + Program Change + + + + + + + + 5 + 0 + 0 + 0 + + + + After Touch + + + + + + + + 5 + 0 + 0 + 0 + + + + Pitch Bend + + + + + + + + 5 + 0 + 0 + 0 + + + + Sysex + + + + + + + + + + + 5 + 5 + 0 + 0 + + + + Controller Filter + + + + 6 + + + 2 + + + + + + 5 + 0 + 0 + 0 + + + + + + + + + 5 + 0 + 0 + 0 + + + + + + + + + 5 + 0 + 0 + 0 + + + + + + + + + 5 + 5 + 0 + 0 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + CtrlComboBox + QComboBox +
ctrlcombo.h
+ 0 + +
+
+ + rf1 + rf2 + rf3 + rf4 + rf5 + rf6 + rf7 + + + +
-- cgit v1.2.3