From e40fc849149dd97c248866a4a1d026dda5e57b62 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Mon, 7 Mar 2011 19:01:11 +0000 Subject: clean3 --- .../muse2/synti/simpledrums/CMakeLists.txt | 53 + attic/muse2-oom/muse2/synti/simpledrums/COPYING | 3 + attic/muse2-oom/muse2/synti/simpledrums/README | 44 + .../muse2/synti/simpledrums/ReleaseNotes.txt | 21 + attic/muse2-oom/muse2/synti/simpledrums/common.h | 110 ++ .../muse2/synti/simpledrums/simpledrums.cpp | 1766 ++++++++++++++++++++ .../muse2/synti/simpledrums/simpledrums.h | 178 ++ .../muse2/synti/simpledrums/simpledrumsgui.cpp | 893 ++++++++++ .../muse2/synti/simpledrums/simpledrumsgui.h | 212 +++ .../muse2/synti/simpledrums/simpledrumsguibase.ui | 27 + .../muse2-oom/muse2/synti/simpledrums/ssplugin.cpp | 461 +++++ attic/muse2-oom/muse2/synti/simpledrums/ssplugin.h | 153 ++ .../muse2/synti/simpledrums/sspluginchooserbase.ui | 134 ++ .../muse2/synti/simpledrums/ssplugingui.cpp | 534 ++++++ .../muse2/synti/simpledrums/ssplugingui.h | 206 +++ 15 files changed, 4795 insertions(+) create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/CMakeLists.txt create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/COPYING create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/README create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/ReleaseNotes.txt create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/common.h create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/simpledrums.cpp create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/simpledrums.h create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/simpledrumsgui.cpp create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/simpledrumsgui.h create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/simpledrumsguibase.ui create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/ssplugin.cpp create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/ssplugin.h create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/sspluginchooserbase.ui create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/ssplugingui.cpp create mode 100644 attic/muse2-oom/muse2/synti/simpledrums/ssplugingui.h (limited to 'attic/muse2-oom/muse2/synti/simpledrums') diff --git a/attic/muse2-oom/muse2/synti/simpledrums/CMakeLists.txt b/attic/muse2-oom/muse2/synti/simpledrums/CMakeLists.txt new file mode 100644 index 00000000..6b015f2b --- /dev/null +++ b/attic/muse2-oom/muse2/synti/simpledrums/CMakeLists.txt @@ -0,0 +1,53 @@ +#============================================================================= +# 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 ( simpledrums_mocs simpledrumsgui.h ssplugingui.h ) +# QT4_WRAP_UI ( simpledrums_uis simpledrumsguibase.ui sspluginchooserbase.ui ) +QT4_WRAP_UI3 ( simpledrums_uis simpledrumsguibase.ui sspluginchooserbase.ui ) + +add_library ( simpledrums SHARED + simpledrums.cpp + simpledrumsgui.cpp + simpledrums.h + ssplugin.cpp + ssplugingui.cpp + ssplugin.h + common.h + ${simpledrums_mocs} + ${simpledrums_uis} + ) + +# - tell cmake to name target simpledrums.so instead of +# libsimpledrums.so +# - use precompiled header files +# +set_target_properties ( simpledrums + PROPERTIES PREFIX "" + COMPILE_FLAGS "-O6 -fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h" + ) + +target_link_libraries(simpledrums + synti +# awl + ${QT_LIBRARIES} + ) + +install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ simpledrums ) + diff --git a/attic/muse2-oom/muse2/synti/simpledrums/COPYING b/attic/muse2-oom/muse2/synti/simpledrums/COPYING new file mode 100644 index 00000000..5c3cefc2 --- /dev/null +++ b/attic/muse2-oom/muse2/synti/simpledrums/COPYING @@ -0,0 +1,3 @@ +COPYING +--------------------------------------- +This software is licensed under GNU GPL. diff --git a/attic/muse2-oom/muse2/synti/simpledrums/README b/attic/muse2-oom/muse2/synti/simpledrums/README new file mode 100644 index 00000000..9e2695dc --- /dev/null +++ b/attic/muse2-oom/muse2/synti/simpledrums/README @@ -0,0 +1,44 @@ +-------------------------------------- +Simpledrums v 0.2, by Mathias Lundgren +-------------------------------------- + +Simpledrums is a simple MESS-synth sampler (MusE Experimental Soft +Synth) aiming at becoming a simple, tightly integrated sampler for +MusE, specifically aimed at drumsamples. + +Features: +- 16 channels/samples (1 sample/channel) +- Simple controls for each individual channel: volume, balance, noteoff-ignore, channel on/off +- Main volume +- 4 LADSPA send-effects can be used, 4 effect taps for each individual channel +- All channel parameters are controllable via the GUI, or by MusE:s controller handling (controller pane in pianoroll/drumeditor) +- All effect parameters can be controlled via the GUI, or by Sysex messages (f.ex. turn effect on/off, modify effect parameters) +- Complete synth state (fx-parameters, samples etc) is saved together with MusE project, and restored later when loaded +- Possible to save synth state to file +- Samples automatically resampled when loaded (if needed) + +That's all folks! + +------------- +Known issues: +------------- +- Not the prettiest gui in the world +- All samples are read directly into memory (no caching) +- Some obscure LADSPA-effects make SimpleSynth segfault +- More... + +------------- +Future plans: +------------- +- Fix all the known issues! ;-) +- Sample loops +- Sample offset variation w respect to note velocity +- Treble/eq-controller for each individual channel +- Treble level variation w respect to note velocity +- More... + +Mathias Lundgren, (lunar_shuttle@users.sourceforge.net), 2004 +Plugin management code based on Werner Schweers plugin management handling for MusE + +(C) Copyright Mathias Lundgren, Werner Schweer 2000-2004 +Licensed under the GNU General Public License diff --git a/attic/muse2-oom/muse2/synti/simpledrums/ReleaseNotes.txt b/attic/muse2-oom/muse2/synti/simpledrums/ReleaseNotes.txt new file mode 100644 index 00000000..1144321a --- /dev/null +++ b/attic/muse2-oom/muse2/synti/simpledrums/ReleaseNotes.txt @@ -0,0 +1,21 @@ +RELEASE NOTES: +-------------- +2005-05-07 ver 1.0 (go figure!) +- Now possible to load/save setup to file + +2004-12-13 ver 0.2 +- Support for 4 LADSPA sendeffects added +- Resampling of samples when loading (libsamplerate) +- Synth state is saved to/restored from project file +- Channel settings: balance, volume, effect tap for each sendeffect +- Effect settings: all LADSPA parameters controllable and saved to MusE project, effect master volume, effect on/off +- Support for mono + stereo samples +- Support for stereo + mono LADSPA effects +- Bugfixes, GUI-improvements etc... + +2004-11-09 ver 0.1 +- Simpledrums initial release +- 16 channels (1 sample for each channel) with parameters: volume, balance, noteoff-ignore + +(C) Copyright Mathias Lundgren, Werner Schweer 2000-2004 +Licensed under the GNU General Public License diff --git a/attic/muse2-oom/muse2/synti/simpledrums/common.h b/attic/muse2-oom/muse2/synti/simpledrums/common.h new file mode 100644 index 00000000..e4763540 --- /dev/null +++ b/attic/muse2-oom/muse2/synti/simpledrums/common.h @@ -0,0 +1,110 @@ +// +// C++ Interface: common +// +// Description: +// +// +// Author: Mathias Lundgren , (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef __MUSE_TESTO_COMMON_H__ +#define __MUSE_TESTO_COMMON_H__ + +#include "muse/midictrl.h" + +#define SS_VERSIONSTRING "1.0" + +#define SS_DEBUG 0 +#define SS_DEBUG_INIT 0 +#define SS_TRACE_FUNC 0 +#define SS_DEBUG_MIDI 0 +#define SS_DEBUG_LADSPA 0 +#define SS_DEBUG_STATE 0 + +#define SS_DBG(string) if (SS_DEBUG) fprintf(stderr, "%s:%d:%s: %s\n", __FILE__ , __LINE__ , __PRETTY_FUNCTION__, string); +#define SS_DBG2(string1, string2) if (SS_DEBUG) fprintf(stderr, "%s:%d:%s: %s: %s\n", __FILE__ , __LINE__ , __PRETTY_FUNCTION__, string1, string2); +#define SS_DBG_I(string1, int) if (SS_DEBUG) fprintf(stderr, "%s:%d:%s: %s: %d\n", __FILE__ , __LINE__ , __PRETTY_FUNCTION__, string1, int); + +#define SS_TRACE_IN if (SS_TRACE_FUNC) fprintf (stderr, "->%s:%d\n", __PRETTY_FUNCTION__, __LINE__); +#define SS_TRACE_OUT if (SS_TRACE_FUNC) fprintf (stderr, "<-%s:%d\n", __PRETTY_FUNCTION__, __LINE__); +#define SS_ERROR(string) fprintf(stderr, "SimpleDrums error: %s\n", string) +#define SS_DBG_LADSPA(string1) if (SS_DEBUG_LADSPA) fprintf(stderr, "%s:%d:%s: %s\n", __FILE__ , __LINE__ , __PRETTY_FUNCTION__, string1); +#define SS_DBG_LADSPA2(string1, string2) if (SS_DEBUG_LADSPA) fprintf(stderr, "%s:%d:%s: %s: %s\n", __FILE__ , __LINE__ , __PRETTY_FUNCTION__, string1, string2); + +#define SS_SYSEX_INIT_DATA_VERSION 1 + +#define SS_NR_OF_CHANNELS 16 +#define SS_AUDIO_CHANNELS 2 +#define SS_NR_OF_SENDEFFECTS 4 + +// Controller-related: +#define SS_CHANNEL_CTRL_VOLUME 0 +#define SS_CHANNEL_CTRL_PAN 1 +#define SS_CHANNEL_CTRL_NOFF 2 +#define SS_CHANNEL_CTRL_ONOFF 3 +#define SS_CHANNEL_SENDFX1 4 +#define SS_CHANNEL_SENDFX2 5 +#define SS_CHANNEL_SENDFX3 6 +#define SS_CHANNEL_SENDFX4 7 + +#define SS_PLUGIN_RETURN 0 +#define SS_PLUGIN_ONOFF 1 + +#define SS_NR_OF_MASTER_CONTROLLERS 1 +#define SS_NR_OF_CHANNEL_CONTROLLERS 8 +#define SS_NR_OF_PLUGIN_CONTROLLERS 2 + +#define SS_NR_OF_CONTROLLERS (SS_NR_OF_MASTER_CONTROLLERS + (SS_NR_OF_CHANNELS * SS_NR_OF_CHANNEL_CONTROLLERS) + (SS_NR_OF_PLUGIN_CONTROLLERS*SS_NR_OF_SENDEFFECTS)) +#define SS_FIRST_MASTER_CONTROLLER CTRL_NRPN14_OFFSET +#define SS_FIRST_CHANNEL_CONTROLLER (SS_FIRST_MASTER_CONTROLLER + SS_NR_OF_MASTER_CONTROLLERS) +#define SS_LAST_MASTER_CONTROLLER (SS_FIRST_CHANNEL_CONTROLLER - 1) +#define SS_LAST_CHANNEL_CONTROLLER (SS_FIRST_CHANNEL_CONTROLLER -1 + (SS_NR_OF_CHANNEL_CONTROLLERS * SS_NR_OF_CHANNELS)) + +#define SS_FIRST_PLUGIN_CONTROLLER (SS_LAST_CHANNEL_CONTROLLER + 1) +#define SS_LAST_PLUGIN_CONTROLLER (SS_FIRST_PLUGIN_CONTROLLER -1 + SS_NR_OF_SENDEFFECTS*SS_NR_OF_PLUGIN_CONTROLLERS) + +#define SS_MASTER_CTRL_VOLUME SS_FIRST_MASTER_CONTROLLER + +#define SS_CHANNEL_VOLUME_CONTROLLER(int) (SS_FIRST_CHANNEL_CONTROLLER + (SS_NR_OF_CHANNEL_CONTROLLERS * int) + SS_CHANNEL_CTRL_VOLUME) +#define SS_CHANNEL_PAN_CONTROLLER(int) (SS_FIRST_CHANNEL_CONTROLLER + (SS_NR_OF_CHANNEL_CONTROLLERS * int) + SS_CHANNEL_CTRL_PAN) +#define SS_CHANNEL_NOFF_CONTROLLER(int) (SS_FIRST_CHANNEL_CONTROLLER + (SS_NR_OF_CHANNEL_CONTROLLERS * int) + SS_CHANNEL_CTRL_NOFF) +#define SS_CHANNEL_ONOFF_CONTROLLER(int) (SS_FIRST_CHANNEL_CONTROLLER + (SS_NR_OF_CHANNEL_CONTROLLERS * int) + SS_CHANNEL_CTRL_ONOFF) +#define SS_CHANNEL_SENDFX_CONTROLLER(int1,int2) (SS_FIRST_CHANNEL_CONTROLLER + (SS_NR_OF_CHANNEL_CONTROLLERS * int1) + SS_CHANNEL_SENDFX1 + int2) + +#define SS_PLUGIN_RETURNLEVEL_CONTROLLER(int) (SS_FIRST_PLUGIN_CONTROLLER + (int * SS_NR_OF_PLUGIN_CONTROLLERS)) +#define SS_PLUGIN_ONOFF_CONTROLLER(int) (SS_FIRST_PLUGIN_CONTROLLER + (int * SS_NR_OF_PLUGIN_CONTROLLERS) + 1) + +#define SS_LOWEST_NOTE 36 +#define SS_HIGHEST_NOTE (SS_LOWEST_NOTE + SS_NR_OF_CHANNELS) + +#define SS_PLUGIN_PARAM_MIN 0 +#define SS_PLUGIN_PARAM_MAX 127 + +typedef unsigned char byte; + +enum { + SS_SYSEX_LOAD_SAMPLE = 0, // gui -> synth: tell synth to load sample + SS_SYSEX_INIT_DATA, // synth reinitialization, the position of this (1) in the enum must not be changed since this value is written into proj file + SS_SYSEX_LOAD_SAMPLE_OK, // synth -> gui: tell gui sample loaded OK + SS_SYSEX_LOAD_SAMPLE_ERROR, // synth -> gui: tell gui sample ! loaded OK + SS_SYSEX_CLEAR_SAMPLE, // gui -> synth: tell synth to clear sample + SS_SYSEX_CLEAR_SAMPLE_OK, // synth->gui: confirm sample cleared OK + SS_SYSEX_LOAD_SENDEFFECT, // gui -> synth: tell synth to load laspa-effect + SS_SYSEX_LOAD_SENDEFFECT_OK,// synth->gui: plugin loaded ok + SS_SYSEX_LOAD_SENDEFFECT_ERROR, // synth->gui: plugin _not_ loaded ok + SS_SYSEX_CLEAR_SENDEFFECT, // gui->synth: clear plugin + SS_SYSEX_CLEAR_SENDEFFECT_OK,// synth->gui: plugin cleared + SS_SYSEX_SET_PLUGIN_PARAMETER, //gui->synth: set plugin parameter + SS_SYSEX_SET_PLUGIN_PARAMETER_OK, // synth->gui: set plugin parameter (update gui) + SS_SYSEX_ERRORMSG, // synth -> gui: general error message from synth + SS_SYSEX_GET_INIT_DATA, // gui->synth: request init data + SS_SYSEX_SEND_INIT_DATA // synth->gui: give gui init data + }; + +extern int SS_samplerate; +extern float SS_map_pluginparam2logdomain(int pluginparam_val); +extern int SS_map_logdomain2pluginparam(float pluginparam_log); +#endif + diff --git a/attic/muse2-oom/muse2/synti/simpledrums/simpledrums.cpp b/attic/muse2-oom/muse2/synti/simpledrums/simpledrums.cpp new file mode 100644 index 00000000..43f9ccee --- /dev/null +++ b/attic/muse2-oom/muse2/synti/simpledrums/simpledrums.cpp @@ -0,0 +1,1766 @@ +// +// C++ Implementation: simplesynth +// +// Description: +// +// +// Author: Mathias Lundgren , (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include "muse/midictrl.h" +#include "muse/midi.h" +//#include "libsynti/mpevent.h" +#include "muse/mpevent.h" +#include "simpledrums.h" +#include +#include + +const char* SimpleSynth::synth_state_descr[] = + { + "SS_INITIALIZING", + "SS_LOADING_SAMPLE", + "SS_CLEARING_SAMPLE", + "SS_RUNNING" + }; + +const char* SimpleSynth::channel_state_descr[] = + { + "SS_CHANNEL_INACTIVE", + "SS_SAMPLE_PLAYING" + }; + +#define SWITCH_SYNTH_STATE(state)\ +synth_state = state; \ +if (SS_DEBUG_STATE) \ + fprintf (stderr, "SS STATE: %s\n", SimpleSynth::synth_state_descr[state]); + +#define SWITCH_CHAN_STATE(ch, s)\ +channels[ch].state = s; \ +if (SS_DEBUG_STATE) \ + fprintf (stderr, "SS CHAN %d STATE: %s\n", ch, SimpleSynth::channel_state_descr[s]); + +#define SS_CHANNEL_VOLUME_QUOT 100.0 +#define SS_MASTER_VOLUME_QUOT 100.0 +int SS_samplerate; + +#define SS_LOG_MAX 0 +#define SS_LOG_MIN -10 +#define SS_LOG_OFFSET SS_LOG_MIN + + +// +// Map plugin parameter on domain [SS_PLUGIN_PARAM_MIN, SS_PLUGIN_PARAM_MAX] to domain [SS_LOG_MIN, SS_LOG_MAX] (log domain) +// +float SS_map_pluginparam2logdomain(int pluginparam_val) + { + float scale = (float) (SS_LOG_MAX - SS_LOG_MIN)/ (float) SS_PLUGIN_PARAM_MAX; + float scaled = (float) pluginparam_val * scale; + float mapped = scaled + SS_LOG_OFFSET; + return mapped; + } +// +// Map plugin parameter on domain to domain [SS_LOG_MIN, SS_LOG_MAX] to [SS_PLUGIN_PARAM_MIN, SS_PLUGIN_PARAM_MAX] (from log-> [0,127]) +// (inverse func to the above) +int SS_map_logdomain2pluginparam(float pluginparam_log) + { + float mapped = pluginparam_log - SS_LOG_OFFSET; + float scale = (float) SS_PLUGIN_PARAM_MAX / (float) (SS_LOG_MAX - SS_LOG_MIN); + int scaled = (int) round(mapped * scale); + return scaled; + } + +//--------------------------------------------------------- +// SimpleSynth +//--------------------------------------------------------- +SimpleSynth::SimpleSynth(int sr) + : Mess(SS_AUDIO_CHANNELS) + { + SS_TRACE_IN + SS_samplerate = sr; + SS_initPlugins(); + + simplesynth_ptr = this; + master_vol = 100.0 / SS_MASTER_VOLUME_QUOT; + master_vol_ctrlval = 100; + + //initialize + for (int i=0; idata; + delete channels[i].sample; + } + } + simplesynth_ptr = NULL; + + SS_DBG("Deleting pluginlist"); + //Cleanup plugins: + for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) { + delete (*i); + } + plugins.clear(); + + SS_DBG("Deleting sendfx buffers"); + //Delete sendfx buffers: + for (int i=0; i