summaryrefslogtreecommitdiff
path: root/attic/muse2-oom/muse2/synti/libsynti
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-03-07 19:01:11 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-03-07 19:01:11 +0000
commite40fc849149dd97c248866a4a1d026dda5e57b62 (patch)
treeb12b358f3b3a0608001d30403358f8443118ec5f /attic/muse2-oom/muse2/synti/libsynti
parent1bd4f2e8d9745cabb667b043171cad22c8577768 (diff)
clean3
Diffstat (limited to 'attic/muse2-oom/muse2/synti/libsynti')
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/CMakeLists.txt70
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/evdata.h.OLD67
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/gui.cpp130
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/gui.h72
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/mess.cpp125
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/mess.h103
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/mono.cpp47
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/mono.h47
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/mpevent.cpp.OLD22
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/mpevent.h.OLD100
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/poly.cpp35
-rw-r--r--attic/muse2-oom/muse2/synti/libsynti/poly.h39
12 files changed, 857 insertions, 0 deletions
diff --git a/attic/muse2-oom/muse2/synti/libsynti/CMakeLists.txt b/attic/muse2-oom/muse2/synti/libsynti/CMakeLists.txt
new file mode 100644
index 00000000..8b7a662b
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/CMakeLists.txt
@@ -0,0 +1,70 @@
+#=============================================================================
+# 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.
+#=============================================================================
+
+include(${PROJECT_SOURCE_DIR}/pch.txt)
+
+##
+## List of source files to compile
+##
+file (GLOB synti_source_files
+ mess.cpp
+ # mess2.cpp
+ gui.cpp
+ mono.cpp
+ poly.cpp
+ # midievent.cpp
+ # Removed. Causing conflicts with /muse/mpevent
+ ## mpevent.cpp
+ )
+
+##
+## Define target
+##
+add_library(synti SHARED
+ ${PROJECT_BINARY_DIR}/all-pic.h.pch
+ ${synti_source_files}
+ )
+
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+ ${FILES_TO_TRANSLATE}
+ ${synti_source_files}
+ CACHE INTERNAL ""
+ )
+
+##
+## Compilation flags and target name
+##
+#
+# -fPIC is necessary for 64 bit systems
+#
+set_target_properties( synti
+ PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all-pic.h"
+ OUTPUT_NAME muse_synti
+ )
+
+##
+## Install location
+##
+install(TARGETS synti
+ DESTINATION ${MusE_MODULES_DIR}
+ )
diff --git a/attic/muse2-oom/muse2/synti/libsynti/evdata.h.OLD b/attic/muse2-oom/muse2/synti/libsynti/evdata.h.OLD
new file mode 100644
index 00000000..4e529bec
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/evdata.h.OLD
@@ -0,0 +1,67 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: evdata.h,v 1.1 2004/02/13 13:55:03 wschweer Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __EVDATA_H__
+#define __EVDATA_H__
+
+//#include <memory.h>
+#include <string.h> // p4.0.2
+
+//---------------------------------------------------------
+// EvData
+// variable len event data (sysex, meta etc.)
+//---------------------------------------------------------
+
+class EvData {
+ int* refCount;
+
+ public:
+ unsigned char* data;
+ int dataLen;
+
+ EvData() {
+ data = 0;
+ dataLen = 0;
+ refCount = new int(1);
+ }
+ EvData(const EvData& ed) {
+ data = ed.data;
+ dataLen = ed.dataLen;
+ refCount = ed.refCount;
+ (*refCount)++;
+ }
+
+ EvData& operator=(const EvData& ed) {
+ if (data == ed.data)
+ return *this;
+ if (--(*refCount) == 0) {
+ delete refCount;
+ delete[] data;
+ }
+ data = ed.data;
+ dataLen = ed.dataLen;
+ refCount = ed.refCount;
+ (*refCount)++;
+ return *this;
+ }
+
+ ~EvData() {
+ if (--(*refCount) == 0) {
+ delete[] data;
+ delete refCount;
+ }
+ }
+ void setData(const unsigned char* p, int l) {
+ data = new unsigned char[l];
+ memcpy(data, p, l);
+ dataLen = l;
+ }
+ };
+
+#endif
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/gui.cpp b/attic/muse2-oom/muse2/synti/libsynti/gui.cpp
new file mode 100644
index 00000000..23a18fee
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/gui.cpp
@@ -0,0 +1,130 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// software synthesizer helper library
+// $Id: gui.cpp,v 1.5 2004/04/11 10:46:14 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "gui.h"
+#include "muse/midi.h"
+
+#include <unistd.h>
+
+//---------------------------------------------------------
+// MessGui
+//---------------------------------------------------------
+
+MessGui::MessGui()
+ {
+ //
+ // prepare for interprocess communication:
+ //
+ int filedes[2]; // 0 - reading 1 - writing
+ if (pipe(filedes) == -1) {
+ perror("thread:creating pipe4");
+ exit(-1);
+ }
+ readFd = filedes[0];
+ writeFd = filedes[1];
+ wFifoSize = 0;
+ wFifoWindex = 0;
+ wFifoRindex = 0;
+ rFifoSize = 0;
+ rFifoWindex = 0;
+ rFifoRindex = 0;
+ }
+
+//---------------------------------------------------------
+// MessGui
+//---------------------------------------------------------
+
+MessGui::~MessGui()
+ {
+ }
+
+//---------------------------------------------------------
+// readMessage
+//---------------------------------------------------------
+
+void MessGui::readMessage()
+ {
+ char c;
+ while (rFifoSize) {
+ ::read(readFd, &c, 1);
+ processEvent(rFifo[rFifoRindex]);
+ rFifoRindex = (rFifoRindex + 1) % EVENT_FIFO_SIZE;
+ --rFifoSize;
+ }
+ }
+
+//---------------------------------------------------------
+// sendEvent
+//---------------------------------------------------------
+
+void MessGui::sendEvent(const MidiPlayEvent& ev)
+ {
+ if (wFifoSize == EVENT_FIFO_SIZE) {
+ printf("event gui->synti fifo overflow\n");
+ return;
+ }
+ wFifo[wFifoWindex] = ev;
+ wFifoWindex = (wFifoWindex + 1) % EVENT_FIFO_SIZE;
+ ++wFifoSize;
+ }
+
+//---------------------------------------------------------
+// sendController
+//---------------------------------------------------------
+
+void MessGui::sendController(int ch, int idx, int val)
+ {
+// MidiPlayEvent pe(0, 0, ch, ME_CONTROLLER, idx, val);
+// sendEvent(pe);
+
+ sendEvent(MidiPlayEvent(0, 0, ch, ME_CONTROLLER, idx, val));
+ }
+
+//---------------------------------------------------------
+// sendSysex
+//---------------------------------------------------------
+
+void MessGui::sendSysex(unsigned char* p, int n)
+ {
+// MidiPlayEvent pe(0, 0, ME_SYSEX, p, n);
+// sendEvent(pe);
+
+ sendEvent(MidiPlayEvent(0, 0, ME_SYSEX, p, n));
+ }
+
+//---------------------------------------------------------
+// writeEvent
+// send an event to synti gui
+//---------------------------------------------------------
+
+void MessGui::writeEvent(const MidiPlayEvent& ev)
+ {
+ if (rFifoSize == EVENT_FIFO_SIZE) {
+ printf("event synti->gui fifo overflow\n");
+ return;
+ }
+ rFifo[rFifoWindex] = ev;
+ rFifoWindex = (rFifoWindex + 1) % EVENT_FIFO_SIZE;
+ ++rFifoSize;
+ write(writeFd, "x", 1); // wakeup GUI
+ }
+
+//---------------------------------------------------------
+// readEvent
+// read event from synti gui
+//---------------------------------------------------------
+
+MidiPlayEvent MessGui::readEvent()
+ {
+ MidiPlayEvent ev = wFifo[wFifoRindex];
+ wFifoRindex = (wFifoRindex + 1) % EVENT_FIFO_SIZE;
+ --wFifoSize;
+ return ev;
+ }
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/gui.h b/attic/muse2-oom/muse2/synti/libsynti/gui.h
new file mode 100644
index 00000000..54044243
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/gui.h
@@ -0,0 +1,72 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// software synthesizer helper library
+// $Id: gui.h,v 1.4 2004/06/19 09:50:37 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SYNTH_GUI_H__
+#define __SYNTH_GUI_H__
+
+#include "mpevent.h"
+
+const int EVENT_FIFO_SIZE = 256;
+class QWidget;
+
+//---------------------------------------------------------
+// MessGui
+// manage IO from synti-GUI to Host
+//---------------------------------------------------------
+
+class MessGui {
+ int writeFd;
+
+ // Event Fifo synti -> GUI
+ MidiPlayEvent rFifo[EVENT_FIFO_SIZE];
+ volatile int rFifoSize;
+ int rFifoWindex;
+ int rFifoRindex;
+
+ // Event Fifo GUI -> synti
+ MidiPlayEvent wFifo[EVENT_FIFO_SIZE];
+ volatile int wFifoSize;
+ int wFifoWindex;
+ int wFifoRindex;
+
+ protected:
+ int readFd;
+ void readMessage();
+ void sendEvent(const MidiPlayEvent& ev);
+ void sendController(int,int,int);
+ void sendSysex(unsigned char*, int);
+
+ virtual void processEvent(const MidiPlayEvent&) {};
+
+ public:
+ MessGui();
+ virtual ~MessGui();
+
+ void writeEvent(const MidiPlayEvent&);
+ int fifoSize() const { return wFifoSize; }
+ MidiPlayEvent readEvent();
+ };
+
+//---------------------------------------------------------
+// SynthGuiCtrl
+//---------------------------------------------------------
+
+struct SynthGuiCtrl {
+ enum EditorType { SLIDER, SWITCH, COMBOBOX };
+ QWidget* editor;
+ QWidget* label;
+ EditorType type;
+
+ SynthGuiCtrl() {}
+ SynthGuiCtrl(QWidget* w, QWidget* l, const EditorType t)
+ : editor(w), label(l), type(t) {}
+ };
+
+#endif
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/mess.cpp b/attic/muse2-oom/muse2/synti/libsynti/mess.cpp
new file mode 100644
index 00000000..8c23d8ea
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/mess.cpp
@@ -0,0 +1,125 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mess.cpp,v 1.2 2004/04/15 13:46:18 wschweer Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mess.h"
+#include "muse/midi.h"
+#include "muse/midictrl.h"
+
+static const int FIFO_SIZE = 32;
+
+//---------------------------------------------------------
+// MessP
+//---------------------------------------------------------
+
+struct MessP {
+ // Event Fifo synti -> Host:
+ MidiPlayEvent fifo[FIFO_SIZE];
+ volatile int fifoSize;
+ int fifoWindex;
+ int fifoRindex;
+ };
+
+//---------------------------------------------------------
+// Mess
+//---------------------------------------------------------
+
+Mess::Mess(int n)
+ {
+ _channels = n;
+ _sampleRate = 44100;
+ d = new MessP;
+ d->fifoSize = 0;
+ d->fifoWindex = 0;
+ d->fifoRindex = 0;
+ }
+
+//---------------------------------------------------------
+// Mess
+//---------------------------------------------------------
+
+Mess::~Mess()
+ {
+ delete d;
+ }
+
+//---------------------------------------------------------
+// getGeometry
+// dummy
+//---------------------------------------------------------
+
+void Mess::getGeometry(int* x, int* y, int* w, int* h) const
+ {
+ x = 0;
+ y = 0;
+ w = 0;
+ h = 0;
+ }
+
+//---------------------------------------------------------
+// sendEvent
+// send Event synti -> host
+//---------------------------------------------------------
+
+void Mess::sendEvent(MidiPlayEvent ev)
+ {
+ if (d->fifoSize == FIFO_SIZE) {
+ printf("event synti->host fifo overflow\n");
+ return;
+ }
+ d->fifo[d->fifoWindex] = ev;
+ d->fifoWindex = (d->fifoWindex + 1) % FIFO_SIZE;
+ ++(d->fifoSize);
+ }
+
+//---------------------------------------------------------
+// receiveEvent
+// called from host
+//---------------------------------------------------------
+
+MidiPlayEvent Mess::receiveEvent()
+ {
+ MidiPlayEvent ev = d->fifo[d->fifoRindex];
+ d->fifoRindex = (d->fifoRindex + 1) % FIFO_SIZE;
+ --(d->fifoSize);
+ return ev;
+ }
+
+//---------------------------------------------------------
+// eventsPending
+// called from host:
+// while (eventsPending()) {
+// receiveEvent();
+// ...
+//---------------------------------------------------------
+
+int Mess::eventsPending() const
+ {
+ return d->fifoSize;
+ }
+
+//---------------------------------------------------------
+// processEvent
+// return true if synti is busy
+//---------------------------------------------------------
+
+bool Mess::processEvent(const MidiPlayEvent& ev)
+ {
+ switch(ev.type()) {
+ case ME_NOTEON:
+ return playNote(ev.channel(), ev.dataA(), ev.dataB());
+ case ME_NOTEOFF:
+ return playNote(ev.channel(), ev.dataA(), 0);
+ case ME_SYSEX:
+ return sysex(ev.len(), ev.data());
+ case ME_CONTROLLER:
+ return setController(ev.channel(), ev.dataA(), ev.dataB());
+ case ME_PITCHBEND: // Tim.
+ return setController(ev.channel(), CTRL_PITCH, ev.dataA());
+ }
+ return false;
+ }
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/mess.h b/attic/muse2-oom/muse2/synti/libsynti/mess.h
new file mode 100644
index 00000000..ea4f425f
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/mess.h
@@ -0,0 +1,103 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mess.h,v 1.3.2.3 2009/11/19 04:20:33 terminator356 Exp $
+// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MESS_H__
+#define __MESS_H__
+
+#define MESS_MAJOR_VERSION 1
+#define MESS_MINOR_VERSION 1
+
+#include "mpevent.h"
+
+class QWidget;
+class QString;
+class MessP;
+
+//---------------------------------------------------------
+// MidiPatch
+//---------------------------------------------------------
+
+#define MP_TYPE_GM 1
+#define MP_TYPE_GS 2
+#define MP_TYPE_XG 4
+#define MP_TYPE_LBANK 8
+#define MP_TYPE_HBANK 16
+
+struct MidiPatch {
+ signed char typ; // 1 - GM 2 - GS 4 - XG
+ signed char hbank, lbank, prog;
+ const char* name;
+ };
+
+//---------------------------------------------------------
+// Mess
+// MusE experimental software synth
+// Instance virtual interface class
+//---------------------------------------------------------
+
+class Mess {
+ MessP* d;
+
+ int _sampleRate;
+ int _channels; // 1 - mono, 2 - stereo
+
+ public:
+ Mess(int channels);
+ virtual ~Mess();
+
+ int channels() const { return _channels; }
+ int sampleRate() const { return _sampleRate; }
+ void setSampleRate(int r) { _sampleRate = r; }
+
+ virtual void processMessages() { };
+ virtual void process(float** data, int offset, int len) = 0;
+
+ // the synti has to (re-)implement processEvent() or provide
+ // some of the next three functions:
+
+ virtual bool processEvent(const MidiPlayEvent&);
+ virtual bool setController(int, int, int) { return false; }
+ virtual bool playNote(int, int, int) { return false; }
+ virtual bool sysex(int, const unsigned char*) { return false; }
+
+ virtual void getInitData(int*, const unsigned char**) const {}
+ virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const {return 0;}
+ virtual const char* getPatchName(int, int, int, bool) const { return "?"; }
+ virtual const MidiPatch* getPatchInfo(int, const MidiPatch*) const { return 0; }
+
+ // synthesizer -> host communication
+ void sendEvent(MidiPlayEvent); // called from synti
+ MidiPlayEvent receiveEvent(); // called from host
+ int eventsPending() const;
+
+ // GUI interface routines
+ virtual bool hasGui() const { return false; }
+ virtual bool guiVisible() const { return false; }
+ virtual void showGui(bool) {}
+ virtual void getGeometry(int* x, int* y, int* w, int* h) const;
+ virtual void setGeometry(int, int, int, int) {}
+ };
+
+//---------------------------------------------------------
+// MESS
+// Class descriptor
+//---------------------------------------------------------
+
+struct MESS {
+ const char* name;
+ const char* description;
+ const char* version;
+ int majorMessVersion, minorMessVersion;
+ Mess* (*instantiate)(int sr, QWidget* parent, QString* projectPathPtr, const char* name);
+ };
+
+extern "C" {
+ const MESS* mess_descriptor();
+ }
+
+#endif
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/mono.cpp b/attic/muse2-oom/muse2/synti/libsynti/mono.cpp
new file mode 100644
index 00000000..14a23aca
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/mono.cpp
@@ -0,0 +1,47 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// software synthesizer helper library
+// $Id: mono.cpp,v 1.2 2004/04/15 13:46:18 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mono.h"
+
+//---------------------------------------------------------
+// playNote
+//---------------------------------------------------------
+
+bool MessMono::playNote(int channel, int pitch, int velo)
+ {
+ if (velo == 0) {
+ if (pitchStack.empty())
+ return false;
+ if (pitchStack.back().pitch == pitch) {
+ pitchStack.pop_back();
+ if (pitchStack.empty()) {
+ note(channel, pitch, 0);
+ return false;
+ }
+ PitchVelo pv = pitchStack.back();
+ note(pv.channel, pv.pitch, pv.velo); // change pitch
+ return false;
+ }
+ for (std::list<PitchVelo>::iterator i = pitchStack.begin();
+ i != pitchStack.end(); ++i) {
+ if ((*i).pitch == pitch) {
+ pitchStack.erase(i);
+ return false;
+ }
+ }
+ // no noteon found
+ // emergency stop:
+ note(channel, pitch, velo);
+ return false;
+ }
+ pitchStack.push_back(PitchVelo(channel, pitch, velo));
+ note(channel, pitch, velo);
+ return false;
+ }
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/mono.h b/attic/muse2-oom/muse2/synti/libsynti/mono.h
new file mode 100644
index 00000000..f2f8bdf7
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/mono.h
@@ -0,0 +1,47 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// software synthesizer helper library
+// $Id: mono.h,v 1.4 2004/04/15 13:46:18 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SYNTH_MONO_H__
+#define __SYNTH_MONO_H
+
+#include <list>
+#include "mess.h"
+
+//---------------------------------------------------------
+// PitchVelo
+//---------------------------------------------------------
+
+struct PitchVelo {
+ signed char channel;
+ signed char pitch;
+ signed char velo;
+ PitchVelo(signed char a, signed char b, signed char c)
+ : channel(a), pitch(b), velo(c) {}
+ };
+
+//---------------------------------------------------------
+// MessMono
+// implements some functions for monophone
+// synthesizer
+//---------------------------------------------------------
+
+class MessMono : public Mess {
+ std::list<PitchVelo> pitchStack;
+
+ protected:
+ virtual bool playNote(int channel, int pitch, int velo);
+ virtual void note(int channel, int pitch, int velo) = 0;
+
+ public:
+ MessMono() : Mess(1) {}
+ virtual ~MessMono() {}
+ };
+
+#endif
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/mpevent.cpp.OLD b/attic/muse2-oom/muse2/synti/libsynti/mpevent.cpp.OLD
new file mode 100644
index 00000000..482bc952
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/mpevent.cpp.OLD
@@ -0,0 +1,22 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mpevent.cpp,v 1.1 2004/02/12 18:30:30 wschweer Exp $
+//
+// (C) Copyright 2002-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mpevent.h"
+
+//---------------------------------------------------------
+// MEvent
+//---------------------------------------------------------
+
+MEvent::MEvent(unsigned t, int port, int tpe, const unsigned char* data, int len)
+ {
+ _time = t;
+ _port = port;
+ edata.setData(data, len);
+ _type = tpe;
+ }
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/mpevent.h.OLD b/attic/muse2-oom/muse2/synti/libsynti/mpevent.h.OLD
new file mode 100644
index 00000000..8568169f
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/mpevent.h.OLD
@@ -0,0 +1,100 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mpevent.h,v 1.1 2004/02/12 18:30:31 wschweer Exp $
+//
+// (C) Copyright 1999-2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MPEVENT_H__
+#define __MPEVENT_H__
+
+#include "evdata.h"
+
+//---------------------------------------------------------
+// MEvent
+// baseclass for MidiPlayEvent and MidiRecordEvent
+//---------------------------------------------------------
+
+//---------------------------------------------------------
+// MEvent
+//---------------------------------------------------------
+
+class MEvent {
+ unsigned _time;
+ EvData edata;
+ unsigned char _port, _channel, _type;
+ int _a, _b;
+
+ public:
+ MEvent() {}
+ MEvent(unsigned tm, int p, int c, int t, int a, int b)
+ : _time(tm), _port(p), _channel(c & 0xf), _type(t), _a(a), _b(b) {}
+ MEvent(unsigned t, int p, int type, const unsigned char* data, int len);
+ MEvent(unsigned t, int p, int tpe, EvData d) : _time(t), edata(d), _port(p), _type(tpe) {}
+
+ ~MEvent() {}
+
+ int port() const { return _port; }
+ int channel() const { return _channel; }
+ int type() const { return _type; }
+ int dataA() const { return _a; }
+ int dataB() const { return _b; }
+ unsigned time() const { return _time; }
+
+ void setPort(int val) { _port = val; }
+ void setChannel(int val) { _channel = val; }
+ void setType(int val) { _type = val; }
+ void setA(int val) { _a = val; }
+ void setB(int val) { _b = val; }
+ void setTime(unsigned val) { _time = val; }
+
+ const EvData& eventData() const { return edata; }
+ unsigned char* data() const { return edata.data; }
+ int len() const { return edata.dataLen; }
+ void setData(const EvData& e) { edata = e; }
+ void setData(const unsigned char* p, int len) { edata.setData(p, len); }
+ bool isNote() const { return _type == 0x90; }
+ bool isNoteOff() const { return (_type == 0x80)||(_type == 0x90 && _b == 0); }
+ };
+
+//---------------------------------------------------------
+// MidiRecordEvent
+// allocated and deleted in midiseq thread context
+//---------------------------------------------------------
+
+class MidiPlayEvent;
+
+class MidiRecordEvent : public MEvent {
+ public:
+ MidiRecordEvent() {}
+ MidiRecordEvent(const MEvent& e) : MEvent(e) {}
+ MidiRecordEvent(unsigned tm, int p, int c, int t, int a, int b)
+ : MEvent(tm, p, c, t, a, b) {}
+ MidiRecordEvent(unsigned t, int p, int tpe, const unsigned char* data, int len)
+ : MEvent(t, p, tpe, data, len) {}
+ MidiRecordEvent(unsigned t, int p, int type, EvData data)
+ : MEvent(t, p, type, data) {}
+ ~MidiRecordEvent() {}
+ };
+
+//---------------------------------------------------------
+// MidiPlayEvent
+// allocated and deleted in audio thread context
+//---------------------------------------------------------
+
+class MidiPlayEvent : public MEvent {
+ public:
+ MidiPlayEvent() {}
+ MidiPlayEvent(const MEvent& e) : MEvent(e) {}
+ MidiPlayEvent(unsigned tm, int p, int c, int t, int a, int b)
+ : MEvent(tm, p, c, t, a, b) {}
+ MidiPlayEvent(unsigned t, int p, int type, const unsigned char* data, int len)
+ : MEvent(t, p, type, data, len) {}
+ MidiPlayEvent(unsigned t, int p, int type, EvData data)
+ : MEvent(t, p, type, data) {}
+ ~MidiPlayEvent() {}
+ };
+
+#endif
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/poly.cpp b/attic/muse2-oom/muse2/synti/libsynti/poly.cpp
new file mode 100644
index 00000000..e76fe966
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/poly.cpp
@@ -0,0 +1,35 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// software synthesizer helper library
+// $Id: poly.cpp,v 1.3 2004/06/01 14:25:50 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "poly.h"
+#include "muse/midictrl.h"
+
+//---------------------------------------------------------
+// playNote
+//---------------------------------------------------------
+
+bool MessPoly::playNote(int /*channel*/, int /*pitch*/, int /*velo*/)
+ {
+ return false;
+ }
+
+//---------------------------------------------------------
+// setController
+//---------------------------------------------------------
+
+bool MessPoly::setController(int /*channel*/, int num, int /*val*/)
+ {
+ switch(num) {
+ case CTRL_VOLUME:
+ case CTRL_EXPRESSION:
+ break;
+ }
+ return false;
+ }
+
diff --git a/attic/muse2-oom/muse2/synti/libsynti/poly.h b/attic/muse2-oom/muse2/synti/libsynti/poly.h
new file mode 100644
index 00000000..b990b198
--- /dev/null
+++ b/attic/muse2-oom/muse2/synti/libsynti/poly.h
@@ -0,0 +1,39 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// software synthesizer helper library
+// $Id: poly.h,v 1.2 2004/04/15 13:46:18 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SYNTH_POLY_H__
+#define __SYNTH_POLY_H
+
+#include <list>
+#include "mess.h"
+
+//---------------------------------------------------------
+// MessPoly
+// implements some functions for monophone
+// synthesizer
+//---------------------------------------------------------
+
+class MessPoly : public Mess {
+ float volume;
+ float expression;
+
+ // cached values:
+ float mainLevel;
+
+ protected:
+ virtual bool playNote(int channel, int pitch, int velo);
+ virtual bool setController(int, int, int);
+
+ public:
+ MessPoly() : Mess(1) {}
+ virtual ~MessPoly() {}
+ };
+
+#endif
+