From bf32fe9882d7dd1dd6fbb88f39a42371063b6cd6 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Mon, 1 Nov 2010 08:36:22 +0000 Subject: All MESS plugins: compile with -fvisibility=hidden, fixes LADSPA plugins not appearing in list. Added simpledrums2 (from muse_qt4_evolution). --- muse2/synti/CMakeLists.txt | 3 +- muse2/synti/deicsonze/CMakeLists.txt | 2 +- muse2/synti/deicsonze/deicsonze.cpp | 5 + muse2/synti/deicsonze2/CMakeLists.txt | 2 +- muse2/synti/deicsonze2/deicsonze.cpp | 5 + muse2/synti/fluid/CMakeLists.txt | 2 +- muse2/synti/fluid/fluid.cpp | 6 + muse2/synti/fluidsynth/CMakeLists.txt | 2 +- muse2/synti/fluidsynth/fluidsynti.cpp | 6 + muse2/synti/organ/CMakeLists.txt | 2 +- muse2/synti/organ/organ.cpp | 7 +- muse2/synti/s1/CMakeLists.txt | 5 +- muse2/synti/s1/s1.cpp | 7 +- muse2/synti/simpledrums/CMakeLists.txt | 2 +- muse2/synti/simpledrums/simpledrums.cpp | 6 + muse2/synti/simpledrums2/CMakeLists.txt | 52 + muse2/synti/simpledrums2/COPYING | 3 + muse2/synti/simpledrums2/README | 43 + muse2/synti/simpledrums2/ReleaseNotes.txt | 18 + muse2/synti/simpledrums2/common.h | 110 ++ muse2/synti/simpledrums2/simpledrums.cpp | 1726 +++++++++++++++++++++++ muse2/synti/simpledrums2/simpledrums.h | 173 +++ muse2/synti/simpledrums2/simpledrumsgui.cpp | 890 ++++++++++++ muse2/synti/simpledrums2/simpledrumsgui.h | 214 +++ muse2/synti/simpledrums2/simpledrumsguibase.ui | 23 + muse2/synti/simpledrums2/ssplugin.cpp | 460 ++++++ muse2/synti/simpledrums2/ssplugin.h | 173 +++ muse2/synti/simpledrums2/sspluginchooserbase.ui | 106 ++ muse2/synti/simpledrums2/ssplugingui.cpp | 530 +++++++ muse2/synti/simpledrums2/ssplugingui.h | 204 +++ muse2/synti/vam/CMakeLists.txt | 2 +- muse2/synti/vam/vam.cpp | 7 +- 32 files changed, 4784 insertions(+), 12 deletions(-) create mode 100644 muse2/synti/simpledrums2/CMakeLists.txt create mode 100644 muse2/synti/simpledrums2/COPYING create mode 100644 muse2/synti/simpledrums2/README create mode 100644 muse2/synti/simpledrums2/ReleaseNotes.txt create mode 100644 muse2/synti/simpledrums2/common.h create mode 100644 muse2/synti/simpledrums2/simpledrums.cpp create mode 100644 muse2/synti/simpledrums2/simpledrums.h create mode 100644 muse2/synti/simpledrums2/simpledrumsgui.cpp create mode 100644 muse2/synti/simpledrums2/simpledrumsgui.h create mode 100644 muse2/synti/simpledrums2/simpledrumsguibase.ui create mode 100644 muse2/synti/simpledrums2/ssplugin.cpp create mode 100644 muse2/synti/simpledrums2/ssplugin.h create mode 100644 muse2/synti/simpledrums2/sspluginchooserbase.ui create mode 100644 muse2/synti/simpledrums2/ssplugingui.cpp create mode 100644 muse2/synti/simpledrums2/ssplugingui.h (limited to 'muse2/synti') diff --git a/muse2/synti/CMakeLists.txt b/muse2/synti/CMakeLists.txt index b2bc87ea..1a7fd322 100644 --- a/muse2/synti/CMakeLists.txt +++ b/muse2/synti/CMakeLists.txt @@ -28,7 +28,8 @@ include_directories( ) # set (SubDirs libsynti s1 organ deicsonze deicsonze2 simpledrums vam) -set (SubDirs libsynti s1 organ deicsonze simpledrums vam) +# set (SubDirs libsynti s1 organ deicsonze simpledrums vam) +set (SubDirs libsynti s1 organ deicsonze simpledrums2 vam) if (HAVE_FLUIDSYNTH) set (SubDirs ${SubDirs} fluid fluidsynth ) diff --git a/muse2/synti/deicsonze/CMakeLists.txt b/muse2/synti/deicsonze/CMakeLists.txt index a39b0e14..c9da5854 100644 --- a/muse2/synti/deicsonze/CMakeLists.txt +++ b/muse2/synti/deicsonze/CMakeLists.txt @@ -47,7 +47,7 @@ add_library ( deicsonze SHARED set_target_properties ( deicsonze PROPERTIES PREFIX "" #COMPILE_FLAGS "-O2 -include ${PROJECT_BINARY_DIR}/all-pic.h" - COMPILE_FLAGS "-DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -include ${PROJECT_BINARY_DIR}/all-pic.h" + COMPILE_FLAGS "-fvisibility=hidden -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -include ${PROJECT_BINARY_DIR}/all-pic.h" ) target_link_libraries(deicsonze diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp index 3dc5fafd..4eea4102 100644 --- a/muse2/synti/deicsonze/deicsonze.cpp +++ b/muse2/synti/deicsonze/deicsonze.cpp @@ -1660,7 +1660,12 @@ extern "C" { MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate }; + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/deicsonze2/CMakeLists.txt b/muse2/synti/deicsonze2/CMakeLists.txt index 430953ca..12f88212 100644 --- a/muse2/synti/deicsonze2/CMakeLists.txt +++ b/muse2/synti/deicsonze2/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries( deicsonze synti ) set_target_properties ( deicsonze PROPERTIES PREFIX "" #COMPILE_FLAGS "-O2 -include ${PROJECT_BINARY_DIR}/all-pic.h" - COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all-pic.h" + COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h" ) target_link_libraries(deicsonze diff --git a/muse2/synti/deicsonze2/deicsonze.cpp b/muse2/synti/deicsonze2/deicsonze.cpp index 28b9183e..74c1f56e 100644 --- a/muse2/synti/deicsonze2/deicsonze.cpp +++ b/muse2/synti/deicsonze2/deicsonze.cpp @@ -4350,7 +4350,12 @@ extern "C" { MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate }; + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/fluid/CMakeLists.txt b/muse2/synti/fluid/CMakeLists.txt index 38184550..0007537f 100644 --- a/muse2/synti/fluid/CMakeLists.txt +++ b/muse2/synti/fluid/CMakeLists.txt @@ -38,7 +38,7 @@ add_library ( fluid SHARED # set_target_properties ( fluid PROPERTIES PREFIX "" - COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all-pic.h" + COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h" LINK_FLAGS "${FLUIDSYN_LDFLAGS}" # "-lfluidsynth" ) target_link_libraries(fluid diff --git a/muse2/synti/fluid/fluid.cpp b/muse2/synti/fluid/fluid.cpp index a03be4de..13cfbef3 100644 --- a/muse2/synti/fluid/fluid.cpp +++ b/muse2/synti/fluid/fluid.cpp @@ -61,6 +61,12 @@ extern "C" { MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate, }; + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/fluidsynth/CMakeLists.txt b/muse2/synti/fluidsynth/CMakeLists.txt index cdb298e2..0c3e1b97 100644 --- a/muse2/synti/fluidsynth/CMakeLists.txt +++ b/muse2/synti/fluidsynth/CMakeLists.txt @@ -38,7 +38,7 @@ add_library ( fluidsynth SHARED # set_target_properties ( fluidsynth PROPERTIES PREFIX "" - COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all-pic.h" + COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h" LINK_FLAGS "${FLUIDSYN_LDFLAGS}" # "-lfluidsynth" ) diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp index bf27a61c..bf12b7f8 100644 --- a/muse2/synti/fluidsynth/fluidsynti.cpp +++ b/muse2/synti/fluidsynth/fluidsynti.cpp @@ -1310,6 +1310,12 @@ extern "C" MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate, }; + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/organ/CMakeLists.txt b/muse2/synti/organ/CMakeLists.txt index 8dd67aa8..40db20c1 100644 --- a/muse2/synti/organ/CMakeLists.txt +++ b/muse2/synti/organ/CMakeLists.txt @@ -40,7 +40,7 @@ add_library ( organ SHARED # set_target_properties ( organ PROPERTIES PREFIX "" - COMPILE_FLAGS "-O2 -include ${PROJECT_BINARY_DIR}/all-pic.h" + COMPILE_FLAGS "-fvisibility=hidden -O2 -include ${PROJECT_BINARY_DIR}/all-pic.h" ) target_link_libraries(organ diff --git a/muse2/synti/organ/organ.cpp b/muse2/synti/organ/organ.cpp index a1788a6c..2dede8de 100644 --- a/muse2/synti/organ/organ.cpp +++ b/muse2/synti/organ/organ.cpp @@ -704,7 +704,12 @@ extern "C" { MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate, }; - + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/s1/CMakeLists.txt b/muse2/synti/s1/CMakeLists.txt index 890c6b12..7dffe905 100644 --- a/muse2/synti/s1/CMakeLists.txt +++ b/muse2/synti/s1/CMakeLists.txt @@ -25,7 +25,10 @@ add_library ( s1 SHARED s1.cpp ) # tell cmake to name target s1.so instead of # libs1.so # -set_target_properties ( s1 PROPERTIES PREFIX "" ) +set_target_properties ( s1 + PROPERTIES PREFIX "" + COMPILE_FLAGS "-fvisibility=hidden" + ) target_link_libraries(s1 synti diff --git a/muse2/synti/s1/s1.cpp b/muse2/synti/s1/s1.cpp index c73615bd..8520a742 100644 --- a/muse2/synti/s1/s1.cpp +++ b/muse2/synti/s1/s1.cpp @@ -221,7 +221,12 @@ extern "C" { MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate }; - + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/simpledrums/CMakeLists.txt b/muse2/synti/simpledrums/CMakeLists.txt index 696389c6..6b015f2b 100644 --- a/muse2/synti/simpledrums/CMakeLists.txt +++ b/muse2/synti/simpledrums/CMakeLists.txt @@ -40,7 +40,7 @@ add_library ( simpledrums SHARED # set_target_properties ( simpledrums PROPERTIES PREFIX "" - COMPILE_FLAGS "-O6 -include ${PROJECT_BINARY_DIR}/all-pic.h" + COMPILE_FLAGS "-O6 -fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h" ) target_link_libraries(simpledrums diff --git a/muse2/synti/simpledrums/simpledrums.cpp b/muse2/synti/simpledrums/simpledrums.cpp index 5a0431a0..8bca91a4 100644 --- a/muse2/synti/simpledrums/simpledrums.cpp +++ b/muse2/synti/simpledrums/simpledrums.cpp @@ -1531,6 +1531,12 @@ extern "C" MESS_MAJOR_VERSION, MESS_MINOR_VERSION, instantiate, }; + // We must compile with -fvisibility=hidden to avoid namespace + // conflicts with global variables. + // Only visible symbol is "mess_descriptor". + // (TODO: all plugins should be compiled this way) + + __attribute__ ((visibility("default"))) const MESS* mess_descriptor() { return &descriptor; } } diff --git a/muse2/synti/simpledrums2/CMakeLists.txt b/muse2/synti/simpledrums2/CMakeLists.txt new file mode 100644 index 00000000..3c7ba3c7 --- /dev/null +++ b/muse2/synti/simpledrums2/CMakeLists.txt @@ -0,0 +1,52 @@ +#============================================================================= +# 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 ) + +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/muse2/synti/simpledrums2/COPYING b/muse2/synti/simpledrums2/COPYING new file mode 100644 index 00000000..5c3cefc2 --- /dev/null +++ b/muse2/synti/simpledrums2/COPYING @@ -0,0 +1,3 @@ +COPYING +--------------------------------------- +This software is licensed under GNU GPL. diff --git a/muse2/synti/simpledrums2/README b/muse2/synti/simpledrums2/README new file mode 100644 index 00000000..468640b1 --- /dev/null +++ b/muse2/synti/simpledrums2/README @@ -0,0 +1,43 @@ +-------------------------------------- +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 +- 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/muse2/synti/simpledrums2/ReleaseNotes.txt b/muse2/synti/simpledrums2/ReleaseNotes.txt new file mode 100644 index 00000000..e0d633d8 --- /dev/null +++ b/muse2/synti/simpledrums2/ReleaseNotes.txt @@ -0,0 +1,18 @@ +RELEASE NOTES: +-------------- +????-??-?? 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/muse2/synti/simpledrums2/common.h b/muse2/synti/simpledrums2/common.h new file mode 100644 index 00000000..e4763540 --- /dev/null +++ b/muse2/synti/simpledrums2/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/muse2/synti/simpledrums2/simpledrums.cpp b/muse2/synti/simpledrums2/simpledrums.cpp new file mode 100644 index 00000000..242fd8dd --- /dev/null +++ b/muse2/synti/simpledrums2/simpledrums.cpp @@ -0,0 +1,1726 @@ +// +// 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 "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