diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..c45eeb480 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "plugins/zynaddsubfx/zynaddsubfx"] + path = plugins/zynaddsubfx/zynaddsubfx + url = git://github.com/LMMS/zynaddsubfx.git diff --git a/include/Midi.h b/include/Midi.h index 96c66ea41..7bc50e0e0 100644 --- a/include/Midi.h +++ b/include/Midi.h @@ -129,7 +129,7 @@ const int MidiProgramCount = 128; const int MidiMaxVelocity = 127; const int MidiDefaultVelocity = MidiMaxVelocity / 2; const int MidiMaxControllerValue = 127; -const int MidiMaxNote = 127; +const int MidiMaxKey = 127; const int MidiMaxPanning = 127; const int MidiMinPanning = -128; diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 20729675a..31a262771 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -776,7 +776,7 @@ void VestigeInstrumentView::noteOffAll( void ) m_vi->m_pluginMutex.lock(); if( m_vi->m_plugin != NULL ) { - for( int key = 0; key <= MidiMaxNote; ++key ) + for( int key = 0; key <= MidiMaxKey; ++key ) { m_vi->m_plugin->processMidiEvent( MidiEvent( MidiNoteOff, 0, key, 0 ), 0 ); } diff --git a/plugins/zynaddsubfx/CMakeLists.txt b/plugins/zynaddsubfx/CMakeLists.txt index 773632b3f..3fd07c891 100644 --- a/plugins/zynaddsubfx/CMakeLists.txt +++ b/plugins/zynaddsubfx/CMakeLists.txt @@ -1,26 +1,5 @@ INCLUDE(BuildPlugin) -SET(ZYN_SRC_GUI - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/MasterUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/VirKeyboard.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/ConfigUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/OscilGenUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/WidgetPDial.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/ResonanceUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/MicrotonalUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/ADnoteUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/PresetsUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/EffUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/FilterUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/PartUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/EnvelopeUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/LFOUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/SeqUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/PADnoteUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/SUBnoteUI.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/BankUI.cc" -) - # definitions for ZynAddSubFX IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE) @@ -48,42 +27,81 @@ ENDIF(LMMS_BUILD_WIN32) SET(FLTK_SKIP_OPENGL TRUE) SET(FLTK_SKIP_FORMS TRUE) SET(FLTK_SKIP_IMAGES TRUE) -SET(FLTK_SKIP_FLUID TRUE) +SET(FLTK_SKIP_MATH TRUE) +IF(MINGW_PREFIX) + SET(FLTK_SKIP_FLUID TRUE) +ENDIF() FIND_PACKAGE(FLTK REQUIRED) +IF(MINGW_PREFIX) + SET(FLTK_FLUID_EXECUTABLE "${MINGW_PREFIX}/bin/fluid") +ENDIF() + INCLUDE_DIRECTORIES("${FLTK_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" ${FFTW3F_INCLUDE_DIRS} "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_BINARY_DIR}") -set(ZASF_CORE_LIBS - zynaddsubfx_input - zynaddsubfx_output - zynaddsubfx_misc - zynaddsubfx_synth - zynaddsubfx_seq - zynaddsubfx_effect - zynaddsubfx_params - zynaddsubfx_dsp - zynaddsubfx_samples + +include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/zynaddsubfx/src/UI) + +ADD_DEFINITIONS(-DPLUGINVERSION) # removes exit confirmation dialogs etc. in MasterUI.fl +add_subdirectory(zynaddsubfx/src/Nio) +add_subdirectory(zynaddsubfx/src/UI) + +SET(zynaddsubfx_core_SRCS + zynaddsubfx/src/DSP/AnalogFilter.cpp + zynaddsubfx/src/DSP/FFTwrapper.cpp + zynaddsubfx/src/DSP/Filter.cpp + zynaddsubfx/src/DSP/FormantFilter.cpp + zynaddsubfx/src/DSP/SVFilter.cpp + zynaddsubfx/src/DSP/Unison.cpp + zynaddsubfx/src/Effects/Alienwah.cpp + zynaddsubfx/src/Effects/Chorus.cpp + zynaddsubfx/src/Effects/Distorsion.cpp + zynaddsubfx/src/Effects/DynamicFilter.cpp + zynaddsubfx/src/Effects/Echo.cpp + zynaddsubfx/src/Effects/Effect.cpp + zynaddsubfx/src/Effects/EffectLFO.cpp + zynaddsubfx/src/Effects/EffectMgr.cpp + zynaddsubfx/src/Effects/EQ.cpp + zynaddsubfx/src/Effects/Phaser.cpp + zynaddsubfx/src/Effects/Reverb.cpp + zynaddsubfx/src/Misc/Bank.cpp + zynaddsubfx/src/Misc/Config.cpp + zynaddsubfx/src/Misc/Dump.cpp + zynaddsubfx/src/Misc/Master.cpp + zynaddsubfx/src/Misc/Microtonal.cpp + zynaddsubfx/src/Misc/Part.cpp + zynaddsubfx/src/Misc/Util.cpp + zynaddsubfx/src/Misc/QtXmlWrapper.cpp + zynaddsubfx/src/Misc/Recorder.cpp + zynaddsubfx/src/Misc/WavFile.cpp + zynaddsubfx/src/Misc/WaveShapeSmps.cpp + zynaddsubfx/src/Params/ADnoteParameters.cpp + zynaddsubfx/src/Params/Controller.cpp + zynaddsubfx/src/Params/EnvelopeParams.cpp + zynaddsubfx/src/Params/FilterParams.cpp + zynaddsubfx/src/Params/LFOParams.cpp + zynaddsubfx/src/Params/PADnoteParameters.cpp + zynaddsubfx/src/Params/Presets.cpp + zynaddsubfx/src/Params/PresetsArray.cpp + zynaddsubfx/src/Params/PresetsStore.cpp + zynaddsubfx/src/Params/SUBnoteParameters.cpp + zynaddsubfx/src/Synth/SynthNote.cpp + zynaddsubfx/src/Synth/ADnote.cpp + zynaddsubfx/src/Synth/Envelope.cpp + zynaddsubfx/src/Synth/LFO.cpp + zynaddsubfx/src/Synth/OscilGen.cpp + zynaddsubfx/src/Synth/PADnote.cpp + zynaddsubfx/src/Synth/Resonance.cpp + zynaddsubfx/src/Synth/SUBnote.cpp ) -macro(unit_test NAME CXX_FILE FILES) -endmacro(unit_test) -add_subdirectory(src/Misc) -add_subdirectory(src/Input) -add_subdirectory(src/Synth) -add_subdirectory(src/Output) -add_subdirectory(src/Seq) -add_subdirectory(src/Effects) -add_subdirectory(src/Params) -add_subdirectory(src/DSP) -add_subdirectory(src/Samples) - -ADD_LIBRARY(ZynAddSubFxCore SHARED LocalZynAddSubFx.cpp) -TARGET_LINK_LIBRARIES(ZynAddSubFxCore ${ZASF_CORE_LIBS} ${FFTW3F_LIBRARIES} ${QT_LIBRARIES} -lz -lpthread) +ADD_LIBRARY(ZynAddSubFxCore SHARED LocalZynAddSubFx.cpp ${zynaddsubfx_core_SRCS}) +TARGET_LINK_LIBRARIES(ZynAddSubFxCore zynaddsubfx_nio ${FFTW3F_LIBRARIES} ${QT_LIBRARIES} -lz -lpthread) IF(LMMS_BUILD_WIN32) TARGET_LINK_LIBRARIES(ZynAddSubFxCore -lws2_32) INSTALL(TARGETS ZynAddSubFxCore RUNTIME DESTINATION "${PLUGIN_DIR}") @@ -106,12 +124,11 @@ ENDIF(WIN32) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR}") SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -ADD_EXECUTABLE(RemoteZynAddSubFx RemoteZynAddSubFx.cpp ${ZYN_SRC_GUI} "${WINRC}") +ADD_EXECUTABLE(RemoteZynAddSubFx RemoteZynAddSubFx.cpp "${WINRC}") INSTALL(TARGETS RemoteZynAddSubFx RUNTIME DESTINATION "${PLUGIN_DIR}") -TARGET_LINK_LIBRARIES(RemoteZynAddSubFx ${FLTK_LIBRARIES} -lpthread "-L\"${CMAKE_CURRENT_BINARY_DIR}\"" -lZynAddSubFxCore ) -ADD_DEPENDENCIES(RemoteZynAddSubFx ZynAddSubFxCore) +TARGET_LINK_LIBRARIES(RemoteZynAddSubFx zynaddsubfx_gui ZynAddSubFxCore ${FLTK_LIBRARIES} -lpthread ) -# link system libraries when on win32 +# link Qt libraries when on win32 IF(LMMS_BUILD_WIN32) TARGET_LINK_LIBRARIES(RemoteZynAddSubFx ${QT_LIBRARIES}) ENDIF(LMMS_BUILD_WIN32) diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp index 05b6a725e..36312d651 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp @@ -24,19 +24,25 @@ #include +#include "zynaddsubfx/src/Misc/Util.h" #include #include "LocalZynAddSubFx.h" -#include "src/Input/NULLMidiIn.h" -#include "src/Misc/Master.h" -#include "src/Misc/Dump.h" +#include "zynaddsubfx/src/Nio/NulEngine.h" +#include "zynaddsubfx/src/Misc/Master.h" +#include "zynaddsubfx/src/Misc/Part.h" +#include "zynaddsubfx/src/Misc/Dump.h" +SYNTH_T* synth = NULL; + int LocalZynAddSubFx::s_instanceCount = 0; -LocalZynAddSubFx::LocalZynAddSubFx() +LocalZynAddSubFx::LocalZynAddSubFx() : + m_master( NULL ), + m_ioEngine( NULL ) { for( int i = 0; i < NumKeys; ++i ) { @@ -53,17 +59,23 @@ LocalZynAddSubFx::LocalZynAddSubFx() initConfig(); - OSCIL_SIZE = config.cfg.OscilSize; + synth = new SYNTH_T; + synth->oscilsize = config.cfg.OscilSize; + synth->alias(); srand( time( NULL ) ); - denormalkillbuf = new REALTYPE[SOUND_BUFFER_SIZE]; - for( int i = 0; i < SOUND_BUFFER_SIZE; ++i ) + + denormalkillbuf = new float[synth->buffersize]; + for( int i = 0; i < synth->buffersize; ++i ) { denormalkillbuf[i] = (RND-0.5)*1e-16; } } + ++s_instanceCount; + m_ioEngine = new NulEngine; + m_master = new Master(); m_master->swaplr = 0; } @@ -94,17 +106,19 @@ void LocalZynAddSubFx::initConfig() -void LocalZynAddSubFx::setSampleRate( int _sampleRate ) +void LocalZynAddSubFx::setSampleRate( int sampleRate ) { - SAMPLE_RATE = _sampleRate; + synth->samplerate = sampleRate; + synth->alias(); } -void LocalZynAddSubFx::setBufferSize( int _bufferSize ) +void LocalZynAddSubFx::setBufferSize( int bufferSize ) { - SOUND_BUFFER_SIZE = _bufferSize; + synth->buffersize = bufferSize; + synth->alias(); } @@ -160,14 +174,12 @@ void LocalZynAddSubFx::setPresetDir( const std::string & _dir ) m_presetsDir = _dir; for( int i = 0; i < MAX_BANK_ROOT_DIRS; ++i ) { - if( config.cfg.bankRootDirList[i] == NULL ) + if( config.cfg.bankRootDirList[i].empty() ) { - config.cfg.bankRootDirList[i] = new char[MAX_STRING_SIZE]; - strcpy( config.cfg.bankRootDirList[i], m_presetsDir.c_str() ); + config.cfg.bankRootDirList[i] = m_presetsDir; break; } - else if( strcmp( config.cfg.bankRootDirList[i], - m_presetsDir.c_str() ) == 0 ) + else if( config.cfg.bankRootDirList[i] == m_presetsDir ) { break; } @@ -202,41 +214,38 @@ void LocalZynAddSubFx::setPitchWheelBendRange( int semitones ) void LocalZynAddSubFx::processMidiEvent( const MidiEvent& event ) { - // all functions are called while m_master->mutex is held - static NULLMidiIn midiIn; - switch( event.type() ) { case MidiNoteOn: if( event.velocity() > 0 ) { - if( event.key() <= 0 || event.key() >= 128 ) + if( event.key() < 0 || event.key() > MidiMaxKey ) { break; } if( m_runningNotes[event.key()] > 0 ) { - m_master->NoteOff( event.channel(), event.key() ); + m_master->noteOff( event.channel(), event.key() ); } ++m_runningNotes[event.key()]; - m_master->NoteOn( event.channel(), event.key(), event.velocity() ); + m_master->noteOn( event.channel(), event.key(), event.velocity() ); break; } case MidiNoteOff: - if( event.key() <= 0 || event.key() >= 128 ) + if( event.key() < 0 || event.key() > MidiMaxKey ) { break; } if( --m_runningNotes[event.key()] <= 0 ) { - m_master->NoteOff( event.channel(), event.key() ); + m_master->noteOff( event.channel(), event.key() ); } break; case MidiPitchBend: - m_master->SetController( event.channel(), C_pitchwheel, event.pitchBend()-8192 ); + m_master->setController( event.channel(), C_pitchwheel, event.pitchBend()-8192 ); break; case MidiControlChange: - m_master->SetController( event.channel(), midiIn.getcontroller( event.controllerNumber() ), event.controllerValue() ); + m_master->setController( event.channel(), event.controllerNumber(), event.controllerValue() ); break; default: break; @@ -248,12 +257,13 @@ void LocalZynAddSubFx::processMidiEvent( const MidiEvent& event ) void LocalZynAddSubFx::processAudio( sampleFrame * _out ) { - REALTYPE outputl[SOUND_BUFFER_SIZE]; - REALTYPE outputr[SOUND_BUFFER_SIZE]; + float outputl[synth->buffersize]; + float outputr[synth->buffersize]; m_master->GetAudioOutSamples( SOUND_BUFFER_SIZE, SAMPLE_RATE, outputl, outputr ); - for( int f = 0; f < SOUND_BUFFER_SIZE; ++f ) + // TODO: move to MixHelpers + for( int f = 0; f < synth->buffersize; ++f ) { _out[f][0] = outputl[f]; _out[f][1] = outputr[f]; diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.h b/plugins/zynaddsubfx/LocalZynAddSubFx.h index baec21396..a1bc2d3e8 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.h +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.h @@ -29,6 +29,7 @@ #include "note.h" class Master; +class NulEngine; class LocalZynAddSubFx { @@ -68,6 +69,7 @@ protected: int m_runningNotes[NumKeys]; Master * m_master; + NulEngine* m_ioEngine; } ; diff --git a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp index e769594fa..7a5c5f3ee 100644 --- a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp @@ -35,7 +35,8 @@ #include "RemoteZynAddSubFx.h" #include "LocalZynAddSubFx.h" -#include "src/UI/MasterUI.h" +#include "zynaddsubfx/src/Nio/Nio.h" +#include "zynaddsubfx/src/UI/MasterUI.h" #include @@ -49,6 +50,8 @@ public: m_guiSleepTime( 100 ), m_guiExit( false ) { + Nio::start(); + setInputCount( 0 ); sendMessage( IdInitDone ); waitForMessage( IdInitDone ); @@ -65,6 +68,8 @@ public: #else usleep( m_guiSleepTime * 2 * 1000 ); #endif + + Nio::stop(); } virtual void updateSampleRate() @@ -286,3 +291,22 @@ int main( int _argc, char * * _argv ) } +#ifdef NTK_GUI +static Fl_Tiled_Image *module_backdrop; +#endif + +void set_module_parameters ( Fl_Widget *o ) +{ +#ifdef NTK_GUI + o->box( FL_DOWN_FRAME ); + o->align( o->align() | FL_ALIGN_IMAGE_BACKDROP ); + o->color( FL_BLACK ); + o->image( module_backdrop ); + o->labeltype( FL_SHADOW_LABEL ); +#else + o->box( FL_PLASTIC_UP_BOX ); + o->color( FL_CYAN ); + o->labeltype( FL_EMBOSSED_LABEL ); +#endif +} + diff --git a/plugins/zynaddsubfx/ZynAddSubFx.h b/plugins/zynaddsubfx/ZynAddSubFx.h index cb35b4ce5..ad78b95b4 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.h +++ b/plugins/zynaddsubfx/ZynAddSubFx.h @@ -32,7 +32,7 @@ #include "Instrument.h" #include "InstrumentView.h" #include "RemotePlugin.h" -#include "src/globals.h" +#include "zynaddsubfx/src/globals.h" class QPushButton; diff --git a/plugins/zynaddsubfx/src/DSP/AnalogFilter.cpp b/plugins/zynaddsubfx/src/DSP/AnalogFilter.cpp deleted file mode 100644 index bb1ad75c8..000000000 --- a/plugins/zynaddsubfx/src/DSP/AnalogFilter.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AnalogFilter.cpp - Several analog filters (lowpass, highpass...) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "AnalogFilter.h" - -AnalogFilter::AnalogFilter(unsigned char Ftype, - REALTYPE Ffreq, - REALTYPE Fq, - unsigned char Fstages) -{ - stages = Fstages; - for(int i = 0; i < 3; i++) { - oldc[i] = 0.0; - oldd[i] = 0.0; - c[i] = 0.0; - d[i] = 0.0; - } - type = Ftype; - freq = Ffreq; - q = Fq; - gain = 1.0; - if(stages >= MAX_FILTER_STAGES) - stages = MAX_FILTER_STAGES; - cleanup(); - firsttime = 0; - abovenq = 0; - oldabovenq = 0; - setfreq_and_q(Ffreq, Fq); - firsttime = 1; - d[0] = 0; //this is not used - outgain = 1.0; -} - -AnalogFilter::~AnalogFilter() -{} - -void AnalogFilter::cleanup() -{ - for(int i = 0; i < MAX_FILTER_STAGES + 1; i++) { - x[i].c1 = 0.0; - x[i].c2 = 0.0; - y[i].c1 = 0.0; - y[i].c2 = 0.0; - oldx[i] = x[i]; - oldy[i] = y[i]; - } - needsinterpolation = 0; -} - -void AnalogFilter::computefiltercoefs() -{ - REALTYPE tmp; - REALTYPE omega, sn, cs, alpha, beta; - int zerocoefs = 0; //this is used if the freq is too high - - //do not allow frequencies bigger than samplerate/2 - REALTYPE freq = this->freq; - if(freq > (SAMPLE_RATE / 2 - 500.0)) { - freq = SAMPLE_RATE / 2 - 500.0; - zerocoefs = 1; - } - if(freq < 0.1) - freq = 0.1; - //do not allow bogus Q - if(q < 0.0) - q = 0.0; - REALTYPE tmpq, tmpgain; - if(stages == 0) { - tmpq = q; - tmpgain = gain; - } - else { - tmpq = (q > 1.0 ? pow(q, 1.0 / (stages + 1)) : q); - tmpgain = pow(gain, 1.0 / (stages + 1)); - } - - //most of theese are implementations of - //the "Cookbook formulae for audio EQ" by Robert Bristow-Johnson - //The original location of the Cookbook is: - //http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - switch(type) { - case 0: //LPF 1 pole - if(zerocoefs == 0) - tmp = exp(-2.0 * PI * freq / SAMPLE_RATE); - else - tmp = 0.0; - c[0] = 1.0 - tmp; - c[1] = 0.0; - c[2] = 0.0; - d[1] = tmp; - d[2] = 0.0; - order = 1; - break; - case 1: //HPF 1 pole - if(zerocoefs == 0) - tmp = exp(-2.0 * PI * freq / SAMPLE_RATE); - else - tmp = 0.0; - c[0] = (1.0 + tmp) / 2.0; - c[1] = -(1.0 + tmp) / 2.0; - c[2] = 0.0; - d[1] = tmp; - d[2] = 0.0; - order = 1; - break; - case 2: //LPF 2 poles - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - alpha = sn / (2 * tmpq); - tmp = 1 + alpha; - c[0] = (1.0 - cs) / 2.0 / tmp; - c[1] = (1.0 - cs) / tmp; - c[2] = (1.0 - cs) / 2.0 / tmp; - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha) / tmp * (-1); - } - else { - c[0] = 1.0; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - case 3: //HPF 2 poles - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - alpha = sn / (2 * tmpq); - tmp = 1 + alpha; - c[0] = (1.0 + cs) / 2.0 / tmp; - c[1] = -(1.0 + cs) / tmp; - c[2] = (1.0 + cs) / 2.0 / tmp; - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha) / tmp * (-1); - } - else { - c[0] = 0.0; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - case 4: //BPF 2 poles - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - alpha = sn / (2 * tmpq); - tmp = 1 + alpha; - c[0] = alpha / tmp *sqrt(tmpq + 1); - c[1] = 0; - c[2] = -alpha / tmp *sqrt(tmpq + 1); - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha) / tmp * (-1); - } - else { - c[0] = 0.0; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - case 5: //NOTCH 2 poles - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - alpha = sn / (2 * sqrt(tmpq)); - tmp = 1 + alpha; - c[0] = 1 / tmp; - c[1] = -2 * cs / tmp; - c[2] = 1 / tmp; - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha) / tmp * (-1); - } - else { - c[0] = 1.0; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - case 6: //PEAK (2 poles) - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - tmpq *= 3.0; - alpha = sn / (2 * tmpq); - tmp = 1 + alpha / tmpgain; - c[0] = (1.0 + alpha * tmpgain) / tmp; - c[1] = (-2.0 * cs) / tmp; - c[2] = (1.0 - alpha * tmpgain) / tmp; - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha / tmpgain) / tmp * (-1); - } - else { - c[0] = 1.0; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - case 7: //Low Shelf - 2 poles - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - tmpq = sqrt(tmpq); - alpha = sn / (2 * tmpq); - beta = sqrt(tmpgain) / tmpq; - tmp = (tmpgain + 1.0) + (tmpgain - 1.0) * cs + beta * sn; - - c[0] = tmpgain - * ((tmpgain - + 1.0) - (tmpgain - 1.0) * cs + beta * sn) / tmp; - c[1] = 2.0 * tmpgain - * ((tmpgain - 1.0) - (tmpgain + 1.0) * cs) / tmp; - c[2] = tmpgain - * ((tmpgain - + 1.0) - (tmpgain - 1.0) * cs - beta * sn) / tmp; - d[1] = -2.0 * ((tmpgain - 1.0) + (tmpgain + 1.0) * cs) / tmp * (-1); - d[2] = - ((tmpgain - + 1.0) + (tmpgain - 1.0) * cs - beta * sn) / tmp * (-1); - } - else { - c[0] = tmpgain; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - case 8: //High Shelf - 2 poles - if(zerocoefs == 0) { - omega = 2 * PI * freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - tmpq = sqrt(tmpq); - alpha = sn / (2 * tmpq); - beta = sqrt(tmpgain) / tmpq; - tmp = (tmpgain + 1.0) - (tmpgain - 1.0) * cs + beta * sn; - - c[0] = tmpgain - * ((tmpgain - + 1.0) + (tmpgain - 1.0) * cs + beta * sn) / tmp; - c[1] = -2.0 * tmpgain - * ((tmpgain - 1.0) + (tmpgain + 1.0) * cs) / tmp; - c[2] = tmpgain - * ((tmpgain - + 1.0) + (tmpgain - 1.0) * cs - beta * sn) / tmp; - d[1] = 2.0 * ((tmpgain - 1.0) - (tmpgain + 1.0) * cs) / tmp * (-1); - d[2] = - ((tmpgain - + 1.0) - (tmpgain - 1.0) * cs - beta * sn) / tmp * (-1); - } - else { - c[0] = 1.0; - c[1] = 0.0; - c[2] = 0.0; - d[1] = 0.0; - d[2] = 0.0; - } - order = 2; - break; - default: //wrong type - type = 0; - computefiltercoefs(); - break; - } -} - - -void AnalogFilter::setfreq(REALTYPE frequency) -{ - if(frequency < 0.1) - frequency = 0.1; - REALTYPE rap = freq / frequency; - if(rap < 1.0) - rap = 1.0 / rap; - - oldabovenq = abovenq; - abovenq = frequency > (SAMPLE_RATE / 2 - 500.0); - - int nyquistthresh = (abovenq ^ oldabovenq); - - - if((rap > 3.0) || (nyquistthresh != 0)) { //if the frequency is changed fast, it needs interpolation (now, filter and coeficients backup) - for(int i = 0; i < 3; i++) { - oldc[i] = c[i]; - oldd[i] = d[i]; - } - for(int i = 0; i < MAX_FILTER_STAGES + 1; i++) { - oldx[i] = x[i]; - oldy[i] = y[i]; - } - if(firsttime == 0) - needsinterpolation = 1; - } - freq = frequency; - computefiltercoefs(); - firsttime = 0; -} - -void AnalogFilter::setfreq_and_q(REALTYPE frequency, REALTYPE q_) -{ - q = q_; - setfreq(frequency); -} - -void AnalogFilter::setq(REALTYPE q_) -{ - q = q_; - computefiltercoefs(); -} - -void AnalogFilter::settype(int type_) -{ - type = type_; - computefiltercoefs(); -} - -void AnalogFilter::setgain(REALTYPE dBgain) -{ - gain = dB2rap(dBgain); - computefiltercoefs(); -} - -void AnalogFilter::setstages(int stages_) -{ - if(stages_ >= MAX_FILTER_STAGES) - stages_ = MAX_FILTER_STAGES - 1; - stages = stages_; - cleanup(); - computefiltercoefs(); -} - -void AnalogFilter::singlefilterout(REALTYPE *smp, - fstage &x, - fstage &y, - REALTYPE *c, - REALTYPE *d) -{ - int i; - REALTYPE y0; - if(order == 1) { //First order filter - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - y0 = smp[i] * c[0] + x.c1 * c[1] + y.c1 * d[1]; - y.c1 = y0; - x.c1 = smp[i]; - //output - smp[i] = y0; - } - } - if(order == 2) { //Second order filter - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - y0 = smp[i] * c[0] + x.c1 * c[1] + x.c2 * c[2] + y.c1 * d[1] - + y.c2 * d[2]; - y.c2 = y.c1; - y.c1 = y0; - x.c2 = x.c1; - x.c1 = smp[i]; - //output - smp[i] = y0; - } - } -} -void AnalogFilter::filterout(REALTYPE *smp) -{ - REALTYPE *ismp = NULL; //used if it needs interpolation - int i; - if(needsinterpolation != 0) { - ismp = new REALTYPE[SOUND_BUFFER_SIZE]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - ismp[i] = smp[i]; - for(i = 0; i < stages + 1; i++) - singlefilterout(ismp, oldx[i], oldy[i], oldc, oldd); - } - - for(i = 0; i < stages + 1; i++) - singlefilterout(smp, x[i], y[i], c, d); - - if(needsinterpolation != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE x = i / (REALTYPE) SOUND_BUFFER_SIZE; - smp[i] = ismp[i] * (1.0 - x) + smp[i] * x; - } - delete [] ismp; - needsinterpolation = 0; - } - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - smp[i] *= outgain; -} - -REALTYPE AnalogFilter::H(REALTYPE freq) -{ - REALTYPE fr = freq / SAMPLE_RATE * PI * 2.0; - REALTYPE x = c[0], y = 0.0; - for(int n = 1; n < 3; n++) { - x += cos(n * fr) * c[n]; - y -= sin(n * fr) * c[n]; - } - REALTYPE h = x * x + y * y; - x = 1.0; - y = 0.0; - for(int n = 1; n < 3; n++) { - x -= cos(n * fr) * d[n]; - y += sin(n * fr) * d[n]; - } - h = h / (x * x + y * y); - return pow(h, (stages + 1.0) / 2.0); -} - diff --git a/plugins/zynaddsubfx/src/DSP/AnalogFilter.h b/plugins/zynaddsubfx/src/DSP/AnalogFilter.h deleted file mode 100644 index cd7efbc2d..000000000 --- a/plugins/zynaddsubfx/src/DSP/AnalogFilter.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Analog Filter.h - Several analog filters (lowpass, highpass...) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ANALOG_FILTER_H -#define ANALOG_FILTER_H - -#include "../globals.h" -#include "Filter_.h" - -/**Implementation of Several analog filters (lowpass, highpass...)*/ -class AnalogFilter:public Filter_ -{ - public: - AnalogFilter(unsigned char Ftype, - REALTYPE Ffreq, - REALTYPE Fq, - unsigned char Fstages); - ~AnalogFilter(); - void filterout(REALTYPE *smp); - void setfreq(REALTYPE frequency); - void setfreq_and_q(REALTYPE frequency, REALTYPE q_); - void setq(REALTYPE q_); - - void settype(int type_); - void setgain(REALTYPE dBgain); - void setstages(int stages_); - void cleanup(); - - REALTYPE H(REALTYPE freq); //Obtains the response for a given frequency - - private: - struct fstage { - REALTYPE c1, c2; - } x[MAX_FILTER_STAGES + 1], y[MAX_FILTER_STAGES + 1], - oldx[MAX_FILTER_STAGES + 1], oldy[MAX_FILTER_STAGES + 1]; - - void singlefilterout(REALTYPE *smp, - fstage &x, - fstage &y, - REALTYPE *c, - REALTYPE *d); - void computefiltercoefs(); - int type; //The type of the filter (LPF1,HPF1,LPF2,HPF2...) - int stages; //how many times the filter is applied (0->1,1->2,etc.) - REALTYPE freq; //Frequency given in Hz - REALTYPE q; //Q factor (resonance or Q factor) - REALTYPE gain; //the gain of the filter (if are shelf/peak) filters - - int order; //the order of the filter (number of poles) - - REALTYPE c[3], d[3]; //coefficients - - REALTYPE oldc[3], oldd[3]; //old coefficients(used only if some filter paremeters changes very fast, and it needs interpolation) - - int needsinterpolation, firsttime; /**\todo see if bool works for these*/ - int abovenq; //this is 1 if the frequency is above the nyquist - int oldabovenq; //if the last time was above nyquist (used to see if it needs interpolation) -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/DSP/CMakeLists.txt b/plugins/zynaddsubfx/src/DSP/CMakeLists.txt deleted file mode 100644 index 263a1babb..000000000 --- a/plugins/zynaddsubfx/src/DSP/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(zynaddsubfx_dsp_SRCS - AnalogFilter.cpp - FFTwrapper.cpp - Filter.cpp - FormantFilter.cpp - SVFilter.cpp - Unison.cpp -) - -add_library(zynaddsubfx_dsp STATIC - ${zynaddsubfx_dsp_SRCS} - ) - -target_link_libraries(zynaddsubfx_dsp) diff --git a/plugins/zynaddsubfx/src/DSP/FFTwrapper.cpp b/plugins/zynaddsubfx/src/DSP/FFTwrapper.cpp deleted file mode 100644 index d93c0c40c..000000000 --- a/plugins/zynaddsubfx/src/DSP/FFTwrapper.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FFTwrapper.c - A wrapper for Fast Fourier Transforms - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "FFTwrapper.h" - -FFTwrapper::FFTwrapper(int fftsize_) -{ - fftsize = fftsize_; - tmpfftdata1 = new fftw_real[fftsize]; - tmpfftdata2 = new fftw_real[fftsize]; -#ifdef FFTW_VERSION_2 - planfftw = rfftw_create_plan(fftsize, - FFTW_REAL_TO_COMPLEX, - FFTW_ESTIMATE | FFTW_IN_PLACE); - planfftw_inv = rfftw_create_plan(fftsize, - FFTW_COMPLEX_TO_REAL, - FFTW_ESTIMATE | FFTW_IN_PLACE); -#else - planfftw = fftwf_plan_r2r_1d(fftsize, - tmpfftdata1, - tmpfftdata1, - FFTW_R2HC, - FFTW_ESTIMATE); - planfftw_inv = fftwf_plan_r2r_1d(fftsize, - tmpfftdata2, - tmpfftdata2, - FFTW_HC2R, - FFTW_ESTIMATE); -#endif -} - -FFTwrapper::~FFTwrapper() -{ -#ifdef FFTW_VERSION_2 - rfftw_destroy_plan(planfftw); - rfftw_destroy_plan(planfftw_inv); -#else - fftwf_destroy_plan(planfftw); - fftwf_destroy_plan(planfftw_inv); -#endif - - delete [] tmpfftdata1; - delete [] tmpfftdata2; -} - -/* - * do the Fast Fourier Transform - */ -void FFTwrapper::smps2freqs(REALTYPE *smps, FFTFREQS freqs) -{ -#ifdef FFTW_VERSION_2 - for(int i = 0; i < fftsize; i++) - tmpfftdata1[i] = smps[i]; - rfftw_one(planfftw, tmpfftdata1, tmpfftdata2); - for(int i = 0; i < fftsize / 2; i++) { - freqs.c[i] = tmpfftdata2[i]; - if(i != 0) - freqs.s[i] = tmpfftdata2[fftsize - i]; - } -#else - for(int i = 0; i < fftsize; i++) - tmpfftdata1[i] = smps[i]; - fftwf_execute(planfftw); - for(int i = 0; i < fftsize / 2; i++) { - freqs.c[i] = tmpfftdata1[i]; - if(i != 0) - freqs.s[i] = tmpfftdata1[fftsize - i]; - } -#endif - tmpfftdata2[fftsize / 2] = 0.0; -} - -/* - * do the Inverse Fast Fourier Transform - */ -void FFTwrapper::freqs2smps(FFTFREQS freqs, REALTYPE *smps) -{ - tmpfftdata2[fftsize / 2] = 0.0; -#ifdef FFTW_VERSION_2 - for(int i = 0; i < fftsize / 2; i++) { - tmpfftdata1[i] = freqs.c[i]; - if(i != 0) - tmpfftdata1[fftsize - i] = freqs.s[i]; - } - rfftw_one(planfftw_inv, tmpfftdata1, tmpfftdata2); - for(int i = 0; i < fftsize; i++) - smps[i] = tmpfftdata2[i]; -#else - for(int i = 0; i < fftsize / 2; i++) { - tmpfftdata2[i] = freqs.c[i]; - if(i != 0) - tmpfftdata2[fftsize - i] = freqs.s[i]; - } - fftwf_execute(planfftw_inv); - for(int i = 0; i < fftsize; i++) - smps[i] = tmpfftdata2[i]; -#endif -} - -void newFFTFREQS(FFTFREQS *f, int size) -{ - f->c = new REALTYPE[size]; - f->s = new REALTYPE[size]; - for(int i = 0; i < size; i++) { - f->c[i] = 0.0; - f->s[i] = 0.0; - } -} - -void deleteFFTFREQS(FFTFREQS *f) -{ - delete[] f->c; - delete[] f->s; - f->c = f->s = NULL; -} - diff --git a/plugins/zynaddsubfx/src/DSP/FFTwrapper.h b/plugins/zynaddsubfx/src/DSP/FFTwrapper.h deleted file mode 100644 index 17d40805a..000000000 --- a/plugins/zynaddsubfx/src/DSP/FFTwrapper.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FFTwrapper.h - A wrapper for Fast Fourier Transforms - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FFT_WRAPPER_H -#define FFT_WRAPPER_H - -#include "../globals.h" - -#ifdef FFTW_VERSION_2 - -#include - -/* If you got error messages about rfftw.h, replace the next include line with "#include " -or with "#include (if one doesn't work try the other). It may be necessary to replace -the with or . If the neither one doesn't work, -please install latest version of fftw(recomanded from the sources) from www.fftw.org. -If you'll install fftw3 you need to change the Makefile.inc -Hope all goes right." */ -#include - -#else - -#include -#define fftw_real float -#define rfftw_plan fftwf_plan -#endif - -/**A wrapper for the FFTW library (Fast Fourier Transforms)*/ -class FFTwrapper -{ - public: - /**Constructor - * @param fftsize The size of samples to be fed to fftw*/ - FFTwrapper(int fftsize_); - /**Destructor*/ - ~FFTwrapper(); - /**Convert Samples to Frequencies using Fourier Transform - * @param smps Pointer to Samples to be converted; has length fftsize_ - * @param freqs Structure FFTFREQS which stores the frequencies*/ - void smps2freqs(REALTYPE *smps, FFTFREQS freqs); - void freqs2smps(FFTFREQS freqs, REALTYPE *smps); - private: - int fftsize; - fftw_real *tmpfftdata1, *tmpfftdata2; - rfftw_plan planfftw, planfftw_inv; -}; - -void newFFTFREQS(FFTFREQS *f, int size); -void deleteFFTFREQS(FFTFREQS *f); -#endif - diff --git a/plugins/zynaddsubfx/src/DSP/Filter.cpp b/plugins/zynaddsubfx/src/DSP/Filter.cpp deleted file mode 100644 index c6a3ce976..000000000 --- a/plugins/zynaddsubfx/src/DSP/Filter.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Filter.cpp - Filters, uses analog,formant,etc. filters - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include - -#include "Filter.h" - -Filter::Filter(FilterParams *pars) -{ - unsigned char Ftype = pars->Ptype; - unsigned char Fstages = pars->Pstages; - - category = pars->Pcategory; - - switch(category) { - case 1: - filter = new FormantFilter(pars); - break; - case 2: - filter = new SVFilter(Ftype, 1000.0, pars->getq(), Fstages); - filter->outgain = dB2rap(pars->getgain()); - if(filter->outgain > 1.0) - filter->outgain = sqrt(filter->outgain); - break; - default: - filter = new AnalogFilter(Ftype, 1000.0, pars->getq(), Fstages); - if((Ftype >= 6) && (Ftype <= 8)) - filter->setgain(pars->getgain()); - else - filter->outgain = dB2rap(pars->getgain()); - break; - } -} - -Filter::~Filter() -{ - delete (filter); -} - -void Filter::filterout(REALTYPE *smp) -{ - filter->filterout(smp); -} - -void Filter::setfreq(REALTYPE frequency) -{ - filter->setfreq(frequency); -} - -void Filter::setfreq_and_q(REALTYPE frequency, REALTYPE q_) -{ - filter->setfreq_and_q(frequency, q_); -} - -void Filter::setq(REALTYPE q_) -{ - filter->setq(q_); -} - -REALTYPE Filter::getrealfreq(REALTYPE freqpitch) -{ - if((category == 0) || (category == 2)) - return pow(2.0, freqpitch + 9.96578428); //log2(1000)=9.95748 - else - return freqpitch; -} - diff --git a/plugins/zynaddsubfx/src/DSP/Filter.h b/plugins/zynaddsubfx/src/DSP/Filter.h deleted file mode 100644 index b8f568b21..000000000 --- a/plugins/zynaddsubfx/src/DSP/Filter.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Filter.h - Filters, uses analog,formant,etc. filters - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FILTER_H -#define FILTER_H - -#include "../globals.h" - -#include "Filter_.h" -#include "AnalogFilter.h" -#include "FormantFilter.h" -#include "SVFilter.h" -#include "../Params/FilterParams.h" - -class Filter -{ - public: - Filter(FilterParams *pars); - ~Filter(); - void filterout(REALTYPE *smp); - void setfreq(REALTYPE frequency); - void setfreq_and_q(REALTYPE frequency, REALTYPE q_); - void setq(REALTYPE q_); - - REALTYPE getrealfreq(REALTYPE freqpitch); - private: - Filter_ *filter; - unsigned char category; -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/DSP/Filter_.h b/plugins/zynaddsubfx/src/DSP/Filter_.h deleted file mode 100644 index 88716f0b2..000000000 --- a/plugins/zynaddsubfx/src/DSP/Filter_.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Filter_.h - This class is inherited by filter classes - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FILTER__H -#define FILTER__H - -#include "../globals.h" - -class Filter_ -{ - public: - virtual ~Filter_() {} - virtual void filterout(REALTYPE *smp) = 0; - virtual void setfreq(REALTYPE frequency) = 0; - virtual void setfreq_and_q(REALTYPE frequency, REALTYPE q_) = 0; - virtual void setq(REALTYPE q_) = 0; - virtual void setgain(REALTYPE dBgain) = 0; - REALTYPE outgain; - private: -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/DSP/FormantFilter.cpp b/plugins/zynaddsubfx/src/DSP/FormantFilter.cpp deleted file mode 100644 index 6d6771901..000000000 --- a/plugins/zynaddsubfx/src/DSP/FormantFilter.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FormantFilter.cpp - formant filters - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "FormantFilter.h" - -FormantFilter::FormantFilter(FilterParams *pars) -{ - numformants = pars->Pnumformants; - for(int i = 0; i < numformants; i++) - formant[i] = new AnalogFilter(4 /*BPF*/, 1000.0, 10.0, pars->Pstages); - cleanup(); - inbuffer = new REALTYPE [SOUND_BUFFER_SIZE]; - tmpbuf = new REALTYPE [SOUND_BUFFER_SIZE]; - - for(int j = 0; j < FF_MAX_VOWELS; j++) - for(int i = 0; i < numformants; i++) { - formantpar[j][i].freq = pars->getformantfreq( - pars->Pvowels[j].formants[i].freq); - formantpar[j][i].amp = pars->getformantamp( - pars->Pvowels[j].formants[i].amp); - formantpar[j][i].q = pars->getformantq( - pars->Pvowels[j].formants[i].q); - } - ; - for(int i = 0; i < FF_MAX_FORMANTS; i++) - oldformantamp[i] = 1.0; - for(int i = 0; i < numformants; i++) { - currentformants[i].freq = 1000.0; - currentformants[i].amp = 1.0; - currentformants[i].q = 2.0; - } - - formantslowness = pow(1.0 - (pars->Pformantslowness / 128.0), 3.0); - - sequencesize = pars->Psequencesize; - if(sequencesize == 0) - sequencesize = 1; - for(int k = 0; k < sequencesize; k++) - sequence[k].nvowel = pars->Psequence[k].nvowel; - - vowelclearness = pow(10.0, (pars->Pvowelclearness - 32.0) / 48.0); - - sequencestretch = pow(0.1, (pars->Psequencestretch - 32.0) / 48.0); - if(pars->Psequencereversed) - sequencestretch *= -1.0; - - outgain = dB2rap(pars->getgain()); - - oldinput = -1.0; - Qfactor = 1.0; - oldQfactor = Qfactor; - firsttime = 1; -} - -FormantFilter::~FormantFilter() -{ - for(int i = 0; i < numformants; i++) - delete (formant[i]); - delete[] inbuffer; - delete[] tmpbuf; -} - - - - -void FormantFilter::cleanup() -{ - for(int i = 0; i < numformants; i++) - formant[i]->cleanup(); -} - -void FormantFilter::setpos(REALTYPE input) -{ - int p1, p2; - - if(firsttime != 0) - slowinput = input; - else - slowinput = slowinput - * (1.0 - formantslowness) + input * formantslowness; - - if((fabs(oldinput - input) < 0.001) && (fabs(slowinput - input) < 0.001) - && (fabs(Qfactor - oldQfactor) < 0.001)) { -// oldinput=input; daca setez asta, o sa faca probleme la schimbari foarte lente - firsttime = 0; - return; - } - else - oldinput = input; - - - REALTYPE pos = fmod(input * sequencestretch, 1.0); - if(pos < 0.0) - pos += 1.0; - - F2I(pos * sequencesize, p2); - p1 = p2 - 1; - if(p1 < 0) - p1 += sequencesize; - - pos = fmod(pos * sequencesize, 1.0); - if(pos < 0.0) - pos = 0.0; - else - if(pos > 1.0) - pos = 1.0; - pos = - (atan((pos * 2.0 - - 1.0) * vowelclearness) / atan(vowelclearness) + 1.0) * 0.5; - - p1 = sequence[p1].nvowel; - p2 = sequence[p2].nvowel; - - if(firsttime != 0) { - for(int i = 0; i < numformants; i++) { - currentformants[i].freq = formantpar[p1][i].freq - * (1.0 - - pos) + formantpar[p2][i].freq * pos; - currentformants[i].amp = formantpar[p1][i].amp - * (1.0 - - pos) + formantpar[p2][i].amp * pos; - currentformants[i].q = formantpar[p1][i].q - * (1.0 - pos) + formantpar[p2][i].q * pos; - formant[i]->setfreq_and_q(currentformants[i].freq, - currentformants[i].q * Qfactor); - oldformantamp[i] = currentformants[i].amp; - } - firsttime = 0; - } - else { - for(int i = 0; i < numformants; i++) { - currentformants[i].freq = currentformants[i].freq - * (1.0 - formantslowness) - + (formantpar[p1][i].freq - * (1.0 - - pos) + formantpar[p2][i].freq - * pos) * formantslowness; - - currentformants[i].amp = currentformants[i].amp - * (1.0 - formantslowness) - + (formantpar[p1][i].amp - * (1.0 - - pos) + formantpar[p2][i].amp - * pos) * formantslowness; - - currentformants[i].q = currentformants[i].q - * (1.0 - formantslowness) - + (formantpar[p1][i].q - * (1.0 - - pos) + formantpar[p2][i].q - * pos) * formantslowness; - - formant[i]->setfreq_and_q(currentformants[i].freq, - currentformants[i].q * Qfactor); - } - } - - oldQfactor = Qfactor; -} - -void FormantFilter::setfreq(REALTYPE frequency) -{ - setpos(frequency); -} - -void FormantFilter::setq(REALTYPE q_) -{ - Qfactor = q_; - for(int i = 0; i < numformants; i++) - formant[i]->setq(Qfactor * currentformants[i].q); -} - -void FormantFilter::setgain(REALTYPE dBgain) -{} - - -void FormantFilter::setfreq_and_q(REALTYPE frequency, REALTYPE q_) -{ - Qfactor = q_; - setpos(frequency); -} - - -void FormantFilter::filterout(REALTYPE *smp) -{ - int i, j; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - inbuffer[i] = smp[i]; - smp[i] = 0.0; - } - - for(j = 0; j < numformants; j++) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpbuf[i] = inbuffer[i] * outgain; - formant[j]->filterout(tmpbuf); - - if(ABOVE_AMPLITUDE_THRESHOLD(oldformantamp[j], currentformants[j].amp)) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - smp[i] += tmpbuf[i] - * INTERPOLATE_AMPLITUDE(oldformantamp[j], - currentformants[j].amp, - i, - SOUND_BUFFER_SIZE); - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - smp[i] += tmpbuf[i] * currentformants[j].amp; - oldformantamp[j] = currentformants[j].amp; - } -} - diff --git a/plugins/zynaddsubfx/src/DSP/FormantFilter.h b/plugins/zynaddsubfx/src/DSP/FormantFilter.h deleted file mode 100644 index 4efe24fa5..000000000 --- a/plugins/zynaddsubfx/src/DSP/FormantFilter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FormantFilter.h - formant filter - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FORMANT_FILTER_H -#define FORMANT_FILTER_H - -#include "../globals.h" -#include "Filter_.h" -#include "AnalogFilter.h" -#include "../Params/FilterParams.h" - - -class FormantFilter:public Filter_ -{ - public: - FormantFilter(FilterParams *pars); - ~FormantFilter(); - void filterout(REALTYPE *smp); - void setfreq(REALTYPE frequency); - void setfreq_and_q(REALTYPE frequency, REALTYPE q_); - void setq(REALTYPE q_); - void setgain(REALTYPE dBgain); - - void cleanup(); - private: - AnalogFilter *formant[FF_MAX_FORMANTS]; - REALTYPE *inbuffer, *tmpbuf; - - struct { - REALTYPE freq, amp, q; //frequency,amplitude,Q - } formantpar[FF_MAX_VOWELS][FF_MAX_FORMANTS], - currentformants[FF_MAX_FORMANTS]; - - struct { - unsigned char nvowel; - } sequence [FF_MAX_SEQUENCE]; - - REALTYPE oldformantamp[FF_MAX_FORMANTS]; - - int sequencesize, numformants, firsttime; - REALTYPE oldinput, slowinput; - REALTYPE Qfactor, formantslowness, oldQfactor; - REALTYPE vowelclearness, sequencestretch; - - void setpos(REALTYPE input); -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/DSP/SVFilter.cpp b/plugins/zynaddsubfx/src/DSP/SVFilter.cpp deleted file mode 100644 index 636835a8c..000000000 --- a/plugins/zynaddsubfx/src/DSP/SVFilter.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SVFilter.cpp - Several state-variable filters - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "SVFilter.h" - -SVFilter::SVFilter(unsigned char Ftype, - REALTYPE Ffreq, - REALTYPE Fq, - unsigned char Fstages) -{ - stages = Fstages; - type = Ftype; - freq = Ffreq; - q = Fq; - gain = 1.0; - outgain = 1.0; - needsinterpolation = 0; - firsttime = 1; - if(stages >= MAX_FILTER_STAGES) - stages = MAX_FILTER_STAGES; - cleanup(); - setfreq_and_q(Ffreq, Fq); -} - -SVFilter::~SVFilter() -{} - -void SVFilter::cleanup() -{ - for(int i = 0; i < MAX_FILTER_STAGES + 1; i++) { - st[i].low = 0.0; - st[i].high = 0.0; - st[i].band = 0.0; - st[i].notch = 0.0; - } - oldabovenq = 0; - abovenq = 0; -} - -void SVFilter::computefiltercoefs() -{ - par.f = freq / SAMPLE_RATE * 4.0; - if(par.f > 0.99999) - par.f = 0.99999; - par.q = 1.0 - atan(sqrt(q)) * 2.0 / PI; - par.q = pow(par.q, 1.0 / (stages + 1)); - par.q_sqrt = sqrt(par.q); -} - - -void SVFilter::setfreq(REALTYPE frequency) -{ - if(frequency < 0.1) - frequency = 0.1; - REALTYPE rap = freq / frequency; - if(rap < 1.0) - rap = 1.0 / rap; - - oldabovenq = abovenq; - abovenq = frequency > (SAMPLE_RATE / 2 - 500.0); - - int nyquistthresh = (abovenq ^ oldabovenq); - - - if((rap > 3.0) || (nyquistthresh != 0)) { //if the frequency is changed fast, it needs interpolation (now, filter and coeficients backup) - if(firsttime == 0) - needsinterpolation = 1; - ipar = par; - } - freq = frequency; - computefiltercoefs(); - firsttime = 0; -} - -void SVFilter::setfreq_and_q(REALTYPE frequency, REALTYPE q_) -{ - q = q_; - setfreq(frequency); -} - -void SVFilter::setq(REALTYPE q_) -{ - q = q_; - computefiltercoefs(); -} - -void SVFilter::settype(int type_) -{ - type = type_; - computefiltercoefs(); -} - -void SVFilter::setgain(REALTYPE dBgain) -{ - gain = dB2rap(dBgain); - computefiltercoefs(); -} - -void SVFilter::setstages(int stages_) -{ - if(stages_ >= MAX_FILTER_STAGES) - stages_ = MAX_FILTER_STAGES - 1; - stages = stages_; - cleanup(); - computefiltercoefs(); -} - -void SVFilter::singlefilterout(REALTYPE *smp, fstage &x, parameters &par) -{ - int i; - REALTYPE *out = NULL; - switch(type) { - case 0: - out = &x.low; - break; - case 1: - out = &x.high; - break; - case 2: - out = &x.band; - break; - case 3: - out = &x.notch; - break; - } - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - x.low = x.low + par.f * x.band; - x.high = par.q_sqrt * smp[i] - x.low - par.q * x.band; - x.band = par.f * x.high + x.band; - x.notch = x.high + x.low; - - smp[i] = *out; - } -} - -void SVFilter::filterout(REALTYPE *smp) -{ - int i; - REALTYPE *ismp = NULL; - - if(needsinterpolation != 0) { - ismp = new REALTYPE[SOUND_BUFFER_SIZE]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - ismp[i] = smp[i]; - for(i = 0; i < stages + 1; i++) - singlefilterout(ismp, st[i], ipar); - } - - for(i = 0; i < stages + 1; i++) - singlefilterout(smp, st[i], par); - - if(needsinterpolation != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE x = i / (REALTYPE) SOUND_BUFFER_SIZE; - smp[i] = ismp[i] * (1.0 - x) + smp[i] * x; - } - delete [] ismp; - needsinterpolation = 0; - } - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - smp[i] *= outgain; -} - diff --git a/plugins/zynaddsubfx/src/DSP/SVFilter.h b/plugins/zynaddsubfx/src/DSP/SVFilter.h deleted file mode 100644 index e90419e7d..000000000 --- a/plugins/zynaddsubfx/src/DSP/SVFilter.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SV Filter.h - Several state-variable filters - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef SV_FILTER_H -#define SV_FILTER_H - -#include "../globals.h" -#include "Filter_.h" -class SVFilter:public Filter_ -{ - public: - SVFilter(unsigned char Ftype, - REALTYPE Ffreq, - REALTYPE Fq, - unsigned char Fstages); - ~SVFilter(); - void filterout(REALTYPE *smp); - void setfreq(REALTYPE frequency); - void setfreq_and_q(REALTYPE frequency, REALTYPE q_); - void setq(REALTYPE q_); - - void settype(int type_); - void setgain(REALTYPE dBgain); - void setstages(int stages_); - void cleanup(); - - private: - struct fstage { - REALTYPE low, high, band, notch; - } st[MAX_FILTER_STAGES + 1]; - - struct parameters { - REALTYPE f, q, q_sqrt; - } par, ipar; - - - void singlefilterout(REALTYPE *smp, fstage &x, parameters &par); - void computefiltercoefs(); - int type; //The type of the filter (LPF1,HPF1,LPF2,HPF2...) - int stages; //how many times the filter is applied (0->1,1->2,etc.) - REALTYPE freq; //Frequency given in Hz - REALTYPE q; //Q factor (resonance or Q factor) - REALTYPE gain; //the gain of the filter (if are shelf/peak) filters - - int abovenq; //this is 1 if the frequency is above the nyquist - int oldabovenq; - int needsinterpolation, firsttime; -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/DSP/Unison.cpp b/plugins/zynaddsubfx/src/DSP/Unison.cpp deleted file mode 100644 index 798b2ecec..000000000 --- a/plugins/zynaddsubfx/src/DSP/Unison.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Unison.cpp - Unison effect (multivoice chorus) - Copyright (C) 2002-2009 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include "Unison.h" - -Unison::Unison(int update_period_samples_, REALTYPE max_delay_sec_) { - update_period_samples = update_period_samples_; - max_delay = (int)(max_delay_sec_ * (REALTYPE)SAMPLE_RATE + 1); - if(max_delay < 10) - max_delay = 10; - delay_buffer = new REALTYPE[max_delay]; - delay_k = 0; - base_freq = 1.0; - unison_bandwidth_cents = 10.0; - - ZERO_REALTYPE(delay_buffer, max_delay); - - uv = NULL; - update_period_sample_k = 0; - first_time = 0; - - set_size(1); -} - -Unison::~Unison() { - delete [] delay_buffer; - if(uv) - delete [] uv; -} - -void Unison::set_size(int new_size) { - if(new_size < 1) - new_size = 1; - unison_size = new_size; - if(uv) - delete [] uv; - uv = new UnisonVoice[unison_size]; - first_time = true; - update_parameters(); -} - -void Unison::set_base_frequency(REALTYPE freq) { - base_freq = freq; - update_parameters(); -} - -void Unison::set_bandwidth(REALTYPE bandwidth) { - if(bandwidth < 0) - bandwidth = 0.0; - if(bandwidth > 1200.0) - bandwidth = 1200.0; - - //printf("bandwidth %g\n", bandwidth); - unison_bandwidth_cents = bandwidth; - update_parameters(); -} - -void Unison::update_parameters() { - if(!uv) - return; - REALTYPE increments_per_second = SAMPLE_RATE - / (REALTYPE) update_period_samples; -// printf("#%g, %g\n",increments_per_second,base_freq); - for(int i = 0; i < unison_size; i++) { - REALTYPE base = pow(UNISON_FREQ_SPAN, RND * 2.0 - 1.0); - uv[i].relative_amplitude = base; - REALTYPE period = base / base_freq; - REALTYPE m = 4.0 / (period * increments_per_second); - if(RND < 0.5) - m = -m; - uv[i].step = m; -// printf("%g %g\n",uv[i].relative_amplitude,period); - } - - REALTYPE max_speed = pow(2.0, unison_bandwidth_cents / 1200.0); - unison_amplitude_samples = 0.125 - * (max_speed - 1.0) * SAMPLE_RATE / base_freq; - //printf("unison_amplitude_samples %g\n", unison_amplitude_samples); - - if(unison_amplitude_samples >= max_delay - 1) - unison_amplitude_samples = max_delay - 2; - - update_unison_data(); -} - -void Unison::process(int bufsize, REALTYPE *inbuf, REALTYPE *outbuf) { - if(!uv) - return; - if(!outbuf) - outbuf = inbuf; - - REALTYPE volume = 1.0 / sqrt(unison_size); - REALTYPE xpos_step = 1.0 / (REALTYPE) update_period_samples; - REALTYPE xpos = (REALTYPE) update_period_sample_k * xpos_step; - for(int i = 0; i < bufsize; i++) { - if((update_period_sample_k++) >= update_period_samples) { - update_unison_data(); - update_period_sample_k = 0; - xpos = 0.0; - } - xpos += xpos_step; - REALTYPE in = inbuf[i], out = 0.0; - - REALTYPE sign = 1.0; - for(int k = 0; k < unison_size; k++) { - REALTYPE vpos = uv[k].realpos1 - * (1.0 - xpos) + uv[k].realpos2 * xpos; //optimize - REALTYPE pos = delay_k + max_delay - vpos - 1.0; //optimize - int posi; - REALTYPE posf; - F2I(pos, posi); //optimize! - if(posi >= max_delay) - posi -= max_delay; - posf = pos - floor(pos); - out += - ((1.0 - - posf) * delay_buffer[posi] + posf - * delay_buffer[posi + 1]) * sign; - sign = -sign; - } - outbuf[i] = out * volume; -// printf("%d %g\n",i,outbuf[i]); - delay_buffer[delay_k] = in; - if((++delay_k) >= max_delay) - delay_k = 0; - } -} - -void Unison::update_unison_data() { - if(!uv) - return; - - for(int k = 0; k < unison_size; k++) { - REALTYPE pos = uv[k].position; - REALTYPE step = uv[k].step; - pos += step; - if(pos <= -1.0) { - pos = -1.0; - step = -step; - } - if(pos >= 1.0) { - pos = 1.0; - step = -step; - } - REALTYPE vibratto_val = (pos - 0.333333333 * pos * pos * pos) * 1.5; //make the vibratto lfo smoother - REALTYPE newval = 1.0 + 0.5 - * (vibratto_val - + 1.0) * unison_amplitude_samples - * uv[k].relative_amplitude; - - if(first_time) - uv[k].realpos1 = uv[k].realpos2 = newval; - else{ - uv[k].realpos1 = uv[k].realpos2; - uv[k].realpos2 = newval; - } - - uv[k].position = pos; - uv[k].step = step; - } - if(first_time) - first_time = false; -} - diff --git a/plugins/zynaddsubfx/src/DSP/Unison.h b/plugins/zynaddsubfx/src/DSP/Unison.h deleted file mode 100644 index d4254a114..000000000 --- a/plugins/zynaddsubfx/src/DSP/Unison.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Unison.h - Unison effect (multivoice chorus) - Copyright (C) 2002-2009 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef UNISON_H -#define UNISON_H -#include -#include "../globals.h" - -#define UNISON_FREQ_SPAN 2.0 -//how much the unison frequencies varies (always >= 1.0) - -class Unison -{ - public: - Unison(int update_period_samples_, REALTYPE max_delay_sec_); - ~Unison(); - - void set_size(int new_size); - void set_base_frequency(REALTYPE freq); - void set_bandwidth(REALTYPE bandwidth_cents); - - void process(int bufsize, REALTYPE *inbuf, REALTYPE *outbuf = NULL); - - private: - void update_parameters(); - void update_unison_data(); - - int unison_size; - REALTYPE base_freq; - struct UnisonVoice { - REALTYPE step, position; //base LFO - REALTYPE realpos1, realpos2; //the position regarding samples - REALTYPE relative_amplitude; - REALTYPE lin_fpos, lin_ffreq; - UnisonVoice() { - position = RND * 1.8 - 0.9; - realpos1 = 0.0; - realpos2 = 0.0; - step = 0.0; - relative_amplitude = 1.0; - } - } *uv; - int update_period_samples, update_period_sample_k; - int max_delay, delay_k; - bool first_time; - REALTYPE *delay_buffer; - REALTYPE unison_amplitude_samples; - REALTYPE unison_bandwidth_cents; -}; -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/Alienwah.cpp b/plugins/zynaddsubfx/src/Effects/Alienwah.cpp deleted file mode 100644 index 9d13ea8c1..000000000 --- a/plugins/zynaddsubfx/src/Effects/Alienwah.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Alienwah.cpp - "AlienWah" effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Alienwah.h" - -Alienwah::Alienwah(const int &insertion_, - REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), oldl(NULL), oldr(NULL) -{ - setpreset(Ppreset); - cleanup(); - oldclfol = complex(fb, 0.0); - oldclfor = complex(fb, 0.0); -} - -Alienwah::~Alienwah() -{ - if(oldl != NULL) - delete [] oldl; - if(oldr != NULL) - delete [] oldr; -} - - -/* - * Apply the effect - */ -void Alienwah::out(const Stereo &smp) -{ - REALTYPE lfol, lfor; //Left/Right LFOs - complex clfol, clfor, out, tmp; - /**\todo Rework, as optimization can be used when the new complex type is - * utilized. - * Before all calculations needed to be done with individual REALTYPE, - * but now they can be done together*/ - lfo.effectlfoout(&lfol, &lfor); - lfol *= depth * PI * 2.0; - lfor *= depth * PI * 2.0; - clfol = complex(cos(lfol + phase) * fb, sin(lfol + phase) * fb); //rework - clfor = complex(cos(lfor + phase) * fb, sin(lfor + phase) * fb); //rework - - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE x = ((REALTYPE) i) / SOUND_BUFFER_SIZE; - REALTYPE x1 = 1.0 - x; - //left - tmp = clfol * x + oldclfol * x1; - - out = tmp * oldl[oldk]; - out.real() += (1 - fabs(fb)) * smp.l[i] * (1.0 - panning); - - oldl[oldk] = out; - REALTYPE l = out.real() * 10.0 * (fb + 0.1); - - //right - tmp = clfor * x + oldclfor * x1; - - out = tmp * oldr[oldk]; - out.real() += (1 - fabs(fb)) * smp.r[i] * (1.0 - panning); - - oldr[oldk] = out; - REALTYPE r = out.real() * 10.0 * (fb + 0.1); - - - if(++oldk >= Pdelay) - oldk = 0; - //LRcross - efxoutl[i] = l * (1.0 - lrcross) + r * lrcross; - efxoutr[i] = r * (1.0 - lrcross) + l * lrcross; - } - - oldclfol = clfol; - oldclfor = clfor; -} - -/* - * Cleanup the effect - */ -void Alienwah::cleanup() -{ - for(int i = 0; i < Pdelay; i++) { - oldl[i] = complex(0.0, 0.0); - oldr[i] = complex(0.0, 0.0); - } - oldk = 0; -} - - -/* - * Parameter control - */ - -void Alienwah::setdepth(unsigned char Pdepth) -{ - this->Pdepth = Pdepth; - depth = (Pdepth / 127.0); -} - -void Alienwah::setfb(unsigned char Pfb) -{ - this->Pfb = Pfb; - fb = fabs((Pfb - 64.0) / 64.1); - fb = sqrt(fb); - if(fb < 0.4) - fb = 0.4; - if(Pfb < 64) - fb = -fb; -} - -void Alienwah::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - outvolume = Pvolume / 127.0; - if(insertion == 0) - volume = 1.0; - else - volume = outvolume; -} - -void Alienwah::setpanning(unsigned char Ppanning) -{ - this->Ppanning = Ppanning; - panning = Ppanning / 127.0; -} - -void Alienwah::setlrcross(unsigned char Plrcross) -{ - this->Plrcross = Plrcross; - lrcross = Plrcross / 127.0; -} - -void Alienwah::setphase(unsigned char Pphase) -{ - this->Pphase = Pphase; - phase = (Pphase - 64.0) / 64.0 * PI; -} - -void Alienwah::setdelay(unsigned char Pdelay) -{ - if(oldl != NULL) - delete [] oldl; - if(oldr != NULL) - delete [] oldr; - if(Pdelay >= MAX_ALIENWAH_DELAY) - this->Pdelay = MAX_ALIENWAH_DELAY; - else - this->Pdelay = Pdelay; - oldl = new complex[Pdelay]; - oldr = new complex[Pdelay]; - cleanup(); -} - -void Alienwah::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 11; - const int NUM_PRESETS = 4; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //AlienWah1 - {127, 64, 70, 0, 0, 62, 60, 105, 25, 0, 64}, - //AlienWah2 - {127, 64, 73, 106, 0, 101, 60, 105, 17, 0, 64}, - //AlienWah3 - {127, 64, 63, 0, 1, 100, 112, 105, 31, 0, 42}, - //AlienWah4 - {93, 64, 25, 0, 1, 66, 101, 11, 47, 0, 86} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - if(insertion == 0) - changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect - Ppreset = npreset; -} - - -void Alienwah::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setfb(value); - break; - case 8: - setdelay(value); - break; - case 9: - setlrcross(value); - break; - case 10: - setphase(value); - break; - } -} - -unsigned char Alienwah::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - case 1: - return Ppanning; - break; - case 2: - return lfo.Pfreq; - break; - case 3: - return lfo.Prandomness; - break; - case 4: - return lfo.PLFOtype; - break; - case 5: - return lfo.Pstereo; - break; - case 6: - return Pdepth; - break; - case 7: - return Pfb; - break; - case 8: - return Pdelay; - break; - case 9: - return Plrcross; - break; - case 10: - return Pphase; - break; - default: - return 0; - } -} - diff --git a/plugins/zynaddsubfx/src/Effects/Alienwah.h b/plugins/zynaddsubfx/src/Effects/Alienwah.h deleted file mode 100644 index 9ad695403..000000000 --- a/plugins/zynaddsubfx/src/Effects/Alienwah.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Alienwah.h - "AlienWah" effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ALIENWAH_H -#define ALIENWAH_H -#include -#include "../globals.h" -#include "Effect.h" -#include "EffectLFO.h" - -using namespace std; - -#define MAX_ALIENWAH_DELAY 100 - -/**"AlienWah" Effect*/ -class Alienwah:public Effect -{ - public: - /** - * Constructor - * @param insetion_ 1 for insertion Effect, 0 for others - * @param efxoutl_ Pointer to Alienwah's left channel output buffer - * @param efxoutr_ Pointer to Alienwah's left channel output buffer - * @return Initialized Alienwah - */ - Alienwah(const int &insetion_, - REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_); - ~Alienwah(); - void out(const Stereo &smp); - - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(); - - private: - //Alienwah Parameters - EffectLFO lfo; //lfo-ul Alienwah - unsigned char Pvolume; - unsigned char Ppanning; - unsigned char Pdepth; //the depth of the Alienwah - unsigned char Pfb; //feedback - unsigned char Plrcross; //feedback - unsigned char Pdelay; - unsigned char Pphase; - - - //Control Parameters - void setvolume(unsigned char Pvolume); - void setpanning(unsigned char Ppanning); - void setdepth(unsigned char Pdepth); - void setfb(unsigned char Pfb); - void setlrcross(unsigned char Plrcross); - void setdelay(unsigned char Pdelay); - void setphase(unsigned char Pphase); - - //Internal Values - REALTYPE panning, fb, depth, lrcross, phase; - complex *oldl, *oldr; - complex oldclfol, oldclfor; - int oldk; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/CMakeLists.txt b/plugins/zynaddsubfx/src/Effects/CMakeLists.txt deleted file mode 100644 index 0c15dfa87..000000000 --- a/plugins/zynaddsubfx/src/Effects/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(zynaddsubfx_effect_SRCS - Alienwah.cpp - Chorus.cpp - Distorsion.cpp - DynamicFilter.cpp - Echo.cpp - Effect.cpp - EffectLFO.cpp - EffectMgr.cpp - EQ.cpp - Phaser.cpp - Reverb.cpp -) - -add_library(zynaddsubfx_effect STATIC - ${zynaddsubfx_effect_SRCS} - ) - -target_link_libraries(zynaddsubfx_effect) diff --git a/plugins/zynaddsubfx/src/Effects/Chorus.cpp b/plugins/zynaddsubfx/src/Effects/Chorus.cpp deleted file mode 100644 index b39c0032b..000000000 --- a/plugins/zynaddsubfx/src/Effects/Chorus.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Chorus.cpp - Chorus and Flange effects - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Chorus.h" -#include - -using namespace std; - -Chorus::Chorus(const int &insertion_, - REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), - maxdelay((int)(MAX_CHORUS_DELAY / 1000.0 * SAMPLE_RATE)), - delaySample(maxdelay) -{ - dlk = 0; - drk = 0; - - setpreset(Ppreset); - - lfo.effectlfoout(&lfol, &lfor); - dl2 = getdelay(lfol); - dr2 = getdelay(lfor); - cleanup(); -} - -Chorus::~Chorus() {} - -/* - * get the delay value in samples; xlfo is the current lfo value - */ -REALTYPE Chorus::getdelay(REALTYPE xlfo) -{ - REALTYPE result; - if(Pflangemode == 0) - result = (delay + xlfo * depth) * SAMPLE_RATE; - else - result = 0; - - //check if it is too big delay(caused bu errornous setdelay() and setdepth() - /**\todo fix setdelay() and setdepth(), so this error cannot occur*/ - if((result + 0.5) >= maxdelay) { - cerr - << - "WARNING: Chorus.cpp::getdelay(..) too big delay (see setdelay and setdepth funcs.)\n"; - result = maxdelay - 1.0; - } - return result; -} - -void Chorus::out(const Stereo &input) -{ - const REALTYPE one = 1.0; - dl1 = dl2; - dr1 = dr2; - lfo.effectlfoout(&lfol, &lfor); - - dl2 = getdelay(lfol); - dr2 = getdelay(lfor); - - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE inl = input.l[i]; - REALTYPE inr = input.r[i]; - //LRcross - Stereo tmpc(inl, inr); - //REALTYPE r=inr; - inl = tmpc.l * (1.0 - lrcross) + tmpc.r * lrcross; - inr = tmpc.r * (1.0 - lrcross) + tmpc.l * lrcross; - - //Left channel - - //compute the delay in samples using linear interpolation between the lfo delays - mdel = (dl1 * (SOUND_BUFFER_SIZE - i) + dl2 * i) / SOUND_BUFFER_SIZE; - if(++dlk >= maxdelay) - dlk = 0; - REALTYPE tmp = dlk - mdel + maxdelay * 2.0; //where should I get the sample from - - F2I(tmp, dlhi); - dlhi %= maxdelay; - - dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; - dllo = 1.0 - fmod(tmp, one); - efxoutl[i] = delaySample.l[dlhi2] * dllo + delaySample.l[dlhi] - * (1.0 - dllo); - delaySample.l[dlk] = inl + efxoutl[i] * fb; - - //Right channel - - //compute the delay in samples using linear interpolation between the lfo delays - mdel = (dr1 * (SOUND_BUFFER_SIZE - i) + dr2 * i) / SOUND_BUFFER_SIZE; - if(++drk >= maxdelay) - drk = 0; - tmp = drk * 1.0 - mdel + maxdelay * 2.0; //where should I get the sample from - - F2I(tmp, dlhi); - dlhi %= maxdelay; - - dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; - dllo = 1.0 - fmod(tmp, one); - efxoutr[i] = delaySample.r[dlhi2] * dllo + delaySample.r[dlhi] - * (1.0 - dllo); - delaySample.r[dlk] = inr + efxoutr[i] * fb; - } - - if(Poutsub != 0) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] *= -1.0; - efxoutr[i] *= -1.0; - } - ; - - - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] *= panning; - efxoutr[i] *= (1.0 - panning); - } -} - -/* - * Cleanup the effect - */ -void Chorus::cleanup() -{ - delaySample.l.clear(); - delaySample.r.clear(); -} - -/* - * Parameter control - */ -void Chorus::setdepth(unsigned char Pdepth) -{ - this->Pdepth = Pdepth; - depth = (pow(8.0, (Pdepth / 127.0) * 2.0) - 1.0) / 1000.0; //seconds -} - -void Chorus::setdelay(unsigned char Pdelay) -{ - this->Pdelay = Pdelay; - delay = (pow(10.0, (Pdelay / 127.0) * 2.0) - 1.0) / 1000.0; //seconds -} - -void Chorus::setfb(unsigned char Pfb) -{ - this->Pfb = Pfb; - fb = (Pfb - 64.0) / 64.1; -} -void Chorus::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - outvolume = Pvolume / 127.0; - if(insertion == 0) - volume = 1.0; - else - volume = outvolume; -} - -void Chorus::setpanning(unsigned char Ppanning) -{ - this->Ppanning = Ppanning; - panning = Ppanning / 127.0; -} - -void Chorus::setlrcross(unsigned char Plrcross) -{ - this->Plrcross = Plrcross; - lrcross = Plrcross / 127.0; -} - -void Chorus::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 12; - const int NUM_PRESETS = 10; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Chorus1 - {64, 64, 50, 0, 0, 90, 40, 85, 64, 119, 0, 0 }, - //Chorus2 - {64, 64, 45, 0, 0, 98, 56, 90, 64, 19, 0, 0 }, - //Chorus3 - {64, 64, 29, 0, 1, 42, 97, 95, 90, 127, 0, 0 }, - //Celeste1 - {64, 64, 26, 0, 0, 42, 115, 18, 90, 127, 0, 0 }, - //Celeste2 - {64, 64, 29, 117, 0, 50, 115, 9, 31, 127, 0, 1 }, - //Flange1 - {64, 64, 57, 0, 0, 60, 23, 3, 62, 0, 0, 0 }, - //Flange2 - {64, 64, 33, 34, 1, 40, 35, 3, 109, 0, 0, 0 }, - //Flange3 - {64, 64, 53, 34, 1, 94, 35, 3, 54, 0, 0, 1 }, - //Flange4 - {64, 64, 40, 0, 1, 62, 12, 19, 97, 0, 0, 0 }, - //Flange5 - {64, 64, 55, 105, 0, 24, 39, 19, 17, 0, 0, 1 } - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - Ppreset = npreset; -} - - -void Chorus::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setdelay(value); - break; - case 8: - setfb(value); - break; - case 9: - setlrcross(value); - break; - case 10: - if(value > 1) - Pflangemode = 1; - else - Pflangemode = value; - break; - case 11: - if(value > 1) - Poutsub = 1; - else - Poutsub = value; - break; - } -} - -unsigned char Chorus::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - case 1: - return Ppanning; - break; - case 2: - return lfo.Pfreq; - break; - case 3: - return lfo.Prandomness; - break; - case 4: - return lfo.PLFOtype; - break; - case 5: - return lfo.Pstereo; - break; - case 6: - return Pdepth; - break; - case 7: - return Pdelay; - break; - case 8: - return Pfb; - break; - case 9: - return Plrcross; - break; - case 10: - return Pflangemode; - break; - case 11: - return Poutsub; - break; - default: - return 0; - } -} - diff --git a/plugins/zynaddsubfx/src/Effects/Chorus.h b/plugins/zynaddsubfx/src/Effects/Chorus.h deleted file mode 100644 index 2aeb1a191..000000000 --- a/plugins/zynaddsubfx/src/Effects/Chorus.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Chorus.h - Chorus and Flange effects - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef CHORUS_H -#define CHORUS_H -#include "../globals.h" -#include "Effect.h" -#include "EffectLFO.h" -#include "../Samples/Sample.h" -#include "../Misc/Stereo.h" - -#define MAX_CHORUS_DELAY 250.0 //ms - -/**Chorus and Flange effects*/ -class Chorus:public Effect -{ - public: - Chorus(const int &insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_); - /**Destructor*/ - ~Chorus(); - void out(const Stereo &input); - void setpreset(unsigned char npreset); - /** - * Sets the value of the chosen variable - * - * The possible parameters are: - * -# Volume - * -# Panning - * -# LFO Frequency - * -# LFO Randomness - * -# LFO Type - * -# LFO stereo - * -# Depth - * -# Delay - * -# Feedback - * -# Flange Mode - * -# Subtractive - * @param npar number of chosen parameter - * @param value the new value - */ - void changepar(int npar, unsigned char value); - /** - * Gets the value of the chosen variable - * - * The possible parameters are: - * -# Volume - * -# Panning - * -# LFO Frequency - * -# LFO Randomness - * -# LFO Type - * -# LFO stereo - * -# Depth - * -# Delay - * -# Feedback - * -# Flange Mode - * -# Subtractive - * @param npar number of chosen parameter - * @return the value of the parameter - */ - unsigned char getpar(int npar) const; - void cleanup(); - - private: - //Chorus Parameters - EffectLFO lfo; //lfo-ul chorus - unsigned char Pvolume; - unsigned char Ppanning; - unsigned char Pdepth; //the depth of the Chorus(ms) - unsigned char Pdelay; //the delay (ms) - unsigned char Pfb; //feedback - unsigned char Plrcross; //feedback - unsigned char Pflangemode; //how the LFO is scaled, to result chorus or flange - unsigned char Poutsub; //if I wish to substract the output instead of the adding it - - - //Parameter Controls - void setvolume(unsigned char Pvolume); - void setpanning(unsigned char Ppanning); - void setdepth(unsigned char Pdepth); - void setdelay(unsigned char Pdelay); - void setfb(unsigned char Pfb); - void setlrcross(unsigned char Plrcross); - - //Internal Values - REALTYPE depth, delay, fb, lrcross, panning; - REALTYPE dl1, dl2, dr1, dr2, lfol, lfor; - int maxdelay; - Stereo delaySample; - int dlk, drk, dlhi, dlhi2; - REALTYPE getdelay(REALTYPE xlfo); - REALTYPE dllo, mdel; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/Distorsion.cpp b/plugins/zynaddsubfx/src/Effects/Distorsion.cpp deleted file mode 100644 index a0b6a2e62..000000000 --- a/plugins/zynaddsubfx/src/Effects/Distorsion.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Distorsion.cpp - Distorsion effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Distorsion.h" - - -/* - * Waveshape (this is called by OscilGen::waveshape and Distorsion::process) - */ - -void waveshapesmps(int n, - REALTYPE *smps, - unsigned char type, - unsigned char drive) -{ - int i; - REALTYPE ws = drive / 127.0; - REALTYPE tmpv; - - switch(type) { - case 1: - ws = pow(10, ws * ws * 3.0) - 1.0 + 0.001; //Arctangent - for(i = 0; i < n; i++) - smps[i] = atan(smps[i] * ws) / atan(ws); - break; - case 2: - ws = ws * ws * 32.0 + 0.0001; //Asymmetric - if(ws < 1.0) - tmpv = sin(ws) + 0.1; - else - tmpv = 1.1; - for(i = 0; i < n; i++) - smps[i] = sin(smps[i] * (0.1 + ws - ws * smps[i])) / tmpv; - ; - break; - case 3: - ws = ws * ws * ws * 20.0 + 0.0001; //Pow - for(i = 0; i < n; i++) { - smps[i] *= ws; - if(fabs(smps[i]) < 1.0) { - smps[i] = (smps[i] - pow(smps[i], 3.0)) * 3.0; - if(ws < 1.0) - smps[i] /= ws; - } - else - smps[i] = 0.0; - } - break; - case 4: - ws = ws * ws * ws * 32.0 + 0.0001; //Sine - if(ws < 1.57) - tmpv = sin(ws); - else - tmpv = 1.0; - for(i = 0; i < n; i++) - smps[i] = sin(smps[i] * ws) / tmpv; - break; - case 5: - ws = ws * ws + 0.000001; //Quantisize - for(i = 0; i < n; i++) - smps[i] = floor(smps[i] / ws + 0.5) * ws; - break; - case 6: - ws = ws * ws * ws * 32 + 0.0001; //Zigzag - if(ws < 1.0) - tmpv = sin(ws); - else - tmpv = 1.0; - for(i = 0; i < n; i++) - smps[i] = asin(sin(smps[i] * ws)) / tmpv; - break; - case 7: - ws = pow(2.0, -ws * ws * 8.0); //Limiter - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i]; - if(fabs(tmp) > ws) { - if(tmp >= 0.0) - smps[i] = 1.0; - else - smps[i] = -1.0; - } - else - smps[i] /= ws; - } - break; - case 8: - ws = pow(2.0, -ws * ws * 8.0); //Upper Limiter - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i]; - if(tmp > ws) - smps[i] = ws; - smps[i] *= 2.0; - } - break; - case 9: - ws = pow(2.0, -ws * ws * 8.0); //Lower Limiter - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i]; - if(tmp < -ws) - smps[i] = -ws; - smps[i] *= 2.0; - } - break; - case 10: - ws = (pow(2.0, ws * 6.0) - 1.0) / pow(2.0, 6.0); //Inverse Limiter - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i]; - if(fabs(tmp) > ws) { - if(tmp >= 0.0) - smps[i] = tmp - ws; - else - smps[i] = tmp + ws; - } - else - smps[i] = 0; - } - break; - case 11: - ws = pow(5, ws * ws * 1.0) - 1.0; //Clip - for(i = 0; i < n; i++) - smps[i] = smps[i] - * (ws + 0.5) * 0.9999 - floor( - 0.5 + smps[i] * (ws + 0.5) * 0.9999); - break; - case 12: - ws = ws * ws * ws * 30 + 0.001; //Asym2 - if(ws < 0.3) - tmpv = ws; - else - tmpv = 1.0; - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i] * ws; - if((tmp > -2.0) && (tmp < 1.0)) - smps[i] = tmp * (1.0 - tmp) * (tmp + 2.0) / tmpv; - else - smps[i] = 0.0; - } - break; - case 13: - ws = ws * ws * ws * 32.0 + 0.0001; //Pow2 - if(ws < 1.0) - tmpv = ws * (1 + ws) / 2.0; - else - tmpv = 1.0; - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i] * ws; - if((tmp > -1.0) && (tmp < 1.618034)) - smps[i] = tmp * (1.0 - tmp) / tmpv; - else - if(tmp > 0.0) - smps[i] = -1.0; - else - smps[i] = -2.0; - } - break; - case 14: - ws = pow(ws, 5.0) * 80.0 + 0.0001; //sigmoid - if(ws > 10.0) - tmpv = 0.5; - else - tmpv = 0.5 - 1.0 / (exp(ws) + 1.0); - for(i = 0; i < n; i++) { - REALTYPE tmp = smps[i] * ws; - if(tmp < -10.0) - tmp = -10.0; - else - if(tmp > 10.0) - tmp = 10.0; - tmp = 0.5 - 1.0 / (exp(tmp) + 1.0); - smps[i] = tmp / tmpv; - } - break; - /**\todo update to Distorsion::changepar (Ptype max) if there is added more waveshapings functions*/ - } -} - - -Distorsion::Distorsion(const int &insertion_, - REALTYPE *efxoutl_, - REALTYPE *efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0) -{ - lpfl = new AnalogFilter(2, 22000, 1, 0); - lpfr = new AnalogFilter(2, 22000, 1, 0); - hpfl = new AnalogFilter(3, 20, 1, 0); - hpfr = new AnalogFilter(3, 20, 1, 0); - - - //default values - Pvolume = 50; - Plrcross = 40; - Pdrive = 90; - Plevel = 64; - Ptype = 0; - Pnegate = 0; - Plpf = 127; - Phpf = 0; - Pstereo = 0; - Pprefiltering = 0; - - setpreset(Ppreset); - cleanup(); -} - -Distorsion::~Distorsion() -{ - delete lpfl; - delete lpfr; - delete hpfl; - delete hpfr; -} - -/* - * Cleanup the effect - */ -void Distorsion::cleanup() -{ - lpfl->cleanup(); - hpfl->cleanup(); - lpfr->cleanup(); - hpfr->cleanup(); -} - - -/* - * Apply the filters - */ - -void Distorsion::applyfilters(REALTYPE *efxoutl, REALTYPE *efxoutr) -{ - lpfl->filterout(efxoutl); - hpfl->filterout(efxoutl); - if(Pstereo != 0) { //stereo - lpfr->filterout(efxoutr); - hpfr->filterout(efxoutr); - } -} - - -/* - * Effect output - */ -void Distorsion::out(const Stereo &smp) -{ - int i; - REALTYPE l, r, lout, rout; - - REALTYPE inputvol = pow(5.0, (Pdrive - 32.0) / 127.0); - if(Pnegate != 0) - inputvol *= -1.0; - - if(Pstereo != 0) { //Stereo - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] = smp.l[i] * inputvol * panning; - efxoutr[i] = smp.r[i] * inputvol * (1.0 - panning); - } - } - else { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - efxoutl[i] = - (smp.l[i] * panning + smp.r[i] * (1.0 - panning)) * inputvol; - ; - } - - if(Pprefiltering != 0) - applyfilters(efxoutl, efxoutr); - - //no optimised, yet (no look table) - waveshapesmps(SOUND_BUFFER_SIZE, efxoutl, Ptype + 1, Pdrive); - if(Pstereo != 0) - waveshapesmps(SOUND_BUFFER_SIZE, efxoutr, Ptype + 1, Pdrive); - - if(Pprefiltering == 0) - applyfilters(efxoutl, efxoutr); - - if(Pstereo == 0) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - efxoutr[i] = efxoutl[i]; - - REALTYPE level = dB2rap(60.0 * Plevel / 127.0 - 40.0); - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - lout = efxoutl[i]; - rout = efxoutr[i]; - l = lout * (1.0 - lrcross) + rout * lrcross; - r = rout * (1.0 - lrcross) + lout * lrcross; - lout = l; - rout = r; - - efxoutl[i] = lout * 2.0 * level; - efxoutr[i] = rout * 2.0 * level; - } -} - - -/* - * Parameter control - */ -void Distorsion::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - - if(insertion == 0) { - outvolume = pow(0.01, (1.0 - Pvolume / 127.0)) * 4.0; - volume = 1.0; - } - else - volume = outvolume = Pvolume / 127.0; - ; - if(Pvolume == 0) - cleanup(); -} - -void Distorsion::setpanning(unsigned char Ppanning) -{ - this->Ppanning = Ppanning; - panning = (Ppanning + 0.5) / 127.0; -} - - -void Distorsion::setlrcross(unsigned char Plrcross) -{ - this->Plrcross = Plrcross; - lrcross = Plrcross / 127.0 * 1.0; -} - -void Distorsion::setlpf(unsigned char Plpf) -{ - this->Plpf = Plpf; - REALTYPE fr = exp(pow(Plpf / 127.0, 0.5) * log(25000.0)) + 40; - lpfl->setfreq(fr); - lpfr->setfreq(fr); -} - -void Distorsion::sethpf(unsigned char Phpf) -{ - this->Phpf = Phpf; - REALTYPE fr = exp(pow(Phpf / 127.0, 0.5) * log(25000.0)) + 20.0; - hpfl->setfreq(fr); - hpfr->setfreq(fr); -} - - -void Distorsion::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 11; - const int NUM_PRESETS = 6; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Overdrive 1 - {127, 64, 35, 56, 70, 0, 0, 96, 0, 0, 0 }, - //Overdrive 2 - {127, 64, 35, 29, 75, 1, 0, 127, 0, 0, 0 }, - //A. Exciter 1 - {64, 64, 35, 75, 80, 5, 0, 127, 105, 1, 0 }, - //A. Exciter 2 - {64, 64, 35, 85, 62, 1, 0, 127, 118, 1, 0 }, - //Guitar Amp - {127, 64, 35, 63, 75, 2, 0, 55, 0, 0, 0 }, - //Quantisize - {127, 64, 35, 88, 75, 4, 0, 127, 0, 1, 0 } - }; - - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - if(insertion == 0) - changepar(0, (int) (presets[npreset][0] / 1.5)); //lower the volume if this is system effect - Ppreset = npreset; - cleanup(); -} - - -void Distorsion::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - setlrcross(value); - break; - case 3: - Pdrive = value; - break; - case 4: - Plevel = value; - break; - case 5: - if(value > 13) - Ptype = 13; //this must be increased if more distorsion types are added - else - Ptype = value; - break; - case 6: - if(value > 1) - Pnegate = 1; - else - Pnegate = value; - break; - case 7: - setlpf(value); - break; - case 8: - sethpf(value); - break; - case 9: - if(value > 1) - Pstereo = 1; - else - Pstereo = value; - break; - case 10: - Pprefiltering = value; - break; - } -} - -unsigned char Distorsion::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - case 1: - return Ppanning; - break; - case 2: - return Plrcross; - break; - case 3: - return Pdrive; - break; - case 4: - return Plevel; - break; - case 5: - return Ptype; - break; - case 6: - return Pnegate; - break; - case 7: - return Plpf; - break; - case 8: - return Phpf; - break; - case 9: - return Pstereo; - break; - case 10: - return Pprefiltering; - break; - } - return 0; //in case of bogus parameter number -} - diff --git a/plugins/zynaddsubfx/src/Effects/Distorsion.h b/plugins/zynaddsubfx/src/Effects/Distorsion.h deleted file mode 100644 index 472af3ffd..000000000 --- a/plugins/zynaddsubfx/src/Effects/Distorsion.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Distorsion.h - Distorsion Effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef DISTORSION_H -#define DISTORSION_H - -#include "../globals.h" -#include "../DSP/AnalogFilter.h" -#include "Effect.h" - -//Waveshaping(called by Distorsion effect and waveshape from OscilGen) -void waveshapesmps(int n, - REALTYPE *smps, - unsigned char type, - unsigned char drive); -/**Distortion Effect*/ -class Distorsion:public Effect -{ - public: - Distorsion(const int &insertion, REALTYPE *efxoutl_, REALTYPE *efxoutr_); - ~Distorsion(); - void out(const Stereo &smp); - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(); - void applyfilters(REALTYPE *efxoutl, REALTYPE *efxoutr); - - private: - //Parametrii - unsigned char Pvolume; //Volume or E/R - unsigned char Ppanning; //Panning - unsigned char Plrcross; // L/R Mixing - unsigned char Pdrive; //the input amplification - unsigned char Plevel; //the output amplification - unsigned char Ptype; //Distorsion type - unsigned char Pnegate; //if the input is negated - unsigned char Plpf; //lowpass filter - unsigned char Phpf; //highpass filter - unsigned char Pstereo; //0=mono,1=stereo - unsigned char Pprefiltering; //if you want to do the filtering before the distorsion - - void setvolume(unsigned char Pvolume); - void setpanning(unsigned char Ppanning); - void setlrcross(unsigned char Plrcross); - void setlpf(unsigned char Plpf); - void sethpf(unsigned char Phpf); - - //Real Parameters - REALTYPE panning, lrcross; - AnalogFilter *lpfl, *lpfr, *hpfl, *hpfr; -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/DynamicFilter.cpp b/plugins/zynaddsubfx/src/Effects/DynamicFilter.cpp deleted file mode 100644 index b60f40142..000000000 --- a/plugins/zynaddsubfx/src/Effects/DynamicFilter.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - DynamicFilter.cpp - "WahWah" effect and others - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "DynamicFilter.h" - -DynamicFilter::DynamicFilter(int insertion_, - REALTYPE *efxoutl_, - REALTYPE *efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, new FilterParams(0, 64, 64), 0), - Pvolume(110), Ppanning(64), Pdepth(0), Pampsns(90), - Pampsnsinv(0), Pampsmooth(60), - filterl(NULL), filterr(NULL) -{ - setpreset(Ppreset); - cleanup(); -} - -DynamicFilter::~DynamicFilter() -{ - delete filterpars; - delete filterl; - delete filterr; -} - - -/* - * Apply the effect - */ -void DynamicFilter::out(const Stereo &smp) -{ - int i; - if(filterpars->changed) { - filterpars->changed = false; - cleanup(); - } - - REALTYPE lfol, lfor; - lfo.effectlfoout(&lfol, &lfor); - lfol *= depth * 5.0; - lfor *= depth * 5.0; - REALTYPE freq = filterpars->getfreq(); - REALTYPE q = filterpars->getq(); - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] = smp.l[i]; - efxoutr[i] = smp.r[i]; - - REALTYPE x = (fabs(smp.l[i]) + fabs(smp.l[i])) * 0.5; - ms1 = ms1 * (1.0 - ampsmooth) + x * ampsmooth + 1e-10; - } - - - REALTYPE ampsmooth2 = pow(ampsmooth, 0.2) * 0.3; - ms2 = ms2 * (1.0 - ampsmooth2) + ms1 * ampsmooth2; - ms3 = ms3 * (1.0 - ampsmooth2) + ms2 * ampsmooth2; - ms4 = ms4 * (1.0 - ampsmooth2) + ms3 * ampsmooth2; - REALTYPE rms = (sqrt(ms4)) * ampsns; - - REALTYPE frl = filterl->getrealfreq(freq + lfol + rms); - REALTYPE frr = filterr->getrealfreq(freq + lfor + rms); - - filterl->setfreq_and_q(frl, q); - filterr->setfreq_and_q(frr, q); - - - filterl->filterout(efxoutl); - filterr->filterout(efxoutr); - - //panning - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] *= panning; - efxoutr[i] *= (1.0 - panning); - } -} - -/* - * Cleanup the effect - */ -void DynamicFilter::cleanup() -{ - reinitfilter(); - ms1 = 0.0; - ms2 = 0.0; - ms3 = 0.0; - ms4 = 0.0; -} - - -/* - * Parameter control - */ - -void DynamicFilter::setdepth(unsigned char Pdepth) -{ - this->Pdepth = Pdepth; - depth = pow((Pdepth / 127.0), 2.0); -} - - -void DynamicFilter::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - outvolume = Pvolume / 127.0; - if(insertion == 0) - volume = 1.0; - else - volume = outvolume; -} - -void DynamicFilter::setpanning(unsigned char Ppanning) -{ - this->Ppanning = Ppanning; - panning = Ppanning / 127.0; -} - - -void DynamicFilter::setampsns(unsigned char Pampsns) -{ - ampsns = pow(Pampsns / 127.0, 2.5) * 10.0; - if(Pampsnsinv != 0) - ampsns = -ampsns; - ampsmooth = exp(-Pampsmooth / 127.0 * 10.0) * 0.99; - this->Pampsns = Pampsns; -} - -void DynamicFilter::reinitfilter() -{ - if(filterl != NULL) - delete (filterl); - if(filterr != NULL) - delete (filterr); - filterl = new Filter(filterpars); - filterr = new Filter(filterpars); -} - -void DynamicFilter::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 10; - const int NUM_PRESETS = 5; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //WahWah - {110, 64, 80, 0, 0, 64, 0, 90, 0, 60}, - //AutoWah - {110, 64, 70, 0, 0, 80, 70, 0, 0, 60}, - //Sweep - {100, 64, 30, 0, 0, 50, 80, 0, 0, 60}, - //VocalMorph1 - {110, 64, 80, 0, 0, 64, 0, 64, 0, 60}, - //VocalMorph1 - {127, 64, 50, 0, 0, 96, 64, 0, 0, 60} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - - filterpars->defaults(); - switch(npreset) { - case 0: - filterpars->Pcategory = 0; - filterpars->Ptype = 2; - filterpars->Pfreq = 45; - filterpars->Pq = 64; - filterpars->Pstages = 1; - filterpars->Pgain = 64; - break; - case 1: - filterpars->Pcategory = 2; - filterpars->Ptype = 0; - filterpars->Pfreq = 72; - filterpars->Pq = 64; - filterpars->Pstages = 0; - filterpars->Pgain = 64; - break; - case 2: - filterpars->Pcategory = 0; - filterpars->Ptype = 4; - filterpars->Pfreq = 64; - filterpars->Pq = 64; - filterpars->Pstages = 2; - filterpars->Pgain = 64; - break; - case 3: - filterpars->Pcategory = 1; - filterpars->Ptype = 0; - filterpars->Pfreq = 50; - filterpars->Pq = 70; - filterpars->Pstages = 1; - filterpars->Pgain = 64; - - filterpars->Psequencesize = 2; - // "I" - filterpars->Pvowels[0].formants[0].freq = 34; - filterpars->Pvowels[0].formants[0].amp = 127; - filterpars->Pvowels[0].formants[0].q = 64; - filterpars->Pvowels[0].formants[1].freq = 99; - filterpars->Pvowels[0].formants[1].amp = 122; - filterpars->Pvowels[0].formants[1].q = 64; - filterpars->Pvowels[0].formants[2].freq = 108; - filterpars->Pvowels[0].formants[2].amp = 112; - filterpars->Pvowels[0].formants[2].q = 64; - // "A" - filterpars->Pvowels[1].formants[0].freq = 61; - filterpars->Pvowels[1].formants[0].amp = 127; - filterpars->Pvowels[1].formants[0].q = 64; - filterpars->Pvowels[1].formants[1].freq = 71; - filterpars->Pvowels[1].formants[1].amp = 121; - filterpars->Pvowels[1].formants[1].q = 64; - filterpars->Pvowels[1].formants[2].freq = 99; - filterpars->Pvowels[1].formants[2].amp = 117; - filterpars->Pvowels[1].formants[2].q = 64; - break; - case 4: - filterpars->Pcategory = 1; - filterpars->Ptype = 0; - filterpars->Pfreq = 64; - filterpars->Pq = 70; - filterpars->Pstages = 1; - filterpars->Pgain = 64; - - filterpars->Psequencesize = 2; - filterpars->Pnumformants = 2; - filterpars->Pvowelclearness = 0; - - filterpars->Pvowels[0].formants[0].freq = 70; - filterpars->Pvowels[0].formants[0].amp = 127; - filterpars->Pvowels[0].formants[0].q = 64; - filterpars->Pvowels[0].formants[1].freq = 80; - filterpars->Pvowels[0].formants[1].amp = 122; - filterpars->Pvowels[0].formants[1].q = 64; - - filterpars->Pvowels[1].formants[0].freq = 20; - filterpars->Pvowels[1].formants[0].amp = 127; - filterpars->Pvowels[1].formants[0].q = 64; - filterpars->Pvowels[1].formants[1].freq = 100; - filterpars->Pvowels[1].formants[1].amp = 121; - filterpars->Pvowels[1].formants[1].q = 64; - break; - } - -// for (int i=0;i<5;i++){ -// printf("freq=%d amp=%d q=%d\n",filterpars->Pvowels[0].formants[i].freq,filterpars->Pvowels[0].formants[i].amp,filterpars->Pvowels[0].formants[i].q); -// }; - if(insertion == 0) - changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect - Ppreset = npreset; - - reinitfilter(); -} - - -void DynamicFilter::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setampsns(value); - break; - case 8: - Pampsnsinv = value; - setampsns(Pampsns); - break; - case 9: - Pampsmooth = value; - setampsns(Pampsns); - break; - } -} - -unsigned char DynamicFilter::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - case 1: - return Ppanning; - break; - case 2: - return lfo.Pfreq; - break; - case 3: - return lfo.Prandomness; - break; - case 4: - return lfo.PLFOtype; - break; - case 5: - return lfo.Pstereo; - break; - case 6: - return Pdepth; - break; - case 7: - return Pampsns; - break; - case 8: - return Pampsnsinv; - break; - case 9: - return Pampsmooth; - break; - default: - return 0; - } -} - diff --git a/plugins/zynaddsubfx/src/Effects/DynamicFilter.h b/plugins/zynaddsubfx/src/Effects/DynamicFilter.h deleted file mode 100644 index 6ce10f5ee..000000000 --- a/plugins/zynaddsubfx/src/Effects/DynamicFilter.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - DynamicFilter.h - "WahWah" effect and others - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef DYNAMICFILTER_H -#define DYNAMICFILTER_H -#include "../globals.h" -#include "Effect.h" -#include "EffectLFO.h" - -#include "../DSP/Filter.h" -/**DynamicFilter Effect*/ -class DynamicFilter:public Effect -{ - public: - DynamicFilter(int insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_); - ~DynamicFilter(); - void out(const Stereo &smp); - - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(); - -// void setdryonly(); - - private: - //Parametrii DynamicFilter - EffectLFO lfo; //lfo-ul DynamicFilter - unsigned char Pvolume; - unsigned char Ppanning; - unsigned char Pdepth; /** -#include "EQ.h" - -EQ::EQ(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0) -{ - for(int i = 0; i < MAX_EQ_BANDS; i++) { - filter[i].Ptype = 0; - filter[i].Pfreq = 64; - filter[i].Pgain = 64; - filter[i].Pq = 64; - filter[i].Pstages = 0; - filter[i].l = new AnalogFilter(6, 1000.0, 1.0, 0); - filter[i].r = new AnalogFilter(6, 1000.0, 1.0, 0); - } - //default values - Pvolume = 50; - - setpreset(Ppreset); - cleanup(); -} - -EQ::~EQ() -{} - -void EQ::cleanup() -{ - for(int i = 0; i < MAX_EQ_BANDS; i++) { - filter[i].l->cleanup(); - filter[i].r->cleanup(); - } -} - -void EQ::out(const Stereo &smp) -{ - int i; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] = smp.l[i] * volume; - efxoutr[i] = smp.r[i] * volume; - } - - for(i = 0; i < MAX_EQ_BANDS; i++) { - if(filter[i].Ptype == 0) - continue; - filter[i].l->filterout(efxoutl); - filter[i].r->filterout(efxoutr); - } -} - - -/* - * Parameter control - */ -void EQ::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - - outvolume = pow(0.005, (1.0 - Pvolume / 127.0)) * 10.0; - if(insertion == 0) - volume = 1.0; - else - volume = outvolume; - ; -} - - -void EQ::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 1; - const int NUM_PRESETS = 2; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //EQ 1 - {67}, - //EQ 2 - {67} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - Ppreset = npreset; -} - - -void EQ::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - } - if(npar < 10) - return; - - int nb = (npar - 10) / 5; //number of the band (filter) - if(nb >= MAX_EQ_BANDS) - return; - int bp = npar % 5; //band paramenter - - REALTYPE tmp; - switch(bp) { - case 0: - filter[nb].Ptype = value; - if(value > 9) - filter[nb].Ptype = 0; //has to be changed if more filters will be added - if(filter[nb].Ptype != 0) { - filter[nb].l->settype(value - 1); - filter[nb].r->settype(value - 1); - } - break; - case 1: - filter[nb].Pfreq = value; - tmp = 600.0 * pow(30.0, (value - 64.0) / 64.0); - filter[nb].l->setfreq(tmp); - filter[nb].r->setfreq(tmp); - break; - case 2: - filter[nb].Pgain = value; - tmp = 30.0 * (value - 64.0) / 64.0; - filter[nb].l->setgain(tmp); - filter[nb].r->setgain(tmp); - break; - case 3: - filter[nb].Pq = value; - tmp = pow(30.0, (value - 64.0) / 64.0); - filter[nb].l->setq(tmp); - filter[nb].r->setq(tmp); - break; - case 4: - filter[nb].Pstages = value; - if(value >= MAX_FILTER_STAGES) - filter[nb].Pstages = MAX_FILTER_STAGES - 1; - filter[nb].l->setstages(value); - filter[nb].r->setstages(value); - break; - } -} - -unsigned char EQ::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - } - - if(npar < 10) - return 0; - - int nb = (npar - 10) / 5; //number of the band (filter) - if(nb >= MAX_EQ_BANDS) - return 0; - int bp = npar % 5; //band paramenter - switch(bp) { - case 0: - return filter[nb].Ptype; - break; - case 1: - return filter[nb].Pfreq; - break; - case 2: - return filter[nb].Pgain; - break; - case 3: - return filter[nb].Pq; - break; - case 4: - return filter[nb].Pstages; - break; - } - - return 0; //in case of bogus parameter number -} - - - - -REALTYPE EQ::getfreqresponse(REALTYPE freq) -{ - REALTYPE resp = 1.0; - - for(int i = 0; i < MAX_EQ_BANDS; i++) { - if(filter[i].Ptype == 0) - continue; - resp *= filter[i].l->H(freq); - } - return rap2dB(resp * outvolume); -} - diff --git a/plugins/zynaddsubfx/src/Effects/EQ.h b/plugins/zynaddsubfx/src/Effects/EQ.h deleted file mode 100644 index 7ac328404..000000000 --- a/plugins/zynaddsubfx/src/Effects/EQ.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EQ.h - EQ Effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef EQ_H -#define EQ_H - -#include "../globals.h" -#include "../DSP/AnalogFilter.h" -#include "Effect.h" - -/**EQ Effect*/ -class EQ:public Effect -{ - public: - EQ(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_); - ~EQ(); - void out(const Stereo &smp); - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(); - REALTYPE getfreqresponse(REALTYPE freq); - private: - //Parameters - unsigned char Pvolume; /** -#include "Echo.h" - -#define MAX_DELAY 2 - -Echo::Echo(const int &insertion_, - REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), - samplerate(SAMPLE_RATE), - Pvolume(50), Ppanning(64), Pdelay(60), - Plrdelay(100), Plrcross(100), Pfb(40), Phidamp(60), - delayTime(1), lrdelay(0), avgDelay(0), - delay(new REALTYPE[(int)(MAX_DELAY * samplerate)], - new REALTYPE[(int)(MAX_DELAY * samplerate)]), - old(0.0), pos(0), delta(1), ndelta(1) -{ - initdelays(); - setpreset(Ppreset); -} - -Echo::~Echo() -{ - delete[] delay.l; - delete[] delay.r; -} - -/* - * Cleanup the effect - */ -void Echo::cleanup() -{ - memset(delay.l,0,MAX_DELAY*samplerate*sizeof(REALTYPE)); - memset(delay.r,0,MAX_DELAY*samplerate*sizeof(REALTYPE)); - old = Stereo(0.0); -} - -inline int max(int a, int b) -{ - return a > b ? a : b; -} - -/* - * Initialize the delays - */ -void Echo::initdelays() -{ - cleanup(); - //number of seconds to delay left chan - float dl = avgDelay - lrdelay; - - //number of seconds to delay right chan - float dr = avgDelay + lrdelay; - - ndelta.l = max(1,(int) (dl * samplerate)); - ndelta.r = max(1,(int) (dr * samplerate)); -} - -void Echo::out(const Stereo &input) -{ - REALTYPE ldl, rdl; - - for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { - ldl = delay.l[pos.l]; - rdl = delay.r[pos.r]; - ldl = ldl * (1.0 - lrcross) + rdl * lrcross; - rdl = rdl * (1.0 - lrcross) + ldl * lrcross; - - efxoutl[i] = ldl * 2.0; - efxoutr[i] = rdl * 2.0; - - ldl = input.l[i] * panning - ldl * fb; - rdl = input.r[i] * (1.0 - panning) - rdl * fb; - - //LowPass Filter - old.l = delay.l[(pos.l+delta.l)%(MAX_DELAY * samplerate)] = ldl * hidamp + old.l * (1.0 - hidamp); - old.r = delay.r[(pos.r+delta.r)%(MAX_DELAY * samplerate)] = rdl * hidamp + old.r * (1.0 - hidamp); - - //increment - ++pos.l;// += delta.l; - ++pos.r;// += delta.r; - - //ensure that pos is still in bounds - pos.l %= MAX_DELAY * samplerate; - pos.r %= MAX_DELAY * samplerate; - - //adjust delay if needed - delta.l = (15*delta.l + ndelta.l)/16; - delta.r = (15*delta.r + ndelta.r)/16; - } -} - - -/* - * Parameter control - */ -void Echo::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - - if(insertion == 0) { - outvolume = pow(0.01, (1.0 - Pvolume / 127.0)) * 4.0; - volume = 1.0; - } - else - volume = outvolume = Pvolume / 127.0; - ; - if(Pvolume == 0) - cleanup(); -} - -void Echo::setpanning(unsigned char Ppanning) -{ - this->Ppanning = Ppanning; - panning = (Ppanning + 0.5) / 127.0; -} - -void Echo::setdelay(unsigned char Pdelay) -{ - this->Pdelay=Pdelay; - avgDelay=(Pdelay/127.0*1.5);//0 .. 1.5 sec - initdelays(); -} - -void Echo::setlrdelay(unsigned char Plrdelay) -{ - REALTYPE tmp; - this->Plrdelay = Plrdelay; - tmp = - (pow(2, fabs(Plrdelay - 64.0) / 64.0 * 9) - 1.0) / 1000.0; - if(Plrdelay < 64.0) - tmp = -tmp; - lrdelay = tmp; - initdelays(); -} - -void Echo::setlrcross(unsigned char Plrcross) -{ - this->Plrcross = Plrcross; - lrcross = Plrcross / 127.0 * 1.0; -} - -void Echo::setfb(unsigned char Pfb) -{ - this->Pfb = Pfb; - fb = Pfb / 128.0; -} - -void Echo::sethidamp(unsigned char Phidamp) -{ - this->Phidamp = Phidamp; - hidamp = 1.0 - Phidamp / 127.0; -} - -void Echo::setpreset(unsigned char npreset) -{ - /**\todo see if the preset array can be replaced with a struct or a class*/ - const int PRESET_SIZE = 7; - const int NUM_PRESETS = 9; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Echo 1 - {67, 64, 35, 64, 30, 59, 0 }, - //Echo 2 - {67, 64, 21, 64, 30, 59, 0 }, - //Echo 3 - {67, 75, 60, 64, 30, 59, 10 }, - //Simple Echo - {67, 60, 44, 64, 30, 0, 0 }, - //Canyon - {67, 60, 102, 50, 30, 82, 48 }, - //Panning Echo 1 - {67, 64, 44, 17, 0, 82, 24 }, - //Panning Echo 2 - {81, 60, 46, 118, 100, 68, 18 }, - //Panning Echo 3 - {81, 60, 26, 100, 127, 67, 36 }, - //Feedback Echo - {62, 64, 28, 64, 100, 90, 55 } - }; - - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - if(insertion) - setvolume(presets[npreset][0] / 2); //lower the volume if this is insertion effect - Ppreset = npreset; -} - - -void Echo::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - setdelay(value); - break; - case 3: - setlrdelay(value); - break; - case 4: - setlrcross(value); - break; - case 5: - setfb(value); - break; - case 6: - sethidamp(value); - break; - } -} - -unsigned char Echo::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - case 1: - return Ppanning; - break; - case 2: - return Pdelay; - break; - case 3: - return Plrdelay; - break; - case 4: - return Plrcross; - break; - case 5: - return Pfb; - break; - case 6: - return Phidamp; - break; - } - return 0; // in case of bogus parameter number -} - diff --git a/plugins/zynaddsubfx/src/Effects/Echo.h b/plugins/zynaddsubfx/src/Effects/Echo.h deleted file mode 100644 index 3701c5c8f..000000000 --- a/plugins/zynaddsubfx/src/Effects/Echo.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Echo.h - Echo Effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ECHO_H -#define ECHO_H - -#include "../globals.h" -#include "Effect.h" -#include "../Misc/Stereo.h" -#include "../Samples/Sample.h" - -/**Echo Effect*/ -class Echo:public Effect -{ - public: - - /** - * The Constructor For Echo - * @param insertion_ integer to determine if Echo is an insertion effect - * or not - * @param efxoutl_ Effect out Left Channel - * @param efxoutr_ Effect out Right Channel - * @return An initialized Echo Object - */ - Echo(const int &insertion_, - REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_); - - /** - * The destructor - */ - ~Echo(); - - void out(const Stereo &input); - - /** - * Sets the state of Echo to the specified preset - * @param npreset number of chosen preset - */ - void setpreset(unsigned char npreset); - - /** - * Sets the value of the chosen variable - * - * The possible parameters are: - * -# Volume - * -# Panning - * -# Delay - * -# L/R Delay - * -# L/R Crossover - * -# Feedback - * -# Dampening - * @param npar number of chosen parameter - * @param value the new value - */ - void changepar(int npar, unsigned char value); - - /** - * Gets the specified parameter - * - * The possible parameters are - * -# Volume - * -# Panning - * -# Delay - * -# L/R Delay - * -# L/R Crossover - * -# Feedback - * -# Dampening - * @param npar number of chosen parameter - * @return value of parameter - */ - unsigned char getpar(int npar) const; - - int getnumparams(); - - /**Zeros out the state of the Echo*/ - void cleanup(); - - /**\todo This function needs to be implemented or the prototype should be removed*/ - void setdryonly(); - private: - int samplerate; - - //Parameters - char Pvolume; /**<#1 Volume or Dry/Wetness*/ - char Ppanning; /**<#2 Panning*/ - char Pdelay; /**<#3 Delay of the Echo*/ - char Plrdelay; /**<#4 L/R delay difference*/ - char Plrcross; /**<#5 L/R Mixing*/ - char Pfb; /**<#6Feedback*/ - char Phidamp; /**<#7Dampening of the Echo*/ - - void setvolume(unsigned char Pvolume); - void setpanning(unsigned char Ppanning); - void setdelay(unsigned char Pdelay); - void setlrdelay(unsigned char Plrdelay); - void setlrcross(unsigned char Plrcross); - void setfb(unsigned char Pfb); - void sethidamp(unsigned char Phidamp); - - //Real Parameters - REALTYPE panning, lrcross, fb, hidamp; - //Left/Right delay lengths - Stereo delayTime; - REALTYPE lrdelay; - REALTYPE avgDelay; - - void initdelays(); - //2 channel ring buffer - Stereo delay; - Stereo old; - - //position of reading/writing from delaysample - Stereo pos; - //step size for delay buffer - Stereo delta; - Stereo ndelta; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/Effect.cpp b/plugins/zynaddsubfx/src/Effects/Effect.cpp deleted file mode 100644 index ab44312ed..000000000 --- a/plugins/zynaddsubfx/src/Effects/Effect.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Effect.cpp - this class is inherited by the all effects(Reverb, Echo, ..) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Effect.h" - -Effect::Effect(bool insertion_, REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_, FilterParams *filterpars_, - const unsigned char &Ppreset_) - :Ppreset(Ppreset_), efxoutl(efxoutl_), efxoutr(efxoutr_), - filterpars(filterpars_), insertion(insertion_) -{} - -void Effect::out(REALTYPE *const smpsl, REALTYPE *const smpsr) -{ - out(Stereo(smpsl,smpsr)); -}; - diff --git a/plugins/zynaddsubfx/src/Effects/Effect.h b/plugins/zynaddsubfx/src/Effects/Effect.h deleted file mode 100644 index eddbbba5c..000000000 --- a/plugins/zynaddsubfx/src/Effects/Effect.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Effect.h - this class is inherited by the all effects(Reverb, Echo, ..) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef EFFECT_H -#define EFFECT_H - -#include "../Misc/Util.h" -#include "../globals.h" -#include "../Params/FilterParams.h" -#include "../Misc/Stereo.h" - - -/**this class is inherited by the all effects(Reverb, Echo, ..)*/ -class Effect -{ - public: - /** - * Effect Constructor - * @param insertion_ 1 when it is an insertion Effect and 0 when it - * is not an insertion Effect - * @param efxoutl_ Effect output buffer Left channel - * @param efxoutr_ Effect output buffer Right channel - * @param filterpars_ pointer to FilterParams array - * @param Ppreset_ chosen preset - * @return Initialized Effect object*/ - Effect(bool insertion_, REALTYPE *const efxoutl_, - REALTYPE *const efxoutr_, FilterParams *filterpars_, - const unsigned char &Ppreset_); - /**Deconstructor - * - * Deconstructs the Effect and releases any resouces that it has - * allocated for itself*/ - virtual ~Effect() {} - /** - * Choose a preset - * @param npreset number of chosen preset*/ - virtual void setpreset(unsigned char npreset) = 0; - /**Change parameter npar to value - * @param npar chosen parameter - * @param value chosen new value*/ - virtual void changepar(int npar, unsigned char value) = 0; - /**Get the value of parameter npar - * @param npar chosen parameter - * @return the value of the parameter in an unsigned char or 0 if it - * does not exist*/ - virtual unsigned char getpar(int npar) const = 0; - /**Output result of effect based on the given buffers - * - * This method should result in the effect generating its results - * and placing them into the efxoutl and efxoutr buffers. - * Every Effect should overide this method. - * - * @param smpsl Input buffer for the Left channel - * @param smpsr Input buffer for the Right channel - */ - void out(REALTYPE *const smpsl, REALTYPE *const smpsr); - virtual void out(const Stereo &smp) = 0; - /**Reset the state of the effect*/ - virtual void cleanup() {} - /**This is only used for EQ (for user interface)*/ - virtual REALTYPE getfreqresponse(REALTYPE freq) { - return freq; - } - - unsigned char Ppreset; /***/ - - REALTYPE outvolume;/** -#include - -#include "EffectLFO.h" - - -EffectLFO::EffectLFO() -{ - xl = 0.0; - xr = 0.0; - Pfreq = 40; - Prandomness = 0; - PLFOtype = 0; - Pstereo = 96; - - updateparams(); - - ampl1 = (1 - lfornd) + lfornd * RND; - ampl2 = (1 - lfornd) + lfornd * RND; - ampr1 = (1 - lfornd) + lfornd * RND; - ampr2 = (1 - lfornd) + lfornd * RND; -} - -EffectLFO::~EffectLFO() -{} - - -/* - * Update the changed parameters - */ -void EffectLFO::updateparams() -{ - REALTYPE lfofreq = (pow(2, Pfreq / 127.0 * 10.0) - 1.0) * 0.03; - incx = fabs(lfofreq) * (REALTYPE)SOUND_BUFFER_SIZE / (REALTYPE)SAMPLE_RATE; - if(incx > 0.49999999) - incx = 0.499999999; //Limit the Frequency - - lfornd = Prandomness / 127.0; - if(lfornd < 0.0) - lfornd = 0.0; - else - if(lfornd > 1.0) - lfornd = 1.0; - - if(PLFOtype > 1) - PLFOtype = 1; //this has to be updated if more lfo's are added - lfotype = PLFOtype; - - xr = fmod(xl + (Pstereo - 64.0) / 127.0 + 1.0, 1.0); -} - - -/* - * Compute the shape of the LFO - */ -REALTYPE EffectLFO::getlfoshape(REALTYPE x) -{ - REALTYPE out; - switch(lfotype) { - case 1: //EffectLFO_TRIANGLE - if((x > 0.0) && (x < 0.25)) - out = 4.0 * x; - else - if((x > 0.25) && (x < 0.75)) - out = 2 - 4 * x; - else - out = 4.0 * x - 4.0; - break; - /**\todo more to be added here; also ::updateparams() need to be updated (to allow more lfotypes)*/ - default: - out = cos(x * 2 * PI); //EffectLFO_SINE - } - return out; -} - -/* - * LFO output - */ -void EffectLFO::effectlfoout(REALTYPE *outl, REALTYPE *outr) -{ - REALTYPE out; - - out = getlfoshape(xl); - if((lfotype == 0) || (lfotype == 1)) - out *= (ampl1 + xl * (ampl2 - ampl1)); - xl += incx; - if(xl > 1.0) { - xl -= 1.0; - ampl1 = ampl2; - ampl2 = (1.0 - lfornd) + lfornd * RND; - } - *outl = (out + 1.0) * 0.5; - - out = getlfoshape(xr); - if((lfotype == 0) || (lfotype == 1)) - out *= (ampr1 + xr * (ampr2 - ampr1)); - xr += incx; - if(xr > 1.0) { - xr -= 1.0; - ampr1 = ampr2; - ampr2 = (1.0 - lfornd) + lfornd * RND; - } - *outr = (out + 1.0) * 0.5; -} - diff --git a/plugins/zynaddsubfx/src/Effects/EffectLFO.h b/plugins/zynaddsubfx/src/Effects/EffectLFO.h deleted file mode 100644 index cd54463a9..000000000 --- a/plugins/zynaddsubfx/src/Effects/EffectLFO.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EffectLFO.h - Stereo LFO used by some effects - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef EFFECT_LFO_H -#define EFFECT_LFO_H - -#include "../globals.h" -/**LFO for some of the Effect objects - * \todo see if this should inherit LFO*/ -class EffectLFO -{ - public: - EffectLFO(); - ~EffectLFO(); - void effectlfoout(REALTYPE *outl, REALTYPE *outr); - void updateparams(); - unsigned char Pfreq; - unsigned char Prandomness; - unsigned char PLFOtype; - unsigned char Pstereo; //"64"=0 - private: - REALTYPE getlfoshape(REALTYPE x); - - REALTYPE xl, xr; - REALTYPE incx; - REALTYPE ampl1, ampl2, ampr1, ampr2; //necessary for "randomness" - REALTYPE lfornd; - char lfotype; /**\todo GET RID OF CHAR (replace with short or enum)*/ -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/EffectMgr.cpp b/plugins/zynaddsubfx/src/Effects/EffectMgr.cpp deleted file mode 100644 index eea0e3236..000000000 --- a/plugins/zynaddsubfx/src/Effects/EffectMgr.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EffectMgr.cpp - Effect manager, an interface betwen the program and effects - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "EffectMgr.h" -#include -using namespace std; - -EffectMgr::EffectMgr(int insertion_, pthread_mutex_t *mutex_) - :insertion(insertion_), - efxoutl(new REALTYPE[SOUND_BUFFER_SIZE]), - efxoutr(new REALTYPE[SOUND_BUFFER_SIZE]), - filterpars(NULL), nefx(0), efx(NULL), mutex(mutex_), dryonly(false) -{ - setpresettype("Peffect"); /**\todo Figure out what this is doing - * , as it might be another leaky abstraction.*/ -// efx=NULL; -// nefx=0; -// insertion=insertion_; -// mutex=mutex_; -// efxoutl=new REALTYPE[SOUND_BUFFER_SIZE]; -// efxoutr=new REALTYPE[SOUND_BUFFER_SIZE]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] = 0.0; - efxoutr[i] = 0.0; - } -// filterpars=NULL; -// dryonly=false; - defaults(); -} - - -EffectMgr::~EffectMgr() -{ - if(efx != NULL) - delete efx; - delete [] efxoutl; - delete [] efxoutr; -} - -void EffectMgr::defaults() -{ - changeeffect(0); - setdryonly(false); -} - -/* - * Change the effect - */ -void EffectMgr::changeeffect(int nefx_) -{ - cleanup(); - if(nefx == nefx_) - return; - nefx = nefx_; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] = 0.0; - efxoutr[i] = 0.0; - } - - if(efx != NULL) - delete efx; - switch(nefx) { /**\todo replace leaky abstraction*/ - case 1: - efx = new Reverb(insertion, efxoutl, efxoutr); - break; - case 2: - efx = new Echo(insertion, efxoutl, efxoutr); - break; - case 3: - efx = new Chorus(insertion, efxoutl, efxoutr); - break; - case 4: - efx = new Phaser(insertion, efxoutl, efxoutr); - break; - case 5: - efx = new Alienwah(insertion, efxoutl, efxoutr); - break; - case 6: - efx = new Distorsion(insertion, efxoutl, efxoutr); - break; - case 7: - efx = new EQ(insertion, efxoutl, efxoutr); - break; - case 8: - efx = new DynamicFilter(insertion, efxoutl, efxoutr); - break; - //put more effect here - default: - efx = NULL; - break; //no effect (thru) - } - - if(efx != NULL) - filterpars = efx->filterpars; -} - -/* - * Obtain the effect number - */ -int EffectMgr::geteffect() -{ - return nefx; -} - -/* - * Cleanup the current effect - */ -void EffectMgr::cleanup() -{ - if(efx != NULL) - efx->cleanup(); -} - - -/* - * Get the preset of the current effect - */ - -unsigned char EffectMgr::getpreset() -{ - if(efx != NULL) - return efx->Ppreset; - else - return 0; -} - -/* - * Change the preset of the current effect - */ -void EffectMgr::changepreset_nolock(unsigned char npreset) -{ - if(efx != NULL) - efx->setpreset(npreset); -} - -/* - * Change the preset of the current effect(with thread locking) - */ -void EffectMgr::changepreset(unsigned char npreset) -{ - pthread_mutex_lock(mutex); - changepreset_nolock(npreset); - pthread_mutex_unlock(mutex); -} - - -/* - * Change a parameter of the current effect - */ -void EffectMgr::seteffectpar_nolock(int npar, unsigned char value) -{ - if(efx == NULL) - return; - efx->changepar(npar, value); -} - -/* - * Change a parameter of the current effect (with thread locking) - */ -void EffectMgr::seteffectpar(int npar, unsigned char value) -{ - pthread_mutex_lock(mutex); - seteffectpar_nolock(npar, value); - pthread_mutex_unlock(mutex); -} - -/* - * Get a parameter of the current effect - */ -unsigned char EffectMgr::geteffectpar(int npar) -{ - if(efx == NULL) - return 0; - return efx->getpar(npar); -} - - -/* - * Apply the effect - */ -void EffectMgr::out(REALTYPE *smpsl, REALTYPE *smpsr) -{ - int i; - if(efx == NULL) { - if(insertion == 0) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - smpsl[i] = 0.0; - smpsr[i] = 0.0; - efxoutl[i] = 0.0; - efxoutr[i] = 0.0; - } - ; - return; - } - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - smpsl[i] += denormalkillbuf[i]; - smpsr[i] += denormalkillbuf[i]; - efxoutl[i] = 0.0; - efxoutr[i] = 0.0; - } - efx->out(smpsl, smpsr); - - REALTYPE volume = efx->volume; - - if(nefx == 7) { //this is need only for the EQ effect - /**\todo figure out why*/ - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - smpsl[i] = efxoutl[i]; - smpsr[i] = efxoutr[i]; - } - return; - } - - //Insertion effect - if(insertion != 0) { - REALTYPE v1, v2; - if(volume < 0.5) { - v1 = 1.0; - v2 = volume * 2.0; - } - else { - v1 = (1.0 - volume) * 2.0; - v2 = 1.0; - } - if((nefx == 1) || (nefx == 2)) - v2 *= v2; //for Reverb and Echo, the wet function is not liniar - - if(dryonly) { //this is used for instrument effect only - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - smpsl[i] *= v1; - smpsr[i] *= v1; - efxoutl[i] *= v2; - efxoutr[i] *= v2; - } - } - else { //normal instrument/insertion effect - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - smpsl[i] = smpsl[i] * v1 + efxoutl[i] * v2; - smpsr[i] = smpsr[i] * v1 + efxoutr[i] * v2; - } - } - } - else { //System effect - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] *= 2.0 * volume; - efxoutr[i] *= 2.0 * volume; - smpsl[i] = efxoutl[i]; - smpsr[i] = efxoutr[i]; - } - } -} - -/* - * Get the effect volume for the system effect - */ -REALTYPE EffectMgr::sysefxgetvolume() -{ - if(efx == NULL) - return 1.0; - else - return efx->outvolume; -} - - -/* - * Get the EQ response - */ -REALTYPE EffectMgr::getEQfreqresponse(REALTYPE freq) -{ - if(nefx == 7) - return efx->getfreqresponse(freq); - else - return 0.0; -} - - -void EffectMgr::setdryonly(bool value) -{ - dryonly = value; -} - -void EffectMgr::add2XML(XMLwrapper *xml) -{ - xml->addpar("type", geteffect()); - - if((efx == NULL) || (geteffect() == 0)) - return; - xml->addpar("preset", efx->Ppreset); - - xml->beginbranch("EFFECT_PARAMETERS"); - for(int n = 0; n < 128; n++) { - /**\todo evaluate who should oversee saving - * and loading of parameters*/ - int par = geteffectpar(n); - if(par == 0) - continue; - xml->beginbranch("par_no", n); - xml->addpar("par", par); - xml->endbranch(); - } - if(filterpars != NULL) { - xml->beginbranch("FILTER"); - filterpars->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); -} - -void EffectMgr::getfromXML(XMLwrapper *xml) -{ - changeeffect(xml->getpar127("type", geteffect())); - - if((efx == NULL) || (geteffect() == 0)) - return; - - efx->Ppreset = xml->getpar127("preset", efx->Ppreset); - - if(xml->enterbranch("EFFECT_PARAMETERS")) { - for(int n = 0; n < 128; n++) { - seteffectpar_nolock(n, 0); //erase effect parameter - if(xml->enterbranch("par_no", n) == 0) - continue; - - int par = geteffectpar(n); - seteffectpar_nolock(n, xml->getpar127("par", par)); - xml->exitbranch(); - } - if(filterpars != NULL) { - if(xml->enterbranch("FILTER")) { - filterpars->getfromXML(xml); - xml->exitbranch(); - } - } - xml->exitbranch(); - } - cleanup(); -} - diff --git a/plugins/zynaddsubfx/src/Effects/EffectMgr.h b/plugins/zynaddsubfx/src/Effects/EffectMgr.h deleted file mode 100644 index 29d6a7a71..000000000 --- a/plugins/zynaddsubfx/src/Effects/EffectMgr.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EffectMgr.h - Effect manager, an interface betwen the program and effects - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef EFFECTMGR_H -#define EFFECTMGR_H - -#include - -#include "Effect.h" -#include "Reverb.h" -#include "Echo.h" -#include "Chorus.h" -#include "Phaser.h" -#include "Alienwah.h" -#include "Distorsion.h" -#include "EQ.h" -#include "DynamicFilter.h" -#include "../Misc/XMLwrapper.h" -#include "../Params/FilterParams.h" -#include "../Params/Presets.h" - -/**Effect manager, an interface betwen the program and effects*/ -class EffectMgr:public Presets -{ - public: - EffectMgr(int insertion_, pthread_mutex_t *mutex_); - ~EffectMgr(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - void out(REALTYPE *smpsl, REALTYPE *smpsr); - - void setdryonly(bool value); - - /**get the output(to speakers) volume of the systemeffect*/ - REALTYPE sysefxgetvolume(); - - void cleanup(); /** -#include -#include "Phaser.h" - -using namespace std; - -#define PHASER_LFO_SHAPE 2 -#define ONE_ 0.99999f // To prevent LFO ever reaching 1.0 for filter stability purposes -#define ZERO_ 0.00001f // Same idea as above. - -Phaser::Phaser(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), old(NULL), xn1(NULL), yn1(NULL), diff(0.0), oldgain(0.0), - fb(0.0) -{ - analog_setup(); - setpreset(Ppreset); - cleanup(); -} - -void Phaser::analog_setup() -{ - //model mismatch between JFET devices - offset[0] = -0.2509303f; - offset[1] = 0.9408924f; - offset[2] = 0.998f; - offset[3] = -0.3486182f; - offset[4] = -0.2762545f; - offset[5] = -0.5215785f; - offset[6] = 0.2509303f; - offset[7] = -0.9408924f; - offset[8] = -0.998f; - offset[9] = 0.3486182f; - offset[10] = 0.2762545f; - offset[11] = 0.5215785f; - - barber = 0; //Deactivate barber pole phasing by default - - mis = 1.0f; - Rmin = 625.0f;// 2N5457 typical on resistance at Vgs = 0 - Rmax = 22000.0f;// Resistor parallel to FET - Rmx = Rmin/Rmax; - Rconst = 1.0f + Rmx; // Handle parallel resistor relationship - C = 0.00000005f; // 50 nF - CFs = (float) 2.0f*(float)SAMPLE_RATE*C; - invperiod = 1.0f / ((float) SOUND_BUFFER_SIZE); -} - -Phaser::~Phaser() -{ - if(xn1.l) - delete[] xn1.l; - if(yn1.l) - delete[] yn1.l; - if(xn1.r) - delete[] xn1.r; - if(yn1.r) - delete[] yn1.r; -} - -/* - * Effect output - */ -void Phaser::out(const Stereo &input) -{ - if(Panalog) - AnalogPhase(input); - else - normalPhase(input); -} - -void Phaser::AnalogPhase(const Stereo &input) -{ - Stereo gain(0.0), lfoVal(0.0), mod(0.0), g(0.0), b(0.0), hpf(0.0); - - lfo.effectlfoout(&lfoVal.l, &lfoVal.r); - mod.l = lfoVal.l*width + (depth - 0.5f); - mod.r = lfoVal.r*width + (depth - 0.5f); - - mod.l = limit(mod.l, ZERO_, ONE_); - mod.r = limit(mod.r, ZERO_, ONE_); - - if(Phyper) { - //Triangle wave squared is approximately sin on bottom, tri on top - //Result is exponential sweep more akin to filter in synth with - //exponential generator circuitry. - mod.l *= mod.l; - mod.r *= mod.r; - } - - //g.l,g.r is Vp - Vgs. Typical FET drain-source resistance follows constant/[1-sqrt(Vp - Vgs)] - mod.l = sqrtf(1.0f - mod.l); - mod.r = sqrtf(1.0f - mod.r); - - diff.r = (mod.r - oldgain.r) * invperiod; - diff.l = (mod.l - oldgain.l) * invperiod; - - g = oldgain; - oldgain = mod; - - for (int i = 0; i < SOUND_BUFFER_SIZE; i++) { - g.l += diff.l;// Linear interpolation between LFO samples - g.r += diff.r; - - Stereo xn(input.l[i] * panning, - input.r[i] * (1.0f - panning)); - - if (barber) { - g.l = fmodf((g.l + 0.25f), ONE_); - g.r = fmodf((g.r + 0.25f), ONE_); - } - - xn.l = applyPhase(xn.l, g.l, fb.l, hpf.l, yn1.l, xn1.l); - xn.r = applyPhase(xn.r, g.r, fb.r, hpf.r, yn1.r, xn1.r); - - - fb.l = xn.l * feedback; - fb.r = xn.r * feedback; - efxoutl[i] = xn.l; - efxoutr[i] = xn.r; - } - - if(Poutsub) { - invSignal(efxoutl, SOUND_BUFFER_SIZE); - invSignal(efxoutr, SOUND_BUFFER_SIZE); - } -} - -REALTYPE Phaser::applyPhase(REALTYPE x, REALTYPE g, REALTYPE fb, - REALTYPE &hpf, REALTYPE *yn1, REALTYPE *xn1) -{ - for(int j = 0; j < Pstages; j++) { //Phasing routine - mis = 1.0f + offsetpct*offset[j]; - - //This is symmetrical. - //FET is not, so this deviates slightly, however sym dist. is - //better sounding than a real FET. - float d = (1.0f + 2.0f*(0.25f + g)*hpf*hpf*distortion) * mis; - Rconst = 1.0f + mis*Rmx; - - // This is 1/R. R is being modulated to control filter fc. - float b = (Rconst - g)/ (d*Rmin); - float gain = (CFs - b)/(CFs + b); - yn1[j] = gain * (x + yn1[j]) - xn1[j]; - - //high pass filter: - //Distortion depends on the high-pass part of the AP stage. - hpf = yn1[j] + (1.0f-gain)*xn1[j]; - - xn1[j] = x; - x = yn1[j]; - if (j==1) - x += fb; //Insert feedback after first phase stage - } - return x; -} -void Phaser::normalPhase(const Stereo &input) -{ - Stereo gain(0.0), lfoVal(0.0); - - lfo.effectlfoout(&lfoVal.l, &lfoVal.r); - gain.l = (exp(lfoVal.l * PHASER_LFO_SHAPE) - 1) / (exp(PHASER_LFO_SHAPE) - 1.0); - gain.r = (exp(lfoVal.r * PHASER_LFO_SHAPE) - 1) / (exp(PHASER_LFO_SHAPE) - 1.0); - - gain.l = 1.0 - phase * (1.0 - depth) - (1.0 - phase) * gain.l * depth; - gain.r = 1.0 - phase * (1.0 - depth) - (1.0 - phase) * gain.r * depth; - - gain.l = limit(gain.l, ZERO_, ONE_); - gain.r = limit(gain.r, ZERO_, ONE_); - - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE x = (REALTYPE) i / SOUND_BUFFER_SIZE; - REALTYPE x1 = 1.0 - x; - //TODO think about making panning an external feature - Stereo xn(input.l[i] * panning + fb.l, - input.r[i] * (1.0 - panning) + fb.r); - - Stereo g(gain.l * x + oldgain.l * x1, - gain.r * x + oldgain.r * x1); - - xn.l = applyPhase(xn.l, g.l, old.l); - xn.r = applyPhase(xn.r, g.r, old.r); - - //Left/Right crossing - crossover(xn.l, xn.r, lrcross); - - fb.l = xn.l * feedback; - fb.r = xn.r * feedback; - efxoutl[i] = xn.l; - efxoutr[i] = xn.r; - } - - oldgain = gain; - - if(Poutsub) { - invSignal(efxoutl, SOUND_BUFFER_SIZE); - invSignal(efxoutr, SOUND_BUFFER_SIZE); - } -} - -REALTYPE Phaser::applyPhase(REALTYPE x, REALTYPE g, REALTYPE *old) -{ - for(int j = 0; j < Pstages * 2; j++) { //Phasing routine - REALTYPE tmp = old[j]; - old[j] = g * tmp + x; - x = tmp - g *old[j]; - } - return x; -} - -/* - * Cleanup the effect - */ -void Phaser::cleanup() -{ - fb = oldgain = Stereo(0.0); - for(int i = 0; i < Pstages * 2; i++) { - old.l[i] = 0.0; - old.r[i] = 0.0; - } - for(int i = 0; i < Pstages; i++) { - xn1.l[i] = 0.0; - yn1.l[i] = 0.0; - xn1.r[i] = 0.0; - yn1.r[i] = 0.0; - } -} - -/* - * Parameter control - */ -void Phaser::setwidth(unsigned char Pwidth) -{ - this->Pwidth = Pwidth; - width = ((float)Pwidth / 127.0f); -} - -void Phaser::setfb(unsigned char Pfb) -{ - this->Pfb = Pfb; - feedback = (float) (Pfb - 64) / 64.2f; -} - -void Phaser::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - outvolume = Pvolume / 127.0; - if(insertion == 0) - volume = 1.0; - else - volume = outvolume; -} - -void Phaser::setpanning(unsigned char Ppanning) -{ - this->Ppanning = Ppanning; - panning = (float)Ppanning / 127.0; -} - -void Phaser::setlrcross(unsigned char Plrcross) -{ - this->Plrcross = Plrcross; - lrcross = Plrcross / 127.0; -} - -void Phaser::setdistortion(unsigned char Pdistortion) -{ - this->Pdistortion = Pdistortion; - distortion = (float)Pdistortion / 127.0f; -} - -void Phaser::setoffset(unsigned char Poffset) -{ - this->Poffset = Poffset; - offsetpct = (float)Poffset / 127.0f; -} - -void Phaser::setstages(unsigned char Pstages) -{ - if(xn1.l) - delete[] xn1.l; - if(yn1.l) - delete[] yn1.l; - if(xn1.r) - delete[] xn1.r; - if(yn1.r) - delete[] yn1.r; - - - this->Pstages = min(MAX_PHASER_STAGES, (int)Pstages); - - old = Stereo(new REALTYPE[Pstages * 2], - new REALTYPE[Pstages * 2]); - - xn1 = Stereo(new REALTYPE[Pstages], - new REALTYPE[Pstages]); - - yn1 = Stereo(new REALTYPE[Pstages], - new REALTYPE[Pstages]); - - cleanup(); -} - -void Phaser::setphase(unsigned char Pphase) -{ - this->Pphase = Pphase; - phase = (Pphase / 127.0); -} - -void Phaser::setdepth(unsigned char Pdepth) -{ - this->Pdepth = Pdepth; - depth = (float)(Pdepth) / 127.0f; -} - - -void Phaser::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 15; - const int NUM_PRESETS = 12; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Phaser - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - {64, 64, 36, 0, 0, 64, 110, 64, 1, 0, 0, 20, 0, 0, 0}, - {64, 64, 35, 0, 0, 88, 40, 64, 3, 0, 0, 20, 0, 0, 0}, - {64, 64, 31, 0, 0, 66, 68, 107, 2, 0, 0, 20, 0, 0, 0}, - {39, 64, 22, 0, 0, 66, 67, 10, 5, 0, 1, 20, 0, 0, 0}, - {64, 64, 20, 0, 1, 110, 67, 78, 10, 0, 0, 20, 0, 0, 0}, - {64, 64, 53, 100, 0, 58, 37, 78, 3, 0, 0, 20, 0, 0, 0}, - //APhaser - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - {64, 64, 14, 0, 1, 64, 64, 40, 4, 10, 0, 110, 1, 20, 1}, - {64, 64, 14, 5, 1, 64, 70, 40, 6, 10, 0, 110, 1, 20, 1}, - {64, 64, 9, 0, 0, 64, 60, 40, 8, 10, 0, 40, 0, 20, 1}, - {64, 64, 14, 10, 0, 64, 45, 80, 7, 10, 1, 110, 1, 20, 1}, - {25, 64, 127, 10, 0, 64, 25, 16, 8, 100, 0, 25, 0, 20, 1}, - {64, 64, 1, 10, 1, 64, 70, 40, 12, 10, 0, 110, 1, 20, 1} - }; - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - Ppreset = npreset; -} - - -void Phaser::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - barber = (2 == value); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setfb(value); - break; - case 8: - setstages(value); - break; - case 9: - setlrcross(value); - setoffset(value); - break; - case 10: - Poutsub = min((int)value,1); - break; - case 11: - setphase(value); - setwidth(value); - break; - case 12: - Phyper = min((int)value, 1); - break; - case 13: - setdistortion(value); - break; - case 14: - Panalog = value; - break; - } -} - -unsigned char Phaser::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - case 1: - return Ppanning; - case 2: - return lfo.Pfreq; - case 3: - return lfo.Prandomness; - case 4: - return lfo.PLFOtype; - case 5: - return lfo.Pstereo; - case 6: - return Pdepth; - case 7: - return Pfb; - case 8: - return Pstages; - case 9: - return Plrcross; - return Poffset; - case 10: - return Poutsub; - case 11: - return Pphase; - return Pwidth; - case 12: - return Phyper; - case 13: - return Pdistortion; - case 14: - return Panalog; - default: - return 0; - } -} diff --git a/plugins/zynaddsubfx/src/Effects/Phaser.h b/plugins/zynaddsubfx/src/Effects/Phaser.h deleted file mode 100644 index 75ff79173..000000000 --- a/plugins/zynaddsubfx/src/Effects/Phaser.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Phaser.h - Phaser effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2009-2010 Ryan Billing - Copyright (C) 2010-2010 Mark McCurry - Author: Nasca Octavian Paul - Ryan Billing - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PHASER_H -#define PHASER_H -#include "../globals.h" -#include "Effect.h" -#include "EffectLFO.h" - -#define MAX_PHASER_STAGES 12 - -class Phaser:public Effect -{ - public: - Phaser(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_); - ~Phaser(); - void out(const Stereo &input); - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(); - - private: - //Phaser parameters - EffectLFO lfo; //Phaser modulator - unsigned char Pvolume; //Used to set wet/dry mix - unsigned char Ppanning; - unsigned char Pdistortion; //Model distortion added by FET element - unsigned char Pdepth; //Depth of phaser sweep - unsigned char Pwidth; //Phaser width (LFO amplitude) - unsigned char Pfb; //feedback - unsigned char Poffset; //Model mismatch between variable resistors - unsigned char Plrcross; //crossover - unsigned char Pstages; //Number of first-order All-Pass stages - unsigned char Poutsub; //if I wish to subtract the output instead of adding - unsigned char Pphase; - unsigned char Phyper; //lfo^2 -- converts tri into hyper-sine - unsigned char Panalog; - - //Control parameters - void setvolume(unsigned char Pvolume); - void setpanning(unsigned char Ppanning); - void setdepth(unsigned char Pdepth); - void setfb(unsigned char Pfb); - void setdistortion(unsigned char Pdistortion); - void setwidth(unsigned char Pwidth); - void setoffset(unsigned char Poffset); - void setlrcross(unsigned char Plrcross); - void setstages(unsigned char Pstages); - void setphase(unsigned char Pphase); - - //Internal Variables - bool barber; //Barber pole phasing flag - REALTYPE distortion, width, offsetpct; - REALTYPE panning, feedback, depth, lrcross, phase; - Stereo old, xn1, yn1; - Stereo diff, oldgain, fb; - REALTYPE invperiod; - REALTYPE offset[12]; - - float mis; - float Rmin; // 3N5457 typical on resistance at Vgs = 0 - float Rmax; // Resistor parallel to FET - float Rmx; // Rmin/Rmax to avoid division in loop - float Rconst; // Handle parallel resistor relationship - float C; // Capacitor - float CFs; // A constant derived from capacitor and resistor relationships - - void analog_setup(); - void AnalogPhase(const Stereo &input); - //analog case - REALTYPE applyPhase(REALTYPE x, REALTYPE g, REALTYPE fb, - REALTYPE &hpf, REALTYPE *yn1, REALTYPE *xn1); - - void normalPhase(const Stereo &input); - REALTYPE applyPhase(REALTYPE x, REALTYPE g, REALTYPE *old); -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Effects/Reverb.cpp b/plugins/zynaddsubfx/src/Effects/Reverb.cpp deleted file mode 100644 index 0176fa77e..000000000 --- a/plugins/zynaddsubfx/src/Effects/Reverb.cpp +++ /dev/null @@ -1,551 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Reverb.cpp - Reverberation effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Reverb.h" - -/**\todo: EarlyReflections,Prdelay,Perbalance */ - -Reverb::Reverb(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0) -{ - inputbuf = new REALTYPE[SOUND_BUFFER_SIZE]; - - bandwidth = NULL; - - //defaults - Pvolume = 48; - Ppan = 64; - Ptime = 64; - Pidelay = 40; - Pidelayfb = 0; - Prdelay = 0; - Plpf = 127; - Phpf = 0; - Perbalance = 64; - Plohidamp = 80; - Ptype = 1; - Proomsize = 64; - Pbandwidth = 30; - roomsize = 1.0; - rs = 1.0; - - for(int i = 0; i < REV_COMBS * 2; i++) { - comblen[i] = 800 + (int)(RND * 1400); - combk[i] = 0; - lpcomb[i] = 0; - combfb[i] = -0.97; - comb[i] = NULL; - } - - for(int i = 0; i < REV_APS * 2; i++) { - aplen[i] = 500 + (int)(RND * 500); - apk[i] = 0; - ap[i] = NULL; - } - - lpf = NULL; - hpf = NULL; //no filter - idelay = NULL; - - setpreset(Ppreset); - cleanup(); //do not call this before the comb initialisation -} - - -Reverb::~Reverb() -{ - int i; - if(idelay != NULL) - delete [] idelay; - if(hpf != NULL) - delete hpf; - if(lpf != NULL) - delete lpf; - - for(i = 0; i < REV_APS * 2; i++) - delete [] ap[i]; - for(i = 0; i < REV_COMBS * 2; i++) - delete [] comb[i]; - - delete [] inputbuf; - if(bandwidth) - delete bandwidth; -} - -/* - * Cleanup the effect - */ -void Reverb::cleanup() -{ - int i, j; - for(i = 0; i < REV_COMBS * 2; i++) { - lpcomb[i] = 0.0; - for(j = 0; j < comblen[i]; j++) - comb[i][j] = 0.0; - } - - for(i = 0; i < REV_APS * 2; i++) - for(j = 0; j < aplen[i]; j++) - ap[i][j] = 0.0; - - if(idelay != NULL) - for(i = 0; i < idelaylen; i++) - idelay[i] = 0.0; - - if(hpf != NULL) - hpf->cleanup(); - if(lpf != NULL) - lpf->cleanup(); -} - -/* - * Process one channel; 0=left,1=right - */ -void Reverb::processmono(int ch, REALTYPE *output) -{ - int i, j; - REALTYPE fbout, tmp; - /**\todo: implement the high part from lohidamp*/ - - for(j = REV_COMBS * ch; j < REV_COMBS * (ch + 1); j++) { - int ck = combk[j]; - int comblength = comblen[j]; - REALTYPE lpcombj = lpcomb[j]; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - fbout = comb[j][ck] * combfb[j]; - fbout = fbout * (1.0 - lohifb) + lpcombj * lohifb; - lpcombj = fbout; - - comb[j][ck] = inputbuf[i] + fbout; - output[i] += fbout; - - if((++ck) >= comblength) - ck = 0; - } - - combk[j] = ck; - lpcomb[j] = lpcombj; - } - - for(j = REV_APS * ch; j < REV_APS * (1 + ch); j++) { - int ak = apk[j]; - int aplength = aplen[j]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmp = ap[j][ak]; - ap[j][ak] = 0.7 * tmp + output[i]; - output[i] = tmp - 0.7 * ap[j][ak]; - if((++ak) >= aplength) - ak = 0; - } - apk[j] = ak; - } -} - -/* - * Effect output - */ -void Reverb::out(const Stereo &smp) -{ - int i; - if((Pvolume == 0) && (insertion != 0)) - return; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - inputbuf[i] = (smp.l[i] + smp.r[i]) / 2.0; - - if(idelay != NULL) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - //Initial delay r - REALTYPE tmp = inputbuf[i] + idelay[idelayk] * idelayfb; - inputbuf[i] = idelay[idelayk]; - idelay[idelayk] = tmp; - idelayk++; - if(idelayk >= idelaylen) - idelayk = 0; - } - } - - if(bandwidth) - bandwidth->process(SOUND_BUFFER_SIZE, inputbuf); - - if(lpf != NULL) - lpf->filterout(inputbuf); - if(hpf != NULL) - hpf->filterout(inputbuf); - - processmono(0, efxoutl); //left - processmono(1, efxoutr); //right - - REALTYPE lvol = rs / REV_COMBS * pan; - REALTYPE rvol = rs / REV_COMBS * (1.0 - pan); - if(insertion != 0) { - lvol *= 2; - rvol *= 2; - } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - efxoutl[i] *= lvol; - efxoutr[i] *= rvol; - } -} - - -/* - * Parameter control - */ -void Reverb::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - if(insertion == 0) { - outvolume = pow(0.01, (1.0 - Pvolume / 127.0)) * 4.0; - volume = 1.0; - } - else { - volume = outvolume = Pvolume / 127.0; - if(Pvolume == 0) - cleanup(); - } -} - -void Reverb::setpan(unsigned char Ppan) -{ - this->Ppan = Ppan; - pan = (REALTYPE)Ppan / 127.0; -} - -void Reverb::settime(unsigned char Ptime) -{ - int i; - REALTYPE t; - this->Ptime = Ptime; - t = pow(60.0, (REALTYPE)Ptime / 127.0) - 0.97; - - for(i = 0; i < REV_COMBS * 2; i++) - combfb[i] = - -exp((REALTYPE)comblen[i] / (REALTYPE)SAMPLE_RATE * log(0.001) / t); - //the feedback is negative because it removes the DC -} - -void Reverb::setlohidamp(unsigned char Plohidamp) -{ - if(Plohidamp < 64) - Plohidamp = 64; //remove this when the high part from lohidamp will be added - - this->Plohidamp = Plohidamp; - if(Plohidamp == 64) { - lohidamptype = 0; - lohifb = 0.0; - } - else { - if(Plohidamp < 64) - lohidamptype = 1; - if(Plohidamp > 64) - lohidamptype = 2; - REALTYPE x = fabs((REALTYPE)(Plohidamp - 64) / 64.1); - lohifb = x * x; - } -} - -void Reverb::setidelay(unsigned char Pidelay) -{ - REALTYPE delay; - this->Pidelay = Pidelay; - delay = pow(50 * Pidelay / 127.0, 2) - 1.0; - - if(idelay != NULL) - delete [] idelay; - idelay = NULL; - - idelaylen = (int) (SAMPLE_RATE * delay / 1000); - if(idelaylen > 1) { - idelayk = 0; - idelay = new REALTYPE[idelaylen]; - for(int i = 0; i < idelaylen; i++) - idelay[i] = 0.0; - } -} - -void Reverb::setidelayfb(unsigned char Pidelayfb) -{ - this->Pidelayfb = Pidelayfb; - idelayfb = Pidelayfb / 128.0; -} - -void Reverb::sethpf(unsigned char Phpf) -{ - this->Phpf = Phpf; - if(Phpf == 0) { //No HighPass - if(hpf != NULL) - delete hpf; - hpf = NULL; - } - else { - REALTYPE fr = exp(pow(Phpf / 127.0, 0.5) * log(10000.0)) + 20.0; - if(hpf == NULL) - hpf = new AnalogFilter(3, fr, 1, 0); - else - hpf->setfreq(fr); - } -} - -void Reverb::setlpf(unsigned char Plpf) -{ - this->Plpf = Plpf; - if(Plpf == 127) { //No LowPass - if(lpf != NULL) - delete lpf; - lpf = NULL; - } - else { - REALTYPE fr = exp(pow(Plpf / 127.0, 0.5) * log(25000.0)) + 40; - if(lpf == NULL) - lpf = new AnalogFilter(2, fr, 1, 0); - else - lpf->setfreq(fr); - } -} - -void Reverb::settype(unsigned char Ptype) -{ - const int NUM_TYPES = 3; - const int combtunings[NUM_TYPES][REV_COMBS] = { - //this is unused (for random) - {0, 0, 0, 0, 0, 0, 0, 0 }, - //Freeverb by Jezar at Dreampoint - {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 }, - //Freeverb by Jezar at Dreampoint //duplicate - {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 } - }; - const int aptunings[NUM_TYPES][REV_APS] = { - //this is unused (for random) - {0, 0, 0, 0 }, - //Freeverb by Jezar at Dreampoint - {225, 341, 441, 556 }, - //Freeverb by Jezar at Dreampoint (duplicate) - {225, 341, 441, 556 } - }; - - if(Ptype >= NUM_TYPES) - Ptype = NUM_TYPES - 1; - this->Ptype = Ptype; - - REALTYPE tmp; - for(int i = 0; i < REV_COMBS * 2; i++) { - if(Ptype == 0) - tmp = 800.0 + (int)(RND * 1400.0); - else - tmp = combtunings[Ptype][i % REV_COMBS]; - tmp *= roomsize; - if(i > REV_COMBS) - tmp += 23.0; - tmp *= SAMPLE_RATE / 44100.0; //adjust the combs according to the samplerate - if(tmp < 10) - tmp = 10; - - comblen[i] = (int) tmp; - combk[i] = 0; - lpcomb[i] = 0; - if(comb[i] != NULL) - delete [] comb[i]; - comb[i] = new REALTYPE[comblen[i]]; - } - - for(int i = 0; i < REV_APS * 2; i++) { - if(Ptype == 0) - tmp = 500 + (int)(RND * 500); - else - tmp = aptunings[Ptype][i % REV_APS]; - tmp *= roomsize; - if(i > REV_APS) - tmp += 23.0; - tmp *= SAMPLE_RATE / 44100.0; //adjust the combs according to the samplerate - if(tmp < 10) - tmp = 10; - aplen[i] = (int) tmp; - apk[i] = 0; - if(ap[i] != NULL) - delete [] ap[i]; - ap[i] = new REALTYPE[aplen[i]]; - } - settime(Ptime); - cleanup(); - if(bandwidth) - delete bandwidth; - bandwidth = NULL; - if(Ptype == 2) { //bandwidth - bandwidth = new Unison(SOUND_BUFFER_SIZE / 4 + 1, 2.0); - bandwidth->set_size(50); - bandwidth->set_base_frequency(1.0); - } -} - -void Reverb::setroomsize(unsigned char Proomsize) -{ - this->Proomsize = Proomsize; - if(Proomsize == 0) - this->Proomsize = 64; //this is because the older versions consider roomsize=0 - roomsize = (this->Proomsize - 64.0) / 64.0; - if(roomsize > 0.0) - roomsize *= 2.0; - roomsize = pow(10.0, roomsize); - rs = sqrt(roomsize); - settype(Ptype); -} - -void Reverb::setbandwidth(unsigned char Pbandwidth) { - this->Pbandwidth = Pbandwidth; - REALTYPE v = Pbandwidth / 127.0; - if(bandwidth) - bandwidth->set_bandwidth(pow(v, 2.0) * 200.0); -} - -void Reverb::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 13; - const int NUM_PRESETS = 13; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Cathedral1 - {80, 64, 63, 24, 0, 0, 0, 85, 5, 83, 1, 64, 20 }, - //Cathedral2 - {80, 64, 69, 35, 0, 0, 0, 127, 0, 71, 0, 64, 20 }, - //Cathedral3 - {80, 64, 69, 24, 0, 0, 0, 127, 75, 78, 1, 85, 20 }, - //Hall1 - {90, 64, 51, 10, 0, 0, 0, 127, 21, 78, 1, 64, 20 }, - //Hall2 - {90, 64, 53, 20, 0, 0, 0, 127, 75, 71, 1, 64, 20 }, - //Room1 - {100, 64, 33, 0, 0, 0, 0, 127, 0, 106, 0, 30, 20 }, - //Room2 - {100, 64, 21, 26, 0, 0, 0, 62, 0, 77, 1, 45, 20 }, - //Basement - {110, 64, 14, 0, 0, 0, 0, 127, 5, 71, 0, 25, 20 }, - //Tunnel - {85, 80, 84, 20, 42, 0, 0, 51, 0, 78, 1, 105, 20 }, - //Echoed1 - {95, 64, 26, 60, 71, 0, 0, 114, 0, 64, 1, 64, 20 }, - //Echoed2 - {90, 64, 40, 88, 71, 0, 0, 114, 0, 88, 1, 64, 20 }, - //VeryLong1 - {90, 64, 93, 15, 0, 0, 0, 114, 0, 77, 0, 95, 20 }, - //VeryLong2 - {90, 64, 111, 30, 0, 0, 0, 114, 90, 74, 1, 80, 20 } - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) - changepar(n, presets[npreset][n]); - if(insertion != 0) - changepar(0, presets[npreset][0] / 2); //lower the volume if reverb is insertion effect - Ppreset = npreset; -} - - -void Reverb::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpan(value); - break; - case 2: - settime(value); - break; - case 3: - setidelay(value); - break; - case 4: - setidelayfb(value); - break; -// case 5: setrdelay(value); -// break; -// case 6: seterbalance(value); -// break; - case 7: - setlpf(value); - break; - case 8: - sethpf(value); - break; - case 9: - setlohidamp(value); - break; - case 10: - settype(value); - break; - case 11: - setroomsize(value); - break; - case 12: - setbandwidth(value); - break; - } -} - -unsigned char Reverb::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - case 1: - return Ppan; - break; - case 2: - return Ptime; - break; - case 3: - return Pidelay; - break; - case 4: - return Pidelayfb; - break; -// case 5: return(Prdelay); -// break; -// case 6: return(Perbalance); -// break; - case 7: - return Plpf; - break; - case 8: - return Phpf; - break; - case 9: - return Plohidamp; - break; - case 10: - return Ptype; - break; - case 11: - return Proomsize; - break; - case 12: - return Pbandwidth; - break; - } - return 0; //in case of bogus "parameter" -} - diff --git a/plugins/zynaddsubfx/src/Effects/Reverb.h b/plugins/zynaddsubfx/src/Effects/Reverb.h deleted file mode 100644 index a505a8fda..000000000 --- a/plugins/zynaddsubfx/src/Effects/Reverb.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Reverb.h - Reverberation effect - Copyright (C) 2002-2009 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef REVERB_H -#define REVERB_H - -#include -#include "../globals.h" -#include "../DSP/AnalogFilter.h" -#include "../DSP/FFTwrapper.h" -#include "../DSP/Unison.h" -#include "Effect.h" - -#define REV_COMBS 8 -#define REV_APS 4 - -/**Creates Reverberation Effects*/ - -class Reverb:public Effect -{ - public: - Reverb(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_); - ~Reverb(); - void out(const Stereo &smp); - void cleanup(); - - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - - private: - //Parametrii - /**Amount of the reverb*/ - unsigned char Pvolume; - - /**Left/Right Panning*/ - unsigned char Ppan; - - /**duration of reverb*/ - unsigned char Ptime; - - /**Initial delay*/ - unsigned char Pidelay; - - /**Initial delay feedback*/ - unsigned char Pidelayfb; - - /**delay between ER/Reverbs*/ - unsigned char Prdelay; - - /**EarlyReflections/Reverb Balance*/ - unsigned char Perbalance; - - /**HighPassFilter*/ - unsigned char Plpf; - - /**LowPassFilter*/ - unsigned char Phpf; - - /**Low/HighFrequency Damping - * \todo 0..63 lpf,64=off,65..127=hpf(TODO)*/ - unsigned char Plohidamp; - - /**Reverb type*/ - unsigned char Ptype; - - /**Room Size*/ - unsigned char Proomsize; - - /**Bandwidth */ - unsigned char Pbandwidth; - - //parameter control - void setvolume(unsigned char Pvolume); - void setpan(unsigned char Ppan); - void settime(unsigned char Ptime); - void setlohidamp(unsigned char Plohidamp); - void setidelay(unsigned char Pidelay); - void setidelayfb(unsigned char Pidelayfb); - void sethpf(unsigned char Phpf); - void setlpf(unsigned char Plpf); - void settype(unsigned char Ptype); - void setroomsize(unsigned char Proomsize); - void setbandwidth(unsigned char Pbandwidth); - - REALTYPE pan; - //Parameters - int lohidamptype; /**<0=disable,1=highdamp(lowpass),2=lowdamp(highpass)*/ - int idelaylen; - int idelayk; - REALTYPE lohifb, idelayfb, roomsize, rs; //rs is used to "normalise" the volume according to the roomsize - int comblen[REV_COMBS * 2]; - int aplen[REV_APS * 2]; - Unison *bandwidth; - - //Internal Variables - - REALTYPE *comb[REV_COMBS * 2]; - - int combk[REV_COMBS * 2]; - REALTYPE combfb[REV_COMBS * 2]; /**type) { - case SND_SEQ_EVENT_NOTEON: - cmdtype = MidiNoteON; - cmdchan = midievent->data.note.channel; - cmdparams[0] = midievent->data.note.note; - cmdparams[1] = midievent->data.note.velocity; - break; - case SND_SEQ_EVENT_NOTEOFF: - cmdtype = MidiNoteOFF; - cmdchan = midievent->data.note.channel; - cmdparams[0] = midievent->data.note.note; - break; - case SND_SEQ_EVENT_PITCHBEND: - cmdtype = MidiController; - cmdchan = midievent->data.control.channel; - cmdparams[0] = C_pitchwheel; //Pitch Bend - cmdparams[1] = midievent->data.control.value; - break; - case SND_SEQ_EVENT_CONTROLLER: - cmdtype = MidiController; - cmdchan = midievent->data.control.channel; - cmdparams[0] = getcontroller(midievent->data.control.param); - cmdparams[1] = midievent->data.control.value; - //fprintf(stderr,"t=%d val=%d\n",midievent->data.control.param,midievent->data.control.value); - break; - } -} - - -int ALSAMidiIn::getalsaid() -{ - if(midi_handle) { - snd_seq_client_info_t *seq_info; - snd_seq_client_info_malloc(&seq_info); - snd_seq_get_client_info(midi_handle, seq_info); - int id = snd_seq_client_info_get_client(seq_info); - snd_seq_client_info_free(seq_info); - return id; - } - return -1; -} - diff --git a/plugins/zynaddsubfx/src/Input/ALSAMidiIn.h b/plugins/zynaddsubfx/src/Input/ALSAMidiIn.h deleted file mode 100644 index cea61fb36..000000000 --- a/plugins/zynaddsubfx/src/Input/ALSAMidiIn.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ALSAMidiIn.h - Midi input for ALSA (this creates an ALSA virtual port) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ALSA_MIDI_IN_H -#define ALSA_MIDI_IN_H - -#include -#include "MidiIn.h" - - -/**Midi input for ALSA (this creates an ALSA virtual port)*/ -class ALSAMidiIn:public MidiIn -{ - public: - /**Constructor*/ - ALSAMidiIn(); - /**Destructor*/ - ~ALSAMidiIn(); - - void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams); - /**Get the ALSA id - * @return ALSA id*/ - int getalsaid(); - - private: - snd_seq_t *midi_handle; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Input/CMakeLists.txt b/plugins/zynaddsubfx/src/Input/CMakeLists.txt deleted file mode 100644 index dac041748..000000000 --- a/plugins/zynaddsubfx/src/Input/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(zynaddsubfx_input_SRCS - MidiIn.cpp - NULLMidiIn.cpp - #OSSMidiIn.cpp #[TODO] get OSS midi detection and - #WINMidiIn.cpp # Win midi detection working -) - -if(AlsaMidiInput) - set(zynaddsubfx_input_SRCS - ${zynaddsubfx_input_SRCS} - ALSAMidiIn.cpp - ) - message(STATUS "Alsa midi input enabled") - set(MIDIINPUT_LIBRARIES ${ASOUND_LIBRARY} PARENT_SCOPE) -endif(AlsaMidiInput) - -add_library(zynaddsubfx_input STATIC - ${zynaddsubfx_input_SRCS} - ) diff --git a/plugins/zynaddsubfx/src/Input/MidiIn.cpp b/plugins/zynaddsubfx/src/Input/MidiIn.cpp deleted file mode 100644 index 3d7c5b230..000000000 --- a/plugins/zynaddsubfx/src/Input/MidiIn.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MidiIn.cpp - This class is inherited by all the Midi input classes - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "../globals.h" -#include "MidiIn.h" - -int MidiIn::getcontroller(unsigned char b) -{ - /**\todo there might be a better way to do this*/ - int ctl = C_NULL; - switch(b) { - case 1: - ctl = C_modwheel; //Modulation Wheel - break; - case 7: - ctl = C_volume; //Volume - break; - case 10: - ctl = C_panning; //Panning - break; - case 11: - ctl = C_expression; //Expression - break; - case 64: - ctl = C_sustain; //Sustain pedal - break; - case 65: - ctl = C_portamento; //Portamento - break; - case 71: - ctl = C_filterq; //Filter Q (Sound Timbre) - break; - case 74: - ctl = C_filtercutoff; //Filter Cutoff (Brightness) - break; - case 75: - ctl = C_bandwidth; //BandWidth - break; - case 76: - ctl = C_fmamp; //FM amplitude - break; - case 77: - ctl = C_resonance_center; //Resonance Center Frequency - break; - case 78: - ctl = C_resonance_bandwidth; //Resonance Bandwith - break; - case 120: - ctl = C_allsoundsoff; //All Sounds OFF - break; - case 121: - ctl = C_resetallcontrollers; //Reset All Controllers - break; - case 123: - ctl = C_allnotesoff; //All Notes OFF - break; - //RPN and NRPN - case 0x06: - ctl = C_dataentryhi; //Data Entry (Coarse) - break; - case 0x26: - ctl = C_dataentrylo; //Data Entry (Fine) - break; - case 99: - ctl = C_nrpnhi; //NRPN (Coarse) - break; - case 98: - ctl = C_nrpnlo; //NRPN (Fine) - break; - default: - ctl = C_NULL; //unknown controller - //fprintf(stderr,"Controller=%d , par=%d\n",midievent->data.control.param,cmdparams[1]); - break; - } - return ctl; -} - diff --git a/plugins/zynaddsubfx/src/Input/MidiIn.h b/plugins/zynaddsubfx/src/Input/MidiIn.h deleted file mode 100644 index 5d978eaeb..000000000 --- a/plugins/zynaddsubfx/src/Input/MidiIn.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MidiIn.h - This class is inherited by all the Midi input classes - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MIDI_IN_H -#define MIDI_IN_H - -#include "../globals.h" - -enum MidiCmdType { - MidiNull, MidiNoteOFF, MidiNoteON, MidiController -}; -#define MP_MAX_BYTES 4000 //in case of loooong SYS_EXes - -/**This class is inherited by all the Midi input classes*/ -class MidiIn -{ - public: - /**Get the command,channel and parameters of the MIDI - * - * \todo make pure virtual - * @param cmdtype the referece to the variable that will store the type - * @param cmdchan the channel for the event - * @param parameters for the event*/ - virtual void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams) = 0; - int getcontroller(unsigned char b); - protected: - bool inputok; /**<1 if I can read midi bytes from input ports*/ -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Input/NULLMidiIn.cpp b/plugins/zynaddsubfx/src/Input/NULLMidiIn.cpp deleted file mode 100644 index a9c13acb3..000000000 --- a/plugins/zynaddsubfx/src/Input/NULLMidiIn.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - NULLMidiIn.cpp - a dummy Midi port - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "NULLMidiIn.h" - -NULLMidiIn::NULLMidiIn() -{} - -NULLMidiIn::~NULLMidiIn() -{} - -/* - * Get the midi command,channel and parameters - * It returns MidiNull because it is a dummy driver - */ -void NULLMidiIn::getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams) -{ - cmdtype = MidiNull; -} - diff --git a/plugins/zynaddsubfx/src/Input/NULLMidiIn.h b/plugins/zynaddsubfx/src/Input/NULLMidiIn.h deleted file mode 100644 index 72cef4ad0..000000000 --- a/plugins/zynaddsubfx/src/Input/NULLMidiIn.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - NULLMidiIn.h - a dummy Midi port - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef NULL_MIDI_IN_H -#define NULL_MIDI_IN_H - -#include "MidiIn.h" - - -/**a dummy Midi port*/ -class NULLMidiIn:public MidiIn -{ - public: - /**Dummy Constructor - * \todo see if the default constructor would work here*/ - NULLMidiIn(); - /**Dummy Destructor - * \todo see if the default destructor would work here*/ - ~NULLMidiIn(); - /**Get the midi command,channel and parameters - * It returns MidiNull because it is a dummy driver - */ - void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams); - - private: -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Input/OSSMidiIn.cpp b/plugins/zynaddsubfx/src/Input/OSSMidiIn.cpp deleted file mode 100644 index 5a20fb930..000000000 --- a/plugins/zynaddsubfx/src/Input/OSSMidiIn.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSMidiIn.cpp - Midi input for Open Sound System - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "OSSMidiIn.h" -#include "../Misc/Util.h" - -OSSMidiIn::OSSMidiIn() -{ - inputok = false; - midi_handle = open(config.cfg.LinuxOSSSeqInDev, O_RDONLY, 0); - if(midi_handle != -1) - inputok = true; - - lastmidicmd = 0; - cmdtype = 0; - cmdchan = 0; -} - -OSSMidiIn::~OSSMidiIn() -{ - close(midi_handle); -} - -unsigned char OSSMidiIn::readbyte() -{ - unsigned char tmp[4]; - read(midi_handle, &tmp[0], 1); - while(tmp[0] != SEQ_MIDIPUTC) { - read(midi_handle, &tmp[0], 4); - } - return tmp[1]; -} - -unsigned char OSSMidiIn::getmidibyte() -{ - unsigned char b; - do { - b = readbyte(); - } while(b == 0xfe); //drops the Active Sense Messages - return b; -} - -/* - * Get the midi command,channel and parameters - */ -void OSSMidiIn::getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams) -{ - unsigned char tmp, i; - if(inputok == false) { - cmdtype = MidiNull; - return; - } - i = 0; - if(lastmidicmd == 0) { //asteapta prima data pana cand vine prima comanda midi - while(tmp < 0x80) - tmp = getmidibyte(); - lastmidicmd = tmp; - } - - tmp = getmidibyte(); - - if(tmp >= 0x80) { - lastmidicmd = tmp; - tmp = getmidibyte(); - } - - if((lastmidicmd >= 0x80) && (lastmidicmd <= 0x8f)) { //Note OFF - cmdtype = MidiNoteOFF; - cmdchan = lastmidicmd % 16; - cmdparams[0] = tmp; //note number - } - - if((lastmidicmd >= 0x90) && (lastmidicmd <= 0x9f)) { //Note ON - cmdtype = MidiNoteON; - cmdchan = lastmidicmd % 16; - cmdparams[0] = tmp; //note number - cmdparams[1] = getmidibyte(); //velocity - if(cmdparams[1] == 0) - cmdtype = MidiNoteOFF; //if velocity==0 then is note off - } - if((lastmidicmd >= 0xB0) && (lastmidicmd <= 0xBF)) { //Controllers - cmdtype = MidiController; - cmdchan = lastmidicmd % 16; - cmdparams[0] = getcontroller(tmp); - cmdparams[1] = getmidibyte(); - } - if((lastmidicmd >= 0xE0) && (lastmidicmd <= 0xEF)) { //Pitch Wheel - cmdtype = MidiController; - cmdchan = lastmidicmd % 16; - cmdparams[0] = C_pitchwheel; - cmdparams[1] = (tmp + getmidibyte() * (int) 128) - 8192; //hope this is correct - } -} - diff --git a/plugins/zynaddsubfx/src/Input/OSSMidiIn.h b/plugins/zynaddsubfx/src/Input/OSSMidiIn.h deleted file mode 100644 index a3b56f51b..000000000 --- a/plugins/zynaddsubfx/src/Input/OSSMidiIn.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSMidiIn.h - Midi input for Open Sound System - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef OSS_MIDI_IN_H -#define OSS_MIDI_IN_H - -#include "MidiIn.h" - -class OSSMidiIn:public MidiIn -{ - public: - OSSMidiIn(); - ~OSSMidiIn(); - unsigned char getmidibyte(); - unsigned char readbyte(); - - //Midi parser - void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams); - unsigned char cmdtype; //the Message Type (noteon,noteof,sysex..) - unsigned char cmdchan; //the channel number - - private: - int midi_handle; - unsigned char lastmidicmd; //last byte (>=80) received from the Midi -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Input/WINMidiIn.cpp b/plugins/zynaddsubfx/src/Input/WINMidiIn.cpp deleted file mode 100644 index 65974eec1..000000000 --- a/plugins/zynaddsubfx/src/Input/WINMidiIn.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - WINMidiIn.cpp - Midi input for Windows - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include -#include - -#include "WINMidiIn.h" -#include "MidiIn.h" -#include "../Misc/Util.h" - -Master *winmaster; -HMIDIIN winmidiinhandle; -MidiIn midictl; //used to convert the controllers to ZynAddSubFX controllers - -void CALLBACK WinMidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, - DWORD dwParam1, DWORD dwParam2) -{ - int midicommand = MidiNull; - if(wMsg == MIM_DATA) { - int cmd, par1, par2; - cmd = dwParam1 & 0xff; - if(cmd == 0xfe) - return; - par1 = (dwParam1 >> 8) & 0xff; - par2 = dwParam1 >> 16; - //printf("%x %x %x\n",cmd,par1,par2);fflush(stdout); - int cmdchan = cmd & 0x0f; - int cmdtype = (cmd >> 4) & 0x0f; - - int tmp = 0; - pthread_mutex_lock(&winmaster->mutex); - switch(cmdtype) { - case (0x8): //noteon - winmaster->NoteOff(cmdchan, par1); - break; - case (0x9): //noteoff - winmaster->NoteOn(cmdchan, par1, par2 & 0xff); - break; - case (0xb): //controller - winmaster->SetController(cmdchan, midictl.getcontroller( - par1), par2 & 0xff); - break; - case (0xe): //pitch wheel - tmp = (par1 + par2 * (long int) 128) - 8192; - winmaster->SetController(cmdchan, C_pitchwheel, tmp); - break; - default: - break; - } - pthread_mutex_unlock(&winmaster->mutex); - } -} - -void InitWinMidi(Master *master_) -{ - winmaster = master_; - - long int result = - midiInOpen(&winmidiinhandle, - config.cfg.WindowsMidiInId, - (DWORD)WinMidiInProc, - 0, - CALLBACK_FUNCTION); - result = midiInStart(winmidiinhandle); -} - -void StopWinMidi() -{ - midiInStop(winmidiinhandle); - midiInClose(winmidiinhandle); -} - diff --git a/plugins/zynaddsubfx/src/Input/WINMidiIn.h b/plugins/zynaddsubfx/src/Input/WINMidiIn.h deleted file mode 100644 index db9fc79d5..000000000 --- a/plugins/zynaddsubfx/src/Input/WINMidiIn.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - WINMidiIn.h - Midi input for Windows - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef WIN_MIDI_IN_H -#define WIN_MIDI_IN_H - - -#include "../Misc/Master.h" - -void InitWinMidi(Master *master_); -void StopWinMidi(); - - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/Bank.cpp b/plugins/zynaddsubfx/src/Misc/Bank.cpp deleted file mode 100644 index 246a4098a..000000000 --- a/plugins/zynaddsubfx/src/Misc/Bank.cpp +++ /dev/null @@ -1,644 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Bank.h - Instrument Bank - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Bank.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Config.h" - -#define INSTRUMENT_EXTENSION ".xiz" - -//if this file exists into a directory, this make the directory to be considered as a bank, even if it not contains a instrument file -#define FORCE_BANK_DIR_FILE ".bankdir" - -Bank::Bank() -{ - ZERO(defaultinsname, PART_MAX_NAME_LEN); - snprintf(defaultinsname, PART_MAX_NAME_LEN, "%s", " "); - - for(int i = 0; i < BANK_SIZE; i++) { - ins[i].used = false; - ins[i].filename = NULL; - ins[i].info.PADsynth_used = false; - } - dirname = NULL; - clearbank(); - - - - for(int i = 0; i < MAX_NUM_BANKS; i++) { - banks[i].dir = NULL; - banks[i].name = NULL; - } - - bankfiletitle = dirname; - - loadbank(config.cfg.currentBankDir); -} - -Bank::~Bank() -{ - for(int i = 0; i < MAX_NUM_BANKS; i++) { - if(banks[i].dir != NULL) - delete [] banks[i].dir; - if(banks[i].name != NULL) - delete [] banks[i].name; - } - - clearbank(); -} - -/* - * Get the name of an instrument from the bank - */ -char *Bank::getname(unsigned int ninstrument) -{ - if(emptyslot(ninstrument)) - return defaultinsname; - return ins[ninstrument].name; -} - -/* - * Get the numbered name of an instrument from the bank - */ -char *Bank::getnamenumbered(unsigned int ninstrument) -{ - if(emptyslot(ninstrument)) - return defaultinsname; - snprintf(tmpinsname[ninstrument], - PART_MAX_NAME_LEN + 15, - "%d. %s", - ninstrument + 1, - getname(ninstrument)); - return tmpinsname[ninstrument]; -} - -/* - * Changes the name of an instrument (and the filename) - */ -void Bank::setname(unsigned int ninstrument, const char *newname, int newslot) -{ - if(emptyslot(ninstrument)) - return; - - char newfilename[1000 + 1], tmpfilename[100 + 1]; - - ZERO(newfilename, 1001); - ZERO(tmpfilename, 101); - if(newslot >= 0) - snprintf(tmpfilename, 100, "%4d-%s", newslot + 1, newname); - else - snprintf(tmpfilename, 100, "%4d-%s", ninstrument + 1, newname); - - //add the zeroes at the start of filename - for(int i = 0; i < 4; i++) - if(tmpfilename[i] == ' ') - tmpfilename[i] = '0'; - - //make the filenames legal - for(int i = 0; i < (int) strlen(tmpfilename); i++) { - char c = tmpfilename[i]; - if((c >= '0') && (c <= '9')) - continue; - if((c >= 'A') && (c <= 'Z')) - continue; - if((c >= 'a') && (c <= 'z')) - continue; - if((c == '-') || (c == ' ')) - continue; - - tmpfilename[i] = '_'; - } - - snprintf(newfilename, 1000, "%s/%s.xiz", dirname, tmpfilename); - -// printf("rename %s -> %s\n",ins[ninstrument].filename,newfilename);////////////// - - rename(ins[ninstrument].filename, newfilename); - if(ins[ninstrument].filename) - delete [] ins[ninstrument].filename; - ins[ninstrument].filename = new char[strlen(newfilename) + 5]; - snprintf(ins[ninstrument].filename, strlen( - newfilename) + 1, "%s", newfilename); - snprintf(ins[ninstrument].name, PART_MAX_NAME_LEN, "%s", &tmpfilename[5]); -} - -/* - * Check if there is no instrument on a slot from the bank - */ -int Bank::emptyslot(unsigned int ninstrument) -{ - if(ninstrument >= BANK_SIZE) - return 1; - if(ins[ninstrument].filename == NULL) - return 1; - - if(ins[ninstrument].used) - return 0; - else - return 1; -} - -/* - * Removes the instrument from the bank - */ -void Bank::clearslot(unsigned int ninstrument) -{ - if(emptyslot(ninstrument)) - return; - -// printf("remove %s \n",ins[ninstrument].filename);//////////////////////// - - - remove(ins[ninstrument].filename); - deletefrombank(ninstrument); -} - -/* - * Save the instrument to a slot - */ -void Bank::savetoslot(unsigned int ninstrument, Part *part) -{ - clearslot(ninstrument); - - const int maxfilename = 200; - char tmpfilename[maxfilename + 20]; - ZERO(tmpfilename, maxfilename + 20); - - snprintf(tmpfilename, - maxfilename, - "%4d-%s", - ninstrument + 1, - (char *)part->Pname); - - //add the zeroes at the start of filename - for(int i = 0; i < 4; i++) - if(tmpfilename[i] == ' ') - tmpfilename[i] = '0'; - - //make the filenames legal - for(int i = 0; i < (int)strlen(tmpfilename); i++) { - char c = tmpfilename[i]; - if((c >= '0') && (c <= '9')) - continue; - if((c >= 'A') && (c <= 'Z')) - continue; - if((c >= 'a') && (c <= 'z')) - continue; - if((c == '-') || (c == ' ')) - continue; - - tmpfilename[i] = '_'; - } - - strncat(tmpfilename, ".xiz", maxfilename + 10); - - int fnsize = strlen(dirname) + strlen(tmpfilename) + 10; - char *filename = new char[fnsize + 4]; - ZERO(filename, fnsize + 2); - - snprintf(filename, fnsize, "%s/%s", dirname, tmpfilename); - - remove(filename); - part->saveXML(filename); - addtobank(ninstrument, tmpfilename, (char *) part->Pname); - - delete[] filename; -} - -/* - * Loads the instrument from the bank - */ -void Bank::loadfromslot(unsigned int ninstrument, Part *part) -{ - if(emptyslot(ninstrument)) - return; - - part->defaultsinstrument(); - -// printf("load: %s\n",ins[ninstrument].filename); - - part->loadXMLinstrument(ins[ninstrument].filename); -} - - -/* - * Makes current a bank directory - */ -int Bank::loadbank(const char *bankdirname) -{ - DIR *dir = opendir(bankdirname); - clearbank(); - - if(dir == NULL) - return -1; - - if(dirname != NULL) - delete[] dirname; - dirname = new char[strlen(bankdirname) + 1]; - snprintf(dirname, strlen(bankdirname) + 1, "%s", bankdirname); - - bankfiletitle = dirname; - - // printf("loadbank %s/\n",bankdirname); - struct dirent *fn; - - while((fn = readdir(dir))) { - const char *filename = fn->d_name; - - //sa verific daca e si extensia dorita - if(strstr(filename, INSTRUMENT_EXTENSION) == NULL) - continue; - - //verify if the name is like this NNNN-name (where N is a digit) - int no = 0; - unsigned int startname = 0; - - for(unsigned int i = 0; i < 4; i++) { - if(strlen(filename) <= i) - break; - - if((filename[i] >= '0') && (filename[i] <= '9')) { - no = no * 10 + (filename[i] - '0'); - startname++; - } - } - - - if((startname + 1) < strlen(filename)) - startname++; //to take out the "-" - - char name[PART_MAX_NAME_LEN + 1]; - ZERO(name, PART_MAX_NAME_LEN + 1); - snprintf(name, PART_MAX_NAME_LEN, "%s", filename); - - //remove the file extension - for(int i = strlen(name) - 1; i >= 2; i--) { - if(name[i] == '.') { - name[i] = '\0'; - break; - } - } - - if(no != 0) //the instrument position in the bank is found - addtobank(no - 1, filename, &name[startname]); - else - addtobank(-1, filename, name); - ; - } - - - closedir(dir); - - if(dirname != NULL) - sprintf(config.cfg.currentBankDir, "%s", dirname); - ; - - return 0; -} - -/* - * Makes a new bank, put it on a file and makes it current bank - */ -int Bank::newbank(const char *newbankdirname) -{ - int result; - char tmpfilename[MAX_STRING_SIZE]; - char bankdir[MAX_STRING_SIZE]; - snprintf(bankdir, MAX_STRING_SIZE, "%s", config.cfg.bankRootDirList[0]); - - if(((bankdir[strlen(bankdir) - 1]) != '/') - && ((bankdir[strlen(bankdir) - 1]) != '\\')) - strncat(bankdir, "/", MAX_STRING_SIZE - strlen(bankdir) - 1 ); - ; - strncat(bankdir, newbankdirname, MAX_STRING_SIZE - strlen(bankdir) - 1); -#ifdef OS_WINDOWS - result = mkdir(bankdir); -#else - result = mkdir(bankdir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); -#endif - if(result < 0) - return -1; - - snprintf(tmpfilename, - MAX_STRING_SIZE, - "%s/%s", - bankdir, - FORCE_BANK_DIR_FILE); -// printf("%s\n",tmpfilename); - FILE *tmpfile = fopen(tmpfilename, "w+"); - fclose(tmpfile); - - return loadbank(bankdir); -} - -/* - * Check if the bank is locked (i.e. the file opened was readonly) - */ -int Bank::locked() -{ - return dirname == NULL; -} - -/* - * Swaps a slot with another - */ -void Bank::swapslot(unsigned int n1, unsigned int n2) -{ - if((n1 == n2) || (locked())) - return; - if(emptyslot(n1) && (emptyslot(n2))) - return; - if(emptyslot(n1)) { //change n1 to n2 in order to make - int tmp = n2; - n2 = n1; - n1 = tmp; - } - - if(emptyslot(n2)) { //this is just a movement from slot1 to slot2 - setname(n1, getname(n1), n2); - ins[n2] = ins[n1]; - ins[n1].used = false; - ins[n1].name[0] = '\0'; - ins[n1].filename = NULL; - ins[n1].info.PADsynth_used = 0; - } - else { //if both slots are used - if(strcmp(ins[n1].name, ins[n2].name) == 0) //change the name of the second instrument if the name are equal - strncat(ins[n2].name, "2", PART_MAX_NAME_LEN); - ; - setname(n1, getname(n1), n2); - setname(n2, getname(n2), n1); - ins_t tmp; - tmp.used = true; - strcpy(tmp.name, ins[n2].name); - char *tmpfilename = ins[n2].filename; - bool padsynth_used = ins[n2].info.PADsynth_used; - - ins[n2] = ins[n1]; - strcpy(ins[n1].name, tmp.name); - ins[n1].filename = tmpfilename; - ins[n1].info.PADsynth_used = padsynth_used; - } -} - - -//a helper function that compares 2 banks[] arrays -int Bank_compar(const void *a, const void *b) -{ - struct Bank::bankstruct *bank1 = (Bank::bankstruct *)a; - struct Bank::bankstruct *bank2 = (Bank::bankstruct *)b; - if(((bank1->name) == NULL) || ((bank2->name) == NULL)) - return 0; - - int result = strcasecmp(bank1->name, bank2->name); - return result < 0; -} - - -/* - * Re-scan for directories containing instrument banks - */ - -void Bank::rescanforbanks() -{ - for(int i = 0; i < MAX_NUM_BANKS; i++) { - if(banks[i].dir != NULL) - delete [] banks[i].dir; - if(banks[i].name != NULL) - delete [] banks[i].name; - banks[i].dir = NULL; - banks[i].name = NULL; - } - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) - if(config.cfg.bankRootDirList[i] != NULL) - scanrootdir(config.cfg.bankRootDirList[i]); - - //sort the banks - for(int j = 0; j < MAX_NUM_BANKS - 1; j++) { - for(int i = j + 1; i < MAX_NUM_BANKS; i++) { - if(Bank_compar(&banks[i], &banks[j])) { - char *tmpname = banks[i].name; - char *tmpdir = banks[i].dir; - - banks[i].name = banks[j].name; - banks[i].dir = banks[j].dir; - - banks[j].name = tmpname; - banks[j].dir = tmpdir; - } - } - } - - //remove duplicate bank names - int dupl = 0; - for(int j = 0; j < MAX_NUM_BANKS - 1; j++) { - for(int i = j + 1; i < MAX_NUM_BANKS; i++) { - if((banks[i].name == NULL) || (banks[j].name == NULL)) - continue; - if(strcmp(banks[i].name, banks[j].name) == 0) { //add a [1] to the first bankname and [n] to others - char *tmpname = banks[i].name; - banks[i].name = new char[strlen(tmpname) + 100]; - sprintf(banks[i].name, "%s[%d]", tmpname, dupl + 2); - delete[] tmpname; - - if(dupl == 0) { - char *tmpname = banks[j].name; - banks[j].name = new char[strlen(tmpname) + 100]; - sprintf(banks[j].name, "%s[1]", tmpname); - delete[] tmpname; - } - - dupl++; - } - else - dupl = 0; - } - } -} - - - -// private stuff - -void Bank::scanrootdir(char *rootdir) -{ -// printf("Scanning root dir:%s\n",rootdir); - DIR *dir = opendir(rootdir); - if(dir == NULL) - return; - - const int maxdirsize = 1000; - struct { - char dir[maxdirsize]; - char name[maxdirsize]; - } bank; - - const char *separator = "/"; - if(strlen(rootdir)) { - char tmp = rootdir[strlen(rootdir) - 1]; - if((tmp == '/') || (tmp == '\\')) - separator = ""; - } - - struct dirent *fn; - while((fn = readdir(dir))) { - const char *dirname = fn->d_name; - if(dirname[0] == '.') - continue; - - snprintf(bank.dir, maxdirsize, "%s%s%s/", rootdir, separator, dirname); - snprintf(bank.name, maxdirsize, "%s", dirname); - //find out if the directory contains at least 1 instrument - bool isbank = false; - - DIR *d = opendir(bank.dir); - if(d == NULL) - continue; - - struct dirent *fname; - - while((fname = readdir(d))) { - if((strstr(fname->d_name, INSTRUMENT_EXTENSION) != NULL) - || (strstr(fname->d_name, FORCE_BANK_DIR_FILE) != NULL)) { - isbank = true; - break; //aici as putea pune in loc de break un update la un counter care imi arata nr. de instrumente din bank - } - } - - closedir(d); - - if(isbank) { - int pos = -1; - for(int i = 1; i < MAX_NUM_BANKS; i++) { //banks[0] e liber intotdeauna - if(banks[i].name == NULL) { - pos = i; - break; - } - } - - if(pos >= 0) { - banks[pos].name = new char[maxdirsize]; - banks[pos].dir = new char[maxdirsize]; - snprintf(banks[pos].name, maxdirsize, "%s", bank.name); - snprintf(banks[pos].dir, maxdirsize, "%s", bank.dir); - } - } - } - - closedir(dir); -} - -void Bank::clearbank() -{ - for(int i = 0; i < BANK_SIZE; i++) - deletefrombank(i); - if(dirname != NULL) - delete[] dirname; - bankfiletitle = NULL; - dirname = NULL; -} - -int Bank::addtobank(int pos, const char *filename, const char *name) -{ - if((pos >= 0) && (pos < BANK_SIZE)) { - if(ins[pos].used) - pos = -1; //force it to find a new free position - } - else - if(pos >= BANK_SIZE) - pos = -1; - - - if(pos < 0) { //find a free position - for(int i = BANK_SIZE - 1; i >= 0; i--) - if(!ins[i].used) { - pos = i; - break; - } - ; - } - - if(pos < 0) - return -1; //the bank is full - - // printf("%s %d\n",filename,pos); - - deletefrombank(pos); - - ins[pos].used = true; - snprintf(ins[pos].name, PART_MAX_NAME_LEN, "%s", name); - - snprintf(tmpinsname[pos], PART_MAX_NAME_LEN + 10, " "); - - int len = strlen(filename) + 1 + strlen(dirname); - ins[pos].filename = new char[len + 2]; - ins[pos].filename[len + 1] = 0; - snprintf(ins[pos].filename, len + 1, "%s/%s", dirname, filename); - - //see if PADsynth is used - if(config.cfg.CheckPADsynth) { - XMLwrapper *xml = new XMLwrapper(); - xml->loadXMLfile(ins[pos].filename); - - ins[pos].info.PADsynth_used = xml->hasPadSynth(); - delete xml; - } - else - ins[pos].info.PADsynth_used = false; - - return 0; -} - -bool Bank::isPADsynth_used(unsigned int ninstrument) -{ - if(config.cfg.CheckPADsynth == 0) - return 0; - else - return ins[ninstrument].info.PADsynth_used; -} - - -void Bank::deletefrombank(int pos) -{ - if((pos < 0) || (pos >= BANK_SIZE)) - return; - ins[pos].used = false; - ZERO(ins[pos].name, PART_MAX_NAME_LEN + 1); - if(ins[pos].filename != NULL) { - delete [] ins[pos].filename; - ins[pos].filename = NULL; - } - - ZERO(tmpinsname[pos], PART_MAX_NAME_LEN + 20); -} - diff --git a/plugins/zynaddsubfx/src/Misc/Bank.h b/plugins/zynaddsubfx/src/Misc/Bank.h deleted file mode 100644 index aa3594648..000000000 --- a/plugins/zynaddsubfx/src/Misc/Bank.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Bank.h - Instrument Bank - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef BANK_H -#define BANK_H - -#include "../globals.h" -#include "XMLwrapper.h" -#include "Part.h" - -#define BANK_SIZE 160 - -/** - * The max. number of banks that are used - */ -#define MAX_NUM_BANKS 400 - -/**The instrument Bank - * \todo add in strings to replace char* */ -class Bank -{ - public: - /**Constructor*/ - Bank(); - ~Bank(); - char *getname(unsigned int ninstrument); - char *getnamenumbered(unsigned int ninstrument); - void setname(unsigned int ninstrument, const char *newname, int newslot); //if newslot==-1 then this is ignored, else it will be put on that slot - bool isPADsynth_used(unsigned int ninstrument); - - /**returns 0 if the slot is not empty or 1 if the slot is empty - * \todo start using bool before facepalm*/ - int emptyslot(unsigned int ninstrument); - - /**Empties out the selected slot*/ - void clearslot(unsigned int ninstrument); - /**Saves the given Part to slot*/ - void savetoslot(unsigned int ninstrument, Part *part); - /**Loads the given slot into a Part*/ - void loadfromslot(unsigned int ninstrument, Part *part); - - /**Swaps Slots*/ - void swapslot(unsigned int n1, unsigned int n2); - - int loadbank(const char *bankdirname); - int newbank(const char *newbankdirname); - - char *bankfiletitle; //this is shown on the UI of the bank (the title of the window) - int locked(); - - void rescanforbanks(); - - struct bankstruct { - char *dir; - char *name; - }; - - bankstruct banks[MAX_NUM_BANKS]; - - private: - - //it adds a filename to the bank - //if pos is -1 it try to find a position - //returns -1 if the bank is full, or 0 if the instrument was added - int addtobank(int pos, const char *filename, const char *name); - - void deletefrombank(int pos); - - void clearbank(); - - char defaultinsname[PART_MAX_NAME_LEN]; - char tmpinsname[BANK_SIZE][PART_MAX_NAME_LEN + 20]; //this keeps the numbered names - - struct ins_t { - bool used; - char name[PART_MAX_NAME_LEN + 1]; - char *filename; - struct { - bool PADsynth_used; - } info; - } ins[BANK_SIZE]; - - char *dirname; - - void scanrootdir(char *rootdir); //scans a root dir for banks -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/CMakeLists.txt b/plugins/zynaddsubfx/src/Misc/CMakeLists.txt deleted file mode 100644 index eb68d5805..000000000 --- a/plugins/zynaddsubfx/src/Misc/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -if(NOT ("${MXML_INCLUDE_DIR}" STREQUAL "")) - include_directories("${MXML_INCLUDE_DIR}") -endif() - -set(zynaddsubfx_misc_SRCS - Bank.cpp - Config.cpp - Dump.cpp - Master.cpp - Microtonal.cpp - Part.cpp - Util.cpp - QtXmlWrapper.cpp -) - -if (LASH_FOUND) - set(zynaddsubfx_misc_SRCS ${zynaddsubfx_misc_SRCS} LASHClient.cpp) -endif() - -add_library(zynaddsubfx_misc STATIC - ${zynaddsubfx_misc_SRCS} - ) - -target_link_libraries(zynaddsubfx_misc zynaddsubfx_output) diff --git a/plugins/zynaddsubfx/src/Misc/Config.cpp b/plugins/zynaddsubfx/src/Misc/Config.cpp deleted file mode 100644 index a58f64dc6..000000000 --- a/plugins/zynaddsubfx/src/Misc/Config.cpp +++ /dev/null @@ -1,409 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Config.cpp - Configuration file functions - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include -#include - -#ifdef OS_WINDOWS -#include -#include -#endif - -#include "Config.h" -#include "XMLwrapper.h" - -Config::Config() : - workingDir( NULL ) -{} -void Config::init() -{ - maxstringsize = MAX_STRING_SIZE; //for ui - //defaults - cfg.SampleRate = 44100; - cfg.SoundBufferSize = 256; - cfg.OscilSize = 1024; - cfg.SwapStereo = 0; - - cfg.LinuxOSSWaveOutDev = new char[MAX_STRING_SIZE]; - snprintf(cfg.LinuxOSSWaveOutDev, MAX_STRING_SIZE, "/dev/dsp"); - cfg.LinuxOSSSeqInDev = new char[MAX_STRING_SIZE]; - snprintf(cfg.LinuxOSSSeqInDev, MAX_STRING_SIZE, "/dev/sequencer"); - - cfg.DumpFile = new char[MAX_STRING_SIZE]; - snprintf(cfg.DumpFile, MAX_STRING_SIZE, "zynaddsubfx_dump.txt"); - - cfg.WindowsWaveOutId = 0; - cfg.WindowsMidiInId = 0; - - cfg.BankUIAutoClose = 0; - cfg.DumpNotesToFile = 0; - cfg.DumpAppend = 1; - - cfg.GzipCompression = 3; - - cfg.Interpolation = 0; - cfg.CheckPADsynth = 1; - - cfg.UserInterfaceMode = 0; - cfg.VirKeybLayout = 1; - winwavemax = 1; - winmidimax = 1; -//try to find out how many input midi devices are there -#ifdef WINMIDIIN - winmidimax = midiInGetNumDevs(); - if(winmidimax == 0) - winmidimax = 1; -#endif - winmididevices = new winmidionedevice[winmidimax]; - for(int i = 0; i < winmidimax; i++) { - winmididevices[i].name = new char[MAX_STRING_SIZE]; - for(int j = 0; j < MAX_STRING_SIZE; j++) - winmididevices[i].name[j] = '\0'; - } - - -//get the midi input devices name -#ifdef WINMIDIIN - MIDIINCAPS midiincaps; - for(int i = 0; i < winmidimax; i++) - if(!midiInGetDevCaps(i, &midiincaps, sizeof(MIDIINCAPS))) - snprintf(winmididevices[i].name, - MAX_STRING_SIZE, - "%s", - midiincaps.szPname); - ; -#endif - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) - cfg.bankRootDirList[i] = NULL; - cfg.currentBankDir = new char[MAX_STRING_SIZE]; - sprintf(cfg.currentBankDir, "./testbnk"); - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) - cfg.presetsDirList[i] = NULL; - - char filename[MAX_STRING_SIZE]; - getConfigFileName(filename, MAX_STRING_SIZE); - readConfig(filename); - - if(cfg.bankRootDirList[0] == NULL) { -#if defined(OS_LINUX) - //banks - cfg.bankRootDirList[0] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[0], "~/banks"); - - cfg.bankRootDirList[1] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[1], "./"); - - cfg.bankRootDirList[2] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[2], "/usr/share/zynaddsubfx/banks"); - - cfg.bankRootDirList[3] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[3], "/usr/local/share/zynaddsubfx/banks"); - - cfg.bankRootDirList[4] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[4], "../banks"); - - cfg.bankRootDirList[5] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[5], "banks"); - -#else - //banks - cfg.bankRootDirList[0] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[0], "./"); - -#ifdef VSTAUDIOOUT - cfg.bankRootDirList[1] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[1], "c:/Program Files/ZynAddSubFX/banks"); -#else - cfg.bankRootDirList[1] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[1], "../banks"); -#endif - cfg.bankRootDirList[2] = new char[MAX_STRING_SIZE]; - sprintf(cfg.bankRootDirList[2], "banks"); - -#endif - } - - if(cfg.presetsDirList[0] == NULL) { -#if defined(OS_LINUX) - //presets - cfg.presetsDirList[0] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[0], "./"); - - cfg.presetsDirList[1] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[1], "../presets"); - - cfg.presetsDirList[2] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[2], "presets"); - - cfg.presetsDirList[3] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[3], "/usr/share/zynaddsubfx/presets"); - - cfg.presetsDirList[4] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[4], "/usr/local/share/zynaddsubfx/presets"); - -#else - //presets - cfg.presetsDirList[0] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[0], "./"); - -#ifdef VSTAUDIOOUT - cfg.presetsDirList[1] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[1], "c:/Program Files/ZynAddSubFX/presets"); -#else - cfg.presetsDirList[1] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[1], "../presets"); -#endif - - cfg.presetsDirList[2] = new char[MAX_STRING_SIZE]; - sprintf(cfg.presetsDirList[2], "presets"); -#endif - } -} - -Config::~Config() -{ - delete [] cfg.LinuxOSSWaveOutDev; - delete [] cfg.LinuxOSSSeqInDev; - delete [] cfg.DumpFile; - - for(int i = 0; i < winmidimax; i++) - delete [] winmididevices[i].name; - delete [] winmididevices; -} - - -void Config::save() -{ - char filename[MAX_STRING_SIZE]; - getConfigFileName(filename, MAX_STRING_SIZE); - saveConfig(filename); -} - -void Config::clearbankrootdirlist() -{ - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { - if(cfg.bankRootDirList[i] == NULL) - delete (cfg.bankRootDirList[i]); - cfg.bankRootDirList[i] = NULL; - } -} - -void Config::clearpresetsdirlist() -{ - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { - if(cfg.presetsDirList[i] == NULL) - delete (cfg.presetsDirList[i]); - cfg.presetsDirList[i] = NULL; - } -} - -void Config::readConfig(const char *filename) -{ - XMLwrapper *xmlcfg = new XMLwrapper(); - if(xmlcfg->loadXMLfile(filename) < 0) - return; - if(xmlcfg->enterbranch("CONFIGURATION")) { - cfg.SampleRate = xmlcfg->getpar("sample_rate", - cfg.SampleRate, - 4000, - 1024000); - cfg.SoundBufferSize = xmlcfg->getpar("sound_buffer_size", - cfg.SoundBufferSize, - 16, - 8192); - cfg.OscilSize = xmlcfg->getpar("oscil_size", - cfg.OscilSize, - MAX_AD_HARMONICS * 2, - 131072); - cfg.SwapStereo = xmlcfg->getpar("swap_stereo", - cfg.SwapStereo, - 0, - 1); - cfg.BankUIAutoClose = xmlcfg->getpar("bank_window_auto_close", - cfg.BankUIAutoClose, - 0, - 1); - - cfg.DumpNotesToFile = xmlcfg->getpar("dump_notes_to_file", - cfg.DumpNotesToFile, - 0, - 1); - cfg.DumpAppend = xmlcfg->getpar("dump_append", - cfg.DumpAppend, - 0, - 1); - xmlcfg->getparstr("dump_file", cfg.DumpFile, MAX_STRING_SIZE); - - cfg.GzipCompression = xmlcfg->getpar("gzip_compression", - cfg.GzipCompression, - 0, - 9); - - xmlcfg->getparstr("bank_current", cfg.currentBankDir, MAX_STRING_SIZE); - cfg.Interpolation = xmlcfg->getpar("interpolation", - cfg.Interpolation, - 0, - 1); - - cfg.CheckPADsynth = xmlcfg->getpar("check_pad_synth", - cfg.CheckPADsynth, - 0, - 1); - - - cfg.UserInterfaceMode = xmlcfg->getpar("user_interface_mode", - cfg.UserInterfaceMode, - 0, - 2); - cfg.VirKeybLayout = xmlcfg->getpar("virtual_keyboard_layout", - cfg.VirKeybLayout, - 0, - 10); - - //get bankroot dirs - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { - if(xmlcfg->enterbranch("BANKROOT", i)) { - cfg.bankRootDirList[i] = new char[MAX_STRING_SIZE]; - xmlcfg->getparstr("bank_root", - cfg.bankRootDirList[i], - MAX_STRING_SIZE); - xmlcfg->exitbranch(); - } - } - - //get preset root dirs - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { - if(xmlcfg->enterbranch("PRESETSROOT", i)) { - cfg.presetsDirList[i] = new char[MAX_STRING_SIZE]; - xmlcfg->getparstr("presets_root", - cfg.presetsDirList[i], - MAX_STRING_SIZE); - xmlcfg->exitbranch(); - } - } - - //linux stuff - xmlcfg->getparstr("linux_oss_wave_out_dev", - cfg.LinuxOSSWaveOutDev, - MAX_STRING_SIZE); - xmlcfg->getparstr("linux_oss_seq_in_dev", - cfg.LinuxOSSSeqInDev, - MAX_STRING_SIZE); - - //windows stuff - cfg.WindowsWaveOutId = xmlcfg->getpar("windows_wave_out_id", - cfg.WindowsWaveOutId, - 0, - winwavemax); - cfg.WindowsMidiInId = xmlcfg->getpar("windows_midi_in_id", - cfg.WindowsMidiInId, - 0, - winmidimax); - - xmlcfg->exitbranch(); - } - delete (xmlcfg); - - cfg.OscilSize = (int) pow(2, ceil(log(cfg.OscilSize - 1.0) / log(2.0))); -} - -void Config::saveConfig(const char *filename) -{ - XMLwrapper *xmlcfg = new XMLwrapper(); - - xmlcfg->beginbranch("CONFIGURATION"); - - xmlcfg->addpar("sample_rate", cfg.SampleRate); - xmlcfg->addpar("sound_buffer_size", cfg.SoundBufferSize); - xmlcfg->addpar("oscil_size", cfg.OscilSize); - xmlcfg->addpar("swap_stereo", cfg.SwapStereo); - xmlcfg->addpar("bank_window_auto_close", cfg.BankUIAutoClose); - - xmlcfg->addpar("dump_notes_to_file", cfg.DumpNotesToFile); - xmlcfg->addpar("dump_append", cfg.DumpAppend); - xmlcfg->addparstr("dump_file", cfg.DumpFile); - - xmlcfg->addpar("gzip_compression", cfg.GzipCompression); - - xmlcfg->addpar("check_pad_synth", cfg.CheckPADsynth); - - xmlcfg->addparstr("bank_current", cfg.currentBankDir); - - xmlcfg->addpar("user_interface_mode", cfg.UserInterfaceMode); - xmlcfg->addpar("virtual_keyboard_layout", cfg.VirKeybLayout); - - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) - if(cfg.bankRootDirList[i] != NULL) { - xmlcfg->beginbranch("BANKROOT", i); - xmlcfg->addparstr("bank_root", cfg.bankRootDirList[i]); - xmlcfg->endbranch(); - } - ; - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) - if(cfg.presetsDirList[i] != NULL) { - xmlcfg->beginbranch("PRESETSROOT", i); - xmlcfg->addparstr("presets_root", cfg.presetsDirList[i]); - xmlcfg->endbranch(); - } - ; - - xmlcfg->addpar("interpolation", cfg.Interpolation); - - //linux stuff - xmlcfg->addparstr("linux_oss_wave_out_dev", cfg.LinuxOSSWaveOutDev); - xmlcfg->addparstr("linux_oss_seq_in_dev", cfg.LinuxOSSSeqInDev); - - //windows stuff - xmlcfg->addpar("windows_wave_out_id", cfg.WindowsWaveOutId); - xmlcfg->addpar("windows_midi_in_id", cfg.WindowsMidiInId); - - xmlcfg->endbranch(); - - int tmp = cfg.GzipCompression; - cfg.GzipCompression = 0; - xmlcfg->saveXMLfile(filename); - cfg.GzipCompression = tmp; - - delete (xmlcfg); -} - -void Config::getConfigFileName(char *name, int namesize) -{ - name[0] = 0; - if( workingDir != NULL ) - { - snprintf(name, namesize, "%s%s", workingDir, ".zynaddsubfxXML.cfg"); - } - else - { -#ifdef OS_LINUX - snprintf(name, namesize, "%s%s", getenv("HOME"), "/.zynaddsubfxXML.cfg"); -#else - snprintf(name, namesize, "%s", "zynaddsubfxXML.cfg"); -#endif - } -} - diff --git a/plugins/zynaddsubfx/src/Misc/Config.h b/plugins/zynaddsubfx/src/Misc/Config.h deleted file mode 100644 index 45688addc..000000000 --- a/plugins/zynaddsubfx/src/Misc/Config.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Config.h - Configuration file functions - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef CONFIG_H -#define CONFIG_H -#include "../globals.h" -#define MAX_STRING_SIZE 4000 -#define MAX_BANK_ROOT_DIRS 100 - -/**Configuration file functions*/ -class Config -{ - public: - /** Constructor*/ - Config(); - /** Destructor*/ - ~Config(); - struct { - char *LinuxOSSWaveOutDev, *LinuxOSSSeqInDev; - int SampleRate, SoundBufferSize, OscilSize, SwapStereo; - int WindowsWaveOutId, WindowsMidiInId; - int BankUIAutoClose; - int DumpNotesToFile, DumpAppend; - int GzipCompression; - int Interpolation; - char *DumpFile; - char *bankRootDirList[MAX_BANK_ROOT_DIRS], *currentBankDir; - char *presetsDirList[MAX_BANK_ROOT_DIRS]; - int CheckPADsynth; - int UserInterfaceMode; - int VirKeybLayout; - } cfg; - int winwavemax, winmidimax; //number of wave/midi devices on Windows - int maxstringsize; - - char * workingDir; - - struct winmidionedevice { - char *name; - }; - winmidionedevice *winmididevices; - - void clearbankrootdirlist(); - void clearpresetsdirlist(); - void init(); - void save(); - - private: - void readConfig(const char *filename); - void saveConfig(const char *filename); - void getConfigFileName(char *name, int namesize); -}; -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/Control.h b/plugins/zynaddsubfx/src/Misc/Control.h deleted file mode 100644 index 297e6f0da..000000000 --- a/plugins/zynaddsubfx/src/Misc/Control.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Control.h - Defines a variable that can be controled from a frontend - - Copyright (C) 2009 Harald Hvaal - Author: Harald Hvaal - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _CONTROL_H_ -#define _CONTROL_H_ - -#include - -class Control -{ - public: - /** - * The parent is the logical owner of this control. Parent should only - * be null for the root node. - * The id is a string uniquely identifying this control within the - * context of the parent control. No spaces or dots are allowed in this - * id. - * Children id's are denoted by ., so that one - * can refer to any control in the hierarchy by separating them with - * dots. Example: Main.AddSynth.FrequencyLFO.Amplitude - */ - Control(Control *parent, string id); - - /** - * Will recursively get the XML representation for all the subcontrols. - * Used for saving to file and copy-pasting settings - */ - string getXMLRepresentation(); - - /** - * Set the value of this (and possibly subcomponents as well) based on - * a xml description. - */ - void restoreFromXML(string xml); - - /** - * Register a controluser. This will cause this user to be notified - * whenever the contents of the control changes. - */ - void registerControlUser(ControlUser *user); - - /** - * This should return a string representation of the controls internal - * value - */ - virtual string getStringRepresentation() = 0; -}; - -class FloatControl:public Control -{ - public: - /** - * Set the value of this control. If the ControlUser variable is set, - * then this user will not be updated with the new value. This is to - * avoid setting a value being set back to the source that set it - * (which would be redundant, or possibly causing infinite setValue - * loops). - * NOTE: this function is thread-safe (using a mutex internally) - */ - void setValue(float value, ControlUser *user = NULL); - - /** - * Reimplemented from Control - */ - virtual string getStringRepresentation(); - - float value(); -}; - -class ControlUser -{ - public: - /** - * Pure virtual method, to notify the controluser that the value has - * been changed internally, and needs to be read again. - */ - virtual void controlUpdated(Control *control) = 0; -}; - -#endif /* _CONTROL_H_ */ - diff --git a/plugins/zynaddsubfx/src/Misc/Dump.cpp b/plugins/zynaddsubfx/src/Misc/Dump.cpp deleted file mode 100644 index 492cf57ed..000000000 --- a/plugins/zynaddsubfx/src/Misc/Dump.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.cpp - It dumps the notes to a text file - - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include -#include "Util.h" -#include "Dump.h" - -Dump dump; - -Dump::Dump() -{ - file = NULL; - tick = 0; - k = 0; - keyspressed = 0; -} - -Dump::~Dump() -{ - if(file != NULL) { - double duration = (double)tick * (double) SOUND_BUFFER_SIZE - / (double) SAMPLE_RATE; - fprintf( - file, - "\n# statistics: duration = %d seconds; keyspressed = %d\n\n\n\n", - (int) duration, - keyspressed); - fclose(file); - } -} - -void Dump::startnow() -{ - if(file != NULL) - return; //the file is already open - - if(config.cfg.DumpNotesToFile != 0) { - if(config.cfg.DumpAppend != 0) - file = fopen(config.cfg.DumpFile, "a"); - else - file = fopen(config.cfg.DumpFile, "w"); - if(file == NULL) - return; - if(config.cfg.DumpAppend != 0) - fprintf(file, "%s", "#************************************\n"); - - time_t tm = time(NULL); - - fprintf(file, "#date/time = %s\n", ctime(&tm)); - fprintf(file, - "#1 tick = %g milliseconds\n", - SOUND_BUFFER_SIZE * 1000.0 / SAMPLE_RATE); - fprintf(file, "SAMPLERATE = %d\n", SAMPLE_RATE); - fprintf(file, "TICKSIZE = %d #samples\n", SOUND_BUFFER_SIZE); - fprintf(file, "\n\nSTART\n"); - } -} - -void Dump::inctick() -{ - tick++; -} - - -void Dump::dumpnote(char chan, char note, char vel) -{ - if(file == NULL) - return; - if(note == 0) - return; - if(vel == 0) - fprintf(file, "n %d -> %d %d \n", tick, chan, note); //note off - else - fprintf(file, "N %d -> %d %d %d \n", tick, chan, note, vel); //note on - - if(vel != 0) - keyspressed++; -#ifndef JACKAUDIOOUT - if(k++ > 25) { - fflush(file); - k = 0; - } -#endif -} - -void Dump::dumpcontroller(char chan, unsigned int type, int par) -{ - if(file == NULL) - return; - switch(type) { - case C_pitchwheel: - fprintf(file, "P %d -> %d %d\n", tick, chan, par); - break; - default: - fprintf(file, "C %d -> %d %d %d\n", tick, chan, type, par); - break; - } -#ifndef JACKAUDIOOUT - if(k++ > 25) { - fflush(file); - k = 0; - } -#endif -} - diff --git a/plugins/zynaddsubfx/src/Misc/Dump.h b/plugins/zynaddsubfx/src/Misc/Dump.h deleted file mode 100644 index 392fd407b..000000000 --- a/plugins/zynaddsubfx/src/Misc/Dump.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.h - It dumps the notes to a text file - - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef DUMP_H -#define DUMP_H - -#include - -/**Object used to dump the notes into a text file - * \todo see if this object should have knowledge about the file - * that it will write to - * \todo upgrade from stdio to iostream*/ -class Dump -{ - public: - /**Constructor*/ - Dump(); - /**Destructor - * Closes the dumpfile*/ - ~Dump(); - /**Open dumpfile and prepare it for dumps - * \todo see if this fits better in the constructor*/ - void startnow(); - /**Tick the timestamp*/ - void inctick(); - /**Dump Note to dumpfile - * @param chan The channel of the note - * @param note The note - * @param vel The velocity of the note*/ - void dumpnote(char chan, char note, char vel); - /** Dump the Controller - * @param chan The channel of the Controller - * @param type The type - * @param par The value of the controller - * \todo figure out what type is exactly meaning*/ - void dumpcontroller(char chan, unsigned int type, int par); - - private: - FILE *file; - int tick; - int k; //This appears to be a constant used to flush the file - //periodically when JACK is used - int keyspressed; -}; -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/LASHClient.cpp b/plugins/zynaddsubfx/src/Misc/LASHClient.cpp deleted file mode 100644 index 292037791..000000000 --- a/plugins/zynaddsubfx/src/Misc/LASHClient.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LASHClient.cpp - LASH support - Copyright (C) 2006-2009 Lars Luthman - Author: Lars Luthman - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include - -#include "LASHClient.h" - - -LASHClient::LASHClient(int *argc, char ***argv) -{ - client = lash_init(lash_extract_args(argc, argv), "ZynAddSubFX", - LASH_Config_File, LASH_PROTOCOL(2, 0)); -} - - -void LASHClient::setalsaid(int id) -{ - if(lash_enabled(client)) - if(id != -1) - lash_alsa_client_id(client, id); -} - - -void LASHClient::setjackname(const char *name) -{ - if(lash_enabled(client)) - if(name != NULL) { - lash_jack_client_name(client, name); - - lash_event_t *event = lash_event_new_with_type(LASH_Client_Name); - lash_event_set_string(event, name); - lash_send_event(client, event); - } -} - - -LASHClient::Event LASHClient::checkevents(std::string &filename) -{ - if(!lash_enabled(client)) - return NoEvent; - - Event received = NoEvent; - lash_event_t *event; - while(event = lash_get_event(client)) { - // save - if(lash_event_get_type(event) == LASH_Save_File) { - std::cerr << "LASH event: LASH_Save_File" << std::endl; - filename = std::string(lash_event_get_string(event)) - + "/master.xmz"; - received = Save; - break; - } - // restore - else - if(lash_event_get_type(event) == LASH_Restore_File) { - std::cerr << "LASH event: LASH_Restore_File" << std::endl; - filename = std::string(lash_event_get_string(event)) - + "/master.xmz"; - received = Restore; - break; - } - // quit - else - if(lash_event_get_type(event) == LASH_Quit) { - std::cerr << "LASH event: LASH_Quit" << std::endl; - received = Quit; - break; - } - - lash_event_destroy(event); - } - return received; -} - - -void LASHClient::confirmevent(Event event) -{ - if(event == Save) - lash_send_event(client, lash_event_new_with_type(LASH_Save_File)); - else - if(event == Restore) - lash_send_event(client, lash_event_new_with_type(LASH_Restore_File)); -} - diff --git a/plugins/zynaddsubfx/src/Misc/LASHClient.h b/plugins/zynaddsubfx/src/Misc/LASHClient.h deleted file mode 100644 index cf50295da..000000000 --- a/plugins/zynaddsubfx/src/Misc/LASHClient.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LASHClient.h - LASH support - Copyright (C) 2006-2009 Lars Luthman - Author: Lars Luthman - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef LASHClient_h -#define LASHClient_h - -#include -#include -#include - - -/** This class wraps up some functions for initialising and polling - * the LASH daemon. - * \todo fix indentation nonconformism - * \todo see why there is no destructor*/ -class LASHClient -{ - public: - /**Enum to represent the LASH events that are currently handled*/ - enum Event { - Save, - Restore, - Quit, - NoEvent - }; - - /** Constructor - * @param argc number of arguments - * @param argv the text arguments*/ - LASHClient(int *argc, char ***argv); - - /**set the ALSA id - * @param id new ALSA id*/ - void setalsaid(int id); - /**Set the JACK name - * @param name the new name*/ - void setjackname(const char *name); - Event checkevents(std::string &filename); - void confirmevent(Event event); - - private: - - lash_client_t *client; -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/Master.cpp b/plugins/zynaddsubfx/src/Misc/Master.cpp deleted file mode 100644 index fa5e1b003..000000000 --- a/plugins/zynaddsubfx/src/Misc/Master.cpp +++ /dev/null @@ -1,828 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Master.cpp - It sends Midi Messages to Parts, receives samples from parts, - process them with system/insertion effects and mix them - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Master.h" - -#include -#include -#include - -#include - -Master::Master() -{ - swaplr = 0; - - pthread_mutex_init(&mutex, NULL); - fft = new FFTwrapper(OSCIL_SIZE); - - tmpmixl = new REALTYPE[SOUND_BUFFER_SIZE]; - tmpmixr = new REALTYPE[SOUND_BUFFER_SIZE]; - audiooutl = new REALTYPE[SOUND_BUFFER_SIZE]; - audiooutr = new REALTYPE[SOUND_BUFFER_SIZE]; - - ksoundbuffersample = -1; //this is only time when this is -1; this means that the GetAudioOutSamples was never called - ksoundbuffersamplelow = 0.0; - oldsamplel = 0.0; - oldsampler = 0.0; - shutup = 0; - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { - vuoutpeakpart[npart] = 1e-9; - fakepeakpart[npart] = 0; - } - - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - audiooutl[i] = 0.0; - audiooutr[i] = 0.0; - } - - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) - part[npart] = new Part(µtonal, fft, &mutex); - - - - //Insertion Effects init - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) - insefx[nefx] = new EffectMgr(1, &mutex); - - //System Effects init - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) - sysefx[nefx] = new EffectMgr(0, &mutex); - ; - - - defaults(); -} - -void Master::defaults() -{ - volume = 1.0; - setPvolume(80); - setPkeyshift(64); - - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { - part[npart]->defaults(); - part[npart]->Prcvchn = npart % NUM_MIDI_CHANNELS; - } - - partonoff(0, 1); //enable the first part - - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { - insefx[nefx]->defaults(); - Pinsparts[nefx] = -1; - } - - //System Effects init - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { - sysefx[nefx]->defaults(); - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) - //if (nefx==0) setPsysefxvol(npart,nefx,64); - //else - setPsysefxvol(npart, nefx, 0); - ; - for(int nefxto = 0; nefxto < NUM_SYS_EFX; nefxto++) - setPsysefxsend(nefx, nefxto, 0); - } - -// sysefx[0]->changeeffect(1); - microtonal.defaults(); - ShutUp(); -} - -/* - * Note On Messages (velocity=0 for NoteOff) - */ -void Master::NoteOn(unsigned char chan, - unsigned char note, - unsigned char velocity) -{ - dump.dumpnote(chan, note, velocity); - - noteon(chan, note, velocity); -} - -/* - * Internal Note On (velocity=0 for NoteOff) - */ -void Master::noteon(unsigned char chan, - unsigned char note, - unsigned char velocity) -{ - int npart; - if(velocity != 0) { - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) { - if(chan == part[npart]->Prcvchn) { - fakepeakpart[npart] = velocity * 2; - if(part[npart]->Penabled != 0) - part[npart]->NoteOn(note, velocity, keyshift); - } - } - } - else - this->NoteOff(chan, note); - ; - HDDRecorder.triggernow(); -} - -/* - * Note Off Messages - */ -void Master::NoteOff(unsigned char chan, unsigned char note) -{ - dump.dumpnote(chan, note, 0); - - noteoff(chan, note); -} - -/* - * Internal Note Off - */ -void Master::noteoff(unsigned char chan, unsigned char note) -{ - int npart; - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) - if((chan == part[npart]->Prcvchn) && (part[npart]->Penabled != 0)) - part[npart]->NoteOff(note); - ; -} - -/* - * Controllers - */ -void Master::SetController(unsigned char chan, unsigned int type, int par) -{ - dump.dumpcontroller(chan, type, par); - - setcontroller(chan, type, par); -} - -/* - * Internal Controllers - */ -void Master::setcontroller(unsigned char chan, unsigned int type, int par) -{ - if((type == C_dataentryhi) || (type == C_dataentrylo) - || (type == C_nrpnhi) || (type == C_nrpnlo)) { //Process RPN and NRPN by the Master (ignore the chan) - ctl.setparameternumber(type, par); - - int parhi = -1, parlo = -1, valhi = -1, vallo = -1; - if(ctl.getnrpn(&parhi, &parlo, &valhi, &vallo) == 0) //this is NRPN - //fprintf(stderr,"rcv. NRPN: %d %d %d %d\n",parhi,parlo,valhi,vallo); - switch(parhi) { - case 0x04: //System Effects - if(parlo < NUM_SYS_EFX) - sysefx[parlo]->seteffectpar_nolock(valhi, vallo); - ; - break; - case 0x08: //Insertion Effects - if(parlo < NUM_INS_EFX) - insefx[parlo]->seteffectpar_nolock(valhi, vallo); - ; - break; - } - ; - } - else { //other controllers - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) //Send the controller to all part assigned to the channel - if((chan == part[npart]->Prcvchn) && (part[npart]->Penabled != 0)) - part[npart]->SetController(type, par); - ; - - if(type == C_allsoundsoff) { //cleanup insertion/system FX - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) - sysefx[nefx]->cleanup(); - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - insefx[nefx]->cleanup(); - } - } -} - - -/* - * Enable/Disable a part - */ -void Master::partonoff(int npart, int what) -{ - if(npart >= NUM_MIDI_PARTS) - return; - if(what == 0) { //disable part - fakepeakpart[npart] = 0; - part[npart]->Penabled = 0; - part[npart]->cleanup(); - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { - if(Pinsparts[nefx] == npart) - insefx[nefx]->cleanup(); - ; - } - } - else { //enabled - part[npart]->Penabled = 1; - fakepeakpart[npart] = 0; - } -} - -/* - * Master audio out (the final sound) - */ -void Master::AudioOut(REALTYPE *outl, REALTYPE *outr) -{ - int i, npart, nefx; - - /* //test!!!!!!!!!!!!! se poate bloca aici (mutex) - if (seq.play){ - int type,par1,par2,again,midichan; - int ntrack=1; - // do{ - again=seq.getevent(ntrack,&midichan,&type,&par1,&par2); - if (type>0) { - // printf("aaa\n"); - - if (type==1){//note_on or note_off - if (par2!=0) NoteOn(midichan,par1,par2); - else NoteOff(midichan,par1); - }; - }; - // } while (again); - }; - */ - - -// printf("zzzz\n"); - - - //Swaps the Left channel with Right Channel (if it is asked for) - if(swaplr != 0) { - REALTYPE *tmp = outl; - outl = outr; - outr = tmp; - } - - //clean up the output samples - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] = 0.0; - outr[i] = 0.0; - } - - //Compute part samples and store them part[npart]->partoutl,partoutr - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) - if(part[npart]->Penabled != 0) - part[npart]->ComputePartSmps(); - - //Insertion effects - for(nefx = 0; nefx < NUM_INS_EFX; nefx++) { - if(Pinsparts[nefx] >= 0) { - int efxpart = Pinsparts[nefx]; - if(part[efxpart]->Penabled != 0) - insefx[nefx]->out(part[efxpart]->partoutl, - part[efxpart]->partoutr); - } - } - - - //Apply the part volumes and pannings (after insertion effects) - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) { - if(part[npart]->Penabled == 0) - continue; - - REALTYPE newvol_l = part[npart]->volume; - REALTYPE newvol_r = part[npart]->volume; - REALTYPE oldvol_l = part[npart]->oldvolumel; - REALTYPE oldvol_r = part[npart]->oldvolumer; - REALTYPE pan = part[npart]->panning; - if(pan < 0.5) - newvol_l *= pan * 2.0; - else - newvol_r *= (1.0 - pan) * 2.0; - - if(ABOVE_AMPLITUDE_THRESHOLD(oldvol_l, newvol_l) - || ABOVE_AMPLITUDE_THRESHOLD(oldvol_r, newvol_r)) { //the volume or the panning has changed and needs interpolation - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE vol_l = INTERPOLATE_AMPLITUDE(oldvol_l, - newvol_l, - i, - SOUND_BUFFER_SIZE); - REALTYPE vol_r = INTERPOLATE_AMPLITUDE(oldvol_r, - newvol_r, - i, - SOUND_BUFFER_SIZE); - part[npart]->partoutl[i] *= vol_l; - part[npart]->partoutr[i] *= vol_r; - } - part[npart]->oldvolumel = newvol_l; - part[npart]->oldvolumer = newvol_r; - } - else { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //the volume did not changed - part[npart]->partoutl[i] *= newvol_l; - part[npart]->partoutr[i] *= newvol_r; - } - } - } - - - //System effects - for(nefx = 0; nefx < NUM_SYS_EFX; nefx++) { - if(sysefx[nefx]->geteffect() == 0) - continue; //the effect is disabled - - //Clean up the samples used by the system effects - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmpmixl[i] = 0.0; - tmpmixr[i] = 0.0; - } - - //Mix the channels according to the part settings about System Effect - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) { - //skip if the part has no output to effect - if(Psysefxvol[nefx][npart] == 0) - continue; - - //skip if the part is disabled - if(part[npart]->Penabled == 0) - continue; - - //the output volume of each part to system effect - REALTYPE vol = sysefxvol[nefx][npart]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmpmixl[i] += part[npart]->partoutl[i] * vol; - tmpmixr[i] += part[npart]->partoutr[i] * vol; - } - } - - // system effect send to next ones - for(int nefxfrom = 0; nefxfrom < nefx; nefxfrom++) { - if(Psysefxsend[nefxfrom][nefx] != 0) { - REALTYPE v = sysefxsend[nefxfrom][nefx]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmpmixl[i] += sysefx[nefxfrom]->efxoutl[i] * v; - tmpmixr[i] += sysefx[nefxfrom]->efxoutr[i] * v; - } - } - } - - sysefx[nefx]->out(tmpmixl, tmpmixr); - - //Add the System Effect to sound output - REALTYPE outvol = sysefx[nefx]->sysefxgetvolume(); - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] += tmpmixl[i] * outvol; - outr[i] += tmpmixr[i] * outvol; - } - } - - //Mix all parts - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //the volume did not changed - outl[i] += part[npart]->partoutl[i]; - outr[i] += part[npart]->partoutr[i]; - } - } - - //Insertion effects for Master Out - for(nefx = 0; nefx < NUM_INS_EFX; nefx++) - if(Pinsparts[nefx] == -2) - insefx[nefx]->out(outl, outr); - ; - - //Master Volume - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] *= volume; - outr[i] *= volume; - } - - //Peak computation (for vumeters) - vuoutpeakl = 1e-12; - vuoutpeakr = 1e-12; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - if(fabs(outl[i]) > vuoutpeakl) - vuoutpeakl = fabs(outl[i]); - if(fabs(outr[i]) > vuoutpeakr) - vuoutpeakr = fabs(outr[i]); - } - if((vuoutpeakl > 1.0) || (vuoutpeakr > 1.0)) - vuclipped = 1; - if(vumaxoutpeakl < vuoutpeakl) - vumaxoutpeakl = vuoutpeakl; - if(vumaxoutpeakr < vuoutpeakr) - vumaxoutpeakr = vuoutpeakr; - - //RMS Peak computation (for vumeters) - vurmspeakl = 1e-12; - vurmspeakr = 1e-12; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - vurmspeakl += outl[i] * outl[i]; - vurmspeakr += outr[i] * outr[i]; - } - vurmspeakl = sqrt(vurmspeakl / SOUND_BUFFER_SIZE); - vurmspeakr = sqrt(vurmspeakr / SOUND_BUFFER_SIZE); - - //Part Peak computation (for Part vumeters or fake part vumeters) - for(npart = 0; npart < NUM_MIDI_PARTS; npart++) { - vuoutpeakpart[npart] = 1.0e-12; - if(part[npart]->Penabled != 0) { - REALTYPE *outl = part[npart]->partoutl, - *outr = part[npart]->partoutr; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmp = fabs(outl[i] + outr[i]); - if(tmp > vuoutpeakpart[npart]) - vuoutpeakpart[npart] = tmp; - } - vuoutpeakpart[npart] *= volume; - } - else - if(fakepeakpart[npart] > 1) - fakepeakpart[npart]--; - ; - } - - - //Shutup if it is asked (with fade-out) - if(shutup != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmp = - (SOUND_BUFFER_SIZE - i) / (REALTYPE) SOUND_BUFFER_SIZE; - outl[i] *= tmp; - outr[i] *= tmp; - } - ShutUp(); - } - - //update the LFO's time - LFOParams::time++; - - if(HDDRecorder.recording()) - HDDRecorder.recordbuffer(outl, outr); - dump.inctick(); -} - -void Master::GetAudioOutSamples(int nsamples, - int samplerate, - REALTYPE *outl, - REALTYPE *outr) -{ - if(ksoundbuffersample == -1) { //first time - AudioOut(&audiooutl[0], &audiooutr[0]); - ksoundbuffersample = 0; - } - - - if(samplerate == SAMPLE_RATE) { //no resample - int ksample = 0; - while(ksample < nsamples) { - outl[ksample] = audiooutl[ksoundbuffersample]; - outr[ksample] = audiooutr[ksoundbuffersample]; - - ksample++; - ksoundbuffersample++; - if(ksoundbuffersample >= SOUND_BUFFER_SIZE) { - AudioOut(&audiooutl[0], &audiooutr[0]); - ksoundbuffersample = 0; - } - } - } - else { //Resample - int ksample = 0; - REALTYPE srinc = SAMPLE_RATE / (REALTYPE)samplerate; - - while(ksample < nsamples) { - if(ksoundbuffersample != 0) { - outl[ksample] = audiooutl[ksoundbuffersample] - * ksoundbuffersamplelow - + audiooutl[ksoundbuffersample - - 1] * (1.0 - ksoundbuffersamplelow); - outr[ksample] = audiooutr[ksoundbuffersample] - * ksoundbuffersamplelow - + audiooutr[ksoundbuffersample - - 1] * (1.0 - ksoundbuffersamplelow); - } - else { - outl[ksample] = audiooutl[ksoundbuffersample] - * ksoundbuffersamplelow - + oldsamplel * (1.0 - ksoundbuffersamplelow); - outr[ksample] = audiooutr[ksoundbuffersample] - * ksoundbuffersamplelow - + oldsampler * (1.0 - ksoundbuffersamplelow); - } - - ksample++; - - ksoundbuffersamplelow += srinc; - if(ksoundbuffersamplelow >= 1.0) { - ksoundbuffersample += (int) floor(ksoundbuffersamplelow); - ksoundbuffersamplelow = ksoundbuffersamplelow - floor( - ksoundbuffersamplelow); - } - - if(ksoundbuffersample >= SOUND_BUFFER_SIZE) { - oldsamplel = audiooutl[SOUND_BUFFER_SIZE - 1]; - oldsampler = audiooutr[SOUND_BUFFER_SIZE - 1]; - AudioOut(&audiooutl[0], &audiooutr[0]); - ksoundbuffersample = 0; - } - } - } -} - - -Master::~Master() -{ - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) - delete part[npart]; - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) - delete insefx[nefx]; - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) - delete sysefx[nefx]; - - delete [] audiooutl; - delete [] audiooutr; - delete [] tmpmixl; - delete [] tmpmixr; - delete (fft); - - pthread_mutex_destroy(&mutex); -} - - -/* - * Parameter control - */ -void Master::setPvolume(char Pvolume_) -{ - Pvolume = Pvolume_; - volume = dB2rap((Pvolume - 96.0) / 96.0 * 40.0); -} - -void Master::setPkeyshift(char Pkeyshift_) -{ - Pkeyshift = Pkeyshift_; - keyshift = (int)Pkeyshift - 64; -} - - -void Master::setPsysefxvol(int Ppart, int Pefx, char Pvol) -{ - Psysefxvol[Pefx][Ppart] = Pvol; - sysefxvol[Pefx][Ppart] = pow(0.1, (1.0 - Pvol / 96.0) * 2.0); -} - -void Master::setPsysefxsend(int Pefxfrom, int Pefxto, char Pvol) -{ - Psysefxsend[Pefxfrom][Pefxto] = Pvol; - sysefxsend[Pefxfrom][Pefxto] = pow(0.1, (1.0 - Pvol / 96.0) * 2.0); -} - - -/* - * Panic! (Clean up all parts and effects) - */ -void Master::ShutUp() -{ - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { - part[npart]->cleanup(); - fakepeakpart[npart] = 0; - } - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) - insefx[nefx]->cleanup(); - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) - sysefx[nefx]->cleanup(); - vuresetpeaks(); - shutup = 0; -} - - -/* - * Reset peaks and clear the "cliped" flag (for VU-meter) - */ -void Master::vuresetpeaks() -{ - vuoutpeakl = 1e-9; - vuoutpeakr = 1e-9; - vumaxoutpeakl = 1e-9; - vumaxoutpeakr = 1e-9; - vuclipped = 0; -} - - - -void Master::applyparameters() -{ - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) - part[npart]->applyparameters(); - ; -} - -void Master::add2XML(XMLwrapper *xml) -{ - xml->addpar("volume", Pvolume); - xml->addpar("key_shift", Pkeyshift); - xml->addparbool("nrpn_receive", ctl.NRPN.receive); - - xml->beginbranch("MICROTONAL"); - microtonal.add2XML(xml); - xml->endbranch(); - - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { - xml->beginbranch("PART", npart); - part[npart]->add2XML(xml); - xml->endbranch(); - } - - xml->beginbranch("SYSTEM_EFFECTS"); - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { - xml->beginbranch("SYSTEM_EFFECT", nefx); - xml->beginbranch("EFFECT"); - sysefx[nefx]->add2XML(xml); - xml->endbranch(); - - for(int pefx = 0; pefx < NUM_MIDI_PARTS; pefx++) { - xml->beginbranch("VOLUME", pefx); - xml->addpar("vol", Psysefxvol[nefx][pefx]); - xml->endbranch(); - } - - for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; tonefx++) { - xml->beginbranch("SENDTO", tonefx); - xml->addpar("send_vol", Psysefxsend[nefx][tonefx]); - xml->endbranch(); - } - - - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("INSERTION_EFFECTS"); - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { - xml->beginbranch("INSERTION_EFFECT", nefx); - xml->addpar("part", Pinsparts[nefx]); - - xml->beginbranch("EFFECT"); - insefx[nefx]->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - } - - xml->endbranch(); -} - - -int Master::getalldata(char **data) -{ - XMLwrapper *xml = new XMLwrapper(); - - xml->beginbranch("MASTER"); - - pthread_mutex_lock(&mutex); - add2XML(xml); - pthread_mutex_unlock(&mutex); - - xml->endbranch(); - - *data = xml->getXMLdata(); - delete (xml); - return strlen(*data) + 1; -} - -void Master::putalldata(char *data, int size) -{ - XMLwrapper *xml = new XMLwrapper(); - if(!xml->putXMLdata(data)) { - delete (xml); - return; - } - - if(xml->enterbranch("MASTER") == 0) - return; - - pthread_mutex_lock(&mutex); - getfromXML(xml); - pthread_mutex_unlock(&mutex); - - xml->exitbranch(); - - delete (xml); -} - -int Master::saveXML(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - - xml->beginbranch("MASTER"); - add2XML(xml); - xml->endbranch(); - - int result = xml->saveXMLfile(filename); - delete (xml); - return result; -} - - - -int Master::loadXML(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); - return -1; - } - - if(xml->enterbranch("MASTER") == 0) - return -10; - getfromXML(xml); - xml->exitbranch(); - - delete (xml); - return 0; -} - -void Master::getfromXML(XMLwrapper *xml) -{ - setPvolume(xml->getpar127("volume", Pvolume)); - setPkeyshift(xml->getpar127("key_shift", Pkeyshift)); - ctl.NRPN.receive = xml->getparbool("nrpn_receive", ctl.NRPN.receive); - - - part[0]->Penabled = 0; - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { - if(xml->enterbranch("PART", npart) == 0) - continue; - part[npart]->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("MICROTONAL")) { - microtonal.getfromXML(xml); - xml->exitbranch(); - } - - sysefx[0]->changeeffect(0); - if(xml->enterbranch("SYSTEM_EFFECTS")) { - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { - if(xml->enterbranch("SYSTEM_EFFECT", nefx) == 0) - continue; - if(xml->enterbranch("EFFECT")) { - sysefx[nefx]->getfromXML(xml); - xml->exitbranch(); - } - - for(int partefx = 0; partefx < NUM_MIDI_PARTS; partefx++) { - if(xml->enterbranch("VOLUME", partefx) == 0) - continue; - setPsysefxvol(partefx, nefx, - xml->getpar127("vol", Psysefxvol[partefx][nefx])); - xml->exitbranch(); - } - - for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; tonefx++) { - if(xml->enterbranch("SENDTO", tonefx) == 0) - continue; - setPsysefxsend(nefx, tonefx, - xml->getpar127("send_vol", - Psysefxsend[nefx][tonefx])); - xml->exitbranch(); - } - xml->exitbranch(); - } - xml->exitbranch(); - } - - - if(xml->enterbranch("INSERTION_EFFECTS")) { - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { - if(xml->enterbranch("INSERTION_EFFECT", nefx) == 0) - continue; - Pinsparts[nefx] = xml->getpar("part", - Pinsparts[nefx], - -2, - NUM_MIDI_PARTS); - if(xml->enterbranch("EFFECT")) { - insefx[nefx]->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Misc/Master.h b/plugins/zynaddsubfx/src/Misc/Master.h deleted file mode 100644 index eb4752245..000000000 --- a/plugins/zynaddsubfx/src/Misc/Master.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Master.h - It sends Midi Messages to Parts, receives samples from parts, - process them with system/insertion effects and mix them - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MASTER_H -#define MASTER_H - -#include "../globals.h" -#include "../Effects/EffectMgr.h" -#include "Part.h" -#include "../Output/Recorder.h" -#include "Microtonal.h" - -#include "Bank.h" -#include "Dump.h" -#include "../Seq/Sequencer.h" -#include "XMLwrapper.h" - -extern Dump dump; -/** It sends Midi Messages to Parts, receives samples from parts, - * process them with system/insertion effects and mix them */ -class Master -{ - public: - /** Constructor*/ - Master(); - /** Destructor*/ - ~Master(); - - /**Saves all settings to a XML file - * @return 0 for ok or <0 if there is an error*/ - int saveXML(const char *filename); - - /**This adds the parameters to the XML data*/ - void add2XML(XMLwrapper *xml); - - void defaults(); - - - /**loads all settings from a XML file - * @return 0 for ok or -1 if there is an error*/ - int loadXML(const char *filename); - void applyparameters(); - - void getfromXML(XMLwrapper *xml); - - /**get all data to a newly allocated array (used for VST) - * @return the datasize*/ - int getalldata(char **data); - /**put all data from the *data array to zynaddsubfx parameters (used for VST)*/ - void putalldata(char *data, int size); - - - - //Midi IN - void NoteOn(unsigned char chan, - unsigned char note, - unsigned char velocity); - void NoteOff(unsigned char chan, unsigned char note); - void SetController(unsigned char chan, unsigned int type, int par); - //void NRPN... - - - void ShutUp(); - int shutup; - - /**Audio Output*/ - void AudioOut(REALTYPE *outl, REALTYPE *outr); - /**Audio Output (for callback mode). This allows the program to be controled by an external program*/ - void GetAudioOutSamples(int nsamples, - int samplerate, - REALTYPE *outl, - REALTYPE *outr); - - - void partonoff(int npart, int what); - - /**parts \todo see if this can be made to be dynamic*/ - Part *part[NUM_MIDI_PARTS]; - - //parameters - unsigned char Pvolume; - unsigned char Pkeyshift; - unsigned char Psysefxvol[NUM_SYS_EFX][NUM_MIDI_PARTS]; - unsigned char Psysefxsend[NUM_SYS_EFX][NUM_SYS_EFX]; - - //parameters control - void setPvolume(char Pvolume_); - void setPkeyshift(char Pkeyshift_); - void setPsysefxvol(int Ppart, int Pefx, char Pvol); - void setPsysefxsend(int Pefxfrom, int Pefxto, char Pvol); - - //effects - EffectMgr *sysefx[NUM_SYS_EFX]; //system - EffectMgr *insefx[NUM_INS_EFX]; //insertion -// void swapcopyeffects(int what,int type,int neff1,int neff2); - - //HDD recorder - Recorder HDDRecorder; - - //part that's apply the insertion effect; -1 to disable - short int Pinsparts[NUM_INS_EFX]; - - //peaks for VU-meter - void vuresetpeaks(); - REALTYPE vuoutpeakl, vuoutpeakr, vumaxoutpeakl, vumaxoutpeakr, - vurmspeakl, vurmspeakr; - int vuclipped; - - //peaks for part VU-meters - REALTYPE vuoutpeakpart[NUM_MIDI_PARTS]; - unsigned char fakepeakpart[NUM_MIDI_PARTS]; //this is used to compute the "peak" when the part is disabled - - Controller ctl; - int swaplr; //1 if L and R are swapped - - //Sequencer - Sequencer seq; - - //other objects - Microtonal microtonal; - Bank bank; - - FFTwrapper *fft; - pthread_mutex_t mutex; - - private: - REALTYPE volume; - REALTYPE sysefxvol[NUM_SYS_EFX][NUM_MIDI_PARTS]; - REALTYPE sysefxsend[NUM_SYS_EFX][NUM_SYS_EFX]; - - //Temporary mixing samples for part samples which is sent to system effect - REALTYPE *tmpmixl; - REALTYPE *tmpmixr; - - - int keyshift; - - //Audio Output samples (if it used GetAudioOutSamples - eg. for Jack output; elsewhere is unused) - REALTYPE *audiooutl; - REALTYPE *audiooutr; - - int ksoundbuffersample; //this is used to know if there is need to call AudioOut by GetAudioOutSamples method - REALTYPE ksoundbuffersamplelow; //this is used for resampling (eg. if Jack samplerate!= SAMPLE_RATE) - REALTYPE oldsamplel, oldsampler; //this is used for resampling - - //These are called by the NoteOn, NoteOff,SetController (which are from external sources like MIDI, Virtual Keyboard) - //and are called by internal parts of the program (like sequencer) - void noteon(unsigned char chan, - unsigned char note, - unsigned char velocity); - void noteoff(unsigned char chan, unsigned char note); - void setcontroller(unsigned char chan, unsigned int type, int par); -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/Microtonal.cpp b/plugins/zynaddsubfx/src/Misc/Microtonal.cpp deleted file mode 100644 index cae9aa9d9..000000000 --- a/plugins/zynaddsubfx/src/Misc/Microtonal.cpp +++ /dev/null @@ -1,687 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Microtonal.cpp - Tuning settings and microtonal capabilities - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "Microtonal.h" - -#define MAX_LINE_SIZE 80 - -Microtonal::Microtonal() -{ - Pname = new unsigned char[MICROTONAL_MAX_NAME_LEN]; - Pcomment = new unsigned char[MICROTONAL_MAX_NAME_LEN]; - defaults(); -} - -void Microtonal::defaults() -{ - Pinvertupdown = 0; - Pinvertupdowncenter = 60; - octavesize = 12; - Penabled = 0; - PAnote = 69; - PAfreq = 440.0; - Pscaleshift = 64; - - Pfirstkey = 0; - Plastkey = 127; - Pmiddlenote = 60; - Pmapsize = 12; - Pmappingenabled = 0; - - for(int i = 0; i < 128; i++) - Pmapping[i] = i; - - for(int i = 0; i < MAX_OCTAVE_SIZE; i++) { - octave[i].tuning = tmpoctave[i].tuning = pow( - 2, - (i % octavesize - + 1) / 12.0); - octave[i].type = tmpoctave[i].type = 1; - octave[i].x1 = tmpoctave[i].x1 = (i % octavesize + 1) * 100; - octave[i].x2 = tmpoctave[i].x2 = 0; - } - octave[11].type = 2; - octave[11].x1 = 2; - octave[11].x2 = 1; - for(int i = 0; i < MICROTONAL_MAX_NAME_LEN; i++) { - Pname[i] = '\0'; - Pcomment[i] = '\0'; - } - snprintf((char *) Pname, MICROTONAL_MAX_NAME_LEN, "12tET"); - snprintf((char *) Pcomment, - MICROTONAL_MAX_NAME_LEN, - "Equal Temperament 12 notes per octave"); - Pglobalfinedetune = 64; -} - -Microtonal::~Microtonal() -{ - delete [] Pname; - delete [] Pcomment; -} - -/* - * Get the size of the octave - */ -unsigned char Microtonal::getoctavesize() const -{ - if(Penabled != 0) - return octavesize; - else - return 12; -} - -/* - * Get the frequency according the note number - */ -REALTYPE Microtonal::getnotefreq(int note, int keyshift) const -{ - // in this function will appears many times things like this: - // var=(a+b*100)%b - // I had written this way because if I use var=a%b gives unwanted results when a<0 - // This is the same with divisions. - - if((Pinvertupdown != 0) && ((Pmappingenabled == 0) || (Penabled == 0))) - note = (int) Pinvertupdowncenter * 2 - note; - - //compute global fine detune - REALTYPE globalfinedetunerap = pow(2.0, (Pglobalfinedetune - 64.0) / 1200.0); //-64.0 .. 63.0 cents - - if(Penabled == 0) - return pow(2.0, - (note - PAnote - + keyshift) / 12.0) * PAfreq * globalfinedetunerap; //12tET - - int scaleshift = - ((int)Pscaleshift - 64 + (int) octavesize * 100) % octavesize; - - //compute the keyshift - REALTYPE rap_keyshift = 1.0; - if(keyshift != 0) { - int kskey = (keyshift + (int)octavesize * 100) % octavesize; - int ksoct = (keyshift + (int)octavesize * 100) / octavesize - 100; - rap_keyshift = (kskey == 0) ? (1.0) : (octave[kskey - 1].tuning); - rap_keyshift *= pow(octave[octavesize - 1].tuning, ksoct); - } - - //if the mapping is enabled - if(Pmappingenabled != 0) { - if((note < Pfirstkey) || (note > Plastkey)) - return -1.0; - //Compute how many mapped keys are from middle note to reference note - //and find out the proportion between the freq. of middle note and "A" note - int tmp = PAnote - Pmiddlenote, minus = 0; - if(tmp < 0) { - tmp = -tmp; - minus = 1; - } - int deltanote = 0; - for(int i = 0; i < tmp; i++) - if(Pmapping[i % Pmapsize] >= 0) - deltanote++; - REALTYPE rap_anote_middlenote = - (deltanote == - 0) ? (1.0) : (octave[(deltanote - 1) % octavesize].tuning); - if(deltanote != 0) - rap_anote_middlenote *= - pow(octave[octavesize - 1].tuning, (deltanote - 1) / octavesize); - if(minus != 0) - rap_anote_middlenote = 1.0 / rap_anote_middlenote; - - //Convert from note (midi) to degree (note from the tunning) - int degoct = - (note - (int)Pmiddlenote + (int) Pmapsize - * 200) / (int)Pmapsize - 200; - int degkey = (note - Pmiddlenote + (int)Pmapsize * 100) % Pmapsize; - degkey = Pmapping[degkey]; - if(degkey < 0) - return -1.0; //this key is not mapped - - //invert the keyboard upside-down if it is asked for - //TODO: do the right way by using Pinvertupdowncenter - if(Pinvertupdown != 0) { - degkey = octavesize - degkey - 1; - degoct = -degoct; - } - //compute the frequency of the note - degkey = degkey + scaleshift; - degoct += degkey / octavesize; - degkey %= octavesize; - - REALTYPE freq = (degkey == 0) ? (1.0) : octave[degkey - 1].tuning; - freq *= pow(octave[octavesize - 1].tuning, degoct); - freq *= PAfreq / rap_anote_middlenote; - freq *= globalfinedetunerap; - if(scaleshift != 0) - freq /= octave[scaleshift - 1].tuning; - return freq * rap_keyshift; - } - else { //if the mapping is disabled - int nt = note - PAnote + scaleshift; - int ntkey = (nt + (int)octavesize * 100) % octavesize; - int ntoct = (nt - ntkey) / octavesize; - - REALTYPE oct = octave[octavesize - 1].tuning; - REALTYPE freq = - octave[(ntkey + octavesize - 1) % octavesize].tuning *pow(oct, - ntoct) - * PAfreq; - if(ntkey == 0) - freq /= oct; - if(scaleshift != 0) - freq /= octave[scaleshift - 1].tuning; -// fprintf(stderr,"note=%d freq=%.3f cents=%d\n",note,freq,(int)floor(log(freq/PAfreq)/log(2.0)*1200.0+0.5)); - freq *= globalfinedetunerap; - return freq * rap_keyshift; - } -} - -bool Microtonal::operator==(const Microtonal µ) const -{ - return !(*this != micro); -} - -bool Microtonal::operator!=(const Microtonal µ) const -{ - //A simple macro to test equality MiCRotonal EQuals (not the perfect - //approach, but good enough) -#define MCREQ(x) if(x != micro.x) \ - return true; - - //for floats -#define FMCREQ(x) if(!((x < micro.x + 0.0001) && (x > micro.x - 0.0001))) \ - return true; - - MCREQ(Pinvertupdown); - MCREQ(Pinvertupdowncenter); - MCREQ(octavesize); - MCREQ(Penabled); - MCREQ(PAnote); - FMCREQ(PAfreq); - MCREQ(Pscaleshift); - - MCREQ(Pfirstkey); - MCREQ(Plastkey); - MCREQ(Pmiddlenote); - MCREQ(Pmapsize); - MCREQ(Pmappingenabled); - - for(int i = 0; i < 128; i++) - MCREQ(Pmapping[i]); - - for(int i = 0; i < octavesize; i++) { - FMCREQ(octave[i].tuning); - MCREQ(octave[i].type); - MCREQ(octave[i].x1); - MCREQ(octave[i].x2); - } - if(strcmp((const char *)this->Pname, (const char *)micro.Pname)) - return true; - if(strcmp((const char *)this->Pcomment, (const char *)micro.Pcomment)) - return true; - MCREQ(Pglobalfinedetune); - return false; - - //undefine macros, as they are no longer needed -#undef MCREQ -#undef FMCREQ -} - - -/* - * Convert a line to tunings; returns -1 if it ok - */ -int Microtonal::linetotunings(unsigned int nline, const char *line) -{ - int x1 = -1, x2 = -1, type = -1; - REALTYPE x = -1.0, tmp, tuning = 1.0; - if(strstr(line, "/") == NULL) { - if(strstr(line, ".") == NULL) { // M case (M=M/1) - sscanf(line, "%d", &x1); - x2 = 1; - type = 2; //division - } - else { // float number case - sscanf(line, "%f", &x); - if(x < 0.000001) - return 1; - type = 1; //float type(cents) - } - } - else { // M/N case - sscanf(line, "%d/%d", &x1, &x2); - if((x1 < 0) || (x2 < 0)) - return 1; - if(x2 == 0) - x2 = 1; - type = 2; //division - } - - if(x1 <= 0) - x1 = 1; //not allow zero frequency sounds (consider 0 as 1) - - //convert to float if the number are too big - if((type == 2) - && ((x1 > (128 * 128 * 128 - 1)) || (x2 > (128 * 128 * 128 - 1)))) { - type = 1; - x = ((REALTYPE) x1) / x2; - } - switch(type) { - case 1: - x1 = (int) floor(x); - tmp = fmod(x, 1.0); - x2 = (int) (floor(tmp * 1e6)); - tuning = pow(2.0, x / 1200.0); - break; - case 2: - x = ((REALTYPE)x1) / x2; - tuning = x; - break; - } - - tmpoctave[nline].tuning = tuning; - tmpoctave[nline].type = type; - tmpoctave[nline].x1 = x1; - tmpoctave[nline].x2 = x2; - - return -1; //ok -} - -/* - * Convert the text to tunnings - */ -int Microtonal::texttotunings(const char *text) -{ - unsigned int i, k = 0, nl = 0; - char *lin; - lin = new char[MAX_LINE_SIZE + 1]; - while(k < strlen(text)) { - for(i = 0; i < MAX_LINE_SIZE; i++) { - lin[i] = text[k++]; - if(lin[i] < 0x20) - break; - } - lin[i] = '\0'; - if(strlen(lin) == 0) - continue; - int err = linetotunings(nl, lin); - if(err != -1) { - delete [] lin; - return nl; //Parse error - } - nl++; - } - delete [] lin; - if(nl > MAX_OCTAVE_SIZE) - nl = MAX_OCTAVE_SIZE; - if(nl == 0) - return -2; //the input is empty - octavesize = nl; - for(i = 0; i < octavesize; i++) { - octave[i].tuning = tmpoctave[i].tuning; - octave[i].type = tmpoctave[i].type; - octave[i].x1 = tmpoctave[i].x1; - octave[i].x2 = tmpoctave[i].x2; - } - return -1; //ok -} - -/* - * Convert the text to mapping - */ -void Microtonal::texttomapping(const char *text) -{ - unsigned int i, k = 0; - char *lin; - lin = new char[MAX_LINE_SIZE + 1]; - for(i = 0; i < 128; i++) - Pmapping[i] = -1; - int tx = 0; - while(k < strlen(text)) { - for(i = 0; i < MAX_LINE_SIZE; i++) { - lin[i] = text[k++]; - if(lin[i] < 0x20) - break; - } - lin[i] = '\0'; - if(strlen(lin) == 0) - continue; - - int tmp = 0; - if(sscanf(lin, "%d", &tmp) == 0) - tmp = -1; - if(tmp < -1) - tmp = -1; - Pmapping[tx] = tmp; - - if((tx++) > 127) - break; - } - delete [] lin; - - if(tx == 0) - tx = 1; - Pmapsize = tx; -} - -/* - * Convert tunning to text line - */ -void Microtonal::tuningtoline(int n, char *line, int maxn) -{ - if((n > octavesize) || (n > MAX_OCTAVE_SIZE)) { - line[0] = '\0'; - return; - } - if(octave[n].type == 1) - snprintf(line, maxn, "%d.%06d", octave[n].x1, octave[n].x2); - if(octave[n].type == 2) - snprintf(line, maxn, "%d/%d", octave[n].x1, octave[n].x2); -} - - -int Microtonal::loadline(FILE *file, char *line) -{ - do { - if(fgets(line, 500, file) == 0) - return 1; - } while(line[0] == '!'); - return 0; -} -/* - * Loads the tunnings from a scl file - */ -int Microtonal::loadscl(const char *filename) -{ - FILE *file = fopen(filename, "r"); - char tmp[500]; - fseek(file, 0, SEEK_SET); - //loads the short description - if(loadline(file, &tmp[0]) != 0) - return 2; - for(int i = 0; i < 500; i++) - if(tmp[i] < 32) - tmp[i] = 0; - snprintf((char *) Pname, MICROTONAL_MAX_NAME_LEN, "%s", tmp); - snprintf((char *) Pcomment, MICROTONAL_MAX_NAME_LEN, "%s", tmp); - //loads the number of the notes - if(loadline(file, &tmp[0]) != 0) - return 2; - int nnotes = MAX_OCTAVE_SIZE; - sscanf(&tmp[0], "%d", &nnotes); - if(nnotes > MAX_OCTAVE_SIZE) - return 2; - //load the tunnings - for(int nline = 0; nline < nnotes; nline++) { - if(loadline(file, &tmp[0]) != 0) - return 2; - linetotunings(nline, &tmp[0]); - } - fclose(file); - - octavesize = nnotes; - for(int i = 0; i < octavesize; i++) { - octave[i].tuning = tmpoctave[i].tuning; - octave[i].type = tmpoctave[i].type; - octave[i].x1 = tmpoctave[i].x1; - octave[i].x2 = tmpoctave[i].x2; - } - - return 0; -} - -/* - * Loads the mapping from a kbm file - */ -int Microtonal::loadkbm(const char *filename) -{ - FILE *file = fopen(filename, "r"); - int x; - char tmp[500]; - - fseek(file, 0, SEEK_SET); - //loads the mapsize - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Pmapsize = x; - //loads first MIDI note to retune - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Pfirstkey = x; - //loads last MIDI note to retune - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Plastkey = x; - //loads last the middle note where scale fro scale degree=0 - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Pmiddlenote = x; - //loads the reference note - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - PAnote = x; - //loads the reference freq. - if(loadline(file, &tmp[0]) != 0) - return 2; - REALTYPE tmpPAfreq = 440.0; - if(sscanf(&tmp[0], "%f", &tmpPAfreq) == 0) - return 2; - PAfreq = tmpPAfreq; - - //the scale degree(which is the octave) is not loaded, it is obtained by the tunnings with getoctavesize() method - if(loadline(file, &tmp[0]) != 0) - return 2; - - //load the mappings - if(Pmapsize != 0) { - for(int nline = 0; nline < Pmapsize; nline++) { - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - x = -1; - Pmapping[nline] = x; - } - Pmappingenabled = 1; - } - else { - Pmappingenabled = 0; - Pmapping[0] = 0; - Pmapsize = 1; - } - fclose(file); - - return 0; -} - - - -void Microtonal::add2XML(XMLwrapper *xml) const -{ - xml->addparstr("name", (char *) Pname); - xml->addparstr("comment", (char *) Pcomment); - - xml->addparbool("invert_up_down", Pinvertupdown); - xml->addpar("invert_up_down_center", Pinvertupdowncenter); - - xml->addparbool("enabled", Penabled); - xml->addpar("global_fine_detune", Pglobalfinedetune); - - xml->addpar("a_note", PAnote); - xml->addparreal("a_freq", PAfreq); - - if((Penabled == 0) && (xml->minimal)) - return; - - xml->beginbranch("SCALE"); - xml->addpar("scale_shift", Pscaleshift); - xml->addpar("first_key", Pfirstkey); - xml->addpar("last_key", Plastkey); - xml->addpar("middle_note", Pmiddlenote); - - xml->beginbranch("OCTAVE"); - xml->addpar("octave_size", octavesize); - for(int i = 0; i < octavesize; i++) { - xml->beginbranch("DEGREE", i); - if(octave[i].type == 1) - xml->addparreal("cents", octave[i].tuning); - ; - if(octave[i].type == 2) { - xml->addpar("numerator", octave[i].x1); - xml->addpar("denominator", octave[i].x2); - } - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("KEYBOARD_MAPPING"); - xml->addpar("map_size", Pmapsize); - xml->addpar("mapping_enabled", Pmappingenabled); - for(int i = 0; i < Pmapsize; i++) { - xml->beginbranch("KEYMAP", i); - xml->addpar("degree", Pmapping[i]); - xml->endbranch(); - } - - xml->endbranch(); - xml->endbranch(); -} - -void Microtonal::getfromXML(XMLwrapper *xml) -{ - xml->getparstr("name", (char *) Pname, MICROTONAL_MAX_NAME_LEN); - xml->getparstr("comment", (char *) Pcomment, MICROTONAL_MAX_NAME_LEN); - - Pinvertupdown = xml->getparbool("invert_up_down", Pinvertupdown); - Pinvertupdowncenter = xml->getpar127("invert_up_down_center", - Pinvertupdowncenter); - - Penabled = xml->getparbool("enabled", Penabled); - Pglobalfinedetune = xml->getpar127("global_fine_detune", Pglobalfinedetune); - - PAnote = xml->getpar127("a_note", PAnote); - PAfreq = xml->getparreal("a_freq", PAfreq, 1.0, 10000.0); - - if(xml->enterbranch("SCALE")) { - Pscaleshift = xml->getpar127("scale_shift", Pscaleshift); - Pfirstkey = xml->getpar127("first_key", Pfirstkey); - Plastkey = xml->getpar127("last_key", Plastkey); - Pmiddlenote = xml->getpar127("middle_note", Pmiddlenote); - - if(xml->enterbranch("OCTAVE")) { - octavesize = xml->getpar127("octave_size", octavesize); - for(int i = 0; i < octavesize; i++) { - if(xml->enterbranch("DEGREE", i) == 0) - continue; - octave[i].x2 = 0; - octave[i].tuning = xml->getparreal("cents", octave[i].tuning); - octave[i].x1 = xml->getpar127("numerator", octave[i].x1); - octave[i].x2 = xml->getpar127("denominator", octave[i].x2); - - if(octave[i].x2 != 0) - octave[i].type = 2; - else - octave[i].type = 1; - - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("KEYBOARD_MAPPING")) { - Pmapsize = xml->getpar127("map_size", Pmapsize); - Pmappingenabled = xml->getpar127("mapping_enabled", Pmappingenabled); - for(int i = 0; i < Pmapsize; i++) { - if(xml->enterbranch("KEYMAP", i) == 0) - continue; - Pmapping[i] = xml->getpar127("degree", Pmapping[i]); - xml->exitbranch(); - } - xml->exitbranch(); - } - xml->exitbranch(); - } -} - - - -int Microtonal::saveXML(const char *filename) const -{ - XMLwrapper *xml = new XMLwrapper(); - - xml->beginbranch("MICROTONAL"); - add2XML(xml); - xml->endbranch(); - - int result = xml->saveXMLfile(filename); - delete (xml); - return result; -} - -int Microtonal::loadXML(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); - return -1; - } - - if(xml->enterbranch("MICROTONAL") == 0) - return -10; - getfromXML(xml); - xml->exitbranch(); - - delete (xml); - return 0; -} - diff --git a/plugins/zynaddsubfx/src/Misc/Microtonal.h b/plugins/zynaddsubfx/src/Misc/Microtonal.h deleted file mode 100644 index c7fd7c200..000000000 --- a/plugins/zynaddsubfx/src/Misc/Microtonal.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Microtonal.h - Tuning settings and microtonal capabilities - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MICROTONAL_H -#define MICROTONAL_H - -#include "../globals.h" -#include "XMLwrapper.h" - -#define MAX_OCTAVE_SIZE 128 -#define MICROTONAL_MAX_NAME_LEN 120 - -#include - - -/**Tuning settings and microtonal capabilities*/ -class Microtonal -{ - public: - /**Constructor*/ - Microtonal(); - /**Destructor*/ - ~Microtonal(); - void defaults(); - /**Calculates the frequency for a given note - */ - REALTYPE getnotefreq(int note, int keyshift) const; - - - //Parameters - /**if the keys are inversed (the pitch is lower to keys from the right direction)*/ - unsigned char Pinvertupdown; - - /**the central key of the inversion*/ - unsigned char Pinvertupdowncenter; - - /**0 for 12 key temperate scale, 1 for microtonal*/ - unsigned char Penabled; - - /**the note of "A" key*/ - unsigned char PAnote; - - /**the frequency of the "A" note*/ - REALTYPE PAfreq; - - /**if the scale is "tuned" to a note, you can tune to other note*/ - unsigned char Pscaleshift; - - //first and last key (to retune) - unsigned char Pfirstkey; - unsigned char Plastkey; - - /**The middle note where scale degree 0 is mapped to*/ - unsigned char Pmiddlenote; - - /**Map size*/ - unsigned char Pmapsize; - - /**Mapping ON/OFF*/ - unsigned char Pmappingenabled; - /**Mapping (keys)*/ - short int Pmapping[128]; - - /**Fine detune to be applied to all notes*/ - unsigned char Pglobalfinedetune; - - // Functions - /** Return the current octave size*/ - unsigned char getoctavesize() const; - /**Convert tunning to string*/ - void tuningtoline(int n, char *line, int maxn); - /**load the tunnings from a .scl file*/ - int loadscl(const char *filename); - /**load the mapping from .kbm file*/ - int loadkbm(const char *filename); - /**Load text into the internal tunings - * - *\todo better description*/ - int texttotunings(const char *text); - /**Load text into the internal mappings - * - *\todo better description*/ - void texttomapping(const char *text); - - /**Name of Microtonal tuning*/ - unsigned char *Pname; - /**Comment about the tuning*/ - unsigned char *Pcomment; - - void add2XML(XMLwrapper *xml) const; - void getfromXML(XMLwrapper *xml); - int saveXML(const char *filename) const; - int loadXML(const char *filename); - - //simple operators primarily for debug - bool operator==(const Microtonal µ) const; - bool operator!=(const Microtonal µ) const; - - private: - int linetotunings(unsigned int nline, const char *line); - int loadline(FILE *file, char *line); //loads a line from the text file, while ignoring the lines beggining with "!" - unsigned char octavesize; - struct { - unsigned char type; //1 for cents or 2 for division - - // the real tuning (eg. +1.05946 for one halftone) - // or 2.0 for one octave - REALTYPE tuning; - - //the real tunning is x1/x2 - unsigned int x1, x2; - } octave[MAX_OCTAVE_SIZE], tmpoctave[MAX_OCTAVE_SIZE]; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/Part.cpp b/plugins/zynaddsubfx/src/Misc/Part.cpp deleted file mode 100644 index e54c85891..000000000 --- a/plugins/zynaddsubfx/src/Misc/Part.cpp +++ /dev/null @@ -1,1370 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Part.cpp - Part implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Part.h" -#include "Microtonal.h" -#include -#include -#include - -Part::Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_) -{ - microtonal = microtonal_; - fft = fft_; - mutex = mutex_; - partoutl = new REALTYPE [SOUND_BUFFER_SIZE]; - partoutr = new REALTYPE [SOUND_BUFFER_SIZE]; - tmpoutl = new REALTYPE [SOUND_BUFFER_SIZE]; - tmpoutr = new REALTYPE [SOUND_BUFFER_SIZE]; - - for(int n = 0; n < NUM_KIT_ITEMS; n++) { - kit[n].Pname = new unsigned char [PART_MAX_NAME_LEN]; - kit[n].adpars = NULL; - kit[n].subpars = NULL; - kit[n].padpars = NULL; - } - - kit[0].adpars = new ADnoteParameters(fft); - kit[0].subpars = new SUBnoteParameters(); - kit[0].padpars = new PADnoteParameters(fft, mutex); -// ADPartParameters=kit[0].adpars; -// SUBPartParameters=kit[0].subpars; - - //Part's Insertion Effects init - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { - partefx[nefx] = new EffectMgr(1, mutex); - Pefxbypass[nefx] = false; - } - - for(int n = 0; n < NUM_PART_EFX + 1; n++) { - partfxinputl[n] = new REALTYPE [SOUND_BUFFER_SIZE]; - partfxinputr[n] = new REALTYPE [SOUND_BUFFER_SIZE]; - } - - killallnotes = 0; - oldfreq = -1.0; - - int i, j; - for(i = 0; i < POLIPHONY; i++) { - partnote[i].status = KEY_OFF; - partnote[i].note = -1; - partnote[i].itemsplaying = 0; - for(j = 0; j < NUM_KIT_ITEMS; j++) { - partnote[i].kititem[j].adnote = NULL; - partnote[i].kititem[j].subnote = NULL; - partnote[i].kititem[j].padnote = NULL; - } - partnote[i].time = 0; - } - cleanup(); - - Pname = new unsigned char [PART_MAX_NAME_LEN]; - - oldvolumel = oldvolumer = 0.5; - lastnote = -1; - lastpos = 0; // lastpos will store previously used NoteOn(...)'s pos. - lastlegatomodevalid = false; // To store previous legatomodevalid value. - - - defaults(); -} - -void Part::defaults() -{ - Penabled = 0; - Pminkey = 0; - Pmaxkey = 127; - Pnoteon = 1; - Ppolymode = 1; - Plegatomode = 0; - setPvolume(96); - Pkeyshift = 64; - Prcvchn = 0; - setPpanning(64); - Pvelsns = 64; - Pveloffs = 64; - Pkeylimit = 15; - defaultsinstrument(); - ctl.defaults(); -} - -void Part::defaultsinstrument() -{ - ZERO(Pname, PART_MAX_NAME_LEN); - - info.Ptype = 0; - ZERO(info.Pauthor, MAX_INFO_TEXT_SIZE + 1); - ZERO(info.Pcomments, MAX_INFO_TEXT_SIZE + 1); - - Pkitmode = 0; - Pdrummode = 0; - - for(int n = 0; n < NUM_KIT_ITEMS; n++) { - kit[n].Penabled = 0; - kit[n].Pmuted = 0; - kit[n].Pminkey = 0; - kit[n].Pmaxkey = 127; - kit[n].Padenabled = 0; - kit[n].Psubenabled = 0; - kit[n].Ppadenabled = 0; - ZERO(kit[n].Pname, PART_MAX_NAME_LEN); - kit[n].Psendtoparteffect = 0; - if(n != 0) - setkititemstatus(n, 0); - } - kit[0].Penabled = 1; - kit[0].Padenabled = 1; - kit[0].adpars->defaults(); - kit[0].subpars->defaults(); - kit[0].padpars->defaults(); - - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { - partefx[nefx]->defaults(); - Pefxroute[nefx] = 0; //route to next effect - } -} - - - -/* - * Cleanup the part - */ -void Part::cleanup() -{ - for(int k = 0; k < POLIPHONY; k++) - KillNotePos(k); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - partoutl[i] = denormalkillbuf[i]; - partoutr[i] = denormalkillbuf[i]; - tmpoutl[i] = 0.0; - tmpoutr[i] = 0.0; - } - ctl.resetall(); - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) - partefx[nefx]->cleanup(); - for(int n = 0; n < NUM_PART_EFX + 1; n++) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - partfxinputl[n][i] = denormalkillbuf[i]; - partfxinputr[n][i] = denormalkillbuf[i]; - } - } -} - -Part::~Part() -{ - cleanup(); - for(int n = 0; n < NUM_KIT_ITEMS; n++) { - if(kit[n].adpars != NULL) - delete (kit[n].adpars); - if(kit[n].subpars != NULL) - delete (kit[n].subpars); - if(kit[n].padpars != NULL) - delete (kit[n].padpars); - kit[n].adpars = NULL; - kit[n].subpars = NULL; - kit[n].padpars = NULL; - delete [] kit[n].Pname; - } - - delete [] Pname; - delete [] partoutl; - delete [] partoutr; - delete [] tmpoutl; - delete [] tmpoutr; - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) - delete (partefx[nefx]); - for(int n = 0; n < NUM_PART_EFX + 1; n++) { - delete [] partfxinputl[n]; - delete [] partfxinputr[n]; - } -} - -/* - * Note On Messages - */ -void Part::NoteOn(unsigned char note, - unsigned char velocity, - int masterkeyshift) -{ - int i, pos; - - // Legato and MonoMem used vars: - int posb = POLIPHONY - 1; // Just a dummy initial value. - bool legatomodevalid = false; //true when legato mode is determined applicable. - bool doinglegato = false; // true when we determined we do a legato note. - bool ismonofirstnote = false; /*(In Mono/Legato) true when we determined - no other notes are held down or sustained.*/ - int lastnotecopy = lastnote; //Useful after lastnote has been changed. - - if(Pnoteon == 0) - return; - if((note < Pminkey) || (note > Pmaxkey)) - return; - - // MonoMem stuff: - if(Ppolymode == 0) { // If Poly is off - monomemnotes.push_back(note); // Add note to the list. - monomem[note].velocity = velocity; // Store this note's velocity. - monomem[note].mkeyshift = masterkeyshift; /* Store masterkeyshift too, - I'm not sure why though... */ - if((partnote[lastpos].status != KEY_PLAYING) - && (partnote[lastpos].status != KEY_RELASED_AND_SUSTAINED)) - ismonofirstnote = true; // No other keys are held or sustained. - } - else - // Poly mode is On so just make sure the list is empty. - if(not monomemnotes.empty()) - monomemnotes.clear(); - - lastnote = note; - - pos = -1; - for(i = 0; i < POLIPHONY; i++) { - if(partnote[i].status == KEY_OFF) { - pos = i; - break; - } - } - - if((Plegatomode != 0) && (Pdrummode == 0)) { - if(Ppolymode != 0) { - fprintf( - stderr, - "ZynAddSubFX WARNING: Poly and Legato modes are both On, that should not happen ! ... Disabling Legato mode ! - (Part.cpp::NoteOn(..))\n"); - Plegatomode = 0; - } - else { - // Legato mode is on and applicable. - legatomodevalid = true; - if((not ismonofirstnote) && (lastlegatomodevalid)) { - // At least one other key is held or sustained, and the - // previous note was played while in valid legato mode. - doinglegato = true; // So we'll do a legato note. - pos = lastpos; // A legato note uses same pos as previous.. - posb = lastposb; // .. same goes for posb. - } - else { - // Legato mode is valid, but this is only a first note. - for(i = 0; i < POLIPHONY; i++) - if((partnote[i].status == KEY_PLAYING) - || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) - RelaseNotePos(i); - - // Set posb - posb = (pos + 1) % POLIPHONY; //We really want it (if the following fails) - for(i = 0; i < POLIPHONY; i++) - if((partnote[i].status == KEY_OFF) && (pos != i)) { - posb = i; - break; - } - } - lastposb = posb; // Keep a trace of used posb - } - } - else // Legato mode is either off or non-applicable. - if(Ppolymode == 0) { //if the mode is 'mono' turn off all other notes - for(i = 0; i < POLIPHONY; i++) - if(partnote[i].status == KEY_PLAYING) - RelaseNotePos(i); - RelaseSustainedKeys(); - } - lastlegatomodevalid = legatomodevalid; - - if(pos == -1) - //test - fprintf(stderr, - "%s", - "NOTES TOO MANY (> POLIPHONY) - (Part.cpp::NoteOn(..))\n"); - else { - //start the note - partnote[pos].status = KEY_PLAYING; - partnote[pos].note = note; - if(legatomodevalid) { - partnote[posb].status = KEY_PLAYING; - partnote[posb].note = note; - } - - //this computes the velocity sensing of the part - REALTYPE vel = VelF(velocity / 127.0, Pvelsns); - - //compute the velocity offset - vel += (Pveloffs - 64.0) / 64.0; - if(vel < 0.0) - vel = 0.0; - else - if(vel > 1.0) - vel = 1.0; - - //compute the keyshift - int partkeyshift = (int)Pkeyshift - 64; - int keyshift = masterkeyshift + partkeyshift; - - //initialise note frequency - REALTYPE notebasefreq; - if(Pdrummode == 0) { - notebasefreq = microtonal->getnotefreq(note, keyshift); - if(notebasefreq < 0.0) - return; //the key is no mapped - } - else - notebasefreq = 440.0 * pow(2.0, (note - 69.0) / 12.0); - ; - - //Portamento - if(oldfreq < 1.0) - oldfreq = notebasefreq; //this is only the first note is played - - // For Mono/Legato: Force Portamento Off on first - // notes. That means it is required that the previous note is - // still held down or sustained for the Portamento to activate - // (that's like Legato). - int portamento = 0; - if((Ppolymode != 0) || (not ismonofirstnote)) - // I added a third argument to the - // ctl.initportamento(...) function to be able - // to tell it if we're doing a legato note. - portamento = ctl.initportamento(oldfreq, notebasefreq, doinglegato); - - if(portamento != 0) - ctl.portamento.noteusing = pos; - oldfreq = notebasefreq; - - lastpos = pos; // Keep a trace of used pos. - - if(doinglegato) { - // Do Legato note - if(Pkitmode == 0) { // "normal mode" legato note - if((kit[0].Padenabled != 0) - && (partnote[pos].kititem[0].adnote != NULL) - && (partnote[posb].kititem[0].adnote != NULL)) { - partnote[pos].kititem[0].adnote->ADlegatonote(notebasefreq, - vel, - portamento, - note, - true); //'true' is to tell it it's being called from here. - partnote[posb].kititem[0].adnote->ADlegatonote(notebasefreq, - vel, - portamento, - note, - true); - } - - if((kit[0].Psubenabled != 0) - && (partnote[pos].kititem[0].subnote != NULL) - && (partnote[posb].kititem[0].subnote != NULL)) { - partnote[pos].kititem[0].subnote->SUBlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - partnote[posb].kititem[0].subnote->SUBlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - } - - if((kit[0].Ppadenabled != 0) - && (partnote[pos].kititem[0].padnote != NULL) - && (partnote[posb].kititem[0].padnote != NULL)) { - partnote[pos].kititem[0].padnote->PADlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - partnote[posb].kititem[0].padnote->PADlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - } - } - else { // "kit mode" legato note - int ci = 0; - for(int item = 0; item < NUM_KIT_ITEMS; item++) { - if(kit[item].Pmuted != 0) - continue; - if((note < kit[item].Pminkey) || (note > kit[item].Pmaxkey)) - continue; - - if((lastnotecopy < kit[item].Pminkey) - || (lastnotecopy > kit[item].Pmaxkey)) - continue; // We will not perform legato across 2 key regions. - - partnote[pos].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < - NUM_PART_EFX ? kit[item].Psendtoparteffect : NUM_PART_EFX); //if this parameter is 127 for "unprocessed" - partnote[posb].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < - NUM_PART_EFX ? kit[item].Psendtoparteffect : NUM_PART_EFX); - - if((kit[item].Padenabled != 0) && (kit[item].adpars != NULL) - && (partnote[pos].kititem[ci].adnote != NULL) - && (partnote[posb].kititem[ci].adnote != NULL)) { - partnote[pos].kititem[ci].adnote->ADlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - partnote[posb].kititem[ci].adnote->ADlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - } - if((kit[item].Psubenabled != 0) - && (kit[item].subpars != NULL) - && (partnote[pos].kititem[ci].subnote != NULL) - && (partnote[posb].kititem[ci].subnote != NULL)) { - partnote[pos].kititem[ci].subnote->SUBlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - partnote[posb].kititem[ci].subnote->SUBlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - } - if((kit[item].Ppadenabled != 0) - && (kit[item].padpars != NULL) - && (partnote[pos].kititem[ci].padnote != NULL) - && (partnote[posb].kititem[ci].padnote != NULL)) { - partnote[pos].kititem[ci].padnote->PADlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - partnote[posb].kititem[ci].padnote->PADlegatonote( - notebasefreq, - vel, - portamento, - note, - true); - } - - if((kit[item].adpars != NULL) - || (kit[item].subpars != NULL) - || (kit[item].padpars != NULL)) { - ci++; - if(((kit[item].Padenabled != 0) - || (kit[item].Psubenabled != 0) - || (kit[item].Ppadenabled != 0)) && (Pkitmode == 2)) - break; - } - } - if(ci == 0) { - // No legato were performed at all, so pretend nothing happened: - monomemnotes.pop_back(); // Remove last note from the list. - lastnote = lastnotecopy; // Set lastnote back to previous value. - } - } - return; // Ok, Legato note done, return. - } - - partnote[pos].itemsplaying = 0; - if(legatomodevalid) - partnote[posb].itemsplaying = 0; - - if(Pkitmode == 0) { //init the notes for the "normal mode" - partnote[pos].kititem[0].sendtoparteffect = 0; - if(kit[0].Padenabled != 0) - partnote[pos].kititem[0].adnote = new ADnote(kit[0].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - if(kit[0].Psubenabled != 0) - partnote[pos].kititem[0].subnote = new SUBnote(kit[0].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - if(kit[0].Ppadenabled != 0) - partnote[pos].kititem[0].padnote = new PADnote(kit[0].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - if((kit[0].Padenabled != 0) || (kit[0].Psubenabled != 0) - || (kit[0].Ppadenabled != 0)) - partnote[pos].itemsplaying++; - - // Spawn another note (but silent) if legatomodevalid==true - if(legatomodevalid) { - partnote[posb].kititem[0].sendtoparteffect = 0; - if(kit[0].Padenabled != 0) - partnote[posb].kititem[0].adnote = new ADnote(kit[0].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); //true for silent. - if(kit[0].Psubenabled != 0) - partnote[posb].kititem[0].subnote = new SUBnote( - kit[0].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - if(kit[0].Ppadenabled != 0) - partnote[posb].kititem[0].padnote = new PADnote( - kit[0].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - if((kit[0].Padenabled != 0) || (kit[0].Psubenabled != 0) - || (kit[0].Ppadenabled != 0)) - partnote[posb].itemsplaying++; - } - } - else { //init the notes for the "kit mode" - for(int item = 0; item < NUM_KIT_ITEMS; item++) { - if(kit[item].Pmuted != 0) - continue; - if((note < kit[item].Pminkey) || (note > kit[item].Pmaxkey)) - continue; - - int ci = partnote[pos].itemsplaying; //ci=current item - - partnote[pos].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < NUM_PART_EFX ? - kit[item]. - Psendtoparteffect : NUM_PART_EFX); //if this parameter is 127 for "unprocessed" - - if((kit[item].adpars != NULL) && ((kit[item].Padenabled) != 0)) - partnote[pos].kititem[ci].adnote = new ADnote( - kit[item].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - - if((kit[item].subpars != NULL) && ((kit[item].Psubenabled) != 0)) - partnote[pos].kititem[ci].subnote = new SUBnote( - kit[item].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - - if((kit[item].padpars != NULL) && ((kit[item].Ppadenabled) != 0)) - partnote[pos].kititem[ci].padnote = new PADnote( - kit[item].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - - // Spawn another note (but silent) if legatomodevalid==true - if(legatomodevalid) { - partnote[posb].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < - NUM_PART_EFX ? kit[item].Psendtoparteffect : NUM_PART_EFX); //if this parameter is 127 for "unprocessed" - - if((kit[item].adpars != NULL) - && ((kit[item].Padenabled) != 0)) - partnote[posb].kititem[ci].adnote = new ADnote( - kit[item].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); //true for silent. - if((kit[item].subpars != NULL) - && ((kit[item].Psubenabled) != 0)) - partnote[posb].kititem[ci].subnote = - new SUBnote(kit[item].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - if((kit[item].padpars != NULL) - && ((kit[item].Ppadenabled) != 0)) - partnote[posb].kititem[ci].padnote = - new PADnote(kit[item].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - - if((kit[item].adpars != NULL) || (kit[item].subpars != NULL)) - partnote[posb].itemsplaying++; - } - - if((kit[item].adpars != NULL) || (kit[item].subpars != NULL)) { - partnote[pos].itemsplaying++; - if(((kit[item].Padenabled != 0) - || (kit[item].Psubenabled != 0) - || (kit[item].Ppadenabled != 0)) - && (Pkitmode == 2)) - break; - } - } - } - } - - //this only relase the keys if there is maximum number of keys allowed - setkeylimit(Pkeylimit); -} - -/* - * Note Off Messages - */ -void Part::NoteOff(unsigned char note) //relase the key -{ - int i; - - // This note is released, so we remove it from the list. - if(not monomemnotes.empty()) - monomemnotes.remove(note); - - for(i = POLIPHONY - 1; i >= 0; i--) //first note in, is first out if there are same note multiple times - if((partnote[i].status == KEY_PLAYING) && (partnote[i].note == note)) { - if(ctl.sustain.sustain == 0) { //the sustain pedal is not pushed - if((Ppolymode == 0) && (not monomemnotes.empty())) - MonoMemRenote(); // To play most recent still held note. - else - RelaseNotePos(i); - /// break; - } - else //the sustain pedal is pushed - partnote[i].status = KEY_RELASED_AND_SUSTAINED; - } -} - -/* - * Controllers - */ -void Part::SetController(unsigned int type, int par) -{ - switch(type) { - case C_pitchwheel: - ctl.setpitchwheel(par); - break; - case C_expression: - ctl.setexpression(par); - setPvolume(Pvolume); //update the volume - break; - case C_portamento: - ctl.setportamento(par); - break; - case C_panning: - ctl.setpanning(par); - setPpanning(Ppanning); //update the panning - break; - case C_filtercutoff: - ctl.setfiltercutoff(par); - break; - case C_filterq: - ctl.setfilterq(par); - break; - case C_bandwidth: - ctl.setbandwidth(par); - break; - case C_modwheel: - ctl.setmodwheel(par); - break; - case C_fmamp: - ctl.setfmamp(par); - break; - case C_volume: - ctl.setvolume(par); - if(ctl.volume.receive != 0) - volume = ctl.volume.volume; - else - setPvolume(Pvolume); - break; - case C_sustain: - ctl.setsustain(par); - if(ctl.sustain.sustain == 0) - RelaseSustainedKeys(); - break; - case C_allsoundsoff: - AllNotesOff(); //Panic - break; - case C_resetallcontrollers: - ctl.resetall(); - RelaseSustainedKeys(); - if(ctl.volume.receive != 0) - volume = ctl.volume.volume; - else - setPvolume(Pvolume); - setPvolume(Pvolume); //update the volume - setPpanning(Ppanning); //update the panning - - for(int item = 0; item < NUM_KIT_ITEMS; item++) { - if(kit[item].adpars == NULL) - continue; - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_center, 1.0); - - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_bandwidth, 1.0); - } - //more update to add here if I add controllers - break; - case C_allnotesoff: - RelaseAllKeys(); - break; - case C_resonance_center: - ctl.setresonancecenter(par); - for(int item = 0; item < NUM_KIT_ITEMS; item++) { - if(kit[item].adpars == NULL) - continue; - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_center, ctl.resonancecenter.relcenter); - } - break; - case C_resonance_bandwidth: - ctl.setresonancebw(par); - kit[0].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_bandwidth, ctl.resonancebandwidth.relbw); - break; - } -} -/* - * Relase the sustained keys - */ - -void Part::RelaseSustainedKeys() -{ - // Let's call MonoMemRenote() on some conditions: - if((Ppolymode == 0) && (not monomemnotes.empty())) - if(monomemnotes.back() != lastnote) // Sustain controller manipulation would cause repeated same note respawn without this check. - MonoMemRenote(); // To play most recent still held note. - - for(int i = 0; i < POLIPHONY; i++) - if(partnote[i].status == KEY_RELASED_AND_SUSTAINED) - RelaseNotePos(i); -} - -/* - * Relase all keys - */ - -void Part::RelaseAllKeys() -{ - for(int i = 0; i < POLIPHONY; i++) - if((partnote[i].status != KEY_RELASED) - && (partnote[i].status != KEY_OFF)) //thanks to Frank Neumann - RelaseNotePos(i); - ; -} - -// Call NoteOn(...) with the most recent still held key as new note -// (Made for Mono/Legato). -void Part::MonoMemRenote() -{ - unsigned char mmrtempnote = monomemnotes.back(); // Last list element. - monomemnotes.pop_back(); // We remove it, will be added again in NoteOn(...). - if(Pnoteon == 0) - RelaseNotePos(lastpos); - else - NoteOn(mmrtempnote, monomem[mmrtempnote].velocity, - monomem[mmrtempnote].mkeyshift); -} - -/* - * Release note at position - */ -void Part::RelaseNotePos(int pos) -{ - for(int j = 0; j < NUM_KIT_ITEMS; j++) { - if(partnote[pos].kititem[j].adnote != NULL) - if(partnote[pos].kititem[j].adnote) - partnote[pos].kititem[j].adnote->relasekey(); - - if(partnote[pos].kititem[j].subnote != NULL) - if(partnote[pos].kititem[j].subnote != NULL) - partnote[pos].kititem[j].subnote->relasekey(); - - if(partnote[pos].kititem[j].padnote != NULL) - if(partnote[pos].kititem[j].padnote) - partnote[pos].kititem[j].padnote->relasekey(); - } - partnote[pos].status = KEY_RELASED; -} - - -/* - * Kill note at position - */ -void Part::KillNotePos(int pos) -{ - partnote[pos].status = KEY_OFF; - partnote[pos].note = -1; - partnote[pos].time = 0; - partnote[pos].itemsplaying = 0; - - for(int j = 0; j < NUM_KIT_ITEMS; j++) { - if(partnote[pos].kititem[j].adnote != NULL) { - delete (partnote[pos].kititem[j].adnote); - partnote[pos].kititem[j].adnote = NULL; - } - if(partnote[pos].kititem[j].subnote != NULL) { - delete (partnote[pos].kititem[j].subnote); - partnote[pos].kititem[j].subnote = NULL; - } - if(partnote[pos].kititem[j].padnote != NULL) { - delete (partnote[pos].kititem[j].padnote); - partnote[pos].kititem[j].padnote = NULL; - } - } - if(pos == ctl.portamento.noteusing) { - ctl.portamento.noteusing = -1; - ctl.portamento.used = 0; - } -} - - -/* - * Set Part's key limit - */ -void Part::setkeylimit(unsigned char Pkeylimit) -{ - this->Pkeylimit = Pkeylimit; - int keylimit = Pkeylimit; - if(keylimit == 0) - keylimit = POLIPHONY - 5; - - //release old keys if the number of notes>keylimit - if(Ppolymode != 0) { - int notecount = 0; - for(int i = 0; i < POLIPHONY; i++) - if((partnote[i].status == KEY_PLAYING) - || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) - notecount++; - ; - int oldestnotepos = -1, maxtime = 0; - if(notecount > keylimit) { //find out the oldest note - for(int i = 0; i < POLIPHONY; i++) { - if(((partnote[i].status == KEY_PLAYING) - || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) - && (partnote[i].time > maxtime)) { - maxtime = partnote[i].time; - oldestnotepos = i; - } - } - } - if(oldestnotepos != -1) - RelaseNotePos(oldestnotepos); - } -} - - -/* - * Prepare all notes to be turned off - */ -void Part::AllNotesOff() -{ - killallnotes = 1; -} - - -/* - * Compute Part samples and store them in the partoutl[] and partoutr[] - */ -void Part::ComputePartSmps() -{ - int i, k; - int noteplay; //0 if there is nothing activated - for(int nefx = 0; nefx < NUM_PART_EFX + 1; nefx++) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - partfxinputl[nefx][i] = 0.0; - partfxinputr[nefx][i] = 0.0; - } - } - - for(k = 0; k < POLIPHONY; k++) { - if(partnote[k].status == KEY_OFF) - continue; - noteplay = 0; - partnote[k].time++; - //get the sampledata of the note and kill it if it's finished - - for(int item = 0; item < partnote[k].itemsplaying; item++) { - int sendcurrenttofx = partnote[k].kititem[item].sendtoparteffect; - - ADnote *adnote = partnote[k].kititem[item].adnote; - SUBnote *subnote = partnote[k].kititem[item].subnote; - PADnote *padnote = partnote[k].kititem[item].padnote; - //get from the ADnote - if(adnote != NULL) { - noteplay++; - if(adnote->ready != 0) - adnote->noteout(&tmpoutl[0], &tmpoutr[0]); - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmpoutl[i] = 0.0; - tmpoutr[i] = 0.0; - } - ; - if(adnote->finished() != 0) { - delete (adnote); - partnote[k].kititem[item].adnote = NULL; - } - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //add the ADnote to part(mix) - partfxinputl[sendcurrenttofx][i] += tmpoutl[i]; - partfxinputr[sendcurrenttofx][i] += tmpoutr[i]; - } - } - //get from the SUBnote - if(subnote != NULL) { - noteplay++; - if(subnote->ready != 0) - subnote->noteout(&tmpoutl[0], &tmpoutr[0]); - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmpoutl[i] = 0.0; - tmpoutr[i] = 0.0; - } - ; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //add the SUBnote to part(mix) - partfxinputl[sendcurrenttofx][i] += tmpoutl[i]; - partfxinputr[sendcurrenttofx][i] += tmpoutr[i]; - } - if(subnote->finished() != 0) { - delete (subnote); - partnote[k].kititem[item].subnote = NULL; - } - } - //get from the PADnote - if(padnote != NULL) { - noteplay++; - if(padnote->ready != 0) - padnote->noteout(&tmpoutl[0], &tmpoutr[0]); - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmpoutl[i] = 0.0; - tmpoutr[i] = 0.0; - } - ; - if(padnote->finished() != 0) { - delete (padnote); - partnote[k].kititem[item].padnote = NULL; - } - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //add the PADnote to part(mix) - partfxinputl[sendcurrenttofx][i] += tmpoutl[i]; - partfxinputr[sendcurrenttofx][i] += tmpoutr[i]; - } - } - } - //Kill note if there is no synth on that note - if(noteplay == 0) - KillNotePos(k); - } - - - //Apply part's effects and mix them - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { - if(!Pefxbypass[nefx]) { - partefx[nefx]->out(partfxinputl[nefx], partfxinputr[nefx]); - if(Pefxroute[nefx] == 2) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - partfxinputl[nefx + 1][i] += partefx[nefx]->efxoutl[i]; - partfxinputr[nefx + 1][i] += partefx[nefx]->efxoutr[i]; - } - } - } - int routeto = ((Pefxroute[nefx] == 0) ? nefx + 1 : NUM_PART_EFX); - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - partfxinputl[routeto][i] += partfxinputl[nefx][i]; - partfxinputr[routeto][i] += partfxinputr[nefx][i]; - } - } - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - partoutl[i] = partfxinputl[NUM_PART_EFX][i]; - partoutr[i] = partfxinputr[NUM_PART_EFX][i]; - } - - //Kill All Notes if killallnotes!=0 - if(killallnotes != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmp = - (SOUND_BUFFER_SIZE - i) / (REALTYPE) SOUND_BUFFER_SIZE; - partoutl[i] *= tmp; - partoutr[i] *= tmp; - tmpoutl[i] = 0.0; - tmpoutr[i] = 0.0; - } - for(int k = 0; k < POLIPHONY; k++) - KillNotePos(k); - killallnotes = 0; - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) - partefx[nefx]->cleanup(); - ; - } - ctl.updateportamento(); -} - -/* - * Parameter control - */ -void Part::setPvolume(char Pvolume_) -{ - Pvolume = Pvolume_; - volume = dB2rap((Pvolume - 96.0) / 96.0 * 40.0) * ctl.expression.relvolume; -} - -void Part::setPpanning(char Ppanning_) -{ - Ppanning = Ppanning_; - panning = Ppanning / 127.0 + ctl.panning.pan; - if(panning < 0.0) - panning = 0.0; - else - if(panning > 1.0) - panning = 1.0; -} - -/* - * Enable or disable a kit item - */ -void Part::setkititemstatus(int kititem, int Penabled_) -{ - if((kititem == 0) || (kititem >= NUM_KIT_ITEMS)) - return; //nonexistent kit item and the first kit item is always enabled - kit[kititem].Penabled = Penabled_; - - bool resetallnotes = false; - if(Penabled_ == 0) { - if(kit[kititem].adpars != NULL) - delete (kit[kititem].adpars); - if(kit[kititem].subpars != NULL) - delete (kit[kititem].subpars); - if(kit[kititem].padpars != NULL) { - delete (kit[kititem].padpars); - resetallnotes = true; - } - kit[kititem].adpars = NULL; - kit[kititem].subpars = NULL; - kit[kititem].padpars = NULL; - kit[kititem].Pname[0] = '\0'; - } - else { - if(kit[kititem].adpars == NULL) - kit[kititem].adpars = new ADnoteParameters(fft); - if(kit[kititem].subpars == NULL) - kit[kititem].subpars = new SUBnoteParameters(); - if(kit[kititem].padpars == NULL) - kit[kititem].padpars = new PADnoteParameters(fft, mutex); - } - - if(resetallnotes) - for(int k = 0; k < POLIPHONY; k++) - KillNotePos(k); -} - - - -void Part::add2XMLinstrument(XMLwrapper *xml) -{ - xml->beginbranch("INFO"); - xml->addparstr("name", (char *)Pname); - xml->addparstr("author", (char *)info.Pauthor); - xml->addparstr("comments", (char *)info.Pcomments); - xml->addpar("type", info.Ptype); - xml->endbranch(); - - - xml->beginbranch("INSTRUMENT_KIT"); - xml->addpar("kit_mode", Pkitmode); - xml->addparbool("drum_mode", Pdrummode); - - for(int i = 0; i < NUM_KIT_ITEMS; i++) { - xml->beginbranch("INSTRUMENT_KIT_ITEM", i); - xml->addparbool("enabled", kit[i].Penabled); - if(kit[i].Penabled != 0) { - xml->addparstr("name", (char *)kit[i].Pname); - - xml->addparbool("muted", kit[i].Pmuted); - xml->addpar("min_key", kit[i].Pminkey); - xml->addpar("max_key", kit[i].Pmaxkey); - - xml->addpar("send_to_instrument_effect", kit[i].Psendtoparteffect); - - xml->addparbool("add_enabled", kit[i].Padenabled); - if((kit[i].Padenabled != 0) && (kit[i].adpars != NULL)) { - xml->beginbranch("ADD_SYNTH_PARAMETERS"); - kit[i].adpars->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("sub_enabled", kit[i].Psubenabled); - if((kit[i].Psubenabled != 0) && (kit[i].subpars != NULL)) { - xml->beginbranch("SUB_SYNTH_PARAMETERS"); - kit[i].subpars->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("pad_enabled", kit[i].Ppadenabled); - if((kit[i].Ppadenabled != 0) && (kit[i].padpars != NULL)) { - xml->beginbranch("PAD_SYNTH_PARAMETERS"); - kit[i].padpars->add2XML(xml); - xml->endbranch(); - } - } - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("INSTRUMENT_EFFECTS"); - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { - xml->beginbranch("INSTRUMENT_EFFECT", nefx); - xml->beginbranch("EFFECT"); - partefx[nefx]->add2XML(xml); - xml->endbranch(); - - xml->addpar("route", Pefxroute[nefx]); - partefx[nefx]->setdryonly(Pefxroute[nefx] == 2); - xml->addparbool("bypass", Pefxbypass[nefx]); - xml->endbranch(); - } - xml->endbranch(); -} - - -void Part::add2XML(XMLwrapper *xml) -{ - //parameters - xml->addparbool("enabled", Penabled); - if((Penabled == 0) && (xml->minimal)) - return; - - xml->addpar("volume", Pvolume); - xml->addpar("panning", Ppanning); - - xml->addpar("min_key", Pminkey); - xml->addpar("max_key", Pmaxkey); - xml->addpar("key_shift", Pkeyshift); - xml->addpar("rcv_chn", Prcvchn); - - xml->addpar("velocity_sensing", Pvelsns); - xml->addpar("velocity_offset", Pveloffs); - - xml->addparbool("note_on", Pnoteon); - xml->addparbool("poly_mode", Ppolymode); - xml->addpar("legato_mode", Plegatomode); - xml->addpar("key_limit", Pkeylimit); - - xml->beginbranch("INSTRUMENT"); - add2XMLinstrument(xml); - xml->endbranch(); - - xml->beginbranch("CONTROLLER"); - ctl.add2XML(xml); - xml->endbranch(); -} - -int Part::saveXML(char *filename) -{ - XMLwrapper *xml; - xml = new XMLwrapper(); - - xml->beginbranch("INSTRUMENT"); - add2XMLinstrument(xml); - xml->endbranch(); - - int result = xml->saveXMLfile(filename); - delete (xml); - return result; -} - -int Part::loadXMLinstrument(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); - return -1; - } - - if(xml->enterbranch("INSTRUMENT") == 0) - return -10; - getfromXMLinstrument(xml); - xml->exitbranch(); - - delete (xml); - return 0; -} - - -void Part::applyparameters() -{ - for(int n = 0; n < NUM_KIT_ITEMS; n++) - if((kit[n].padpars != NULL) && (kit[n].Ppadenabled != 0)) - kit[n].padpars->applyparameters(true); - ; -} - -void Part::getfromXMLinstrument(XMLwrapper *xml) -{ - if(xml->enterbranch("INFO")) { - xml->getparstr("name", (char *)Pname, PART_MAX_NAME_LEN); - xml->getparstr("author", (char *)info.Pauthor, MAX_INFO_TEXT_SIZE); - xml->getparstr("comments", (char *)info.Pcomments, MAX_INFO_TEXT_SIZE); - info.Ptype = xml->getpar("type", info.Ptype, 0, 16); - - xml->exitbranch(); - } - - if(xml->enterbranch("INSTRUMENT_KIT")) { - Pkitmode = xml->getpar127("kit_mode", Pkitmode); - Pdrummode = xml->getparbool("drum_mode", Pdrummode); - - setkititemstatus(0, 0); - for(int i = 0; i < NUM_KIT_ITEMS; i++) { - if(xml->enterbranch("INSTRUMENT_KIT_ITEM", i) == 0) - continue; - setkititemstatus(i, xml->getparbool("enabled", kit[i].Penabled)); - if(kit[i].Penabled == 0) { - xml->exitbranch(); - continue; - } - - xml->getparstr("name", (char *)kit[i].Pname, PART_MAX_NAME_LEN); - - kit[i].Pmuted = xml->getparbool("muted", kit[i].Pmuted); - kit[i].Pminkey = xml->getpar127("min_key", kit[i].Pminkey); - kit[i].Pmaxkey = xml->getpar127("max_key", kit[i].Pmaxkey); - - kit[i].Psendtoparteffect = xml->getpar127( - "send_to_instrument_effect", - kit[i].Psendtoparteffect); - - kit[i].Padenabled = xml->getparbool("add_enabled", - kit[i].Padenabled); - if(xml->enterbranch("ADD_SYNTH_PARAMETERS")) { - kit[i].adpars->getfromXML(xml); - xml->exitbranch(); - } - - kit[i].Psubenabled = xml->getparbool("sub_enabled", - kit[i].Psubenabled); - if(xml->enterbranch("SUB_SYNTH_PARAMETERS")) { - kit[i].subpars->getfromXML(xml); - xml->exitbranch(); - } - - kit[i].Ppadenabled = xml->getparbool("pad_enabled", - kit[i].Ppadenabled); - if(xml->enterbranch("PAD_SYNTH_PARAMETERS")) { - kit[i].padpars->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - - xml->exitbranch(); - } - - - if(xml->enterbranch("INSTRUMENT_EFFECTS")) { - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { - if(xml->enterbranch("INSTRUMENT_EFFECT", nefx) == 0) - continue; - if(xml->enterbranch("EFFECT")) { - partefx[nefx]->getfromXML(xml); - xml->exitbranch(); - } - - Pefxroute[nefx] = xml->getpar("route", - Pefxroute[nefx], - 0, - NUM_PART_EFX); - partefx[nefx]->setdryonly(Pefxroute[nefx] == 2); - Pefxbypass[nefx] = xml->getparbool("bypass", Pefxbypass[nefx]); - xml->exitbranch(); - } - xml->exitbranch(); - } -} - -void Part::getfromXML(XMLwrapper *xml) -{ - Penabled = xml->getparbool("enabled", Penabled); - - setPvolume(xml->getpar127("volume", Pvolume)); - setPpanning(xml->getpar127("panning", Ppanning)); - - Pminkey = xml->getpar127("min_key", Pminkey); - Pmaxkey = xml->getpar127("max_key", Pmaxkey); - Pkeyshift = xml->getpar127("key_shift", Pkeyshift); - Prcvchn = xml->getpar127("rcv_chn", Prcvchn); - - Pvelsns = xml->getpar127("velocity_sensing", Pvelsns); - Pveloffs = xml->getpar127("velocity_offset", Pveloffs); - - Pnoteon = xml->getparbool("note_on", Pnoteon); - Ppolymode = xml->getparbool("poly_mode", Ppolymode); - Plegatomode = xml->getparbool("legato_mode", Plegatomode); //older versions - if(!Plegatomode) - Plegatomode = xml->getpar127("legato_mode", Plegatomode); - Pkeylimit = xml->getpar127("key_limit", Pkeylimit); - - - if(xml->enterbranch("INSTRUMENT")) { - getfromXMLinstrument(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("CONTROLLER")) { - ctl.getfromXML(xml); - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Misc/Part.h b/plugins/zynaddsubfx/src/Misc/Part.h deleted file mode 100644 index 66169e3e3..000000000 --- a/plugins/zynaddsubfx/src/Misc/Part.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Part.h - Part implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PART_H -#define PART_H - -#define MAX_INFO_TEXT_SIZE 1000 - -#include "../globals.h" -#include "../Params/ADnoteParameters.h" -#include "../Params/SUBnoteParameters.h" -#include "../Params/PADnoteParameters.h" -#include "../Synth/ADnote.h" -#include "../Synth/SUBnote.h" -#include "../Synth/PADnote.h" -#include "../Params/Controller.h" -#include "../Misc/Microtonal.h" -#include "../DSP/FFTwrapper.h" -#include "../Effects/EffectMgr.h" -#include "XMLwrapper.h" - -#include // For the monomemnotes list. - -/** Part implementation*/ -class Part -{ - public: - /**Constructor - * @param microtonal_ Pointer to the microtonal object - * @param fft_ Pointer to the FFTwrapper - * @param mutex_ Pointer to the master pthread_mutex_t*/ - Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_); - /**Destructor*/ - ~Part(); - - // Midi commands implemented - void NoteOn(unsigned char note, - unsigned char velocity, - int masterkeyshift); - void NoteOff(unsigned char note); - void AllNotesOff(); //panic - void SetController(unsigned int type, int par); - void RelaseSustainedKeys(); //this is called when the sustain pedal is relased - void RelaseAllKeys(); //this is called on AllNotesOff controller - - /* The synthesizer part output */ - void ComputePartSmps(); //Part output - - //instrumentonly: 0 - save all, 1 - save only instrumnet, 2 - save only instrument without the name(used in bank) - - - //saves the instrument settings to a XML file - //returns 0 for ok or <0 if there is an error - int saveXML(char *filename); - int loadXMLinstrument(const char *filename); - - void add2XML(XMLwrapper *xml); - void add2XMLinstrument(XMLwrapper *xml); - - void defaults(); - void defaultsinstrument(); - - void applyparameters(); - - void getfromXML(XMLwrapper *xml); - void getfromXMLinstrument(XMLwrapper *xml); - - void cleanup(); - -// ADnoteParameters *ADPartParameters; -// SUBnoteParameters *SUBPartParameters; - - //the part's kit - struct { - unsigned char Penabled, Pmuted, Pminkey, Pmaxkey; - unsigned char *Pname; - unsigned char Padenabled, Psubenabled, Ppadenabled; - unsigned char Psendtoparteffect; - ADnoteParameters *adpars; - SUBnoteParameters *subpars; - PADnoteParameters *padpars; - } kit[NUM_KIT_ITEMS]; - - - //Part parameters - void setkeylimit(unsigned char Pkeylimit); - void setkititemstatus(int kititem, int Penabled_); - - unsigned char Penabled; /** monomemnotes; // A list to remember held notes. - struct { - unsigned char velocity; - int mkeyshift; // I'm not sure masterkeyshift should be remembered. - } monomem[256]; /* 256 is to cover all possible note values. - monomem[] is used in conjunction with the list to - store the velocity and masterkeyshift values of a - given note (the list only store note values). - For example 'monomem[note].velocity' would be the - velocity value of the note 'note'. - */ - - PartNotes partnote[POLIPHONY]; - - REALTYPE *tmpoutl; //used to get the note - REALTYPE *tmpoutr; - - REALTYPE oldfreq; //this is used for portamento - Microtonal *microtonal; - FFTwrapper *fft; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp b/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp deleted file mode 100644 index a329e043a..000000000 --- a/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp +++ /dev/null @@ -1,550 +0,0 @@ -/* - * QtXmlWrapper.cpp - a QtXml based XML backend for ZynAddSubxFX - * - * Copyright (c) 2009 Tobias Doerffel - * - * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * 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 (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -/* File derived from QtXmlWrapper.C: */ -/* - ZynAddSubFX - a software synthesizer - - QtXmlWrapper.C - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "QtXmlWrapper.h" -#include -#include -#include -#include -#include "lmmsconfig.h" -#include "../globals.h" -#include "Util.h" - - -struct XmlData -{ - XmlData() : - m_doc( "ZynAddSubFX-data" ) - { - } - QDomDocument m_doc; - QDomElement m_node; - QDomElement m_info; - - QDomElement addparams( const char *name, unsigned int params, ... ); -} ; - - - -QtXmlWrapper::QtXmlWrapper() : - d( new XmlData ) -{ - version.Major = 2; - version.Minor = 4; - version.Revision = 1; - - minimal = true; - - d->m_node = d->m_doc.createElement( "ZynAddSubFX-data" ); - d->m_node.setAttribute( "version-major", QString::number( version.Major ) ); - d->m_node.setAttribute( "version-minor", QString::number( version.Minor ) ); - d->m_node.setAttribute( "version-revision", QString::number( version.Revision ) ); - d->m_node.setAttribute( "ZynAddSubFX-author", "Nasca Octavian Paul" ); - d->m_doc.appendChild( d->m_node ); - - //make the empty branch that will contain the information parameters - d->m_info = d->addparams("INFORMATION", 0); - - //save zynaddsubfx specifications - beginbranch("BASE_PARAMETERS"); - addpar("max_midi_parts", NUM_MIDI_PARTS); - addpar("max_kit_items_per_instrument", NUM_KIT_ITEMS); - - addpar("max_system_effects", NUM_SYS_EFX); - addpar("max_insertion_effects", NUM_INS_EFX); - addpar("max_instrument_effects", NUM_PART_EFX); - - addpar("max_addsynth_voices", NUM_VOICES); - endbranch(); -} - - - - -QtXmlWrapper::~QtXmlWrapper() -{ - delete d; -} - - - - -void QtXmlWrapper::setPadSynth(bool enabled) -{ - /**@bug this might create multiple nodes when only one is needed*/ - QDomElement oldNode = d->m_node; - d->m_node = d->m_info; - //Info storing - addparbool("PADsynth_used", enabled); - d->m_node = oldNode; -} - -QDomElement findElement( QDomElement root, const QString & tagname, const QString & attrname, - const QString & attrval ) -{ - QDomNodeList list = root.elementsByTagName( tagname ); - for( int i = 0; i < list.size(); ++i ) - { - QDomNode n = list.at( i ); - if( n.isElement() ) - { - QDomElement e = n.toElement(); - if( e.hasAttribute( attrname ) && e.attribute( attrname ) == attrval ) - { - return e; - } - } - } - - return QDomElement(); -} - - - - -bool QtXmlWrapper::hasPadSynth() const -{ - /**Right now this has a copied implementation of setparbool, so this should - * be reworked as XMLwrapper evolves*/ - QDomElement tmp = d->m_doc.elementsByTagName( "INFORMATION" ).at( 0 ).toElement(); - QDomElement parameter = findElement( tmp, "par_bool", "name", "PADsynth_used" ); - if( !parameter.isNull() ) - { - const QString val = parameter.attribute( "value" ).toLower(); - return val[0] == 'y'; - } - return false; -} - - -/* SAVE XML members */ - -int QtXmlWrapper::saveXMLfile(const std::string &filename) const -{ - char *xmldata = getXMLdata(); - if(xmldata == NULL) - return -2; - - int compression = config.cfg.GzipCompression; - int result = dosavefile(filename.c_str(), compression, xmldata); - - delete[] xmldata; - return result; -} - - -char *QtXmlWrapper::getXMLdata() const -{ - QString xml = d->m_doc.toString( 1 ); - return qstrdup( xml.toUtf8().constData() ); -} - - -int QtXmlWrapper::dosavefile(const char *filename, - int compression, - const char *xmldata) const -{ - if(compression == 0) { - FILE *file; - file = fopen(filename, "w"); - if(file == NULL) - return -1; - fputs(xmldata, file); - fclose(file); - } - else { - if(compression > 9) - compression = 9; - if(compression < 1) - compression = 1; - char options[10]; - snprintf(options, 10, "wb%d", compression); - - gzFile gzfile; - gzfile = gzopen(filename, options); - if(gzfile == NULL) - return -1; - gzputs(gzfile, xmldata); - gzclose(gzfile); - } - - return 0; -} - - - -void QtXmlWrapper::addpar(const std::string &name, int val) -{ - d->addparams("par", 2, "name", name.c_str(), "value", stringFrom( - val).c_str()); -} - -void QtXmlWrapper::addparreal(const std::string &name, REALTYPE val) -{ - d->addparams("par_real", 2, "name", name.c_str(), "value", - stringFrom(val).c_str()); -} - -void QtXmlWrapper::addparbool(const std::string &name, int val) -{ - if(val != 0) - d->addparams("par_bool", 2, "name", name.c_str(), "value", "yes"); - else - d->addparams("par_bool", 2, "name", name.c_str(), "value", "no"); -} - -void QtXmlWrapper::addparstr(const std::string &name, const std::string &val) -{ - QDomElement e = d->m_doc.createElement( "string" ); - e.setAttribute( "name", name.c_str() ); - e.appendChild( d->m_doc.createTextNode( val.c_str() ) ); - d->m_node.appendChild( e ); -} - - -void QtXmlWrapper::beginbranch(const std::string &name) -{ - d->m_node = d->addparams(name.c_str(), 0); -} - -void QtXmlWrapper::beginbranch(const std::string &name, int id) -{ - d->m_node = d->addparams(name.c_str(), 1, "id", stringFrom(id).c_str()); -} - -void QtXmlWrapper::endbranch() -{ - d->m_node = d->m_node.parentNode().toElement(); -} - - - -/* LOAD XML members */ - -int QtXmlWrapper::loadXMLfile(const std::string &filename) -{ - const char *xmldata = doloadfile(filename.c_str()); - if(xmldata == NULL) - { - qDebug() << "QtXmlWrapper::loadXMLfile(): empty data"; - return -1; //the file could not be loaded or uncompressed - } - - QByteArray b( xmldata ); - while( !b.isEmpty() && b[0] != '<' ) - { - // remove first blank line - b.remove( 0, 1 ); - } - - if( !d->m_doc.setContent( b ) ) - { - qDebug() << "QtXmlWrapper::loadXMLfile(): could not set document content"; - delete[] xmldata; - return -2; - } - delete[] xmldata; - - d->m_node = d->m_doc.elementsByTagName( "ZynAddSubFX-data" ).at( 0 ).toElement(); - if( d->m_node.isNull() || !d->m_node.isElement() ) - { - qDebug() << "QtXmlWrapper::loadXMLfile(): missing root node"; - return -3; //the XML doesnt embbed zynaddsubfx data - } - QDomElement root = d->m_node.toElement(); - //fetch version information - version.Major = root.attribute( "version-major").toInt(); - version.Minor = root.attribute( "version-minor").toInt(); - version.Revision = root.attribute( "version-revision").toInt(); - - return 0; -} - - -char *QtXmlWrapper::doloadfile(const std::string &filename) const -{ - char *xmldata = NULL; - gzFile gzfile = gzopen(filename.c_str(), "rb"); - - if(gzfile != NULL) { //The possibly compressed file opened - std::stringstream strBuf; //reading stream - const int bufSize = 500; //fetch size - char fetchBuf[bufSize + 1]; //fetch buffer - int read = 0; //chars read in last fetch - - fetchBuf[bufSize] = 0; //force null termination - - while(bufSize == (read = gzread(gzfile, fetchBuf, bufSize))) - strBuf << fetchBuf; - - fetchBuf[read] = 0; //Truncate last partial read - strBuf << fetchBuf; - - gzclose(gzfile); - - //Place data in output format - std::string tmp = strBuf.str(); - xmldata = new char[tmp.size() + 1]; - strncpy(xmldata, tmp.c_str(), tmp.size() + 1); - } - - return xmldata; -} - -bool QtXmlWrapper::putXMLdata(const char *xmldata) -{ - d->m_doc.setContent( QString::fromUtf8( xmldata ) ); - - d->m_node = d->m_doc.elementsByTagName( "ZynAddSubFX-data" ).at( 0 ).toElement(); - if( d->m_node.isNull() ) - { - return false; - } - - return true; -} - - - -int QtXmlWrapper::enterbranch(const std::string &name) -{ - QDomElement tmp = d->m_node.firstChildElement( name.c_str() ); - if( tmp.isNull() ) - { - return 0; - } - - d->m_node = tmp; - - return 1; -} - -int QtXmlWrapper::enterbranch(const std::string &name, int id) -{ - QDomElement tmp = findElement( d->m_node, name.c_str(), - "id", QString::number( id ) ); - if( tmp.isNull() ) - { - return 0; - } - - d->m_node = tmp; - - return 1; -} - - -void QtXmlWrapper::exitbranch() -{ - d->m_node = d->m_node.parentNode().toElement(); -} - - -int QtXmlWrapper::getbranchid(int min, int max) const -{ - if( !d->m_node.isElement() ) - { - return min; - } - QDomElement tmp = d->m_node.toElement(); - if( !tmp.hasAttribute( "id" ) ) - { - return min; - } - int id = tmp.attribute( "id" ).toInt(); - if((min == 0) && (max == 0)) - return id; - - if(id < min) - id = min; - else - if(id > max) - id = max; - - return id; -} - -int QtXmlWrapper::getpar(const std::string &name, int defaultpar, int min, - int max) const -{ - QDomElement tmp = findElement( d->m_node, "par", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasAttribute( "value" ) ) - { - return defaultpar; - } - - int val = tmp.attribute( "value" ).toInt(); - if(val < min) - val = min; - else - if(val > max) - val = max; - - return val; -} - -int QtXmlWrapper::getpar127(const std::string &name, int defaultpar) const -{ - return getpar(name, defaultpar, 0, 127); -} - -int QtXmlWrapper::getparbool(const std::string &name, int defaultpar) const -{ - QDomElement tmp = findElement( d->m_node, "par_bool", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasAttribute( "value" ) ) - { - return defaultpar; - } - - const QString val = tmp.attribute( "value" ).toLower(); - if( val[0] == 'y' ) - { - return 1; - } - return 0; -} - -void QtXmlWrapper::getparstr(const std::string &name, char *par, int maxstrlen) const -{ - ZERO(par, maxstrlen); - QDomNode tmp = findElement( d->m_node, "string", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasChildNodes() ) - { - return; - } - - tmp = tmp.firstChild(); - if( tmp.nodeType() == QDomNode::ElementNode ) - { - snprintf(par, maxstrlen, "%s", tmp.toElement().tagName().toUtf8().constData() ); - return; - } - if( tmp.nodeType() == QDomNode::TextNode ) - { - snprintf(par, maxstrlen, "%s", tmp.toText().data().toUtf8().constData() ); - return; - } -} - -std::string QtXmlWrapper::getparstr(const std::string &name, - const std::string &defaultpar) const -{ - QDomNode tmp = findElement( d->m_node, "string", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasChildNodes() ) - { - return defaultpar; - } - - tmp = tmp.firstChild(); - if( tmp.nodeType() == QDomNode::ElementNode && !tmp.toElement().tagName().isEmpty() ) - { - return tmp.toElement().tagName().toUtf8().constData(); - } - if( tmp.nodeType() == QDomNode::TextNode && !tmp.toText().data().isEmpty() ) - { - return tmp.toText().data().toUtf8().constData(); - } - - return defaultpar; -} - -REALTYPE QtXmlWrapper::getparreal(const char *name, REALTYPE defaultpar) const -{ - QDomElement tmp = findElement( d->m_node, "par_real", "name", name ); - if( tmp.isNull() || !tmp.hasAttribute( "value" ) ) - { - return defaultpar; - } - - return tmp.attribute( "value" ).toFloat(); -} - -REALTYPE QtXmlWrapper::getparreal(const char *name, - REALTYPE defaultpar, - REALTYPE min, - REALTYPE max) const -{ - REALTYPE result = getparreal(name, defaultpar); - - if(result < min) - result = min; - else - if(result > max) - result = max; - return result; -} - - -/** Private members **/ - -QDomElement XmlData::addparams(const char *name, unsigned int params, - ...) -{ - /**@todo make this function send out a good error message if something goes - * wrong**/ - QDomElement element = m_doc.createElement( name ); - m_node.appendChild( element ); - - if(params) { - va_list variableList; - va_start(variableList, params); - - const char *ParamName; - const char *ParamValue; - while(params--) { - ParamName = va_arg(variableList, const char *); - ParamValue = va_arg(variableList, const char *); - element.setAttribute( ParamName, ParamValue); - } - } - return element; -} - diff --git a/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.h b/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.h deleted file mode 100644 index 0f478dd97..000000000 --- a/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * QtXmlWrapper.h - a QtXml based XML backend for ZynAddSubxFX - * - * Copyright (c) 2009 Tobias Doerffel - * - * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * 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 (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -/* File derived from XMLwrapper.h: */ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.h - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef QT_XML_WRAPPER_H -#define QT_XML_WRAPPER_H - -#include "../globals.h" - -#include -#include -#include -#include - -#define QtXmlWrapper XMLwrapper - -struct XmlData; - -class QtXmlWrapper -{ -public: - QtXmlWrapper(); - ~QtXmlWrapper(); - - int saveXMLfile( const std::string & filename ) const; - int loadXMLfile( const std::string & filename ); - - char *getXMLdata() const; - bool putXMLdata( const char *xmldata ); - - void addpar( const std::string & name, int val ); - void addparreal( const std::string & name, REALTYPE val); - void addparbool( const std::string & name, int val ); - void addparstr( const std::string & name, const std::string & val ); - - void beginbranch( const std::string & name ); - void beginbranch( const std::string & name, int id ); - void endbranch(); - - - int enterbranch( const std::string & name ); - int enterbranch( const std::string & name, int id ); - void exitbranch(); - int getbranchid( int min, int max ) const; - - int getpar( const std::string & name, int defaultpar, int min, int max ) const; - int getpar127( const std::string & name, int defaultpar ) const; - int getparbool( const std::string & name, int defaultpar ) const; - - void getparstr( const std::string & name, char * par, int maxstrlen ) const; - std::string getparstr( const std::string & name, const std::string & defaultpar ) const; - REALTYPE getparreal( const char * name, REALTYPE defaultpar ) const; - - REALTYPE getparreal(const char *name, REALTYPE defaultpar, REALTYPE min, REALTYPE max) const; - - bool minimal; /** -Stereo::Stereo(const T &left, const T &right) - :l(left), r(right) -{} - -template -Stereo::Stereo(const T &val) - :l(val), r(val) -{} - -template -Stereo &Stereo::operator=(const Stereo &nstr) -{ - l = nstr.l; - r = nstr.r; - return *this; -} - diff --git a/plugins/zynaddsubfx/src/Misc/Stereo.h b/plugins/zynaddsubfx/src/Misc/Stereo.h deleted file mode 100644 index 06ee63c80..000000000 --- a/plugins/zynaddsubfx/src/Misc/Stereo.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Stereo.h - Object for storing a pair of objects - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef STEREO_H -#define STEREO_H - -template -struct Stereo -{ - public: - Stereo(const T &left, const T &right); - - /**Initializes Stereo with left and right set to val - * @param val the value for both channels*/ - Stereo(const T &val); - ~Stereo() {} - - Stereo &operator=(const Stereo &smp); - - //data - T l, r; -}; -#include "Stereo.cpp" -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/Util.cpp b/plugins/zynaddsubfx/src/Misc/Util.cpp deleted file mode 100644 index a7ea4328d..000000000 --- a/plugins/zynaddsubfx/src/Misc/Util.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Util.cpp - Miscellaneous functions - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Util.h" -#include -#include - -#include -#include -#include -#include -#include -#include - -int SAMPLE_RATE = 44100; -int SOUND_BUFFER_SIZE = 256; -int OSCIL_SIZE = 1024; - -Config config; -REALTYPE *denormalkillbuf; - - -/* - * Transform the velocity according the scaling parameter (velocity sensing) - */ -REALTYPE VelF(REALTYPE velocity, unsigned char scaling) -{ - REALTYPE x; - x = pow(VELOCITY_MAX_SCALE, (64.0 - scaling) / 64.0); - if((scaling == 127) || (velocity > 0.99)) - return 1.0; - else - return pow(velocity, x); -} - -/* - * Get the detune in cents - */ -REALTYPE getdetune(unsigned char type, - unsigned short int coarsedetune, - unsigned short int finedetune) -{ - REALTYPE det = 0.0, octdet = 0.0, cdet = 0.0, findet = 0.0; - //Get Octave - int octave = coarsedetune / 1024; - if(octave >= 8) - octave -= 16; - octdet = octave * 1200.0; - - //Coarse and fine detune - int cdetune = coarsedetune % 1024; - if(cdetune > 512) - cdetune -= 1024; - - int fdetune = finedetune - 8192; - - switch(type) { -// case 1: is used for the default (see below) - case 2: - cdet = fabs(cdetune * 10.0); - findet = fabs(fdetune / 8192.0) * 10.0; - break; - case 3: - cdet = fabs(cdetune * 100); - findet = pow(10, fabs(fdetune / 8192.0) * 3.0) / 10.0 - 0.1; - break; - case 4: - cdet = fabs(cdetune * 701.95500087); //perfect fifth - findet = (pow(2, fabs(fdetune / 8192.0) * 12.0) - 1.0) / 4095 * 1200; - break; - //case ...: need to update N_DETUNE_TYPES, if you'll add more - default: - cdet = fabs(cdetune * 50.0); - findet = fabs(fdetune / 8192.0) * 35.0; //almost like "Paul's Sound Designer 2" - break; - } - if(finedetune < 8192) - findet = -findet; - if(cdetune < 0) - cdet = -cdet; - - det = octdet + cdet + findet; - return det; -} - - -bool fileexists(const char *filename) -{ - struct stat tmp; - int result = stat(filename, &tmp); - if(result >= 0) - return true; - - return false; -} - -void invSignal(REALTYPE *sig, size_t len) -{ - for(unsigned int i = 0; i < len; i++) - sig[i] *= -1.0f; -} - -void crossover(REALTYPE &a, REALTYPE &b, REALTYPE crossover) -{ - REALTYPE tmpa = a; - REALTYPE tmpb = b; - a = tmpa * (1.0 - crossover) + tmpb * crossover; - b = tmpb * (1.0 - crossover) + tmpa * crossover; -} - - diff --git a/plugins/zynaddsubfx/src/Misc/Util.h b/plugins/zynaddsubfx/src/Misc/Util.h deleted file mode 100644 index d77f457f4..000000000 --- a/plugins/zynaddsubfx/src/Misc/Util.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Util.h - Miscellaneous functions - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef UTIL_H -#define UTIL_H - -#include -#include -#include -#include "../globals.h" -#include "Config.h" - -//Velocity Sensing function -extern REALTYPE VelF(REALTYPE velocity, unsigned char scaling); - -bool fileexists(const char *filename); - -#define N_DETUNE_TYPES 4 //the number of detune types -extern REALTYPE getdetune(unsigned char type, - unsigned short int coarsedetune, - unsigned short int finedetune); - -extern REALTYPE *denormalkillbuf; /** -std::string stringFrom(T x) -{ - std::stringstream ss; - ss << x; - return ss.str(); -} - -template -std::string stringFrom(REALTYPE x) -{ - char buf[64]; - sprintf( buf, "%f", x ); - return buf; -} - - -template -T stringTo(const char *x) -{ - std::string str = x != NULL ? x : "0"; //should work for the basic float/int - std::stringstream ss(str); - T ans; - ss >> ans; - return ans; -} - -template -T limit(T val, T min, T max) -{ - return (val < min ? min : (val > max ? max : val)); -} - -#endif - diff --git a/plugins/zynaddsubfx/src/Misc/XMLwrapper.cpp b/plugins/zynaddsubfx/src/Misc/XMLwrapper.cpp deleted file mode 100644 index d3750c47e..000000000 --- a/plugins/zynaddsubfx/src/Misc/XMLwrapper.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.cpp - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "XMLwrapper.h" -#include -#include -#include -#include -#include -#include -#include - -#include "../globals.h" -#include "Util.h" - -using namespace std; - -int xml_k = 0; -bool verbose = false; - -const char *XMLwrapper_whitespace_callback(mxml_node_t *node, int where) -{ - const char *name = node->value.element.name; - - if((where == MXML_WS_BEFORE_OPEN) && (!strcmp(name, "?xml"))) - return NULL; - if((where == MXML_WS_BEFORE_CLOSE) && (!strcmp(name, "string"))) - return NULL; - - if((where == MXML_WS_BEFORE_OPEN) || (where == MXML_WS_BEFORE_CLOSE)) - /* const char *tmp=node->value.element.name; - if (tmp!=NULL) { - if ((strstr(tmp,"par")!=tmp)&&(strstr(tmp,"string")!=tmp)) { - printf("%s ",tmp); - if (where==MXML_WS_BEFORE_OPEN) xml_k++; - if (where==MXML_WS_BEFORE_CLOSE) xml_k--; - if (xml_k>=STACKSIZE) xml_k=STACKSIZE-1; - if (xml_k<0) xml_k=0; - printf("%d\n",xml_k); - printf("\n"); - }; - - }; - int i=0; - for (i=1;i(mxmlFindElement( - const_cast(node), - const_cast(top), - name, attr, value, descend)); -} - -//temporary const overload of mxmlElementGetAttr -const char *mxmlElementGetAttr(const mxml_node_t *node, const char *name) -{ - return mxmlElementGetAttr(const_cast(node), name); -} - -XMLwrapper::XMLwrapper() -{ - version.Major = 2; - version.Minor = 4; - version.Revision = 1; - - minimal = true; - - node = tree = mxmlNewElement(MXML_NO_PARENT, - "?xml version=\"1.0\" encoding=\"UTF-8\"?"); - /* for mxml 2.1 (and older) - tree=mxmlNewElement(MXML_NO_PARENT,"?xml"); - mxmlElementSetAttr(tree,"version","1.0"); - mxmlElementSetAttr(tree,"encoding","UTF-8"); - */ - - mxml_node_t *doctype = mxmlNewElement(tree, "!DOCTYPE"); - mxmlElementSetAttr(doctype, "ZynAddSubFX-data", NULL); - - node = root = addparams("ZynAddSubFX-data", 4, - "version-major", stringFrom( - version.Major).c_str(), - "version-minor", stringFrom( - version.Minor).c_str(), - "version-revision", - stringFrom(version.Revision).c_str(), - "ZynAddSubFX-author", "Nasca Octavian Paul"); - - //make the empty branch that will contain the information parameters - info = addparams("INFORMATION", 0); - - //save zynaddsubfx specifications - beginbranch("BASE_PARAMETERS"); - addpar("max_midi_parts", NUM_MIDI_PARTS); - addpar("max_kit_items_per_instrument", NUM_KIT_ITEMS); - - addpar("max_system_effects", NUM_SYS_EFX); - addpar("max_insertion_effects", NUM_INS_EFX); - addpar("max_instrument_effects", NUM_PART_EFX); - - addpar("max_addsynth_voices", NUM_VOICES); - endbranch(); -} - -XMLwrapper::~XMLwrapper() -{ - if(tree != NULL) - mxmlDelete(tree); -} - -void XMLwrapper::setPadSynth(bool enabled) -{ - /**@bug this might create multiple nodes when only one is needed*/ - mxml_node_t *oldnode = node; - node = info; - //Info storing - addparbool("PADsynth_used", enabled); - node = oldnode; -} - -bool XMLwrapper::hasPadSynth() const -{ - /**Right now this has a copied implementation of setparbool, so this should - * be reworked as XMLwrapper evolves*/ - mxml_node_t *tmp = mxmlFindElement(tree, - tree, - "INFORMATION", - NULL, - NULL, - MXML_DESCEND); - - mxml_node_t *parameter = mxmlFindElement(tmp, - tmp, - "par_bool", - "name", - "PADsynth_used", - MXML_DESCEND_FIRST); - if(parameter == NULL) //no information availiable - return false; - - const char *strval = mxmlElementGetAttr(parameter, "value"); - if(strval == NULL) //no information available - return false; - - if((strval[0] == 'Y') || (strval[0] == 'y')) - return true; - else - return false; -} - - -/* SAVE XML members */ - -int XMLwrapper::saveXMLfile(const string &filename) const -{ - char *xmldata = getXMLdata(); - if(xmldata == NULL) - return -2; - - int compression = config.cfg.GzipCompression; - int result = dosavefile(filename.c_str(), compression, xmldata); - - free(xmldata); - return result; -} - -char *XMLwrapper::getXMLdata() const -{ - xml_k = 0; - - char *xmldata = mxmlSaveAllocString(tree, XMLwrapper_whitespace_callback); - - return xmldata; -} - - -int XMLwrapper::dosavefile(const char *filename, - int compression, - const char *xmldata) const -{ - if(compression == 0) { - FILE *file; - file = fopen(filename, "w"); - if(file == NULL) - return -1; - fputs(xmldata, file); - fclose(file); - } - else { - if(compression > 9) - compression = 9; - if(compression < 1) - compression = 1; - char options[10]; - snprintf(options, 10, "wb%d", compression); - - gzFile gzfile; - gzfile = gzopen(filename, options); - if(gzfile == NULL) - return -1; - gzputs(gzfile, xmldata); - gzclose(gzfile); - } - - return 0; -} - - - -void XMLwrapper::addpar(const string &name, int val) -{ - addparams("par", 2, "name", name.c_str(), "value", stringFrom( - val).c_str()); -} - -void XMLwrapper::addparreal(const string &name, REALTYPE val) -{ - addparams("par_real", 2, "name", name.c_str(), "value", - stringFrom(val).c_str()); -} - -void XMLwrapper::addparbool(const string &name, int val) -{ - if(val != 0) - addparams("par_bool", 2, "name", name.c_str(), "value", "yes"); - else - addparams("par_bool", 2, "name", name.c_str(), "value", "no"); -} - -void XMLwrapper::addparstr(const string &name, const string &val) -{ - mxml_node_t *element = mxmlNewElement(node, "string"); - mxmlElementSetAttr(element, "name", name.c_str()); - mxmlNewText(element, 0, val.c_str()); -} - - -void XMLwrapper::beginbranch(const string &name) -{ - if(verbose) - cout << "beginbranch()" << name << endl; - node = addparams(name.c_str(), 0); -} - -void XMLwrapper::beginbranch(const string &name, int id) -{ - if(verbose) - cout << "beginbranch(" << id << ")" << name << endl; - node = addparams(name.c_str(), 1, "id", stringFrom(id).c_str()); -} - -void XMLwrapper::endbranch() -{ - if(verbose) - cout << "endbranch()" << node << "-" << node->value.element.name - << " To " - << node->parent << "-" << node->parent->value.element.name << endl; - node = node->parent; -} - - - -/* LOAD XML members */ - -int XMLwrapper::loadXMLfile(const string &filename) -{ - if(tree != NULL) - mxmlDelete(tree); - tree = NULL; - - const char *xmldata = doloadfile(filename.c_str()); - if(xmldata == NULL) - return -1; //the file could not be loaded or uncompressed - - root = tree = mxmlLoadString(NULL, xmldata, MXML_OPAQUE_CALLBACK); - - delete [] xmldata; - - if(tree == NULL) - return -2; //this is not XML - - - node = root = mxmlFindElement(tree, - tree, - "ZynAddSubFX-data", - NULL, - NULL, - MXML_DESCEND); - if(root == NULL) - return -3; //the XML doesnt embbed zynaddsubfx data - - //fetch version information - version.Major = stringTo(mxmlElementGetAttr(root, "version-major")); - version.Minor = stringTo(mxmlElementGetAttr(root, "version-minor")); - version.Revision = - stringTo(mxmlElementGetAttr(root, "version-revision")); - - if(verbose) - cout << "loadXMLfile() version: " << version.Major << '.' - << version.Minor << '.' << version.Revision << endl; - - - return 0; -} - - -char *XMLwrapper::doloadfile(const string &filename) const -{ - char *xmldata = NULL; - gzFile gzfile = gzopen(filename.c_str(), "rb"); - - if(gzfile != NULL) { //The possibly compressed file opened - stringstream strBuf; //reading stream - const int bufSize = 500; //fetch size - char fetchBuf[bufSize + 1]; //fetch buffer - int read = 0; //chars read in last fetch - - fetchBuf[bufSize] = 0; //force null termination - - while(bufSize == (read = gzread(gzfile, fetchBuf, bufSize))) - strBuf << fetchBuf; - - fetchBuf[read] = 0; //Truncate last partial read - strBuf << fetchBuf; - - gzclose(gzfile); - - //Place data in output format - string tmp = strBuf.str(); - xmldata = new char[tmp.size() + 1]; - strncpy(xmldata, tmp.c_str(), tmp.size() + 1); - } - - return xmldata; -} - -bool XMLwrapper::putXMLdata(const char *xmldata) -{ - if(tree != NULL) - mxmlDelete(tree); - - tree = NULL; - if(xmldata == NULL) - return false; - - root = tree = mxmlLoadString(NULL, xmldata, MXML_OPAQUE_CALLBACK); - if(tree == NULL) - return false; - - node = root = mxmlFindElement(tree, - tree, - "ZynAddSubFX-data", - NULL, - NULL, - MXML_DESCEND); - if(root == NULL) - return false; - - return true; -} - - - -int XMLwrapper::enterbranch(const string &name) -{ - if(verbose) - cout << "enterbranch() " << name << endl; - mxml_node_t *tmp = mxmlFindElement(node, node, - name.c_str(), NULL, NULL, - MXML_DESCEND_FIRST); - if(tmp == NULL) - return 0; - - node = tmp; - return 1; -} - -int XMLwrapper::enterbranch(const string &name, int id) -{ - if(verbose) - cout << "enterbranch(" << id << ") " << name << endl; - mxml_node_t *tmp = mxmlFindElement(node, node, - name.c_str(), "id", stringFrom( - id).c_str(), MXML_DESCEND_FIRST); - if(tmp == NULL) - return 0; - - node = tmp; - return 1; -} - - -void XMLwrapper::exitbranch() -{ - if(verbose) - cout << "exitbranch()" << node << "-" << node->value.element.name - << " To " - << node->parent << "-" << node->parent->value.element.name << endl; - node = node->parent; -} - - -int XMLwrapper::getbranchid(int min, int max) const -{ - int id = stringTo(mxmlElementGetAttr(node, "id")); - if((min == 0) && (max == 0)) - return id; - - if(id < min) - id = min; - else - if(id > max) - id = max; - - return id; -} - -int XMLwrapper::getpar(const string &name, int defaultpar, int min, - int max) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "par", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if(tmp == NULL) - return defaultpar; - - const char *strval = mxmlElementGetAttr(tmp, "value"); - if(strval == NULL) - return defaultpar; - - int val = stringTo(strval); - if(val < min) - val = min; - else - if(val > max) - val = max; - - return val; -} - -int XMLwrapper::getpar127(const string &name, int defaultpar) const -{ - return getpar(name, defaultpar, 0, 127); -} - -int XMLwrapper::getparbool(const string &name, int defaultpar) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "par_bool", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if(tmp == NULL) - return defaultpar; - - const char *strval = mxmlElementGetAttr(tmp, "value"); - if(strval == NULL) - return defaultpar; - - if((strval[0] == 'Y') || (strval[0] == 'y')) - return 1; - else - return 0; -} - -void XMLwrapper::getparstr(const string &name, char *par, int maxstrlen) const -{ - ZERO(par, maxstrlen); - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "string", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if(tmp == NULL) - return; - if(tmp->child == NULL) - return; - if(tmp->child->type == MXML_OPAQUE) { - snprintf(par, maxstrlen, "%s", tmp->child->value.element.name); - return; - } - if((tmp->child->type == MXML_TEXT) - && (tmp->child->value.text.string != NULL)) { - snprintf(par, maxstrlen, "%s", tmp->child->value.text.string); - return; - } -} - -string XMLwrapper::getparstr(const string &name, - const std::string &defaultpar) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "string", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if((tmp == NULL) || (tmp->child == NULL)) - return defaultpar; - - if((tmp->child->type == MXML_OPAQUE) - && (tmp->child->value.element.name != NULL)) - return tmp->child->value.element.name; - - if((tmp->child->type == MXML_TEXT) - && (tmp->child->value.text.string != NULL)) - return tmp->child->value.text.string; - - return defaultpar; -} - -REALTYPE XMLwrapper::getparreal(const char *name, REALTYPE defaultpar) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "par_real", - "name", - name, - MXML_DESCEND_FIRST); - if(tmp == NULL) - return defaultpar; - - const char *strval = mxmlElementGetAttr(tmp, "value"); - if(strval == NULL) - return defaultpar; - - return stringTo(strval); -} - -REALTYPE XMLwrapper::getparreal(const char *name, - REALTYPE defaultpar, - REALTYPE min, - REALTYPE max) const -{ - REALTYPE result = getparreal(name, defaultpar); - - if(result < min) - result = min; - else - if(result > max) - result = max; - return result; -} - - -/** Private members **/ - -mxml_node_t *XMLwrapper::addparams(const char *name, unsigned int params, - ...) const -{ - /**@todo make this function send out a good error message if something goes - * wrong**/ - mxml_node_t *element = mxmlNewElement(node, name); - - if(params) { - va_list variableList; - va_start(variableList, params); - - const char *ParamName; - const char *ParamValue; - while(params--) { - ParamName = va_arg(variableList, const char *); - ParamValue = va_arg(variableList, const char *); - if(verbose) - cout << "addparams()[" << params << "]=" << name << " " - << ParamName << "=\"" << ParamValue << "\"" << endl; - mxmlElementSetAttr(element, ParamName, ParamValue); - } - } - return element; -} - diff --git a/plugins/zynaddsubfx/src/Misc/XMLwrapper.h b/plugins/zynaddsubfx/src/Misc/XMLwrapper.h deleted file mode 100644 index 997ac933b..000000000 --- a/plugins/zynaddsubfx/src/Misc/XMLwrapper.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.h - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#if 1 -#include "QtXmlWrapper.h" -#else -#include -#include -#ifndef REALTYPE -#define REALTYPE float -#endif - -#ifndef XML_WRAPPER_H -#define XML_WRAPPER_H - -/**Mxml wrapper*/ -class XMLwrapper -{ - public: - /** - * Constructor. - * Will Construct the object and fill in top level branch - * */ - XMLwrapper(); - - /**Destructor*/ - ~XMLwrapper(); - - /** - * Saves the XML to a file. - * @param filename the name of the destination file. - * @returns 0 if ok or -1 if the file cannot be saved. - */ - int saveXMLfile(const std::string &filename) const; - - /** - * Return XML tree as a string. - * Note: The string must be freed with free() to deallocate - * @returns a newly allocated NULL terminated string of the XML data. - */ - char *getXMLdata() const; - - /** - * Add simple parameter. - * @param name The name of the mXML node. - * @param val The string value of the mXml node - */ - void addpar(const std::string &name, int val); - - /** - * Adds a realtype parameter. - * @param name The name of the mXML node. - * @param val The REALTYPE value of the node. - */ - void addparreal(const std::string &name, REALTYPE val); - - /** - * Add boolean parameter. - * \todo Fix this reverse boolean logic. - * @param name The name of the mXML node. - * @param val The boolean value of the node (0->"yes";else->"no"). - */ - void addparbool(const std::string &name, int val); - - /** - * Add string parameter. - * @param name The name of the mXML node. - * @param val The string value of the node. - */ - void addparstr(const std::string &name, const std::string &val); - - /** - * Create a new branch. - * @param name Name of new branch - * @see void endbranch() - */ - void beginbranch(const std::string &name); - /** - * Create a new branch. - * @param name Name of new branch - * @param id "id" value of branch - * @see void endbranch() - */ - void beginbranch(const std::string &name, int id); - - /**Closes new branches. - * This must be called to exit each branch created by beginbranch( ). - * @see void beginbranch(const std::string &name) - * @see void beginbranch(const std::string &name, int id) - */ - void endbranch(); - - /** - * Loads file into XMLwrapper. - * @param filename file to be loaded - * @returns 0 if ok or -1 if the file cannot be loaded - */ - int loadXMLfile(const std::string &filename); - - /** - * Loads string into XMLwrapper. - * @param xmldata NULL terminated string of XML data. - * @returns true if successful. - */ - bool putXMLdata(const char *xmldata); - - /** - * Enters the branch. - * @param name Name of branch. - * @returns 1 if is ok, or 0 otherwise. - */ - int enterbranch(const std::string &name); - - /** - * Enter into the branch \c name with id \c id. - * @param name Name of branch. - * @param id Value of branch's "id". - * @returns 1 if is ok, or 0 otherwise. - */ - int enterbranch(const std::string &name, int id); - - /**Exits from a branch*/ - void exitbranch(); - - /**Get the the branch_id and limits it between the min and max. - * if min==max==0, it will not limit it - * if there isn't any id, will return min - * this must be called only imediately after enterbranch() - */ - int getbranchid(int min, int max) const; - - /** - * Returns the integer value stored in node name. - * It returns the integer value between the limits min and max. - * If min==max==0, then the value will not be limited. - * If there is no location named name, then defaultpar will be returned. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - * @param min The minimum return value. - * @param max The maximum return value. - */ - int getpar(const std::string &name, int defaultpar, int min, - int max) const; - - /** - * Returns the integer value stored in the node with range [0,127]. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - int getpar127(const std::string &name, int defaultpar) const; - - /** - * Returns the boolean value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - int getparbool(const std::string &name, int defaultpar) const; - - /** - * Get the string value stored in the node. - * @param name The parameter name. - * @param par Pointer to destination string - * @param maxstrlen Max string length for destination - */ - void getparstr(const std::string &name, char *par, int maxstrlen) const; - - /** - * Get the string value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - std::string getparstr(const std::string &name, - const std::string &defaultpar) const; - - /** - * Returns the real value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - REALTYPE getparreal(const char *name, REALTYPE defaultpar) const; - - /** - * Returns the real value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - * @param min The minimum value - * @param max The maximum value - */ - REALTYPE getparreal(const char *name, - REALTYPE defaultpar, - REALTYPE min, - REALTYPE max) const; - - bool minimal; /** - * - * @param name The name of the xml node - * @param params The number of the attributes - * @param ... const char * pairs that are in the format attribute_name, - * attribute_value - */ - mxml_node_t *addparams(const char *name, unsigned int params, - ...) const; - - /**@todo keep these numbers up to date*/ - struct { - int Major; /** -#include "DSSIaudiooutput.h" -#include "../Misc/Config.h" -#include "../Misc/Bank.h" -#include - -// -// Static stubs for LADSPA member functions -// -// LADSPA is essentially a C handle based API; This plug-in implementation is -// a C++ OO one so we need stub functions to map from C API calls to C++ object -// method calls. -void DSSIaudiooutput::stub_connectPort(LADSPA_Handle instance, unsigned long port, LADSPA_Data * data) -{ - getInstance(instance)->connectPort(port, data); -} - -void DSSIaudiooutput::stub_activate(LADSPA_Handle instance) -{ - getInstance(instance)->activate(); -} - -void DSSIaudiooutput::stub_run(LADSPA_Handle instance, unsigned long sample_count) -{ - getInstance(instance)->run(sample_count); -} - -void DSSIaudiooutput::stub_deactivate(LADSPA_Handle instance) -{ - getInstance(instance)->deactivate(); -} - - -void DSSIaudiooutput::stub_cleanup(LADSPA_Handle instance) -{ - DSSIaudiooutput* plugin_instance = getInstance(instance); - plugin_instance->cleanup(); - delete plugin_instance; -} - - -const LADSPA_Descriptor *ladspa_descriptor(unsigned long index) -{ - return DSSIaudiooutput::getLadspaDescriptor(index); -} - -// -// Static stubs for DSSI member functions -// -// DSSI is essentially a C handle based API; This plug-in implementation is -// a C++ OO one so we need stub functions to map from C API calls to C++ object -// method calls. -const DSSI_Program_Descriptor* DSSIaudiooutput::stub_getProgram (LADSPA_Handle instance, unsigned long index) -{ - return getInstance(instance)->getProgram(index); -} - -void DSSIaudiooutput::stub_selectProgram(LADSPA_Handle instance, unsigned long bank, unsigned long program) -{ - getInstance(instance)->selectProgram(bank, program); -} - -int DSSIaudiooutput::stub_getMidiControllerForPort(LADSPA_Handle instance, unsigned long port) -{ - return getInstance(instance)->getMidiControllerForPort(port); -} - -void DSSIaudiooutput::stub_runSynth(LADSPA_Handle instance, unsigned long sample_count, - snd_seq_event_t *events, unsigned long event_count) -{ - getInstance(instance)->runSynth(sample_count, events, event_count); -} - -const DSSI_Descriptor *dssi_descriptor(unsigned long index) -{ - return DSSIaudiooutput::getDssiDescriptor(index); -} - -// -// LADSPA member functions -// - -/** - * Instantiates a plug-in. - * - * This LADSPA member function instantiates a plug-in. - * Note that instance initialisation should generally occur in - * activate() rather than here. - * - * Zyn Implementation - * ------------------ - * This implementation creates a C++ class object and hides its pointer - * in the handle by type casting. - * - * @param descriptor [in] the descriptor for this plug-in - * @param s_rate [in] the sample rate - * @return the plug-in instance handle if successful else NULL - */ -LADSPA_Handle DSSIaudiooutput::instantiate(const LADSPA_Descriptor * descriptor, unsigned long s_rate) -{ - if(descriptor->UniqueID == dssiDescriptor->LADSPA_Plugin->UniqueID) - { - return (LADSPA_Handle)(new DSSIaudiooutput(s_rate)); - } - else - { - return NULL; - } -} - -/** - * Connects a port on an instantiated plug-in. - * - * This LADSPA member function connects a port on an instantiated plug-in to a - * memory location at which a block of data for the port will be read/written. - * The data location is expected to be an array of LADSPA_Data for audio ports - * or a single LADSPA_Data value for control ports. Memory issues will be - * managed by the host. The plug-in must read/write the data at these locations - * every time run() or run_adding() is called and the data present at the time - * of this connection call should not be considered meaningful. - * - * Zyn Implementation - * ------------------ - * The buffer pointers are stored as member variables - * - * @param port [in] the port to be connected - * @param data [in] the data buffer to write to / read from - */ -void DSSIaudiooutput::connectPort(unsigned long port, LADSPA_Data * data) -{ - switch (port) { - case 0: - outl = data; - break; - case 1: - outr = data; - break; - } -} - -/** - * Initialises a plug-in instance and activates it for use. - * - * This LADSPA member function initialises a plug-in instance and activates it - * for use. This is separated from instantiate() to aid real-time support and - * so that hosts can reinitialise a plug-in instance by calling deactivate() and - * then activate(). In this case the plug-in instance must reset all state - * information dependent on the history of the plug-in instance except for any - * data locations provided by connect_port() and any gain set by - * set_run_adding_gain(). - * - * Zyn Implementation - * ------------------ - * Currently this does nothing; Care must be taken as to code placed here as - * too much code here seems to cause time-out problems in jack-dssi-host. -*/ -void DSSIaudiooutput::activate() -{ -} - -/** - * Runs an instance of a plug-in for a block. - * - * This LADSPA member function runs an instance of a plug-in for a block. - * Note that if an activate() function exists then it must be called before - * run() or run_adding(). If deactivate() is called for a plug-in instance then - * the plug-in instance may not be reused until activate() has been called again. - * - * Zyn Implementation - * ------------------ - * This is a LADSPA function that does not process any MIDI events; it is hence - * implemented by simply calling runSynth() with an empty event list. - * - * @param sample_count [in] the block size (in samples) for which the plug-in instance may run - */ -void DSSIaudiooutput::run(unsigned long sample_count) -{ - runSynth(sample_count,NULL,(unsigned long)0); -} - -/** - * Counterpart to activate(). - * - * This LADSPA member function is the counterpart to activate() (see above). - * Deactivation is not similar to pausing as the plug-in instance will be - * reinitialised when activate() is called to reuse it. - * - * Zyn Implementation - * ------------------ - * Currently this function does nothing. - */ -void DSSIaudiooutput::deactivate() -{ - -} - -/** - * Deletes a plug-in instance that is no longer required. - * - * LADSPA member function; once an instance of a plug-in has been finished with - * it can be deleted using this function. The instance handle ceases to be - * valid after this call. - * - * If activate() was called for a plug-in instance then a corresponding call to - * deactivate() must be made before cleanup() is called. - * - * Zyn Implementation - * ------------------ - * Currently cleanup is deferred to the destructor that is invoked after cleanup() - */ -void DSSIaudiooutput::cleanup() -{ -} - -/** - * Initial entry point for the LADSPA plug-in library. - * - * This LADSPA function is the initial entry point for the plug-in library. - * The LADSPA host looks for this entry point in each shared library object it - * finds and then calls the function to enumerate the plug-ins within the - * library. - * - * Zyn Implementation - * ------------------ - * As the Zyn plug-in is a DSSI plug-in, the LADSPA descriptor is embedded inside - * the DSSI descriptor, which is created by DSSIaudiooutput::initDssiDescriptor() - * statically when the library is loaded. This function then merely returns a pointer - * to that embedded descriptor. - * - * @param index [in] the index number of the plug-in within the library. - * @return if index is in range, a pointer to the plug-in descriptor is returned, else NULL - */ -const LADSPA_Descriptor* DSSIaudiooutput::getLadspaDescriptor(unsigned long index) -{ - if(index > 0 || dssiDescriptor == NULL) - return NULL; - else - return dssiDescriptor->LADSPA_Plugin; -} - -// -// DSSI member functions -// - -/** - * Provides a description of a program available on this synth. - * - * This DSSI member function pointer provides a description of a program (named - * preset sound) available on this synth. - * - * Zyn Implementation - * ------------------ - * The instruments in all Zyn's bank directories, as shown by the `instrument - * -> show instrument bank` command, are enumerated to the host by this - * function, allowing access to all those instruments. - * The first time an instrument is requested, the bank it is in and any - * unmapped ones preceding that are mapped; all the instruments names and - * filenames from those banks are stored in the programMap member variable for - * later use. This is done on demand in this way, rather than up front in one - * go because loading all the instrument names in one go can lead to timeouts - * and zombies. - * - * @param index [in] index into the plug-in's list of - * programs, not a program number as represented by the Program - * field of the DSSI_Program_Descriptor. (This distinction is - * needed to support synths that use non-contiguous program or - * bank numbers.) - * @return a DSSI_Program_Descriptor pointer that is - * guaranteed to be valid only until the next call to get_program, - * deactivate, or configure, on the same plug-in instance, or NULL if index is out of range. - */ -const DSSI_Program_Descriptor* DSSIaudiooutput::getProgram (unsigned long index) -{ - static DSSI_Program_Descriptor retVal; - - /* Make sure we have the list of banks loaded */ - initBanks(); - - /* Make sure that the bank containing the instrument has been mapped */ - while (index >= programMap.size() && mapNextBank()) - /* DO NOTHING MORE */; - - if(index >= programMap.size()) - { - /* No more instruments */ - return NULL; - } - else - { - /* OK, return the instrument */ - retVal.Name = programMap[index].name.c_str(); - retVal.Program = programMap[index].program; - retVal.Bank = programMap[index].bank; - return &retVal; - } -} - -/** - * Selects a new program for this synth. - * - * This DSSI member function selects a new program for this synth. The program - * change will take effect immediately at the start of the next run_synth() - * call. An invalid bank / instrument combination is ignored. - * - * Zyn Implementation - * ------------------ - * the banks and instruments are as shown in the `instrument -> show instrument - * bank` command in Zyn. The bank no is a 1-based index into the list of banks - * Zyn loads and shows in the drop down and the program number is the - * instrument within that bank. - * - * @param bank [in] the bank number to select - * @param program [in] the program number within the bank to select - */ -void DSSIaudiooutput::selectProgram(unsigned long bank, unsigned long program) -{ - initBanks(); -// cerr << "selectProgram(" << (bank & 0x7F) << ':' << ((bank >> 7) & 0x7F) << "," << program << ")" << '\n'; - if(bank < MAX_NUM_BANKS && program < BANK_SIZE) - { - char* bankdir = master->bank.banks[ bank ].dir; - if(bankdir != NULL) - { - pthread_mutex_lock(&master->mutex); - - /* We have to turn off the CheckPADsynth functionality, else - * the program change takes way too long and we get timeouts - * and hence zombies (!) */ - int save = config.cfg.CheckPADsynth; - config.cfg.CheckPADsynth = 0; - - /* Load the bank... */ - master->bank.loadbank(bankdir); - - /* restore the CheckPADsynth flag */ - config.cfg.CheckPADsynth = save; - - /* Now load the instrument... */ - master->bank.loadfromslot((unsigned int)program, master->part[0]); - - pthread_mutex_unlock(&master->mutex); - } - } -} - -/** - * Returns the MIDI controller number or NRPN for a input control port - * - * This DSSI member function returns the MIDI controller number or NRPN that - * should be mapped to the given input control port. If the given port should - * not have any MIDI controller mapped to it, the function will return DSSI_NONE. - * The behaviour of this function is undefined if the given port - * number does not correspond to an input control port. - * - * Zyn Implementation - * ------------------ - * Currently Zyn does not define any controller ports, but may do in the future. - * - * @param port [in] the input controller port - * @return the CC and NRPN values shifted and ORed together. - */ -int DSSIaudiooutput::getMidiControllerForPort(unsigned long port) -{ - return DSSI_NONE; -} - -/** - * Runs the synth for a block. - * - * This DSSI member function runs the synth for a block. This is identical in - * function to the LADSPA run() function, except that it also supplies events - * to the synth. - * - * Zyn Implementation - * ------------------ - * Zyn implements synthesis in Master::GetAudioOutSamples; runSynth calls this - * function in chunks delimited by the sample_count and the frame indexes in - * the events block, calling the appropriate NoteOn, NoteOff and SetController - * members of Master to process the events supplied between each chunk. - * - * @param sample_count [in] the block size (in samples) for which the synth - * instance may run. - * @param events [in] The Events pointer points to a block of ALSA - * sequencer events, used to communicate MIDI and related events to the synth. - * Each event must be timestamped relative to the start of the block, - * (mis)using the ALSA "tick time" field as a frame count. The host is - * responsible for ensuring that events with differing timestamps are already - * ordered by time. Must not include NOTE (only NOTE_ON / NOTE_OFF), LSB or MSB - * events. - * @param event_count [in] the number of entries in the `events` block - */ -void DSSIaudiooutput::runSynth(unsigned long sample_count, snd_seq_event_t *events, unsigned long event_count) -{ - unsigned long from_frame = 0; - unsigned long event_index = 0; - unsigned long next_event_frame = 0; - unsigned long to_frame = 0; - pthread_mutex_lock(&master->mutex); - - do { - /* Find the time of the next event, if any */ - if(events == NULL || event_index >= event_count) - next_event_frame = ULONG_MAX; - else - next_event_frame = events[event_index].time.tick; - - /* find the end of the sub-sample to be processed this time round... */ - /* if the next event falls within the desired sample interval... */ - if(next_event_frame < sample_count && next_event_frame >= to_frame) - /* set the end to be at that event */ - to_frame = next_event_frame; - else - /* ...else go for the whole remaining sample */ - to_frame = sample_count; - if(from_frameGetAudioOutSamples(to_frame - from_frame, (int)sampleRate, &(outl[from_frame]), &(outr[from_frame])); - // next sub-sample please... - from_frame = to_frame; - } - - // Now process any event(s) at the current timing point - while(events != NULL && event_index < event_count && events[event_index].time.tick == to_frame) - { - if(events[event_index].type == SND_SEQ_EVENT_NOTEON) - { - master->NoteOn(events[event_index].data.note.channel, events[event_index].data.note.note, events[event_index].data.note.velocity); - } - else if(events[event_index].type == SND_SEQ_EVENT_NOTEOFF) - { - master->NoteOff(events[event_index].data.note.channel, events[event_index].data.note.note); - } - else if(events[event_index].type == SND_SEQ_EVENT_CONTROLLER) - { - master->SetController(events[event_index].data.control.channel, events[event_index].data.control.param, events[event_index].data.control.value); - } - else - { - } - event_index++; - } - - // Keep going until we have the desired total length of sample... - } while(to_frame < sample_count); - - pthread_mutex_unlock(&master->mutex); -} - -/** - * Initial entry point for the DSSI plug-in library. - * - * This DSSI function is the initial entry point for the plug-in library. - * The DSSI host looks for this entry point in each shared library object it - * finds and then calls the function to enumerate the plug-ins within the - * library. - * - * Zyn Implementation - * ------------------ - * The descriptor is created statically by DSSIaudiooutput::initDssiDescriptor() - * when the plug-in library is loaded. This function merely returns a pointer to - * that descriptor. - * - * @param index [in] the index number of the plug-in within the library. - * @return if index is in range, a pointer to the plug-in descriptor is returned, else NULL - */ -const DSSI_Descriptor* DSSIaudiooutput::getDssiDescriptor(unsigned long index) -{ - if(index > 0 || dssiDescriptor == NULL) - return NULL; - else - return dssiDescriptor; -} - -// -// Internal member functions -// - -// Initialise the DSSI descriptor, statically: -DSSI_Descriptor* DSSIaudiooutput::dssiDescriptor = DSSIaudiooutput::initDssiDescriptor(); - -/** - * Initializes the DSSI (and LADSPA) descriptor, returning it is an object. - */ -DSSI_Descriptor* DSSIaudiooutput::initDssiDescriptor() -{ - DSSI_Descriptor* newDssiDescriptor = new DSSI_Descriptor; - - LADSPA_PortDescriptor* newPortDescriptors; - char** newPortNames; - LADSPA_PortRangeHint* newPortRangeHints; - - if (newDssiDescriptor) - { - LADSPA_Descriptor* newLadspaDescriptor = new LADSPA_Descriptor; - if (newLadspaDescriptor) - { - newLadspaDescriptor->UniqueID = 100; - newLadspaDescriptor->Label = "ZASF"; - newLadspaDescriptor->Properties = 0; - newLadspaDescriptor->Name = "ZynAddSubFX"; - newLadspaDescriptor->Maker = "Nasca Octavian Paul "; - newLadspaDescriptor->Copyright = "GNU General Public License v.2"; - newLadspaDescriptor->PortCount = 2; - - newPortNames = new char *[newLadspaDescriptor->PortCount]; - newPortNames[0] = "Output L"; - newPortNames[1] = "Output R"; - newLadspaDescriptor->PortNames = newPortNames; - - newPortDescriptors = new LADSPA_PortDescriptor[newLadspaDescriptor->PortCount]; - newPortDescriptors[0] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO; - newPortDescriptors[1] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO; - newLadspaDescriptor->PortDescriptors = newPortDescriptors; - - newPortRangeHints = new LADSPA_PortRangeHint[newLadspaDescriptor->PortCount]; - newPortRangeHints[0].HintDescriptor = 0; - newPortRangeHints[1].HintDescriptor = 0; - newLadspaDescriptor->PortRangeHints = newPortRangeHints; - - newLadspaDescriptor->activate = stub_activate; - newLadspaDescriptor->cleanup = stub_cleanup; - newLadspaDescriptor->connect_port = stub_connectPort; - newLadspaDescriptor->deactivate = stub_deactivate; - newLadspaDescriptor->instantiate = instantiate; - newLadspaDescriptor->run = stub_run; - newLadspaDescriptor->run_adding = NULL; - newLadspaDescriptor->set_run_adding_gain = NULL; - } - newDssiDescriptor->LADSPA_Plugin = newLadspaDescriptor; - newDssiDescriptor->DSSI_API_Version = 1; - newDssiDescriptor->configure = NULL; - newDssiDescriptor->get_program = stub_getProgram; - newDssiDescriptor->get_midi_controller_for_port = stub_getMidiControllerForPort; - newDssiDescriptor->select_program = stub_selectProgram; - newDssiDescriptor->run_synth = stub_runSynth; - newDssiDescriptor->run_synth_adding = NULL; - newDssiDescriptor->run_multiple_synths = NULL; - newDssiDescriptor->run_multiple_synths_adding = NULL; - } - - dssiDescriptor = newDssiDescriptor; - - return dssiDescriptor; -} - -/** - * Converts a LADSPA / DSSI handle into a DSSIaudiooutput instance. - * - * @param instance [in] - * @return the instance - */ -DSSIaudiooutput* DSSIaudiooutput::getInstance(LADSPA_Handle instance) -{ - return (DSSIaudiooutput*)(instance); -} - -/** - * The private sole constructor for the DSSIaudiooutput class. - * - * Only ever called via instantiate(). - * @param sampleRate [in] the sample rate to be used by the synth. - * @return - */ -DSSIaudiooutput::DSSIaudiooutput(unsigned long sampleRate) -{ - this->sampleRate = sampleRate; - this->banksInited = false; - - config.init(); - - srand(time(NULL)); - denormalkillbuf=new REALTYPE [SOUND_BUFFER_SIZE]; - for (int i=0;imaster = new Master(); -} - -/** - * The destructor for the DSSIaudiooutput class - * @return - */ -DSSIaudiooutput::~DSSIaudiooutput() -{ -} - -/** - * Ensures the list of bank (directories) has been initialised. - */ -void DSSIaudiooutput::initBanks(void) -{ - if(!banksInited) - { - pthread_mutex_lock(&master->mutex); - master->bank.rescanforbanks(); - banksInited = true; - pthread_mutex_unlock(&master->mutex); - } -} - -/** - * constructor for the internally used ProgramDescriptor class - * - * @param _bank [in] bank number - * @param _program [in] program number - * @param _name [in] instrument / sample name - * @return - */ -DSSIaudiooutput::ProgramDescriptor::ProgramDescriptor(unsigned long _bank, unsigned long _program, char* _name) : - bank(_bank), program(_program), name(_name) -{ -} - -/** - * The map of programs available; held as a single shared statically allocated object. - */ -vector DSSIaudiooutput::programMap = vector(); - -/** - * Index controlling the map of banks - */ -long DSSIaudiooutput::bankNoToMap = 1; - -/** - * Queries and maps the next available bank of instruments. - * - * If the program index requested to getProgram() lies beyond the banks mapped to date, - * this member function is called to map the next one. - * @return true if a new bank has been found and mapped, else false. - */ -bool DSSIaudiooutput::mapNextBank() -{ - pthread_mutex_lock(&master->mutex); - Bank& bank = master->bank; - bool retval; - if(bankNoToMap >= MAX_NUM_BANKS || bank.banks[bankNoToMap].dir == NULL) - { - retval = false; - } - else - { - bank.loadbank(bank.banks[bankNoToMap].dir); - for(unsigned long instrument = 0; instrument < BANK_SIZE; instrument++) - { - char* insName = bank.getname(instrument); - if(insName != NULL && insName[0] != '\0' && insName[0] != ' ') - { - programMap.push_back(ProgramDescriptor(bankNoToMap,instrument,insName)); - } - } - bankNoToMap ++; - retval = true; - } - pthread_mutex_unlock(&master->mutex); - return retval; -} diff --git a/plugins/zynaddsubfx/src/Output/DSSIaudiooutput.h b/plugins/zynaddsubfx/src/Output/DSSIaudiooutput.h deleted file mode 100644 index 076367a72..000000000 --- a/plugins/zynaddsubfx/src/Output/DSSIaudiooutput.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - VSTaudiooutput.h - Audio output for VST - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef VST_AUDIO_OUTPUT_H -#define VST_AUDIO_OUTPUT_H - -#include - -#include "../globals.h" -#include "../Misc/Master.h" - -#include -#include -#include - -class DSSIaudiooutput -{ -public: - // - // Static stubs for LADSPA member functions - // - static void stub_connectPort(LADSPA_Handle instance, unsigned long port, LADSPA_Data * data); - static void stub_activate(LADSPA_Handle instance); - static void stub_run(LADSPA_Handle instance, unsigned long sample_count); - static void stub_deactivate(LADSPA_Handle Instance); - static void stub_cleanup(LADSPA_Handle instance); - - // - // Static stubs for DSSI member functions - // - static const DSSI_Program_Descriptor* stub_getProgram (LADSPA_Handle instance, unsigned long Index); - static void stub_selectProgram(LADSPA_Handle instance, unsigned long bank, unsigned long program); - static int stub_getMidiControllerForPort(LADSPA_Handle instance, unsigned long port); - static void stub_runSynth(LADSPA_Handle instance, unsigned long sample_count, - snd_seq_event_t *events, unsigned long event_count); - - /* - * LADSPA member functions - */ - static LADSPA_Handle instantiate(const LADSPA_Descriptor * descriptor, unsigned long s_rate); - void connectPort(unsigned long port, LADSPA_Data * data); - void activate(); - void run(unsigned long sample_count); - void deactivate(); - void cleanup(); - static const LADSPA_Descriptor* getLadspaDescriptor(unsigned long index); - - /* - * DSSI member functions - */ - const DSSI_Program_Descriptor* getProgram (unsigned long Index); - void selectProgram(unsigned long bank, unsigned long program); - int getMidiControllerForPort(unsigned long port); - void runSynth(unsigned long sample_count, snd_seq_event_t *events, unsigned long event_count); - static const DSSI_Descriptor* getDssiDescriptor(unsigned long index); - - struct ProgramDescriptor - { - unsigned long bank; - unsigned long program; - string name; - ProgramDescriptor(unsigned long _bank, unsigned long _program, char* _name); - }; - -private: - - DSSIaudiooutput(unsigned long sampleRate); - ~DSSIaudiooutput(); - static DSSI_Descriptor* initDssiDescriptor(); - static DSSIaudiooutput* getInstance(LADSPA_Handle instance); - void initBanks(); - bool mapNextBank(); - - LADSPA_Data *outl; - LADSPA_Data *outr; - long sampleRate; - Master* master; - static DSSI_Descriptor* dssiDescriptor; - static string bankDirNames[]; - static - vector programMap; - - /** - * Flag controlling the list of bank directories - */ - bool banksInited; - - static - long bankNoToMap; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Output/JACK_RTaudiooutput.cpp b/plugins/zynaddsubfx/src/Output/JACK_RTaudiooutput.cpp deleted file mode 100644 index 2e63e659b..000000000 --- a/plugins/zynaddsubfx/src/Output/JACK_RTaudiooutput.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - JACKaudiooutput.cpp - Audio output for JACK - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include - - -extern "C" -{ -#include -}; -#include "JACKaudiooutput.h" - -Master *jackmaster; -jack_client_t *jackclient; -jack_port_t *outport_left, *outport_right; -jack_ringbuffer_t *rb = NULL; - -REALTYPE *jackoutl, *jackoutr; -int jackfinish = 0; - -void *thread_blocked(void *arg); -int jackprocess(jack_nframes_t nframes, void *arg); -int jacksrate(jack_nframes_t nframes, void *arg); -void jackshutdown(void *arg); - -pthread_cond_t more_data = PTHREAD_COND_INITIALIZER; -pthread_mutex_t zyn_thread_lock = PTHREAD_MUTEX_INITIALIZER; - -pthread_t bthr; - - -bool JACKaudiooutputinit(Master *master_) -{ - jackmaster = master_; - jackclient = 0; - char tmpstr[100]; - - jackoutl = new REALTYPE [SOUND_BUFFER_SIZE]; - jackoutr = new REALTYPE [SOUND_BUFFER_SIZE]; - - int rbbufsize = SOUND_BUFFER_SIZE * sizeof(REALTYPE) * 2 * 2; - printf("%d\n", rbbufsize); - rb = jack_ringbuffer_create(rbbufsize); - for(int i = 0; i < rbbufsize; i++) - rb->buf[i] = 0.0; - - - for(int i = 0; i < 15; i++) { - if(i != 0) - snprintf(tmpstr, 100, "ZynAddSubFX_%d", i); - else - snprintf(tmpstr, 100, "ZynAddSubFX"); - jackclient = jack_client_new(tmpstr); - if(jackclient != 0) - break; - } - - if(jackclient == 0) { - fprintf( - stderr, - "\nERROR: Cannot make a jack client (possible reasons: JACK server is not running or jackd is launched by root and zynaddsubfx by another user.).\n\n\n"); - return false; - } - - fprintf(stderr, - "Internal SampleRate = %d\nJack Output SampleRate= %d\n", - SAMPLE_RATE, - jack_get_sample_rate(jackclient)); - if((unsigned int)jack_get_sample_rate(jackclient) != - (unsigned int) SAMPLE_RATE) - fprintf(stderr, - "It is recomanded that the both samplerates to be equal.\n"); - - jack_set_process_callback(jackclient, jackprocess, 0); - jack_set_sample_rate_callback(jackclient, jacksrate, 0); - jack_on_shutdown(jackclient, jackshutdown, 0); - - outport_left = jack_port_register(jackclient, - "out_1", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - outport_right = jack_port_register(jackclient, - "out_2", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - - if(jack_activate(jackclient)) { - fprintf(stderr, "Cannot activate jack client\n"); - return false; - } - - pthread_create(&bthr, NULL, thread_blocked, NULL); - - /* - jack_connect(jackclient,jack_port_name(outport_left),"alsa_pcm:out_1"); - jack_connect(jackclient,jack_port_name(outport_right),"alsa_pcm:out_2"); - */ - - return true; -} - -void *thread_blocked(void *arg) -{ - int datasize = SOUND_BUFFER_SIZE * sizeof(REALTYPE); - - //try to get realtime - sched_param sc; - sc.sched_priority = 50; - int err = sched_setscheduler(0, SCHED_FIFO, &sc); - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - pthread_mutex_lock(&zyn_thread_lock); - - while(jackfinish == 0) { - while(jack_ringbuffer_write_space(rb) >= datasize) { - pthread_mutex_lock(&jackmaster->mutex); - jackmaster->GetAudioOutSamples(SOUND_BUFFER_SIZE, - jack_get_sample_rate(jackclient), - jackoutl, - jackoutr); - pthread_mutex_unlock(&jackmaster->mutex); - - jack_ringbuffer_write(rb, (char *) jackoutl, datasize); - jack_ringbuffer_write(rb, (char *) jackoutr, datasize); - } - pthread_cond_wait(&more_data, &zyn_thread_lock); - } - pthread_mutex_unlock(&zyn_thread_lock); - - return 0; -} - - -int jackprocess(jack_nframes_t nframes, void *arg) -{ - jack_default_audio_sample_t *outl = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_left, - nframes); - jack_default_audio_sample_t *outr = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_right, - nframes); - - int datasize = nframes * sizeof(REALTYPE); - int incoming_datasize = SOUND_BUFFER_SIZE * sizeof(REALTYPE); - int data_read = 0; - - - if(jack_ringbuffer_read_space(rb) >= (2 * incoming_datasize)) { - if(datasize > incoming_datasize) { - data_read = 0; - while(data_read < datasize) { - jack_ringbuffer_read(rb, (char *) outl + data_read, datasize); - jack_ringbuffer_read(rb, (char *) outr + data_read, datasize); - data_read += incoming_datasize; - } - } - else - if(datasize == incoming_datasize) { - jack_ringbuffer_read(rb, (char *) outl, datasize); - jack_ringbuffer_read(rb, (char *) outr, datasize); - } - else {} - } - else { //the ringbuffer is empty or there are too small amount of samples in it - for(int i = 0; i < nframes; i++) { - outl[i] = 0.0; - outr[i] = 0.0; - } - } - /* if (jack_ringbuffer_read_space(rb)>=datasize){ - jack_ringbuffer_read(rb, (char *) outl,datasize); - jack_ringbuffer_read(rb, (char *) outr,datasize); - } else {//the ringbuffer is empty or there are too small amount of samples in it - for (int i=0;i -#include -#include "JACKaudiooutput.h" - -Master *jackmaster; -jack_client_t *jackclient; -char jackname[100]; -jack_port_t *outport_left, *outport_right, *midi_inport; - -int jackprocess(jack_nframes_t nframes, void *arg); -int jacksrate(jack_nframes_t nframes, void *arg); -void jackshutdown(void *arg); - -bool JACKaudiooutputinit(Master *master_) -{ - jackmaster = master_; - jackclient = 0; - - for(int i = 0; i < 15; i++) { - if(i != 0) - snprintf(jackname, 100, "ZynAddSubFX_%d", i); - else - snprintf(jackname, 100, "ZynAddSubFX"); - jackclient = jack_client_new(jackname); - if(jackclient != 0) - break; - } - - if(jackclient == 0) { - fprintf( - stderr, - "\nERROR: Cannot make a jack client (possible reasons: JACK server is not running or jackd is launched by root and zynaddsubfx by another user.).\n"); - return false; - } - - fprintf(stderr, - "Internal SampleRate = %d\nJack Output SampleRate= %d\n", - SAMPLE_RATE, - jack_get_sample_rate(jackclient)); - if((unsigned int)jack_get_sample_rate(jackclient) != - (unsigned int) SAMPLE_RATE) - fprintf(stderr, - "It is recomanded that the both samplerates to be equal.\n"); - - jack_set_process_callback(jackclient, jackprocess, 0); - jack_set_sample_rate_callback(jackclient, jacksrate, 0); - jack_on_shutdown(jackclient, jackshutdown, 0); - - outport_left = jack_port_register(jackclient, - "out_1", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - outport_right = jack_port_register(jackclient, - "out_2", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - midi_inport = jack_port_register(jackclient, - "midi_input", - JACK_DEFAULT_MIDI_TYPE, - JackPortIsInput | JackPortIsTerminal, - 0); - - if(jack_activate(jackclient)) { - fprintf(stderr, "Cannot activate jack client\n"); - return false; - } - - /* - jack_connect(jackclient,jack_port_name(outport_left),"alsa_pcm:out_1"); - jack_connect(jackclient,jack_port_name(outport_right),"alsa_pcm:out_2"); - */ - return true; -} - -int jackprocess(jack_nframes_t nframes, void *arg) -{ - jack_default_audio_sample_t *outl = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_left, - nframes); - jack_default_audio_sample_t *outr = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_right, - nframes); - - if(!pthread_mutex_trylock(&jackmaster->mutex)) { - JACKhandlemidi(nframes); - jackmaster->GetAudioOutSamples(nframes, jack_get_sample_rate( - jackclient), outl, outr); - pthread_mutex_unlock(&jackmaster->mutex); - } - else { - memset(outl, 0, sizeof(jack_default_audio_sample_t) * nframes); - memset(outr, 0, sizeof(jack_default_audio_sample_t) * nframes); - } - - return 0; -} - -void JACKfinish() -{ - jack_client_close(jackclient); -} - -int jacksrate(jack_nframes_t nframes, void *arg) -{ - return 0; -} - -void jackshutdown(void *arg) -{} - - -void JACKhandlemidi(unsigned long frames) -{ - // We must have the master mutex before we run this function - - // XXX This is really nasty, not only do we lose the sample accuracy of - // JACK MIDI, but any accuracy at all below the buffer size - - void *midi_buf = jack_port_get_buffer(midi_inport, frames); - jack_midi_event_t jack_midi_event; - jack_nframes_t event_index = 0; - unsigned char *midi_data; - unsigned char type, chan; - - while(jack_midi_event_get(&jack_midi_event, midi_buf, - event_index++) == 0) { - midi_data = jack_midi_event.buffer; - type = midi_data[0] & 0xF0; - chan = midi_data[0] & 0x0F; - - switch(type) { - case 0x80: /* note-off */ - jackmaster->NoteOff(chan, midi_data[1]); - break; - - case 0x90: /* note-on */ - jackmaster->NoteOn(chan, midi_data[1], midi_data[2]); - break; - - case 0xB0: /* controller */ - jackmaster->SetController(chan, midi_data[1], midi_data[2]); - break; - - case 0xE0: /* pitch bend */ - jackmaster->SetController(chan, C_pitchwheel, - ((midi_data[2] << 7) | midi_data[1])); - break; - - /* XXX TODO: handle MSB/LSB controllers and RPNs and NRPNs */ - } - } -} - - -const char *JACKgetname() -{ - if(jackclient != NULL) - return jackname; - return NULL; -} - diff --git a/plugins/zynaddsubfx/src/Output/JACKaudiooutput.h b/plugins/zynaddsubfx/src/Output/JACKaudiooutput.h deleted file mode 100644 index afc5e5b7f..000000000 --- a/plugins/zynaddsubfx/src/Output/JACKaudiooutput.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - JACKaudiooutput.h - Audio output for JACK - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef JACK_AUDIO_OUTPUT_H -#define JACK_AUDIO_OUTPUT_H - -#include - -#include "../globals.h" -#include "../Misc/Master.h" - - -#if (REALTYPE != jack_default_audio_sample_t) -#error \ - "The internal sample datatype of ZynAddSubFX and the datatype of jack differs. \ - In order to compile ZynAddSubFX the 'REALTYPE' and 'jack_default_audio_sample_t' must be equal. \ - Set the 'REALTYPE' data type (which is defined in 'globals.h') to what is defined \ - in the file types.h from jack include directory as 'jack_default_audio_sample_t' (as float or double)." -#endif - - - - -bool JACKaudiooutputinit(Master *master_); -void JACKfinish(); -void JACKhandlemidi(unsigned long frames); -const char *JACKgetname(); - -#endif - diff --git a/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp b/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp deleted file mode 100644 index f6c6b3f0f..000000000 --- a/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.cpp - Audio output for Open Sound System - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "OSSaudiooutput.h" -#include "../Misc/Util.h" -#include "../globals.h" -using namespace std; - -OSSaudiooutput::OSSaudiooutput() -{ - int i; - int snd_bitsize = 16; - snd_fragment = 0x00080009; //fragment size (?) - snd_stereo = 1; //stereo - snd_format = AFMT_S16_LE; - snd_samplerate = SAMPLE_RATE; - playing_until.tv_sec = 0; - playing_until.tv_usec = 0; - - smps = new short int[SOUND_BUFFER_SIZE * 2]; - for(i = 0; i < SOUND_BUFFER_SIZE * 2; i++) - smps[i] = 0; - - snd_handle = open(config.cfg.LinuxOSSWaveOutDev, O_WRONLY, 0); - if(snd_handle == -1) { - cerr << "ERROR - I can't open the "; - cerr << config.cfg.LinuxOSSWaveOutDev << '.' << endl; - return; - } - ioctl(snd_handle, SNDCTL_DSP_RESET, NULL); - - ioctl(snd_handle, SNDCTL_DSP_SETFMT, &snd_format); - ioctl(snd_handle, SNDCTL_DSP_STEREO, &snd_stereo); - ioctl(snd_handle, SNDCTL_DSP_SPEED, &snd_samplerate); - ioctl(snd_handle, SNDCTL_DSP_SAMPLESIZE, &snd_bitsize); - ioctl(snd_handle, SNDCTL_DSP_SETFRAGMENT, &snd_fragment); -} - - -/* - * Output the samples to the soundcard - * The samples are bigger than -1.0 and smaller 1.0 - */ -void OSSaudiooutput::OSSout(REALTYPE *smp_left, REALTYPE *smp_right) -{ - int i; - REALTYPE l, r; - if(snd_handle < 0) { //output could not be opened - struct timeval now; - int remaining; - gettimeofday(&now, NULL); - if((playing_until.tv_usec == 0) && (playing_until.tv_sec == 0)) { - playing_until.tv_usec = now.tv_usec; - playing_until.tv_sec = now.tv_sec; - } - else { - remaining = (playing_until.tv_usec - now.tv_usec) - + (playing_until.tv_sec - now.tv_sec) * 1000000; - if(remaining > 10000) //Don't sleep() less than 10ms. - //This will add latency... - usleep(remaining - 10000); - if(remaining < 0) - cerr << "WARNING - too late" << endl; - } - playing_until.tv_usec += SOUND_BUFFER_SIZE * 1000000 / SAMPLE_RATE; - if(remaining < 0) - playing_until.tv_usec -= remaining; - playing_until.tv_sec += playing_until.tv_usec / 1000000; - playing_until.tv_usec %= 1000000; - return; - } - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - l = smp_left[i]; - r = smp_right[i]; - - if(l < -1.0) - l = -1.0; - else - if(l > 1.0) - l = 1.0; - if(r < -1.0) - r = -1.0; - else - if(r > 1.0) - r = 1.0; - - smps[i * 2] = (short int) (l * 32767.0); - smps[i * 2 + 1] = (short int) (r * 32767.0); - } - write(snd_handle, smps, SOUND_BUFFER_SIZE * 4); // *2 because is 16 bit, again * 2 because is stereo -} - - -OSSaudiooutput::~OSSaudiooutput() -{ - close(snd_handle); - delete [] smps; -} - diff --git a/plugins/zynaddsubfx/src/Output/OSSaudiooutput.h b/plugins/zynaddsubfx/src/Output/OSSaudiooutput.h deleted file mode 100644 index 28da1cfaf..000000000 --- a/plugins/zynaddsubfx/src/Output/OSSaudiooutput.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.h - Audio output for Open Sound System - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef OSS_AUDIO_OUTPUT_H -#define OSS_AUDIO_OUTPUT_H - -#include -#include "../globals.h" - -class OSSaudiooutput -{ - public: - OSSaudiooutput(); - ~OSSaudiooutput(); - - //the out is [-1.0 .. 1.0] - /* smp_left[] and smp_right[] has the size of SOUND_BUFFER_SIZE */ - void OSSout(REALTYPE *smp_left, REALTYPE *smp_right); - private: - int snd_handle; - int snd_fragment; - int snd_stereo; - int snd_format; - int snd_samplerate; - struct timeval playing_until; - - short int *smps; //Samples to be sent to soundcard -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Output/PAaudiooutput.cpp b/plugins/zynaddsubfx/src/Output/PAaudiooutput.cpp deleted file mode 100644 index bfd84cca9..000000000 --- a/plugins/zynaddsubfx/src/Output/PAaudiooutput.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PAaudiooutput.cpp - Audio output for PortAudio - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "PAaudiooutput.h" - -Master *PAmaster; -PaStream *stream; -REALTYPE *outl, *outr; - -int PAprocess(void *inputBuffer, void *outputBuffer, - unsigned long framesPerBuffer, - PaTimestamp outTime, void *userData) -{ - if(framesPerBuffer != SOUND_BUFFER_SIZE) { - fprintf( - stderr, - "Bug: PAudioOutput::PAprocess SOUND_BUFFER_SIZE!=framesPerBuffer"); - fprintf(stderr, "%d %d\n", framesPerBuffer, SOUND_BUFFER_SIZE); - } - - pthread_mutex_lock(&PAmaster->mutex); - PAmaster->GetAudioOutSamples(SOUND_BUFFER_SIZE, SAMPLE_RATE, outl, outr); - pthread_mutex_unlock(&PAmaster->mutex); - - float *out = (float *)outputBuffer; - - for(int i = 0; i < framesPerBuffer; i++) { - if(i >= SOUND_BUFFER_SIZE) - break; //this should never happens, except only when framesPerBuffer!>SOUND_BUFFER_SIZE - out[i * 2] = outl[i]; - out[i * 2 + 1] = outr[i]; - } - - return 0; -} - -void PAaudiooutputinit(Master *master_) -{ - PAmaster = master_; - outl = new REALTYPE [SOUND_BUFFER_SIZE]; - outr = new REALTYPE [SOUND_BUFFER_SIZE]; - Pa_Initialize(); - Pa_OpenDefaultStream(&stream, - 0, - 2, - paFloat32, - SAMPLE_RATE, - SOUND_BUFFER_SIZE, - 0, - PAprocess, - NULL); - Pa_StartStream(stream); -} - -void PAfinish() -{ - Pa_StopStream(stream); - delete (outl); - delete (outr); -} - diff --git a/plugins/zynaddsubfx/src/Output/PAaudiooutput.h b/plugins/zynaddsubfx/src/Output/PAaudiooutput.h deleted file mode 100644 index 942011d57..000000000 --- a/plugins/zynaddsubfx/src/Output/PAaudiooutput.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PAaudiooutput.h - Audio output for PortAudio - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef PA_AUDIO_OUTPUT_H -#define PA_AUDIO_OUTPUT_H - -#include - -#include "../globals.h" -#include "../Misc/Master.h" - -void PAaudiooutputinit(Master *master_); -void PAfinish(); - -#endif - diff --git a/plugins/zynaddsubfx/src/Output/Recorder.cpp b/plugins/zynaddsubfx/src/Output/Recorder.cpp deleted file mode 100644 index 244047ce8..000000000 --- a/plugins/zynaddsubfx/src/Output/Recorder.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Recorder.cpp - Records sound to a file - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Recorder.h" - -Recorder::Recorder() -{ - recordbuf_16bit = new short int [SOUND_BUFFER_SIZE * 2]; - status = 0; - notetrigger = 0; - for(int i = 0; i < SOUND_BUFFER_SIZE * 2; i++) - recordbuf_16bit[i] = 0; -} - -Recorder::~Recorder() -{ - if(recording() == 1) - stop(); - delete [] recordbuf_16bit; -} - -int Recorder::preparefile(std::string filename_, int overwrite) -{ - if(!overwrite) { - struct stat fileinfo; - int statr; - statr = stat(filename_.c_str(), &fileinfo); - if(statr == 0) //file exists - return 1; - } - - if(!wav.newfile(filename_, SAMPLE_RATE, 2)) - return 2; - - status = 1; //ready - - return 0; -} - -void Recorder::start() -{ - notetrigger = 0; - status = 2; //recording -} - -void Recorder::stop() -{ - wav.close(); - status = 0; -} - -void Recorder::pause() -{ - status = 0; -} - -int Recorder::recording() -{ - if((status == 2) && (notetrigger != 0)) - return 1; - else - return 0; -} - -void Recorder::recordbuffer(REALTYPE *outl, REALTYPE *outr) -{ - int tmp; - if(status != 2) - return; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - tmp = (int)(outl[i] * 32767.0); - if(tmp < -32768) - tmp = -32768; - if(tmp > 32767) - tmp = 32767; - recordbuf_16bit[i * 2] = tmp; - - tmp = (int)(outr[i] * 32767.0); - if(tmp < -32768) - tmp = -32768; - if(tmp > 32767) - tmp = 32767; - recordbuf_16bit[i * 2 + 1] = tmp; - } - wav.write_stereo_samples(SOUND_BUFFER_SIZE, recordbuf_16bit); -} - -void Recorder::triggernow() -{ - if(status == 2) - notetrigger = 1; -} - diff --git a/plugins/zynaddsubfx/src/Output/Recorder.h b/plugins/zynaddsubfx/src/Output/Recorder.h deleted file mode 100644 index 997ed3783..000000000 --- a/plugins/zynaddsubfx/src/Output/Recorder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Recorder.h - Records sound to a file - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef RECORDER_H -#define RECORDER_H -#include -#include "../globals.h" -#include "WAVaudiooutput.h" - -/**Records sound to a file*/ -class Recorder -{ - public: - - Recorder(); - ~Recorder(); - int preparefile(std::string filename_, int overwrite); //returns 1 if the file exists - void start(); - void stop(); - void pause(); - int recording(); - void triggernow(); - void recordbuffer(REALTYPE *outl, REALTYPE *outr); - - /** Status: - * 0 - not ready(no file selected), - * 1 - ready - * 2 - recording */ - int status; - - private: - WAVaudiooutput wav; - short int *recordbuf_16bit; - int notetrigger; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Output/VSTaudiooutput.cpp b/plugins/zynaddsubfx/src/Output/VSTaudiooutput.cpp deleted file mode 100644 index 494a127c0..000000000 --- a/plugins/zynaddsubfx/src/Output/VSTaudiooutput.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - VSTaudiooutput.cpp - Audio output for VST - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include "VSTaudiooutput.h" - -//the constructor and the destructor are defined in main.cpp - -void VSTSynth::process(float **inputs, float **outputs, long sampleframes) -{ - float *outl = outputs[0]; - float *outr = outputs[1]; - pthread_mutex_lock(&vmaster->mutex); - vmaster->GetAudioOutSamples(sampleframes, (int) getSampleRate(), outl, outr); - pthread_mutex_unlock(&vmaster->mutex); -} - -void VSTSynth::processReplacing(float **inputs, - float **outputs, - long sampleframes) -{ - process(inputs, outputs, sampleframes); -} - -long int VSTSynth::canDo(char *txt) -{ - if(strcmp(txt, "receiveVstEvents") == 0) - return 1; - if(strcmp(txt, "receiveVstMidiEvent") == 0) - return 1; - return -1; -} - -bool VSTSynth::getVendorString(char *txt) -{ - strcpy(txt, "Nasca O. Paul"); - return true; -} - -bool VSTSynth::getProductString(char *txt) -{ - strcpy(txt, "ZynAddSubFX"); - return true; -} - -void VSTSynth::resume() -{ - wantEvents(); -} - diff --git a/plugins/zynaddsubfx/src/Output/VSTaudiooutput.h b/plugins/zynaddsubfx/src/Output/VSTaudiooutput.h deleted file mode 100644 index 1fe0afd13..000000000 --- a/plugins/zynaddsubfx/src/Output/VSTaudiooutput.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - VSTaudiooutput.h - Audio output for VST - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef VST_AUDIO_OUTPUT_H -#define VST_AUDIO_OUTPUT_H - -#include - -#include "../globals.h" -#include "../Misc/Master.h" -#include "../UI/MasterUI.h" - -#include "../../../vstsdk2/source/common/audioeffectx.h" - -class VSTSynth:public AudioEffectX -{ - public: - VSTSynth(audioMasterCallback audioMaster); - ~VSTSynth(); - - virtual void process(float **inputs, float **outputs, long sampleframes); - virtual void processReplacing(float **inputs, - float **outputs, - long sampleframes); - virtual long processEvents(VstEvents *events); //this is used for Midi input - virtual long int canDo(char *txt); - virtual bool getVendorString(char *txt); - virtual bool getProductString(char *txt); - virtual void resume(); - - virtual long getChunk(void **data, bool isPreset = false); - virtual long setChunk(void *data, long size, bool isPreset = false); - - MasterUI *ui; - int Pexitprogram; - - Master *vmaster; - pthread_t thr; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Output/WAVaudiooutput.cpp b/plugins/zynaddsubfx/src/Output/WAVaudiooutput.cpp deleted file mode 100644 index cc1f87c0e..000000000 --- a/plugins/zynaddsubfx/src/Output/WAVaudiooutput.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2006 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include "WAVaudiooutput.h" -using namespace std; - -WAVaudiooutput::WAVaudiooutput() -{ - file = NULL; - sampleswritten = 0; - samplerate = 44100; -} - -WAVaudiooutput::~WAVaudiooutput() -{ - close(); -} - -bool WAVaudiooutput::newfile(string filename, int samplerate, int channels) -{ - /**\todo Move this into the Constructor*/ - close(); //inchide un posibil fisier existent - file = fopen(filename.c_str(), "w"); - if(!file) - return false; - this->samplerate = samplerate; - this->channels = channels; - sampleswritten = 0; - char tmp[44]; - fwrite(tmp, 1, 44, file); - return true; -} - -void WAVaudiooutput::close() -{ - if(file) { - unsigned int chunksize; - rewind(file); - - fwrite("RIFF", 4, 1, file); - chunksize = sampleswritten * 4 + 36; - fwrite(&chunksize, 4, 1, file); - - fwrite("WAVEfmt ", 8, 1, file); - chunksize = 16; - fwrite(&chunksize, 4, 1, file); - unsigned short int formattag = 1; //uncompresed wave - fwrite(&formattag, 2, 1, file); - unsigned short int nchannels = channels; //stereo - fwrite(&nchannels, 2, 1, file); - unsigned int samplerate_ = samplerate; //samplerate - fwrite(&samplerate_, 4, 1, file); - unsigned int bytespersec = samplerate * 2 * channels; //bytes/sec - fwrite(&bytespersec, 4, 1, file); - unsigned short int blockalign = 2 * channels; //2 channels * 16 bits/8 - fwrite(&blockalign, 2, 1, file); - unsigned short int bitspersample = 16; - fwrite(&bitspersample, 2, 1, file); - - fwrite("data", 4, 1, file); - chunksize = sampleswritten * blockalign; - fwrite(&chunksize, 4, 1, file); - - fclose(file); - file = NULL; - } -} - -void WAVaudiooutput::write_stereo_samples(int nsmps, short int *smps) -{ - if(!file) - return; - fwrite(smps, nsmps, 4, file); - sampleswritten += nsmps; -} - -void WAVaudiooutput::write_mono_samples(int nsmps, short int *smps) -{ - if(!file) - return; - fwrite(smps, nsmps, 2, file); - sampleswritten += nsmps; -} - diff --git a/plugins/zynaddsubfx/src/Output/WAVaudiooutput.h b/plugins/zynaddsubfx/src/Output/WAVaudiooutput.h deleted file mode 100644 index 193fb19f3..000000000 --- a/plugins/zynaddsubfx/src/Output/WAVaudiooutput.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - - Copyright (C) 2008 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef WAVOUTPUT_H -#define WAVOUTPUT_H -#include - -class WAVaudiooutput -{ - public: - WAVaudiooutput(); - ~WAVaudiooutput(); - - bool newfile(std::string filename, int samplerate, int channels); - void close(); - - void write_mono_samples(int nsmps, short int *smps); - void write_stereo_samples(int nsmps, short int *smps); - - private: - int sampleswritten; - int samplerate; - int channels; - FILE *file; -}; -#endif - diff --git a/plugins/zynaddsubfx/src/Params/ADnoteParameters.cpp b/plugins/zynaddsubfx/src/Params/ADnoteParameters.cpp deleted file mode 100644 index 91f3449f1..000000000 --- a/plugins/zynaddsubfx/src/Params/ADnoteParameters.cpp +++ /dev/null @@ -1,840 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnoteParameters.cpp - Parameters for ADnote (ADsynth) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include - -#include "ADnoteParameters.h" -int ADnote_unison_sizes[] = -{1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 25, 30, 40, 50, 0}; - -ADnoteParameters::ADnoteParameters(FFTwrapper *fft_) - :PresetsArray() -{ - setpresettype("Padsyth"); - fft = fft_; - - GlobalPar.FreqEnvelope = new EnvelopeParams(0, 0); - GlobalPar.FreqEnvelope->ASRinit(64, 50, 64, 60); - GlobalPar.FreqLfo = new LFOParams(70, 0, 64, 0, 0, 0, 0, 0); - - GlobalPar.AmpEnvelope = new EnvelopeParams(64, 1); - GlobalPar.AmpEnvelope->ADSRinit_dB(0, 40, 127, 25); - GlobalPar.AmpLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 1); - - GlobalPar.GlobalFilter = new FilterParams(2, 94, 40); - GlobalPar.FilterEnvelope = new EnvelopeParams(0, 1); - GlobalPar.FilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); - GlobalPar.FilterLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 2); - GlobalPar.Reson = new Resonance(); - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) - EnableVoice(nvoice); - - defaults(); -} - -void ADnoteParameters::defaults() -{ - //Default Parameters - /* Frequency Global Parameters */ - GlobalPar.PStereo = 1; //stereo - GlobalPar.PDetune = 8192; //zero - GlobalPar.PCoarseDetune = 0; - GlobalPar.PDetuneType = 1; - GlobalPar.FreqEnvelope->defaults(); - GlobalPar.FreqLfo->defaults(); - GlobalPar.PBandwidth = 64; - - /* Amplitude Global Parameters */ - GlobalPar.PVolume = 90; - GlobalPar.PPanning = 64; //center - GlobalPar.PAmpVelocityScaleFunction = 64; - GlobalPar.AmpEnvelope->defaults(); - GlobalPar.AmpLfo->defaults(); - GlobalPar.PPunchStrength = 0; - GlobalPar.PPunchTime = 60; - GlobalPar.PPunchStretch = 64; - GlobalPar.PPunchVelocitySensing = 72; - GlobalPar.Hrandgrouping = 0; - - /* Filter Global Parameters*/ - GlobalPar.PFilterVelocityScale = 64; - GlobalPar.PFilterVelocityScaleFunction = 64; - GlobalPar.GlobalFilter->defaults(); - GlobalPar.FilterEnvelope->defaults(); - GlobalPar.FilterLfo->defaults(); - GlobalPar.Reson->defaults(); - - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) - defaults(nvoice); - ; - VoicePar[0].Enabled = 1; -} - -/* - * Defaults a voice - */ -void ADnoteParameters::defaults(int n) -{ - int nvoice = n; - VoicePar[nvoice].Enabled = 0; - - VoicePar[nvoice].Unison_size = 1; - VoicePar[nvoice].Unison_frequency_spread = 60; - VoicePar[nvoice].Unison_stereo_spread = 64; - VoicePar[nvoice].Unison_vibratto = 64; - VoicePar[nvoice].Unison_vibratto_speed = 64; - VoicePar[nvoice].Unison_invert_phase = 0; - - VoicePar[nvoice].Type = 0; - VoicePar[nvoice].Pfixedfreq = 0; - VoicePar[nvoice].PfixedfreqET = 0; - VoicePar[nvoice].Presonance = 1; - VoicePar[nvoice].Pfilterbypass = 0; - VoicePar[nvoice].Pextoscil = -1; - VoicePar[nvoice].PextFMoscil = -1; - VoicePar[nvoice].Poscilphase = 64; - VoicePar[nvoice].PFMoscilphase = 64; - VoicePar[nvoice].PDelay = 0; - VoicePar[nvoice].PVolume = 100; - VoicePar[nvoice].PVolumeminus = 0; - VoicePar[nvoice].PPanning = 64; //center - VoicePar[nvoice].PDetune = 8192; //8192=0 - VoicePar[nvoice].PCoarseDetune = 0; - VoicePar[nvoice].PDetuneType = 0; - VoicePar[nvoice].PFreqLfoEnabled = 0; - VoicePar[nvoice].PFreqEnvelopeEnabled = 0; - VoicePar[nvoice].PAmpEnvelopeEnabled = 0; - VoicePar[nvoice].PAmpLfoEnabled = 0; - VoicePar[nvoice].PAmpVelocityScaleFunction = 127; - VoicePar[nvoice].PFilterEnabled = 0; - VoicePar[nvoice].PFilterEnvelopeEnabled = 0; - VoicePar[nvoice].PFilterLfoEnabled = 0; - VoicePar[nvoice].PFMEnabled = 0; - - //I use the internal oscillator (-1) - VoicePar[nvoice].PFMVoice = -1; - - VoicePar[nvoice].PFMVolume = 90; - VoicePar[nvoice].PFMVolumeDamp = 64; - VoicePar[nvoice].PFMDetune = 8192; - VoicePar[nvoice].PFMCoarseDetune = 0; - VoicePar[nvoice].PFMDetuneType = 0; - VoicePar[nvoice].PFMFreqEnvelopeEnabled = 0; - VoicePar[nvoice].PFMAmpEnvelopeEnabled = 0; - VoicePar[nvoice].PFMVelocityScaleFunction = 64; - - VoicePar[nvoice].OscilSmp->defaults(); - VoicePar[nvoice].FMSmp->defaults(); - - VoicePar[nvoice].AmpEnvelope->defaults(); - VoicePar[nvoice].AmpLfo->defaults(); - - VoicePar[nvoice].FreqEnvelope->defaults(); - VoicePar[nvoice].FreqLfo->defaults(); - - VoicePar[nvoice].VoiceFilter->defaults(); - VoicePar[nvoice].FilterEnvelope->defaults(); - VoicePar[nvoice].FilterLfo->defaults(); - - VoicePar[nvoice].FMFreqEnvelope->defaults(); - VoicePar[nvoice].FMAmpEnvelope->defaults(); -} - - - -/* - * Init the voice parameters - */ -void ADnoteParameters::EnableVoice(int nvoice) -{ - VoicePar[nvoice].OscilSmp = new OscilGen(fft, GlobalPar.Reson); - VoicePar[nvoice].FMSmp = new OscilGen(fft, NULL); - - VoicePar[nvoice].AmpEnvelope = new EnvelopeParams(64, 1); - VoicePar[nvoice].AmpEnvelope->ADSRinit_dB(0, 100, 127, 100); - VoicePar[nvoice].AmpLfo = new LFOParams(90, 32, 64, 0, 0, 30, 0, 1); - - VoicePar[nvoice].FreqEnvelope = new EnvelopeParams(0, 0); - VoicePar[nvoice].FreqEnvelope->ASRinit(30, 40, 64, 60); - VoicePar[nvoice].FreqLfo = new LFOParams(50, 40, 0, 0, 0, 0, 0, 0); - - VoicePar[nvoice].VoiceFilter = new FilterParams(2, 50, 60); - VoicePar[nvoice].FilterEnvelope = new EnvelopeParams(0, 0); - VoicePar[nvoice].FilterEnvelope->ADSRinit_filter(90, 70, 40, 70, 10, 40); - VoicePar[nvoice].FilterLfo = new LFOParams(50, 20, 64, 0, 0, 0, 0, 2); - - VoicePar[nvoice].FMFreqEnvelope = new EnvelopeParams(0, 0); - VoicePar[nvoice].FMFreqEnvelope->ASRinit(20, 90, 40, 80); - VoicePar[nvoice].FMAmpEnvelope = new EnvelopeParams(64, 1); - VoicePar[nvoice].FMAmpEnvelope->ADSRinit(80, 90, 127, 100); -} - -/* - * Get the Multiplier of the fine detunes of the voices - */ -REALTYPE ADnoteParameters::getBandwidthDetuneMultiplier() -{ - REALTYPE bw = (GlobalPar.PBandwidth - 64.0) / 64.0; - bw = pow(2.0, bw * pow(fabs(bw), 0.2) * 5.0); - - return bw; -} - -/* - * Get the unison spread in cents for a voice - */ - -REALTYPE ADnoteParameters::getUnisonFrequencySpreadCents(int nvoice) { - REALTYPE unison_spread = VoicePar[nvoice].Unison_frequency_spread / 127.0; - unison_spread = pow(unison_spread * 2.0, 2.0) * 50.0; //cents - return unison_spread; -} - -/* - * Kill the voice - */ -void ADnoteParameters::KillVoice(int nvoice) -{ - delete (VoicePar[nvoice].OscilSmp); - delete (VoicePar[nvoice].FMSmp); - - delete (VoicePar[nvoice].AmpEnvelope); - delete (VoicePar[nvoice].AmpLfo); - - delete (VoicePar[nvoice].FreqEnvelope); - delete (VoicePar[nvoice].FreqLfo); - - delete (VoicePar[nvoice].VoiceFilter); - delete (VoicePar[nvoice].FilterEnvelope); - delete (VoicePar[nvoice].FilterLfo); - - delete (VoicePar[nvoice].FMFreqEnvelope); - delete (VoicePar[nvoice].FMAmpEnvelope); -} - -ADnoteParameters::~ADnoteParameters() -{ - delete (GlobalPar.FreqEnvelope); - delete (GlobalPar.FreqLfo); - delete (GlobalPar.AmpEnvelope); - delete (GlobalPar.AmpLfo); - delete (GlobalPar.GlobalFilter); - delete (GlobalPar.FilterEnvelope); - delete (GlobalPar.FilterLfo); - delete (GlobalPar.Reson); - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) - KillVoice(nvoice); - ; -} - -int ADnoteParameters::get_unison_size_index(int nvoice) { - int index = 0; - if(nvoice >= NUM_VOICES) - return 0; - int unison = VoicePar[nvoice].Unison_size; - - while(1) { - if(ADnote_unison_sizes[index] >= unison) - return index; - ; - if(ADnote_unison_sizes[index] == 0) - return index - 1; - ; - index++; - } - return 0; -} - -void ADnoteParameters::set_unison_size_index(int nvoice, int index) { - int unison = 1; - for(int i = 0; i <= index; i++) { - unison = ADnote_unison_sizes[i]; - if(unison == 0) { - unison = ADnote_unison_sizes[i - 1]; - break; - } - } - - VoicePar[nvoice].Unison_size = unison; -} - - - -void ADnoteParameters::add2XMLsection(XMLwrapper *xml, int n) -{ - int nvoice = n; - if(nvoice >= NUM_VOICES) - return; - - int oscilused = 0, fmoscilused = 0; //if the oscil or fmoscil are used by another voice - - for(int i = 0; i < NUM_VOICES; i++) { - if(VoicePar[i].Pextoscil == nvoice) - oscilused = 1; - if(VoicePar[i].PextFMoscil == nvoice) - fmoscilused = 1; - } - - xml->addparbool("enabled", VoicePar[nvoice].Enabled); - if(((VoicePar[nvoice].Enabled == 0) && (oscilused == 0) - && (fmoscilused == 0)) && (xml->minimal)) - return; - - - xml->addpar("type", VoicePar[nvoice].Type); - - xml->addpar("unison_size", VoicePar[nvoice].Unison_size); - xml->addpar("unison_frequency_spread", - VoicePar[nvoice].Unison_frequency_spread); - xml->addpar("unison_stereo_spread", VoicePar[nvoice].Unison_stereo_spread); - xml->addpar("unison_vibratto", VoicePar[nvoice].Unison_vibratto); - xml->addpar("unison_vibratto_speed", VoicePar[nvoice].Unison_vibratto_speed); - xml->addpar("unison_invert_phase", VoicePar[nvoice].Unison_invert_phase); - - xml->addpar("delay", VoicePar[nvoice].PDelay); - xml->addparbool("resonance", VoicePar[nvoice].Presonance); - - xml->addpar("ext_oscil", VoicePar[nvoice].Pextoscil); - xml->addpar("ext_fm_oscil", VoicePar[nvoice].PextFMoscil); - - xml->addpar("oscil_phase", VoicePar[nvoice].Poscilphase); - xml->addpar("oscil_fm_phase", VoicePar[nvoice].PFMoscilphase); - - xml->addparbool("filter_enabled", VoicePar[nvoice].PFilterEnabled); - xml->addparbool("filter_bypass", VoicePar[nvoice].Pfilterbypass); - - xml->addpar("fm_enabled", VoicePar[nvoice].PFMEnabled); - - xml->beginbranch("OSCIL"); - VoicePar[nvoice].OscilSmp->add2XML(xml); - xml->endbranch(); - - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("panning", VoicePar[nvoice].PPanning); - xml->addpar("volume", VoicePar[nvoice].PVolume); - xml->addparbool("volume_minus", VoicePar[nvoice].PVolumeminus); - xml->addpar("velocity_sensing", VoicePar[nvoice].PAmpVelocityScaleFunction); - - xml->addparbool("amp_envelope_enabled", - VoicePar[nvoice].PAmpEnvelopeEnabled); - if((VoicePar[nvoice].PAmpEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_ENVELOPE"); - VoicePar[nvoice].AmpEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->addparbool("amp_lfo_enabled", VoicePar[nvoice].PAmpLfoEnabled); - if((VoicePar[nvoice].PAmpLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_LFO"); - VoicePar[nvoice].AmpLfo->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addparbool("fixed_freq", VoicePar[nvoice].Pfixedfreq); - xml->addpar("fixed_freq_et", VoicePar[nvoice].PfixedfreqET); - xml->addpar("detune", VoicePar[nvoice].PDetune); - xml->addpar("coarse_detune", VoicePar[nvoice].PCoarseDetune); - xml->addpar("detune_type", VoicePar[nvoice].PDetuneType); - - xml->addparbool("freq_envelope_enabled", - VoicePar[nvoice].PFreqEnvelopeEnabled); - if((VoicePar[nvoice].PFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); - VoicePar[nvoice].FreqEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->addparbool("freq_lfo_enabled", VoicePar[nvoice].PFreqLfoEnabled); - if((VoicePar[nvoice].PFreqLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_LFO"); - VoicePar[nvoice].FreqLfo->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - - - if((VoicePar[nvoice].PFilterEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_PARAMETERS"); - xml->beginbranch("FILTER"); - VoicePar[nvoice].VoiceFilter->add2XML(xml); - xml->endbranch(); - - xml->addparbool("filter_envelope_enabled", - VoicePar[nvoice].PFilterEnvelopeEnabled); - if((VoicePar[nvoice].PFilterEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_ENVELOPE"); - VoicePar[nvoice].FilterEnvelope->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("filter_lfo_enabled", - VoicePar[nvoice].PFilterLfoEnabled); - if((VoicePar[nvoice].PFilterLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_LFO"); - VoicePar[nvoice].FilterLfo->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - } - - if((VoicePar[nvoice].PFMEnabled != 0) || (fmoscilused != 0) - || (!xml->minimal)) { - xml->beginbranch("FM_PARAMETERS"); - xml->addpar("input_voice", VoicePar[nvoice].PFMVoice); - - xml->addpar("volume", VoicePar[nvoice].PFMVolume); - xml->addpar("volume_damp", VoicePar[nvoice].PFMVolumeDamp); - xml->addpar("velocity_sensing", - VoicePar[nvoice].PFMVelocityScaleFunction); - - xml->addparbool("amp_envelope_enabled", - VoicePar[nvoice].PFMAmpEnvelopeEnabled); - if((VoicePar[nvoice].PFMAmpEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_ENVELOPE"); - VoicePar[nvoice].FMAmpEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->beginbranch("MODULATOR"); - xml->addpar("detune", VoicePar[nvoice].PFMDetune); - xml->addpar("coarse_detune", VoicePar[nvoice].PFMCoarseDetune); - xml->addpar("detune_type", VoicePar[nvoice].PFMDetuneType); - - xml->addparbool("freq_envelope_enabled", - VoicePar[nvoice].PFMFreqEnvelopeEnabled); - if((VoicePar[nvoice].PFMFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); - VoicePar[nvoice].FMFreqEnvelope->add2XML(xml); - xml->endbranch(); - } - - xml->beginbranch("OSCIL"); - VoicePar[nvoice].FMSmp->add2XML(xml); - xml->endbranch(); - - xml->endbranch(); - xml->endbranch(); - } -} - - -void ADnoteParameters::add2XML(XMLwrapper *xml) -{ - xml->addparbool("stereo", GlobalPar.PStereo); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("volume", GlobalPar.PVolume); - xml->addpar("panning", GlobalPar.PPanning); - xml->addpar("velocity_sensing", GlobalPar.PAmpVelocityScaleFunction); - xml->addpar("punch_strength", GlobalPar.PPunchStrength); - xml->addpar("punch_time", GlobalPar.PPunchTime); - xml->addpar("punch_stretch", GlobalPar.PPunchStretch); - xml->addpar("punch_velocity_sensing", GlobalPar.PPunchVelocitySensing); - xml->addpar("harmonic_randomness_grouping", GlobalPar.Hrandgrouping); - - xml->beginbranch("AMPLITUDE_ENVELOPE"); - GlobalPar.AmpEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_LFO"); - GlobalPar.AmpLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addpar("detune", GlobalPar.PDetune); - - xml->addpar("coarse_detune", GlobalPar.PCoarseDetune); - xml->addpar("detune_type", GlobalPar.PDetuneType); - - xml->addpar("bandwidth", GlobalPar.PBandwidth); - - xml->beginbranch("FREQUENCY_ENVELOPE"); - GlobalPar.FreqEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_LFO"); - GlobalPar.FreqLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", GlobalPar.PFilterVelocityScale); - xml->addpar("velocity_sensing", GlobalPar.PFilterVelocityScaleFunction); - - xml->beginbranch("FILTER"); - GlobalPar.GlobalFilter->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_ENVELOPE"); - GlobalPar.FilterEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_LFO"); - GlobalPar.FilterLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("RESONANCE"); - GlobalPar.Reson->add2XML(xml); - xml->endbranch(); - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - xml->beginbranch("VOICE", nvoice); - add2XMLsection(xml, nvoice); - xml->endbranch(); - } -} - - -void ADnoteParameters::getfromXML(XMLwrapper *xml) -{ - GlobalPar.PStereo = xml->getparbool("stereo", GlobalPar.PStereo); - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - GlobalPar.PVolume = xml->getpar127("volume", GlobalPar.PVolume); - GlobalPar.PPanning = xml->getpar127("panning", GlobalPar.PPanning); - GlobalPar.PAmpVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - GlobalPar. - PAmpVelocityScaleFunction); - - GlobalPar.PPunchStrength = xml->getpar127("punch_strength", - GlobalPar.PPunchStrength); - GlobalPar.PPunchTime = xml->getpar127("punch_time", - GlobalPar.PPunchTime); - GlobalPar.PPunchStretch = xml->getpar127("punch_stretch", - GlobalPar.PPunchStretch); - GlobalPar.PPunchVelocitySensing = xml->getpar127( - "punch_velocity_sensing", - GlobalPar.PPunchVelocitySensing); - GlobalPar.Hrandgrouping = xml->getpar127( - "harmonic_randomness_grouping", - GlobalPar.Hrandgrouping); - - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - GlobalPar.AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("AMPLITUDE_LFO")) { - GlobalPar.AmpLfo->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - GlobalPar.PDetune = xml->getpar("detune", - GlobalPar.PDetune, - 0, - 16383); - GlobalPar.PCoarseDetune = xml->getpar("coarse_detune", - GlobalPar.PCoarseDetune, - 0, - 16383); - GlobalPar.PDetuneType = xml->getpar127("detune_type", - GlobalPar.PDetuneType); - - GlobalPar.PBandwidth = xml->getpar127("bandwidth", - GlobalPar.PBandwidth); - - xml->enterbranch("FREQUENCY_ENVELOPE"); - GlobalPar.FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FREQUENCY_LFO"); - GlobalPar.FreqLfo->getfromXML(xml); - xml->exitbranch(); - - xml->exitbranch(); - } - - - if(xml->enterbranch("FILTER_PARAMETERS")) { - GlobalPar.PFilterVelocityScale = xml->getpar127( - "velocity_sensing_amplitude", - GlobalPar.PFilterVelocityScale); - GlobalPar.PFilterVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - GlobalPar.PFilterVelocityScaleFunction); - - xml->enterbranch("FILTER"); - GlobalPar.GlobalFilter->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_ENVELOPE"); - GlobalPar.FilterEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_LFO"); - GlobalPar.FilterLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); - } - - if(xml->enterbranch("RESONANCE")) { - GlobalPar.Reson->getfromXML(xml); - xml->exitbranch(); - } - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - VoicePar[nvoice].Enabled = 0; - if(xml->enterbranch("VOICE", nvoice) == 0) - continue; - getfromXMLsection(xml, nvoice); - xml->exitbranch(); - } -} - -void ADnoteParameters::getfromXMLsection(XMLwrapper *xml, int n) -{ - int nvoice = n; - if(nvoice >= NUM_VOICES) - return; - - VoicePar[nvoice].Enabled = xml->getparbool("enabled", 0); - - VoicePar[nvoice].Unison_size = - xml->getpar127("unison_size", VoicePar[nvoice].Unison_size); - VoicePar[nvoice].Unison_frequency_spread = xml->getpar127( - "unison_frequency_spread", - VoicePar[nvoice].Unison_frequency_spread); - VoicePar[nvoice].Unison_stereo_spread = xml->getpar127( - "unison_stereo_spread", - VoicePar[nvoice].Unison_stereo_spread); - VoicePar[nvoice].Unison_vibratto = xml->getpar127( - "unison_vibratto", - VoicePar[nvoice]. - Unison_vibratto); - VoicePar[nvoice].Unison_vibratto_speed = xml->getpar127( - "unison_vibratto_speed", - VoicePar[nvoice].Unison_vibratto_speed); - VoicePar[nvoice].Unison_invert_phase = xml->getpar127( - "unison_invert_phase", - VoicePar[nvoice].Unison_invert_phase); - - VoicePar[nvoice].Type = xml->getpar127("type", - VoicePar[nvoice].Type); - VoicePar[nvoice].PDelay = xml->getpar127("delay", - VoicePar[nvoice].PDelay); - VoicePar[nvoice].Presonance = - xml->getparbool("resonance", VoicePar[nvoice].Presonance); - - VoicePar[nvoice].Pextoscil = xml->getpar("ext_oscil", - -1, - -1, - nvoice - 1); - VoicePar[nvoice].PextFMoscil = xml->getpar("ext_fm_oscil", - -1, - -1, - nvoice - 1); - - VoicePar[nvoice].Poscilphase = - xml->getpar127("oscil_phase", VoicePar[nvoice].Poscilphase); - VoicePar[nvoice].PFMoscilphase = xml->getpar127( - "oscil_fm_phase", - VoicePar[nvoice]. - PFMoscilphase); - - VoicePar[nvoice].PFilterEnabled = xml->getparbool( - "filter_enabled", - VoicePar[nvoice]. - PFilterEnabled); - VoicePar[nvoice].Pfilterbypass = xml->getparbool( - "filter_bypass", - VoicePar[nvoice]. - Pfilterbypass); - - VoicePar[nvoice].PFMEnabled = - xml->getpar127("fm_enabled", VoicePar[nvoice].PFMEnabled); - - if(xml->enterbranch("OSCIL")) { - VoicePar[nvoice].OscilSmp->getfromXML(xml); - xml->exitbranch(); - } - - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - VoicePar[nvoice].PPanning = - xml->getpar127("panning", VoicePar[nvoice].PPanning); - VoicePar[nvoice].PVolume = - xml->getpar127("volume", VoicePar[nvoice].PVolume); - VoicePar[nvoice].PVolumeminus = xml->getparbool( - "volume_minus", - VoicePar[nvoice]. - PVolumeminus); - VoicePar[nvoice].PAmpVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - VoicePar[nvoice].PAmpVelocityScaleFunction); - - VoicePar[nvoice].PAmpEnvelopeEnabled = xml->getparbool( - "amp_envelope_enabled", - VoicePar[nvoice].PAmpEnvelopeEnabled); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - VoicePar[nvoice].AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - VoicePar[nvoice].PAmpLfoEnabled = xml->getparbool( - "amp_lfo_enabled", - VoicePar[nvoice]. - PAmpLfoEnabled); - if(xml->enterbranch("AMPLITUDE_LFO")) { - VoicePar[nvoice].AmpLfo->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - VoicePar[nvoice].Pfixedfreq = - xml->getparbool("fixed_freq", VoicePar[nvoice].Pfixedfreq); - VoicePar[nvoice].PfixedfreqET = xml->getpar127( - "fixed_freq_et", - VoicePar[nvoice]. - PfixedfreqET); - - - VoicePar[nvoice].PDetune = xml->getpar("detune", - VoicePar[nvoice].PDetune, - 0, - 16383); - - VoicePar[nvoice].PCoarseDetune = - xml->getpar("coarse_detune", - VoicePar[nvoice].PCoarseDetune, - 0, - 16383); - VoicePar[nvoice].PDetuneType = xml->getpar127( - "detune_type", - VoicePar[nvoice]. - PDetuneType); - - VoicePar[nvoice].PFreqEnvelopeEnabled = xml->getparbool( - "freq_envelope_enabled", - VoicePar[nvoice].PFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { - VoicePar[nvoice].FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - VoicePar[nvoice].PFreqLfoEnabled = xml->getparbool( - "freq_lfo_enabled", - VoicePar[nvoice]. - PFreqLfoEnabled); - if(xml->enterbranch("FREQUENCY_LFO")) { - VoicePar[nvoice].FreqLfo->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FILTER_PARAMETERS")) { - if(xml->enterbranch("FILTER")) { - VoicePar[nvoice].VoiceFilter->getfromXML(xml); - xml->exitbranch(); - } - - VoicePar[nvoice].PFilterEnvelopeEnabled = xml->getparbool( - "filter_envelope_enabled", - VoicePar[nvoice].PFilterEnvelopeEnabled); - if(xml->enterbranch("FILTER_ENVELOPE")) { - VoicePar[nvoice].FilterEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - VoicePar[nvoice].PFilterLfoEnabled = xml->getparbool( - "filter_lfo_enabled", - VoicePar[nvoice].PFilterLfoEnabled); - if(xml->enterbranch("FILTER_LFO")) { - VoicePar[nvoice].FilterLfo->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FM_PARAMETERS")) { - VoicePar[nvoice].PFMVoice = - xml->getpar("input_voice", - VoicePar[nvoice].PFMVoice, - -1, - nvoice - 1); - - VoicePar[nvoice].PFMVolume = - xml->getpar127("volume", VoicePar[nvoice].PFMVolume); - VoicePar[nvoice].PFMVolumeDamp = xml->getpar127( - "volume_damp", - VoicePar[nvoice]. - PFMVolumeDamp); - VoicePar[nvoice].PFMVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - VoicePar[nvoice].PFMVelocityScaleFunction); - - VoicePar[nvoice].PFMAmpEnvelopeEnabled = xml->getparbool( - "amp_envelope_enabled", - VoicePar[nvoice].PFMAmpEnvelopeEnabled); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - VoicePar[nvoice].FMAmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("MODULATOR")) { - VoicePar[nvoice].PFMDetune = - xml->getpar("detune", VoicePar[nvoice].PFMDetune, 0, 16383); - VoicePar[nvoice].PFMCoarseDetune = xml->getpar( - "coarse_detune", - VoicePar[nvoice]. - PFMCoarseDetune, - 0, - 16383); - VoicePar[nvoice].PFMDetuneType = xml->getpar127( - "detune_type", - VoicePar[nvoice]. - PFMDetuneType); - - VoicePar[nvoice].PFMFreqEnvelopeEnabled = xml->getparbool( - "freq_envelope_enabled", - VoicePar[nvoice].PFMFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { - VoicePar[nvoice].FMFreqEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("OSCIL")) { - VoicePar[nvoice].FMSmp->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Params/ADnoteParameters.h b/plugins/zynaddsubfx/src/Params/ADnoteParameters.h deleted file mode 100644 index e63efcff3..000000000 --- a/plugins/zynaddsubfx/src/Params/ADnoteParameters.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnoteParameters.h - Parameters for ADnote (ADsynth) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef AD_NOTE_PARAMETERS_H -#define AD_NOTE_PARAMETERS_H - - -#include "../globals.h" -#include "EnvelopeParams.h" -#include "LFOParams.h" -#include "FilterParams.h" -#include "../Synth/OscilGen.h" -#include "../Synth/Resonance.h" -#include "../Misc/Util.h" -#include "../Misc/XMLwrapper.h" -#include "../DSP/FFTwrapper.h" -#include "PresetsArray.h" - -enum FMTYPE { - NONE, MORPH, RING_MOD, PHASE_MOD, FREQ_MOD, PITCH_MOD -}; -extern int ADnote_unison_sizes[]; - -/*****************************************************************/ -/* GLOBAL PARAMETERS */ -/*****************************************************************/ - -struct ADnoteGlobalParam { - /* The instrument type - MONO/STEREO - If the mode is MONO, the panning of voices are not used - Stereo=1, Mono=0. */ - - unsigned char PStereo; - - - /****************************************** - * FREQUENCY GLOBAL PARAMETERS * - ******************************************/ - unsigned short int PDetune; //fine detune - unsigned short int PCoarseDetune; //coarse detune+octave - unsigned char PDetuneType; //detune type - - unsigned char PBandwidth; //how much the relative fine detunes of the voices are changed - - EnvelopeParams *FreqEnvelope; //Frequency Envelope - - LFOParams *FreqLfo; //Frequency LFO - - /******************************************** - * AMPLITUDE GLOBAL PARAMETERS * - ********************************************/ - - /* Panning - 0 - random - 1 - left - 64 - center - 127 - right */ - unsigned char PPanning; - - unsigned char PVolume; - - unsigned char PAmpVelocityScaleFunction; - - EnvelopeParams *AmpEnvelope; - - LFOParams *AmpLfo; - - unsigned char PPunchStrength, PPunchTime, PPunchStretch, - PPunchVelocitySensing; - - /****************************************** - * FILTER GLOBAL PARAMETERS * - ******************************************/ - FilterParams *GlobalFilter; - - // filter velocity sensing - unsigned char PFilterVelocityScale; - - // filter velocity sensing - unsigned char PFilterVelocityScaleFunction; - - EnvelopeParams *FilterEnvelope; - - LFOParams *FilterLfo; - - // RESONANCE - Resonance *Reson; - - //how the randomness is applied to the harmonics on more voices using the same oscillator - unsigned char Hrandgrouping; -}; - - - -/***********************************************************/ -/* VOICE PARAMETERS */ -/***********************************************************/ -struct ADnoteVoiceParam { - /** If the voice is enabled */ - unsigned char Enabled; - - /** How many subvoices are used in this voice */ - unsigned char Unison_size; - - /** How subvoices are spread */ - unsigned char Unison_frequency_spread; - - /** Stereo spread of the subvoices*/ - unsigned char Unison_stereo_spread; - - /** Vibratto of the subvoices (which makes the unison more "natural")*/ - unsigned char Unison_vibratto; - - /** Medium speed of the vibratto of the subvoices*/ - unsigned char Unison_vibratto_speed; - - /** Unison invert phase */ - unsigned char Unison_invert_phase; //0=none,1=random,2=50%,3=33%,4=25% - - /** Type of the voice (0=Sound,1=Noise)*/ - unsigned char Type; - - /** Voice Delay */ - unsigned char PDelay; - - /** If the resonance is enabled for this voice */ - unsigned char Presonance; - - // What external oscil should I use, -1 for internal OscilSmp&FMSmp - short int Pextoscil, PextFMoscil; - // it is not allowed that the externoscil,externFMoscil => current voice - - // oscillator phases - unsigned char Poscilphase, PFMoscilphase; - - // filter bypass - unsigned char Pfilterbypass; - - /** Voice oscillator */ - OscilGen *OscilSmp; - - /********************************** - * FREQUENCY PARAMETERS * - **********************************/ - - /** If the base frequency is fixed to 440 Hz*/ - unsigned char Pfixedfreq; - - /* Equal temperate (this is used only if the Pfixedfreq is enabled) - If this parameter is 0, the frequency is fixed (to 440 Hz); - if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ - unsigned char PfixedfreqET; - - /** Fine detune */ - unsigned short int PDetune; - - /** Coarse detune + octave */ - unsigned short int PCoarseDetune; - - /** Detune type */ - unsigned char PDetuneType; - - /* Frequency Envelope */ - unsigned char PFreqEnvelopeEnabled; - EnvelopeParams *FreqEnvelope; - - /* Frequency LFO */ - unsigned char PFreqLfoEnabled; - LFOParams *FreqLfo; - - - /*************************** - * AMPLITUDE PARAMETERS * - ***************************/ - - /* Panning 0 - random - 1 - left - 64 - center - 127 - right - The Panning is ignored if the instrument is mono */ - unsigned char PPanning; - - /* Voice Volume */ - unsigned char PVolume; - - /* If the Volume negative */ - unsigned char PVolumeminus; - - /* Velocity sensing */ - unsigned char PAmpVelocityScaleFunction; - - /* Amplitude Envelope */ - unsigned char PAmpEnvelopeEnabled; - EnvelopeParams *AmpEnvelope; - - /* Amplitude LFO */ - unsigned char PAmpLfoEnabled; - LFOParams *AmpLfo; - - - - /************************* - * FILTER PARAMETERS * - *************************/ - - /* Voice Filter */ - unsigned char PFilterEnabled; - FilterParams *VoiceFilter; - - /* Filter Envelope */ - unsigned char PFilterEnvelopeEnabled; - EnvelopeParams *FilterEnvelope; - - /* LFO Envelope */ - unsigned char PFilterLfoEnabled; - LFOParams *FilterLfo; - - /**************************** - * MODULLATOR PARAMETERS * - ****************************/ - - /* Modullator Parameters (0=off,1=Morph,2=RM,3=PM,4=FM.. */ - unsigned char PFMEnabled; - - /* Voice that I use as modullator instead of FMSmp. - It is -1 if I use FMSmp(default). - It maynot be equal or bigger than current voice */ - short int PFMVoice; - - /* Modullator oscillator */ - OscilGen *FMSmp; - - /* Modullator Volume */ - unsigned char PFMVolume; - - /* Modullator damping at higher frequencies */ - unsigned char PFMVolumeDamp; - - /* Modullator Velocity Sensing */ - unsigned char PFMVelocityScaleFunction; - - /* Fine Detune of the Modullator*/ - unsigned short int PFMDetune; - - /* Coarse Detune of the Modullator */ - unsigned short int PFMCoarseDetune; - - /* The detune type */ - unsigned char PFMDetuneType; - - /* Frequency Envelope of the Modullator */ - unsigned char PFMFreqEnvelopeEnabled; - EnvelopeParams *FMFreqEnvelope; - - /* Frequency Envelope of the Modullator */ - unsigned char PFMAmpEnvelopeEnabled; - EnvelopeParams *FMAmpEnvelope; -}; - -class ADnoteParameters : public PresetsArray -{ - public: - ADnoteParameters(FFTwrapper *fft_); - ~ADnoteParameters(); - - ADnoteGlobalParam GlobalPar; - ADnoteVoiceParam VoicePar[NUM_VOICES]; - - void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); - - REALTYPE getBandwidthDetuneMultiplier(); - REALTYPE getUnisonFrequencySpreadCents(int nvoice); - int get_unison_size_index(int nvoice); - void set_unison_size_index(int nvoice, int index); - private: - void defaults(int n); //n is the nvoice - - void EnableVoice(int nvoice); - void KillVoice(int nvoice); - FFTwrapper *fft; - - void add2XMLsection(XMLwrapper *xml, int n); - void getfromXMLsection(XMLwrapper *xml, int n); -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Params/CMakeLists.txt b/plugins/zynaddsubfx/src/Params/CMakeLists.txt deleted file mode 100644 index 670fcf26d..000000000 --- a/plugins/zynaddsubfx/src/Params/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(zynaddsubfx_params_SRCS - ADnoteParameters.cpp - Controller.cpp - EnvelopeParams.cpp - FilterParams.cpp - LFOParams.cpp - PADnoteParameters.cpp - Presets.cpp - PresetsArray.cpp - PresetsStore.cpp - SUBnoteParameters.cpp - -) - -add_library(zynaddsubfx_params STATIC - ${zynaddsubfx_params_SRCS} - ) - -target_link_libraries(zynaddsubfx_params)# ${ASOUND_LIBRARY}) diff --git a/plugins/zynaddsubfx/src/Params/Controller.cpp b/plugins/zynaddsubfx/src/Params/Controller.cpp deleted file mode 100644 index e3fb70d8c..000000000 --- a/plugins/zynaddsubfx/src/Params/Controller.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Controller.cpp - (Midi) Controllers implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Controller.h" -#include -#include - -Controller::Controller() -{ - defaults(); - resetall(); -} - -Controller::~Controller() -{} - -void Controller::defaults() -{ - setpitchwheelbendrange(100); //2 halftones - expression.receive = 1; - panning.depth = 64; - filtercutoff.depth = 64; - filterq.depth = 64; - bandwidth.depth = 64; - bandwidth.exponential = 0; - modwheel.depth = 80; - modwheel.exponential = 0; - fmamp.receive = 1; - volume.receive = 1; - sustain.receive = 1; - NRPN.receive = 1; - - portamento.portamento = 0; - portamento.used = 0; - portamento.proportional = 0; - portamento.propRate = 80; - portamento.propDepth = 90; - portamento.receive = 1; - portamento.time = 64; - portamento.updowntimestretch = 64; - portamento.pitchthresh = 3; - portamento.pitchthreshtype = 1; - portamento.noteusing = -1; - resonancecenter.depth = 64; - resonancebandwidth.depth = 64; - - initportamento(440.0, 440.0, false); // Now has a third argument - setportamento(0); -} - -void Controller::resetall() -{ - setpitchwheel(0); //center - setexpression(127); - setpanning(64); - setfiltercutoff(64); - setfilterq(64); - setbandwidth(64); - setmodwheel(64); - setfmamp(127); - setvolume(127); - setsustain(0); - setresonancecenter(64); - setresonancebw(64); - - //reset the NRPN - NRPN.parhi = -1; - NRPN.parlo = -1; - NRPN.valhi = -1; - NRPN.vallo = -1; -} - -void Controller::setpitchwheel(int value) -{ - pitchwheel.data = value; - REALTYPE cents = value / 8192.0; - cents *= pitchwheel.bendrange; - pitchwheel.relfreq = pow(2, cents / 1200.0); - //fprintf(stderr,"%ld %ld -> %.3f\n",pitchwheel.bendrange,pitchwheel.data,pitchwheel.relfreq);fflush(stderr); -} - -void Controller::setpitchwheelbendrange(unsigned short int value) -{ - pitchwheel.bendrange = value; -} - -void Controller::setexpression(int value) -{ - expression.data = value; - if(expression.receive != 0) - expression.relvolume = value / 127.0; - else - expression.relvolume = 1.0; -} - -void Controller::setpanning(int value) -{ - panning.data = value; - panning.pan = (value / 128.0 - 0.5) * (panning.depth / 64.0); -} - -void Controller::setfiltercutoff(int value) -{ - filtercutoff.data = value; - filtercutoff.relfreq = - (value - 64.0) * filtercutoff.depth / 4096.0 * 3.321928; //3.3219..=ln2(10) -} - -void Controller::setfilterq(int value) -{ - filterq.data = value; - filterq.relq = pow(30.0, (value - 64.0) / 64.0 * (filterq.depth / 64.0)); -} - -void Controller::setbandwidth(int value) -{ - bandwidth.data = value; - if(bandwidth.exponential == 0) { - REALTYPE tmp = pow(25.0, pow(bandwidth.depth / 127.0, 1.5)) - 1.0; - if((value < 64) && (bandwidth.depth >= 64)) - tmp = 1.0; - bandwidth.relbw = (value / 64.0 - 1.0) * tmp + 1.0; - if(bandwidth.relbw < 0.01) - bandwidth.relbw = 0.01; - } - else - bandwidth.relbw = - pow(25.0, (value - 64.0) / 64.0 * (bandwidth.depth / 64.0)); - ; -} - -void Controller::setmodwheel(int value) -{ - modwheel.data = value; - if(modwheel.exponential == 0) { - REALTYPE tmp = pow(25.0, pow(modwheel.depth / 127.0, 1.5) * 2.0) / 25.0; - if((value < 64) && (modwheel.depth >= 64)) - tmp = 1.0; - modwheel.relmod = (value / 64.0 - 1.0) * tmp + 1.0; - if(modwheel.relmod < 0.0) - modwheel.relmod = 0.0; - } - else - modwheel.relmod = - pow(25.0, (value - 64.0) / 64.0 * (modwheel.depth / 80.0)); -} - -void Controller::setfmamp(int value) -{ - fmamp.data = value; - fmamp.relamp = value / 127.0; - if(fmamp.receive != 0) - fmamp.relamp = value / 127.0; - else - fmamp.relamp = 1.0; -} - -void Controller::setvolume(int value) -{ - volume.data = value; - if(volume.receive != 0) - volume.volume = pow(0.1, (127 - value) / 127.0 * 2.0); - else - volume.volume = 1.0; -} - -void Controller::setsustain(int value) -{ - sustain.data = value; - if(sustain.receive != 0) - sustain.sustain = ((value < 64) ? 0 : 1); - else - sustain.sustain = 0; -} - -void Controller::setportamento(int value) -{ - portamento.data = value; - if(portamento.receive != 0) - portamento.portamento = ((value < 64) ? 0 : 1); -} - -int Controller::initportamento(REALTYPE oldfreq, - REALTYPE newfreq, - bool legatoflag) -{ - portamento.x = 0.0; - - if(legatoflag) { // Legato in progress - if(portamento.portamento == 0) - return 0; - } - else // No legato, do the original if...return - if((portamento.used != 0) || (portamento.portamento == 0)) - return 0; - ; - - REALTYPE portamentotime = pow(100.0, portamento.time / 127.0) / 50.0; //portamento time in seconds - - if(portamento.proportional) { - //If there is a min(float,float) and a max(float,float) then they - //could be used here - //Linear functors could also make this nicer - if(oldfreq > newfreq) //2 is the center of propRate - portamentotime *= - pow(oldfreq / newfreq / (portamento.propRate / 127.0 * 3 + .05), - (portamento.propDepth / 127.0 * 1.6 + .2)); - else //1 is the center of propDepth - portamentotime *= - pow(newfreq / oldfreq / (portamento.propRate / 127.0 * 3 + .05), - (portamento.propDepth / 127.0 * 1.6 + .2)); - } - - if((portamento.updowntimestretch >= 64) && (newfreq < oldfreq)) { - if(portamento.updowntimestretch == 127) - return 0; - portamentotime *= pow(0.1, (portamento.updowntimestretch - 64) / 63.0); - } - if((portamento.updowntimestretch < 64) && (newfreq > oldfreq)) { - if(portamento.updowntimestretch == 0) - return 0; - portamentotime *= pow(0.1, (64.0 - portamento.updowntimestretch) / 64.0); - } - - //printf("%f->%f : Time %f\n",oldfreq,newfreq,portamentotime); - - portamento.dx = SOUND_BUFFER_SIZE / (portamentotime * SAMPLE_RATE); - portamento.origfreqrap = oldfreq / newfreq; - - REALTYPE tmprap = ((portamento.origfreqrap > 1.0) ? - (portamento.origfreqrap) : - (1.0 / portamento.origfreqrap)); - - REALTYPE thresholdrap = pow(2.0, portamento.pitchthresh / 12.0); - if((portamento.pitchthreshtype == 0) && (tmprap - 0.00001 > thresholdrap)) - return 0; - if((portamento.pitchthreshtype == 1) && (tmprap + 0.00001 < thresholdrap)) - return 0; - - portamento.used = 1; - portamento.freqrap = portamento.origfreqrap; - return 1; -} - -void Controller::updateportamento() -{ - if(portamento.used == 0) - return; - - portamento.x += portamento.dx; - if(portamento.x > 1.0) { - portamento.x = 1.0; - portamento.used = 0; - } - portamento.freqrap = - (1.0 - portamento.x) * portamento.origfreqrap + portamento.x; -} - - -void Controller::setresonancecenter(int value) -{ - resonancecenter.data = value; - resonancecenter.relcenter = - pow(3.0, (value - 64.0) / 64.0 * (resonancecenter.depth / 64.0)); -} -void Controller::setresonancebw(int value) -{ - resonancebandwidth.data = value; - resonancebandwidth.relbw = - pow(1.5, (value - 64.0) / 64.0 * (resonancebandwidth.depth / 127.0)); -} - - -//Returns 0 if there is NRPN or 1 if there is not -int Controller::getnrpn(int *parhi, int *parlo, int *valhi, int *vallo) -{ - if(NRPN.receive == 0) - return 1; - if((NRPN.parhi < 0) || (NRPN.parlo < 0) || (NRPN.valhi < 0) - || (NRPN.vallo < 0)) - return 1; - - *parhi = NRPN.parhi; - *parlo = NRPN.parlo; - *valhi = NRPN.valhi; - *vallo = NRPN.vallo; - return 0; -} - - -void Controller::setparameternumber(unsigned int type, int value) -{ - switch(type) { - case C_nrpnhi: - NRPN.parhi = value; - NRPN.valhi = -1; - NRPN.vallo = -1; //clear the values - break; - case C_nrpnlo: - NRPN.parlo = value; - NRPN.valhi = -1; - NRPN.vallo = -1; //clear the values - break; - case C_dataentryhi: - if((NRPN.parhi >= 0) && (NRPN.parlo >= 0)) - NRPN.valhi = value; - break; - case C_dataentrylo: - if((NRPN.parhi >= 0) && (NRPN.parlo >= 0)) - NRPN.vallo = value; - break; - } -} - - - -void Controller::add2XML(XMLwrapper *xml) -{ - xml->addpar("pitchwheel_bendrange", pitchwheel.bendrange); - - xml->addparbool("expression_receive", expression.receive); - xml->addpar("panning_depth", panning.depth); - xml->addpar("filter_cutoff_depth", filtercutoff.depth); - xml->addpar("filter_q_depth", filterq.depth); - xml->addpar("bandwidth_depth", bandwidth.depth); - xml->addpar("mod_wheel_depth", modwheel.depth); - xml->addparbool("mod_wheel_exponential", modwheel.exponential); - xml->addparbool("fm_amp_receive", fmamp.receive); - xml->addparbool("volume_receive", volume.receive); - xml->addparbool("sustain_receive", sustain.receive); - - xml->addparbool("portamento_receive", portamento.receive); - xml->addpar("portamento_time", portamento.time); - xml->addpar("portamento_pitchthresh", portamento.pitchthresh); - xml->addpar("portamento_pitchthreshtype", portamento.pitchthreshtype); - xml->addpar("portamento_portamento", portamento.portamento); - xml->addpar("portamento_updowntimestretch", portamento.updowntimestretch); - xml->addpar("portamento_proportional", portamento.proportional); - xml->addpar("portamento_proprate", portamento.propRate); - xml->addpar("portamento_propdepth", portamento.propDepth); - - xml->addpar("resonance_center_depth", resonancecenter.depth); - xml->addpar("resonance_bandwidth_depth", resonancebandwidth.depth); -} - -void Controller::getfromXML(XMLwrapper *xml) -{ - pitchwheel.bendrange = xml->getpar("pitchwheel_bendrange", - pitchwheel.bendrange, - -6400, - 6400); - - expression.receive = xml->getparbool("expression_receive", - expression.receive); - panning.depth = xml->getpar127("panning_depth", panning.depth); - filtercutoff.depth = xml->getpar127("filter_cutoff_depth", - filtercutoff.depth); - filterq.depth = xml->getpar127("filter_q_depth", filterq.depth); - bandwidth.depth = xml->getpar127("bandwidth_depth", bandwidth.depth); - modwheel.depth = xml->getpar127("mod_wheel_depth", modwheel.depth); - modwheel.exponential = xml->getparbool("mod_wheel_exponential", - modwheel.exponential); - fmamp.receive = xml->getparbool("fm_amp_receive", - fmamp.receive); - volume.receive = xml->getparbool("volume_receive", - volume.receive); - sustain.receive = xml->getparbool("sustain_receive", - sustain.receive); - - portamento.receive = xml->getparbool("portamento_receive", - portamento.receive); - portamento.time = xml->getpar127("portamento_time", - portamento.time); - portamento.pitchthresh = xml->getpar127("portamento_pitchthresh", - portamento.pitchthresh); - portamento.pitchthreshtype = xml->getpar127("portamento_pitchthreshtype", - portamento.pitchthreshtype); - portamento.portamento = xml->getpar127("portamento_portamento", - portamento.portamento); - portamento.updowntimestretch = xml->getpar127( - "portamento_updowntimestretch", - portamento.updowntimestretch); - portamento.proportional = xml->getpar127("portamento_proportional", - portamento.proportional); - portamento.propRate = xml->getpar127("portamento_proprate", - portamento.propRate); - portamento.propDepth = xml->getpar127("portamento_propdepth", - portamento.propDepth); - - - resonancecenter.depth = xml->getpar127("resonance_center_depth", - resonancecenter.depth); - resonancebandwidth.depth = xml->getpar127("resonance_bandwidth_depth", - resonancebandwidth.depth); -} - diff --git a/plugins/zynaddsubfx/src/Params/Controller.h b/plugins/zynaddsubfx/src/Params/Controller.h deleted file mode 100644 index 86a4badbb..000000000 --- a/plugins/zynaddsubfx/src/Params/Controller.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Controller.h - (Midi) Controllers implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#ifndef CONTROLLER_H -#define CONTROLLER_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" - -/**(Midi) Controllers implementation*/ -class Controller -{ - public: - Controller(); - ~Controller(); - void resetall(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - //Controllers functions - void setpitchwheel(int value); - void setpitchwheelbendrange(unsigned short int value); - void setexpression(int value); - void setpanning(int value); - void setfiltercutoff(int value); - void setfilterq(int value); - void setbandwidth(int value); - void setmodwheel(int value); - void setfmamp(int value); - void setvolume(int value); - void setsustain(int value); - /**Enable or disable portamento - * @param value 0-127 MIDI value (greater than 64 enables)*/ - void setportamento(int value); - void setresonancecenter(int value); - void setresonancebw(int value); - - - void setparameternumber(unsigned int type, int value); //used for RPN and NRPN's - int getnrpn(int *parhi, int *parlo, int *valhi, int *vallo); - - /** - * Initialize a portamento - * - * @param oldfreq Starting frequency of the portamento (Hz) - * @param newfreq Ending frequency of the portamento (Hz) - * @param legatoflag true when legato is in progress, false otherwise - * @returns 1 if properly initialized, 0 otherwise*/ - int initportamento(REALTYPE oldfreq, REALTYPE newfreq, bool legatoflag); - /**Update portamento's freqrap to next value based upon dx*/ - void updateportamento(); - - // Controllers values - struct { //Pitch Wheel - int data; - short int bendrange; //bendrange is in cents - REALTYPE relfreq; //the relative frequency (default is 1.0) - } pitchwheel; - - struct { //Expression - int data; - REALTYPE relvolume; - unsigned char receive; - } expression; - - struct { //Panning - int data; - REALTYPE pan; - unsigned char depth; - } panning; - - - struct { //Filter cutoff - int data; - REALTYPE relfreq; - unsigned char depth; - } filtercutoff; - - struct { //Filter Q - int data; - REALTYPE relq; - unsigned char depth; - } filterq; - - struct { //Bandwidth - int data; - REALTYPE relbw; - unsigned char depth; - unsigned char exponential; - } bandwidth; - - struct { //Modulation Wheel - int data; - REALTYPE relmod; - unsigned char depth; - unsigned char exponential; - } modwheel; - - struct { //FM amplitude - int data; - REALTYPE relamp; - unsigned char receive; - } fmamp; - - struct { //Volume - int data; - REALTYPE volume; - unsigned char receive; - } volume; - - struct { //Sustain - int data, sustain; - unsigned char receive; - } sustain; - - struct { /** - -#include -#include -#include "EnvelopeParams.h" - -EnvelopeParams::EnvelopeParams(unsigned char Penvstretch_, - unsigned char Pforcedrelease_):Presets() -{ - int i; - - PA_dt = 10; - PD_dt = 10; - PR_dt = 10; - PA_val = 64; - PD_val = 64; - PS_val = 64; - PR_val = 64; - - for(i = 0; i < MAX_ENVELOPE_POINTS; i++) { - Penvdt[i] = 32; - Penvval[i] = 64; - } - Penvdt[0] = 0; //no used - Penvsustain = 1; - Penvpoints = 1; - Envmode = 1; - Penvstretch = Penvstretch_; - Pforcedrelease = Pforcedrelease_; - Pfreemode = 1; - Plinearenvelope = 0; - - store2defaults(); -} - -EnvelopeParams::~EnvelopeParams() -{} - -REALTYPE EnvelopeParams::getdt(char i) -{ - REALTYPE result = (pow(2.0, Penvdt[(int)i] / 127.0 * 12.0) - 1.0) * 10.0; //miliseconds - return result; -} - - -/* - * ADSR/ASR... initialisations - */ -void EnvelopeParams::ADSRinit(char A_dt, char D_dt, char S_val, char R_dt) -{ - setpresettype("Penvamplitude"); - Envmode = 1; - PA_dt = A_dt; - PD_dt = D_dt; - PS_val = S_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - - store2defaults(); -} - -void EnvelopeParams::ADSRinit_dB(char A_dt, char D_dt, char S_val, char R_dt) -{ - setpresettype("Penvamplitude"); - Envmode = 2; - PA_dt = A_dt; - PD_dt = D_dt; - PS_val = S_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - - store2defaults(); -} - -void EnvelopeParams::ASRinit(char A_val, char A_dt, char R_val, char R_dt) -{ - setpresettype("Penvfrequency"); - Envmode = 3; - PA_val = A_val; - PA_dt = A_dt; - PR_val = R_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - - store2defaults(); -} - -void EnvelopeParams::ADSRinit_filter(char A_val, - char A_dt, - char D_val, - char D_dt, - char R_dt, - char R_val) -{ - setpresettype("Penvfilter"); - Envmode = 4; - PA_val = A_val; - PA_dt = A_dt; - PD_val = D_val; - PD_dt = D_dt; - PR_dt = R_dt; - PR_val = R_val; - Pfreemode = 0; - converttofree(); - store2defaults(); -} - -void EnvelopeParams::ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt) -{ - setpresettype("Penvbandwidth"); - Envmode = 5; - PA_val = A_val; - PA_dt = A_dt; - PR_val = R_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - store2defaults(); -} - -/* - * Convert the Envelope to freemode - */ -void EnvelopeParams::converttofree() -{ - switch(Envmode) { - case 1: - Penvpoints = 4; - Penvsustain = 2; - Penvval[0] = 0; - Penvdt[1] = PA_dt; - Penvval[1] = 127; - Penvdt[2] = PD_dt; - Penvval[2] = PS_val; - Penvdt[3] = PR_dt; - Penvval[3] = 0; - break; - case 2: - Penvpoints = 4; - Penvsustain = 2; - Penvval[0] = 0; - Penvdt[1] = PA_dt; - Penvval[1] = 127; - Penvdt[2] = PD_dt; - Penvval[2] = PS_val; - Penvdt[3] = PR_dt; - Penvval[3] = 0; - break; - case 3: - Penvpoints = 3; - Penvsustain = 1; - Penvval[0] = PA_val; - Penvdt[1] = PA_dt; - Penvval[1] = 64; - Penvdt[2] = PR_dt; - Penvval[2] = PR_val; - break; - case 4: - Penvpoints = 4; - Penvsustain = 2; - Penvval[0] = PA_val; - Penvdt[1] = PA_dt; - Penvval[1] = PD_val; - Penvdt[2] = PD_dt; - Penvval[2] = 64; - Penvdt[3] = PR_dt; - Penvval[3] = PR_val; - break; - case 5: - Penvpoints = 3; - Penvsustain = 1; - Penvval[0] = PA_val; - Penvdt[1] = PA_dt; - Penvval[1] = 64; - Penvdt[2] = PR_dt; - Penvval[2] = PR_val; - break; - } -} - - - - -void EnvelopeParams::add2XML(XMLwrapper *xml) -{ - xml->addparbool("free_mode", Pfreemode); - xml->addpar("env_points", Penvpoints); - xml->addpar("env_sustain", Penvsustain); - xml->addpar("env_stretch", Penvstretch); - xml->addparbool("forced_release", Pforcedrelease); - xml->addparbool("linear_envelope", Plinearenvelope); - xml->addpar("A_dt", PA_dt); - xml->addpar("D_dt", PD_dt); - xml->addpar("R_dt", PR_dt); - xml->addpar("A_val", PA_val); - xml->addpar("D_val", PD_val); - xml->addpar("S_val", PS_val); - xml->addpar("R_val", PR_val); - - if((Pfreemode != 0) || (!xml->minimal)) { - for(int i = 0; i < Penvpoints; i++) { - xml->beginbranch("POINT", i); - if(i != 0) - xml->addpar("dt", Penvdt[i]); - xml->addpar("val", Penvval[i]); - xml->endbranch(); - } - } -} - - - -void EnvelopeParams::getfromXML(XMLwrapper *xml) -{ - Pfreemode = xml->getparbool("free_mode", Pfreemode); - Penvpoints = xml->getpar127("env_points", Penvpoints); - Penvsustain = xml->getpar127("env_sustain", Penvsustain); - Penvstretch = xml->getpar127("env_stretch", Penvstretch); - Pforcedrelease = xml->getparbool("forced_release", Pforcedrelease); - Plinearenvelope = xml->getparbool("linear_envelope", Plinearenvelope); - - PA_dt = xml->getpar127("A_dt", PA_dt); - PD_dt = xml->getpar127("D_dt", PD_dt); - PR_dt = xml->getpar127("R_dt", PR_dt); - PA_val = xml->getpar127("A_val", PA_val); - PD_val = xml->getpar127("D_val", PD_val); - PS_val = xml->getpar127("S_val", PS_val); - PR_val = xml->getpar127("R_val", PR_val); - - for(int i = 0; i < Penvpoints; i++) { - if(xml->enterbranch("POINT", i) == 0) - continue; - if(i != 0) - Penvdt[i] = xml->getpar127("dt", Penvdt[i]); - Penvval[i] = xml->getpar127("val", Penvval[i]); - xml->exitbranch(); - } - - if(!Pfreemode) - converttofree(); -} - - -void EnvelopeParams::defaults() -{ - Penvstretch = Denvstretch; - Pforcedrelease = Dforcedrelease; - Plinearenvelope = Dlinearenvelope; - PA_dt = DA_dt; - PD_dt = DD_dt; - PR_dt = DR_dt; - PA_val = DA_val; - PD_val = DD_val; - PS_val = DS_val; - PR_val = DR_val; - Pfreemode = 0; - converttofree(); -} - -void EnvelopeParams::store2defaults() -{ - Denvstretch = Penvstretch; - Dforcedrelease = Pforcedrelease; - Dlinearenvelope = Plinearenvelope; - DA_dt = PA_dt; - DD_dt = PD_dt; - DR_dt = PR_dt; - DA_val = PA_val; - DD_val = PD_val; - DS_val = PS_val; - DR_val = PR_val; -} - diff --git a/plugins/zynaddsubfx/src/Params/EnvelopeParams.h b/plugins/zynaddsubfx/src/Params/EnvelopeParams.h deleted file mode 100644 index 3a1c06aa0..000000000 --- a/plugins/zynaddsubfx/src/Params/EnvelopeParams.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EnvelopeParams.h - Parameters for Envelope - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ENVELOPE_PARAMS_H -#define ENVELOPE_PARAMS_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "Presets.h" - -#define MAX_ENVELOPE_POINTS 40 -#define MIN_ENVELOPE_DB -400 - -class EnvelopeParams:public Presets -{ - public: - EnvelopeParams(unsigned char Penvstretch_, - unsigned char Pforcedrelease_); - ~EnvelopeParams(); - void ADSRinit(char A_dt, char D_dt, char S_val, char R_dt); - void ADSRinit_dB(char A_dt, char D_dt, char S_val, char R_dt); - void ASRinit(char A_val, char A_dt, char R_val, char R_dt); - void ADSRinit_filter(char A_val, - char A_dt, - char D_val, - char D_dt, - char R_dt, - char R_val); - void ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt); - void converttofree(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - REALTYPE getdt(char i); - - /* MIDI Parameters */ - unsigned char Pfreemode; //1 daca este in modul free sau 0 daca este in mod ADSR,ASR,... - unsigned char Penvpoints; - unsigned char Penvsustain; //127 pentru dezactivat - unsigned char Penvdt[MAX_ENVELOPE_POINTS]; - unsigned char Penvval[MAX_ENVELOPE_POINTS]; - unsigned char Penvstretch; //64=normal stretch (piano-like), 0=no stretch - unsigned char Pforcedrelease; //0 - OFF, 1 - ON - unsigned char Plinearenvelope; //if the amplitude envelope is linear - - unsigned char PA_dt, PD_dt, PR_dt, - PA_val, PD_val, PS_val, PR_val; - - - - int Envmode; // 1 for ADSR parameters (linear amplitude) - // 2 for ADSR_dB parameters (dB amplitude) - // 3 for ASR parameters (frequency LFO) - // 4 for ADSR_filter parameters (filter parameters) - // 5 for ASR_bw parameters (bandwidth parameters) - - private: - void store2defaults(); - - /* Default parameters */ - unsigned char Denvstretch; - unsigned char Dforcedrelease; - unsigned char Dlinearenvelope; - unsigned char DA_dt, DD_dt, DR_dt, - DA_val, DD_val, DS_val, DR_val; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Params/FilterParams.cpp b/plugins/zynaddsubfx/src/Params/FilterParams.cpp deleted file mode 100644 index 6f87bc1a3..000000000 --- a/plugins/zynaddsubfx/src/Params/FilterParams.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FilterParams.cpp - Parameters for filter - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include "FilterParams.h" - -FilterParams::FilterParams(unsigned char Ptype_, - unsigned char Pfreq_, - unsigned char Pq_) - : PresetsArray() -{ - setpresettype("Pfilter"); - Dtype = Ptype_; - Dfreq = Pfreq_; - Dq = Pq_; - - changed = false; - defaults(); -} - -FilterParams::~FilterParams() -{} - - -void FilterParams::defaults() -{ - Ptype = Dtype; - Pfreq = Dfreq; - Pq = Dq; - - Pstages = 0; - Pfreqtrack = 64; - Pgain = 64; - Pcategory = 0; - - Pnumformants = 3; - Pformantslowness = 64; - for(int j = 0; j < FF_MAX_VOWELS; j++) - defaults(j); - ; - - Psequencesize = 3; - for(int i = 0; i < FF_MAX_SEQUENCE; i++) - Psequence[i].nvowel = i % FF_MAX_VOWELS; - - Psequencestretch = 40; - Psequencereversed = 0; - Pcenterfreq = 64; //1 kHz - Poctavesfreq = 64; - Pvowelclearness = 64; -} - -void FilterParams::defaults(int n) -{ - int j = n; - for(int i = 0; i < FF_MAX_FORMANTS; i++) { - Pvowels[j].formants[i].freq = (int)(RND * 127.0); //some random freqs - Pvowels[j].formants[i].q = 64; - Pvowels[j].formants[i].amp = 127; - } -} - - -/* - * Get the parameters from other FilterParams - */ - -void FilterParams::getfromFilterParams(FilterParams *pars) -{ - defaults(); - - if(pars == NULL) - return; - - Ptype = pars->Ptype; - Pfreq = pars->Pfreq; - Pq = pars->Pq; - - Pstages = pars->Pstages; - Pfreqtrack = pars->Pfreqtrack; - Pgain = pars->Pgain; - Pcategory = pars->Pcategory; - - Pnumformants = pars->Pnumformants; - Pformantslowness = pars->Pformantslowness; - for(int j = 0; j < FF_MAX_VOWELS; j++) { - for(int i = 0; i < FF_MAX_FORMANTS; i++) { - Pvowels[j].formants[i].freq = pars->Pvowels[j].formants[i].freq; - Pvowels[j].formants[i].q = pars->Pvowels[j].formants[i].q; - Pvowels[j].formants[i].amp = pars->Pvowels[j].formants[i].amp; - } - } - - Psequencesize = pars->Psequencesize; - for(int i = 0; i < FF_MAX_SEQUENCE; i++) - Psequence[i].nvowel = pars->Psequence[i].nvowel; - - Psequencestretch = pars->Psequencestretch; - Psequencereversed = pars->Psequencereversed; - Pcenterfreq = pars->Pcenterfreq; - Poctavesfreq = pars->Poctavesfreq; - Pvowelclearness = pars->Pvowelclearness; -} - - -/* - * Parameter control - */ -REALTYPE FilterParams::getfreq() -{ - return (Pfreq / 64.0 - 1.0) * 5.0; -} - -REALTYPE FilterParams::getq() -{ - return exp(pow((REALTYPE) Pq / 127.0, 2) * log(1000.0)) - 0.9; -} -REALTYPE FilterParams::getfreqtracking(REALTYPE notefreq) -{ - return log(notefreq / 440.0) * (Pfreqtrack - 64.0) / (64.0 * LOG_2); -} - -REALTYPE FilterParams::getgain() -{ - return (Pgain / 64.0 - 1.0) * 30.0; //-30..30dB -} - -/* - * Get the center frequency of the formant's graph - */ -REALTYPE FilterParams::getcenterfreq() -{ - return 10000.0 * pow(10, -(1.0 - Pcenterfreq / 127.0) * 2.0); -} - -/* - * Get the number of octave that the formant functions applies to - */ -REALTYPE FilterParams::getoctavesfreq() -{ - return 0.25 + 10.0 * Poctavesfreq / 127.0; -} - -/* - * Get the frequency from x, where x is [0..1] - */ -REALTYPE FilterParams::getfreqx(REALTYPE x) -{ - if(x > 1.0) - x = 1.0; - REALTYPE octf = pow(2.0, getoctavesfreq()); - return getcenterfreq() / sqrt(octf) * pow(octf, x); -} - -/* - * Get the x coordinate from frequency (used by the UI) - */ -REALTYPE FilterParams::getfreqpos(REALTYPE freq) -{ - return (log(freq) - log(getfreqx(0.0))) / log(2.0) / getoctavesfreq(); -} - - -/* - * Get the freq. response of the formant filter - */ -void FilterParams::formantfilterH(int nvowel, int nfreqs, REALTYPE *freqs) -{ - REALTYPE c[3], d[3]; - REALTYPE filter_freq, filter_q, filter_amp; - REALTYPE omega, sn, cs, alpha; - - for(int i = 0; i < nfreqs; i++) - freqs[i] = 0.0; - - //for each formant... - for(int nformant = 0; nformant < Pnumformants; nformant++) { - //compute formant parameters(frequency,amplitude,etc.) - filter_freq = getformantfreq(Pvowels[nvowel].formants[nformant].freq); - filter_q = getformantq(Pvowels[nvowel].formants[nformant].q) * getq(); - if(Pstages > 0) - filter_q = - (filter_q > 1.0 ? pow(filter_q, 1.0 / (Pstages + 1)) : filter_q); - - filter_amp = getformantamp(Pvowels[nvowel].formants[nformant].amp); - - - if(filter_freq <= (SAMPLE_RATE / 2 - 100.0)) { - omega = 2 * PI * filter_freq / SAMPLE_RATE; - sn = sin(omega); - cs = cos(omega); - alpha = sn / (2 * filter_q); - REALTYPE tmp = 1 + alpha; - c[0] = alpha / tmp *sqrt(filter_q + 1); - c[1] = 0; - c[2] = -alpha / tmp *sqrt(filter_q + 1); - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha) / tmp * (-1); - } - else - continue; - - - for(int i = 0; i < nfreqs; i++) { - REALTYPE freq = getfreqx(i / (REALTYPE) nfreqs); - if(freq > SAMPLE_RATE / 2) { - for(int tmp = i; tmp < nfreqs; tmp++) - freqs[tmp] = 0.0; - break; - } - REALTYPE fr = freq / SAMPLE_RATE * PI * 2.0; - REALTYPE x = c[0], y = 0.0; - for(int n = 1; n < 3; n++) { - x += cos(n * fr) * c[n]; - y -= sin(n * fr) * c[n]; - } - REALTYPE h = x * x + y * y; - x = 1.0; - y = 0.0; - for(int n = 1; n < 3; n++) { - x -= cos(n * fr) * d[n]; - y += sin(n * fr) * d[n]; - } - h = h / (x * x + y * y); - - freqs[i] += pow(h, (Pstages + 1.0) / 2.0) * filter_amp; - } - } - for(int i = 0; i < nfreqs; i++) { - if(freqs[i] > 0.000000001) - freqs[i] = rap2dB(freqs[i]) + getgain(); - else - freqs[i] = -90.0; - } -} - -/* - * Transforms a parameter to the real value - */ -REALTYPE FilterParams::getformantfreq(unsigned char freq) -{ - REALTYPE result = getfreqx(freq / 127.0); - return result; -} - -REALTYPE FilterParams::getformantamp(unsigned char amp) -{ - REALTYPE result = pow(0.1, (1.0 - amp / 127.0) * 4.0); - return result; -} - -REALTYPE FilterParams::getformantq(unsigned char q) -{ - //temp - REALTYPE result = pow(25.0, (q - 32.0) / 64.0); - return result; -} - - - -void FilterParams::add2XMLsection(XMLwrapper *xml, int n) -{ - int nvowel = n; - for(int nformant = 0; nformant < FF_MAX_FORMANTS; nformant++) { - xml->beginbranch("FORMANT", nformant); - xml->addpar("freq", Pvowels[nvowel].formants[nformant].freq); - xml->addpar("amp", Pvowels[nvowel].formants[nformant].amp); - xml->addpar("q", Pvowels[nvowel].formants[nformant].q); - xml->endbranch(); - } -} - -void FilterParams::add2XML(XMLwrapper *xml) -{ - //filter parameters - xml->addpar("category", Pcategory); - xml->addpar("type", Ptype); - xml->addpar("freq", Pfreq); - xml->addpar("q", Pq); - xml->addpar("stages", Pstages); - xml->addpar("freq_track", Pfreqtrack); - xml->addpar("gain", Pgain); - - //formant filter parameters - if((Pcategory == 1) || (!xml->minimal)) { - xml->beginbranch("FORMANT_FILTER"); - xml->addpar("num_formants", Pnumformants); - xml->addpar("formant_slowness", Pformantslowness); - xml->addpar("vowel_clearness", Pvowelclearness); - xml->addpar("center_freq", Pcenterfreq); - xml->addpar("octaves_freq", Poctavesfreq); - for(int nvowel = 0; nvowel < FF_MAX_VOWELS; nvowel++) { - xml->beginbranch("VOWEL", nvowel); - add2XMLsection(xml, nvowel); - xml->endbranch(); - } - xml->addpar("sequence_size", Psequencesize); - xml->addpar("sequence_stretch", Psequencestretch); - xml->addparbool("sequence_reversed", Psequencereversed); - for(int nseq = 0; nseq < FF_MAX_SEQUENCE; nseq++) { - xml->beginbranch("SEQUENCE_POS", nseq); - xml->addpar("vowel_id", Psequence[nseq].nvowel); - xml->endbranch(); - } - xml->endbranch(); - } -} - - -void FilterParams::getfromXMLsection(XMLwrapper *xml, int n) -{ - int nvowel = n; - for(int nformant = 0; nformant < FF_MAX_FORMANTS; nformant++) { - if(xml->enterbranch("FORMANT", nformant) == 0) - continue; - Pvowels[nvowel].formants[nformant].freq = xml->getpar127( - "freq", - Pvowels[nvowel - ].formants[nformant].freq); - Pvowels[nvowel].formants[nformant].amp = xml->getpar127( - "amp", - Pvowels[nvowel - ].formants[nformant].amp); - Pvowels[nvowel].formants[nformant].q = - xml->getpar127("q", Pvowels[nvowel].formants[nformant].q); - xml->exitbranch(); - } -} - -void FilterParams::getfromXML(XMLwrapper *xml) -{ - //filter parameters - Pcategory = xml->getpar127("category", Pcategory); - Ptype = xml->getpar127("type", Ptype); - Pfreq = xml->getpar127("freq", Pfreq); - Pq = xml->getpar127("q", Pq); - Pstages = xml->getpar127("stages", Pstages); - Pfreqtrack = xml->getpar127("freq_track", Pfreqtrack); - Pgain = xml->getpar127("gain", Pgain); - - //formant filter parameters - if(xml->enterbranch("FORMANT_FILTER")) { - Pnumformants = xml->getpar127("num_formants", Pnumformants); - Pformantslowness = xml->getpar127("formant_slowness", Pformantslowness); - Pvowelclearness = xml->getpar127("vowel_clearness", Pvowelclearness); - Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); - Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); - - for(int nvowel = 0; nvowel < FF_MAX_VOWELS; nvowel++) { - if(xml->enterbranch("VOWEL", nvowel) == 0) - continue; - getfromXMLsection(xml, nvowel); - xml->exitbranch(); - } - Psequencesize = xml->getpar127("sequence_size", Psequencesize); - Psequencestretch = xml->getpar127("sequence_stretch", Psequencestretch); - Psequencereversed = xml->getparbool("sequence_reversed", - Psequencereversed); - for(int nseq = 0; nseq < FF_MAX_SEQUENCE; nseq++) { - if(xml->enterbranch("SEQUENCE_POS", nseq) == 0) - continue; - Psequence[nseq].nvowel = xml->getpar("vowel_id", - Psequence[nseq].nvowel, - 0, - FF_MAX_VOWELS - 1); - xml->exitbranch(); - } - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Params/FilterParams.h b/plugins/zynaddsubfx/src/Params/FilterParams.h deleted file mode 100644 index 8facbe58c..000000000 --- a/plugins/zynaddsubfx/src/Params/FilterParams.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FilterParams.h - Parameters for filter - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FILTER_PARAMS_H -#define FILTER_PARAMS_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "PresetsArray.h" - -class FilterParams : public PresetsArray -{ - public: - FilterParams(unsigned char Ptype_, - unsigned char Pfreq, - unsigned char Pq_); - ~FilterParams(); - - void add2XML(XMLwrapper *xml); - void add2XMLsection(XMLwrapper *xml, int n); - void defaults(); - void getfromXML(XMLwrapper *xml); - void getfromXMLsection(XMLwrapper *xml, int n); - - - void getfromFilterParams(FilterParams *pars); - - REALTYPE getfreq(); - REALTYPE getq(); - REALTYPE getfreqtracking(REALTYPE notefreq); - REALTYPE getgain(); - - unsigned char Pcategory; //Filter category (Analog/Formant/StVar) - unsigned char Ptype; // Filter type (for analog lpf,hpf,bpf..) - unsigned char Pfreq; // Frequency (64-central frequency) - unsigned char Pq; // Q parameters (resonance or bandwidth) - unsigned char Pstages; //filter stages+1 - unsigned char Pfreqtrack; //how the filter frequency is changing according the note frequency - unsigned char Pgain; //filter's output gain - - //Formant filter parameters - unsigned char Pnumformants; //how many formants are used - unsigned char Pformantslowness; //how slow varies the formants - unsigned char Pvowelclearness; //how vowels are kept clean (how much try to avoid "mixed" vowels) - unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves - - struct { - struct { - unsigned char freq, amp, q; //frequency,amplitude,Q - } formants[FF_MAX_FORMANTS]; - } Pvowels[FF_MAX_VOWELS]; - - - unsigned char Psequencesize; //how many vowels are in the sequence - unsigned char Psequencestretch; //how the sequence is stretched (how the input from filter envelopes/LFOs/etc. is "stretched") - unsigned char Psequencereversed; //if the input from filter envelopes/LFOs/etc. is reversed(negated) - struct { - unsigned char nvowel; //the vowel from the position - } Psequence[FF_MAX_SEQUENCE]; - - REALTYPE getcenterfreq(); - REALTYPE getoctavesfreq(); - REALTYPE getfreqpos(REALTYPE freq); - REALTYPE getfreqx(REALTYPE x); - - void formantfilterH(int nvowel, int nfreqs, REALTYPE *freqs); //used by UI - - REALTYPE getformantfreq(unsigned char freq); - REALTYPE getformantamp(unsigned char amp); - REALTYPE getformantq(unsigned char q); - - bool changed; - - private: - void defaults(int n); - - //stored default parameters - unsigned char Dtype; - unsigned char Dfreq; - unsigned char Dq; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Params/LFOParams.cpp b/plugins/zynaddsubfx/src/Params/LFOParams.cpp deleted file mode 100644 index 33028defc..000000000 --- a/plugins/zynaddsubfx/src/Params/LFOParams.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFOParams.cpp - Parameters for LFO - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "../globals.h" -#include "LFOParams.h" - -int LFOParams::time; - -LFOParams::LFOParams(char Pfreq_, - char Pintensity_, - char Pstartphase_, - char PLFOtype_, - char Prandomness_, - char Pdelay_, - char Pcontinous_, - char fel_):Presets() -{ - switch(fel_) { - case 0: - setpresettype("Plfofrequency"); - break; - case 1: - setpresettype("Plfoamplitude"); - break; - case 2: - setpresettype("Plfofilter"); - break; - } - Dfreq = Pfreq_; - Dintensity = Pintensity_; - Dstartphase = Pstartphase_; - DLFOtype = PLFOtype_; - Drandomness = Prandomness_; - Ddelay = Pdelay_; - Dcontinous = Pcontinous_; - fel = fel_; - time = 0; - - defaults(); -} - -LFOParams::~LFOParams() -{} - -void LFOParams::defaults() -{ - Pfreq = Dfreq / 127.0; - Pintensity = Dintensity; - Pstartphase = Dstartphase; - PLFOtype = DLFOtype; - Prandomness = Drandomness; - Pdelay = Ddelay; - Pcontinous = Dcontinous; - Pfreqrand = 0; - Pstretch = 64; -} - - -void LFOParams::add2XML(XMLwrapper *xml) -{ - xml->addparreal("freq", Pfreq); - xml->addpar("intensity", Pintensity); - xml->addpar("start_phase", Pstartphase); - xml->addpar("lfo_type", PLFOtype); - xml->addpar("randomness_amplitude", Prandomness); - xml->addpar("randomness_frequency", Pfreqrand); - xml->addpar("delay", Pdelay); - xml->addpar("stretch", Pstretch); - xml->addparbool("continous", Pcontinous); -} - -void LFOParams::getfromXML(XMLwrapper *xml) -{ - Pfreq = xml->getparreal("freq", Pfreq, 0.0, 1.0); - Pintensity = xml->getpar127("intensity", Pintensity); - Pstartphase = xml->getpar127("start_phase", Pstartphase); - PLFOtype = xml->getpar127("lfo_type", PLFOtype); - Prandomness = xml->getpar127("randomness_amplitude", Prandomness); - Pfreqrand = xml->getpar127("randomness_frequency", Pfreqrand); - Pdelay = xml->getpar127("delay", Pdelay); - Pstretch = xml->getpar127("stretch", Pstretch); - Pcontinous = xml->getparbool("continous", Pcontinous); -} - diff --git a/plugins/zynaddsubfx/src/Params/LFOParams.h b/plugins/zynaddsubfx/src/Params/LFOParams.h deleted file mode 100644 index 6a7dcd915..000000000 --- a/plugins/zynaddsubfx/src/Params/LFOParams.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFOParams.h - Parameters for LFO - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef LFO_PARAMS_H -#define LFO_PARAMS_H - -#include "../Misc/XMLwrapper.h" -#include "Presets.h" - -class LFOParams:public Presets -{ - public: - LFOParams(char Pfreq_, - char Pintensity_, - char Pstartphase_, - char PLFOtype_, - char Prandomness_, - char Pdelay_, - char Pcontinous, - char fel_); - ~LFOParams(); - - void add2XML(XMLwrapper *xml); - void defaults(); - /**Loads the LFO from the xml*/ - void getfromXML(XMLwrapper *xml); - - /* MIDI Parameters*/ - REALTYPE Pfreq; /** -#include "PADnoteParameters.h" -#include "../Output/WAVaudiooutput.h" -using namespace std; - -PADnoteParameters::PADnoteParameters(FFTwrapper *fft_, - pthread_mutex_t *mutex_):Presets() -{ - setpresettype("Ppadsyth"); - - fft = fft_; - mutex = mutex_; - - resonance = new Resonance(); - oscilgen = new OscilGen(fft_, resonance); - oscilgen->ADvsPAD = true; - - FreqEnvelope = new EnvelopeParams(0, 0); - FreqEnvelope->ASRinit(64, 50, 64, 60); - FreqLfo = new LFOParams(70, 0, 64, 0, 0, 0, 0, 0); - - AmpEnvelope = new EnvelopeParams(64, 1); - AmpEnvelope->ADSRinit_dB(0, 40, 127, 25); - AmpLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 1); - - GlobalFilter = new FilterParams(2, 94, 40); - FilterEnvelope = new EnvelopeParams(0, 1); - FilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); - FilterLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 2); - - for(int i = 0; i < PAD_MAX_SAMPLES; i++) - sample[i].smp = NULL; - newsample.smp = NULL; - - defaults(); -} - -PADnoteParameters::~PADnoteParameters() -{ - deletesamples(); - delete (oscilgen); - delete (resonance); - - delete (FreqEnvelope); - delete (FreqLfo); - delete (AmpEnvelope); - delete (AmpLfo); - delete (GlobalFilter); - delete (FilterEnvelope); - delete (FilterLfo); -} - -void PADnoteParameters::defaults() -{ - Pmode = 0; - Php.base.type = 0; - Php.base.par1 = 80; - Php.freqmult = 0; - Php.modulator.par1 = 0; - Php.modulator.freq = 30; - Php.width = 127; - Php.amp.type = 0; - Php.amp.mode = 0; - Php.amp.par1 = 80; - Php.amp.par2 = 64; - Php.autoscale = true; - Php.onehalf = 0; - - setPbandwidth(500); - Pbwscale = 0; - - resonance->defaults(); - oscilgen->defaults(); - - Phrpos.type = 0; - Phrpos.par1 = 64; - Phrpos.par2 = 64; - Phrpos.par3 = 0; - - Pquality.samplesize = 3; - Pquality.basenote = 4; - Pquality.oct = 3; - Pquality.smpoct = 2; - - PStereo = 1; //stereo - /* Frequency Global Parameters */ - Pfixedfreq = 0; - PfixedfreqET = 0; - PDetune = 8192; //zero - PCoarseDetune = 0; - PDetuneType = 1; - FreqEnvelope->defaults(); - FreqLfo->defaults(); - - /* Amplitude Global Parameters */ - PVolume = 90; - PPanning = 64; //center - PAmpVelocityScaleFunction = 64; - AmpEnvelope->defaults(); - AmpLfo->defaults(); - PPunchStrength = 0; - PPunchTime = 60; - PPunchStretch = 64; - PPunchVelocitySensing = 72; - - /* Filter Global Parameters*/ - PFilterVelocityScale = 64; - PFilterVelocityScaleFunction = 64; - GlobalFilter->defaults(); - FilterEnvelope->defaults(); - FilterLfo->defaults(); - - deletesamples(); -} - -void PADnoteParameters::deletesample(int n) -{ - if((n < 0) || (n >= PAD_MAX_SAMPLES)) - return; - if(sample[n].smp != NULL) { - delete[] sample[n].smp; - sample[n].smp = NULL; - } - sample[n].size = 0; - sample[n].basefreq = 440.0; -} - -void PADnoteParameters::deletesamples() -{ - for(int i = 0; i < PAD_MAX_SAMPLES; i++) - deletesample(i); -} - -/* - * Get the harmonic profile (i.e. the frequency distributio of a single harmonic) - */ -REALTYPE PADnoteParameters::getprofile(REALTYPE *smp, int size) -{ - for(int i = 0; i < size; i++) - smp[i] = 0.0; - const int supersample = 16; - REALTYPE basepar = pow(2.0, (1.0 - Php.base.par1 / 127.0) * 12.0); - REALTYPE freqmult = floor(pow(2.0, - Php.freqmult / 127.0 * 5.0) + 0.000001); - - REALTYPE modfreq = floor(pow(2.0, - Php.modulator.freq / 127.0 - * 5.0) + 0.000001); - REALTYPE modpar1 = pow(Php.modulator.par1 / 127.0, 4.0) * 5.0 / sqrt( - modfreq); - REALTYPE amppar1 = - pow(2.0, pow(Php.amp.par1 / 127.0, 2.0) * 10.0) - 0.999; - REALTYPE amppar2 = (1.0 - Php.amp.par2 / 127.0) * 0.998 + 0.001; - REALTYPE width = pow(150.0 / (Php.width + 22.0), 2.0); - - for(int i = 0; i < size * supersample; i++) { - bool makezero = false; - REALTYPE x = i * 1.0 / (size * (REALTYPE) supersample); - - REALTYPE origx = x; - - //do the sizing (width) - x = (x - 0.5) * width + 0.5; - if(x < 0.0) { - x = 0.0; - makezero = true; - } - else { - if(x > 1.0) { - x = 1.0; - makezero = true; - } - } - - //compute the full profile or one half - switch(Php.onehalf) { - case 1: - x = x * 0.5 + 0.5; - break; - case 2: - x = x * 0.5; - break; - } - - REALTYPE x_before_freq_mult = x; - - //do the frequency multiplier - x *= freqmult; - - //do the modulation of the profile - x += sin(x_before_freq_mult * 3.1415926 * modfreq) * modpar1; - x = fmod(x + 1000.0, 1.0) * 2.0 - 1.0; - - - //this is the base function of the profile - REALTYPE f; - switch(Php.base.type) { - case 1: - f = exp(-(x * x) * basepar); - if(f < 0.4) - f = 0.0; - else - f = 1.0; - break; - case 2: - f = exp(-(fabs(x)) * sqrt(basepar)); - break; - default: - f = exp(-(x * x) * basepar); - break; - } - if(makezero) - f = 0.0; - - REALTYPE amp = 1.0; - origx = origx * 2.0 - 1.0; - - //compute the amplitude multiplier - switch(Php.amp.type) { - case 1: - amp = exp(-(origx * origx) * 10.0 * amppar1); - break; - case 2: - amp = 0.5 * (1.0 + cos(3.1415926 * origx * sqrt(amppar1 * 4.0 + 1.0))); - break; - case 3: - amp = 1.0 / (pow(origx * (amppar1 * 2.0 + 0.8), 14.0) + 1.0); - break; - } - - //apply the amplitude multiplier - REALTYPE finalsmp = f; - if(Php.amp.type != 0) - switch(Php.amp.mode) { - case 0: - finalsmp = amp * (1.0 - amppar2) + finalsmp * amppar2; - break; - case 1: - finalsmp *= amp * (1.0 - amppar2) + amppar2; - break; - case 2: - finalsmp = finalsmp / (amp + pow(amppar2, 4.0) * 20.0 + 0.0001); - break; - case 3: - finalsmp = amp / (finalsmp + pow(amppar2, 4.0) * 20.0 + 0.0001); - break; - } - ; - - smp[i / supersample] += finalsmp / supersample; - } - - //normalize the profile (make the max. to be equal to 1.0) - REALTYPE max = 0.0; - for(int i = 0; i < size; i++) { - if(smp[i] < 0.0) - smp[i] = 0.0; - if(smp[i] > max) - max = smp[i]; - } - if(max < 0.00001) - max = 1.0; - for(int i = 0; i < size; i++) - smp[i] /= max; - - if(!Php.autoscale) - return 0.5; - - //compute the estimated perceived bandwidth - REALTYPE sum = 0.0; - int i; - for(i = 0; i < size / 2 - 2; i++) { - sum += smp[i] * smp[i] + smp[size - i - 1] * smp[size - i - 1]; - if(sum >= 4.0) - break; - } - - REALTYPE result = 1.0 - 2.0 * i / (REALTYPE) size; - return result; -} - -/* - * Compute the real bandwidth in cents and returns it - * Also, sets the bandwidth parameter - */ -REALTYPE PADnoteParameters::setPbandwidth(int Pbandwidth) -{ - this->Pbandwidth = Pbandwidth; - REALTYPE result = pow(Pbandwidth / 1000.0, 1.1); - result = pow(10.0, result * 4.0) * 0.25; - return result; -} - -/* - * Get the harmonic(overtone) position - */ -REALTYPE PADnoteParameters::getNhr(int n) -{ - REALTYPE result = 1.0; - REALTYPE par1 = pow(10.0, -(1.0 - Phrpos.par1 / 255.0) * 3.0); - REALTYPE par2 = Phrpos.par2 / 255.0; - - REALTYPE n0 = n - 1.0; - REALTYPE tmp = 0.0; - int thresh = 0; - switch(Phrpos.type) { - case 1: - thresh = (int)(par2 * par2 * 100.0) + 1; - if(n < thresh) - result = n; - else - result = 1.0 + n0 + (n0 - thresh + 1.0) * par1 * 8.0; - break; - case 2: - thresh = (int)(par2 * par2 * 100.0) + 1; - if(n < thresh) - result = n; - else - result = 1.0 + n0 - (n0 - thresh + 1.0) * par1 * 0.90; - break; - case 3: - tmp = par1 * 100.0 + 1.0; - result = pow(n0 / tmp, 1.0 - par2 * 0.8) * tmp + 1.0; - break; - case 4: - result = n0 - * (1.0 - - par1) - + pow(n0 * 0.1, par2 * 3.0 + 1.0) * par1 * 10.0 + 1.0; - break; - case 5: - result = n0 - + sin(n0 * par2 * par2 * PI * 0.999) * sqrt(par1) * 2.0 + 1.0; - break; - case 6: - tmp = pow(par2 * 2.0, 2.0) + 0.1; - result = n0 * pow(1.0 + par1 * pow(n0 * 0.8, tmp), tmp) + 1.0; - break; - default: - result = n; - break; - } - - REALTYPE par3 = Phrpos.par3 / 255.0; - - REALTYPE iresult = floor(result + 0.5); - REALTYPE dresult = result - iresult; - - result = iresult + (1.0 - par3) * dresult; - - return result; -} - -/* - * Generates the long spectrum for Bandwidth mode (only amplitudes are generated; phases will be random) - */ -void PADnoteParameters::generatespectrum_bandwidthMode(REALTYPE *spectrum, - int size, - REALTYPE basefreq, - REALTYPE *profile, - int profilesize, - REALTYPE bwadjust) -{ - for(int i = 0; i < size; i++) - spectrum[i] = 0.0; - - REALTYPE harmonics[OSCIL_SIZE / 2]; - for(int i = 0; i < OSCIL_SIZE / 2; i++) - harmonics[i] = 0.0; - //get the harmonic structure from the oscillator (I am using the frequency amplitudes, only) - oscilgen->get(harmonics, basefreq, false); - - //normalize - REALTYPE max = 0.0; - for(int i = 0; i < OSCIL_SIZE / 2; i++) - if(harmonics[i] > max) - max = harmonics[i]; - if(max < 0.000001) - max = 1; - for(int i = 0; i < OSCIL_SIZE / 2; i++) - harmonics[i] /= max; - - for(int nh = 1; nh < OSCIL_SIZE / 2; nh++) { //for each harmonic - REALTYPE realfreq = getNhr(nh) * basefreq; - if(realfreq > SAMPLE_RATE * 0.49999) - break; - if(realfreq < 20.0) - break; - if(harmonics[nh - 1] < 1e-4) - continue; - - //compute the bandwidth of each harmonic - REALTYPE bandwidthcents = setPbandwidth(Pbandwidth); - REALTYPE bw = - (pow(2.0, bandwidthcents / 1200.0) - 1.0) * basefreq / bwadjust; - REALTYPE power = 1.0; - switch(Pbwscale) { - case 0: - power = 1.0; - break; - case 1: - power = 0.0; - break; - case 2: - power = 0.25; - break; - case 3: - power = 0.5; - break; - case 4: - power = 0.75; - break; - case 5: - power = 1.5; - break; - case 6: - power = 2.0; - break; - case 7: - power = -0.5; - break; - } - bw = bw * pow(realfreq / basefreq, power); - int ibw = (int)((bw / (SAMPLE_RATE * 0.5) * size)) + 1; - - REALTYPE amp = harmonics[nh - 1]; - if(resonance->Penabled) - amp *= resonance->getfreqresponse(realfreq); - - if(ibw > profilesize) { //if the bandwidth is larger than the profilesize - REALTYPE rap = sqrt((REALTYPE)profilesize / (REALTYPE)ibw); - int cfreq = - (int) (realfreq / (SAMPLE_RATE * 0.5) * size) - ibw / 2; - for(int i = 0; i < ibw; i++) { - int src = (int)(i * rap * rap); - int spfreq = i + cfreq; - if(spfreq < 0) - continue; - if(spfreq >= size) - break; - spectrum[spfreq] += amp * profile[src] * rap; - } - } - else { //if the bandwidth is smaller than the profilesize - REALTYPE rap = sqrt((REALTYPE)ibw / (REALTYPE)profilesize); - REALTYPE ibasefreq = realfreq / (SAMPLE_RATE * 0.5) * size; - for(int i = 0; i < profilesize; i++) { - REALTYPE idfreq = i / (REALTYPE)profilesize - 0.5; - idfreq *= ibw; - int spfreq = (int) (idfreq + ibasefreq); - REALTYPE fspfreq = fmod(idfreq + ibasefreq, 1.0); - if(spfreq <= 0) - continue; - if(spfreq >= size - 1) - break; - spectrum[spfreq] += amp * profile[i] * rap * (1.0 - fspfreq); - spectrum[spfreq + 1] += amp * profile[i] * rap * fspfreq; - } - } - } -} - -/* - * Generates the long spectrum for non-Bandwidth modes (only amplitudes are generated; phases will be random) - */ -void PADnoteParameters::generatespectrum_otherModes(REALTYPE *spectrum, - int size, - REALTYPE basefreq, - REALTYPE *profile, - int profilesize, - REALTYPE bwadjust) -{ - for(int i = 0; i < size; i++) - spectrum[i] = 0.0; - - REALTYPE harmonics[OSCIL_SIZE / 2]; - for(int i = 0; i < OSCIL_SIZE / 2; i++) - harmonics[i] = 0.0; - //get the harmonic structure from the oscillator (I am using the frequency amplitudes, only) - oscilgen->get(harmonics, basefreq, false); - - //normalize - REALTYPE max = 0.0; - for(int i = 0; i < OSCIL_SIZE / 2; i++) - if(harmonics[i] > max) - max = harmonics[i]; - if(max < 0.000001) - max = 1; - for(int i = 0; i < OSCIL_SIZE / 2; i++) - harmonics[i] /= max; - - for(int nh = 1; nh < OSCIL_SIZE / 2; nh++) { //for each harmonic - REALTYPE realfreq = getNhr(nh) * basefreq; - - ///sa fac aici interpolarea si sa am grija daca frecv descresc - - if(realfreq > SAMPLE_RATE * 0.49999) - break; - if(realfreq < 20.0) - break; -// if (harmonics[nh-1]<1e-4) continue; - - - REALTYPE amp = harmonics[nh - 1]; - if(resonance->Penabled) - amp *= resonance->getfreqresponse(realfreq); - int cfreq = (int) (realfreq / (SAMPLE_RATE * 0.5) * size); - - spectrum[cfreq] = amp + 1e-9; - } - - if(Pmode != 1) { - int old = 0; - for(int k = 1; k < size; k++) { - if((spectrum[k] > 1e-10) || (k == (size - 1))) { - int delta = k - old; - REALTYPE val1 = spectrum[old]; - REALTYPE val2 = spectrum[k]; - REALTYPE idelta = 1.0 / delta; - for(int i = 0; i < delta; i++) { - REALTYPE x = idelta * i; - spectrum[old + i] = val1 * (1.0 - x) + val2 * x; - } - old = k; - } - } - } -} - -/* - * Applies the parameters (i.e. computes all the samples, based on parameters); - */ -void PADnoteParameters::applyparameters(bool lockmutex) -{ - const int samplesize = (((int) 1) << (Pquality.samplesize + 14)); - int spectrumsize = samplesize / 2; - REALTYPE spectrum[spectrumsize]; - int profilesize = 512; - REALTYPE profile[profilesize]; - - - REALTYPE bwadjust = getprofile(profile, profilesize); -// for (int i=0;ifreqs2smps(fftfreqs, newsample.smp); //that's all; here is the only ifft for the whole sample; no windows are used ;-) - - - //normalize(rms) - REALTYPE rms = 0.0; - for(int i = 0; i < samplesize; i++) - rms += newsample.smp[i] * newsample.smp[i]; - rms = sqrt(rms); - if(rms < 0.000001) - rms = 1.0; - rms *= sqrt(262144.0 / samplesize); - for(int i = 0; i < samplesize; i++) - newsample.smp[i] *= 1.0 / rms * 50.0; - - //prepare extra samples used by the linear or cubic interpolation - for(int i = 0; i < extra_samples; i++) - newsample.smp[i + samplesize] = newsample.smp[i]; - - //replace the current sample with the new computed sample - if(lockmutex) { - pthread_mutex_lock(mutex); - deletesample(nsample); - sample[nsample].smp = newsample.smp; - sample[nsample].size = samplesize; - sample[nsample].basefreq = basefreq * basefreqadjust; - pthread_mutex_unlock(mutex); - } - else { - deletesample(nsample); - sample[nsample].smp = newsample.smp; - sample[nsample].size = samplesize; - sample[nsample].basefreq = basefreq * basefreqadjust; - } - newsample.smp = NULL; - } - delete (fft); - deleteFFTFREQS(&fftfreqs); - - //delete the additional samples that might exists and are not useful - if(lockmutex) { - pthread_mutex_lock(mutex); - for(int i = samplemax; i < PAD_MAX_SAMPLES; i++) - deletesample(i); - pthread_mutex_unlock(mutex); - } - else - for(int i = samplemax; i < PAD_MAX_SAMPLES; i++) - deletesample(i); - ; -} - -void PADnoteParameters::export2wav(string basefilename) -{ - applyparameters(true); - basefilename += "_PADsynth_"; - for(int k = 0; k < PAD_MAX_SAMPLES; k++) { - if(sample[k].smp == NULL) - continue; - char tmpstr[20]; - snprintf(tmpstr, 20, "_%02d", k + 1); - string filename = basefilename + string(tmpstr) + ".wav"; - WAVaudiooutput wav; - if(wav.newfile(filename, SAMPLE_RATE, 1)) { - int nsmps = sample[k].size; - short int *smps = new short int[nsmps]; - for(int i = 0; i < nsmps; i++) - smps[i] = (short int)(sample[k].smp[i] * 32767.0); - wav.write_mono_samples(nsmps, smps); - wav.close(); - } - } -} - - - -void PADnoteParameters::add2XML(XMLwrapper *xml) -{ - xml->setPadSynth(true); - - xml->addparbool("stereo", PStereo); - xml->addpar("mode", Pmode); - xml->addpar("bandwidth", Pbandwidth); - xml->addpar("bandwidth_scale", Pbwscale); - - xml->beginbranch("HARMONIC_PROFILE"); - xml->addpar("base_type", Php.base.type); - xml->addpar("base_par1", Php.base.par1); - xml->addpar("frequency_multiplier", Php.freqmult); - xml->addpar("modulator_par1", Php.modulator.par1); - xml->addpar("modulator_frequency", Php.modulator.freq); - xml->addpar("width", Php.width); - xml->addpar("amplitude_multiplier_type", Php.amp.type); - xml->addpar("amplitude_multiplier_mode", Php.amp.mode); - xml->addpar("amplitude_multiplier_par1", Php.amp.par1); - xml->addpar("amplitude_multiplier_par2", Php.amp.par2); - xml->addparbool("autoscale", Php.autoscale); - xml->addpar("one_half", Php.onehalf); - xml->endbranch(); - - xml->beginbranch("OSCIL"); - oscilgen->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("RESONANCE"); - resonance->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("HARMONIC_POSITION"); - xml->addpar("type", Phrpos.type); - xml->addpar("parameter1", Phrpos.par1); - xml->addpar("parameter2", Phrpos.par2); - xml->addpar("parameter3", Phrpos.par3); - xml->endbranch(); - - xml->beginbranch("SAMPLE_QUALITY"); - xml->addpar("samplesize", Pquality.samplesize); - xml->addpar("basenote", Pquality.basenote); - xml->addpar("octaves", Pquality.oct); - xml->addpar("samples_per_octave", Pquality.smpoct); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->addpar("punch_strength", PPunchStrength); - xml->addpar("punch_time", PPunchTime); - xml->addpar("punch_stretch", PPunchStretch); - xml->addpar("punch_velocity_sensing", PPunchVelocitySensing); - - xml->beginbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_LFO"); - AmpLfo->add2XML(xml); - xml->endbranch(); - - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addpar("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); - - xml->beginbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_LFO"); - FreqLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); - xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); - - xml->beginbranch("FILTER"); - GlobalFilter->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_ENVELOPE"); - FilterEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_LFO"); - FilterLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); -} - -void PADnoteParameters::getfromXML(XMLwrapper *xml) -{ - PStereo = xml->getparbool("stereo", PStereo); - Pmode = xml->getpar127("mode", 0); - Pbandwidth = xml->getpar("bandwidth", Pbandwidth, 0, 1000); - Pbwscale = xml->getpar127("bandwidth_scale", Pbwscale); - - if(xml->enterbranch("HARMONIC_PROFILE")) { - Php.base.type = xml->getpar127("base_type", Php.base.type); - Php.base.par1 = xml->getpar127("base_par1", Php.base.par1); - Php.freqmult = xml->getpar127("frequency_multiplier", - Php.freqmult); - Php.modulator.par1 = xml->getpar127("modulator_par1", - Php.modulator.par1); - Php.modulator.freq = xml->getpar127("modulator_frequency", - Php.modulator.freq); - Php.width = xml->getpar127("width", Php.width); - Php.amp.type = xml->getpar127("amplitude_multiplier_type", - Php.amp.type); - Php.amp.mode = xml->getpar127("amplitude_multiplier_mode", - Php.amp.mode); - Php.amp.par1 = xml->getpar127("amplitude_multiplier_par1", - Php.amp.par1); - Php.amp.par2 = xml->getpar127("amplitude_multiplier_par2", - Php.amp.par2); - Php.autoscale = xml->getparbool("autoscale", Php.autoscale); - Php.onehalf = xml->getpar127("one_half", Php.onehalf); - xml->exitbranch(); - } - - if(xml->enterbranch("OSCIL")) { - oscilgen->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("RESONANCE")) { - resonance->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("HARMONIC_POSITION")) { - Phrpos.type = xml->getpar127("type", Phrpos.type); - Phrpos.par1 = xml->getpar("parameter1", Phrpos.par1, 0, 255); - Phrpos.par2 = xml->getpar("parameter2", Phrpos.par2, 0, 255); - Phrpos.par3 = xml->getpar("parameter3", Phrpos.par3, 0, 255); - xml->exitbranch(); - } - - if(xml->enterbranch("SAMPLE_QUALITY")) { - Pquality.samplesize = xml->getpar127("samplesize", Pquality.samplesize); - Pquality.basenote = xml->getpar127("basenote", Pquality.basenote); - Pquality.oct = xml->getpar127("octaves", Pquality.oct); - Pquality.smpoct = xml->getpar127("samples_per_octave", - Pquality.smpoct); - xml->exitbranch(); - } - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", - PAmpVelocityScaleFunction); - PPunchStrength = xml->getpar127("punch_strength", PPunchStrength); - PPunchTime = xml->getpar127("punch_time", PPunchTime); - PPunchStretch = xml->getpar127("punch_stretch", PPunchStretch); - PPunchVelocitySensing = xml->getpar127("punch_velocity_sensing", - PPunchVelocitySensing); - - xml->enterbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("AMPLITUDE_LFO"); - AmpLfo->getfromXML(xml); - xml->exitbranch(); - - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getpar127("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - - xml->enterbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FREQUENCY_LFO"); - FreqLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); - } - - if(xml->enterbranch("FILTER_PARAMETERS")) { - PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", - PFilterVelocityScale); - PFilterVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - PFilterVelocityScaleFunction); - - xml->enterbranch("FILTER"); - GlobalFilter->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_ENVELOPE"); - FilterEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_LFO"); - FilterLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Params/PADnoteParameters.h b/plugins/zynaddsubfx/src/Params/PADnoteParameters.h deleted file mode 100644 index 37d598529..000000000 --- a/plugins/zynaddsubfx/src/Params/PADnoteParameters.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PADnoteParameters.h - Parameters for PADnote (PADsynth) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PAD_NOTE_PARAMETERS_H -#define PAD_NOTE_PARAMETERS_H - -#include "../Misc/XMLwrapper.h" -#include "../DSP/FFTwrapper.h" -#include "../globals.h" -#include "../Synth/OscilGen.h" -#include "../Synth/Resonance.h" -#include "../Misc/Util.h" - -#include "EnvelopeParams.h" -#include "LFOParams.h" -#include "FilterParams.h" -#include "Presets.h" -#include -#include - -class PADnoteParameters:public Presets -{ - public: - PADnoteParameters(FFTwrapper *fft_, pthread_mutex_t *mutex_); - ~PADnoteParameters(); - - void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); - - //returns a value between 0.0-1.0 that represents the estimation perceived bandwidth - REALTYPE getprofile(REALTYPE *smp, int size); - - //parameters - - //the mode: 0 - bandwidth, 1 - discrete (bandwidth=0), 2 - continous - //the harmonic profile is used only on mode 0 - unsigned char Pmode; - - //Harmonic profile (the frequency distribution of a single harmonic) - struct { - struct { //base function - unsigned char type; - unsigned char par1; - } base; - unsigned char freqmult; //frequency multiplier of the distribution - struct { //the modulator of the distribution - unsigned char par1; - unsigned char freq; - } modulator; - - unsigned char width; //the width of the resulting function after the modulation - struct { //the amplitude multiplier of the harmonic profile - unsigned char mode; - unsigned char type; - unsigned char par1; - unsigned char par2; - } amp; - bool autoscale; //if the scale of the harmonic profile is computed automaticaly - unsigned char onehalf; //what part of the base function is used to make the distribution - } Php; - - - unsigned int Pbandwidth; //the values are from 0 to 1000 - unsigned char Pbwscale; //how the bandwidth is increased according to the harmonic's frequency - - struct { //where are positioned the harmonics (on integer multimplier or different places) - unsigned char type; - unsigned char par1, par2, par3; //0..255 - } Phrpos; - - struct { //quality of the samples (how many samples, the length of them,etc.) - unsigned char samplesize; - unsigned char basenote, oct, smpoct; - } Pquality; - - //frequency parameters - //If the base frequency is fixed to 440 Hz - unsigned char Pfixedfreq; - - /* Equal temperate (this is used only if the Pfixedfreq is enabled) - If this parameter is 0, the frequency is fixed (to 440 Hz); - if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ - unsigned char PfixedfreqET; - unsigned short int PDetune; //fine detune - unsigned short int PCoarseDetune; //coarse detune+octave - unsigned char PDetuneType; //detune type - - EnvelopeParams *FreqEnvelope; //Frequency Envelope - LFOParams *FreqLfo; //Frequency LFO - - //Amplitude parameters - unsigned char PStereo; - /* Panning - 0 - random - 1 - left - 64 - center - 127 - right */ - unsigned char PPanning; - - unsigned char PVolume; - - unsigned char PAmpVelocityScaleFunction; - - EnvelopeParams *AmpEnvelope; - - LFOParams *AmpLfo; - - unsigned char PPunchStrength, PPunchTime, PPunchStretch, - PPunchVelocitySensing; - - //Filter Parameters - FilterParams *GlobalFilter; - - // filter velocity sensing - unsigned char PFilterVelocityScale; - - // filter velocity sensing - unsigned char PFilterVelocityScaleFunction; - - EnvelopeParams *FilterEnvelope; - LFOParams *FilterLfo; - - - - - REALTYPE setPbandwidth(int Pbandwidth); //returns the BandWidth in cents - REALTYPE getNhr(int n); //gets the n-th overtone position relatively to N harmonic - - void applyparameters(bool lockmutex); - void export2wav(std::string basefilename); - - OscilGen *oscilgen; - Resonance *resonance; - - struct { - int size; - REALTYPE basefreq; - REALTYPE *smp; - } sample[PAD_MAX_SAMPLES], newsample; - - private: - void generatespectrum_bandwidthMode(REALTYPE *spectrum, - int size, - REALTYPE basefreq, - REALTYPE *profile, - int profilesize, - REALTYPE bwadjust); - void generatespectrum_otherModes(REALTYPE *spectrum, - int size, - REALTYPE basefreq, - REALTYPE *profile, - int profilesize, - REALTYPE bwadjust); - void deletesamples(); - void deletesample(int n); - - FFTwrapper *fft; - pthread_mutex_t *mutex; -}; - - - -#endif - diff --git a/plugins/zynaddsubfx/src/Params/Presets.cpp b/plugins/zynaddsubfx/src/Params/Presets.cpp deleted file mode 100644 index 228964aac..000000000 --- a/plugins/zynaddsubfx/src/Params/Presets.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Presets.cpp - Presets and Clipboard management - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Presets.h" -#include - - -Presets::Presets() -{ - type[0] = 0; -} - -Presets::~Presets() -{} - -void Presets::setpresettype(const char *type) -{ - strcpy(this->type, type); -} - -void Presets::copy(const char *name) -{ - XMLwrapper *xml = new XMLwrapper(); - - //used only for the clipboard - if(name == NULL) - xml->minimal = false; - - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - //strcat(type, "n"); - if(name == NULL) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - - xml->beginbranch(type); - add2XML(xml); - xml->endbranch(); - - if(name == NULL) - presetsstore.copyclipboard(xml, type); - else - presetsstore.copypreset(xml, type, name); - - delete (xml); -} - -void Presets::paste(int npreset) -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - //strcat(type, "n"); - - if(npreset == 0) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - - XMLwrapper *xml = new XMLwrapper(); - if(npreset == 0) { - if(!checkclipboardtype()) { - delete (xml); - return; - } - if(!presetsstore.pasteclipboard(xml)) { - delete (xml); - return; - } - } - else { - if(!presetsstore.pastepreset(xml, npreset)) { - delete (xml); - return; - } - } - - if(xml->enterbranch(type) == 0) { - return; - } - - defaults(); - getfromXML(xml); - - xml->exitbranch(); - - delete (xml); -} - -bool Presets::checkclipboardtype() -{ - return presetsstore.checkclipboardtype(type); -} - -void Presets::rescanforpresets() -{ - presetsstore.rescanforpresets(type); -} - - -void Presets::deletepreset(int npreset) -{ - presetsstore.deletepreset(npreset); -} - diff --git a/plugins/zynaddsubfx/src/Params/Presets.h b/plugins/zynaddsubfx/src/Params/Presets.h deleted file mode 100644 index d8000fe3b..000000000 --- a/plugins/zynaddsubfx/src/Params/Presets.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Presets.h - Presets and Clipboard management - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PRESETS_H -#define PRESETS_H - -#include "../Misc/XMLwrapper.h" - -#include "PresetsStore.h" - -/**Presets and Clipboard management*/ -class Presets -{ - friend class PresetsArray; - public: - Presets(); - virtual ~Presets(); - - virtual void copy(const char *name); /** - - -PresetsArray::PresetsArray() -{ - type[0] = 0; - nelement = -1; -} - -PresetsArray::~PresetsArray() -{} - -void PresetsArray::setpresettype(const char *type) -{ - strcpy(this->type, type); -} - -void PresetsArray::copy(const char *name) -{ - XMLwrapper *xml = new XMLwrapper(); - - //used only for the clipboard - if(name == NULL) - xml->minimal = false; - - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - if(name == NULL) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - ; - - xml->beginbranch(type); - if(nelement == -1) - add2XML(xml); - else - add2XMLsection(xml, nelement); - xml->endbranch(); - - if(name == NULL) - presetsstore.copyclipboard(xml, type); - else - presetsstore.copypreset(xml, type, name); - - delete (xml); - nelement = -1; -} - -void PresetsArray::paste(int npreset) -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - if(npreset == 0) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - ; - - XMLwrapper *xml = new XMLwrapper(); - if(npreset == 0) { - if(!checkclipboardtype()) { - nelement = -1; - delete (xml); - return; - } - if(!presetsstore.pasteclipboard(xml)) { - delete (xml); - nelement = -1; - return; - } - } - else { - if(!presetsstore.pastepreset(xml, npreset)) { - delete (xml); - nelement = -1; - return; - } - } - - if(xml->enterbranch(type) == 0) { - nelement = -1; - return; - } - if(nelement == -1) { - defaults(); - getfromXML(xml); - } - else { - defaults(nelement); - getfromXMLsection(xml, nelement); - } - xml->exitbranch(); - - delete (xml); - nelement = -1; -} - -bool PresetsArray::checkclipboardtype() -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - - return presetsstore.checkclipboardtype(type); -} - -void PresetsArray::setelement(int n) -{ - nelement = n; -} - diff --git a/plugins/zynaddsubfx/src/Params/PresetsArray.h b/plugins/zynaddsubfx/src/Params/PresetsArray.h deleted file mode 100644 index aea7ed362..000000000 --- a/plugins/zynaddsubfx/src/Params/PresetsArray.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PresetsArray.h - PresetsArray and Clipboard management - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PRESETSARRAY_H -#define PRESETSARRAY_H - -#include "../Misc/XMLwrapper.h" - -#include "Presets.h" - -/**PresetsArray and Clipboard management*/ -class PresetsArray : public Presets -{ - public: - PresetsArray(); - virtual ~PresetsArray(); - - void copy(const char *name); /** -#include -#include -#include -#include -#include -#include - -#include "PresetsStore.h" -#include "../Misc/Util.h" - -using namespace std; - -PresetsStore presetsstore; - -PresetsStore::PresetsStore() -{ - clipboard.data = NULL; - clipboard.type[0] = 0; -} - -PresetsStore::~PresetsStore() -{ - if(clipboard.data != NULL) - free(clipboard.data); - clearpresets(); -} - -//Clipboard management - -void PresetsStore::copyclipboard(XMLwrapper *xml, char *type) -{ - strcpy(clipboard.type, type); - if(clipboard.data != NULL) - free(clipboard.data); - clipboard.data = xml->getXMLdata(); -} - -bool PresetsStore::pasteclipboard(XMLwrapper *xml) -{ - if(clipboard.data != NULL) - xml->putXMLdata(clipboard.data); - else - return false; - return true; -} - -bool PresetsStore::checkclipboardtype(const char *type) -{ - //makes LFO's compatible - if((strstr(type, - "Plfo") != NULL) && (strstr(clipboard.type, "Plfo") != NULL)) - return true; - return strcmp(type, clipboard.type) == 0; -} - -//Presets management -void PresetsStore::clearpresets() -{ - presets.clear(); -} - -//a helper function that compares 2 presets[] -bool PresetsStore::presetstruct::operator<(const presetstruct &b) const -{ - return name < b.name; -} - - -void PresetsStore::rescanforpresets(const string &type) -{ - //std::cout << "Scanning For Presets" << std::endl; - //std::cout << "Of Type: " << type << std::endl; - - clearpresets(); - string ftype = "." + type + ".xpz"; - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { - if(config.cfg.presetsDirList[i] == NULL) - continue; - - //open directory - string dirname = config.cfg.presetsDirList[i]; - DIR *dir = opendir(dirname.c_str()); - if(dir == NULL) - continue; - struct dirent *fn; - - //check all files in directory - while((fn = readdir(dir))) { - string filename = fn->d_name; - if(filename.find(ftype) == string::npos) - continue; - - //ensure proper path is formed - char tmpc = dirname[dirname.size() - 1]; - const char *tmps; - if((tmpc == '/') || (tmpc == '\\')) - tmps = ""; - else - tmps = "/"; - - string location = "" + dirname + tmps + filename; - - //trim file type off of name - string name = filename.substr(0, filename.find(ftype)); - - //put on list - presets.push_back(presetstruct(location, name)); - } - - closedir(dir); - } - - //sort the presets - sort(presets.begin(), presets.end()); -} - - -void PresetsStore::copypreset(XMLwrapper *xml, char *type, string name) -{ - if(config.cfg.presetsDirList[0] == NULL) - return; - - //make the filenames legal - for(int i = 0; i < (int) name.size(); i++) { - char c = name[i]; - if(!(isdigit(c) || isalpha(c) || (c == '-') || (c == ' '))) - name[i] = '_'; - } - - //make path legal - const string dirname = config.cfg.presetsDirList[0]; - char tmpc = dirname[dirname.size() - 1]; - const char *tmps; - if((tmpc == '/') || (tmpc == '\\')) - tmps = ""; - else - tmps = "/"; - - string filename("" + dirname + tmps + name + type); - - xml->saveXMLfile(filename); -} - -bool PresetsStore::pastepreset(XMLwrapper *xml, int npreset) -{ - npreset--; - if(npreset < 0) - return false; - unsigned int unsigned_npreset = npreset; - if(unsigned_npreset >= presets.size()) - return false; - string filename = presets[unsigned_npreset].file; - if(filename.empty()) - return false; - bool result = (xml->loadXMLfile(filename) >= 0); - return result; -} - -void PresetsStore::deletepreset(int npreset) -{ - npreset--; - if(npreset < 0) - return; - unsigned int unsigned_npreset = npreset; - if(unsigned_npreset >= presets.size()) - return; - string filename = presets[unsigned_npreset].file; - if(filename.empty()) - return; - remove(filename.c_str()); -} - diff --git a/plugins/zynaddsubfx/src/Params/PresetsStore.h b/plugins/zynaddsubfx/src/Params/PresetsStore.h deleted file mode 100644 index 08437956e..000000000 --- a/plugins/zynaddsubfx/src/Params/PresetsStore.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PresetsStore.cpp - Presets and Clipboard store - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "../Misc/XMLwrapper.h" -#include "../Misc/Config.h" - -#define MAX_PRESETTYPE_SIZE 30 - -class PresetsStore -{ - public: - PresetsStore(); - ~PresetsStore(); - - //Clipboard stuff - void copyclipboard(XMLwrapper *xml, char *type); - bool pasteclipboard(XMLwrapper *xml); - bool checkclipboardtype(const char *type); - - //presets stuff - void copypreset(XMLwrapper *xml, char *type, std::string name); - bool pastepreset(XMLwrapper *xml, int npreset); - void deletepreset(int npreset); - - struct presetstruct { - presetstruct(std::string _file, std::string _name) - :file(_file),name(_name){}; - bool operator<(const presetstruct &b) const; - std::string file; - std::string name; - }; - std::vector presets; - - void rescanforpresets(const std::string &type); - - private: - struct { - char *data; - char type[MAX_PRESETTYPE_SIZE]; - } clipboard; - - void clearpresets(); -}; - -extern PresetsStore presetsstore; - diff --git a/plugins/zynaddsubfx/src/Params/SUBnoteParameters.cpp b/plugins/zynaddsubfx/src/Params/SUBnoteParameters.cpp deleted file mode 100644 index 425ddad75..000000000 --- a/plugins/zynaddsubfx/src/Params/SUBnoteParameters.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnoteParameters.cpp - Parameters for SUBnote (SUBsynth) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "../globals.h" -#include "SUBnoteParameters.h" -#include - -SUBnoteParameters::SUBnoteParameters():Presets() -{ - setpresettype("Psubsyth"); - AmpEnvelope = new EnvelopeParams(64, 1); - AmpEnvelope->ADSRinit_dB(0, 40, 127, 25); - FreqEnvelope = new EnvelopeParams(64, 0); - FreqEnvelope->ASRinit(30, 50, 64, 60); - BandWidthEnvelope = new EnvelopeParams(64, 0); - BandWidthEnvelope->ASRinit_bw(100, 70, 64, 60); - - GlobalFilter = new FilterParams(2, 80, 40); - GlobalFilterEnvelope = new EnvelopeParams(0, 1); - GlobalFilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); - - defaults(); -} - - -void SUBnoteParameters::defaults() -{ - PVolume = 96; - PPanning = 64; - PAmpVelocityScaleFunction = 90; - - Pfixedfreq = 0; - PfixedfreqET = 0; - Pnumstages = 2; - Pbandwidth = 40; - Phmagtype = 0; - Pbwscale = 64; - Pstereo = 1; - Pstart = 1; - - PDetune = 8192; - PCoarseDetune = 0; - PDetuneType = 1; - PFreqEnvelopeEnabled = 0; - PBandWidthEnvelopeEnabled = 0; - - for(int n = 0; n < MAX_SUB_HARMONICS; n++) { - Phmag[n] = 0; - Phrelbw[n] = 64; - } - Phmag[0] = 127; - - PGlobalFilterEnabled = 0; - PGlobalFilterVelocityScale = 64; - PGlobalFilterVelocityScaleFunction = 64; - - AmpEnvelope->defaults(); - FreqEnvelope->defaults(); - BandWidthEnvelope->defaults(); - GlobalFilter->defaults(); - GlobalFilterEnvelope->defaults(); -} - - - -SUBnoteParameters::~SUBnoteParameters() -{ - delete (AmpEnvelope); - delete (FreqEnvelope); - delete (BandWidthEnvelope); - delete (GlobalFilter); - delete (GlobalFilterEnvelope); -} - - - - -void SUBnoteParameters::add2XML(XMLwrapper *xml) -{ - xml->addpar("num_stages", Pnumstages); - xml->addpar("harmonic_mag_type", Phmagtype); - xml->addpar("start", Pstart); - - xml->beginbranch("HARMONICS"); - for(int i = 0; i < MAX_SUB_HARMONICS; i++) { - if((Phmag[i] == 0) && (xml->minimal)) - continue; - xml->beginbranch("HARMONIC", i); - xml->addpar("mag", Phmag[i]); - xml->addpar("relbw", Phrelbw[i]); - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addparbool("stereo", Pstereo); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->beginbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addparbool("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); - - xml->addpar("bandwidth", Pbandwidth); - xml->addpar("bandwidth_scale", Pbwscale); - - xml->addparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); - if((PFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("band_width_envelope_enabled", PBandWidthEnvelopeEnabled); - if((PBandWidthEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("BANDWIDTH_ENVELOPE"); - BandWidthEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("FILTER_PARAMETERS"); - xml->addparbool("enabled", PGlobalFilterEnabled); - if((PGlobalFilterEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER"); - GlobalFilter->add2XML(xml); - xml->endbranch(); - - xml->addpar("filter_velocity_sensing", - PGlobalFilterVelocityScaleFunction); - xml->addpar("filter_velocity_sensing_amplitude", - PGlobalFilterVelocityScale); - - xml->beginbranch("FILTER_ENVELOPE"); - GlobalFilterEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); -} - -void SUBnoteParameters::getfromXML(XMLwrapper *xml) -{ - Pnumstages = xml->getpar127("num_stages", Pnumstages); - Phmagtype = xml->getpar127("harmonic_mag_type", Phmagtype); - Pstart = xml->getpar127("start", Pstart); - - if(xml->enterbranch("HARMONICS")) { - Phmag[0] = 0; - for(int i = 0; i < MAX_SUB_HARMONICS; i++) { - if(xml->enterbranch("HARMONIC", i) == 0) - continue; - Phmag[i] = xml->getpar127("mag", Phmag[i]); - Phrelbw[i] = xml->getpar127("relbw", Phrelbw[i]); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - Pstereo = xml->getparbool("stereo", Pstereo); - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", - PAmpVelocityScaleFunction); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getparbool("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - - Pbandwidth = xml->getpar127("bandwidth", Pbandwidth); - Pbwscale = xml->getpar127("bandwidth_scale", Pbwscale); - - PFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", - PFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { - FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - PBandWidthEnvelopeEnabled = xml->getparbool( - "band_width_envelope_enabled", - PBandWidthEnvelopeEnabled); - if(xml->enterbranch("BANDWIDTH_ENVELOPE")) { - BandWidthEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - - if(xml->enterbranch("FILTER_PARAMETERS")) { - PGlobalFilterEnabled = xml->getparbool("enabled", PGlobalFilterEnabled); - if(xml->enterbranch("FILTER")) { - GlobalFilter->getfromXML(xml); - xml->exitbranch(); - } - - PGlobalFilterVelocityScaleFunction = xml->getpar127( - "filter_velocity_sensing", - PGlobalFilterVelocityScaleFunction); - PGlobalFilterVelocityScale = xml->getpar127( - "filter_velocity_sensing_amplitude", - PGlobalFilterVelocityScale); - - if(xml->enterbranch("FILTER_ENVELOPE")) { - GlobalFilterEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Params/SUBnoteParameters.h b/plugins/zynaddsubfx/src/Params/SUBnoteParameters.h deleted file mode 100644 index 57bc08004..000000000 --- a/plugins/zynaddsubfx/src/Params/SUBnoteParameters.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnoteParameters.h - Parameters for SUBnote (SUBsynth) - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef SUB_NOTE_PARAMETERS_H -#define SUB_NOTE_PARAMETERS_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "EnvelopeParams.h" -#include "FilterParams.h" -#include "Presets.h" - -class SUBnoteParameters:public Presets -{ - public: - SUBnoteParameters(); - ~SUBnoteParameters(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - //Parameters - //AMPLITUDE PARAMETRERS - unsigned char Pstereo; //0 for mono,1 for stereo - unsigned char PVolume; - unsigned char PPanning; - unsigned char PAmpVelocityScaleFunction; - EnvelopeParams *AmpEnvelope; - - //Frequency Parameters - unsigned short int PDetune; - unsigned short int PCoarseDetune; - unsigned char PDetuneType; - unsigned char PFreqEnvelopeEnabled; - EnvelopeParams *FreqEnvelope; - unsigned char PBandWidthEnvelopeEnabled; - EnvelopeParams *BandWidthEnvelope; - - //Filter Parameters (Global) - unsigned char PGlobalFilterEnabled; - FilterParams *GlobalFilter; - unsigned char PGlobalFilterVelocityScale; - unsigned char PGlobalFilterVelocityScaleFunction; - EnvelopeParams *GlobalFilterEnvelope; - - - //Other Parameters - - //If the base frequency is fixed to 440 Hz - unsigned char Pfixedfreq; - - /* Equal temperate (this is used only if the Pfixedfreq is enabled) - If this parameter is 0, the frequency is fixed (to 440 Hz); - if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ - unsigned char PfixedfreqET; - - - //how many times the filters are applied - unsigned char Pnumstages; - - //bandwidth - unsigned char Pbandwidth; - - //How the magnitudes are computed (0=linear,1=-60dB,2=-60dB) - unsigned char Phmagtype; - - //Magnitudes - unsigned char Phmag[MAX_SUB_HARMONICS]; - - //Relative BandWidth ("64"=1.0) - unsigned char Phrelbw[MAX_SUB_HARMONICS]; - - //how much the bandwidth is increased according to lower/higher frequency; 64-default - unsigned char Pbwscale; - - //how the harmonics start("0"=0,"1"=random,"2"=1) - unsigned char Pstart; - - - private: -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Samples/CMakeLists.txt b/plugins/zynaddsubfx/src/Samples/CMakeLists.txt deleted file mode 100644 index a6ef7b2a0..000000000 --- a/plugins/zynaddsubfx/src/Samples/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(zynaddsubfx_samples_SRCS - Sample.cpp -) - -add_library(zynaddsubfx_samples STATIC - ${zynaddsubfx_samples_SRCS} - ) - -target_link_libraries(zynaddsubfx_samples - zynaddsubfx_samples - ) diff --git a/plugins/zynaddsubfx/src/Samples/Sample.cpp b/plugins/zynaddsubfx/src/Samples/Sample.cpp deleted file mode 100644 index 33c9b3a20..000000000 --- a/plugins/zynaddsubfx/src/Samples/Sample.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Sample.cpp - Object for storing information on samples - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include //for memcpy/memset -#include -#include "Sample.h" - -using namespace std; - -/**\TODO start using pointer math here as these will be Frequency called - * functions throughout the code*/ -Sample::Sample(const Sample &smp) - :bufferSize(smp.bufferSize) -{ - buffer = new REALTYPE[bufferSize]; - for(int i = 0; i < bufferSize; ++i) - *(i + buffer) = *(i + smp.buffer); -} - -Sample::Sample(int length, REALTYPE fill) - :bufferSize(length) -{ - if(length < 1) - bufferSize = 1; - buffer = new REALTYPE[bufferSize]; - for(int i = 0; i < bufferSize; ++i) - buffer[i] = fill; -} - -Sample::Sample(int length, const REALTYPE *input) - :bufferSize(length) -{ - if(length > 0) { - buffer = new REALTYPE[length]; - for(int i = 0; i < length; ++i) - *(buffer + i) = *(input + i); - } - else { - buffer = new REALTYPE[1]; - bufferSize = 1; - *buffer = 0; - } -} - -Sample::~Sample() -{ - delete[] buffer; -} - -void Sample::clear() -{ - for(int i = 0; i < bufferSize; ++i) - *(i + buffer) = 0; -} - -void Sample::operator=(const Sample &smp) -{ - /**\todo rewrite to be less repetitive*/ - if(bufferSize == smp.bufferSize) - for(int i = 0; i < bufferSize; ++i) - *(i + buffer) = *(i + smp.buffer); - else { - delete[] buffer; - buffer = new REALTYPE[smp.bufferSize]; - bufferSize = smp.bufferSize; - for(int i = 0; i < bufferSize; ++i) - *(i + buffer) = *(i + smp.buffer); - } -} - -bool Sample::operator==(const Sample &smp) const -{ - if(this->bufferSize != smp.bufferSize) - return false; - for(int i = 0; i < bufferSize; ++i) - if(this->buffer[i] != smp.buffer[i]) - return false; - return true; -} - -/** - * Linear point estimation - * @param ya Y of point a - * @param yb Y of point b - * @param xt X of test point - * @param xa X of point a - * @param xb X of point b - * @return estimated Y of test point - */ -inline float linearEstimate(float ya, float yb, float xt, int xa = 0, int xb = 1) -{ - if(xa == xb) - return ya; - - return (yb-ya) * (xt-xa)/(xb-xa) + ya; -} - -void Sample::resize(int nsize) -{ - if(bufferSize == nsize) - return; - else {//resampling occurs here - float ratio = (nsize * 1.0) / (bufferSize * 1.0); - - int nBufferSize = nsize; - float *nBuffer = new float[nBufferSize]; - - //take care of edge cases - *nBuffer = *buffer; - *(nBuffer+nBufferSize-1) = *(buffer+bufferSize-1); - - //addition is done to avoid 0 edge case - for(int i = 1; i < nBufferSize - 1; ++i) - { - float left = floor(i/ratio); - float right = ceil((i+1)/ratio); - float test = i/ratio; - if(left > bufferSize - 1) - left = bufferSize - 1; - if(right > bufferSize - 1) - right = bufferSize - 1; - if(left > test) - test = left; - nBuffer[i] = linearEstimate(buffer[(int)left], - buffer[(int)right], - test, (int)left, (int)right); - } - - //put the new data in - delete[] buffer; - buffer = nBuffer; - bufferSize = nBufferSize; - } -} - -void Sample::append(const Sample &smp) -{ - int nbufferSize = bufferSize + smp.bufferSize; - float *nbuffer = new float[nbufferSize]; - - memcpy(nbuffer, buffer, bufferSize * sizeof(float)); - memcpy(nbuffer + bufferSize, smp.buffer, smp.bufferSize * sizeof(float)); - delete buffer; - - buffer = nbuffer; - bufferSize = nbufferSize; -} - -REALTYPE Sample::max() const -{ - REALTYPE max = -1500; //a good low considering that samples should store values -1.0 to 1.0 - for(int i = 0; i < bufferSize; ++i) - if(buffer[i] > max) - max = buffer[i]; - return max; -} - -REALTYPE Sample::min() const -{ - REALTYPE min = 1500; //a good high considering that samples should store values -1.0 to 1.0 - for(int i = 0; i < bufferSize; ++i) - if(buffer[i] < min) - min = buffer[i]; - return min; -} - -REALTYPE Sample::absMax() const -{ - REALTYPE max = 0; - for(int i = 0; i < bufferSize; ++i) - if(fabs(buffer[i]) > max) - max = fabs(buffer[i]); - return max; -} - diff --git a/plugins/zynaddsubfx/src/Samples/Sample.h b/plugins/zynaddsubfx/src/Samples/Sample.h deleted file mode 100644 index de6b6dfb0..000000000 --- a/plugins/zynaddsubfx/src/Samples/Sample.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Sample.h - Object for storing information on samples - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef SAMPLE_H -#define SAMPLE_H -#include "../globals.h" -/** - * Base Class for Samples - */ -class Sample -{ - public: - Sample(const Sample &smp); - Sample(int length, REALTYPE fill = 0); - Sample(int length, const REALTYPE *fill); - ~Sample(); - /**Fills the buffer with zeros*/ - void clear(); - /**States the size of the buffer - * @return the size of the buffer*/ - int size() const { - return bufferSize; - } - /**Provides the indexing operator for non const Samples*/ - REALTYPE &operator[](int index) { - return *(buffer + index % bufferSize); - } - /**Provides the indexing operator for const Samples*/ - const REALTYPE &operator[](int index) const { - return *(buffer + index % bufferSize); - } - /**Provides the assignment operator*/ - void operator=(const Sample &smp); - /**Provides the == operator*/ - bool operator==(const Sample &smp) const; - - /**Provides direct access to the buffer to allow for transition - * - * This method is like c_str() from the string class and should be used - * sparingly*/ - const REALTYPE *c_buf() const {return buffer;} - - /**Change the size of the sample*/ - void resize(int nsize); - - /**Appends another Sample to this Sample*/ - void append(const Sample &smp); - - REALTYPE max() const; - REALTYPE min() const; - REALTYPE absMax() const; - private: - int bufferSize; - float *buffer; -}; -#endif - diff --git a/plugins/zynaddsubfx/src/Seq/CMakeLists.txt b/plugins/zynaddsubfx/src/Seq/CMakeLists.txt deleted file mode 100644 index 008c821e4..000000000 --- a/plugins/zynaddsubfx/src/Seq/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(zynaddsubfx_seq_SRCS - MIDIEvents.cpp - MIDIFile.cpp - Sequencer.cpp -) - -add_library(zynaddsubfx_seq STATIC - ${zynaddsubfx_seq_SRCS} - ) - -target_link_libraries(zynaddsubfx_seq) diff --git a/plugins/zynaddsubfx/src/Seq/MIDIEvents.cpp b/plugins/zynaddsubfx/src/Seq/MIDIEvents.cpp deleted file mode 100644 index 22d9a0565..000000000 --- a/plugins/zynaddsubfx/src/Seq/MIDIEvents.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MIDIEvents.cpp - It stores the midi events from midi file or sequencer - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "MIDIEvents.h" -#include -#include - -MIDIEvents::MIDIEvents() -{} - -MIDIEvents::~MIDIEvents() -{} - - -/************** Track stuff ***************/ -void MIDIEvents::writeevent(list *l, event *ev) -{ - listpos *tmp = new listpos; - tmp->next = NULL; - tmp->ev = *ev; - if(l->current != NULL) - l->current->next = tmp; - else - l->first = tmp; - l->current = tmp; -// printf("Wx%x ",(int) l->current); -// printf("-> %d \n",l->current->ev.deltatime); - l->size++; -} - -void MIDIEvents::readevent(list *l, event *ev) -{ - if(l->current == NULL) { - ev->type = -1; - return; - } - *ev = l->current->ev; - l->current = l->current->next; - - //test - if(l->current != NULL) { -// ev->deltatime=10000; -// printf("Rx%d\n",l->current->ev.deltatime); -// printf("Rx%x ",(int) l->current); -// printf("-> %d (next=%x) \n",(int)l->current->ev.deltatime,(int)l->current->next); - } -} - - -void MIDIEvents::rewindlist(list *l) -{ - l->current = l->first; -} - -void MIDIEvents::deletelist(list *l) -{ - l->current = l->first; - if(l->current == NULL) - return; - while(l->current->next != NULL) { - listpos *tmp = l->current; - l->current = l->current->next; - delete (tmp); - } - deletelistreference(l); -} - -void MIDIEvents::deletelistreference(list *l) -{ - l->current = l->first = NULL; - l->size = 0; - l->length = 0.0; -} - diff --git a/plugins/zynaddsubfx/src/Seq/MIDIEvents.h b/plugins/zynaddsubfx/src/Seq/MIDIEvents.h deleted file mode 100644 index 222404876..000000000 --- a/plugins/zynaddsubfx/src/Seq/MIDIEvents.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MIDIEvents.h - It stores the midi events from midi file or sequencer - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef MIDI_EVENTS_H -#define MIDI_EVENTS_H - -#include "../globals.h" -#define NUM_MIDI_TRACKS NUM_MIDI_CHANNELS - -/**storage the midi events from midi file or sequencer - * \todo this looks quite like a remake of a linked list - * if it is, then it should be rewritten to use */ -class MIDIEvents -{ - friend class MIDIFile; - public: - MIDIEvents(); - ~MIDIEvents(); - - protected: - - /* Events */ - struct event { - int deltatime; - int channel; //on what midi channel is - int type, par1, par2; //type=1 for note, type=2 for controller, type=255 for time messages - } tmpevent; - struct listpos { - event ev; - struct listpos *next; - }; - struct list { - listpos *first, *current; - int size; //how many events are - double length; //in seconds - }; - struct { - list track; //the stored track - list record; //the track being "recorded" from midi - } miditrack[NUM_MIDI_TRACKS]; - - void writeevent(list *l, event *ev); - void readevent(list *l, event *ev); - - void rewindlist(list *l); - void deletelist(list *l); - void deletelistreference(list *l); -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Seq/MIDIFile.cpp b/plugins/zynaddsubfx/src/Seq/MIDIFile.cpp deleted file mode 100644 index d6c70ecb4..000000000 --- a/plugins/zynaddsubfx/src/Seq/MIDIFile.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MIDIFile.cpp - MIDI file loader - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include "MIDIFile.h" - - -MIDIFile::MIDIFile() -{ - midifile = NULL; - midifilesize = 0; - midifilek = 0; - midieof = false; - me = NULL; -} - -MIDIFile::~MIDIFile() -{ - clearmidifile(); -} - -int MIDIFile::loadfile(const char *filename) -{ - clearmidifile(); - - FILE *file = fopen(filename, "r"); - if(file == NULL) - return -1; - - char header[4]; - ZERO(header, 4); - if (fread(header, 4, 1, file) != 1) { - return -1; - } - - //test to see if this a midi file - if((header[0] != 'M') || (header[1] != 'T') || (header[2] != 'h') - || (header[3] != 'd')) { - fclose(file); - return -1; - } - - //get the filesize - fseek(file, 0, SEEK_END); - midifilesize = ftell(file); - rewind(file); - - midifile = new unsigned char[midifilesize]; - ZERO(midifile, midifilesize); - if (fread(midifile, midifilesize, 1, file) != 1) { - clearmidifile(); - return -1; - } - fclose(file); - -// for (int i=0;ime = me_; - - //read the header - int chunk = getint32(); //MThd - if(chunk != 0x4d546864) - return -1; - int size = getint32(); - if(size != 6) - return -1; //header is always 6 bytes long - - - int format = getint16(); - printf("format %d\n", format); - - int ntracks = getint16(); //this is always 1 if the format is "0" - printf("ntracks %d\n", ntracks); - - int division = getint16(); - printf("division %d\n", division); - if(division >= 0) { //delta time units in each a quater note -// tick=???; - } - else //SMPTE (frames/second and ticks/frame) - printf( - "ERROR:in MIDIFile.cpp::parsemidifile() - SMPTE not implemented yet."); - ; - - if(ntracks >= NUM_MIDI_TRACKS) - ntracks = NUM_MIDI_TRACKS - 1; - - for(int n = 0; n < ntracks; n++) { - if(parsetrack(n) < 0) { - clearmidifile(); - return -1; - } - } - - printf("\n\nCURRENT File position is = 0x%x\n", midifilek); - printf("\nMIDI file succesfully parsed.\n"); -// printf("\n0x%x\n",getbyte()); - - this->me = NULL; - return 0; -} - -//private members - - -int MIDIFile::parsetrack(int ntrack) -{ - printf("\n--==*Reading track %d **==--\n", ntrack); - - int chunk = getint32(); //MTrk - if(chunk != 0x4d54726b) - return -1; - - int size = getint32(); - printf("size = %d\n", size); - - int oldmidifilek = midifilek; - - unsigned char lastmsg = 0; - unsigned int dt = 0; - - while(!midieof) { - unsigned int msgdeltatime = getvarint32(); - -/// printf("MSGDELTATIME = %d\n",msgdeltatime); - -// dt+=msgdeltatime; - - int msg = peekbyte(); -/// printf("raw msg=0x%x ",msg); - if(msg < 0x80) - msg = lastmsg; - else { - lastmsg = msg; - getbyte(); - } -/// printf("msg=0x%x\n",msg); - -// dt+=msgdeltatime; - add_dt(ntrack, msgdeltatime); - - unsigned int mtype, mlength; - - switch(msg) { - case 0x80 ... 0x8f: //note on off - parsenoteoff(ntrack, msg & 0x0f, dt); - dt = 0; - break; - case 0x90 ... 0x9f: //note on (or note off) - parsenoteon(ntrack, msg & 0x0f, dt); - dt = 0; - break; - case 0xa0 ... 0xaf: //aftertouch - ignored - skipnbytes(2); - break; - case 0xb0 ... 0xbf: //control change - parsecontrolchange(ntrack, msg & 0x0f, dt); - dt = 0; - break; - case 0xc0 ... 0xcf: //program change - ignored - skipnbytes(1); - break; - case 0xd0 ... 0xdf: //channel pressure - ignored - skipnbytes(1); - break; - case 0xe0 ... 0xef: //channel mode messages - skipnbytes(2); - break; - case 0xf0: //sysex - ignored - while(getbyte() != 0xf7) { - if(midieof) - break; - } - break; - case 0xf7: //sysex (another type) - ignored - skipnbytes(getvarint32()); - break; - - case 0xff: //meta-event - mtype = getbyte(); - mlength = getbyte(); - parsemetaevent(mtype, mlength); - break; - - default: - getbyte(); - printf("UNKNOWN message! 0x%x\n", msg); - return -1; - break; - } - - - - if(midieof) - return -1; - - if((midifilek - oldmidifilek) == size) - break; - else - if((midifilek - oldmidifilek) > size) - return -1; -// if (size!=6) return(-1);//header is always 6 bytes long - } - - printf("End Track\n\n"); - - return 0; -} - - -void MIDIFile::parsenoteoff(char ntrack, char chan, unsigned int dt) -{ - unsigned char note; - note = getbyte(); - - (void) getbyte(); //Read in unused noteoff_velocity - if(chan >= NUM_MIDI_CHANNELS) - return; - - me->tmpevent.deltatime = convertdt(dt); - me->tmpevent.type = 1; - me->tmpevent.par1 = note; - me->tmpevent.par2 = 0; - me->tmpevent.channel = chan; - - printf("Note off:%d \n", note); - - ///test -// ntrack=0; - - me->writeevent(&me->miditrack[(int)ntrack].record, &me->tmpevent); -} - - -void MIDIFile::parsenoteon(char ntrack, char chan, unsigned int dt) -{ - unsigned char note, vel; - note = getbyte(); - vel = getbyte(); - -// printf("ntrack=%d\n",ntrack); - printf("[dt %d ] Note on:%d %d\n", dt, note, vel); - - if(chan >= NUM_MIDI_CHANNELS) - return; - - me->tmpevent.deltatime = convertdt(dt); - me->tmpevent.type = 1; - me->tmpevent.par1 = note; - me->tmpevent.par2 = vel; - me->tmpevent.channel = chan; - me->writeevent(&me->miditrack[(int)ntrack].record, &me->tmpevent); -} - -void MIDIFile::parsecontrolchange(char ntrack, char chan, unsigned int dt) -{ - unsigned char control, value; - control = getbyte(); - value = getbyte(); - - if(chan >= NUM_MIDI_CHANNELS) - return; - - printf("[dt %d] Control change:%d %d\n", dt, control, value); - - me->tmpevent.deltatime = convertdt(dt); - me->tmpevent.type = 2; - me->tmpevent.par1 = control; //???????????? ma uit la Sequencer::recordnote() din varianele vechi de zyn - me->tmpevent.par2 = value; - me->tmpevent.channel = chan; - me->writeevent(&me->miditrack[(int)ntrack].record, &me->tmpevent); -} - -void MIDIFile::parsepitchwheel(char ntrack, char chan, unsigned int dt) -{ - unsigned char valhi, vallo; - vallo = getbyte(); - valhi = getbyte(); - - if(chan >= NUM_MIDI_CHANNELS) - return; - - int value = (int)valhi * 128 + vallo; - - printf("[dt %d] Pitch wheel:%d\n", dt, value); -} - -void MIDIFile::parsemetaevent(unsigned char mtype, unsigned char mlength) -{ - int oldmidifilek = midifilek; - printf("meta-event type=0x%x length=%d\n", mtype, mlength); - - - - midifilek = oldmidifilek + mlength; -} - -void MIDIFile::add_dt(char ntrack, unsigned int dt) -{ - me->tmpevent.deltatime = convertdt(dt); - me->tmpevent.type = 255; - me->tmpevent.par1 = 0; - me->tmpevent.par2 = 0; - me->tmpevent.channel = 0; - me->writeevent(&me->miditrack[(int)ntrack].record, &me->tmpevent); -} - - -unsigned int MIDIFile::convertdt(unsigned int dt) -{ - double result = dt; - printf("DT=%d\n", dt); - - return (int) (result * 15.0); -} - - -void MIDIFile::clearmidifile() -{ - if(midifile != NULL) - delete (midifile); - midifile = NULL; - midifilesize = 0; - midifilek = 0; - midieof = false; -} - -unsigned char MIDIFile::getbyte() -{ - if(midifilek >= midifilesize) { - midieof = true; - return 0; - } - -/// printf("(%d) ",midifile[midifilek]); - return midifile[midifilek++]; -} - -unsigned char MIDIFile::peekbyte() -{ - if(midifilek >= midifilesize) { - midieof = true; - return 0; - } - return midifile[midifilek]; -} - -unsigned int MIDIFile::getint32() -{ - unsigned int result = 0; - for(int i = 0; i < 4; i++) - result = result * 256 + getbyte(); - ; - if(midieof) - result = 0; - return result; -} - -unsigned short int MIDIFile::getint16() -{ - unsigned short int result = 0; - for(int i = 0; i < 2; i++) - result = result * 256 + getbyte(); - ; - if(midieof) - result = 0; - return result; -} - -unsigned int MIDIFile::getvarint32() -{ - unsigned long result = 0; -/// printf("\n[start]"); - - if((result = getbyte()) & 0x80) { - result &= 0x7f; - uint8_t b; - do { - b = getbyte(); - result = (result << 7) + (b & 0x7f); - } while(b & 0x80); - } -/// printf("[end - result= %d]\n",result); - return result; -} - - -void MIDIFile::skipnbytes(int n) -{ - midifilek += n; - if(midifilek >= midifilesize) { - midifilek = midifilesize - 1; - midieof = true; - } -} - diff --git a/plugins/zynaddsubfx/src/Seq/MIDIFile.h b/plugins/zynaddsubfx/src/Seq/MIDIFile.h deleted file mode 100644 index ed1153bd2..000000000 --- a/plugins/zynaddsubfx/src/Seq/MIDIFile.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MIDIFile.h - MIDI file loader - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MIDIFILE_H -#define MIDIFILE_H - -#include "../globals.h" -#include "MIDIEvents.h" - -/**MIDI file loader*/ -class MIDIFile -{ - public: - MIDIFile(); - ~MIDIFile(); - - /**Loads the given file - * @param filename The name of the file to load - * @return -1 if there is an error, otherwise 0*/ - int loadfile(const char *filename); - - //returns -1 if there is an error, otherwise 0 - int parsemidifile(MIDIEvents *me_); - - private: - MIDIEvents *me; - - unsigned char *midifile; - int midifilesize, midifilek; - bool midieof; - - //returns -1 if there is an error, otherwise 0 - int parsetrack(int ntrack); - - void parsenoteoff(char ntrack, char chan, unsigned int dt); - void parsenoteon(char ntrack, char chan, unsigned int dt); - void parsecontrolchange(char ntrack, char chan, unsigned int dt); - void parsepitchwheel(char ntrack, char chan, unsigned int dt); - void parsemetaevent(unsigned char mtype, unsigned char mlength); - - void add_dt(char ntrack, unsigned int dt); - - void clearmidifile(); - - //convert the delta-time to internal format - unsigned int convertdt(unsigned int dt); - - /* Low Level MIDIfile functions */ - - //get a byte from the midifile - unsigned char getbyte(); - - //peek the current byte from the midifile - unsigned char peekbyte(); - - //get a set of 4 bytes from the midifile - unsigned int getint32(); - - //get a word of 2 bytes from the midifile - unsigned short int getint16(); - - //read a variable length quantity - unsigned int getvarint32(); - - //skip some bytes - void skipnbytes(int n); -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Seq/Sequencer.cpp b/plugins/zynaddsubfx/src/Seq/Sequencer.cpp deleted file mode 100644 index c11e68a7c..000000000 --- a/plugins/zynaddsubfx/src/Seq/Sequencer.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Sequencer.cpp - The Sequencer - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include - -#include -#include - -#include "Sequencer.h" - - - -Sequencer::Sequencer() -{ - play = 0; - for(int i = 0; i < NUM_MIDI_TRACKS; i++) { - miditrack[i].track.first = NULL; - miditrack[i].track.current = NULL; - miditrack[i].track.size = 0; - miditrack[i].track.length = 0.0; - miditrack[i].record.first = NULL; - miditrack[i].record.current = NULL; - miditrack[i].record.size = 0; - miditrack[i].record.length = 0.0; - - nextevent[i].time = 0.0; - resettime(&playtime[i]); - } - - setplayspeed(0); -} - -Sequencer::~Sequencer() -{ - for(int i = 0; i < NUM_MIDI_TRACKS; i++) { - deletelist(&miditrack[i].track); - deletelist(&miditrack[i].record); - } -} - - -int Sequencer::importmidifile(const char *filename) -{ - if(midifile.loadfile(filename) < 0) - return -1; - - for(int i = 0; i < NUM_MIDI_TRACKS; i++) - deletelist(&miditrack[i].record); - ; - if(midifile.parsemidifile(this) < 0) - return -1; - - //copy the "record" track to the main track - for(int i = 0; i < NUM_MIDI_TRACKS; i++) { - deletelist(&miditrack[i].track); - miditrack[i].track = miditrack[i].record; - deletelistreference(&miditrack[i].record); - } - return 0; -} - - - -void Sequencer::startplay() -{ - if(play != 0) - return; - for(int i = 0; i < NUM_MIDI_TRACKS; i++) - resettime(&playtime[i]); - - for(int i = 0; i < NUM_MIDI_TRACKS; i++) - rewindlist(&miditrack[i].track); - ; - play = 1; -} -void Sequencer::stopplay() -{ - if(play == 0) - return; - play = 0; -} - -// ************ Player stuff *************** - -int Sequencer::getevent(char ntrack, - int *midich, - int *type, - int *par1, - int *par2) -{ - *type = 0; - if(play == 0) - return -1; - - //test -// if (ntrack!=0) return(-1); - - updatecounter(&playtime[(int)ntrack]); - -// printf("%g %g\n",nextevent[ntrack].time,playtime[ntrack].abs); - - if(nextevent[(int)ntrack].time < playtime[(int)ntrack].abs) - readevent(&miditrack[(int)ntrack].track, &nextevent[(int)ntrack].ev); - else - return -1; - if(nextevent[(int)ntrack].ev.type == -1) - return -1; -// printf("********************************\n"); - - //sa pun aici o protectie. a.i. daca distanta dintre timpul curent si eveliment e prea mare (>1sec) sa elimin nota - - if(ntrack == 1) - printf("_ %f %.2f (%d)\n", nextevent[(int)ntrack].time, - playtime[(int)ntrack].abs, nextevent[(int)ntrack].ev.par2); - - *type = nextevent[(int)ntrack].ev.type; - *par1 = nextevent[(int)ntrack].ev.par1; - *par2 = nextevent[(int)ntrack].ev.par2; - *midich = nextevent[(int)ntrack].ev.channel; - - - double dt = nextevent[(int)ntrack].ev.deltatime * 0.0001 * realplayspeed; - printf("zzzzzzzzzzzzzz[%d] %d\n", - ntrack, - nextevent[(int)ntrack].ev.deltatime); - nextevent[(int)ntrack].time += dt; - -// printf("%f - %d %d \n",nextevent[ntrack].time,par1,par2); - return 0; //?? sau 1 -} - -/************** Timer stuff ***************/ - -void Sequencer::resettime(timestruct *t) -{ - t->abs = 0.0; - t->rel = 0.0; - - t->last = 0.0; -#ifndef OS_WINDOWS - timeval tval; - if(gettimeofday(&tval, NULL) == 0) - t->last = tval.tv_sec + tval.tv_usec * 0.000001; -#endif -} - -void Sequencer::updatecounter(timestruct *t) -{ - double current = 0.0; -#ifndef OS_WINDOWS - timeval tval; - if(gettimeofday(&tval, NULL) == 0) - current = tval.tv_sec + tval.tv_usec * 0.000001; -#endif - - t->rel = current - t->last; - t->abs += t->rel; - t->last = current; - -// printf("%f %f %f\n",t->last,t->abs,t->rel); -} - -void Sequencer::setplayspeed(int speed) -{ - playspeed = speed; - realplayspeed = pow(10.0, speed / 128.0); -} - diff --git a/plugins/zynaddsubfx/src/Seq/Sequencer.h b/plugins/zynaddsubfx/src/Seq/Sequencer.h deleted file mode 100644 index dd2d75613..000000000 --- a/plugins/zynaddsubfx/src/Seq/Sequencer.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Sequencer.h - The Sequencer - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef SEQUENCER_H -#define SEQUENCER_H - -#include "../globals.h" -#include "MIDIEvents.h" -#include "MIDIFile.h" - -/**The Sequencer - * \todo restructure some of this code*/ -class Sequencer:public MIDIEvents -{ - public: - /**Constructor*/ - Sequencer(); - /**Destructor*/ - ~Sequencer(); - - //these functions are called by the master and are ignored if the recorder/player are stopped - void recordnote(char chan, char note, char vel); - void recordcontroller(char chan, unsigned int type, int par); - - /**Gets an event \todo better description - * - * this is only for player - * @return 1 if this must be called at least once more - * 0 if there are no more notes for the current time - * -1 if there are no notes*/ - int getevent(char ntrack, int *midich, int *type, int *par1, int *par2); - - /**Imports a given midifile - * @return 0 if ok or -1 if there is a error loading file*/ - int importmidifile(const char *filename); - - void startplay(); - void stopplay(); - - - int play; - int playspeed; //viteza de rulare (0.1x-10x), 0=1.0x, 128=10x - void setplayspeed(int speed); - - private: - - MIDIFile midifile; - - /* Timer */ - struct timestruct { - double abs; //the time from the begining of the track - double rel; //the time difference between the last and the current event - double last; //the time of the last event (absolute, since 1 Jan 1970) - //these must be double, because the float's precision is too low - //and all these represent the time in seconds - } playtime[NUM_MIDI_TRACKS]; - - void resettime(timestruct *t); - void updatecounter(timestruct *t); //this updates the timer values - - /* Player only*/ - - struct { - event ev; - double time; - } nextevent[NUM_MIDI_TRACKS]; - - double realplayspeed; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/ADnote.cpp b/plugins/zynaddsubfx/src/Synth/ADnote.cpp deleted file mode 100644 index aa149cef5..000000000 --- a/plugins/zynaddsubfx/src/Synth/ADnote.cpp +++ /dev/null @@ -1,1987 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnote.cpp - The "additive" synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include - -#include "../globals.h" -#include "../Misc/Util.h" -#include "ADnote.h" - - -ADnote::ADnote(ADnoteParameters *pars, - Controller *ctl_, - REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote_, - bool besilent) -{ - ready = 0; - - tmpwavel = new REALTYPE [SOUND_BUFFER_SIZE]; - tmpwaver = new REALTYPE [SOUND_BUFFER_SIZE]; - bypassl = new REALTYPE [SOUND_BUFFER_SIZE]; - bypassr = new REALTYPE [SOUND_BUFFER_SIZE]; - - // Initialise some legato-specific vars - Legato.msg = LM_Norm; - Legato.fade.length = (int)(SAMPLE_RATE * 0.005); // 0.005 seems ok. - if(Legato.fade.length < 1) - Legato.fade.length = 1; // (if something's fishy) - Legato.fade.step = (1.0 / Legato.fade.length); - Legato.decounter = -10; - Legato.param.freq = freq; - Legato.param.vel = velocity; - Legato.param.portamento = portamento_; - Legato.param.midinote = midinote_; - Legato.silent = besilent; - - partparams = pars; - ctl = ctl_; - portamento = portamento_; - midinote = midinote_; - NoteEnabled = ON; - basefreq = freq; - if(velocity > 1.0) - velocity = 1.0; - this->velocity = velocity; - time = 0.0; - stereo = pars->GlobalPar.PStereo; - - NoteGlobalPar.Detune = getdetune(pars->GlobalPar.PDetuneType, - pars->GlobalPar.PCoarseDetune, - pars->GlobalPar.PDetune); - bandwidthDetuneMultiplier = pars->getBandwidthDetuneMultiplier(); - - if(pars->GlobalPar.PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->GlobalPar.PPanning / 128.0; - - - NoteGlobalPar.FilterCenterPitch = pars->GlobalPar.GlobalFilter->getfreq() //center freq - + pars->GlobalPar.PFilterVelocityScale - / 127.0 * 6.0 //velocity sensing - * (VelF(velocity, - pars->GlobalPar. - PFilterVelocityScaleFunction) - 1); - - if(pars->GlobalPar.PPunchStrength != 0) { - NoteGlobalPar.Punch.Enabled = 1; - NoteGlobalPar.Punch.t = 1.0; //start from 1.0 and to 0.0 - NoteGlobalPar.Punch.initialvalue = - ((pow(10, 1.5 * pars->GlobalPar.PPunchStrength / 127.0) - 1.0) - * VelF(velocity, - pars->GlobalPar.PPunchVelocitySensing)); - REALTYPE time = - pow(10, 3.0 * pars->GlobalPar.PPunchTime / 127.0) / 10000.0; //0.1 .. 100 ms - REALTYPE stretch = pow(440.0 / freq, - pars->GlobalPar.PPunchStretch / 64.0); - NoteGlobalPar.Punch.dt = 1.0 / (time * SAMPLE_RATE * stretch); - } - else - NoteGlobalPar.Punch.Enabled = 0; - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - pars->VoicePar[nvoice].OscilSmp->newrandseed(rand()); - NoteVoicePar[nvoice].OscilSmp = NULL; - NoteVoicePar[nvoice].FMSmp = NULL; - NoteVoicePar[nvoice].VoiceOut = NULL; - - NoteVoicePar[nvoice].FMVoice = -1; - unison_size[nvoice] = 1; - - if(pars->VoicePar[nvoice].Enabled == 0) { - NoteVoicePar[nvoice].Enabled = OFF; - continue; //the voice is disabled - } - - unison_stereo_spread[nvoice] = - pars->VoicePar[nvoice].Unison_stereo_spread / 127.0; - int unison = pars->VoicePar[nvoice].Unison_size; - if(unison < 1) - unison = 1; - - //compute unison - unison_size[nvoice] = unison; - - unison_base_freq_rap[nvoice] = new REALTYPE[unison]; - unison_freq_rap[nvoice] = new REALTYPE[unison]; - unison_invert_phase[nvoice] = new bool[unison]; - REALTYPE unison_spread = pars->getUnisonFrequencySpreadCents( - nvoice); - REALTYPE unison_real_spread = pow(2.0, (unison_spread * 0.5) / 1200.0); - REALTYPE unison_vibratto_a = pars->VoicePar[nvoice].Unison_vibratto - / 127.0; //0.0 .. 1.0 - - - switch(unison) { - case 1: - unison_base_freq_rap[nvoice][0] = 1.0; //if the unison is not used, always make the only subvoice to have the default note - break; - case 2: { //unison for 2 subvoices - unison_base_freq_rap[nvoice][0] = 1.0 / unison_real_spread; - unison_base_freq_rap[nvoice][1] = unison_real_spread; - }; - break; - default: { //unison for more than 2 subvoices - REALTYPE unison_values[unison]; - REALTYPE min = -1e-6, max = 1e-6; - for(int k = 0; k < unison; k++) { - REALTYPE step = (k / (REALTYPE) (unison - 1)) * 2.0 - 1.0; //this makes the unison spread more uniform - REALTYPE val = step + (RND * 2.0 - 1.0) / (unison - 1); - unison_values[k] = val; - if(val > max) - max = val; - if(val < min) - min = val; - } - REALTYPE diff = max - min; - for(int k = 0; k < unison; k++) { - unison_values[k] = - (unison_values[k] - (max + min) * 0.5) / diff; //the lowest value will be -1 and the highest will be 1 - unison_base_freq_rap[nvoice][k] = - pow(2.0, (unison_spread * unison_values[k]) / 1200); - } - }; - } - - //unison vibrattos - if(unison > 1) { - for(int k = 0; k < unison; k++) //reduce the frequency difference for larger vibrattos - unison_base_freq_rap[nvoice][k] = 1.0 - + (unison_base_freq_rap[ - nvoice][k] - - 1.0) - * (1.0 - unison_vibratto_a); - ; - } - unison_vibratto[nvoice].step = new REALTYPE[unison]; - unison_vibratto[nvoice].position = new REALTYPE[unison]; - unison_vibratto[nvoice].amplitude = - (unison_real_spread - 1.0) * unison_vibratto_a; - - REALTYPE increments_per_second = SAMPLE_RATE - / (REALTYPE)SOUND_BUFFER_SIZE; - REALTYPE vibratto_base_period = 0.25 - * pow(2.0, - (1.0 - - pars->VoicePar[nvoice]. - Unison_vibratto_speed / 127.0) * 4.0); - for(int k = 0; k < unison; k++) { - unison_vibratto[nvoice].position[k] = RND * 1.8 - 0.9; - REALTYPE vibratto_period = vibratto_base_period * pow( - 2.0, - RND * 2.0 - - 1.0); //make period to vary randomly from 50% to 200% vibratto base period - - REALTYPE m = 4.0 / (vibratto_period * increments_per_second); - if(RND < 0.5) - m = -m; - unison_vibratto[nvoice].step[k] = m; - } - - if(unison == 1) { //no vibratto for a single voice - unison_vibratto[nvoice].step[0] = 0.0; - unison_vibratto[nvoice].position[0] = 0.0; - unison_vibratto[nvoice].amplitude = 0.0; - } - - //phase invert for unison - unison_invert_phase[nvoice][0] = false; - if(unison != 1) { - int inv = pars->VoicePar[nvoice].Unison_invert_phase; - switch(inv) { - case 0: for(int k = 0; k < unison; k++) - unison_invert_phase[nvoice][k] = false; - break; - case 1: for(int k = 0; k < unison; k++) - unison_invert_phase[nvoice][k] = (RND > 0.5); - break; - default: for(int k = 0; k < unison; k++) - unison_invert_phase[nvoice][k] = - (k % inv == 0) ? true : false; - break; - } - } - - - oscfreqhi[nvoice] = new int[unison]; - oscfreqlo[nvoice] = new REALTYPE[unison]; - oscfreqhiFM[nvoice] = new unsigned int[unison]; - oscfreqloFM[nvoice] = new REALTYPE[unison]; - oscposhi[nvoice] = new int[unison]; - oscposlo[nvoice] = new REALTYPE[unison]; - oscposhiFM[nvoice] = new unsigned int[unison]; - oscposloFM[nvoice] = new REALTYPE[unison]; - - NoteVoicePar[nvoice].Enabled = ON; - NoteVoicePar[nvoice].fixedfreq = pars->VoicePar[nvoice].Pfixedfreq; - NoteVoicePar[nvoice].fixedfreqET = pars->VoicePar[nvoice].PfixedfreqET; - - //use the Globalpars.detunetype if the detunetype is 0 - if(pars->VoicePar[nvoice].PDetuneType != 0) { - NoteVoicePar[nvoice].Detune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - pars->VoicePar[nvoice]. - PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - else { - NoteVoicePar[nvoice].Detune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice]. - PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->GlobalPar.PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - if(pars->VoicePar[nvoice].PFMDetuneType != 0) - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->VoicePar[nvoice].PFMDetuneType, - pars->VoicePar[nvoice]. - PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - else - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice]. - PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - ; - - - for(int k = 0; k < unison; k++) { - oscposhi[nvoice][k] = 0; - oscposlo[nvoice][k] = 0.0; - oscposhiFM[nvoice][k] = 0; - oscposloFM[nvoice][k] = 0.0; - } - - NoteVoicePar[nvoice].OscilSmp = - new REALTYPE[OSCIL_SIZE + OSCIL_SMP_EXTRA_SAMPLES]; //the extra points contains the first point - - //Get the voice's oscil or external's voice oscil - int vc = nvoice; - if(pars->VoicePar[nvoice].Pextoscil != -1) - vc = pars->VoicePar[nvoice].Pextoscil; - if(!pars->GlobalPar.Hrandgrouping) - pars->VoicePar[vc].OscilSmp->newrandseed(rand()); - int oscposhi_start = - pars->VoicePar[vc].OscilSmp->get(NoteVoicePar[nvoice].OscilSmp, - getvoicebasefreq(nvoice), - pars->VoicePar[nvoice].Presonance); - - //I store the first elments to the last position for speedups - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) - NoteVoicePar[nvoice].OscilSmp[OSCIL_SIZE - + i] = - NoteVoicePar[nvoice].OscilSmp[i]; - - oscposhi_start += - (int)((pars->VoicePar[nvoice].Poscilphase - - 64.0) / 128.0 * OSCIL_SIZE + OSCIL_SIZE * 4); - oscposhi_start %= OSCIL_SIZE; - - for(int k = 0; k < unison; k++) { - oscposhi[nvoice][k] = oscposhi_start; - oscposhi_start = (int)(RND * (OSCIL_SIZE - 1)); //put random starting point for other subvoices - } - - NoteVoicePar[nvoice].FreqLfo = NULL; - NoteVoicePar[nvoice].FreqEnvelope = NULL; - - NoteVoicePar[nvoice].AmpLfo = NULL; - NoteVoicePar[nvoice].AmpEnvelope = NULL; - - NoteVoicePar[nvoice].VoiceFilterL = NULL; - NoteVoicePar[nvoice].VoiceFilterR = NULL; - NoteVoicePar[nvoice].FilterEnvelope = NULL; - NoteVoicePar[nvoice].FilterLfo = NULL; - - NoteVoicePar[nvoice].FilterCenterPitch = - pars->VoicePar[nvoice].VoiceFilter->getfreq(); - NoteVoicePar[nvoice].filterbypass = - pars->VoicePar[nvoice].Pfilterbypass; - - switch(pars->VoicePar[nvoice].PFMEnabled) { - case 1: - NoteVoicePar[nvoice].FMEnabled = MORPH; - break; - case 2: - NoteVoicePar[nvoice].FMEnabled = RING_MOD; - break; - case 3: - NoteVoicePar[nvoice].FMEnabled = PHASE_MOD; - break; - case 4: - NoteVoicePar[nvoice].FMEnabled = FREQ_MOD; - break; - case 5: - NoteVoicePar[nvoice].FMEnabled = PITCH_MOD; - break; - default: - NoteVoicePar[nvoice].FMEnabled = NONE; - } - - NoteVoicePar[nvoice].FMVoice = pars->VoicePar[nvoice].PFMVoice; - NoteVoicePar[nvoice].FMFreqEnvelope = NULL; - NoteVoicePar[nvoice].FMAmpEnvelope = NULL; - - //Compute the Voice's modulator volume (incl. damping) - REALTYPE fmvoldamp = pow(440.0 / getvoicebasefreq( - nvoice), - pars->VoicePar[nvoice].PFMVolumeDamp / 64.0 - - 1.0); - switch(NoteVoicePar[nvoice].FMEnabled) { - case PHASE_MOD: - fmvoldamp = - pow(440.0 / getvoicebasefreq( - nvoice), pars->VoicePar[nvoice].PFMVolumeDamp / 64.0); - NoteVoicePar[nvoice].FMVolume = - (exp(pars->VoicePar[nvoice].PFMVolume / 127.0 - * FM_AMP_MULTIPLIER) - 1.0) * fmvoldamp * 4.0; - break; - case FREQ_MOD: - NoteVoicePar[nvoice].FMVolume = - (exp(pars->VoicePar[nvoice].PFMVolume / 127.0 - * FM_AMP_MULTIPLIER) - 1.0) * fmvoldamp * 4.0; - break; - // case PITCH_MOD:NoteVoicePar[nvoice].FMVolume=(pars->VoicePar[nvoice].PFMVolume/127.0*8.0)*fmvoldamp;//??????????? - // break; - default: - if(fmvoldamp > 1.0) - fmvoldamp = 1.0; - NoteVoicePar[nvoice].FMVolume = pars->VoicePar[nvoice].PFMVolume - / 127.0 * fmvoldamp; - } - - //Voice's modulator velocity sensing - NoteVoicePar[nvoice].FMVolume *= - VelF(velocity, - partparams->VoicePar[nvoice].PFMVelocityScaleFunction); - - FMoldsmp[nvoice] = new REALTYPE [unison]; - for(int k = 0; k < unison; k++) - FMoldsmp[nvoice][k] = 0.0; //this is for FM (integration) - - firsttick[nvoice] = 1; - NoteVoicePar[nvoice].DelayTicks = - (int)((exp(pars->VoicePar[nvoice].PDelay / 127.0 - * log(50.0)) - - 1.0) / SOUND_BUFFER_SIZE / 10.0 * SAMPLE_RATE); - } - - max_unison = 1; - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) - if(unison_size[nvoice] > max_unison) - max_unison = unison_size[nvoice]; - ; - - tmpwave_unison = new REALTYPE *[max_unison]; - for(int k = 0; k < max_unison; k++) { - tmpwave_unison[k] = new REALTYPE[SOUND_BUFFER_SIZE]; - memset(tmpwave_unison[k], 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - } - - initparameters(); - ready = 1; -} - -// ADlegatonote: This function is (mostly) a copy of ADnote(...) and -// initparameters() stuck together with some lines removed so that it -// only alter the already playing note (to perform legato). It is -// possible I left stuff that is not required for this. -void ADnote::ADlegatonote(REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote_, - bool externcall) -{ - ADnoteParameters *pars = partparams; - //Controller *ctl_=ctl; - - // Manage legato stuff - if(externcall) - Legato.msg = LM_Norm; - if(Legato.msg != LM_CatchUp) { - Legato.lastfreq = Legato.param.freq; - Legato.param.freq = freq; - Legato.param.vel = velocity; - Legato.param.portamento = portamento_; - Legato.param.midinote = midinote_; - if(Legato.msg == LM_Norm) { - if(Legato.silent) { - Legato.fade.m = 0.0; - Legato.msg = LM_FadeIn; - } - else { - Legato.fade.m = 1.0; - Legato.msg = LM_FadeOut; - return; - } - } - if(Legato.msg == LM_ToNorm) - Legato.msg = LM_Norm; - } - - portamento = portamento_; - midinote = midinote_; - basefreq = freq; - - if(velocity > 1.0) - velocity = 1.0; - this->velocity = velocity; - - NoteGlobalPar.Detune = getdetune(pars->GlobalPar.PDetuneType, - pars->GlobalPar.PCoarseDetune, - pars->GlobalPar.PDetune); - bandwidthDetuneMultiplier = pars->getBandwidthDetuneMultiplier(); - - if(pars->GlobalPar.PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->GlobalPar.PPanning / 128.0; - - - NoteGlobalPar.FilterCenterPitch = pars->GlobalPar.GlobalFilter->getfreq() //center freq - + pars->GlobalPar.PFilterVelocityScale - / 127.0 * 6.0 //velocity sensing - * (VelF(velocity, - pars->GlobalPar. - PFilterVelocityScaleFunction) - 1); - - - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if(NoteVoicePar[nvoice].Enabled == OFF) - continue; //(gf) Stay the same as first note in legato. - - NoteVoicePar[nvoice].fixedfreq = pars->VoicePar[nvoice].Pfixedfreq; - NoteVoicePar[nvoice].fixedfreqET = pars->VoicePar[nvoice].PfixedfreqET; - - //use the Globalpars.detunetype if the detunetype is 0 - if(pars->VoicePar[nvoice].PDetuneType != 0) { - NoteVoicePar[nvoice].Detune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - pars->VoicePar[nvoice]. - PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - else { - NoteVoicePar[nvoice].Detune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice]. - PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->GlobalPar.PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - if(pars->VoicePar[nvoice].PFMDetuneType != 0) - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->VoicePar[nvoice].PFMDetuneType, - pars->VoicePar[nvoice]. - PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - else - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice]. - PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - ; - - //Get the voice's oscil or external's voice oscil - int vc = nvoice; - if(pars->VoicePar[nvoice].Pextoscil != -1) - vc = pars->VoicePar[nvoice].Pextoscil; - if(!pars->GlobalPar.Hrandgrouping) - pars->VoicePar[vc].OscilSmp->newrandseed(rand()); - - pars->VoicePar[vc].OscilSmp->get(NoteVoicePar[nvoice].OscilSmp, - getvoicebasefreq(nvoice), - pars->VoicePar[nvoice].Presonance); //(gf)Modif of the above line. - - //I store the first elments to the last position for speedups - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) - NoteVoicePar[nvoice].OscilSmp[OSCIL_SIZE - + i] = - NoteVoicePar[nvoice].OscilSmp[i]; - - - NoteVoicePar[nvoice].FilterCenterPitch = - pars->VoicePar[nvoice].VoiceFilter->getfreq(); - NoteVoicePar[nvoice].filterbypass = - pars->VoicePar[nvoice].Pfilterbypass; - - - NoteVoicePar[nvoice].FMVoice = pars->VoicePar[nvoice].PFMVoice; - - //Compute the Voice's modulator volume (incl. damping) - REALTYPE fmvoldamp = pow(440.0 / getvoicebasefreq( - nvoice), - pars->VoicePar[nvoice].PFMVolumeDamp / 64.0 - - 1.0); - - switch(NoteVoicePar[nvoice].FMEnabled) { - case PHASE_MOD: - fmvoldamp = - pow(440.0 / getvoicebasefreq( - nvoice), pars->VoicePar[nvoice].PFMVolumeDamp / 64.0); - NoteVoicePar[nvoice].FMVolume = - (exp(pars->VoicePar[nvoice].PFMVolume / 127.0 - * FM_AMP_MULTIPLIER) - 1.0) * fmvoldamp * 4.0; - break; - case FREQ_MOD: - NoteVoicePar[nvoice].FMVolume = - (exp(pars->VoicePar[nvoice].PFMVolume / 127.0 - * FM_AMP_MULTIPLIER) - 1.0) * fmvoldamp * 4.0; - break; - // case PITCH_MOD:NoteVoicePar[nvoice].FMVolume=(pars->VoicePar[nvoice].PFMVolume/127.0*8.0)*fmvoldamp;//??????????? - // break; - default: - if(fmvoldamp > 1.0) - fmvoldamp = 1.0; - NoteVoicePar[nvoice].FMVolume = pars->VoicePar[nvoice].PFMVolume - / 127.0 * fmvoldamp; - } - - //Voice's modulator velocity sensing - NoteVoicePar[nvoice].FMVolume *= - VelF(velocity, - partparams->VoicePar[nvoice].PFMVelocityScaleFunction); - - NoteVoicePar[nvoice].DelayTicks = - (int)((exp(pars->VoicePar[nvoice].PDelay / 127.0 - * log(50.0)) - - 1.0) / SOUND_BUFFER_SIZE / 10.0 * SAMPLE_RATE); - } - - /// initparameters(); - - /////////////// - // Altered content of initparameters(): - - int nvoice, i, tmp[NUM_VOICES]; - - NoteGlobalPar.Volume = 4.0 - * pow(0.1, 3.0 - * (1.0 - partparams->GlobalPar.PVolume / 96.0)) //-60 dB .. 0 dB - * VelF( - velocity, - partparams->GlobalPar. - PAmpVelocityScaleFunction); //velocity sensing - - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - NoteGlobalPar.FilterQ = partparams->GlobalPar.GlobalFilter->getq(); - NoteGlobalPar.FilterFreqTracking = - partparams->GlobalPar.GlobalFilter->getfreqtracking(basefreq); - - // Forbids the Modulation Voice to be greater or equal than voice - for(i = 0; i < NUM_VOICES; i++) - if(NoteVoicePar[i].FMVoice >= i) - NoteVoicePar[i].FMVoice = -1; - - // Voice Parameter init - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if(NoteVoicePar[nvoice].Enabled == 0) - continue; - - NoteVoicePar[nvoice].noisetype = partparams->VoicePar[nvoice].Type; - /* Voice Amplitude Parameters Init */ - NoteVoicePar[nvoice].Volume = - pow(0.1, 3.0 * (1.0 - partparams->VoicePar[nvoice].PVolume / 127.0)) // -60 dB .. 0 dB - * VelF(velocity, - partparams->VoicePar[nvoice].PAmpVelocityScaleFunction); //velocity - - if(partparams->VoicePar[nvoice].PVolumeminus != 0) - NoteVoicePar[nvoice].Volume = -NoteVoicePar[nvoice].Volume; - - if(partparams->VoicePar[nvoice].PPanning == 0) - NoteVoicePar[nvoice].Panning = RND; // random panning - else - NoteVoicePar[nvoice].Panning = - partparams->VoicePar[nvoice].PPanning / 128.0; - - newamplitude[nvoice] = 1.0; - if((partparams->VoicePar[nvoice].PAmpEnvelopeEnabled != 0) - && (NoteVoicePar[nvoice].AmpEnvelope != NULL)) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpEnvelope->envout_dB(); - ; - - if((partparams->VoicePar[nvoice].PAmpLfoEnabled != 0) - && (NoteVoicePar[nvoice].AmpLfo != NULL)) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpLfo->amplfoout(); - ; - - - NoteVoicePar[nvoice].FilterFreqTracking = - partparams->VoicePar[nvoice].VoiceFilter->getfreqtracking(basefreq); - - /* Voice Modulation Parameters Init */ - if((NoteVoicePar[nvoice].FMEnabled != NONE) - && (NoteVoicePar[nvoice].FMVoice < 0)) { - partparams->VoicePar[nvoice].FMSmp->newrandseed(rand()); - - //Perform Anti-aliasing only on MORPH or RING MODULATION - - int vc = nvoice; - if(partparams->VoicePar[nvoice].PextFMoscil != -1) - vc = partparams->VoicePar[nvoice].PextFMoscil; - - if(!partparams->GlobalPar.Hrandgrouping) - partparams->VoicePar[vc].FMSmp->newrandseed(rand()); - - ///oscposhiFM[nvoice]=(oscposhi[nvoice]+partparams->VoicePar[vc].FMSmp->get(NoteVoicePar[nvoice].FMSmp,tmp)) % OSCIL_SIZE; - // / oscposhi[nvoice]+partparams->VoicePar[vc].FMSmp->get(NoteVoicePar[nvoice].FMSmp,tmp); //(gf) Modif of the above line. - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) - NoteVoicePar[nvoice].FMSmp[OSCIL_SIZE - + i] = NoteVoicePar[nvoice].FMSmp[i]; - ///oscposhiFM[nvoice]+=(int)((partparams->VoicePar[nvoice].PFMoscilphase-64.0)/128.0*OSCIL_SIZE+OSCIL_SIZE*4); - ///oscposhiFM[nvoice]%=OSCIL_SIZE; - } - - FMnewamplitude[nvoice] = NoteVoicePar[nvoice].FMVolume - * ctl->fmamp.relamp; - - if((partparams->VoicePar[nvoice].PFMAmpEnvelopeEnabled != 0) - && (NoteVoicePar[nvoice].FMAmpEnvelope != NULL)) - FMnewamplitude[nvoice] *= - NoteVoicePar[nvoice].FMAmpEnvelope->envout_dB(); - ; - } - - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - for(i = nvoice + 1; i < NUM_VOICES; i++) - tmp[i] = 0; - for(i = nvoice + 1; i < NUM_VOICES; i++) - if((NoteVoicePar[i].FMVoice == nvoice) && (tmp[i] == 0)) - tmp[i] = 1; - ; - } - /////////////// - - // End of the ADlegatonote function. -} - - -/* - * Kill a voice of ADnote - */ -void ADnote::KillVoice(int nvoice) -{ - delete [] oscfreqhi[nvoice]; - delete [] oscfreqlo[nvoice]; - delete [] oscfreqhiFM[nvoice]; - delete [] oscfreqloFM[nvoice]; - delete [] oscposhi[nvoice]; - delete [] oscposlo[nvoice]; - delete [] oscposhiFM[nvoice]; - delete [] oscposloFM[nvoice]; - - delete [] NoteVoicePar[nvoice].OscilSmp; - delete [] unison_base_freq_rap[nvoice]; - delete [] unison_freq_rap[nvoice]; - delete [] unison_invert_phase[nvoice]; - delete [] FMoldsmp[nvoice]; - delete [] unison_vibratto[nvoice].step; - delete [] unison_vibratto[nvoice].position; - - if(NoteVoicePar[nvoice].FreqEnvelope != NULL) - delete (NoteVoicePar[nvoice].FreqEnvelope); - NoteVoicePar[nvoice].FreqEnvelope = NULL; - - if(NoteVoicePar[nvoice].FreqLfo != NULL) - delete (NoteVoicePar[nvoice].FreqLfo); - NoteVoicePar[nvoice].FreqLfo = NULL; - - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - delete (NoteVoicePar[nvoice].AmpEnvelope); - NoteVoicePar[nvoice].AmpEnvelope = NULL; - - if(NoteVoicePar[nvoice].AmpLfo != NULL) - delete (NoteVoicePar[nvoice].AmpLfo); - NoteVoicePar[nvoice].AmpLfo = NULL; - - if(NoteVoicePar[nvoice].VoiceFilterL != NULL) - delete (NoteVoicePar[nvoice].VoiceFilterL); - NoteVoicePar[nvoice].VoiceFilterL = NULL; - - if(NoteVoicePar[nvoice].VoiceFilterR != NULL) - delete (NoteVoicePar[nvoice].VoiceFilterR); - NoteVoicePar[nvoice].VoiceFilterR = NULL; - - if(NoteVoicePar[nvoice].FilterEnvelope != NULL) - delete (NoteVoicePar[nvoice].FilterEnvelope); - NoteVoicePar[nvoice].FilterEnvelope = NULL; - - if(NoteVoicePar[nvoice].FilterLfo != NULL) - delete (NoteVoicePar[nvoice].FilterLfo); - NoteVoicePar[nvoice].FilterLfo = NULL; - - if(NoteVoicePar[nvoice].FMFreqEnvelope != NULL) - delete (NoteVoicePar[nvoice].FMFreqEnvelope); - NoteVoicePar[nvoice].FMFreqEnvelope = NULL; - - if(NoteVoicePar[nvoice].FMAmpEnvelope != NULL) - delete (NoteVoicePar[nvoice].FMAmpEnvelope); - NoteVoicePar[nvoice].FMAmpEnvelope = NULL; - - if((NoteVoicePar[nvoice].FMEnabled != NONE) - && (NoteVoicePar[nvoice].FMVoice < 0)) - delete [] NoteVoicePar[nvoice].FMSmp; - - if(NoteVoicePar[nvoice].VoiceOut != NULL) - memset(NoteVoicePar[nvoice].VoiceOut, 0, SOUND_BUFFER_SIZE - * sizeof(REALTYPE));//do not delete, yet: perhaps is used by another voice - - NoteVoicePar[nvoice].Enabled = OFF; -} - -/* - * Kill the note - */ -void ADnote::KillNote() -{ - int nvoice; - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if(NoteVoicePar[nvoice].Enabled == ON) - KillVoice(nvoice); - - //delete VoiceOut - if(NoteVoicePar[nvoice].VoiceOut != NULL) - delete (NoteVoicePar[nvoice].VoiceOut); - NoteVoicePar[nvoice].VoiceOut = NULL; - } - - delete (NoteGlobalPar.FreqEnvelope); - delete (NoteGlobalPar.FreqLfo); - delete (NoteGlobalPar.AmpEnvelope); - delete (NoteGlobalPar.AmpLfo); - delete (NoteGlobalPar.GlobalFilterL); - if(stereo != 0) - delete (NoteGlobalPar.GlobalFilterR); - delete (NoteGlobalPar.FilterEnvelope); - delete (NoteGlobalPar.FilterLfo); - - NoteEnabled = OFF; -} - -ADnote::~ADnote() -{ - if(NoteEnabled == ON) - KillNote(); - delete [] tmpwavel; - delete [] tmpwaver; - delete [] bypassl; - delete [] bypassr; - for(int k = 0; k < max_unison; k++) - delete[] tmpwave_unison[k]; - delete[] tmpwave_unison; -} - - -/* - * Init the parameters - */ -void ADnote::initparameters() -{ - int nvoice, i, tmp[NUM_VOICES]; - - // Global Parameters - NoteGlobalPar.FreqEnvelope = new Envelope( - partparams->GlobalPar.FreqEnvelope, - basefreq); - NoteGlobalPar.FreqLfo = new LFO(partparams->GlobalPar.FreqLfo, - basefreq); - - NoteGlobalPar.AmpEnvelope = new Envelope(partparams->GlobalPar.AmpEnvelope, - basefreq); - NoteGlobalPar.AmpLfo = new LFO(partparams->GlobalPar.AmpLfo, basefreq); - - NoteGlobalPar.Volume = 4.0 - * pow(0.1, 3.0 - * (1.0 - partparams->GlobalPar.PVolume / 96.0)) //-60 dB .. 0 dB - * VelF( - velocity, - partparams->GlobalPar. - PAmpVelocityScaleFunction); //velocity sensing - - NoteGlobalPar.AmpEnvelope->envout_dB(); //discard the first envelope output - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - NoteGlobalPar.GlobalFilterL = new Filter(partparams->GlobalPar.GlobalFilter); - if(stereo != 0) - NoteGlobalPar.GlobalFilterR = new Filter( - partparams->GlobalPar.GlobalFilter); - - NoteGlobalPar.FilterEnvelope = new Envelope( - partparams->GlobalPar.FilterEnvelope, - basefreq); - NoteGlobalPar.FilterLfo = new LFO(partparams->GlobalPar.FilterLfo, - basefreq); - NoteGlobalPar.FilterQ = partparams->GlobalPar.GlobalFilter->getq(); - NoteGlobalPar.FilterFreqTracking = - partparams->GlobalPar.GlobalFilter->getfreqtracking(basefreq); - - // Forbids the Modulation Voice to be greater or equal than voice - for(i = 0; i < NUM_VOICES; i++) - if(NoteVoicePar[i].FMVoice >= i) - NoteVoicePar[i].FMVoice = -1; - - // Voice Parameter init - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if(NoteVoicePar[nvoice].Enabled == 0) - continue; - - NoteVoicePar[nvoice].noisetype = partparams->VoicePar[nvoice].Type; - /* Voice Amplitude Parameters Init */ - NoteVoicePar[nvoice].Volume = - pow(0.1, 3.0 * (1.0 - partparams->VoicePar[nvoice].PVolume / 127.0)) // -60 dB .. 0 dB - * VelF(velocity, - partparams->VoicePar[nvoice].PAmpVelocityScaleFunction); //velocity - - if(partparams->VoicePar[nvoice].PVolumeminus != 0) - NoteVoicePar[nvoice].Volume = -NoteVoicePar[nvoice].Volume; - - if(partparams->VoicePar[nvoice].PPanning == 0) - NoteVoicePar[nvoice].Panning = RND; // random panning - else - NoteVoicePar[nvoice].Panning = - partparams->VoicePar[nvoice].PPanning / 128.0; - - newamplitude[nvoice] = 1.0; - if(partparams->VoicePar[nvoice].PAmpEnvelopeEnabled != 0) { - NoteVoicePar[nvoice].AmpEnvelope = new Envelope( - partparams->VoicePar[nvoice].AmpEnvelope, - basefreq); - NoteVoicePar[nvoice].AmpEnvelope->envout_dB(); //discard the first envelope sample - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpEnvelope->envout_dB(); - } - - if(partparams->VoicePar[nvoice].PAmpLfoEnabled != 0) { - NoteVoicePar[nvoice].AmpLfo = new LFO( - partparams->VoicePar[nvoice].AmpLfo, - basefreq); - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpLfo->amplfoout(); - } - - /* Voice Frequency Parameters Init */ - if(partparams->VoicePar[nvoice].PFreqEnvelopeEnabled != 0) - NoteVoicePar[nvoice].FreqEnvelope = new Envelope( - partparams->VoicePar[nvoice].FreqEnvelope, - basefreq); - - if(partparams->VoicePar[nvoice].PFreqLfoEnabled != 0) - NoteVoicePar[nvoice].FreqLfo = new LFO( - partparams->VoicePar[nvoice].FreqLfo, - basefreq); - - /* Voice Filter Parameters Init */ - if(partparams->VoicePar[nvoice].PFilterEnabled != 0) { - NoteVoicePar[nvoice].VoiceFilterL = new Filter( - partparams->VoicePar[nvoice].VoiceFilter); - NoteVoicePar[nvoice].VoiceFilterR = new Filter( - partparams->VoicePar[nvoice].VoiceFilter); - } - - if(partparams->VoicePar[nvoice].PFilterEnvelopeEnabled != 0) - NoteVoicePar[nvoice].FilterEnvelope = new Envelope( - partparams->VoicePar[nvoice].FilterEnvelope, - basefreq); - - if(partparams->VoicePar[nvoice].PFilterLfoEnabled != 0) - NoteVoicePar[nvoice].FilterLfo = - new LFO(partparams->VoicePar[nvoice].FilterLfo, basefreq); - - NoteVoicePar[nvoice].FilterFreqTracking = - partparams->VoicePar[nvoice].VoiceFilter->getfreqtracking(basefreq); - - /* Voice Modulation Parameters Init */ - if((NoteVoicePar[nvoice].FMEnabled != NONE) - && (NoteVoicePar[nvoice].FMVoice < 0)) { - partparams->VoicePar[nvoice].FMSmp->newrandseed(rand()); - NoteVoicePar[nvoice].FMSmp = - new REALTYPE[OSCIL_SIZE + OSCIL_SMP_EXTRA_SAMPLES]; - - //Perform Anti-aliasing only on MORPH or RING MODULATION - - int vc = nvoice; - if(partparams->VoicePar[nvoice].PextFMoscil != -1) - vc = partparams->VoicePar[nvoice].PextFMoscil; - - REALTYPE tmp = 1.0; - if((partparams->VoicePar[vc].FMSmp->Padaptiveharmonics != 0) - || (NoteVoicePar[nvoice].FMEnabled == MORPH) - || (NoteVoicePar[nvoice].FMEnabled == RING_MOD)) - tmp = getFMvoicebasefreq(nvoice); - ; - if(!partparams->GlobalPar.Hrandgrouping) - partparams->VoicePar[vc].FMSmp->newrandseed(rand()); - - for(int k = 0; k < unison_size[nvoice]; k++) - oscposhiFM[nvoice][k] = - (oscposhi[nvoice][k] - + partparams->VoicePar[vc].FMSmp->get(NoteVoicePar[nvoice] - . - FMSmp, - tmp)) % OSCIL_SIZE; - ; - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) - NoteVoicePar[nvoice].FMSmp[OSCIL_SIZE - + i] = NoteVoicePar[nvoice].FMSmp[i]; - int oscposhiFM_add = - (int)((partparams->VoicePar[nvoice].PFMoscilphase - - 64.0) / 128.0 * OSCIL_SIZE + OSCIL_SIZE * 4); - for(int k = 0; k < unison_size[nvoice]; k++) { - oscposhiFM[nvoice][k] += oscposhiFM_add; - oscposhiFM[nvoice][k] %= OSCIL_SIZE; - } - } - - if(partparams->VoicePar[nvoice].PFMFreqEnvelopeEnabled != 0) - NoteVoicePar[nvoice].FMFreqEnvelope = new Envelope( - partparams->VoicePar[nvoice].FMFreqEnvelope, - basefreq); - - FMnewamplitude[nvoice] = NoteVoicePar[nvoice].FMVolume - * ctl->fmamp.relamp; - - if(partparams->VoicePar[nvoice].PFMAmpEnvelopeEnabled != 0) { - NoteVoicePar[nvoice].FMAmpEnvelope = new Envelope( - partparams->VoicePar[nvoice].FMAmpEnvelope, - basefreq); - FMnewamplitude[nvoice] *= - NoteVoicePar[nvoice].FMAmpEnvelope->envout_dB(); - } - } - - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - for(i = nvoice + 1; i < NUM_VOICES; i++) - tmp[i] = 0; - for(i = nvoice + 1; i < NUM_VOICES; i++) - if((NoteVoicePar[i].FMVoice == nvoice) && (tmp[i] == 0)) { - NoteVoicePar[nvoice].VoiceOut = new REALTYPE[SOUND_BUFFER_SIZE]; - tmp[i] = 1; - } - ; - if(NoteVoicePar[nvoice].VoiceOut != NULL) - memset(NoteVoicePar[nvoice].VoiceOut, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - } -} - - -/* - * Computes the relative frequency of each unison voice and it's vibratto - * This must be called before setfreq* functions - */ -void ADnote::compute_unison_freq_rap(int nvoice) { - if(unison_size[nvoice] == 1) { //no unison - unison_freq_rap[nvoice][0] = 1.0; - return; - } - REALTYPE relbw = ctl->bandwidth.relbw * bandwidthDetuneMultiplier; - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE pos = unison_vibratto[nvoice].position[k]; - REALTYPE step = unison_vibratto[nvoice].step[k]; - pos += step; - if(pos <= -1.0) { - pos = -1.0; - step = -step; - } - if(pos >= 1.0) { - pos = 1.0; - step = -step; - } - REALTYPE vibratto_val = (pos - 0.333333333 * pos * pos * pos) * 1.5; //make the vibratto lfo smoother - unison_freq_rap[nvoice][k] = 1.0 - + ((unison_base_freq_rap[nvoice][k] - - 1.0) + vibratto_val - * unison_vibratto[nvoice].amplitude) - * relbw; - - unison_vibratto[nvoice].position[k] = pos; - step = unison_vibratto[nvoice].step[k] = step; - } -} - - -/* - * Computes the frequency of an oscillator - */ -void ADnote::setfreq(int nvoice, REALTYPE in_freq) -{ - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE freq = fabs(in_freq) * unison_freq_rap[nvoice][k]; - REALTYPE speed = freq * REALTYPE(OSCIL_SIZE) / (REALTYPE) SAMPLE_RATE; - if(speed > OSCIL_SIZE) - speed = OSCIL_SIZE; - - F2I(speed, oscfreqhi[nvoice][k]); - oscfreqlo[nvoice][k] = speed - floor(speed); - } -} - -/* - * Computes the frequency of an modullator oscillator - */ -void ADnote::setfreqFM(int nvoice, REALTYPE in_freq) -{ - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE freq = fabs(in_freq) * unison_freq_rap[nvoice][k]; - REALTYPE speed = freq * REALTYPE(OSCIL_SIZE) / (REALTYPE) SAMPLE_RATE; - if(speed > OSCIL_SIZE) - speed = OSCIL_SIZE; - - F2I(speed, oscfreqhiFM[nvoice][k]); - oscfreqloFM[nvoice][k] = speed - floor(speed); - } -} - -/* - * Get Voice base frequency - */ -REALTYPE ADnote::getvoicebasefreq(int nvoice) const -{ - REALTYPE detune = NoteVoicePar[nvoice].Detune / 100.0 - + NoteVoicePar[nvoice].FineDetune / 100.0 - * ctl->bandwidth.relbw * bandwidthDetuneMultiplier - + NoteGlobalPar.Detune / 100.0; - - if(NoteVoicePar[nvoice].fixedfreq == 0) - return this->basefreq * pow(2, detune / 12.0); - else { //the fixed freq is enabled - REALTYPE fixedfreq = 440.0; - int fixedfreqET = NoteVoicePar[nvoice].fixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - REALTYPE tmp = - (midinote - - 69.0) / 12.0 * (pow(2.0, (fixedfreqET - 1) / 63.0) - 1.0); - if(fixedfreqET <= 64) - fixedfreq *= pow(2.0, tmp); - else - fixedfreq *= pow(3.0, tmp); - } - return fixedfreq * pow(2.0, detune / 12.0); - } -} - -/* - * Get Voice's Modullator base frequency - */ -REALTYPE ADnote::getFMvoicebasefreq(int nvoice) const -{ - REALTYPE detune = NoteVoicePar[nvoice].FMDetune / 100.0; - return getvoicebasefreq(nvoice) * pow(2, detune / 12.0); -} - -/* - * Computes all the parameters for each tick - */ -void ADnote::computecurrentparameters() -{ - int nvoice; - REALTYPE voicefreq, voicepitch, filterpitch, filterfreq, FMfreq, - FMrelativepitch, globalpitch, globalfilterpitch; - globalpitch = 0.01 * (NoteGlobalPar.FreqEnvelope->envout() - + NoteGlobalPar.FreqLfo->lfoout() - * ctl->modwheel.relmod); - globaloldamplitude = globalnewamplitude; - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - globalfilterpitch = NoteGlobalPar.FilterEnvelope->envout() - + NoteGlobalPar.FilterLfo->lfoout() - + NoteGlobalPar.FilterCenterPitch; - - REALTYPE tmpfilterfreq = globalfilterpitch + ctl->filtercutoff.relfreq - + NoteGlobalPar.FilterFreqTracking; - - tmpfilterfreq = NoteGlobalPar.GlobalFilterL->getrealfreq(tmpfilterfreq); - - REALTYPE globalfilterq = NoteGlobalPar.FilterQ * ctl->filterq.relq; - NoteGlobalPar.GlobalFilterL->setfreq_and_q(tmpfilterfreq, globalfilterq); - if(stereo != 0) - NoteGlobalPar.GlobalFilterR->setfreq_and_q(tmpfilterfreq, globalfilterq); - - //compute the portamento, if it is used by this note - REALTYPE portamentofreqrap = 1.0; - if(portamento != 0) { //this voice use portamento - portamentofreqrap = ctl->portamento.freqrap; - if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" - ; - } - - //compute parameters for all voices - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if(NoteVoicePar[nvoice].Enabled != ON) - continue; - NoteVoicePar[nvoice].DelayTicks -= 1; - if(NoteVoicePar[nvoice].DelayTicks > 0) - continue; - - compute_unison_freq_rap(nvoice); - - /*******************/ - /* Voice Amplitude */ - /*******************/ - oldamplitude[nvoice] = newamplitude[nvoice]; - newamplitude[nvoice] = 1.0; - - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpEnvelope->envout_dB(); - - if(NoteVoicePar[nvoice].AmpLfo != NULL) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpLfo->amplfoout(); - - /****************/ - /* Voice Filter */ - /****************/ - if(NoteVoicePar[nvoice].VoiceFilterL != NULL) { - filterpitch = NoteVoicePar[nvoice].FilterCenterPitch; - - if(NoteVoicePar[nvoice].FilterEnvelope != NULL) - filterpitch += NoteVoicePar[nvoice].FilterEnvelope->envout(); - - if(NoteVoicePar[nvoice].FilterLfo != NULL) - filterpitch += NoteVoicePar[nvoice].FilterLfo->lfoout(); - - filterfreq = filterpitch + NoteVoicePar[nvoice].FilterFreqTracking; - filterfreq = NoteVoicePar[nvoice].VoiceFilterL->getrealfreq( - filterfreq); - - NoteVoicePar[nvoice].VoiceFilterL->setfreq(filterfreq); - if(stereo && NoteVoicePar[nvoice].VoiceFilterR) - NoteVoicePar[nvoice].VoiceFilterR->setfreq(filterfreq); - } - - if(NoteVoicePar[nvoice].noisetype == 0) { //compute only if the voice isn't noise - /*******************/ - /* Voice Frequency */ - /*******************/ - voicepitch = 0.0; - if(NoteVoicePar[nvoice].FreqLfo != NULL) - voicepitch += NoteVoicePar[nvoice].FreqLfo->lfoout() / 100.0 - * ctl->bandwidth.relbw; - - if(NoteVoicePar[nvoice].FreqEnvelope != NULL) - voicepitch += NoteVoicePar[nvoice].FreqEnvelope->envout() - / 100.0; - voicefreq = getvoicebasefreq(nvoice) - * pow(2, (voicepitch + globalpitch) / 12.0); //Hz frequency - voicefreq *= ctl->pitchwheel.relfreq; //change the frequency by the controller - setfreq(nvoice, voicefreq * portamentofreqrap); - - /***************/ - /* Modulator */ - /***************/ - if(NoteVoicePar[nvoice].FMEnabled != NONE) { - FMrelativepitch = NoteVoicePar[nvoice].FMDetune / 100.0; - if(NoteVoicePar[nvoice].FMFreqEnvelope != NULL) - FMrelativepitch += - NoteVoicePar[nvoice].FMFreqEnvelope->envout() / 100; - FMfreq = - pow(2.0, FMrelativepitch - / 12.0) * voicefreq * portamentofreqrap; - setfreqFM(nvoice, FMfreq); - - FMoldamplitude[nvoice] = FMnewamplitude[nvoice]; - FMnewamplitude[nvoice] = NoteVoicePar[nvoice].FMVolume - * ctl->fmamp.relamp; - if(NoteVoicePar[nvoice].FMAmpEnvelope != NULL) - FMnewamplitude[nvoice] *= - NoteVoicePar[nvoice].FMAmpEnvelope->envout_dB(); - } - } - } - time += (REALTYPE)SOUND_BUFFER_SIZE / (REALTYPE)SAMPLE_RATE; -} - - -/* - * Fadein in a way that removes clicks but keep sound "punchy" - */ -inline void ADnote::fadein(REALTYPE *smps) const -{ - int zerocrossings = 0; - for(int i = 1; i < SOUND_BUFFER_SIZE; i++) - if((smps[i - 1] < 0.0) && (smps[i] > 0.0)) - zerocrossings++; //this is only the possitive crossings - - REALTYPE tmp = (SOUND_BUFFER_SIZE - 1.0) / (zerocrossings + 1) / 3.0; - if(tmp < 8.0) - tmp = 8.0; - - int n; - F2I(tmp, n); //how many samples is the fade-in - if(n > SOUND_BUFFER_SIZE) - n = SOUND_BUFFER_SIZE; - for(int i = 0; i < n; i++) { //fade-in - REALTYPE tmp = 0.5 - cos((REALTYPE)i / (REALTYPE) n * PI) * 0.5; - smps[i] *= tmp; - } -} - -/* - * Computes the Oscillator (Without Modulation) - LinearInterpolation - */ -inline void ADnote::ComputeVoiceOscillator_LinearInterpolation(int nvoice) -{ - int i, poshi; - REALTYPE poslo; - - for(int k = 0; k < unison_size[nvoice]; k++) { - poshi = oscposhi[nvoice][k]; - poslo = oscposlo[nvoice][k]; - int freqhi = oscfreqhi[nvoice][k]; - REALTYPE freqlo = oscfreqlo[nvoice][k]; - REALTYPE *smps = NoteVoicePar[nvoice].OscilSmp; - REALTYPE *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tw[i] = smps[poshi] * (1.0 - poslo) + smps[poshi + 1] * poslo; - poslo += freqlo; - if(poslo >= 1.0) { - poslo -= 1.0; - poshi++; - } - poshi += freqhi; - poshi &= OSCIL_SIZE - 1; - } - oscposhi[nvoice][k] = poshi; - oscposlo[nvoice][k] = poslo; - } -} - - - -/* - * Computes the Oscillator (Without Modulation) - CubicInterpolation - * - The differences from the Linear are to little to deserve to be used. This is because I am using a large OSCIL_SIZE (>512) -inline void ADnote::ComputeVoiceOscillator_CubicInterpolation(int nvoice){ - int i,poshi; - REALTYPE poslo; - - poshi=oscposhi[nvoice]; - poslo=oscposlo[nvoice]; - REALTYPE *smps=NoteVoicePar[nvoice].OscilSmp; - REALTYPE xm1,x0,x1,x2,a,b,c; - for (i=0;i=1.0) { - poslo-=1.0; - poshi++; - }; - poshi+=oscfreqhi[nvoice]; - poshi&=OSCIL_SIZE-1; - }; - oscposhi[nvoice]=poshi; - oscposlo[nvoice]=poslo; -}; -*/ -/* - * Computes the Oscillator (Morphing) - */ -inline void ADnote::ComputeVoiceOscillatorMorph(int nvoice) -{ - int i; - REALTYPE amp; - ComputeVoiceOscillator_LinearInterpolation(nvoice); - if(FMnewamplitude[nvoice] > 1.0) - FMnewamplitude[nvoice] = 1.0; - if(FMoldamplitude[nvoice] > 1.0) - FMoldamplitude[nvoice] = 1.0; - - if(NoteVoicePar[nvoice].FMVoice >= 0) { - //if I use VoiceOut[] as modullator - int FMVoice = NoteVoicePar[nvoice].FMVoice; - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - SOUND_BUFFER_SIZE); - tw[i] = tw[i] - * (1.0 - amp) + amp * NoteVoicePar[FMVoice].VoiceOut[i]; - } - } - } - else { - for(int k = 0; k < unison_size[nvoice]; k++) { - int poshiFM = oscposhiFM[nvoice][k]; - REALTYPE posloFM = oscposloFM[nvoice][k]; - int freqhiFM = oscfreqhiFM[nvoice][k]; - REALTYPE freqloFM = oscfreqloFM[nvoice][k]; - REALTYPE *tw = tmpwave_unison[k]; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - SOUND_BUFFER_SIZE); - tw[i] = tw[i] * (1.0 - amp) + amp - * (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1 - posloFM) - + NoteVoicePar[nvoice].FMSmp[poshiFM + 1] * posloFM); - posloFM += freqloFM; - if(posloFM >= 1.0) { - posloFM -= 1.0; - poshiFM++; - } - poshiFM += freqhiFM; - poshiFM &= OSCIL_SIZE - 1; - } - oscposhiFM[nvoice][k] = poshiFM; - oscposloFM[nvoice][k] = posloFM; - } - } -} - -/* - * Computes the Oscillator (Ring Modulation) - */ -inline void ADnote::ComputeVoiceOscillatorRingModulation(int nvoice) -{ - int i; - REALTYPE amp; - ComputeVoiceOscillator_LinearInterpolation(nvoice); - if(FMnewamplitude[nvoice] > 1.0) - FMnewamplitude[nvoice] = 1.0; - if(FMoldamplitude[nvoice] > 1.0) - FMoldamplitude[nvoice] = 1.0; - if(NoteVoicePar[nvoice].FMVoice >= 0) { - // if I use VoiceOut[] as modullator - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - SOUND_BUFFER_SIZE); - int FMVoice = NoteVoicePar[nvoice].FMVoice; - tw[i] *= (1.0 - amp) + amp * NoteVoicePar[FMVoice].VoiceOut[i]; - } - } - } - else { - for(int k = 0; k < unison_size[nvoice]; k++) { - int poshiFM = oscposhiFM[nvoice][k]; - REALTYPE posloFM = oscposloFM[nvoice][k]; - int freqhiFM = oscfreqhiFM[nvoice][k]; - REALTYPE freqloFM = oscfreqloFM[nvoice][k]; - REALTYPE *tw = tmpwave_unison[k]; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - SOUND_BUFFER_SIZE); - tw[i] *= (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1.0 - posloFM) - + NoteVoicePar[nvoice].FMSmp[poshiFM - + 1] * posloFM) * amp - + (1.0 - amp); - posloFM += freqloFM; - if(posloFM >= 1.0) { - posloFM -= 1.0; - poshiFM++; - } - poshiFM += freqhiFM; - poshiFM &= OSCIL_SIZE - 1; - } - oscposhiFM[nvoice][k] = poshiFM; - oscposloFM[nvoice][k] = posloFM; - } - } -} - - - -/* - * Computes the Oscillator (Phase Modulation or Frequency Modulation) - */ -inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, - int FMmode) -{ - int carposhi = 0; - int i, FMmodfreqhi = 0; - REALTYPE FMmodfreqlo = 0, carposlo = 0; - - if(NoteVoicePar[nvoice].FMVoice >= 0) { - //if I use VoiceOut[] as modulator - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - memcpy(tw, NoteVoicePar[NoteVoicePar[nvoice].FMVoice].VoiceOut, - SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - } - } - else { - //Compute the modulator and store it in tmpwave_unison[][] - for(int k = 0; k < unison_size[nvoice]; k++) { - int poshiFM = oscposhiFM[nvoice][k]; - REALTYPE posloFM = oscposloFM[nvoice][k]; - int freqhiFM = oscfreqhiFM[nvoice][k]; - REALTYPE freqloFM = oscfreqloFM[nvoice][k]; - REALTYPE *tw = tmpwave_unison[k]; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - tw[i] = - (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1.0 - posloFM) - + NoteVoicePar[nvoice].FMSmp[poshiFM + 1] * posloFM); - posloFM += freqloFM; - if(posloFM >= 1.0) { - posloFM = fmod(posloFM, 1.0); - poshiFM++; - } - poshiFM += freqhiFM; - poshiFM &= OSCIL_SIZE - 1; - } - oscposhiFM[nvoice][k] = poshiFM; - oscposloFM[nvoice][k] = posloFM; - } - } - // Amplitude interpolation - if(ABOVE_AMPLITUDE_THRESHOLD(FMoldamplitude[nvoice], - FMnewamplitude[nvoice])) { - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tw[i] *= INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - SOUND_BUFFER_SIZE); - ; - } - } - else { - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tw[i] *= FMnewamplitude[nvoice]; - } - } - - - //normalize: makes all sample-rates, oscil_sizes to produce same sound - if(FMmode != 0) { //Frequency modulation - REALTYPE normalize = OSCIL_SIZE / 262144.0 * 44100.0 - / (REALTYPE)SAMPLE_RATE; - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - REALTYPE fmold = FMoldsmp[nvoice][k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - fmold = fmod(fmold + tw[i] * normalize, OSCIL_SIZE); - tw[i] = fmold; - } - FMoldsmp[nvoice][k] = fmold; - } - } - else { //Phase modulation - REALTYPE normalize = OSCIL_SIZE / 262144.0; - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tw[i] *= normalize; - } - } - - //do the modulation - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - int poshi = oscposhi[nvoice][k]; - REALTYPE poslo = oscposlo[nvoice][k]; - int freqhi = oscfreqhi[nvoice][k]; - REALTYPE freqlo = oscfreqlo[nvoice][k]; - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - F2I(tw[i], FMmodfreqhi); - FMmodfreqlo = fmod(tw[i] + 0.0000000001, 1.0); - if(FMmodfreqhi < 0) - FMmodfreqlo++; - - //carrier - carposhi = poshi + FMmodfreqhi; - carposlo = poslo + FMmodfreqlo; - - if(carposlo >= 1.0) { - carposhi++; - carposlo = fmod(carposlo, 1.0); - } - carposhi &= (OSCIL_SIZE - 1); - - tw[i] = NoteVoicePar[nvoice].OscilSmp[carposhi] - * (1.0 - carposlo) - + NoteVoicePar[nvoice].OscilSmp[carposhi - + 1] * carposlo; - - poslo += freqlo; - if(poslo >= 1.0) { - poslo = fmod(poslo, 1.0); - poshi++; - } - - poshi += freqhi; - poshi &= OSCIL_SIZE - 1; - } - oscposhi[nvoice][k] = poshi; - oscposlo[nvoice][k] = poslo; - } -} - - -/*Calculeaza Oscilatorul cu PITCH MODULATION*/ -inline void ADnote::ComputeVoiceOscillatorPitchModulation(int nvoice) -{ -//TODO -} - -/* - * Computes the Noise - */ -inline void ADnote::ComputeVoiceNoise(int nvoice) -{ - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) - tw[i] = RND * 2.0 - 1.0; - } -} - - - -/* - * Compute the ADnote samples - * Returns 0 if the note is finished - */ -int ADnote::noteout(REALTYPE *outl, REALTYPE *outr) -{ - int i, nvoice; - - memcpy(outl, denormalkillbuf, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - memcpy(outr, denormalkillbuf, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - - if(NoteEnabled == OFF) - return 0; - - memset(bypassl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - memset(bypassr, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - computecurrentparameters(); - - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if((NoteVoicePar[nvoice].Enabled != ON) - || (NoteVoicePar[nvoice].DelayTicks > 0)) - continue; - if(NoteVoicePar[nvoice].noisetype == 0) //voice mode=sound - switch(NoteVoicePar[nvoice].FMEnabled) { - case MORPH: - ComputeVoiceOscillatorMorph(nvoice); - break; - case RING_MOD: - ComputeVoiceOscillatorRingModulation(nvoice); - break; - case PHASE_MOD: - ComputeVoiceOscillatorFrequencyModulation(nvoice, 0); - break; - case FREQ_MOD: - ComputeVoiceOscillatorFrequencyModulation(nvoice, 1); - break; - //case PITCH_MOD:ComputeVoiceOscillatorPitchModulation(nvoice);break; - default: - ComputeVoiceOscillator_LinearInterpolation(nvoice); - //if (config.cfg.Interpolation) ComputeVoiceOscillator_CubicInterpolation(nvoice); - } - else - ComputeVoiceNoise(nvoice); - // Voice Processing - - - //mix subvoices into voice - memset(tmpwavel, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - if(stereo) - memset(tmpwaver, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - for(int k = 0; k < unison_size[nvoice]; k++) { - REALTYPE *tw = tmpwave_unison[k]; - if(stereo) { - REALTYPE stereo_pos = 0; - if(unison_size[nvoice] > 1) - stereo_pos = k - / (REALTYPE)(unison_size[nvoice] - - 1) * 2.0 - 1.0; - REALTYPE stereo_spread = unison_stereo_spread[nvoice] * 2.0; //between 0 and 2.0 - if(stereo_spread > 1.0) { - REALTYPE stereo_pos_1 = (stereo_pos >= 0.0) ? 1.0 : -1.0; - stereo_pos = - (2.0 - - stereo_spread) * stereo_pos - + (stereo_spread - 1.0) * stereo_pos_1; - } - else - stereo_pos *= stereo_spread; - ; - if(unison_size[nvoice] == 1) - stereo_pos = 0.0; - REALTYPE panning = (stereo_pos + 1.0) * 0.5; - - - REALTYPE lvol = (1.0 - panning) * 2.0; - if(lvol > 1.0) - lvol = 1.0; - - REALTYPE rvol = panning * 2.0; - if(rvol > 1.0) - rvol = 1.0; - - if(unison_invert_phase[nvoice][k]) { - lvol = -lvol; - rvol = -rvol; - } - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwavel[i] += tw[i] * lvol; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwaver[i] += tw[i] * rvol; - } - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwavel[i] += tw[i]; - ; - } - - - REALTYPE unison_amplitude = 1.0 / sqrt(unison_size[nvoice]); //reduce the amplitude for large unison sizes - // Amplitude - REALTYPE oldam = oldamplitude[nvoice] * unison_amplitude; - REALTYPE newam = newamplitude[nvoice] * unison_amplitude; - - if(ABOVE_AMPLITUDE_THRESHOLD(oldam, newam)) { - int rest = SOUND_BUFFER_SIZE; - //test if the amplitude if raising and the difference is high - if((newam > oldam) && ((newam - oldam) > 0.25)) { - rest = 10; - if(rest > SOUND_BUFFER_SIZE) - rest = SOUND_BUFFER_SIZE; - for(int i = 0; i < SOUND_BUFFER_SIZE - rest; i++) - tmpwavel[i] *= oldam; - if(stereo) - for(int i = 0; i < SOUND_BUFFER_SIZE - rest; i++) - tmpwaver[i] *= oldam; - } - // Amplitude interpolation - for(i = 0; i < rest; i++) { - REALTYPE amp = INTERPOLATE_AMPLITUDE(oldam, newam, i, rest); - tmpwavel[i + (SOUND_BUFFER_SIZE - rest)] *= amp; - if(stereo) - tmpwaver[i + (SOUND_BUFFER_SIZE - rest)] *= amp; - } - } - else { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwavel[i] *= newam; - if(stereo) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwaver[i] *= newam; - } - - // Fade in - if(firsttick[nvoice] != 0) { - fadein(&tmpwavel[0]); - if(stereo) - fadein(&tmpwaver[0]); - firsttick[nvoice] = 0; - } - - - // Filter - if(NoteVoicePar[nvoice].VoiceFilterL != NULL) - NoteVoicePar[nvoice].VoiceFilterL->filterout(&tmpwavel[0]); - if((stereo) && (NoteVoicePar[nvoice].VoiceFilterR != NULL)) - NoteVoicePar[nvoice].VoiceFilterR->filterout(&tmpwaver[0]); - - //check if the amplitude envelope is finished, if yes, the voice will be fadeout - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) { - if(NoteVoicePar[nvoice].AmpEnvelope->finished() != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwavel[i] *= 1.0 - (REALTYPE)i - / (REALTYPE)SOUND_BUFFER_SIZE; - if(stereo) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmpwaver[i] *= 1.0 - (REALTYPE)i - / (REALTYPE)SOUND_BUFFER_SIZE; - } - //the voice is killed later - } - - - // Put the ADnote samples in VoiceOut (without appling Global volume, because I wish to use this voice as a modullator) - if(NoteVoicePar[nvoice].VoiceOut != NULL) { - if(stereo) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - NoteVoicePar[nvoice].VoiceOut[i] = tmpwavel[i] - + tmpwaver[i]; - else //mono - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - NoteVoicePar[nvoice].VoiceOut[i] = tmpwavel[i]; - ; - } - - - // Add the voice that do not bypass the filter to out - if(NoteVoicePar[nvoice].filterbypass == 0) { //no bypass - if(stereo) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //stereo - outl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume - * NoteVoicePar[nvoice].Panning * 2.0; - outr[i] += tmpwaver[i] * NoteVoicePar[nvoice].Volume - * (1.0 - NoteVoicePar[nvoice].Panning) * 2.0; - } - } - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - outl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume; //mono - ; - } - else { //bypass the filter - if(stereo) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //stereo - bypassl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume - * NoteVoicePar[nvoice].Panning * 2.0; - bypassr[i] += tmpwaver[i] * NoteVoicePar[nvoice].Volume - * (1.0 - NoteVoicePar[nvoice].Panning) * 2.0; - } - } - else - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - bypassl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume; //mono - ; - } - // chech if there is necesary to proces the voice longer (if the Amplitude envelope isn't finished) - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - if(NoteVoicePar[nvoice].AmpEnvelope->finished() != 0) - KillVoice(nvoice); - ; - } - - - //Processing Global parameters - NoteGlobalPar.GlobalFilterL->filterout(&outl[0]); - - if(stereo == 0) { //set the right channel=left channel - memcpy(outr, outl, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - memcpy(bypassr, bypassl, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - } - else - NoteGlobalPar.GlobalFilterR->filterout(&outr[0]); - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] += bypassl[i]; - outr[i] += bypassr[i]; - } - - if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) { - // Amplitude Interpolation - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, - globalnewamplitude, - i, - SOUND_BUFFER_SIZE); - outl[i] *= tmpvol * NoteGlobalPar.Panning; - outr[i] *= tmpvol * (1.0 - NoteGlobalPar.Panning); - } - } - else { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; - outr[i] *= globalnewamplitude * (1.0 - NoteGlobalPar.Panning); - } - } - -//Apply the punch - if(NoteGlobalPar.Punch.Enabled != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE punchamp = NoteGlobalPar.Punch.initialvalue - * NoteGlobalPar.Punch.t + 1.0; - outl[i] *= punchamp; - outr[i] *= punchamp; - NoteGlobalPar.Punch.t -= NoteGlobalPar.Punch.dt; - if(NoteGlobalPar.Punch.t < 0.0) { - NoteGlobalPar.Punch.Enabled = 0; - break; - } - } - } - - - // Apply legato-specific sound signal modifications - if(Legato.silent) // Silencer - if(Legato.msg != LM_FadeIn) { - memset(outl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - memset(outr, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - } - switch(Legato.msg) { - case LM_CatchUp: // Continue the catch-up... - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //Yea, could be done without the loop... - Legato.decounter--; - if(Legato.decounter < 1) { - // Catching-up done, we can finally set - // the note to the actual parameters. - Legato.decounter = -10; - Legato.msg = LM_ToNorm; - ADlegatonote(Legato.param.freq, - Legato.param.vel, - Legato.param.portamento, - Legato.param.midinote, - false); - break; - } - } - break; - case LM_FadeIn: // Fade-in - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - Legato.silent = false; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - Legato.decounter--; - if(Legato.decounter < 1) { - Legato.decounter = -10; - Legato.msg = LM_Norm; - break; - } - Legato.fade.m += Legato.fade.step; - outl[i] *= Legato.fade.m; - outr[i] *= Legato.fade.m; - } - break; - case LM_FadeOut: // Fade-out, then set the catch-up - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - Legato.decounter--; - if(Legato.decounter < 1) { - for(int j = i; j < SOUND_BUFFER_SIZE; j++) { - outl[j] = 0.0; - outr[j] = 0.0; - } - Legato.decounter = -10; - Legato.silent = true; - // Fading-out done, now set the catch-up : - Legato.decounter = Legato.fade.length; - Legato.msg = LM_CatchUp; - REALTYPE catchupfreq = Legato.param.freq - * (Legato.param.freq / Legato.lastfreq); //This freq should make this now silent note to catch-up (or should I say resync ?) with the heard note for the same length it stayed at the previous freq during the fadeout. - ADlegatonote(catchupfreq, - Legato.param.vel, - Legato.param.portamento, - Legato.param.midinote, - false); - break; - } - Legato.fade.m -= Legato.fade.step; - outl[i] *= Legato.fade.m; - outr[i] *= Legato.fade.m; - } - break; - default: - break; - } - - -// Check if the global amplitude is finished. -// If it does, disable the note - if(NoteGlobalPar.AmpEnvelope->finished() != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out - REALTYPE tmp = 1.0 - (REALTYPE)i / (REALTYPE)SOUND_BUFFER_SIZE; - outl[i] *= tmp; - outr[i] *= tmp; - } - KillNote(); - } - return 1; -} - - -/* - * Relase the key (NoteOff) - */ -void ADnote::relasekey() -{ - int nvoice; - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - if(NoteVoicePar[nvoice].Enabled == 0) - continue; - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - NoteVoicePar[nvoice].AmpEnvelope->relasekey(); - if(NoteVoicePar[nvoice].FreqEnvelope != NULL) - NoteVoicePar[nvoice].FreqEnvelope->relasekey(); - if(NoteVoicePar[nvoice].FilterEnvelope != NULL) - NoteVoicePar[nvoice].FilterEnvelope->relasekey(); - if(NoteVoicePar[nvoice].FMFreqEnvelope != NULL) - NoteVoicePar[nvoice].FMFreqEnvelope->relasekey(); - if(NoteVoicePar[nvoice].FMAmpEnvelope != NULL) - NoteVoicePar[nvoice].FMAmpEnvelope->relasekey(); - } - NoteGlobalPar.FreqEnvelope->relasekey(); - NoteGlobalPar.FilterEnvelope->relasekey(); - NoteGlobalPar.AmpEnvelope->relasekey(); -} - -/* - * Check if the note is finished - */ -int ADnote::finished() const -{ - if(NoteEnabled == ON) - return 0; - else - return 1; -} - diff --git a/plugins/zynaddsubfx/src/Synth/ADnote.h b/plugins/zynaddsubfx/src/Synth/ADnote.h deleted file mode 100644 index 9f494a906..000000000 --- a/plugins/zynaddsubfx/src/Synth/ADnote.h +++ /dev/null @@ -1,349 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnote.h - The "additive" synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef AD_NOTE_H -#define AD_NOTE_H - -#include "../globals.h" -#include "Envelope.h" -#include "LFO.h" -#include "../DSP/Filter.h" -#include "../Params/ADnoteParameters.h" -#include "../Params/Controller.h" - -//Globals - -/**FM amplitude tune*/ -#define FM_AMP_MULTIPLIER 14.71280603 - -#define OSCIL_SMP_EXTRA_SAMPLES 5 - -/**The "additive" synthesizer*/ -class ADnote //ADDitive note -{ - public: - /**Constructor. - * @param pars Note Parameters - * @param ctl_ Pointer to system Controller - * @param freq Base frequency for note - * @param velocity Velocity of note - * @param portamento_ 1 if the note has portamento - * @param midinote_ The midi number of the note - * @param besilent Start silent note if true*/ - ADnote(ADnoteParameters *pars, Controller *ctl_, REALTYPE freq, - REALTYPE velocity, int portamento_, int midinote_, - bool besilent); - /**Destructor*/ - ~ADnote(); - - /**Alters the playing note for legato effect*/ - void ADlegatonote(REALTYPE freq, REALTYPE velocity, int portamento_, - int midinote_, bool externcall); - - /**Compute ADnote Samples. - * @return 0 if note is finished*/ - int noteout(REALTYPE *outl, REALTYPE *outr); - - /**Release the key for the note and start release portion of envelopes.*/ - void relasekey(); - /**Return if note is finished. - * @return finished=1 unfinished=0*/ - int finished() const; - - - /**Nonzero when ready for output(the parameters has been computed) - * zero when parameters need to be computed.*/ - char ready; - - private: - - /**Changes the frequency of an oscillator. - * @param nvoice voice to run computations on - * @param in_freq new frequency*/ - void setfreq(int nvoice, REALTYPE in_freq); - /**Set the frequency of the modulator oscillator*/ - void setfreqFM(int nvoice, REALTYPE in_freq); - /**Computes relative frequency for unison and unison's vibratto. - * Note: Must be called before setfreq* functions.*/ - void compute_unison_freq_rap(int nvoice); - /**Compute parameters for next tick*/ - void computecurrentparameters(); - /**Initializes All Parameters*/ - void initparameters(); - /**Deallocate/Cleanup given voice*/ - void KillVoice(int nvoice); - /**Deallocate Note resources and voice resources*/ - void KillNote(); - /**Get the Voice's base frequency*/ - inline REALTYPE getvoicebasefreq(int nvoice) const; - /**Get modulator's base frequency*/ - inline REALTYPE getFMvoicebasefreq(int nvoice) const; - /**Compute the Oscillator's samples. - * Affects tmpwave_unison and updates oscposhi/oscposlo*/ - inline void ComputeVoiceOscillator_LinearInterpolation(int nvoice); - /**Compute the Oscillator's samples. - * Affects tmpwave_unison and updates oscposhi/oscposlo - * @todo remove this declaration if it is commented out*/ - inline void ComputeVoiceOscillator_CubicInterpolation(int nvoice); - /**Computes the Oscillator samples with morphing. - * updates tmpwave_unison*/ - inline void ComputeVoiceOscillatorMorph(int nvoice); - /**Computes the Ring Modulated Oscillator.*/ - inline void ComputeVoiceOscillatorRingModulation(int nvoice); - /**Computes the Frequency Modulated Oscillator. - * @param FMmode modulation type 0=Phase 1=Frequency*/ - inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice, - int FMmode); //FMmode=0 for phase modulation, 1 for Frequency modulation - // inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice); - /**TODO*/ - inline void ComputeVoiceOscillatorPitchModulation(int nvoice); - - /**Generate Noise Samples for Voice*/ - inline void ComputeVoiceNoise(int nvoice); - - /**Fadein in a way that removes clicks but keep sound "punchy"*/ - inline void fadein(REALTYPE *smps) const; - - - //GLOBALS - ADnoteParameters *partparams; - unsigned char stereo; //if the note is stereo (allows note Panning) - int midinote; - REALTYPE velocity, basefreq; - - ONOFFTYPE NoteEnabled; - Controller *ctl; - - /*****************************************************************/ - /* GLOBAL PARAMETERS */ - /*****************************************************************/ - - struct ADnoteGlobal { - /****************************************** - * FREQUENCY GLOBAL PARAMETERS * - ******************************************/ - REALTYPE Detune; //cents - - Envelope *FreqEnvelope; - LFO *FreqLfo; - - /******************************************** - * AMPLITUDE GLOBAL PARAMETERS * - ********************************************/ - REALTYPE Volume; // [ 0 .. 1 ] - - REALTYPE Panning; // [ 0 .. 1 ] - - Envelope *AmpEnvelope; - LFO *AmpLfo; - - struct { - int Enabled; - REALTYPE initialvalue, dt, t; - } Punch; - - /****************************************** - * FILTER GLOBAL PARAMETERS * - ******************************************/ - Filter *GlobalFilterL, *GlobalFilterR; - - REALTYPE FilterCenterPitch; //octaves - REALTYPE FilterQ; - REALTYPE FilterFreqTracking; - - Envelope *FilterEnvelope; - - LFO *FilterLfo; - } NoteGlobalPar; - - - - /***********************************************************/ - /* VOICE PARAMETERS */ - /***********************************************************/ - struct ADnoteVoice { - /* If the voice is enabled */ - ONOFFTYPE Enabled; - - /* Voice Type (sound/noise)*/ - int noisetype; - - /* Filter Bypass */ - int filterbypass; - - /* Delay (ticks) */ - int DelayTicks; - - /* Waveform of the Voice */ - REALTYPE *OscilSmp; - - /************************************ - * FREQUENCY PARAMETERS * - ************************************/ - int fixedfreq; //if the frequency is fixed to 440 Hz - int fixedfreqET; //if the "fixed" frequency varies according to the note (ET) - - // cents = basefreq*VoiceDetune - REALTYPE Detune, FineDetune; - - Envelope *FreqEnvelope; - LFO *FreqLfo; - - - /*************************** - * AMPLITUDE PARAMETERS * - ***************************/ - - /* Panning 0.0=left, 0.5 - center, 1.0 = right */ - REALTYPE Panning; - REALTYPE Volume; // [-1.0 .. 1.0] - - Envelope *AmpEnvelope; - LFO *AmpLfo; - - /************************* - * FILTER PARAMETERS * - *************************/ - - Filter *VoiceFilterL; - Filter *VoiceFilterR; - - REALTYPE FilterCenterPitch; /* Filter center Pitch*/ - REALTYPE FilterFreqTracking; - - Envelope *FilterEnvelope; - LFO *FilterLfo; - - - /**************************** - * MODULLATOR PARAMETERS * - ****************************/ - - FMTYPE FMEnabled; - - int FMVoice; - - // Voice Output used by other voices if use this as modullator - REALTYPE *VoiceOut; - - /* Wave of the Voice */ - REALTYPE *FMSmp; - - REALTYPE FMVolume; - REALTYPE FMDetune; //in cents - - Envelope *FMFreqEnvelope; - Envelope *FMAmpEnvelope; - } NoteVoicePar[NUM_VOICES]; - - - /********************************************************/ - /* INTERNAL VALUES OF THE NOTE AND OF THE VOICES */ - /********************************************************/ - - //time from the start of the note - REALTYPE time; - - //the size of unison for a single voice - int unison_size[NUM_VOICES]; - - //the stereo spread of the unison subvoices (0.0=mono,1.0=max) - REALTYPE unison_stereo_spread[NUM_VOICES]; - - //fractional part (skip) - REALTYPE *oscposlo[NUM_VOICES], *oscfreqlo[NUM_VOICES]; - - //integer part (skip) - int *oscposhi[NUM_VOICES], *oscfreqhi[NUM_VOICES]; - - //fractional part (skip) of the Modullator - REALTYPE *oscposloFM[NUM_VOICES], *oscfreqloFM[NUM_VOICES]; - - //the unison base_value - REALTYPE *unison_base_freq_rap[NUM_VOICES]; - - //how the unison subvoice's frequency is changed (1.0 for no change) - REALTYPE *unison_freq_rap[NUM_VOICES]; - - //which subvoice has phase inverted - bool *unison_invert_phase[NUM_VOICES]; - - //unison vibratto - struct { - REALTYPE amplitude; //amplitude which be added to unison_freq_rap - REALTYPE *step; //value which increments the position - REALTYPE *position; //between -1.0 and 1.0 - } unison_vibratto[NUM_VOICES]; - - - //integer part (skip) of the Modullator - unsigned int *oscposhiFM[NUM_VOICES], *oscfreqhiFM[NUM_VOICES]; - - //used to compute and interpolate the amplitudes of voices and modullators - REALTYPE oldamplitude[NUM_VOICES], - newamplitude[NUM_VOICES], - FMoldamplitude[NUM_VOICES], - FMnewamplitude[NUM_VOICES]; - - //used by Frequency Modulation (for integration) - REALTYPE *FMoldsmp[NUM_VOICES]; - - //temporary buffer - REALTYPE *tmpwavel; - REALTYPE *tmpwaver; - int max_unison; - REALTYPE **tmpwave_unison; - - //Filter bypass samples - REALTYPE *bypassl, *bypassr; - - //interpolate the amplitudes - REALTYPE globaloldamplitude, globalnewamplitude; - - //1 - if it is the fitst tick (used to fade in the sound) - char firsttick[NUM_VOICES]; - - //1 if the note has portamento - int portamento; - - //how the fine detunes are made bigger or smaller - REALTYPE bandwidthDetuneMultiplier; - - // Legato vars - struct { - bool silent; - REALTYPE lastfreq; - LegatoMsg msg; - int decounter; - struct { // Fade In/Out vars - int length; - REALTYPE m, step; - } fade; - struct { // Note parameters - REALTYPE freq, vel; - int portamento, midinote; - } param; - } Legato; -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/CMakeLists.txt b/plugins/zynaddsubfx/src/Synth/CMakeLists.txt deleted file mode 100644 index 486554b9f..000000000 --- a/plugins/zynaddsubfx/src/Synth/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(zynaddsubfx_synth_SRCS - ADnote.cpp - Envelope.cpp - LFO.cpp - OscilGen.cpp - PADnote.cpp - Resonance.cpp - SUBnote.cpp -) - -add_library(zynaddsubfx_synth STATIC - ${zynaddsubfx_synth_SRCS} - ) - -target_link_libraries(zynaddsubfx_synth) - diff --git a/plugins/zynaddsubfx/src/Synth/Envelope.cpp b/plugins/zynaddsubfx/src/Synth/Envelope.cpp deleted file mode 100644 index 86ea3119c..000000000 --- a/plugins/zynaddsubfx/src/Synth/Envelope.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Envelope.cpp - Envelope implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Envelope.h" -#include "../Params/EnvelopeParams.h" - -Envelope::Envelope(EnvelopeParams *envpars, REALTYPE basefreq) -{ - int i; - envpoints = envpars->Penvpoints; - if(envpoints > MAX_ENVELOPE_POINTS) - envpoints = MAX_ENVELOPE_POINTS; - envsustain = (envpars->Penvsustain == 0) ? -1 : envpars->Penvsustain; - forcedrelase = envpars->Pforcedrelease; - envstretch = pow(440.0 / basefreq, envpars->Penvstretch / 64.0); - linearenvelope = envpars->Plinearenvelope; - - if(envpars->Pfreemode == 0) - envpars->converttofree(); - - REALTYPE bufferdt = SOUND_BUFFER_SIZE / (REALTYPE)SAMPLE_RATE; - - int mode = envpars->Envmode; - - //for amplitude envelopes - if((mode == 1) && (linearenvelope == 0)) - mode = 2; //change to log envelope - if((mode == 2) && (linearenvelope != 0)) - mode = 1; //change to linear - - for(i = 0; i < MAX_ENVELOPE_POINTS; i++) { - REALTYPE tmp = envpars->getdt(i) / 1000.0 * envstretch; - if(tmp > bufferdt) - envdt[i] = bufferdt / tmp; - else - envdt[i] = 2.0; //any value larger than 1 - - switch(mode) { - case 2: - envval[i] = (1.0 - envpars->Penvval[i] / 127.0) * -40; - break; - case 3: - envval[i] = - (pow(2, 6.0 - * fabs(envpars->Penvval[i] - 64.0) / 64.0) - 1.0) * 100.0; - if(envpars->Penvval[i] < 64) - envval[i] = -envval[i]; - break; - case 4: - envval[i] = (envpars->Penvval[i] - 64.0) / 64.0 * 6.0; //6 octaves (filtru) - break; - case 5: - envval[i] = (envpars->Penvval[i] - 64.0) / 64.0 * 10; - break; - default: - envval[i] = envpars->Penvval[i] / 127.0; - } - } - - envdt[0] = 1.0; - - currentpoint = 1; //the envelope starts from 1 - keyreleased = 0; - t = 0.0; - envfinish = 0; - inct = envdt[1]; - envoutval = 0.0; -} - -Envelope::~Envelope() -{} - - -/* - * Relase the key (note envelope) - */ -void Envelope::relasekey() -{ - if(keyreleased == 1) - return; - keyreleased = 1; - if(forcedrelase != 0) - t = 0.0; -} - -/* - * Envelope Output - */ -REALTYPE Envelope::envout() -{ - REALTYPE out; - - if(envfinish != 0) { //if the envelope is finished - envoutval = envval[envpoints - 1]; - return envoutval; - } - if((currentpoint == envsustain + 1) && (keyreleased == 0)) { //if it is sustaining now - envoutval = envval[envsustain]; - return envoutval; - } - - if((keyreleased != 0) && (forcedrelase != 0)) { //do the forced release - int tmp = (envsustain < 0) ? (envpoints - 1) : (envsustain + 1); //if there is no sustain point, use the last point for release - - if(envdt[tmp] < 0.00000001) - out = envval[tmp]; - else - out = envoutval + (envval[tmp] - envoutval) * t; - t += envdt[tmp] * envstretch; - - if(t >= 1.0) { - currentpoint = envsustain + 2; - forcedrelase = 0; - t = 0.0; - inct = envdt[currentpoint]; - if((currentpoint >= envpoints) || (envsustain < 0)) - envfinish = 1; - } - return out; - } - if(inct >= 1.0) - out = envval[currentpoint]; - else - out = - envval[currentpoint - - 1] + (envval[currentpoint] - envval[currentpoint - 1]) * t; - - t += inct; - if(t >= 1.0) { - if(currentpoint >= envpoints - 1) - envfinish = 1; - else - currentpoint++; - t = 0.0; - inct = envdt[currentpoint]; - } - - envoutval = out; - return out; -} - -/* - * Envelope Output (dB) - */ -REALTYPE Envelope::envout_dB() -{ - REALTYPE out; - if(linearenvelope != 0) - return envout(); - - if((currentpoint == 1) && ((keyreleased == 0) || (forcedrelase == 0))) { //first point is always lineary interpolated - REALTYPE v1 = dB2rap(envval[0]); - REALTYPE v2 = dB2rap(envval[1]); - out = v1 + (v2 - v1) * t; - - t += inct; - if(t >= 1.0) { - t = 0.0; - inct = envdt[2]; - currentpoint++; - out = v2; - } - - if(out > 0.001) - envoutval = rap2dB(out); - else - envoutval = MIN_ENVELOPE_DB; - } - else - out = dB2rap(envout()); - - return out; -} - -int Envelope::finished() -{ - return envfinish; -} - diff --git a/plugins/zynaddsubfx/src/Synth/Envelope.h b/plugins/zynaddsubfx/src/Synth/Envelope.h deleted file mode 100644 index dc3b6f259..000000000 --- a/plugins/zynaddsubfx/src/Synth/Envelope.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Envelope.h - Envelope implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ENVELOPE_H -#define ENVELOPE_H - -#include "../globals.h" -#include "../Params/EnvelopeParams.h" - -/**Implementation of a general Envelope*/ -class Envelope -{ - public: - - /**Constructor*/ - Envelope(class EnvelopeParams *envpars, REALTYPE basefreq); - /**Destructor*/ - ~Envelope(); - void relasekey(); - REALTYPE envout(); - REALTYPE envout_dB(); - /**Determines the status of the Envelope - * - *\todo see if this can be changed to use a boolean - * @return returns 1 if the envelope is finished*/ - int finished(); - private: - int envpoints; - int envsustain; //"-1" means disabled - REALTYPE envdt[MAX_ENVELOPE_POINTS]; //millisecons - REALTYPE envval[MAX_ENVELOPE_POINTS]; // [0.0 .. 1.0] - REALTYPE envstretch; - int linearenvelope; - - int currentpoint; //current envelope point (starts from 1) - int forcedrelase; - char keyreleased; //if the key was released /** \todo figure out WHY IS THIS A CHAR*/ - char envfinish; /** \todo figure out WHY IS THIS A CHAR*/ - REALTYPE t; // the time from the last point - REALTYPE inct; // the time increment - REALTYPE envoutval; //used to do the forced release -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/LFO.cpp b/plugins/zynaddsubfx/src/Synth/LFO.cpp deleted file mode 100644 index 6dcf47f9f..000000000 --- a/plugins/zynaddsubfx/src/Synth/LFO.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFO.cpp - LFO implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include - -#include "LFO.h" - - -LFO::LFO(LFOParams *lfopars, REALTYPE basefreq) -{ - if(lfopars->Pstretch == 0) - lfopars->Pstretch = 1; - REALTYPE lfostretch = pow(basefreq / 440.0, - (lfopars->Pstretch - 64.0) / 63.0); //max 2x/octave - - REALTYPE lfofreq = - (pow(2, lfopars->Pfreq * 10.0) - 1.0) / 12.0 * lfostretch; - incx = fabs(lfofreq) * (REALTYPE)SOUND_BUFFER_SIZE / (REALTYPE)SAMPLE_RATE; - - if(lfopars->Pcontinous == 0) { - if(lfopars->Pstartphase == 0) - x = RND; - else - x = fmod((lfopars->Pstartphase - 64.0) / 127.0 + 1.0, 1.0); - } - else { - REALTYPE tmp = fmod(lfopars->time * incx, 1.0); - x = fmod((lfopars->Pstartphase - 64.0) / 127.0 + 1.0 + tmp, 1.0); - } - - //Limit the Frequency(or else...) - if(incx > 0.49999999) - incx = 0.499999999; - - - lfornd = lfopars->Prandomness / 127.0; - if(lfornd < 0.0) - lfornd = 0.0; - else - if(lfornd > 1.0) - lfornd = 1.0; - -// lfofreqrnd=pow(lfopars->Pfreqrand/127.0,2.0)*2.0*4.0; - lfofreqrnd = pow(lfopars->Pfreqrand / 127.0, 2.0) * 4.0; - - switch(lfopars->fel) { - case 1: - lfointensity = lfopars->Pintensity / 127.0; - break; - case 2: - lfointensity = lfopars->Pintensity / 127.0 * 4.0; - break; //in octave - default: - lfointensity = pow(2, lfopars->Pintensity / 127.0 * 11.0) - 1.0; //in centi - x -= 0.25; //chance the starting phase - break; - } - - amp1 = (1 - lfornd) + lfornd * RND; - amp2 = (1 - lfornd) + lfornd * RND; - lfotype = lfopars->PLFOtype; - lfodelay = lfopars->Pdelay / 127.0 * 4.0; //0..4 sec - incrnd = nextincrnd = 1.0; - freqrndenabled = (lfopars->Pfreqrand != 0); - computenextincrnd(); - computenextincrnd(); //twice because I want incrnd & nextincrnd to be random -} - -LFO::~LFO() -{} - -/* - * LFO out - */ -REALTYPE LFO::lfoout() -{ - REALTYPE out; - switch(lfotype) { - case 1: //LFO_TRIANGLE - if((x >= 0.0) && (x < 0.25)) - out = 4.0 * x; - else - if((x > 0.25) && (x < 0.75)) - out = 2 - 4 * x; - else - out = 4.0 * x - 4.0; - break; - case 2: //LFO_SQUARE - if(x < 0.5) - out = -1; - else - out = 1; - break; - case 3: //LFO_RAMPUP - out = (x - 0.5) * 2.0; - break; - case 4: //LFO_RAMPDOWN - out = (0.5 - x) * 2.0; - break; - case 5: //LFO_EXP_DOWN 1 - out = pow(0.05, x) * 2.0 - 1.0; - break; - case 6: //LFO_EXP_DOWN 2 - out = pow(0.001, x) * 2.0 - 1.0; - break; - default: - out = cos(x * 2.0 * PI); //LFO_SINE - } - - - if((lfotype == 0) || (lfotype == 1)) - out *= lfointensity * (amp1 + x * (amp2 - amp1)); - else - out *= lfointensity * amp2; - if(lfodelay < 0.00001) { - if(freqrndenabled == 0) - x += incx; - else { - float tmp = (incrnd * (1.0 - x) + nextincrnd * x); - if(tmp > 1.0) - tmp = 1.0; - else - if(tmp < 0.0) - tmp = 0.0; - x += incx * tmp; - } - if(x >= 1) { - x = fmod(x, 1.0); - amp1 = amp2; - amp2 = (1 - lfornd) + lfornd * RND; - - computenextincrnd(); - } - } - else - lfodelay -= (REALTYPE)SOUND_BUFFER_SIZE / (REALTYPE)SAMPLE_RATE; - return out; -} - -/* - * LFO out (for amplitude) - */ -REALTYPE LFO::amplfoout() -{ - REALTYPE out; - out = 1.0 - lfointensity + lfoout(); - if(out < -1.0) - out = -1.0; - else - if(out > 1.0) - out = 1.0; - return out; -} - - -void LFO::computenextincrnd() -{ - if(freqrndenabled == 0) - return; - incrnd = nextincrnd; - nextincrnd = pow(0.5, lfofreqrnd) + RND * (pow(2.0, lfofreqrnd) - 1.0); -} - diff --git a/plugins/zynaddsubfx/src/Synth/LFO.h b/plugins/zynaddsubfx/src/Synth/LFO.h deleted file mode 100644 index 9dd984bcf..000000000 --- a/plugins/zynaddsubfx/src/Synth/LFO.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFO.h - LFO implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef LFO_H -#define LFO_H - -#include "../globals.h" -#include "../Params/LFOParams.h" - -/**Class for creating Low Frequency Ocillators*/ -class LFO -{ - public: - /**Constructor - * - * @param lfopars pointer to a LFOParams object - * @param basefreq base frequency of LFO - */ - LFO(LFOParams *lfopars, REALTYPE basefreq); - /**Deconstructor*/ - ~LFO(); - REALTYPE lfoout(); - REALTYPE amplfoout(); - private: - REALTYPE x; - REALTYPE incx, incrnd, nextincrnd; - REALTYPE amp1, amp2; // used for randomness - REALTYPE lfointensity; - REALTYPE lfornd, lfofreqrnd; - REALTYPE lfodelay; - /**\todo see if an enum would be better here*/ - char lfotype; - int freqrndenabled; - - - void computenextincrnd(); -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/OscilGen.cpp b/plugins/zynaddsubfx/src/Synth/OscilGen.cpp deleted file mode 100644 index 47a1ec253..000000000 --- a/plugins/zynaddsubfx/src/Synth/OscilGen.cpp +++ /dev/null @@ -1,1475 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OscilGen.cpp - Waveform generator for ADnote - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include - -#include "OscilGen.h" -#include "../Effects/Distorsion.h" - -OscilGen::OscilGen(FFTwrapper *fft_, Resonance *res_):Presets() -{ - setpresettype("Poscilgen"); - fft = fft_; - res = res_; - - tmpsmps = new REALTYPE[OSCIL_SIZE]; - newFFTFREQS(&outoscilFFTfreqs, OSCIL_SIZE / 2); - newFFTFREQS(&oscilFFTfreqs, OSCIL_SIZE / 2); - newFFTFREQS(&basefuncFFTfreqs, OSCIL_SIZE / 2); - - randseed = 1; - ADvsPAD = false; - - defaults(); -} - -OscilGen::~OscilGen() -{ - delete[] tmpsmps; - deleteFFTFREQS(&outoscilFFTfreqs); - deleteFFTFREQS(&basefuncFFTfreqs); - deleteFFTFREQS(&oscilFFTfreqs); -} - - -void OscilGen::defaults() -{ - oldbasefunc = 0; - oldbasepar = 64; - oldhmagtype = 0; - oldwaveshapingfunction = 0; - oldwaveshaping = 64; - oldbasefuncmodulation = 0; - oldharmonicshift = 0; - oldbasefuncmodulationpar1 = 0; - oldbasefuncmodulationpar2 = 0; - oldbasefuncmodulationpar3 = 0; - oldmodulation = 0; - oldmodulationpar1 = 0; - oldmodulationpar2 = 0; - oldmodulationpar3 = 0; - - for(int i = 0; i < MAX_AD_HARMONICS; i++) { - hmag[i] = 0.0; - hphase[i] = 0.0; - Phmag[i] = 64; - Phphase[i] = 64; - } - Phmag[0] = 127; - Phmagtype = 0; - if(ADvsPAD) - Prand = 127; //max phase randomness (usefull if the oscil will be imported to a ADsynth from a PADsynth - else - Prand = 64; //no randomness - - Pcurrentbasefunc = 0; - Pbasefuncpar = 64; - - Pbasefuncmodulation = 0; - Pbasefuncmodulationpar1 = 64; - Pbasefuncmodulationpar2 = 64; - Pbasefuncmodulationpar3 = 32; - - Pmodulation = 0; - Pmodulationpar1 = 64; - Pmodulationpar2 = 64; - Pmodulationpar3 = 32; - - Pwaveshapingfunction = 0; - Pwaveshaping = 64; - Pfiltertype = 0; - Pfilterpar1 = 64; - Pfilterpar2 = 64; - Pfilterbeforews = 0; - Psatype = 0; - Psapar = 64; - - Pamprandpower = 64; - Pamprandtype = 0; - - Pharmonicshift = 0; - Pharmonicshiftfirst = 0; - - Padaptiveharmonics = 0; - Padaptiveharmonicspower = 100; - Padaptiveharmonicsbasefreq = 128; - Padaptiveharmonicspar = 50; - - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - oscilFFTfreqs.s[i] = 0.0; - oscilFFTfreqs.c[i] = 0.0; - basefuncFFTfreqs.s[i] = 0.0; - basefuncFFTfreqs.c[i] = 0.0; - } - oscilprepared = 0; - oldfilterpars = 0; - oldsapars = 0; - prepare(); -} - -void OscilGen::convert2sine(int magtype) -{ - REALTYPE mag[MAX_AD_HARMONICS], phase[MAX_AD_HARMONICS]; - REALTYPE oscil[OSCIL_SIZE]; - FFTFREQS freqs; - newFFTFREQS(&freqs, OSCIL_SIZE / 2); - - get(oscil, -1.0); - FFTwrapper *fft = new FFTwrapper(OSCIL_SIZE); - fft->smps2freqs(oscil, freqs); - delete (fft); - - REALTYPE max = 0.0; - - mag[0] = 0; - phase[0] = 0; - for(int i = 0; i < MAX_AD_HARMONICS; i++) { - mag[i] = sqrt(pow(freqs.s[i + 1], 2) + pow(freqs.c[i + 1], 2.0)); - phase[i] = atan2(freqs.c[i + 1], freqs.s[i + 1]); - if(max < mag[i]) - max = mag[i]; - } - if(max < 0.00001) - max = 1.0; - - defaults(); - - for(int i = 0; i < MAX_AD_HARMONICS - 1; i++) { - REALTYPE newmag = mag[i] / max; - REALTYPE newphase = phase[i]; - - Phmag[i] = (int) ((newmag) * 64.0) + 64; - - Phphase[i] = 64 - (int) (64.0 * newphase / PI); - if(Phphase[i] > 127) - Phphase[i] = 127; - - if(Phmag[i] == 64) - Phphase[i] = 64; - } - deleteFFTFREQS(&freqs); - prepare(); -} - -/* - * Base Functions - START - */ -REALTYPE OscilGen::basefunc_pulse(REALTYPE x, REALTYPE a) -{ - return (fmod(x, 1.0) < a) ? -1.0 : 1.0; -} - -REALTYPE OscilGen::basefunc_saw(REALTYPE x, REALTYPE a) -{ - if(a < 0.00001) - a = 0.00001; - else - if(a > 0.99999) - a = 0.99999; - x = fmod(x, 1); - if(x < a) - return x / a * 2.0 - 1.0; - else - return (1.0 - x) / (1.0 - a) * 2.0 - 1.0; -} - -REALTYPE OscilGen::basefunc_triangle(REALTYPE x, REALTYPE a) -{ - x = fmod(x + 0.25, 1); - a = 1 - a; - if(a < 0.00001) - a = 0.00001; - if(x < 0.5) - x = x * 4 - 1.0; - else - x = (1.0 - x) * 4 - 1.0; - x /= -a; - if(x < -1.0) - x = -1.0; - if(x > 1.0) - x = 1.0; - return x; -} - -REALTYPE OscilGen::basefunc_power(REALTYPE x, REALTYPE a) -{ - x = fmod(x, 1); - if(a < 0.00001) - a = 0.00001; - else - if(a > 0.99999) - a = 0.99999; - return pow(x, exp((a - 0.5) * 10.0)) * 2.0 - 1.0; -} - -REALTYPE OscilGen::basefunc_gauss(REALTYPE x, REALTYPE a) -{ - x = fmod(x, 1) * 2.0 - 1.0; - if(a < 0.00001) - a = 0.00001; - return exp(-x * x * (exp(a * 8) + 5.0)) * 2.0 - 1.0; -} - -REALTYPE OscilGen::basefunc_diode(REALTYPE x, REALTYPE a) -{ - if(a < 0.00001) - a = 0.00001; - else - if(a > 0.99999) - a = 0.99999; - a = a * 2.0 - 1.0; - x = cos((x + 0.5) * 2.0 * PI) - a; - if(x < 0.0) - x = 0.0; - return x / (1.0 - a) * 2 - 1.0; -} - -REALTYPE OscilGen::basefunc_abssine(REALTYPE x, REALTYPE a) -{ - x = fmod(x, 1); - if(a < 0.00001) - a = 0.00001; - else - if(a > 0.99999) - a = 0.99999; - return sin(pow(x, exp((a - 0.5) * 5.0)) * PI) * 2.0 - 1.0; -} - -REALTYPE OscilGen::basefunc_pulsesine(REALTYPE x, REALTYPE a) -{ - if(a < 0.00001) - a = 0.00001; - x = (fmod(x, 1) - 0.5) * exp((a - 0.5) * log(128)); - if(x < -0.5) - x = -0.5; - else - if(x > 0.5) - x = 0.5; - x = sin(x * PI * 2.0); - return x; -} - -REALTYPE OscilGen::basefunc_stretchsine(REALTYPE x, REALTYPE a) -{ - x = fmod(x + 0.5, 1) * 2.0 - 1.0; - a = (a - 0.5) * 4; - if(a > 0.0) - a *= 2; - a = pow(3.0, a); - REALTYPE b = pow(fabs(x), a); - if(x < 0) - b = -b; - return -sin(b * PI); -} - -REALTYPE OscilGen::basefunc_chirp(REALTYPE x, REALTYPE a) -{ - x = fmod(x, 1.0) * 2.0 * PI; - a = (a - 0.5) * 4; - if(a < 0.0) - a *= 2.0; - a = pow(3.0, a); - return sin(x / 2.0) * sin(a * x * x); -} - -REALTYPE OscilGen::basefunc_absstretchsine(REALTYPE x, REALTYPE a) -{ - x = fmod(x + 0.5, 1) * 2.0 - 1.0; - a = (a - 0.5) * 9; - a = pow(3.0, a); - REALTYPE b = pow(fabs(x), a); - if(x < 0) - b = -b; - return -pow(sin(b * PI), 2); -} - -REALTYPE OscilGen::basefunc_chebyshev(REALTYPE x, REALTYPE a) -{ - a = a * a * a * 30.0 + 1.0; - return cos(acos(x * 2.0 - 1.0) * a); -} - -REALTYPE OscilGen::basefunc_sqr(REALTYPE x, REALTYPE a) -{ - a = a * a * a * a * 160.0 + 0.001; - return -atan(sin(x * 2.0 * PI) * a); -} -/* - * Base Functions - END - */ - - -/* - * Get the base function - */ -void OscilGen::getbasefunction(REALTYPE *smps) -{ - int i; - REALTYPE par = (Pbasefuncpar + 0.5) / 128.0; - if(Pbasefuncpar == 64) - par = 0.5; - - REALTYPE basefuncmodulationpar1 = Pbasefuncmodulationpar1 / 127.0, - basefuncmodulationpar2 = Pbasefuncmodulationpar2 / 127.0, - basefuncmodulationpar3 = Pbasefuncmodulationpar3 / 127.0; - - switch(Pbasefuncmodulation) { - case 1: - basefuncmodulationpar1 = - (pow(2, basefuncmodulationpar1 * 5.0) - 1.0) / 10.0; - basefuncmodulationpar3 = - floor((pow(2, basefuncmodulationpar3 * 5.0) - 1.0)); - if(basefuncmodulationpar3 < 0.9999) - basefuncmodulationpar3 = -1.0; - break; - case 2: - basefuncmodulationpar1 = - (pow(2, basefuncmodulationpar1 * 5.0) - 1.0) / 10.0; - basefuncmodulationpar3 = 1.0 - + floor((pow(2, basefuncmodulationpar3 - * 5.0) - 1.0)); - break; - case 3: - basefuncmodulationpar1 = - (pow(2, basefuncmodulationpar1 * 7.0) - 1.0) / 10.0; - basefuncmodulationpar3 = 0.01 - + (pow(2, basefuncmodulationpar3 - * 16.0) - 1.0) / 10.0; - break; - } - -// printf("%.5f %.5f\n",basefuncmodulationpar1,basefuncmodulationpar3); - - for(i = 0; i < OSCIL_SIZE; i++) { - REALTYPE t = i * 1.0 / OSCIL_SIZE; - - switch(Pbasefuncmodulation) { - case 1: - t = t * basefuncmodulationpar3 + sin( - (t - + basefuncmodulationpar2) * 2.0 * PI) * basefuncmodulationpar1; //rev - break; - case 2: - t = t + sin( - (t * basefuncmodulationpar3 - + basefuncmodulationpar2) * 2.0 * PI) * basefuncmodulationpar1; //sine - break; - case 3: - t = t + pow((1.0 - cos( - (t + basefuncmodulationpar2) * 2.0 * PI)) * 0.5, - basefuncmodulationpar3) * basefuncmodulationpar1; //power - break; - } - - t = t - floor(t); - - switch(Pcurrentbasefunc) { - case 1: - smps[i] = basefunc_triangle(t, par); - break; - case 2: - smps[i] = basefunc_pulse(t, par); - break; - case 3: - smps[i] = basefunc_saw(t, par); - break; - case 4: - smps[i] = basefunc_power(t, par); - break; - case 5: - smps[i] = basefunc_gauss(t, par); - break; - case 6: - smps[i] = basefunc_diode(t, par); - break; - case 7: - smps[i] = basefunc_abssine(t, par); - break; - case 8: - smps[i] = basefunc_pulsesine(t, par); - break; - case 9: - smps[i] = basefunc_stretchsine(t, par); - break; - case 10: - smps[i] = basefunc_chirp(t, par); - break; - case 11: - smps[i] = basefunc_absstretchsine(t, par); - break; - case 12: - smps[i] = basefunc_chebyshev(t, par); - break; - case 13: - smps[i] = basefunc_sqr(t, par); - break; - default: - smps[i] = -sin(2.0 * PI * i / OSCIL_SIZE); - } - } -} - -/* - * Filter the oscillator - */ -void OscilGen::oscilfilter() -{ - if(Pfiltertype == 0) - return; - REALTYPE par = 1.0 - Pfilterpar1 / 128.0; - REALTYPE par2 = Pfilterpar2 / 127.0; - REALTYPE max = 0.0, tmp = 0.0, p2, x; - for(int i = 1; i < OSCIL_SIZE / 2; i++) { - REALTYPE gain = 1.0; - switch(Pfiltertype) { - case 1: - gain = pow(1.0 - par * par * par * 0.99, i); //lp - tmp = par2 * par2 * par2 * par2 * 0.5 + 0.0001; - if(gain < tmp) - gain = pow(gain, 10.0) / pow(tmp, 9.0); - break; - case 2: - gain = 1.0 - pow(1.0 - par * par, i + 1); //hp1 - gain = pow(gain, par2 * 2.0 + 0.1); - break; - case 3: - if(par < 0.2) - par = par * 0.25 + 0.15; - gain = 1.0 - pow(1.0 - par * par * 0.999 + 0.001, - i * 0.05 * i + 1.0); //hp1b - tmp = pow(5.0, par2 * 2.0); - gain = pow(gain, tmp); - break; - case 4: - gain = i + 1 - pow(2, (1.0 - par) * 7.5); //bp1 - gain = 1.0 / (1.0 + gain * gain / (i + 1.0)); - tmp = pow(5.0, par2 * 2.0); - gain = pow(gain, tmp); - if(gain < 1e-5) - gain = 1e-5; - break; - case 5: - gain = i + 1 - pow(2, (1.0 - par) * 7.5); //bs1 - gain = pow(atan(gain / (i / 10.0 + 1)) / 1.57, 6); - gain = pow(gain, par2 * par2 * 3.9 + 0.1); - break; - case 6: - tmp = pow(par2, 0.33); - gain = - (i + 1 > - pow(2, (1.0 - par) * 10) ? 0.0 : 1.0) * par2 + (1.0 - par2); //lp2 - break; - case 7: - tmp = pow(par2, 0.33); - //tmp=1.0-(1.0-par2)*(1.0-par2); - gain = - (i + 1 > - pow(2, (1.0 - par) * 7) ? 1.0 : 0.0) * par2 + (1.0 - par2); //hp2 - if(Pfilterpar1 == 0) - gain = 1.0; - break; - case 8: - tmp = pow(par2, 0.33); - //tmp=1.0-(1.0-par2)*(1.0-par2); - gain = - (fabs(pow(2, - (1.0 - - par) - * 7) - i) > i / 2 + 1 ? 0.0 : 1.0) * par2 + (1.0 - par2); //bp2 - break; - case 9: - tmp = pow(par2, 0.33); - gain = - (fabs(pow(2, - (1.0 - - par) - * 7) - i) < i / 2 + 1 ? 0.0 : 1.0) * par2 + (1.0 - par2); //bs2 - break; - case 10: - tmp = pow(5.0, par2 * 2.0 - 1.0); - tmp = pow(i / 32.0, tmp) * 32.0; - if(Pfilterpar2 == 64) - tmp = i; - gain = cos(par * par * PI / 2.0 * tmp); //cos - gain *= gain; - break; - case 11: - tmp = pow(5.0, par2 * 2.0 - 1.0); - tmp = pow(i / 32.0, tmp) * 32.0; - if(Pfilterpar2 == 64) - tmp = i; - gain = sin(par * par * PI / 2.0 * tmp); //sin - gain *= gain; - break; - case 12: - p2 = 1.0 - par + 0.2; - x = i / (64.0 * p2 * p2); - if(x < 0.0) - x = 0.0; - else - if(x > 1.0) - x = 1.0; - tmp = pow(1.0 - par2, 2.0); - gain = cos(x * PI) * (1.0 - tmp) + 1.01 + tmp; //low shelf - break; - case 13: - tmp = (int) (pow(2.0, (1.0 - par) * 7.2)); - gain = 1.0; - if(i == (int) (tmp)) - gain = pow(2.0, par2 * par2 * 8.0); - break; - } - - - oscilFFTfreqs.s[i] *= gain; - oscilFFTfreqs.c[i] *= gain; - REALTYPE tmp = oscilFFTfreqs.s[i] * oscilFFTfreqs.s[i] - + oscilFFTfreqs.c[i] * oscilFFTfreqs.c[i]; - if(max < tmp) - max = tmp; - } - - max = sqrt(max); - if(max < 1e-10) - max = 1.0; - REALTYPE imax = 1.0 / max; - for(int i = 1; i < OSCIL_SIZE / 2; i++) { - oscilFFTfreqs.s[i] *= imax; - oscilFFTfreqs.c[i] *= imax; - } -} - -/* - * Change the base function - */ -void OscilGen::changebasefunction() -{ - if(Pcurrentbasefunc != 0) { - getbasefunction(tmpsmps); - fft->smps2freqs(tmpsmps, basefuncFFTfreqs); - basefuncFFTfreqs.c[0] = 0.0; - } - else { - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - basefuncFFTfreqs.s[i] = 0.0; - basefuncFFTfreqs.c[i] = 0.0; - } - //in this case basefuncFFTfreqs_ are not used - } - oscilprepared = 0; - oldbasefunc = Pcurrentbasefunc; - oldbasepar = Pbasefuncpar; - oldbasefuncmodulation = Pbasefuncmodulation; - oldbasefuncmodulationpar1 = Pbasefuncmodulationpar1; - oldbasefuncmodulationpar2 = Pbasefuncmodulationpar2; - oldbasefuncmodulationpar3 = Pbasefuncmodulationpar3; -} - -/* - * Waveshape - */ -void OscilGen::waveshape() -{ - int i; - - oldwaveshapingfunction = Pwaveshapingfunction; - oldwaveshaping = Pwaveshaping; - if(Pwaveshapingfunction == 0) - return; - - oscilFFTfreqs.c[0] = 0.0; //remove the DC - //reduce the amplitude of the freqs near the nyquist - for(i = 1; i < OSCIL_SIZE / 8; i++) { - REALTYPE tmp = i / (OSCIL_SIZE / 8.0); - oscilFFTfreqs.s[OSCIL_SIZE / 2 - i] *= tmp; - oscilFFTfreqs.c[OSCIL_SIZE / 2 - i] *= tmp; - } - fft->freqs2smps(oscilFFTfreqs, tmpsmps); - - //Normalize - REALTYPE max = 0.0; - for(i = 0; i < OSCIL_SIZE; i++) - if(max < fabs(tmpsmps[i])) - max = fabs(tmpsmps[i]); - if(max < 0.00001) - max = 1.0; - max = 1.0 / max; - for(i = 0; i < OSCIL_SIZE; i++) - tmpsmps[i] *= max; - - //Do the waveshaping - waveshapesmps(OSCIL_SIZE, tmpsmps, Pwaveshapingfunction, Pwaveshaping); - - fft->smps2freqs(tmpsmps, oscilFFTfreqs); //perform FFT -} - - -/* - * Do the Frequency Modulation of the Oscil - */ -void OscilGen::modulation() -{ - int i; - - oldmodulation = Pmodulation; - oldmodulationpar1 = Pmodulationpar1; - oldmodulationpar2 = Pmodulationpar2; - oldmodulationpar3 = Pmodulationpar3; - if(Pmodulation == 0) - return; - - - REALTYPE modulationpar1 = Pmodulationpar1 / 127.0, - modulationpar2 = 0.5 - Pmodulationpar2 / 127.0, - modulationpar3 = Pmodulationpar3 / 127.0; - - switch(Pmodulation) { - case 1: - modulationpar1 = (pow(2, modulationpar1 * 7.0) - 1.0) / 100.0; - modulationpar3 = floor((pow(2, modulationpar3 * 5.0) - 1.0)); - if(modulationpar3 < 0.9999) - modulationpar3 = -1.0; - break; - case 2: - modulationpar1 = (pow(2, modulationpar1 * 7.0) - 1.0) / 100.0; - modulationpar3 = 1.0 + floor((pow(2, modulationpar3 * 5.0) - 1.0)); - break; - case 3: - modulationpar1 = (pow(2, modulationpar1 * 9.0) - 1.0) / 100.0; - modulationpar3 = 0.01 + (pow(2, modulationpar3 * 16.0) - 1.0) / 10.0; - break; - } - - oscilFFTfreqs.c[0] = 0.0; //remove the DC - //reduce the amplitude of the freqs near the nyquist - for(i = 1; i < OSCIL_SIZE / 8; i++) { - REALTYPE tmp = i / (OSCIL_SIZE / 8.0); - oscilFFTfreqs.s[OSCIL_SIZE / 2 - i] *= tmp; - oscilFFTfreqs.c[OSCIL_SIZE / 2 - i] *= tmp; - } - fft->freqs2smps(oscilFFTfreqs, tmpsmps); - int extra_points = 2; - REALTYPE *in = new REALTYPE[OSCIL_SIZE + extra_points]; - - //Normalize - REALTYPE max = 0.0; - for(i = 0; i < OSCIL_SIZE; i++) - if(max < fabs(tmpsmps[i])) - max = fabs(tmpsmps[i]); - if(max < 0.00001) - max = 1.0; - max = 1.0 / max; - for(i = 0; i < OSCIL_SIZE; i++) - in[i] = tmpsmps[i] * max; - for(i = 0; i < extra_points; i++) - in[i + OSCIL_SIZE] = tmpsmps[i] * max; - - //Do the modulation - for(i = 0; i < OSCIL_SIZE; i++) { - REALTYPE t = i * 1.0 / OSCIL_SIZE; - - switch(Pmodulation) { - case 1: - t = t * modulationpar3 - + sin((t + modulationpar2) * 2.0 * PI) * modulationpar1; //rev - break; - case 2: - t = t - + sin((t * modulationpar3 - + modulationpar2) * 2.0 * PI) * modulationpar1; //sine - break; - case 3: - t = t + pow((1.0 - cos( - (t + modulationpar2) * 2.0 * PI)) * 0.5, - modulationpar3) * modulationpar1; //power - break; - } - - t = (t - floor(t)) * OSCIL_SIZE; - - int poshi = (int) t; - REALTYPE poslo = t - floor(t); - - tmpsmps[i] = in[poshi] * (1.0 - poslo) + in[poshi + 1] * poslo; - } - - delete [] in; - fft->smps2freqs(tmpsmps, oscilFFTfreqs); //perform FFT -} - - - -/* - * Adjust the spectrum - */ -void OscilGen::spectrumadjust() -{ - if(Psatype == 0) - return; - REALTYPE par = Psapar / 127.0; - switch(Psatype) { - case 1: - par = 1.0 - par * 2.0; - if(par >= 0.0) - par = pow(5.0, par); - else - par = pow(8.0, par); - break; - case 2: - par = pow(10.0, (1.0 - par) * 3.0) * 0.25; - break; - case 3: - par = pow(10.0, (1.0 - par) * 3.0) * 0.25; - break; - } - - - REALTYPE max = 0.0; - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - REALTYPE tmp = pow(oscilFFTfreqs.c[i], 2) + pow(oscilFFTfreqs.s[i], 2.0); - if(max < tmp) - max = tmp; - } - max = sqrt(max) / OSCIL_SIZE * 2.0; - if(max < 1e-8) - max = 1.0; - - - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - REALTYPE mag = - sqrt(pow(oscilFFTfreqs.s[i], - 2) + pow(oscilFFTfreqs.c[i], 2.0)) / max; - REALTYPE phase = atan2(oscilFFTfreqs.s[i], oscilFFTfreqs.c[i]); - - switch(Psatype) { - case 1: - mag = pow(mag, par); - break; - case 2: - if(mag < par) - mag = 0.0; - break; - case 3: - mag /= par; - if(mag > 1.0) - mag = 1.0; - break; - } - oscilFFTfreqs.c[i] = mag * cos(phase); - oscilFFTfreqs.s[i] = mag * sin(phase); - } -} - -void OscilGen::shiftharmonics() -{ - if(Pharmonicshift == 0) - return; - - REALTYPE hc, hs; - int harmonicshift = -Pharmonicshift; - - if(harmonicshift > 0) { - for(int i = OSCIL_SIZE / 2 - 2; i >= 0; i--) { - int oldh = i - harmonicshift; - if(oldh < 0) { - hc = 0.0; - hs = 0.0; - } - else { - hc = oscilFFTfreqs.c[oldh + 1]; - hs = oscilFFTfreqs.s[oldh + 1]; - } - oscilFFTfreqs.c[i + 1] = hc; - oscilFFTfreqs.s[i + 1] = hs; - } - } - else { - for(int i = 0; i < OSCIL_SIZE / 2 - 1; i++) { - int oldh = i + abs(harmonicshift); - if(oldh >= (OSCIL_SIZE / 2 - 1)) { - hc = 0.0; - hs = 0.0; - } - else { - hc = oscilFFTfreqs.c[oldh + 1]; - hs = oscilFFTfreqs.s[oldh + 1]; - if(fabs(hc) < 0.000001) - hc = 0.0; - if(fabs(hs) < 0.000001) - hs = 0.0; - } - - oscilFFTfreqs.c[i + 1] = hc; - oscilFFTfreqs.s[i + 1] = hs; - } - } - - oscilFFTfreqs.c[0] = 0.0; -} - -/* - * Prepare the Oscillator - */ -void OscilGen::prepare() -{ - int i, j, k; - REALTYPE a, b, c, d, hmagnew; - - if((oldbasepar != Pbasefuncpar) || (oldbasefunc != Pcurrentbasefunc) - || (oldbasefuncmodulation != Pbasefuncmodulation) - || (oldbasefuncmodulationpar1 != Pbasefuncmodulationpar1) - || (oldbasefuncmodulationpar2 != Pbasefuncmodulationpar2) - || (oldbasefuncmodulationpar3 != Pbasefuncmodulationpar3)) - changebasefunction(); - - for(i = 0; i < MAX_AD_HARMONICS; i++) - hphase[i] = (Phphase[i] - 64.0) / 64.0 * PI / (i + 1); - - for(i = 0; i < MAX_AD_HARMONICS; i++) { - hmagnew = 1.0 - fabs(Phmag[i] / 64.0 - 1.0); - switch(Phmagtype) { - case 1: - hmag[i] = exp(hmagnew * log(0.01)); - break; - case 2: - hmag[i] = exp(hmagnew * log(0.001)); - break; - case 3: - hmag[i] = exp(hmagnew * log(0.0001)); - break; - case 4: - hmag[i] = exp(hmagnew * log(0.00001)); - break; - default: - hmag[i] = 1.0 - hmagnew; - break; - } - - if(Phmag[i] < 64) - hmag[i] = -hmag[i]; - } - - //remove the harmonics where Phmag[i]==64 - for(i = 0; i < MAX_AD_HARMONICS; i++) - if(Phmag[i] == 64) - hmag[i] = 0.0; - - - for(i = 0; i < OSCIL_SIZE / 2; i++) { - oscilFFTfreqs.c[i] = 0.0; - oscilFFTfreqs.s[i] = 0.0; - } - if(Pcurrentbasefunc == 0) { //the sine case - for(i = 0; i < MAX_AD_HARMONICS; i++) { - oscilFFTfreqs.c[i + 1] = -hmag[i] * sin(hphase[i] * (i + 1)) / 2.0; - oscilFFTfreqs.s[i + 1] = hmag[i] * cos(hphase[i] * (i + 1)) / 2.0; - } - } - else { - for(j = 0; j < MAX_AD_HARMONICS; j++) { - if(Phmag[j] == 64) - continue; - for(i = 1; i < OSCIL_SIZE / 2; i++) { - k = i * (j + 1); - if(k >= OSCIL_SIZE / 2) - break; - a = basefuncFFTfreqs.c[i]; - b = basefuncFFTfreqs.s[i]; - c = hmag[j] * cos(hphase[j] * k); - d = hmag[j] * sin(hphase[j] * k); - oscilFFTfreqs.c[k] += a * c - b * d; - oscilFFTfreqs.s[k] += a * d + b * c; - } - } - } - - if(Pharmonicshiftfirst != 0) - shiftharmonics(); - - - - if(Pfilterbeforews == 0) { - waveshape(); - oscilfilter(); - } - else { - oscilfilter(); - waveshape(); - } - - modulation(); - spectrumadjust(); - if(Pharmonicshiftfirst == 0) - shiftharmonics(); - - oscilFFTfreqs.c[0] = 0.0; - - oldhmagtype = Phmagtype; - oldharmonicshift = Pharmonicshift + Pharmonicshiftfirst * 256; - - oscilprepared = 1; -} - -void OscilGen::adaptiveharmonic(FFTFREQS f, REALTYPE freq) -{ - if(Padaptiveharmonics == 0 /*||(freq<1.0)*/) - return; - if(freq < 1.0) - freq = 440.0; - - FFTFREQS inf; - newFFTFREQS(&inf, OSCIL_SIZE / 2); - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - inf.s[i] = f.s[i]; - inf.c[i] = f.c[i]; - f.s[i] = 0.0; - f.c[i] = 0.0; - } - inf.c[0] = 0.0; - inf.s[0] = 0.0; - - REALTYPE hc = 0.0, hs = 0.0; - REALTYPE basefreq = 30.0 * pow(10.0, Padaptiveharmonicsbasefreq / 128.0); - REALTYPE power = (Padaptiveharmonicspower + 1.0) / 101.0; - - REALTYPE rap = freq / basefreq; - - rap = pow(rap, power); - - bool down = false; - if(rap > 1.0) { - rap = 1.0 / rap; - down = true; - } - - for(int i = 0; i < OSCIL_SIZE / 2 - 2; i++) { - REALTYPE h = i * rap; - int high = (int)(i * rap); - REALTYPE low = fmod(h, 1.0); - - if(high >= (OSCIL_SIZE / 2 - 2)) - break; - else { - if(down) { - f.c[high] += inf.c[i] * (1.0 - low); - f.s[high] += inf.s[i] * (1.0 - low); - f.c[high + 1] += inf.c[i] * low; - f.s[high + 1] += inf.s[i] * low; - } - else { - hc = inf.c[high] * (1.0 - low) + inf.c[high + 1] * low; - hs = inf.s[high] * (1.0 - low) + inf.s[high + 1] * low; - } - if(fabs(hc) < 0.000001) - hc = 0.0; - if(fabs(hs) < 0.000001) - hs = 0.0; - } - - if(!down) { - if(i == 0) { //corect the aplitude of the first harmonic - hc *= rap; - hs *= rap; - } - f.c[i] = hc; - f.s[i] = hs; - } - } - - f.c[1] += f.c[0]; - f.s[1] += f.s[0]; - f.c[0] = 0.0; - f.s[0] = 0.0; - deleteFFTFREQS(&inf); -} - -void OscilGen::adaptiveharmonicpostprocess(REALTYPE *f, int size) -{ - if(Padaptiveharmonics <= 1) - return; - REALTYPE *inf = new REALTYPE[size]; - REALTYPE par = Padaptiveharmonicspar * 0.01; - par = 1.0 - pow((1.0 - par), 1.5); - - for(int i = 0; i < size; i++) { - inf[i] = f[i] * par; - f[i] = f[i] * (1.0 - par); - } - - - if(Padaptiveharmonics == 2) { //2n+1 - for(int i = 0; i < size; i++) - if((i % 2) == 0) - f[i] += inf[i]; //i=0 pt prima armonica,etc. - } - else { //celelalte moduri - int nh = (Padaptiveharmonics - 3) / 2 + 2; - int sub_vs_add = (Padaptiveharmonics - 3) % 2; - if(sub_vs_add == 0) { - for(int i = 0; i < size; i++) { - if(((i + 1) % nh) == 0) - f[i] += inf[i]; - ; - } - } - else { - for(int i = 0; i < size / nh - 1; i++) - f[(i + 1) * nh - 1] += inf[i]; - ; - } - } - - delete[] inf; -} - - - -/* - * Get the oscillator function - */ -short int OscilGen::get(REALTYPE *smps, REALTYPE freqHz) -{ - return this->get(smps, freqHz, 0); -} - -void OscilGen::newrandseed(unsigned int randseed) -{ - this->randseed = randseed; -} - -/* - * Get the oscillator function - */ -short int OscilGen::get(REALTYPE *smps, REALTYPE freqHz, int resonance) -{ - int i; - int nyquist, outpos; - - if((oldbasepar != Pbasefuncpar) || (oldbasefunc != Pcurrentbasefunc) - || (oldhmagtype != Phmagtype) - || (oldwaveshaping != Pwaveshaping) - || (oldwaveshapingfunction != Pwaveshapingfunction)) - oscilprepared = 0; - if(oldfilterpars != Pfiltertype * 256 + Pfilterpar1 + Pfilterpar2 * 65536 - + Pfilterbeforews * 16777216) { - oscilprepared = 0; - oldfilterpars = Pfiltertype * 256 + Pfilterpar1 + Pfilterpar2 * 65536 - + Pfilterbeforews * 16777216; - } - if(oldsapars != Psatype * 256 + Psapar) { - oscilprepared = 0; - oldsapars = Psatype * 256 + Psapar; - } - - if((oldbasefuncmodulation != Pbasefuncmodulation) - || (oldbasefuncmodulationpar1 != Pbasefuncmodulationpar1) - || (oldbasefuncmodulationpar2 != Pbasefuncmodulationpar2) - || (oldbasefuncmodulationpar3 != Pbasefuncmodulationpar3)) - oscilprepared = 0; - - if((oldmodulation != Pmodulation) - || (oldmodulationpar1 != Pmodulationpar1) - || (oldmodulationpar2 != Pmodulationpar2) - || (oldmodulationpar3 != Pmodulationpar3)) - oscilprepared = 0; - - if(oldharmonicshift != Pharmonicshift + Pharmonicshiftfirst * 256) - oscilprepared = 0; - - if(oscilprepared != 1) - prepare(); - - outpos = - (int)((RND * 2.0 - 1.0) * (REALTYPE) OSCIL_SIZE * (Prand - 64.0) / 64.0); - outpos = (outpos + 2 * OSCIL_SIZE) % OSCIL_SIZE; - - - for(i = 0; i < OSCIL_SIZE / 2; i++) { - outoscilFFTfreqs.c[i] = 0.0; - outoscilFFTfreqs.s[i] = 0.0; - } - - nyquist = (int)(0.5 * SAMPLE_RATE / fabs(freqHz)) + 2; - if(ADvsPAD) - nyquist = (int)(OSCIL_SIZE / 2); - if(nyquist > OSCIL_SIZE / 2) - nyquist = OSCIL_SIZE / 2; - - - int realnyquist = nyquist; - - if(Padaptiveharmonics != 0) - nyquist = OSCIL_SIZE / 2; - for(i = 1; i < nyquist - 1; i++) { - outoscilFFTfreqs.c[i] = oscilFFTfreqs.c[i]; - outoscilFFTfreqs.s[i] = oscilFFTfreqs.s[i]; - } - - adaptiveharmonic(outoscilFFTfreqs, freqHz); - adaptiveharmonicpostprocess(&outoscilFFTfreqs.c[1], OSCIL_SIZE / 2 - 1); - adaptiveharmonicpostprocess(&outoscilFFTfreqs.s[1], OSCIL_SIZE / 2 - 1); - - nyquist = realnyquist; - if(Padaptiveharmonics) { //do the antialiasing in the case of adaptive harmonics - for(i = nyquist; i < OSCIL_SIZE / 2; i++) { - outoscilFFTfreqs.s[i] = 0; - outoscilFFTfreqs.c[i] = 0; - } - } - - // Randomness (each harmonic), the block type is computed - // in ADnote by setting start position according to this setting - if((Prand > 64) && (freqHz >= 0.0) && (!ADvsPAD)) { - REALTYPE rnd, angle, a, b, c, d; - rnd = PI * pow((Prand - 64.0) / 64.0, 2.0); - for(i = 1; i < nyquist - 1; i++) { //to Nyquist only for AntiAliasing - angle = rnd * i * RND; - a = outoscilFFTfreqs.c[i]; - b = outoscilFFTfreqs.s[i]; - c = cos(angle); - d = sin(angle); - outoscilFFTfreqs.c[i] = a * c - b * d; - outoscilFFTfreqs.s[i] = a * d + b * c; - } - } - - //Harmonic Amplitude Randomness - if((freqHz > 0.1) && (!ADvsPAD)) { - unsigned int realrnd = rand(); - srand(randseed); - REALTYPE power = Pamprandpower / 127.0; - REALTYPE normalize = 1.0 / (1.2 - power); - switch(Pamprandtype) { - case 1: - power = power * 2.0 - 0.5; - power = pow(15.0, power); - for(i = 1; i < nyquist - 1; i++) { - REALTYPE amp = pow(RND, power) * normalize; - outoscilFFTfreqs.c[i] *= amp; - outoscilFFTfreqs.s[i] *= amp; - } - break; - case 2: - power = power * 2.0 - 0.5; - power = pow(15.0, power) * 2.0; - REALTYPE rndfreq = 2 * PI * RND; - for(i = 1; i < nyquist - 1; i++) { - REALTYPE amp = pow(fabs(sin(i * rndfreq)), power) * normalize; - outoscilFFTfreqs.c[i] *= amp; - outoscilFFTfreqs.s[i] *= amp; - } - break; - } - srand(realrnd + 1); - } - - if((freqHz > 0.1) && (resonance != 0)) - res->applyres(nyquist - 1, outoscilFFTfreqs, freqHz); - - //Full RMS normalize - REALTYPE sum = 0; - for(int j = 1; j < OSCIL_SIZE / 2; j++) { - REALTYPE term = outoscilFFTfreqs.c[j] * outoscilFFTfreqs.c[j] - + outoscilFFTfreqs.s[j] * outoscilFFTfreqs.s[j]; - sum += term; - } - if(sum < 0.000001) - sum = 1.0; - sum = 1.0 / sqrt(sum); - for(int j = 1; j < OSCIL_SIZE / 2; j++) { - outoscilFFTfreqs.c[j] *= sum; - outoscilFFTfreqs.s[j] *= sum; - } - - - if((ADvsPAD) && (freqHz > 0.1)) //in this case the smps will contain the freqs - for(i = 1; i < OSCIL_SIZE / 2; i++) - smps[i - 1] = sqrt(outoscilFFTfreqs.c[i] * outoscilFFTfreqs.c[i] - + outoscilFFTfreqs.s[i] * outoscilFFTfreqs.s[i]); - else { - fft->freqs2smps(outoscilFFTfreqs, smps); - for(i = 0; i < OSCIL_SIZE; i++) - smps[i] *= 0.25; //correct the amplitude - } - - if(Prand < 64) - return outpos; - else - return 0; -} - - -/* - * Get the spectrum of the oscillator for the UI - */ -void OscilGen::getspectrum(int n, REALTYPE *spc, int what) -{ - if(n > OSCIL_SIZE / 2) - n = OSCIL_SIZE / 2; - - for(int i = 1; i < n; i++) { - if(what == 0) - spc[i - 1] = sqrt(oscilFFTfreqs.c[i] * oscilFFTfreqs.c[i] - + oscilFFTfreqs.s[i] * oscilFFTfreqs.s[i]); - else { - if(Pcurrentbasefunc == 0) - spc[i - 1] = ((i == 1) ? (1.0) : (0.0)); - else - spc[i - 1] = sqrt(basefuncFFTfreqs.c[i] * basefuncFFTfreqs.c[i] - + basefuncFFTfreqs.s[i] - * basefuncFFTfreqs.s[i]); - } - } - - if(what == 0) { - for(int i = 0; i < n; i++) - outoscilFFTfreqs.s[i] = outoscilFFTfreqs.c[i] = spc[i]; - for(int i = n; i < OSCIL_SIZE / 2; i++) - outoscilFFTfreqs.s[i] = outoscilFFTfreqs.c[i] = 0.0; - adaptiveharmonic(outoscilFFTfreqs, 0.0); - for(int i = 0; i < n; i++) - spc[i] = outoscilFFTfreqs.s[i]; - adaptiveharmonicpostprocess(spc, n - 1); - } -} - - -/* - * Convert the oscillator as base function - */ -void OscilGen::useasbase() -{ - int i; - - for(i = 0; i < OSCIL_SIZE / 2; i++) { - basefuncFFTfreqs.c[i] = oscilFFTfreqs.c[i]; - basefuncFFTfreqs.s[i] = oscilFFTfreqs.s[i]; - } - - oldbasefunc = Pcurrentbasefunc = 127; - - prepare(); -} - - -/* - * Get the base function for UI - */ -void OscilGen::getcurrentbasefunction(REALTYPE *smps) -{ - if(Pcurrentbasefunc != 0) - fft->freqs2smps(basefuncFFTfreqs, smps); - else - getbasefunction(smps); //the sine case -} - - -void OscilGen::add2XML(XMLwrapper *xml) -{ - xml->addpar("harmonic_mag_type", Phmagtype); - - xml->addpar("base_function", Pcurrentbasefunc); - xml->addpar("base_function_par", Pbasefuncpar); - xml->addpar("base_function_modulation", Pbasefuncmodulation); - xml->addpar("base_function_modulation_par1", Pbasefuncmodulationpar1); - xml->addpar("base_function_modulation_par2", Pbasefuncmodulationpar2); - xml->addpar("base_function_modulation_par3", Pbasefuncmodulationpar3); - - xml->addpar("modulation", Pmodulation); - xml->addpar("modulation_par1", Pmodulationpar1); - xml->addpar("modulation_par2", Pmodulationpar2); - xml->addpar("modulation_par3", Pmodulationpar3); - - xml->addpar("wave_shaping", Pwaveshaping); - xml->addpar("wave_shaping_function", Pwaveshapingfunction); - - xml->addpar("filter_type", Pfiltertype); - xml->addpar("filter_par1", Pfilterpar1); - xml->addpar("filter_par2", Pfilterpar2); - xml->addpar("filter_before_wave_shaping", Pfilterbeforews); - - xml->addpar("spectrum_adjust_type", Psatype); - xml->addpar("spectrum_adjust_par", Psapar); - - xml->addpar("rand", Prand); - xml->addpar("amp_rand_type", Pamprandtype); - xml->addpar("amp_rand_power", Pamprandpower); - - xml->addpar("harmonic_shift", Pharmonicshift); - xml->addparbool("harmonic_shift_first", Pharmonicshiftfirst); - - xml->addpar("adaptive_harmonics", Padaptiveharmonics); - xml->addpar("adaptive_harmonics_base_frequency", Padaptiveharmonicsbasefreq); - xml->addpar("adaptive_harmonics_power", Padaptiveharmonicspower); - - xml->beginbranch("HARMONICS"); - for(int n = 0; n < MAX_AD_HARMONICS; n++) { - if((Phmag[n] == 64) && (Phphase[n] == 64)) - continue; - xml->beginbranch("HARMONIC", n + 1); - xml->addpar("mag", Phmag[n]); - xml->addpar("phase", Phphase[n]); - xml->endbranch(); - } - xml->endbranch(); - - if(Pcurrentbasefunc == 127) { - REALTYPE max = 0.0; - - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - if(max < fabs(basefuncFFTfreqs.c[i])) - max = fabs(basefuncFFTfreqs.c[i]); - if(max < fabs(basefuncFFTfreqs.s[i])) - max = fabs(basefuncFFTfreqs.s[i]); - } - if(max < 0.00000001) - max = 1.0; - - xml->beginbranch("BASE_FUNCTION"); - for(int i = 1; i < OSCIL_SIZE / 2; i++) { - REALTYPE xc = basefuncFFTfreqs.c[i] / max; - REALTYPE xs = basefuncFFTfreqs.s[i] / max; - if((fabs(xs) > 0.00001) && (fabs(xs) > 0.00001)) { - xml->beginbranch("BF_HARMONIC", i); - xml->addparreal("cos", xc); - xml->addparreal("sin", xs); - xml->endbranch(); - } - } - xml->endbranch(); - } -} - - -void OscilGen::getfromXML(XMLwrapper *xml) -{ - Phmagtype = xml->getpar127("harmonic_mag_type", Phmagtype); - - Pcurrentbasefunc = xml->getpar127("base_function", Pcurrentbasefunc); - Pbasefuncpar = xml->getpar127("base_function_par", Pbasefuncpar); - - Pbasefuncmodulation = xml->getpar127("base_function_modulation", - Pbasefuncmodulation); - Pbasefuncmodulationpar1 = xml->getpar127("base_function_modulation_par1", - Pbasefuncmodulationpar1); - Pbasefuncmodulationpar2 = xml->getpar127("base_function_modulation_par2", - Pbasefuncmodulationpar2); - Pbasefuncmodulationpar3 = xml->getpar127("base_function_modulation_par3", - Pbasefuncmodulationpar3); - - Pmodulation = xml->getpar127("modulation", Pmodulation); - Pmodulationpar1 = xml->getpar127("modulation_par1", - Pmodulationpar1); - Pmodulationpar2 = xml->getpar127("modulation_par2", - Pmodulationpar2); - Pmodulationpar3 = xml->getpar127("modulation_par3", - Pmodulationpar3); - - Pwaveshaping = xml->getpar127("wave_shaping", Pwaveshaping); - Pwaveshapingfunction = xml->getpar127("wave_shaping_function", - Pwaveshapingfunction); - - Pfiltertype = xml->getpar127("filter_type", Pfiltertype); - Pfilterpar1 = xml->getpar127("filter_par1", Pfilterpar1); - Pfilterpar2 = xml->getpar127("filter_par2", Pfilterpar2); - Pfilterbeforews = xml->getpar127("filter_before_wave_shaping", - Pfilterbeforews); - - Psatype = xml->getpar127("spectrum_adjust_type", Psatype); - Psapar = xml->getpar127("spectrum_adjust_par", Psapar); - - Prand = xml->getpar127("rand", Prand); - Pamprandtype = xml->getpar127("amp_rand_type", Pamprandtype); - Pamprandpower = xml->getpar127("amp_rand_power", Pamprandpower); - - Pharmonicshift = xml->getpar("harmonic_shift", - Pharmonicshift, - -64, - 64); - Pharmonicshiftfirst = xml->getparbool("harmonic_shift_first", - Pharmonicshiftfirst); - - Padaptiveharmonics = xml->getpar("adaptive_harmonics", - Padaptiveharmonics, - 0, - 127); - Padaptiveharmonicsbasefreq = xml->getpar( - "adaptive_harmonics_base_frequency", - Padaptiveharmonicsbasefreq, - 0, - 255); - Padaptiveharmonicspower = xml->getpar("adaptive_harmonics_power", - Padaptiveharmonicspower, - 0, - 200); - - - if(xml->enterbranch("HARMONICS")) { - Phmag[0] = 64; - Phphase[0] = 64; - for(int n = 0; n < MAX_AD_HARMONICS; n++) { - if(xml->enterbranch("HARMONIC", n + 1) == 0) - continue; - Phmag[n] = xml->getpar127("mag", 64); - Phphase[n] = xml->getpar127("phase", 64); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(Pcurrentbasefunc != 0) - changebasefunction(); - - - if(xml->enterbranch("BASE_FUNCTION")) { - for(int i = 1; i < OSCIL_SIZE / 2; i++) { - if(xml->enterbranch("BF_HARMONIC", i)) { - basefuncFFTfreqs.c[i] = xml->getparreal("cos", 0.0); - basefuncFFTfreqs.s[i] = xml->getparreal("sin", 0.0); - xml->exitbranch(); - } - } - xml->exitbranch(); - - REALTYPE max = 0.0; - - basefuncFFTfreqs.c[0] = 0.0; - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - if(max < fabs(basefuncFFTfreqs.c[i])) - max = fabs(basefuncFFTfreqs.c[i]); - if(max < fabs(basefuncFFTfreqs.s[i])) - max = fabs(basefuncFFTfreqs.s[i]); - } - if(max < 0.00000001) - max = 1.0; - - for(int i = 0; i < OSCIL_SIZE / 2; i++) { - if(basefuncFFTfreqs.c[i]) - basefuncFFTfreqs.c[i] /= max; - if(basefuncFFTfreqs.s[i]) - basefuncFFTfreqs.s[i] /= max; - } - } -} - diff --git a/plugins/zynaddsubfx/src/Synth/OscilGen.h b/plugins/zynaddsubfx/src/Synth/OscilGen.h deleted file mode 100644 index 5c08d629f..000000000 --- a/plugins/zynaddsubfx/src/Synth/OscilGen.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OscilGen.h - Waveform generator for ADnote - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef OSCIL_GEN_H -#define OSCIL_GEN_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "Resonance.h" -#include "../DSP/FFTwrapper.h" -#include "../Params/Presets.h" - -class OscilGen:public Presets -{ - public: - OscilGen(FFTwrapper *fft_, Resonance *res_); - ~OscilGen(); - - /**computes the full spectrum of oscil from harmonics,phases and basefunc*/ - void prepare(); - - /**do the antialiasing(cut off higher freqs.),apply randomness and do a IFFT*/ - short get(REALTYPE *smps, REALTYPE freqHz); //returns where should I start getting samples, used in block type randomness - short get(REALTYPE *smps, REALTYPE freqHz, int resonance); - //if freqHz is smaller than 0, return the "un-randomized" sample for UI - - void getbasefunction(REALTYPE *smps); - - //called by UI - void getspectrum(int n, REALTYPE *spc, int what); //what=0 pt. oscil,1 pt. basefunc - void getcurrentbasefunction(REALTYPE *smps); - /**convert oscil to base function*/ - void useasbase(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - void convert2sine(int magtype); - - //Parameters - - /** - * The hmag and hphase starts counting from 0, so the first harmonic(1) has the index 0, - * 2-nd harmonic has index 1, ..the 128 harminic has index 127 - */ - unsigned char Phmag[MAX_AD_HARMONICS], Phphase[MAX_AD_HARMONICS]; //the MIDI parameters for mag. and phases - - - /**The Type of magnitude: - * 0 - Linear - * 1 - dB scale (-40) - * 2 - dB scale (-60) - * 3 - dB scale (-80) - * 4 - dB scale (-100)*/ - unsigned char Phmagtype; - - unsigned char Pcurrentbasefunc; //The base function used - 0=sin, 1=... - unsigned char Pbasefuncpar; //the parameter of the base function - - unsigned char Pbasefuncmodulation; //what modulation is applied to the basefunc - unsigned char Pbasefuncmodulationpar1, Pbasefuncmodulationpar2, - Pbasefuncmodulationpar3; //the parameter of the base function modulation - - /*the Randomness: - 64=no randomness - 63..0 - block type randomness - 0 is maximum - 65..127 - each harmonic randomness - 127 is maximum*/ - unsigned char Prand; - unsigned char Pwaveshaping, Pwaveshapingfunction; - unsigned char Pfiltertype, Pfilterpar1, Pfilterpar2; - unsigned char Pfilterbeforews; - unsigned char Psatype, Psapar; //spectrum adjust - - unsigned char Pamprandpower, Pamprandtype; //amplitude randomness - int Pharmonicshift; //how the harmonics are shifted - int Pharmonicshiftfirst; //if the harmonic shift is done before waveshaping and filter - - unsigned char Padaptiveharmonics; //the adaptive harmonics status (off=0,on=1,etc..) - unsigned char Padaptiveharmonicsbasefreq; //the base frequency of the adaptive harmonic (30..3000Hz) - unsigned char Padaptiveharmonicspower; //the strength of the effect (0=off,100=full) - unsigned char Padaptiveharmonicspar; //the parameters in 2,3,4.. modes of adaptive harmonics - - unsigned char Pmodulation; //what modulation is applied to the oscil - unsigned char Pmodulationpar1, Pmodulationpar2, Pmodulationpar3; //the parameter of the parameters - - - //makes a new random seed for Amplitude Randomness - //this should be called every note on event - void newrandseed(unsigned int randseed); - - bool ADvsPAD; //if it is used by ADsynth or by PADsynth - - private: - //This array stores some termporary data and it has OSCIL_SIZE elements - REALTYPE *tmpsmps; - FFTFREQS outoscilFFTfreqs; - - REALTYPE hmag[MAX_AD_HARMONICS], hphase[MAX_AD_HARMONICS]; //the magnituides and the phases of the sine/nonsine harmonics -// private: - FFTwrapper *fft; - //computes the basefunction and make the FFT; newbasefunc<0 = same basefunc - void changebasefunction(); - //Waveshaping - void waveshape(); - - //Filter the oscillator accotding to Pfiltertype and Pfilterpar - void oscilfilter(); - - //Adjust the spectrum - void spectrumadjust(); - - //Shift the harmonics - void shiftharmonics(); - - //Do the oscil modulation stuff - void modulation(); - - //Do the adaptive harmonic stuff - void adaptiveharmonic(FFTFREQS f, REALTYPE freq); - - //Do the adaptive harmonic postprocessing (2n+1,2xS,2xA,etc..) - //this function is called even for the user interface - //this can be called for the sine and components, and for the spectrum - //(that's why the sine and cosine components should be processed with a separate call) - void adaptiveharmonicpostprocess(REALTYPE *f, int size); - - //Basic/base functions (Functiile De Baza) - REALTYPE basefunc_pulse(REALTYPE x, REALTYPE a); - REALTYPE basefunc_saw(REALTYPE x, REALTYPE a); - REALTYPE basefunc_triangle(REALTYPE x, REALTYPE a); - REALTYPE basefunc_power(REALTYPE x, REALTYPE a); - REALTYPE basefunc_gauss(REALTYPE x, REALTYPE a); - REALTYPE basefunc_diode(REALTYPE x, REALTYPE a); - REALTYPE basefunc_abssine(REALTYPE x, REALTYPE a); - REALTYPE basefunc_pulsesine(REALTYPE x, REALTYPE a); - REALTYPE basefunc_stretchsine(REALTYPE x, REALTYPE a); - REALTYPE basefunc_chirp(REALTYPE x, REALTYPE a); - REALTYPE basefunc_absstretchsine(REALTYPE x, REALTYPE a); - REALTYPE basefunc_chebyshev(REALTYPE x, REALTYPE a); - REALTYPE basefunc_sqr(REALTYPE x, REALTYPE a); - - //Internal Data - unsigned char oldbasefunc, oldbasepar, oldhmagtype, - oldwaveshapingfunction, oldwaveshaping; - int oldfilterpars, oldsapars, oldbasefuncmodulation, - oldbasefuncmodulationpar1, oldbasefuncmodulationpar2, - oldbasefuncmodulationpar3, oldharmonicshift; - int oldmodulation, oldmodulationpar1, oldmodulationpar2, - oldmodulationpar3; - - - FFTFREQS basefuncFFTfreqs; //Base Function Frequencies - FFTFREQS oscilFFTfreqs; //Oscillator Frequencies - this is different than the hamonics set-up by the user, it may contains time-domain data if the antialiasing is turned off - int oscilprepared; //1 if the oscil is prepared, 0 if it is not prepared and is need to call ::prepare() before ::get() - - Resonance *res; - - unsigned int randseed; -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/PADnote.cpp b/plugins/zynaddsubfx/src/Synth/PADnote.cpp deleted file mode 100644 index 699085f8c..000000000 --- a/plugins/zynaddsubfx/src/Synth/PADnote.cpp +++ /dev/null @@ -1,614 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PADnote.cpp - The "pad" synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include "PADnote.h" -#include "../Misc/Config.h" - -PADnote::PADnote(PADnoteParameters *parameters, - Controller *ctl_, - REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool besilent) -{ - ready = 0; - - // Initialise some legato-specific vars - Legato.msg = LM_Norm; - Legato.fade.length = (int)(SAMPLE_RATE * 0.005); // 0.005 seems ok. - if(Legato.fade.length < 1) - Legato.fade.length = 1; // (if something's fishy) - Legato.fade.step = (1.0 / Legato.fade.length); - Legato.decounter = -10; - Legato.param.freq = freq; - Legato.param.vel = velocity; - Legato.param.portamento = portamento_; - Legato.param.midinote = midinote; - Legato.silent = besilent; - - pars = parameters; - portamento = portamento_; - ctl = ctl_; - this->velocity = velocity; - finished_ = false; - - - if(pars->Pfixedfreq == 0) - basefreq = freq; - else { - basefreq = 440.0; - int fixedfreqET = pars->PfixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - REALTYPE tmp = - (midinote - - 69.0) / 12.0 * (pow(2.0, (fixedfreqET - 1) / 63.0) - 1.0); - if(fixedfreqET <= 64) - basefreq *= pow(2.0, tmp); - else - basefreq *= pow(3.0, tmp); - } - } - - firsttime = true; - released = false; - realfreq = basefreq; - NoteGlobalPar.Detune = getdetune(pars->PDetuneType, - pars->PCoarseDetune, pars->PDetune); - - - //find out the closest note - REALTYPE logfreq = log(basefreq * pow(2.0, NoteGlobalPar.Detune / 1200.0)); - REALTYPE mindist = fabs(logfreq - log(pars->sample[0].basefreq + 0.0001)); - nsample = 0; - for(int i = 1; i < PAD_MAX_SAMPLES; i++) { - if(pars->sample[i].smp == NULL) - break; - REALTYPE dist = fabs(logfreq - log(pars->sample[i].basefreq + 0.0001)); -// printf("(mindist=%g) %i %g %g\n",mindist,i,dist,pars->sample[i].basefreq); - - if(dist < mindist) { - nsample = i; - mindist = dist; - } - } - - int size = pars->sample[nsample].size; - if(size == 0) - size = 1; - - - poshi_l = (int)(RND * (size - 1)); - if(pars->PStereo != 0) - poshi_r = (poshi_l + size / 2) % size; - else - poshi_r = poshi_l; - poslo = 0.0; - - tmpwave = new REALTYPE [SOUND_BUFFER_SIZE]; - - - - if(pars->PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->PPanning / 128.0; - - NoteGlobalPar.FilterCenterPitch = pars->GlobalFilter->getfreq() //center freq - + pars->PFilterVelocityScale / 127.0 - * 6.0 //velocity sensing - * (VelF(velocity, - pars-> - PFilterVelocityScaleFunction) - 1); - - if(pars->PPunchStrength != 0) { - NoteGlobalPar.Punch.Enabled = 1; - NoteGlobalPar.Punch.t = 1.0; //start from 1.0 and to 0.0 - NoteGlobalPar.Punch.initialvalue = - ((pow(10, 1.5 * pars->PPunchStrength / 127.0) - 1.0) - * VelF(velocity, - pars->PPunchVelocitySensing)); - REALTYPE time = pow(10, 3.0 * pars->PPunchTime / 127.0) / 10000.0; //0.1 .. 100 ms - REALTYPE stretch = pow(440.0 / freq, pars->PPunchStretch / 64.0); - NoteGlobalPar.Punch.dt = 1.0 / (time * SAMPLE_RATE * stretch); - } - else - NoteGlobalPar.Punch.Enabled = 0; - - - - NoteGlobalPar.FreqEnvelope = new Envelope(pars->FreqEnvelope, basefreq); - NoteGlobalPar.FreqLfo = new LFO(pars->FreqLfo, basefreq); - - NoteGlobalPar.AmpEnvelope = new Envelope(pars->AmpEnvelope, basefreq); - NoteGlobalPar.AmpLfo = new LFO(pars->AmpLfo, basefreq); - - NoteGlobalPar.Volume = 4.0 * pow(0.1, 3.0 * (1.0 - pars->PVolume / 96.0)) //-60 dB .. 0 dB - * VelF(velocity, pars->PAmpVelocityScaleFunction); //velocity sensing - - NoteGlobalPar.AmpEnvelope->envout_dB(); //discard the first envelope output - globaloldamplitude = globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope-> - envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - NoteGlobalPar.GlobalFilterL = new Filter(pars->GlobalFilter); - NoteGlobalPar.GlobalFilterR = new Filter(pars->GlobalFilter); - - NoteGlobalPar.FilterEnvelope = new Envelope(pars->FilterEnvelope, - basefreq); - NoteGlobalPar.FilterLfo = new LFO(pars->FilterLfo, basefreq); - NoteGlobalPar.FilterQ = pars->GlobalFilter->getq(); - NoteGlobalPar.FilterFreqTracking = pars->GlobalFilter->getfreqtracking( - basefreq); - - ready = 1; ///sa il pun pe asta doar cand e chiar gata - - if(parameters->sample[nsample].smp == NULL) { - finished_ = true; - return; - } -} - - -// PADlegatonote: This function is (mostly) a copy of PADnote(...) -// with some lines removed so that it only alter the already playing -// note (to perform legato). It is possible I left stuff that is not -// required for this. -void PADnote::PADlegatonote(REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool externcall) -{ - PADnoteParameters *parameters = pars; - //Controller *ctl_=ctl; - - // Manage legato stuff - if(externcall) - Legato.msg = LM_Norm; - if(Legato.msg != LM_CatchUp) { - Legato.lastfreq = Legato.param.freq; - Legato.param.freq = freq; - Legato.param.vel = velocity; - Legato.param.portamento = portamento_; - Legato.param.midinote = midinote; - if(Legato.msg == LM_Norm) { - if(Legato.silent) { - Legato.fade.m = 0.0; - Legato.msg = LM_FadeIn; - } - else { - Legato.fade.m = 1.0; - Legato.msg = LM_FadeOut; - return; - } - } - if(Legato.msg == LM_ToNorm) - Legato.msg = LM_Norm; - } - - portamento = portamento_; - this->velocity = velocity; - finished_ = false; - - if(pars->Pfixedfreq == 0) - basefreq = freq; - else { - basefreq = 440.0; - int fixedfreqET = pars->PfixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - REALTYPE tmp = - (midinote - - 69.0) / 12.0 * (pow(2.0, (fixedfreqET - 1) / 63.0) - 1.0); - if(fixedfreqET <= 64) - basefreq *= pow(2.0, tmp); - else - basefreq *= pow(3.0, tmp); - } - } - - released = false; - realfreq = basefreq; - - getdetune(pars->PDetuneType, pars->PCoarseDetune, pars->PDetune); - - - //find out the closest note - REALTYPE logfreq = log(basefreq * pow(2.0, NoteGlobalPar.Detune / 1200.0)); - REALTYPE mindist = fabs(logfreq - log(pars->sample[0].basefreq + 0.0001)); - nsample = 0; - for(int i = 1; i < PAD_MAX_SAMPLES; i++) { - if(pars->sample[i].smp == NULL) - break; - REALTYPE dist = fabs(logfreq - log(pars->sample[i].basefreq + 0.0001)); - - if(dist < mindist) { - nsample = i; - mindist = dist; - } - } - - int size = pars->sample[nsample].size; - if(size == 0) - size = 1; - - if(pars->PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->PPanning / 128.0; - - NoteGlobalPar.FilterCenterPitch = pars->GlobalFilter->getfreq() //center freq - + pars->PFilterVelocityScale / 127.0 - * 6.0 //velocity sensing - * (VelF(velocity, - pars-> - PFilterVelocityScaleFunction) - 1); - - - NoteGlobalPar.Volume = 4.0 * pow(0.1, 3.0 * (1.0 - pars->PVolume / 96.0)) //-60 dB .. 0 dB - * VelF(velocity, pars->PAmpVelocityScaleFunction); //velocity sensing - - NoteGlobalPar.AmpEnvelope->envout_dB(); //discard the first envelope output - globaloldamplitude = globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope-> - envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - NoteGlobalPar.FilterQ = pars->GlobalFilter->getq(); - NoteGlobalPar.FilterFreqTracking = pars->GlobalFilter->getfreqtracking( - basefreq); - - - if(parameters->sample[nsample].smp == NULL) { - finished_ = true; - return; - } - - // End of the PADlegatonote function. -} - - -PADnote::~PADnote() -{ - delete (NoteGlobalPar.FreqEnvelope); - delete (NoteGlobalPar.FreqLfo); - delete (NoteGlobalPar.AmpEnvelope); - delete (NoteGlobalPar.AmpLfo); - delete (NoteGlobalPar.GlobalFilterL); - delete (NoteGlobalPar.GlobalFilterR); - delete (NoteGlobalPar.FilterEnvelope); - delete (NoteGlobalPar.FilterLfo); - delete [] tmpwave; -} - - -inline void PADnote::fadein(REALTYPE *smps) -{ - int zerocrossings = 0; - for(int i = 1; i < SOUND_BUFFER_SIZE; i++) - if((smps[i - 1] < 0.0) && (smps[i] > 0.0)) - zerocrossings++; //this is only the possitive crossings - - REALTYPE tmp = (SOUND_BUFFER_SIZE - 1.0) / (zerocrossings + 1) / 3.0; - if(tmp < 8.0) - tmp = 8.0; - - int n; - F2I(tmp, n); //how many samples is the fade-in - if(n > SOUND_BUFFER_SIZE) - n = SOUND_BUFFER_SIZE; - for(int i = 0; i < n; i++) { //fade-in - REALTYPE tmp = 0.5 - cos((REALTYPE)i / (REALTYPE) n * PI) * 0.5; - smps[i] *= tmp; - } -} - - -void PADnote::computecurrentparameters() -{ - REALTYPE globalpitch, globalfilterpitch; - globalpitch = 0.01 * (NoteGlobalPar.FreqEnvelope->envout() - + NoteGlobalPar.FreqLfo->lfoout() - * ctl->modwheel.relmod + NoteGlobalPar.Detune); - globaloldamplitude = globalnewamplitude; - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - globalfilterpitch = NoteGlobalPar.FilterEnvelope->envout() - + NoteGlobalPar.FilterLfo->lfoout() - + NoteGlobalPar.FilterCenterPitch; - - REALTYPE tmpfilterfreq = globalfilterpitch + ctl->filtercutoff.relfreq - + NoteGlobalPar.FilterFreqTracking; - - tmpfilterfreq = NoteGlobalPar.GlobalFilterL->getrealfreq(tmpfilterfreq); - - REALTYPE globalfilterq = NoteGlobalPar.FilterQ * ctl->filterq.relq; - NoteGlobalPar.GlobalFilterL->setfreq_and_q(tmpfilterfreq, globalfilterq); - NoteGlobalPar.GlobalFilterR->setfreq_and_q(tmpfilterfreq, globalfilterq); - - //compute the portamento, if it is used by this note - REALTYPE portamentofreqrap = 1.0; - if(portamento != 0) { //this voice use portamento - portamentofreqrap = ctl->portamento.freqrap; - if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" - ; - } - - realfreq = basefreq * portamentofreqrap - * pow(2.0, globalpitch / 12.0) * ctl->pitchwheel.relfreq; -} - - -int PADnote::Compute_Linear(REALTYPE *outl, - REALTYPE *outr, - int freqhi, - REALTYPE freqlo) -{ - REALTYPE *smps = pars->sample[nsample].smp; - if(smps == NULL) { - finished_ = true; - return 1; - } - int size = pars->sample[nsample].size; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - poshi_l += freqhi; - poshi_r += freqhi; - poslo += freqlo; - if(poslo >= 1.0) { - poshi_l += 1; - poshi_r += 1; - poslo -= 1.0; - } - if(poshi_l >= size) - poshi_l %= size; - if(poshi_r >= size) - poshi_r %= size; - - outl[i] = smps[poshi_l] * (1.0 - poslo) + smps[poshi_l + 1] * poslo; - outr[i] = smps[poshi_r] * (1.0 - poslo) + smps[poshi_r + 1] * poslo; - } - return 1; -} -int PADnote::Compute_Cubic(REALTYPE *outl, - REALTYPE *outr, - int freqhi, - REALTYPE freqlo) -{ - REALTYPE *smps = pars->sample[nsample].smp; - if(smps == NULL) { - finished_ = true; - return 1; - } - int size = pars->sample[nsample].size; - REALTYPE xm1, x0, x1, x2, a, b, c; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - poshi_l += freqhi; - poshi_r += freqhi; - poslo += freqlo; - if(poslo >= 1.0) { - poshi_l += 1; - poshi_r += 1; - poslo -= 1.0; - } - if(poshi_l >= size) - poshi_l %= size; - if(poshi_r >= size) - poshi_r %= size; - - - //left - xm1 = smps[poshi_l]; - x0 = smps[poshi_l + 1]; - x1 = smps[poshi_l + 2]; - x2 = smps[poshi_l + 3]; - a = (3.0 * (x0 - x1) - xm1 + x2) * 0.5; - b = 2.0 * x1 + xm1 - (5.0 * x0 + x2) * 0.5; - c = (x1 - xm1) * 0.5; - outl[i] = (((a * poslo) + b) * poslo + c) * poslo + x0; - //right - xm1 = smps[poshi_r]; - x0 = smps[poshi_r + 1]; - x1 = smps[poshi_r + 2]; - x2 = smps[poshi_r + 3]; - a = (3.0 * (x0 - x1) - xm1 + x2) * 0.5; - b = 2.0 * x1 + xm1 - (5.0 * x0 + x2) * 0.5; - c = (x1 - xm1) * 0.5; - outr[i] = (((a * poslo) + b) * poslo + c) * poslo + x0; - } - return 1; -} - - -int PADnote::noteout(REALTYPE *outl, REALTYPE *outr) -{ - computecurrentparameters(); - REALTYPE *smps = pars->sample[nsample].smp; - if(smps == NULL) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] = 0.0; - outr[i] = 0.0; - } - return 1; - } - REALTYPE smpfreq = pars->sample[nsample].basefreq; - - - REALTYPE freqrap = realfreq / smpfreq; - int freqhi = (int) (floor(freqrap)); - REALTYPE freqlo = freqrap - floor(freqrap); - - - if(config.cfg.Interpolation) - Compute_Cubic(outl, outr, freqhi, freqlo); - else - Compute_Linear(outl, outr, freqhi, freqlo); - - - if(firsttime) { - fadein(outl); - fadein(outr); - firsttime = false; - } - - NoteGlobalPar.GlobalFilterL->filterout(outl); - NoteGlobalPar.GlobalFilterR->filterout(outr); - - //Apply the punch - if(NoteGlobalPar.Punch.Enabled != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE punchamp = NoteGlobalPar.Punch.initialvalue - * NoteGlobalPar.Punch.t + 1.0; - outl[i] *= punchamp; - outr[i] *= punchamp; - NoteGlobalPar.Punch.t -= NoteGlobalPar.Punch.dt; - if(NoteGlobalPar.Punch.t < 0.0) { - NoteGlobalPar.Punch.Enabled = 0; - break; - } - } - } - - if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) { - // Amplitude Interpolation - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, - globalnewamplitude, - i, - SOUND_BUFFER_SIZE); - outl[i] *= tmpvol * NoteGlobalPar.Panning; - outr[i] *= tmpvol * (1.0 - NoteGlobalPar.Panning); - } - } - else { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; - outr[i] *= globalnewamplitude * (1.0 - NoteGlobalPar.Panning); - } - } - - - // Apply legato-specific sound signal modifications - if(Legato.silent) // Silencer - if(Legato.msg != LM_FadeIn) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] = 0.0; - outr[i] = 0.0; - } - switch(Legato.msg) { - case LM_CatchUp: // Continue the catch-up... - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //Yea, could be done without the loop... - Legato.decounter--; - if(Legato.decounter < 1) { - // Catching-up done, we can finally set - // the note to the actual parameters. - Legato.decounter = -10; - Legato.msg = LM_ToNorm; - PADlegatonote(Legato.param.freq, - Legato.param.vel, - Legato.param.portamento, - Legato.param.midinote, - false); - break; - } - } - break; - case LM_FadeIn: // Fade-in - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - Legato.silent = false; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - Legato.decounter--; - if(Legato.decounter < 1) { - Legato.decounter = -10; - Legato.msg = LM_Norm; - break; - } - Legato.fade.m += Legato.fade.step; - outl[i] *= Legato.fade.m; - outr[i] *= Legato.fade.m; - } - break; - case LM_FadeOut: // Fade-out, then set the catch-up - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { - Legato.decounter--; - if(Legato.decounter < 1) { - for(int j = i; j < SOUND_BUFFER_SIZE; j++) { - outl[j] = 0.0; - outr[j] = 0.0; - } - Legato.decounter = -10; - Legato.silent = true; - // Fading-out done, now set the catch-up : - Legato.decounter = Legato.fade.length; - Legato.msg = LM_CatchUp; - REALTYPE catchupfreq = Legato.param.freq - * (Legato.param.freq / Legato.lastfreq); //This freq should make this now silent note to catch-up (or should I say resync ?) with the heard note for the same length it stayed at the previous freq during the fadeout. - PADlegatonote(catchupfreq, - Legato.param.vel, - Legato.param.portamento, - Legato.param.midinote, - false); - break; - } - Legato.fade.m -= Legato.fade.step; - outl[i] *= Legato.fade.m; - outr[i] *= Legato.fade.m; - } - break; - default: - break; - } - - - // Check if the global amplitude is finished. - // If it does, disable the note - if(NoteGlobalPar.AmpEnvelope->finished() != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out - REALTYPE tmp = 1.0 - (REALTYPE)i / (REALTYPE)SOUND_BUFFER_SIZE; - outl[i] *= tmp; - outr[i] *= tmp; - } - finished_ = 1; - } - - return 1; -} - -int PADnote::finished() -{ - return finished_; -} - -void PADnote::relasekey() -{ - NoteGlobalPar.FreqEnvelope->relasekey(); - NoteGlobalPar.FilterEnvelope->relasekey(); - NoteGlobalPar.AmpEnvelope->relasekey(); -} - diff --git a/plugins/zynaddsubfx/src/Synth/PADnote.h b/plugins/zynaddsubfx/src/Synth/PADnote.h deleted file mode 100644 index 956353218..000000000 --- a/plugins/zynaddsubfx/src/Synth/PADnote.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PADnote.h - The "pad" synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PAD_NOTE_H -#define PAD_NOTE_H - -#include "../globals.h" -#include "../Params/PADnoteParameters.h" -#include "../Params/Controller.h" -#include "Envelope.h" -#include "LFO.h" -#include "../DSP/Filter.h" -#include "../Params/Controller.h" - -/**The "pad" synthesizer*/ -class PADnote -{ - public: - PADnote(PADnoteParameters *parameters, - Controller *ctl_, - REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool besilent); - ~PADnote(); - - void PADlegatonote(REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool externcall); - - int noteout(REALTYPE *outl, REALTYPE *outr); - int finished(); - void relasekey(); - - int ready; - - private: - void fadein(REALTYPE *smps); - void computecurrentparameters(); - bool finished_; - PADnoteParameters *pars; - - int poshi_l, poshi_r; - REALTYPE poslo; - - REALTYPE basefreq; - bool firsttime, released; - - int nsample, portamento; - - int Compute_Linear(REALTYPE *outl, - REALTYPE *outr, - int freqhi, - REALTYPE freqlo); - int Compute_Cubic(REALTYPE *outl, - REALTYPE *outr, - int freqhi, - REALTYPE freqlo); - - - struct { - /****************************************** - * FREQUENCY GLOBAL PARAMETERS * - ******************************************/ - REALTYPE Detune; //cents - - Envelope *FreqEnvelope; - LFO *FreqLfo; - - /******************************************** - * AMPLITUDE GLOBAL PARAMETERS * - ********************************************/ - REALTYPE Volume; // [ 0 .. 1 ] - - REALTYPE Panning; // [ 0 .. 1 ] - - Envelope *AmpEnvelope; - LFO *AmpLfo; - - struct { - int Enabled; - REALTYPE initialvalue, dt, t; - } Punch; - - /****************************************** - * FILTER GLOBAL PARAMETERS * - ******************************************/ - Filter *GlobalFilterL, *GlobalFilterR; - - REALTYPE FilterCenterPitch; //octaves - REALTYPE FilterQ; - REALTYPE FilterFreqTracking; - - Envelope *FilterEnvelope; - - LFO *FilterLfo; - } NoteGlobalPar; - - - REALTYPE globaloldamplitude, globalnewamplitude, velocity, realfreq; - REALTYPE *tmpwave; - Controller *ctl; - - // Legato vars - struct { - bool silent; - REALTYPE lastfreq; - LegatoMsg msg; - int decounter; - struct { // Fade In/Out vars - int length; - REALTYPE m, step; - } fade; - struct { // Note parameters - REALTYPE freq, vel; - int portamento, midinote; - } param; - } Legato; -}; - - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/Resonance.cpp b/plugins/zynaddsubfx/src/Synth/Resonance.cpp deleted file mode 100644 index 2bf8c633c..000000000 --- a/plugins/zynaddsubfx/src/Synth/Resonance.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Resonance.cpp - Resonance - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include "Resonance.h" - - -#include - -Resonance::Resonance():Presets() -{ - setpresettype("Presonance"); - defaults(); -} - -Resonance::~Resonance() -{} - - -void Resonance::defaults() -{ - Penabled = 0; - PmaxdB = 20; - Pcenterfreq = 64; //1 kHz - Poctavesfreq = 64; - Pprotectthefundamental = 0; - ctlcenter = 1.0; - ctlbw = 1.0; - for(int i = 0; i < N_RES_POINTS; i++) - Prespoints[i] = 64; -} - -/* - * Set a point of resonance function with a value - */ -void Resonance::setpoint(int n, unsigned char p) -{ - if((n < 0) || (n >= N_RES_POINTS)) - return; - Prespoints[n] = p; -} - -/* - * Apply the resonance to FFT data - */ -void Resonance::applyres(int n, FFTFREQS fftdata, REALTYPE freq) -{ - if(Penabled == 0) - return; //if the resonance is disabled - REALTYPE sum = 0.0, - l1 = log(getfreqx(0.0) * ctlcenter), - l2 = log(2.0) * getoctavesfreq() * ctlbw; - - for(int i = 0; i < N_RES_POINTS; i++) - if(sum < Prespoints[i]) - sum = Prespoints[i]; - if(sum < 1.0) - sum = 1.0; - - for(int i = 1; i < n; i++) { - REALTYPE x = (log(freq * i) - l1) / l2; //compute where the n-th hamonics fits to the graph - if(x < 0.0) - x = 0.0; - - x *= N_RES_POINTS; - REALTYPE dx = x - floor(x); - x = floor(x); - int kx1 = (int)x; - if(kx1 >= N_RES_POINTS) - kx1 = N_RES_POINTS - 1; - int kx2 = kx1 + 1; - if(kx2 >= N_RES_POINTS) - kx2 = N_RES_POINTS - 1; - REALTYPE y = - (Prespoints[kx1] - * (1.0 - dx) + Prespoints[kx2] * dx) / 127.0 - sum / 127.0; - - y = pow(10.0, y * PmaxdB / 20.0); - - if((Pprotectthefundamental != 0) && (i == 1)) - y = 1.0; - - fftdata.c[i] *= y; - fftdata.s[i] *= y; - } -} - -/* - * Gets the response at the frequency "freq" - */ - -REALTYPE Resonance::getfreqresponse(REALTYPE freq) -{ - REALTYPE l1 = log(getfreqx(0.0) * ctlcenter), - l2 = log(2.0) * getoctavesfreq() * ctlbw, sum = 0.0; - - for(int i = 0; i < N_RES_POINTS; i++) - if(sum < Prespoints[i]) - sum = Prespoints[i]; - if(sum < 1.0) - sum = 1.0; - - REALTYPE x = (log(freq) - l1) / l2; //compute where the n-th hamonics fits to the graph - if(x < 0.0) - x = 0.0; - x *= N_RES_POINTS; - REALTYPE dx = x - floor(x); - x = floor(x); - int kx1 = (int)x; - if(kx1 >= N_RES_POINTS) - kx1 = N_RES_POINTS - 1; - int kx2 = kx1 + 1; - if(kx2 >= N_RES_POINTS) - kx2 = N_RES_POINTS - 1; - REALTYPE result = - (Prespoints[kx1] - * (1.0 - dx) + Prespoints[kx2] * dx) / 127.0 - sum / 127.0; - result = pow(10.0, result * PmaxdB / 20.0); - return result; -} - - -/* - * Smooth the resonance function - */ -void Resonance::smooth() -{ - REALTYPE old = Prespoints[0]; - for(int i = 0; i < N_RES_POINTS; i++) { - old = old * 0.4 + Prespoints[i] * 0.6; - Prespoints[i] = (int) old; - } - old = Prespoints[N_RES_POINTS - 1]; - for(int i = N_RES_POINTS - 1; i > 0; i--) { - old = old * 0.4 + Prespoints[i] * 0.6; - Prespoints[i] = (int) old + 1; - if(Prespoints[i] > 127) - Prespoints[i] = 127; - } -} - -/* - * Randomize the resonance function - */ -void Resonance::randomize(int type) -{ - int r = (int)(RND * 127.0); - for(int i = 0; i < N_RES_POINTS; i++) { - Prespoints[i] = r; - if((RND < 0.1) && (type == 0)) - r = (int)(RND * 127.0); - if((RND < 0.3) && (type == 1)) - r = (int)(RND * 127.0); - if(type == 2) - r = (int)(RND * 127.0); - } - smooth(); -} - -/* - * Interpolate the peaks - */ -void Resonance::interpolatepeaks(int type) -{ - int x1 = 0, y1 = Prespoints[0]; - for(int i = 1; i < N_RES_POINTS; i++) { - if((Prespoints[i] != 64) || (i + 1 == N_RES_POINTS)) { - int y2 = Prespoints[i]; - for(int k = 0; k < i - x1; k++) { - float x = (float) k / (i - x1); - if(type == 0) - x = (1 - cos(x * PI)) * 0.5; - Prespoints[x1 + k] = (int)(y1 * (1.0 - x) + y2 * x); - } - x1 = i; - y1 = y2; - } - } -} - -/* - * Get the frequency from x, where x is [0..1]; x is the x coordinate - */ -REALTYPE Resonance::getfreqx(REALTYPE x) -{ - if(x > 1.0) - x = 1.0; - REALTYPE octf = pow(2.0, getoctavesfreq()); - return getcenterfreq() / sqrt(octf) * pow(octf, x); -} - -/* - * Get the x coordinate from frequency (used by the UI) - */ -REALTYPE Resonance::getfreqpos(REALTYPE freq) -{ - return (log(freq) - log(getfreqx(0.0))) / log(2.0) / getoctavesfreq(); -} - -/* - * Get the center frequency of the resonance graph - */ -REALTYPE Resonance::getcenterfreq() -{ - return 10000.0 * pow(10, -(1.0 - Pcenterfreq / 127.0) * 2.0); -} - -/* - * Get the number of octave that the resonance functions applies to - */ -REALTYPE Resonance::getoctavesfreq() -{ - return 0.25 + 10.0 * Poctavesfreq / 127.0; -} - -void Resonance::sendcontroller(MidiControllers ctl, REALTYPE par) -{ - if(ctl == C_resonance_center) - ctlcenter = par; - else - ctlbw = par; -} - - - - -void Resonance::add2XML(XMLwrapper *xml) -{ - xml->addparbool("enabled", Penabled); - - if((Penabled == 0) && (xml->minimal)) - return; - - xml->addpar("max_db", PmaxdB); - xml->addpar("center_freq", Pcenterfreq); - xml->addpar("octaves_freq", Poctavesfreq); - xml->addparbool("protect_fundamental_frequency", Pprotectthefundamental); - xml->addpar("resonance_points", N_RES_POINTS); - for(int i = 0; i < N_RES_POINTS; i++) { - xml->beginbranch("RESPOINT", i); - xml->addpar("val", Prespoints[i]); - xml->endbranch(); - } -} - - -void Resonance::getfromXML(XMLwrapper *xml) -{ - Penabled = xml->getparbool("enabled", Penabled); - - PmaxdB = xml->getpar127("max_db", PmaxdB); - Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); - Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); - Pprotectthefundamental = xml->getparbool("protect_fundamental_frequency", - Pprotectthefundamental); - for(int i = 0; i < N_RES_POINTS; i++) { - if(xml->enterbranch("RESPOINT", i) == 0) - continue; - Prespoints[i] = xml->getpar127("val", Prespoints[i]); - xml->exitbranch(); - } -} - diff --git a/plugins/zynaddsubfx/src/Synth/Resonance.h b/plugins/zynaddsubfx/src/Synth/Resonance.h deleted file mode 100644 index 6df43093d..000000000 --- a/plugins/zynaddsubfx/src/Synth/Resonance.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Resonance.h - Resonance - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef RESONANCE_H -#define RESONANCE_H - -#include "../globals.h" -#include "../Misc/Util.h" -#include "../Misc/XMLwrapper.h" -#include "../Params/Presets.h" - -#define N_RES_POINTS 256 - -class Resonance:public Presets -{ - public: - Resonance(); - ~Resonance(); - void setpoint(int n, unsigned char p); - void applyres(int n, FFTFREQS fftdata, REALTYPE freq); - void smooth(); - void interpolatepeaks(int type); - void randomize(int type); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - - REALTYPE getfreqpos(REALTYPE freq); - REALTYPE getfreqx(REALTYPE x); - REALTYPE getfreqresponse(REALTYPE freq); - REALTYPE getcenterfreq(); - REALTYPE getoctavesfreq(); - void sendcontroller(MidiControllers ctl, REALTYPE par); - - //parameters - unsigned char Penabled; //if the ressonance is enabled - unsigned char Prespoints[N_RES_POINTS]; //how many points define the resonance function - unsigned char PmaxdB; //how many dB the signal may be amplified - unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves - unsigned char Pprotectthefundamental; //the fundamental (1-st harmonic) is not damped, even it resonance function is low - - //controllers - REALTYPE ctlcenter; //center frequency(relative) - REALTYPE ctlbw; //bandwidth(relative) - - private: -}; - -#endif - diff --git a/plugins/zynaddsubfx/src/Synth/SUBnote.cpp b/plugins/zynaddsubfx/src/Synth/SUBnote.cpp deleted file mode 100644 index 0ef075701..000000000 --- a/plugins/zynaddsubfx/src/Synth/SUBnote.cpp +++ /dev/null @@ -1,790 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnote.cpp - The "subtractive" synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include "../globals.h" -#include "SUBnote.h" -#include "../Misc/Util.h" - -SUBnote::SUBnote(SUBnoteParameters *parameters, - Controller *ctl_, - REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool besilent) -{ - ready = 0; - - tmpsmp = new REALTYPE[SOUND_BUFFER_SIZE]; - tmprnd = new REALTYPE[SOUND_BUFFER_SIZE]; - - // Initialise some legato-specific vars - Legato.msg = LM_Norm; - Legato.fade.length = (int)(SAMPLE_RATE * 0.005); // 0.005 seems ok. - if(Legato.fade.length < 1) - Legato.fade.length = 1; // (if something's fishy) - Legato.fade.step = (1.0 / Legato.fade.length); - Legato.decounter = -10; - Legato.param.freq = freq; - Legato.param.vel = velocity; - Legato.param.portamento = portamento_; - Legato.param.midinote = midinote; - Legato.silent = besilent; - - pars = parameters; - ctl = ctl_; - portamento = portamento_; - NoteEnabled = ON; - volume = pow(0.1, 3.0 * (1.0 - pars->PVolume / 96.0)); //-60 dB .. 0 dB - volume *= VelF(velocity, pars->PAmpVelocityScaleFunction); - if(pars->PPanning != 0) - panning = pars->PPanning / 127.0; - else - panning = RND; - numstages = pars->Pnumstages; - stereo = pars->Pstereo; - start = pars->Pstart; - firsttick = 1; - int pos[MAX_SUB_HARMONICS]; - - if(pars->Pfixedfreq == 0) - basefreq = freq; - else { - basefreq = 440.0; - int fixedfreqET = pars->PfixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - REALTYPE tmp = - (midinote - - 69.0) / 12.0 * (pow(2.0, (fixedfreqET - 1) / 63.0) - 1.0); - if(fixedfreqET <= 64) - basefreq *= pow(2.0, tmp); - else - basefreq *= pow(3.0, tmp); - } - } - REALTYPE detune = getdetune(pars->PDetuneType, - pars->PCoarseDetune, - pars->PDetune); - basefreq *= pow(2.0, detune / 1200.0); //detune -// basefreq*=ctl->pitchwheel.relfreq;//pitch wheel - - //global filter - GlobalFilterCenterPitch = pars->GlobalFilter->getfreq() //center freq - + (pars->PGlobalFilterVelocityScale / 127.0 * 6.0) //velocity sensing - * (VelF(velocity, - pars->PGlobalFilterVelocityScaleFunction) - - 1); - - GlobalFilterL = NULL; - GlobalFilterR = NULL; - GlobalFilterEnvelope = NULL; - - //select only harmonics that desire to compute - numharmonics = 0; - for(int n = 0; n < MAX_SUB_HARMONICS; n++) { - if(pars->Phmag[n] == 0) - continue; - if(n * basefreq > SAMPLE_RATE / 2.0) - break; //remove the freqs above the Nyquist freq - pos[numharmonics++] = n; - } - firstnumharmonics = numharmonics; //(gf)Useful in legato mode. - - if(numharmonics == 0) { - NoteEnabled = OFF; - return; - } - - - lfilter = new bpfilter[numstages * numharmonics]; - if(stereo != 0) - rfilter = new bpfilter[numstages * numharmonics]; - - //how much the amplitude is normalised (because the harmonics) - REALTYPE reduceamp = 0.0; - - for(int n = 0; n < numharmonics; n++) { - REALTYPE freq = basefreq * (pos[n] + 1); - - //the bandwidth is not absolute(Hz); it is relative to frequency - REALTYPE bw = - pow(10, (pars->Pbandwidth - 127.0) / 127.0 * 4) * numstages; - - //Bandwidth Scale - bw *= pow(1000 / freq, (pars->Pbwscale - 64.0) / 64.0 * 3.0); - - //Relative BandWidth - bw *= pow(100, (pars->Phrelbw[pos[n]] - 64.0) / 64.0); - - if(bw > 25.0) - bw = 25.0; - - //try to keep same amplitude on all freqs and bw. (empirically) - REALTYPE gain = sqrt(1500.0 / (bw * freq)); - - REALTYPE hmagnew = 1.0 - pars->Phmag[pos[n]] / 127.0; - REALTYPE hgain; - - switch(pars->Phmagtype) { - case 1: - hgain = exp(hmagnew * log(0.01)); - break; - case 2: - hgain = exp(hmagnew * log(0.001)); - break; - case 3: - hgain = exp(hmagnew * log(0.0001)); - break; - case 4: - hgain = exp(hmagnew * log(0.00001)); - break; - default: - hgain = 1.0 - hmagnew; - } - gain *= hgain; - reduceamp += hgain; - - for(int nph = 0; nph < numstages; nph++) { - REALTYPE amp = 1.0; - if(nph == 0) - amp = gain; - initfilter(lfilter[nph + n * numstages], freq, bw, amp, hgain); - if(stereo != 0) - initfilter(rfilter[nph + n * numstages], freq, bw, amp, hgain); - } - } - - if(reduceamp < 0.001) - reduceamp = 1.0; - volume /= reduceamp; - - oldpitchwheel = 0; - oldbandwidth = 64; - if(pars->Pfixedfreq == 0) - initparameters(basefreq); - else - initparameters(basefreq / 440.0 * freq); - - oldamplitude = newamplitude; - ready = 1; -} - - -// SUBlegatonote: This function is (mostly) a copy of SUBnote(...) and -// initparameters(...) stuck together with some lines removed so that -// it only alter the already playing note (to perform legato). It is -// possible I left stuff that is not required for this. -void SUBnote::SUBlegatonote(REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool externcall) -{ - //SUBnoteParameters *parameters=pars; - //Controller *ctl_=ctl; - - // Manage legato stuff - if(externcall) - Legato.msg = LM_Norm; - if(Legato.msg != LM_CatchUp) { - Legato.lastfreq = Legato.param.freq; - Legato.param.freq = freq; - Legato.param.vel = velocity; - Legato.param.portamento = portamento_; - Legato.param.midinote = midinote; - if(Legato.msg == LM_Norm) { - if(Legato.silent) { - Legato.fade.m = 0.0; - Legato.msg = LM_FadeIn; - } - else { - Legato.fade.m = 1.0; - Legato.msg = LM_FadeOut; - return; - } - } - if(Legato.msg == LM_ToNorm) - Legato.msg = LM_Norm; - } - - portamento = portamento_; - - volume = pow(0.1, 3.0 * (1.0 - pars->PVolume / 96.0)); //-60 dB .. 0 dB - volume *= VelF(velocity, pars->PAmpVelocityScaleFunction); - if(pars->PPanning != 0) - panning = pars->PPanning / 127.0; - else - panning = RND; - - ///start=pars->Pstart; - - int pos[MAX_SUB_HARMONICS]; - - if(pars->Pfixedfreq == 0) - basefreq = freq; - else { - basefreq = 440.0; - int fixedfreqET = pars->PfixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - REALTYPE tmp = - (midinote - - 69.0) / 12.0 * (pow(2.0, (fixedfreqET - 1) / 63.0) - 1.0); - if(fixedfreqET <= 64) - basefreq *= pow(2.0, tmp); - else - basefreq *= pow(3.0, tmp); - } - } - REALTYPE detune = getdetune(pars->PDetuneType, - pars->PCoarseDetune, - pars->PDetune); - basefreq *= pow(2.0, detune / 1200.0); //detune - - //global filter - GlobalFilterCenterPitch = pars->GlobalFilter->getfreq() //center freq - + (pars->PGlobalFilterVelocityScale / 127.0 * 6.0) //velocity sensing - * (VelF(velocity, - pars->PGlobalFilterVelocityScaleFunction) - - 1); - - - int legatonumharmonics = 0; - for(int n = 0; n < MAX_SUB_HARMONICS; n++) { - if(pars->Phmag[n] == 0) - continue; - if(n * basefreq > SAMPLE_RATE / 2.0) - break; //remove the freqs above the Nyquist freq - pos[legatonumharmonics++] = n; - } - if(legatonumharmonics > firstnumharmonics) - numharmonics = firstnumharmonics; - else - numharmonics = legatonumharmonics; - - if(numharmonics == 0) { - NoteEnabled = OFF; - return; - } - - - //how much the amplitude is normalised (because the harmonics) - REALTYPE reduceamp = 0.0; - - for(int n = 0; n < numharmonics; n++) { - REALTYPE freq = basefreq * (pos[n] + 1); - - //the bandwidth is not absolute(Hz); it is relative to frequency - REALTYPE bw = - pow(10, (pars->Pbandwidth - 127.0) / 127.0 * 4) * numstages; - - //Bandwidth Scale - bw *= pow(1000 / freq, (pars->Pbwscale - 64.0) / 64.0 * 3.0); - - //Relative BandWidth - bw *= pow(100, (pars->Phrelbw[pos[n]] - 64.0) / 64.0); - - if(bw > 25.0) - bw = 25.0; - - //try to keep same amplitude on all freqs and bw. (empirically) - REALTYPE gain = sqrt(1500.0 / (bw * freq)); - - REALTYPE hmagnew = 1.0 - pars->Phmag[pos[n]] / 127.0; - REALTYPE hgain; - - switch(pars->Phmagtype) { - case 1: - hgain = exp(hmagnew * log(0.01)); - break; - case 2: - hgain = exp(hmagnew * log(0.001)); - break; - case 3: - hgain = exp(hmagnew * log(0.0001)); - break; - case 4: - hgain = exp(hmagnew * log(0.00001)); - break; - default: - hgain = 1.0 - hmagnew; - } - gain *= hgain; - reduceamp += hgain; - - for(int nph = 0; nph < numstages; nph++) { - REALTYPE amp = 1.0; - if(nph == 0) - amp = gain; - initfilter(lfilter[nph + n * numstages], freq, bw, amp, hgain); - if(stereo != 0) - initfilter(rfilter[nph + n * numstages], freq, bw, amp, hgain); - } - } - - if(reduceamp < 0.001) - reduceamp = 1.0; - volume /= reduceamp; - - oldpitchwheel = 0; - oldbandwidth = 64; - - if(pars->Pfixedfreq == 0) - freq = basefreq; - else - freq *= basefreq / 440.0; - - - /////////////// - // Altered initparameters(...) content: - - if(pars->PGlobalFilterEnabled != 0) { - globalfiltercenterq = pars->GlobalFilter->getq(); - GlobalFilterFreqTracking = pars->GlobalFilter->getfreqtracking(basefreq); - } - - // end of the altered initparameters function content. - /////////////// - - oldamplitude = newamplitude; - - // End of the SUBlegatonote function. -} - - -SUBnote::~SUBnote() -{ - if(NoteEnabled != OFF) - KillNote(); - delete [] tmpsmp; - delete [] tmprnd; -} - -/* - * Kill the note - */ -void SUBnote::KillNote() -{ - if(NoteEnabled != OFF) { - delete [] lfilter; - lfilter = NULL; - if(stereo != 0) - delete [] rfilter; - rfilter = NULL; - delete (AmpEnvelope); - if(FreqEnvelope != NULL) - delete (FreqEnvelope); - if(BandWidthEnvelope != NULL) - delete (BandWidthEnvelope); - NoteEnabled = OFF; - } -} - - -/* - * Compute the filters coefficients - */ -void SUBnote::computefiltercoefs(bpfilter &filter, - REALTYPE freq, - REALTYPE bw, - REALTYPE gain) -{ - if(freq > SAMPLE_RATE / 2.0 - 200.0) - freq = SAMPLE_RATE / 2.0 - 200.0; - ; - - REALTYPE omega = 2.0 * PI * freq / SAMPLE_RATE; - REALTYPE sn = sin(omega); - REALTYPE cs = cos(omega); - REALTYPE alpha = sn * sinh(LOG_2 / 2.0 * bw * omega / sn); - - if(alpha > 1) - alpha = 1; - if(alpha > bw) - alpha = bw; - - filter.b0 = alpha / (1.0 + alpha) * filter.amp * gain; - filter.b2 = -alpha / (1.0 + alpha) * filter.amp * gain; - filter.a1 = -2.0 * cs / (1.0 + alpha); - filter.a2 = (1.0 - alpha) / (1.0 + alpha); -} - - -/* - * Initialise the filters - */ -void SUBnote::initfilter(bpfilter &filter, - REALTYPE freq, - REALTYPE bw, - REALTYPE amp, - REALTYPE mag) -{ - filter.xn1 = 0.0; - filter.xn2 = 0.0; - - if(start == 0) { - filter.yn1 = 0.0; - filter.yn2 = 0.0; - } - else { - REALTYPE a = 0.1 * mag; //empirically - REALTYPE p = RND * 2.0 * PI; - if(start == 1) - a *= RND; - filter.yn1 = a * cos(p); - filter.yn2 = a * cos(p + freq * 2.0 * PI / SAMPLE_RATE); - - //correct the error of computation the start amplitude - //at very high frequencies - if(freq > SAMPLE_RATE * 0.96) { - filter.yn1 = 0.0; - filter.yn2 = 0.0; - } - } - - filter.amp = amp; - filter.freq = freq; - filter.bw = bw; - computefiltercoefs(filter, freq, bw, 1.0); -} - -/* - * Do the filtering - */ -void SUBnote::filter(bpfilter &filter, REALTYPE *smps) -{ - int i; - REALTYPE out; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - out = smps[i] * filter.b0 + filter.b2 * filter.xn2 - - filter.a1 * filter.yn1 - filter.a2 * filter.yn2; - filter.xn2 = filter.xn1; - filter.xn1 = smps[i]; - filter.yn2 = filter.yn1; - filter.yn1 = out; - smps[i] = out; - } -} - -/* - * Init Parameters - */ -void SUBnote::initparameters(REALTYPE freq) -{ - AmpEnvelope = new Envelope(pars->AmpEnvelope, freq); - if(pars->PFreqEnvelopeEnabled != 0) - FreqEnvelope = new Envelope(pars->FreqEnvelope, freq); - else - FreqEnvelope = NULL; - if(pars->PBandWidthEnvelopeEnabled != 0) - BandWidthEnvelope = new Envelope(pars->BandWidthEnvelope, freq); - else - BandWidthEnvelope = NULL; - if(pars->PGlobalFilterEnabled != 0) { - globalfiltercenterq = pars->GlobalFilter->getq(); - GlobalFilterL = new Filter(pars->GlobalFilter); - if(stereo != 0) - GlobalFilterR = new Filter(pars->GlobalFilter); - GlobalFilterEnvelope = new Envelope(pars->GlobalFilterEnvelope, - freq); - GlobalFilterFreqTracking = pars->GlobalFilter->getfreqtracking(basefreq); - } - computecurrentparameters(); -} - - -/* - * Compute Parameters of SUBnote for each tick - */ -void SUBnote::computecurrentparameters() -{ - if((FreqEnvelope != NULL) || (BandWidthEnvelope != NULL) - || (oldpitchwheel != ctl->pitchwheel.data) - || (oldbandwidth != ctl->bandwidth.data) - || (portamento != 0)) { - REALTYPE envfreq = 1.0; - REALTYPE envbw = 1.0; - REALTYPE gain = 1.0; - - if(FreqEnvelope != NULL) { - envfreq = FreqEnvelope->envout() / 1200; - envfreq = pow(2.0, envfreq); - } - envfreq *= ctl->pitchwheel.relfreq; //pitch wheel - if(portamento != 0) { //portamento is used - envfreq *= ctl->portamento.freqrap; - if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" - ; - } - - if(BandWidthEnvelope != NULL) { - envbw = BandWidthEnvelope->envout(); - envbw = pow(2, envbw); - } - envbw *= ctl->bandwidth.relbw; //bandwidth controller - - REALTYPE tmpgain = 1.0 / sqrt(envbw * envfreq); - - for(int n = 0; n < numharmonics; n++) { - for(int nph = 0; nph < numstages; nph++) { - if(nph == 0) - gain = tmpgain; - else - gain = 1.0; - computefiltercoefs(lfilter[nph + n * numstages], - lfilter[nph + n * numstages].freq * envfreq, - lfilter[nph + n * numstages].bw * envbw, - gain); - } - } - if(stereo != 0) - for(int n = 0; n < numharmonics; n++) { - for(int nph = 0; nph < numstages; nph++) { - if(nph == 0) - gain = tmpgain; - else - gain = 1.0; - computefiltercoefs( - rfilter[nph + n * numstages], - rfilter[nph + n - * numstages].freq * envfreq, - rfilter[nph + n * numstages].bw * envbw, - gain); - } - } - ; - oldbandwidth = ctl->bandwidth.data; - oldpitchwheel = ctl->pitchwheel.data; - } - newamplitude = volume * AmpEnvelope->envout_dB() * 2.0; - - //Filter - if(GlobalFilterL != NULL) { - REALTYPE globalfilterpitch = GlobalFilterCenterPitch - + GlobalFilterEnvelope->envout(); - REALTYPE filterfreq = globalfilterpitch + ctl->filtercutoff.relfreq - + GlobalFilterFreqTracking; - filterfreq = GlobalFilterL->getrealfreq(filterfreq); - - GlobalFilterL->setfreq_and_q(filterfreq, - globalfiltercenterq * ctl->filterq.relq); - if(GlobalFilterR != NULL) - GlobalFilterR->setfreq_and_q( - filterfreq, - globalfiltercenterq - * ctl->filterq.relq); - } -} - -/* - * Note Output - */ -int SUBnote::noteout(REALTYPE *outl, REALTYPE *outr) -{ - int i; - - memcpy(outl, denormalkillbuf, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - memcpy(outr, denormalkillbuf, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - - if(NoteEnabled == OFF) - return 0; - - //left channel - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmprnd[i] = RND * 2.0 - 1.0; - for(int n = 0; n < numharmonics; n++) { - memcpy(tmpsmp, tmprnd, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - for(int nph = 0; nph < numstages; nph++) - filter(lfilter[nph + n * numstages], tmpsmp); - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - outl[i] += tmpsmp[i]; - } - - if(GlobalFilterL != NULL) - GlobalFilterL->filterout(&outl[0]); - - //right channel - if(stereo != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - tmprnd[i] = RND * 2.0 - 1.0; - for(int n = 0; n < numharmonics; n++) { - memcpy(tmpsmp, tmprnd, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - for(int nph = 0; nph < numstages; nph++) - filter(rfilter[nph + n * numstages], tmpsmp); - for(i = 0; i < SOUND_BUFFER_SIZE; i++) - outr[i] += tmpsmp[i]; - } - if(GlobalFilterR != NULL) - GlobalFilterR->filterout(&outr[0]); - } - else - memcpy(outr, outl, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - - if(firsttick != 0) { - int n = 10; - if(n > SOUND_BUFFER_SIZE) - n = SOUND_BUFFER_SIZE; - for(i = 0; i < n; i++) { - REALTYPE ampfadein = 0.5 - 0.5 * cos( - (REALTYPE) i / (REALTYPE) n * PI); - outl[i] *= ampfadein; - outr[i] *= ampfadein; - } - firsttick = 0; - } - - if(ABOVE_AMPLITUDE_THRESHOLD(oldamplitude, newamplitude)) { - // Amplitude interpolation - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmpvol = INTERPOLATE_AMPLITUDE(oldamplitude, - newamplitude, - i, - SOUND_BUFFER_SIZE); - outl[i] *= tmpvol * panning; - outr[i] *= tmpvol * (1.0 - panning); - } - } - else { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] *= newamplitude * panning; - outr[i] *= newamplitude * (1.0 - panning); - } - } - - oldamplitude = newamplitude; - computecurrentparameters(); - - // Apply legato-specific sound signal modifications - if(Legato.silent) // Silencer - if(Legato.msg != LM_FadeIn) { - memset(outl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - memset(outr, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE)); - } - switch(Legato.msg) { - case LM_CatchUp: // Continue the catch-up... - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //Yea, could be done without the loop... - Legato.decounter--; - if(Legato.decounter < 1) { - // Catching-up done, we can finally set - // the note to the actual parameters. - Legato.decounter = -10; - Legato.msg = LM_ToNorm; - SUBlegatonote(Legato.param.freq, - Legato.param.vel, - Legato.param.portamento, - Legato.param.midinote, - false); - break; - } - } - break; - case LM_FadeIn: // Fade-in - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - Legato.silent = false; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - Legato.decounter--; - if(Legato.decounter < 1) { - Legato.decounter = -10; - Legato.msg = LM_Norm; - break; - } - Legato.fade.m += Legato.fade.step; - outl[i] *= Legato.fade.m; - outr[i] *= Legato.fade.m; - } - break; - case LM_FadeOut: // Fade-out, then set the catch-up - if(Legato.decounter == -10) - Legato.decounter = Legato.fade.length; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - Legato.decounter--; - if(Legato.decounter < 1) { - for(int j = i; j < SOUND_BUFFER_SIZE; j++) { - outl[j] = 0.0; - outr[j] = 0.0; - } - Legato.decounter = -10; - Legato.silent = true; - // Fading-out done, now set the catch-up : - Legato.decounter = Legato.fade.length; - Legato.msg = LM_CatchUp; - REALTYPE catchupfreq = Legato.param.freq - * (Legato.param.freq / Legato.lastfreq); //This freq should make this now silent note to catch-up (or should I say resync ?) with the heard note for the same length it stayed at the previous freq during the fadeout. - SUBlegatonote(catchupfreq, - Legato.param.vel, - Legato.param.portamento, - Legato.param.midinote, - false); - break; - } - Legato.fade.m -= Legato.fade.step; - outl[i] *= Legato.fade.m; - outr[i] *= Legato.fade.m; - } - break; - default: - break; - } - - // Check if the note needs to be computed more - if(AmpEnvelope->finished() != 0) { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out - REALTYPE tmp = 1.0 - (REALTYPE)i / (REALTYPE)SOUND_BUFFER_SIZE; - outl[i] *= tmp; - outr[i] *= tmp; - } - KillNote(); - } - return 1; -} - -/* - * Relase Key (Note Off) - */ -void SUBnote::relasekey() -{ - AmpEnvelope->relasekey(); - if(FreqEnvelope != NULL) - FreqEnvelope->relasekey(); - if(BandWidthEnvelope != NULL) - BandWidthEnvelope->relasekey(); - if(GlobalFilterEnvelope != NULL) - GlobalFilterEnvelope->relasekey(); -} - -/* - * Check if the note is finished - */ -int SUBnote::finished() -{ - if(NoteEnabled == OFF) - return 1; - else - return 0; -} - diff --git a/plugins/zynaddsubfx/src/Synth/SUBnote.h b/plugins/zynaddsubfx/src/Synth/SUBnote.h deleted file mode 100644 index e6b875e48..000000000 --- a/plugins/zynaddsubfx/src/Synth/SUBnote.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnote.h - The subtractive synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef SUB_NOTE_H -#define SUB_NOTE_H - -#include "../globals.h" -#include "../Params/SUBnoteParameters.h" -#include "../Params/Controller.h" -#include "Envelope.h" -#include "../DSP/Filter.h" - -class SUBnote -{ - public: - SUBnote(SUBnoteParameters *parameters, - Controller *ctl_, - REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool besilent); - ~SUBnote(); - - void SUBlegatonote(REALTYPE freq, - REALTYPE velocity, - int portamento_, - int midinote, - bool externcall); - - int noteout(REALTYPE *outl, REALTYPE *outr); //note output,return 0 if the note is finished - void relasekey(); - int finished(); - - int ready; //if I can get the sampledata - - private: - - void computecurrentparameters(); - void initparameters(REALTYPE freq); - void KillNote(); - - SUBnoteParameters *pars; - - //parameters - int stereo; - int numstages; //number of stages of filters - int numharmonics; //number of harmonics (after the too higher hamonics are removed) - int firstnumharmonics; //To keep track of the first note's numharmonics value, useful in legato mode. - int start; //how the harmonics start - REALTYPE basefreq; - REALTYPE panning; - Envelope *AmpEnvelope; - Envelope *FreqEnvelope; - Envelope *BandWidthEnvelope; - - Filter *GlobalFilterL, *GlobalFilterR; - - Envelope *GlobalFilterEnvelope; - - //internal values - ONOFFTYPE NoteEnabled; - int firsttick, portamento; - REALTYPE volume, oldamplitude, newamplitude; - - REALTYPE GlobalFilterCenterPitch; //octaves - REALTYPE GlobalFilterFreqTracking; - - struct bpfilter { - REALTYPE freq, bw, amp; //filter parameters - REALTYPE a1, a2, b0, b2; //filter coefs. b1=0 - REALTYPE xn1, xn2, yn1, yn2; //filter internal values - }; - - void initfilter(bpfilter &filter, - REALTYPE freq, - REALTYPE bw, - REALTYPE amp, - REALTYPE mag); - void computefiltercoefs(bpfilter &filter, - REALTYPE freq, - REALTYPE bw, - REALTYPE gain); - inline void filter(bpfilter &filter, REALTYPE *smps); - - bpfilter *lfilter, *rfilter; - - REALTYPE *tmpsmp; - REALTYPE *tmprnd; //this is filled with random numbers - - Controller *ctl; - int oldpitchwheel, oldbandwidth; - REALTYPE globalfiltercenterq; - - // Legato vars - struct { - bool silent; - REALTYPE lastfreq; - LegatoMsg msg; - int decounter; - struct { // Fade In/Out vars - int length; - REALTYPE m, step; - } fade; - struct { // Note parameters - REALTYPE freq, vel; - int portamento, midinote; - } param; - } Legato; -}; - - - - -#endif - diff --git a/plugins/zynaddsubfx/src/UI/ADnoteUI.cc b/plugins/zynaddsubfx/src/UI/ADnoteUI.cc deleted file mode 100644 index bf32baa2b..000000000 --- a/plugins/zynaddsubfx/src/UI/ADnoteUI.cc +++ /dev/null @@ -1,2202 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "ADnoteUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later -#include -#include -#include -#include - -void ADvoicelistitem::cb_voicevolume_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PVolume=(int)o->value(); -} -void ADvoicelistitem::cb_voicevolume(Fl_Value_Slider* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_voicevolume_i(o,v); -} - -void ADvoicelistitem::cb_voiceresonanceenabled_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].Presonance=(int)o->value(); -} -void ADvoicelistitem::cb_voiceresonanceenabled(Fl_Check_Button* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_voiceresonanceenabled_i(o,v); -} - -void ADvoicelistitem::cb_voicelfofreq_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].FreqLfo->Pintensity=(int)o->value(); -} -void ADvoicelistitem::cb_voicelfofreq(Fl_Value_Slider* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_voicelfofreq_i(o,v); -} - -void ADvoicelistitem::cb_voicepanning_i(WidgetPDial* o, void*) { - pars->VoicePar[nvoice].PPanning=(int) o->value(); -} -void ADvoicelistitem::cb_voicepanning(WidgetPDial* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_voicepanning_i(o,v); -} - -void ADvoicelistitem::cb_detunevalueoutput_i(Fl_Value_Output* o, void*) { - o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier()); -} -void ADvoicelistitem::cb_detunevalueoutput(Fl_Value_Output* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_detunevalueoutput_i(o,v); -} - -void ADvoicelistitem::cb_voicedetune_i(Fl_Slider* o, void*) { - pars->VoicePar[nvoice].PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback(); -} -void ADvoicelistitem::cb_voicedetune(Fl_Slider* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_voicedetune_i(o,v); -} - -void ADvoicelistitem::cb_noiselabel_i(Fl_Box* o, void*) { - if (pars->VoicePar[nvoice].Type==0) { - o->hide(); - voiceresonanceenabled->activate(); - detunevalueoutput->activate(); - voicedetune->activate(); - voicelfofreq->activate(); - voiceoscil->activate(); -} else { - o->show(); - voiceresonanceenabled->deactivate(); - detunevalueoutput->deactivate(); - voicedetune->deactivate(); - voicelfofreq->deactivate(); - voiceoscil->deactivate(); -}; -} -void ADvoicelistitem::cb_noiselabel(Fl_Box* o, void* v) { - ((ADvoicelistitem*)(o->parent()->parent()->user_data()))->cb_noiselabel_i(o,v); -} - -void ADvoicelistitem::cb_voiceenabled_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].Enabled=(int)o->value(); -if (o->value()==0) voicelistitemgroup->deactivate(); -else voicelistitemgroup->activate(); -o->redraw(); -} -void ADvoicelistitem::cb_voiceenabled(Fl_Check_Button* o, void* v) { - ((ADvoicelistitem*)(o->parent()->user_data()))->cb_voiceenabled_i(o,v); -} - -Fl_Group* ADvoicelistitem::make_window() { - { ADnoteVoiceListItem = new Fl_Group(0, 0, 615, 30); - ADnoteVoiceListItem->box(FL_FLAT_BOX); - ADnoteVoiceListItem->color(FL_BACKGROUND_COLOR); - ADnoteVoiceListItem->selection_color(FL_BACKGROUND_COLOR); - ADnoteVoiceListItem->labeltype(FL_NO_LABEL); - ADnoteVoiceListItem->labelfont(0); - ADnoteVoiceListItem->labelsize(14); - ADnoteVoiceListItem->labelcolor(FL_FOREGROUND_COLOR); - ADnoteVoiceListItem->user_data((void*)(this)); - ADnoteVoiceListItem->align(Fl_Align(FL_ALIGN_TOP)); - ADnoteVoiceListItem->when(FL_WHEN_RELEASE); - { Fl_Group* o = voicelistitemgroup = new Fl_Group(50, 0, 570, 25); - voicelistitemgroup->box(FL_FLAT_BOX); - { Fl_Value_Slider* o = voicevolume = new Fl_Value_Slider(90, 5, 115, 20); - voicevolume->tooltip("Volume"); - voicevolume->type(5); - voicevolume->box(FL_FLAT_BOX); - voicevolume->labelsize(8); - voicevolume->maximum(127); - voicevolume->step(1); - voicevolume->callback((Fl_Callback*)cb_voicevolume); - voicevolume->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(pars->VoicePar[nvoice].PVolume); - } // Fl_Value_Slider* voicevolume - { Fl_Check_Button* o = voiceresonanceenabled = new Fl_Check_Button(245, 7, 15, 17); - voiceresonanceenabled->tooltip("Resonance On/Off"); - voiceresonanceenabled->down_box(FL_DOWN_BOX); - voiceresonanceenabled->labeltype(FL_EMBOSSED_LABEL); - voiceresonanceenabled->labelfont(1); - voiceresonanceenabled->labelsize(11); - voiceresonanceenabled->callback((Fl_Callback*)cb_voiceresonanceenabled); - voiceresonanceenabled->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(pars->VoicePar[nvoice].Presonance); - } // Fl_Check_Button* voiceresonanceenabled - { Fl_Value_Slider* o = voicelfofreq = new Fl_Value_Slider(500, 5, 115, 20); - voicelfofreq->tooltip("Frequency LFO amount"); - voicelfofreq->type(5); - voicelfofreq->box(FL_FLAT_BOX); - voicelfofreq->labelsize(8); - voicelfofreq->maximum(127); - voicelfofreq->step(1); - voicelfofreq->callback((Fl_Callback*)cb_voicelfofreq); - voicelfofreq->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(pars->VoicePar[nvoice].FreqLfo->Pintensity); - } // Fl_Value_Slider* voicelfofreq - { WidgetPDial* o = voicepanning = new WidgetPDial(215, 5, 20, 20); - voicepanning->tooltip("Panning (leftmost is Random)"); - voicepanning->box(FL_ROUND_UP_BOX); - voicepanning->color(FL_BACKGROUND_COLOR); - voicepanning->selection_color(FL_INACTIVE_COLOR); - voicepanning->labeltype(FL_NORMAL_LABEL); - voicepanning->labelfont(0); - voicepanning->labelsize(10); - voicepanning->labelcolor(FL_FOREGROUND_COLOR); - voicepanning->maximum(127); - voicepanning->step(1); - voicepanning->callback((Fl_Callback*)cb_voicepanning); - voicepanning->align(Fl_Align(FL_ALIGN_LEFT)); - voicepanning->when(FL_WHEN_CHANGED); - o->value(pars->VoicePar[nvoice].PPanning); - } // WidgetPDial* voicepanning - { Fl_Group* o = voiceoscil = new Fl_Group(60, 5, 30, 20); - voiceoscil->box(FL_THIN_DOWN_BOX); - voiceoscil->color(FL_GRAY0); - voiceoscil->selection_color((Fl_Color)71); - voiceoscil->labelcolor((Fl_Color)179); - osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),""); - osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); - if (pars->VoicePar[nvoice].Pextoscil != -1) {osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,master);} - voiceoscil->end(); - } // Fl_Group* voiceoscil - { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(265, 5, 45, 20); - detunevalueoutput->labelsize(10); - detunevalueoutput->minimum(-5000); - detunevalueoutput->maximum(5000); - detunevalueoutput->step(0.01); - detunevalueoutput->textfont(1); - detunevalueoutput->textsize(10); - detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput); - detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(getdetune(pars->VoicePar[nvoice].PDetuneType,0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier()); - } // Fl_Value_Output* detunevalueoutput - { Fl_Slider* o = voicedetune = new Fl_Slider(315, 5, 185, 20); - voicedetune->tooltip("Fine Detune (cents)"); - voicedetune->type(5); - voicedetune->box(FL_FLAT_BOX); - voicedetune->minimum(-8192); - voicedetune->maximum(8191); - voicedetune->step(1); - voicedetune->callback((Fl_Callback*)cb_voicedetune); - o->value(pars->VoicePar[nvoice].PDetune-8192); - } // Fl_Slider* voicedetune - { Fl_Box* o = noiselabel = new Fl_Box(65, 5, 20, 20, "N"); - noiselabel->labelfont(1); - noiselabel->labelsize(13); - noiselabel->labelcolor(FL_BACKGROUND2_COLOR); - noiselabel->callback((Fl_Callback*)cb_noiselabel); - if (pars->VoicePar[nvoice].Type==0) o->hide(); - } // Fl_Box* noiselabel - if (pars->VoicePar[nvoice].Enabled==0) o->deactivate(); - voicelistitemgroup->end(); - } // Fl_Group* voicelistitemgroup - { Fl_Check_Button* o = voiceenabled = new Fl_Check_Button(30, 5, 20, 20, "01"); - voiceenabled->down_box(FL_DOWN_BOX); - voiceenabled->labeltype(FL_EMBOSSED_LABEL); - voiceenabled->labelfont(1); - voiceenabled->labelsize(13); - voiceenabled->callback((Fl_Callback*)cb_voiceenabled); - voiceenabled->align(Fl_Align(FL_ALIGN_LEFT)); - char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp)); - o->value(pars->VoicePar[nvoice].Enabled); - } // Fl_Check_Button* voiceenabled - ADnoteVoiceListItem->end(); - } // Fl_Group* ADnoteVoiceListItem - return ADnoteVoiceListItem; -} - -ADvoicelistitem::ADvoicelistitem(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - nvoice=0; - pars=NULL; -} - -void ADvoicelistitem::init(ADnoteParameters *parameters,int nvoice_,Master *master_) { - pars=parameters; - nvoice=nvoice_; - master=master_; - make_window(); - ADnoteVoiceListItem->show(); - end(); -} - -void ADvoicelistitem::refreshlist() { - voiceenabled->value(pars->VoicePar[nvoice].Enabled); - voiceresonanceenabled->value(pars->VoicePar[nvoice].Presonance); - voicevolume->value(pars->VoicePar[nvoice].PVolume); - voicedetune->value(pars->VoicePar[nvoice].PDetune-8192); - voicepanning->value(pars->VoicePar[nvoice].PPanning); - voicelfofreq->value(pars->VoicePar[nvoice].FreqLfo->Pintensity); - if (pars->VoicePar[nvoice].Pextoscil != -1) { - osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); - } else - osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); - if (pars->VoicePar[nvoice].Enabled==0) voicelistitemgroup->deactivate(); - else voicelistitemgroup->activate(); - detunevalueoutput->do_callback(); - noiselabel->do_callback(); - ADnoteVoiceListItem->redraw(); -} - -ADvoicelistitem::~ADvoicelistitem() { - ADnoteVoiceListItem->hide(); - //delete(ADnoteVoiceListItem); -} - -void ADvoiceUI::cb_Enable_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceFMfreqenvgroup->deactivate(); -else voiceFMfreqenvgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Enable_i(o,v); -} - -void ADvoiceUI::cb_Coarse_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=1024; -pars->VoicePar[nvoice].PFMCoarseDetune = k+ - (pars->VoicePar[nvoice].PFMCoarseDetune/1024)*1024; -} -void ADvoiceUI::cb_Coarse(Fl_Counter* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Coarse_i(o,v); -} - -void ADvoiceUI::cb_Octave_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=16; -pars->VoicePar[nvoice].PFMCoarseDetune = k*1024+ - pars->VoicePar[nvoice].PFMCoarseDetune%1024; -} -void ADvoiceUI::cb_Octave(Fl_Counter* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Octave_i(o,v); -} - -void ADvoiceUI::cb__i(Fl_Slider* o, void*) { - pars->VoicePar[nvoice].PFMDetune=(int)o->value()+8192; -fmdetunevalueoutput->do_callback(); -} -void ADvoiceUI::cb_(Fl_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb__i(o,v); -} - -void ADvoiceUI::cb_fmdetunevalueoutput_i(Fl_Value_Output* o, void*) { - o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune)); -} -void ADvoiceUI::cb_fmdetunevalueoutput(Fl_Value_Output* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_fmdetunevalueoutput_i(o,v); -} - -void ADvoiceUI::cb_Detune_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].PFMDetuneType=(int) o->value(); -fmdetunevalueoutput->do_callback(); -} -void ADvoiceUI::cb_Detune(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Detune_i(o,v); -} - -void ADvoiceUI::cb_Vol_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PFMVolume=(int)o->value(); -} -void ADvoiceUI::cb_Vol(Fl_Value_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Vol_i(o,v); -} - -void ADvoiceUI::cb_V_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PFMVelocityScaleFunction=(int) o->value(); -} -void ADvoiceUI::cb_V(Fl_Value_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_V_i(o,v); -} - -void ADvoiceUI::cb_Enable1_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceFMampenvgroup->deactivate(); -else voiceFMampenvgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable1(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Enable1_i(o,v); -} - -void ADvoiceUI::cb_F_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PFMVolumeDamp=(int) o->value()+64; -} -void ADvoiceUI::cb_F(Fl_Value_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_F_i(o,v); -} - -void ADvoiceUI::cb_changeFMoscilbutton_i(Fl_Button*, void*) { - if (oscedit!=NULL) delete(oscedit); - -int nv=nvoice; -if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil; - -oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,NULL,NULL,master); -} -void ADvoiceUI::cb_changeFMoscilbutton(Fl_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_changeFMoscilbutton_i(o,v); -} - -void ADvoiceUI::cb_Phase_i(Fl_Slider* o, void*) { - pars->VoicePar[nvoice].PFMoscilphase=64-(int)o->value(); -oscFM->phase=64-(int) o->value(); -fmoscil->redraw(); -} -void ADvoiceUI::cb_Phase(Fl_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Phase_i(o,v); -} - -void ADvoiceUI::cb_Use_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].PextFMoscil=(int)o->value()-1; -if ((int) o->value() != 0) { - oscFM->init(pars->VoicePar[(int) o->value()-1].FMSmp,master); - changeFMoscilbutton->labelcolor(FL_BLUE); -} else { - oscFM->init(pars->VoicePar[nvoice].FMSmp,master); - changeFMoscilbutton->labelcolor(FL_BLACK); -}; -voiceFMparametersgroup->redraw(); -} -void ADvoiceUI::cb_Use(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Use_i(o,v); -} - -void ADvoiceUI::cb_External_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].PFMVoice=(int)o->value()-1; -if ((int) o->value() != 0) { - modoscil->deactivate(); - modfrequency->deactivate(); -} else { - modoscil->activate(); - modfrequency->activate(); -}; -voiceFMparametersgroup->redraw(); -} -void ADvoiceUI::cb_External(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_External_i(o,v); -} - -void ADvoiceUI::cb_Type_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].PFMEnabled=(int)o->value(); -if (o->value()==0) voiceFMparametersgroup->deactivate(); -else voiceFMparametersgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Type(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Type_i(o,v); -} - -Fl_Menu_Item ADvoiceUI::menu_Type[] = { - {"OFF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"MORPH", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"RING", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"PM", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"FM", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"PITCH", 0, 0, 0, 1, FL_NORMAL_LABEL, 1, 14, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void ADvoiceUI::cb_Enable2_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFreqEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voicefreqenvgroup->deactivate(); -else voicefreqenvgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable2(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Enable2_i(o,v); -} - -void ADvoiceUI::cb_Enable3_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFreqLfoEnabled=(int)o->value(); -if (o->value()==0) voicefreqlfogroup->deactivate(); -else voicefreqlfogroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable3(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Enable3_i(o,v); -} - -void ADvoiceUI::cb_Octave1_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=16; -pars->VoicePar[nvoice].PCoarseDetune = k*1024+ - pars->VoicePar[nvoice].PCoarseDetune%1024; -} -void ADvoiceUI::cb_Octave1(Fl_Counter* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Octave1_i(o,v); -} - -void ADvoiceUI::cb_Coarse1_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=1024; -pars->VoicePar[nvoice].PCoarseDetune = k+ - (pars->VoicePar[nvoice].PCoarseDetune/1024)*1024; -} -void ADvoiceUI::cb_Coarse1(Fl_Counter* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Coarse1_i(o,v); -} - -void ADvoiceUI::cb_1_i(Fl_Slider* o, void*) { - pars->VoicePar[nvoice].PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback(); -} -void ADvoiceUI::cb_1(Fl_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_1_i(o,v); -} - -void ADvoiceUI::cb_detunevalueoutput1_i(Fl_Value_Output* o, void*) { - o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier()); -} -void ADvoiceUI::cb_detunevalueoutput1(Fl_Value_Output* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_detunevalueoutput1_i(o,v); -} - -void ADvoiceUI::cb_440Hz_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -pars->VoicePar[nvoice].Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate(); -} -void ADvoiceUI::cb_440Hz(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_440Hz_i(o,v); -} - -void ADvoiceUI::cb_fixedfreqetdial_i(WidgetPDial* o, void*) { - pars->VoicePar[nvoice].PfixedfreqET=(int) o->value(); -} -void ADvoiceUI::cb_fixedfreqetdial(WidgetPDial* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_fixedfreqetdial_i(o,v); -} - -void ADvoiceUI::cb_Detune1_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].PDetuneType=(int) o->value(); -detunevalueoutput->do_callback(); -} -void ADvoiceUI::cb_Detune1(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Detune1_i(o,v); -} - -void ADvoiceUI::cb_changevoiceoscilbutton_i(Fl_Button*, void*) { - if (oscedit!=NULL) delete(oscedit); - -int nv=nvoice; -if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil; - -oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,NULL,NULL,master); -} -void ADvoiceUI::cb_changevoiceoscilbutton(Fl_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_changevoiceoscilbutton_i(o,v); -} - -void ADvoiceUI::cb_Phase1_i(Fl_Slider* o, void*) { - pars->VoicePar[nvoice].Poscilphase=64-(int)o->value(); -osc->phase=64-(int) o->value(); -voiceoscil->redraw(); -} -void ADvoiceUI::cb_Phase1(Fl_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Phase1_i(o,v); -} - -void ADvoiceUI::cb_R_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].Presonance=(int) o->value(); -} -void ADvoiceUI::cb_R(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_R_i(o,v); -} - -void ADvoiceUI::cb_Use1_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].Pextoscil=(int)o->value()-1; -if ((int) o->value() != 0) { - osc->init(pars->VoicePar[(int) o->value()-1].OscilSmp,master); - changevoiceoscilbutton->labelcolor(FL_BLUE); -} else { - osc->init(pars->VoicePar[nvoice].OscilSmp,master); - changevoiceoscilbutton->labelcolor(FL_BLACK); -}; - -voiceparametersgroup->redraw(); -voiceonbutton->redraw(); -} -void ADvoiceUI::cb_Use1(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Use1_i(o,v); -} - -void ADvoiceUI::cb_Stereo_i(WidgetPDial* o, void*) { - pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value(); -} -void ADvoiceUI::cb_Stereo(WidgetPDial* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Stereo_i(o,v); -} - -void ADvoiceUI::cb_Unison_i(Fl_Choice* o, void*) { - pars->set_unison_size_index(nvoice,(int) o->value()); -} -void ADvoiceUI::cb_Unison(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Unison_i(o,v); -} - -void ADvoiceUI::cb_Vibratto_i(WidgetPDial* o, void*) { - pars->VoicePar[nvoice].Unison_vibratto=(int)o->value(); -} -void ADvoiceUI::cb_Vibratto(WidgetPDial* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Vibratto_i(o,v); -} - -void ADvoiceUI::cb_Invert_i(Fl_Choice* o, void*) { - pars->VoicePar[nvoice].Unison_invert_phase=(int) o->value(); -} -void ADvoiceUI::cb_Invert(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Invert_i(o,v); -} - -void ADvoiceUI::cb_Frequency_i(Fl_Slider* o, void*) { - pars->VoicePar[nvoice].Unison_frequency_spread=(int)o->value(); -unisonspreadoutput->do_callback(); -} -void ADvoiceUI::cb_Frequency(Fl_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Frequency_i(o,v); -} - -void ADvoiceUI::cb_unisonspreadoutput_i(Fl_Value_Output* o, void*) { - o->value(pars->getUnisonFrequencySpreadCents(nvoice)); -} -void ADvoiceUI::cb_unisonspreadoutput(Fl_Value_Output* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_unisonspreadoutput_i(o,v); -} - -void ADvoiceUI::cb_Vib_i(WidgetPDial* o, void*) { - pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value(); -} -void ADvoiceUI::cb_Vib(WidgetPDial* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Vib_i(o,v); -} - -void ADvoiceUI::cb_Vol1_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PVolume=(int)o->value(); -} -void ADvoiceUI::cb_Vol1(Fl_Value_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Vol1_i(o,v); -} - -void ADvoiceUI::cb_V1_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PAmpVelocityScaleFunction=(int) o->value(); -} -void ADvoiceUI::cb_V1(Fl_Value_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_V1_i(o,v); -} - -void ADvoiceUI::cb_Pan_i(WidgetPDial* o, void*) { - pars->VoicePar[nvoice].PPanning=(int) o->value(); -} -void ADvoiceUI::cb_Pan(WidgetPDial* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Pan_i(o,v); -} - -void ADvoiceUI::cb_Enable4_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PAmpEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceampenvgroup->deactivate(); -else voiceampenvgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable4(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Enable4_i(o,v); -} - -void ADvoiceUI::cb_Enable5_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PAmpLfoEnabled=(int)o->value(); -if (o->value()==0) voiceamplfogroup->deactivate(); -else voiceamplfogroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable5(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Enable5_i(o,v); -} - -void ADvoiceUI::cb_Minus_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PVolumeminus=(int)o->value(); -} -void ADvoiceUI::cb_Minus(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Minus_i(o,v); -} - -void ADvoiceUI::cb_Enable6_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFilterEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voicefilterenvgroup->deactivate(); -else voicefilterenvgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable6(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Enable6_i(o,v); -} - -void ADvoiceUI::cb_Enable7_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFilterLfoEnabled=(int)o->value(); -if (o->value()==0) voicefilterlfogroup->deactivate(); -else voicefilterlfogroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_Enable7(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Enable7_i(o,v); -} - -void ADvoiceUI::cb_2_i(Fl_Choice* o, void*) { - int x=(int) o->value(); -pars->VoicePar[nvoice].Type=x; -if (x==0) voicemodegroup->activate(); - else voicemodegroup->deactivate(); -noiselabel->do_callback(); -} -void ADvoiceUI::cb_2(Fl_Choice* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->user_data()))->cb_2_i(o,v); -} - -Fl_Menu_Item ADvoiceUI::menu_[] = { - {"Sound", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"NOISE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 1}, - {0,0,0,0,0,0,0,0,0} -}; - -void ADvoiceUI::cb_bypassfiltercheckbutton_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].Pfilterbypass=(int)o->value(); -} -void ADvoiceUI::cb_bypassfiltercheckbutton(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->user_data()))->cb_bypassfiltercheckbutton_i(o,v); -} - -void ADvoiceUI::cb_Delay_i(Fl_Value_Slider* o, void*) { - pars->VoicePar[nvoice].PDelay=(int)o->value(); -} -void ADvoiceUI::cb_Delay(Fl_Value_Slider* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->parent()->user_data()))->cb_Delay_i(o,v); -} - -void ADvoiceUI::cb_Enable8_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].PFilterEnabled=(int)o->value(); -if (o->value()==0) voicefiltergroup->deactivate(); -else voicefiltergroup->activate(); -o->redraw(); -bypassfiltercheckbutton->redraw(); -} -void ADvoiceUI::cb_Enable8(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->user_data()))->cb_Enable8_i(o,v); -} - -void ADvoiceUI::cb_noiselabel1_i(Fl_Box* o, void*) { - if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show(); -} -void ADvoiceUI::cb_noiselabel1(Fl_Box* o, void* v) { - ((ADvoiceUI*)(o->parent()->parent()->user_data()))->cb_noiselabel1_i(o,v); -} - -void ADvoiceUI::cb_voiceonbutton_i(Fl_Check_Button* o, void*) { - pars->VoicePar[nvoice].Enabled=(int)o->value(); -if (o->value()==0) voiceparametersgroup->deactivate(); -else voiceparametersgroup->activate(); -o->redraw(); -} -void ADvoiceUI::cb_voiceonbutton(Fl_Check_Button* o, void* v) { - ((ADvoiceUI*)(o->parent()->user_data()))->cb_voiceonbutton_i(o,v); -} - -Fl_Group* ADvoiceUI::make_window() { - { ADnoteVoiceParameters = new Fl_Group(0, 0, 765, 575, "Voice"); - ADnoteVoiceParameters->box(FL_FLAT_BOX); - ADnoteVoiceParameters->color(FL_BACKGROUND_COLOR); - ADnoteVoiceParameters->selection_color(FL_BACKGROUND_COLOR); - ADnoteVoiceParameters->labeltype(FL_NO_LABEL); - ADnoteVoiceParameters->labelfont(0); - ADnoteVoiceParameters->labelsize(14); - ADnoteVoiceParameters->labelcolor(FL_FOREGROUND_COLOR); - ADnoteVoiceParameters->user_data((void*)(this)); - ADnoteVoiceParameters->align(Fl_Align(FL_ALIGN_TOP)); - ADnoteVoiceParameters->when(FL_WHEN_RELEASE); - { Fl_Group* o = voiceparametersgroup = new Fl_Group(0, 0, 765, 580); - voiceparametersgroup->box(FL_THIN_UP_BOX); - voiceparametersgroup->color((Fl_Color)48); - { voicemodegroup = new Fl_Group(0, 5, 760, 575); - { Fl_Group* o = voiceFMparametersgroup = new Fl_Group(530, 5, 230, 565, "MODULATOR"); - voiceFMparametersgroup->box(FL_THIN_UP_FRAME); - voiceFMparametersgroup->color((Fl_Color)48); - voiceFMparametersgroup->labeltype(FL_EMBOSSED_LABEL); - voiceFMparametersgroup->labelfont(1); - voiceFMparametersgroup->labelsize(13); - voiceFMparametersgroup->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { modfrequency = new Fl_Group(535, 220, 220, 145, "Mod.FREQUENCY"); - modfrequency->box(FL_THIN_UP_BOX); - modfrequency->labeltype(FL_EMBOSSED_LABEL); - modfrequency->labelfont(1); - modfrequency->labelsize(13); - modfrequency->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = voiceFMfreqenvgroup = new EnvelopeUI(540, 290, 205, 70, "ADSynth Modulator - Frequency Envelope"); - voiceFMfreqenvgroup->box(FL_FLAT_BOX); - voiceFMfreqenvgroup->color((Fl_Color)51); - voiceFMfreqenvgroup->selection_color(FL_BACKGROUND_COLOR); - voiceFMfreqenvgroup->labeltype(FL_NORMAL_LABEL); - voiceFMfreqenvgroup->labelfont(0); - voiceFMfreqenvgroup->labelsize(14); - voiceFMfreqenvgroup->labelcolor(FL_FOREGROUND_COLOR); - voiceFMfreqenvgroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voiceFMfreqenvgroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].FMFreqEnvelope); - if (pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled==0) o->deactivate(); - voiceFMfreqenvgroup->end(); - } // EnvelopeUI* voiceFMfreqenvgroup - { Fl_Check_Button* o = new Fl_Check_Button(545, 295, 50, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable); - o->value(pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled); - } // Fl_Check_Button* o - { Fl_Counter* o = new Fl_Counter(685, 270, 60, 15, "Coarse Det."); - o->tooltip("Coarse Detune"); - o->labelsize(10); - o->minimum(-64); - o->maximum(63); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Coarse); - o->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->VoicePar[nvoice].PFMCoarseDetune%1024; - if (k>=512) k-=1024; - o->value(k); - o->lstep(10); - } // Fl_Counter* o - { Fl_Counter* o = new Fl_Counter(625, 270, 45, 15, "Octave"); - o->tooltip("Octave"); - o->type(1); - o->labelsize(10); - o->minimum(-8); - o->maximum(7); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Octave); - o->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->VoicePar[nvoice].PFMCoarseDetune/1024; - if (k>=8) k-=16; - o->value(k); - } // Fl_Counter* o - { Fl_Slider* o = new Fl_Slider(590, 245, 160, 10); - o->tooltip("Fine Detune (cents)"); - o->type(5); - o->box(FL_FLAT_BOX); - o->minimum(-8192); - o->maximum(8191); - o->step(1); - o->callback((Fl_Callback*)cb_); - o->value(pars->VoicePar[nvoice].PFMDetune-8192); - } // Fl_Slider* o - { Fl_Value_Output* o = fmdetunevalueoutput = new Fl_Value_Output(540, 245, 45, 13, "Detune"); - fmdetunevalueoutput->labelsize(8); - fmdetunevalueoutput->minimum(-5000); - fmdetunevalueoutput->maximum(5000); - fmdetunevalueoutput->step(0.01); - fmdetunevalueoutput->textfont(1); - fmdetunevalueoutput->textsize(8); - fmdetunevalueoutput->callback((Fl_Callback*)cb_fmdetunevalueoutput); - fmdetunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune)); - //o->value(getdetune(pars->VoicePar[nvoice].PFMDetuneType,0,pars->VoicePar[nvoice].PFMDetune)); - } // Fl_Value_Output* fmdetunevalueoutput - { Fl_Choice* o = new Fl_Choice(540, 270, 75, 15, "Detune Type"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Detune); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); - o->value(pars->VoicePar[nvoice].PFMDetuneType); - } // Fl_Choice* o - modfrequency->end(); - } // Fl_Group* modfrequency - { Fl_Group* o = new Fl_Group(535, 60, 220, 160, "Mod.AMPLITUDE"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { Fl_Value_Slider* o = new Fl_Value_Slider(540, 80, 160, 15, "Vol"); - o->tooltip("Volume"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(11); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vol); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->VoicePar[nvoice].PFMVolume); - } // Fl_Value_Slider* o - { Fl_Value_Slider* o = new Fl_Value_Slider(540, 100, 160, 15, "V.Sns"); - o->tooltip("Velocity Sensing Function (rightmost to disable)"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(11); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_V); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->VoicePar[nvoice].PFMVelocityScaleFunction); - } // Fl_Value_Slider* o - { EnvelopeUI* o = voiceFMampenvgroup = new EnvelopeUI(540, 145, 205, 70, "ADSynth Modulator - Amplitude Envelope"); - voiceFMampenvgroup->box(FL_FLAT_BOX); - voiceFMampenvgroup->color((Fl_Color)51); - voiceFMampenvgroup->selection_color(FL_BACKGROUND_COLOR); - voiceFMampenvgroup->labeltype(FL_NORMAL_LABEL); - voiceFMampenvgroup->labelfont(0); - voiceFMampenvgroup->labelsize(14); - voiceFMampenvgroup->labelcolor(FL_FOREGROUND_COLOR); - voiceFMampenvgroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voiceFMampenvgroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].FMAmpEnvelope); - if (pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled==0) o->deactivate(); - voiceFMampenvgroup->end(); - } // EnvelopeUI* voiceFMampenvgroup - { Fl_Check_Button* o = new Fl_Check_Button(545, 150, 50, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable1); - o->value(pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled); - } // Fl_Check_Button* o - { Fl_Value_Slider* o = new Fl_Value_Slider(540, 120, 160, 15, "F.Damp"); - o->tooltip("Modulator Damp at Higher frequency"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(11); - o->minimum(-64); - o->maximum(63); - o->step(1); - o->callback((Fl_Callback*)cb_F); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->VoicePar[nvoice].PFMVolumeDamp-64); - } // Fl_Value_Slider* o - o->end(); - } // Fl_Group* o - { modoscil = new Fl_Group(535, 365, 220, 200); - { Fl_Group* o = fmoscil = new Fl_Group(535, 425, 220, 140); - fmoscil->box(FL_THIN_DOWN_BOX); - fmoscil->color(FL_GRAY0); - fmoscil->selection_color((Fl_Color)71); - fmoscil->labelcolor((Fl_Color)179); - oscFM=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),""); - int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil; - oscFM->init(pars->VoicePar[nv].FMSmp,0,pars->VoicePar[nvoice].PFMoscilphase,master); - fmoscil->end(); - } // Fl_Group* fmoscil - { Fl_Box* o = new Fl_Box(535, 365, 155, 20, "Mod.Oscillator"); - o->labelfont(1); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Button* o = changeFMoscilbutton = new Fl_Button(700, 370, 55, 15, "Change"); - changeFMoscilbutton->box(FL_THIN_UP_BOX); - changeFMoscilbutton->labelfont(1); - changeFMoscilbutton->labelsize(11); - changeFMoscilbutton->callback((Fl_Callback*)cb_changeFMoscilbutton); - if (pars->VoicePar[nvoice].PextFMoscil>=0) o->labelcolor(FL_BLUE); - } // Fl_Button* changeFMoscilbutton - { Fl_Slider* o = new Fl_Slider(665, 400, 65, 10, "Phase"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(10); - o->minimum(-64); - o->maximum(63); - o->step(1); - o->callback((Fl_Callback*)cb_Phase); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(64-pars->VoicePar[nvoice].PFMoscilphase); - } // Fl_Slider* o - { Fl_Choice* o = new Fl_Choice(560, 395, 75, 15, "Use"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Use); - o->add("Internal"); - char tmp[50]; for (int i=0;iadd(tmp);}; - o->value(pars->VoicePar[nvoice].PextFMoscil+1); - } // Fl_Choice* o - modoscil->end(); - } // Fl_Group* modoscil - { Fl_Choice* o = new Fl_Choice(635, 40, 85, 20, "External Mod."); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_External); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("OFF"); - char tmp[50]; for (int i=0;iadd(tmp);}; - o->value(pars->VoicePar[nvoice].PFMVoice+1); - if ((int) o->value() != 0) {modoscil->deactivate();modfrequency->deactivate();} - } // Fl_Choice* o - if (pars->VoicePar[nvoice].PFMEnabled==0) o->deactivate(); - voiceFMparametersgroup->end(); - } // Fl_Group* voiceFMparametersgroup - { Fl_Choice* o = new Fl_Choice(535, 40, 80, 20, "Type:"); - o->down_box(FL_BORDER_BOX); - o->callback((Fl_Callback*)cb_Type); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->menu(menu_Type); - o->value(pars->VoicePar[nvoice].PFMEnabled); - } // Fl_Choice* o - { Fl_Group* o = new Fl_Group(5, 250, 525, 120, "FREQUENCY"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = voicefreqenvgroup = new EnvelopeUI(10, 290, 205, 70, "ADSynth Voice - Frequency Envelope"); - voicefreqenvgroup->box(FL_FLAT_BOX); - voicefreqenvgroup->color((Fl_Color)51); - voicefreqenvgroup->selection_color(FL_BACKGROUND_COLOR); - voicefreqenvgroup->labeltype(FL_NORMAL_LABEL); - voicefreqenvgroup->labelfont(0); - voicefreqenvgroup->labelsize(14); - voicefreqenvgroup->labelcolor(FL_FOREGROUND_COLOR); - voicefreqenvgroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voicefreqenvgroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].FreqEnvelope); - if (pars->VoicePar[nvoice].PFreqEnvelopeEnabled==0) o->deactivate(); - voicefreqenvgroup->end(); - } // EnvelopeUI* voicefreqenvgroup - { Fl_Check_Button* o = new Fl_Check_Button(15, 295, 50, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable2); - o->value(pars->VoicePar[nvoice].PFreqEnvelopeEnabled); - } // Fl_Check_Button* o - { LFOUI* o = voicefreqlfogroup = new LFOUI(215, 290, 230, 70, "Frequency LFO "); - voicefreqlfogroup->box(FL_FLAT_BOX); - voicefreqlfogroup->color(FL_DARK1); - voicefreqlfogroup->selection_color(FL_BACKGROUND_COLOR); - voicefreqlfogroup->labeltype(FL_NORMAL_LABEL); - voicefreqlfogroup->labelfont(0); - voicefreqlfogroup->labelsize(14); - voicefreqlfogroup->labelcolor(FL_FOREGROUND_COLOR); - voicefreqlfogroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voicefreqlfogroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].FreqLfo); - if (pars->VoicePar[nvoice].PFreqLfoEnabled==0) o->deactivate(); - voicefreqlfogroup->end(); - } // LFOUI* voicefreqlfogroup - { Fl_Check_Button* o = new Fl_Check_Button(220, 295, 55, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable3); - o->value(pars->VoicePar[nvoice].PFreqLfoEnabled); - } // Fl_Check_Button* o - { Fl_Counter* o = new Fl_Counter(470, 270, 45, 15, "Octave"); - o->tooltip("Octave"); - o->type(1); - o->labelsize(10); - o->minimum(-8); - o->maximum(7); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Octave1); - o->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->VoicePar[nvoice].PCoarseDetune/1024; - if (k>=8) k-=16; - o->value(k); - } // Fl_Counter* o - { Fl_Counter* o = new Fl_Counter(455, 340, 60, 20, "Coarse Det."); - o->tooltip("Coarse Detune"); - o->labelsize(10); - o->minimum(-64); - o->maximum(63); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Coarse1); - o->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->VoicePar[nvoice].PCoarseDetune%1024; - if (k>=512) k-=1024; - o->value(k); - o->lstep(10); - } // Fl_Counter* o - { Fl_Slider* o = new Fl_Slider(58, 272, 392, 13); - o->tooltip("Fine Detune (cents)"); - o->type(5); - o->box(FL_FLAT_BOX); - o->minimum(-8192); - o->maximum(8191); - o->step(1); - o->callback((Fl_Callback*)cb_1); - o->value(pars->VoicePar[nvoice].PDetune-8192); - } // Fl_Slider* o - { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(10, 272, 45, 15, "Detune"); - detunevalueoutput->labelsize(10); - detunevalueoutput->minimum(-5000); - detunevalueoutput->maximum(5000); - detunevalueoutput->step(0.01); - detunevalueoutput->textfont(1); - detunevalueoutput->textsize(10); - detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput1); - detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier()); - } // Fl_Value_Output* detunevalueoutput - { Fl_Check_Button* o = new Fl_Check_Button(345, 253, 55, 15, "440Hz"); - o->tooltip("Set the voice base frequency to 440Hz"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_440Hz); - o->value(pars->VoicePar[nvoice].Pfixedfreq); - } // Fl_Check_Button* o - { WidgetPDial* o = fixedfreqetdial = new WidgetPDial(405, 255, 15, 15, "Eq.T."); - fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\ -cy)"); - fixedfreqetdial->box(FL_ROUND_UP_BOX); - fixedfreqetdial->color(FL_BACKGROUND_COLOR); - fixedfreqetdial->selection_color(FL_INACTIVE_COLOR); - fixedfreqetdial->labeltype(FL_NORMAL_LABEL); - fixedfreqetdial->labelfont(0); - fixedfreqetdial->labelsize(10); - fixedfreqetdial->labelcolor(FL_FOREGROUND_COLOR); - fixedfreqetdial->maximum(127); - fixedfreqetdial->step(1); - fixedfreqetdial->callback((Fl_Callback*)cb_fixedfreqetdial); - fixedfreqetdial->align(Fl_Align(FL_ALIGN_RIGHT)); - fixedfreqetdial->when(FL_WHEN_CHANGED); - o->value(pars->VoicePar[nvoice].PfixedfreqET); - if (pars->VoicePar[nvoice].Pfixedfreq==0) o->deactivate(); - } // WidgetPDial* fixedfreqetdial - { Fl_Choice* o = new Fl_Choice(450, 305, 75, 15, "Detune Type"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Detune1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); - o->value(pars->VoicePar[nvoice].PDetuneType); - } // Fl_Choice* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = voiceoscil = new Fl_Group(80, 375, 445, 145); - voiceoscil->box(FL_THIN_DOWN_BOX); - voiceoscil->color(FL_GRAY0); - voiceoscil->selection_color((Fl_Color)71); - voiceoscil->labelcolor((Fl_Color)179); - osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),""); - int nv=nvoice; if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil; - osc->init(pars->VoicePar[nv].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); - voiceoscil->end(); - } // Fl_Group* voiceoscil - { Fl_Button* o = changevoiceoscilbutton = new Fl_Button(5, 475, 65, 20, "Change"); - changevoiceoscilbutton->box(FL_THIN_UP_BOX); - changevoiceoscilbutton->labelfont(1); - changevoiceoscilbutton->labelsize(11); - changevoiceoscilbutton->callback((Fl_Callback*)cb_changevoiceoscilbutton); - if (pars->VoicePar[nvoice].Pextoscil>=0) o->labelcolor(FL_BLUE); - } // Fl_Button* changevoiceoscilbutton - { Fl_Box* o = new Fl_Box(5, 375, 75, 35, "Voice Oscillator"); - o->labelfont(1); - o->labelsize(12); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Box* o - { Fl_Slider* o = new Fl_Slider(10, 420, 65, 10, "Phase"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(10); - o->minimum(-64); - o->maximum(63); - o->step(1); - o->callback((Fl_Callback*)cb_Phase1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(64-pars->VoicePar[nvoice].Poscilphase); - } // Fl_Slider* o - { Fl_Check_Button* o = new Fl_Check_Button(210, 5, 35, 35, "R."); - o->tooltip("Resonance On/Off"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_R); - o->value(pars->VoicePar[nvoice].Presonance); - } // Fl_Check_Button* o - { Fl_Choice* o = new Fl_Choice(5, 455, 65, 15, "Use Oscil."); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Use1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("Internal"); - char tmp[50]; for (int i=0;iadd(tmp);}; - o->value(pars->VoicePar[nvoice].Pextoscil+1); - } // Fl_Choice* o - { Fl_Group* o = new Fl_Group(5, 525, 515, 45); - o->box(FL_ENGRAVED_BOX); - { WidgetPDial* o = new WidgetPDial(285, 540, 25, 25, "Stereo"); - o->tooltip("Stereo Spread"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Stereo); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->when(FL_WHEN_CHANGED); - o->value(pars->VoicePar[nvoice].Unison_stereo_spread); - } // WidgetPDial* o - { Fl_Choice* o = new Fl_Choice(10, 545, 75, 20, "Unison"); - o->tooltip("Unison size"); - o->down_box(FL_BORDER_BOX); - o->labelfont(1); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Unison); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("OFF");char tmp[100];for (int i=1;ADnote_unison_sizes[i];i++){snprintf(tmp,100,"size %d",ADnote_unison_sizes[i]);o->add(tmp);}; - o->value(pars->get_unison_size_index(nvoice)); - } // Fl_Choice* o - { WidgetPDial* o = new WidgetPDial(340, 540, 25, 25, "Vibratto"); - o->tooltip("Vibratto"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vibratto); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->when(FL_WHEN_CHANGED); - o->value(pars->VoicePar[nvoice].Unison_vibratto); - } // WidgetPDial* o - { Fl_Choice* o = new Fl_Choice(445, 545, 65, 15, "Invert"); - o->tooltip("Phase Invert"); - o->down_box(FL_BORDER_BOX); - o->labelsize(11); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Invert); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("None");o->add("Random");char tmp[100];for (int i=2;i<=5;i++){snprintf(tmp,100,"%d %%",100/i);o->add(tmp);}; - o->value(pars->VoicePar[nvoice].Unison_invert_phase); - } // Fl_Choice* o - { Fl_Slider* o = new Fl_Slider(95, 547, 125, 13, "Frequency Spread"); - o->tooltip("Frequency Spread of the Unison"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(12); - o->maximum(127); - o->step(1); - o->value(64); - o->callback((Fl_Callback*)cb_Frequency); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->value(pars->VoicePar[nvoice].Unison_frequency_spread); - } // Fl_Slider* o - { Fl_Value_Output* o = unisonspreadoutput = new Fl_Value_Output(225, 545, 40, 15, "(cents)"); - unisonspreadoutput->labelsize(10); - unisonspreadoutput->maximum(1000); - unisonspreadoutput->step(0.1); - unisonspreadoutput->textfont(1); - unisonspreadoutput->textsize(10); - unisonspreadoutput->callback((Fl_Callback*)cb_unisonspreadoutput); - unisonspreadoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(pars->getUnisonFrequencySpreadCents(nvoice)); - } // Fl_Value_Output* unisonspreadoutput - { WidgetPDial* o = new WidgetPDial(390, 540, 25, 25, "Vib.speed"); - o->tooltip("Vibratto Average Speed"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vib); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->when(FL_WHEN_CHANGED); - o->value(pars->VoicePar[nvoice].Unison_vibratto_speed); - } // WidgetPDial* o - o->end(); - } // Fl_Group* o - voicemodegroup->end(); - } // Fl_Group* voicemodegroup - { Fl_Group* o = new Fl_Group(5, 40, 240, 210, "AMPLITUDE"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { Fl_Value_Slider* o = new Fl_Value_Slider(10, 60, 160, 15, "Vol"); - o->tooltip("Volume"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(11); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vol1); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->VoicePar[nvoice].PVolume); - } // Fl_Value_Slider* o - { Fl_Value_Slider* o = new Fl_Value_Slider(10, 80, 160, 15, "V.Sns"); - o->tooltip("Velocity Sensing Function (rightmost to disable)"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(11); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_V1); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->VoicePar[nvoice].PAmpVelocityScaleFunction); - } // Fl_Value_Slider* o - { EnvelopeUI* o = voiceampenvgroup = new EnvelopeUI(10, 105, 205, 70, "ADSynth Voice - Amplitude Envelope"); - voiceampenvgroup->box(FL_FLAT_BOX); - voiceampenvgroup->color((Fl_Color)51); - voiceampenvgroup->selection_color(FL_BACKGROUND_COLOR); - voiceampenvgroup->labeltype(FL_NORMAL_LABEL); - voiceampenvgroup->labelfont(0); - voiceampenvgroup->labelsize(14); - voiceampenvgroup->labelcolor(FL_FOREGROUND_COLOR); - voiceampenvgroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voiceampenvgroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].AmpEnvelope); - if (pars->VoicePar[nvoice].PAmpEnvelopeEnabled==0) o->deactivate(); - voiceampenvgroup->end(); - } // EnvelopeUI* voiceampenvgroup - { WidgetPDial* o = new WidgetPDial(210, 60, 30, 30, "Pan"); - o->tooltip("Panning (leftmost is Random)"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Pan); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(pars->VoicePar[nvoice].PPanning); - } // WidgetPDial* o - { Fl_Check_Button* o = new Fl_Check_Button(15, 110, 50, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable4); - o->value(pars->VoicePar[nvoice].PAmpEnvelopeEnabled); - } // Fl_Check_Button* o - { LFOUI* o = voiceamplfogroup = new LFOUI(10, 175, 230, 70, "Amplitude LFO "); - voiceamplfogroup->box(FL_FLAT_BOX); - voiceamplfogroup->color(FL_DARK1); - voiceamplfogroup->selection_color(FL_BACKGROUND_COLOR); - voiceamplfogroup->labeltype(FL_NORMAL_LABEL); - voiceamplfogroup->labelfont(0); - voiceamplfogroup->labelsize(14); - voiceamplfogroup->labelcolor(FL_FOREGROUND_COLOR); - voiceamplfogroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voiceamplfogroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].AmpLfo); - if (pars->VoicePar[nvoice].PAmpLfoEnabled==0) o->deactivate(); - voiceamplfogroup->end(); - } // LFOUI* voiceamplfogroup - { Fl_Check_Button* o = new Fl_Check_Button(15, 180, 55, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable5); - o->value(pars->VoicePar[nvoice].PAmpLfoEnabled); - } // Fl_Check_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(10, 45, 50, 10, "Minus"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Minus); - o->value(pars->VoicePar[nvoice].PVolumeminus); - } // Fl_Check_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = voicefiltergroup = new Fl_Group(245, 5, 285, 245, "FILTER"); - voicefiltergroup->box(FL_THIN_UP_BOX); - voicefiltergroup->labeltype(FL_EMBOSSED_LABEL); - voicefiltergroup->labelfont(1); - voicefiltergroup->labelsize(13); - voicefiltergroup->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { FilterUI* o = new FilterUI(250, 30, 275, 75, "ADsynth Voice - Filter"); - o->box(FL_FLAT_BOX); - o->color(FL_LIGHT1); - o->selection_color(FL_BACKGROUND_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(14); - o->labelcolor(FL_FOREGROUND_COLOR); - o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - o->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].VoiceFilter,NULL,NULL); - o->end(); - } // FilterUI* o - { EnvelopeUI* o = voicefilterenvgroup = new EnvelopeUI(250, 105, 275, 70, "ADSynth Voice - Filter Envelope"); - voicefilterenvgroup->box(FL_FLAT_BOX); - voicefilterenvgroup->color((Fl_Color)51); - voicefilterenvgroup->selection_color(FL_BACKGROUND_COLOR); - voicefilterenvgroup->labeltype(FL_NORMAL_LABEL); - voicefilterenvgroup->labelfont(0); - voicefilterenvgroup->labelsize(14); - voicefilterenvgroup->labelcolor(FL_FOREGROUND_COLOR); - voicefilterenvgroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voicefilterenvgroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].FilterEnvelope); - if (pars->VoicePar[nvoice].PFilterEnvelopeEnabled==0) o->deactivate(); - voicefilterenvgroup->end(); - } // EnvelopeUI* voicefilterenvgroup - { Fl_Check_Button* o = new Fl_Check_Button(255, 110, 55, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable6); - o->value(pars->VoicePar[nvoice].PFilterEnvelopeEnabled); - } // Fl_Check_Button* o - { LFOUI* o = voicefilterlfogroup = new LFOUI(250, 175, 230, 70, "Filter LFO "); - voicefilterlfogroup->box(FL_FLAT_BOX); - voicefilterlfogroup->color(FL_DARK1); - voicefilterlfogroup->selection_color(FL_BACKGROUND_COLOR); - voicefilterlfogroup->labeltype(FL_NORMAL_LABEL); - voicefilterlfogroup->labelfont(0); - voicefilterlfogroup->labelsize(14); - voicefilterlfogroup->labelcolor(FL_FOREGROUND_COLOR); - voicefilterlfogroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - voicefilterlfogroup->when(FL_WHEN_RELEASE); - o->init(pars->VoicePar[nvoice].FilterLfo); - if (pars->VoicePar[nvoice].PFilterLfoEnabled==0) o->deactivate(); - voicefilterlfogroup->end(); - } // LFOUI* voicefilterlfogroup - { Fl_Check_Button* o = new Fl_Check_Button(255, 180, 55, 10, "Enable"); - o->tooltip("Forced Relase"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable7); - o->value(pars->VoicePar[nvoice].PFilterLfoEnabled); - } // Fl_Check_Button* o - if (pars->VoicePar[nvoice].PFilterEnabled==0) o->deactivate(); - voicefiltergroup->end(); - } // Fl_Group* voicefiltergroup - { Fl_Group* o = new Fl_Group(5, 5, 55, 35, "01"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); - char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp)); - o->end(); - } // Fl_Group* o - { Fl_Choice* o = new Fl_Choice(5, 500, 65, 20); - o->tooltip("Oscillator Type (sound/noise)"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_2); - o->menu(menu_); - o->value(pars->VoicePar[nvoice].Type); - if (pars->VoicePar[nvoice].Type!=0) voicemodegroup->deactivate(); - } // Fl_Choice* o - { Fl_Check_Button* o = bypassfiltercheckbutton = new Fl_Check_Button(425, 10, 100, 20, "Bypass Global F."); - bypassfiltercheckbutton->down_box(FL_DOWN_BOX); - bypassfiltercheckbutton->labelfont(1); - bypassfiltercheckbutton->labelsize(10); - bypassfiltercheckbutton->callback((Fl_Callback*)cb_bypassfiltercheckbutton); - bypassfiltercheckbutton->align(Fl_Align(132|FL_ALIGN_INSIDE)); - o->value(pars->VoicePar[nvoice].Pfilterbypass); - } // Fl_Check_Button* bypassfiltercheckbutton - { Fl_Group* o = new Fl_Group(115, 5, 95, 35); - o->box(FL_THIN_UP_BOX); - { Fl_Value_Slider* o = new Fl_Value_Slider(120, 21, 84, 12, "Delay"); - o->tooltip("Volume"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(11); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Delay); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(pars->VoicePar[nvoice].PDelay); - } // Fl_Value_Slider* o - o->end(); - } // Fl_Group* o - { Fl_Check_Button* o = new Fl_Check_Button(250, 15, 60, 15, "Enable"); - o->tooltip("Enable Filter"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Enable8); - o->value(pars->VoicePar[nvoice].PFilterEnabled); - } // Fl_Check_Button* o - { Fl_Box* o = noiselabel = new Fl_Box(150, 415, 300, 65, "White Noise"); - noiselabel->labelfont(1); - noiselabel->labelsize(50); - noiselabel->labelcolor(FL_BACKGROUND2_COLOR); - noiselabel->callback((Fl_Callback*)cb_noiselabel1); - if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show(); - } // Fl_Box* noiselabel - if (pars->VoicePar[nvoice].Enabled==0) o->deactivate(); - voiceparametersgroup->end(); - } // Fl_Group* voiceparametersgroup - { Fl_Check_Button* o = voiceonbutton = new Fl_Check_Button(60, 5, 55, 35, "On"); - voiceonbutton->box(FL_THIN_UP_BOX); - voiceonbutton->down_box(FL_DOWN_BOX); - voiceonbutton->labelfont(1); - voiceonbutton->labelsize(13); - voiceonbutton->callback((Fl_Callback*)cb_voiceonbutton); - o->value(pars->VoicePar[nvoice].Enabled); - } // Fl_Check_Button* voiceonbutton - ADnoteVoiceParameters->end(); - } // Fl_Group* ADnoteVoiceParameters - return ADnoteVoiceParameters; -} - -ADvoiceUI::ADvoiceUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - nvoice=0; - pars=NULL; - oscedit=NULL; -} - -void ADvoiceUI::init(ADnoteParameters *parameters,int nvoice_,Master *master_) { - pars=parameters; - nvoice=nvoice_; - master=master_; - make_window(); - end(); - ADnoteVoiceParameters->show(); -} - -ADvoiceUI::~ADvoiceUI() { - ADnoteVoiceParameters->hide(); - hide(); - if (oscedit!=NULL) { - delete(oscedit); - }; - //delete (ADnoteVoiceParameters); -} - -void ADnoteUI::cb_octave_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=16; -pars->GlobalPar.PCoarseDetune = k*1024+ - pars->GlobalPar.PCoarseDetune%1024; -} -void ADnoteUI::cb_octave(Fl_Counter* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_octave_i(o,v); -} - -void ADnoteUI::cb_coarsedet_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=1024; -pars->GlobalPar.PCoarseDetune = k+ - (pars->GlobalPar.PCoarseDetune/1024)*1024; -} -void ADnoteUI::cb_coarsedet(Fl_Counter* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_coarsedet_i(o,v); -} - -void ADnoteUI::cb_freq_i(Fl_Slider* o, void*) { - pars->GlobalPar.PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback(); -} -void ADnoteUI::cb_freq(Fl_Slider* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_freq_i(o,v); -} - -void ADnoteUI::cb_detunevalueoutput2_i(Fl_Value_Output* o, void*) { - o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune)); -} -void ADnoteUI::cb_detunevalueoutput2(Fl_Value_Output* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_detunevalueoutput2_i(o,v); -} - -void ADnoteUI::cb_detunetype_i(Fl_Choice* o, void*) { - pars->GlobalPar.PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback(); -} -void ADnoteUI::cb_detunetype(Fl_Choice* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_detunetype_i(o,v); -} - -void ADnoteUI::cb_relBW_i(WidgetPDial* o, void*) { - pars->GlobalPar.PBandwidth=(int) o->value(); - -pars->getBandwidthDetuneMultiplier(); - -for (int i=0;irefreshlist(); -}; -} -void ADnoteUI::cb_relBW(WidgetPDial* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_relBW_i(o,v); -} - -void ADnoteUI::cb_volume_i(Fl_Value_Slider* o, void*) { - pars->GlobalPar.PVolume=(int)o->value(); -} -void ADnoteUI::cb_volume(Fl_Value_Slider* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_volume_i(o,v); -} - -void ADnoteUI::cb_vsns_i(Fl_Value_Slider* o, void*) { - pars->GlobalPar.PAmpVelocityScaleFunction=(int) o->value(); -} -void ADnoteUI::cb_vsns(Fl_Value_Slider* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_vsns_i(o,v); -} - -void ADnoteUI::cb_pan_i(WidgetPDial* o, void*) { - pars->GlobalPar.PPanning=(int) o->value(); -} -void ADnoteUI::cb_pan(WidgetPDial* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_pan_i(o,v); -} - -void ADnoteUI::cb_pstr_i(WidgetPDial* o, void*) { - pars->GlobalPar.PPunchStrength=(int) o->value(); -} -void ADnoteUI::cb_pstr(WidgetPDial* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_pstr_i(o,v); -} - -void ADnoteUI::cb_pt_i(WidgetPDial* o, void*) { - pars->GlobalPar.PPunchTime=(int) o->value(); -} -void ADnoteUI::cb_pt(WidgetPDial* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_pt_i(o,v); -} - -void ADnoteUI::cb_pstc_i(WidgetPDial* o, void*) { - pars->GlobalPar.PPunchStretch=(int) o->value(); -} -void ADnoteUI::cb_pstc(WidgetPDial* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_pstc_i(o,v); -} - -void ADnoteUI::cb_pvel_i(WidgetPDial* o, void*) { - pars->GlobalPar.PPunchVelocitySensing=(int) o->value(); -} -void ADnoteUI::cb_pvel(WidgetPDial* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_pvel_i(o,v); -} - -void ADnoteUI::cb_rndgrp_i(Fl_Check_Button* o, void*) { - pars->GlobalPar.Hrandgrouping=(int) o->value(); -} -void ADnoteUI::cb_rndgrp(Fl_Check_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->parent()->user_data()))->cb_rndgrp_i(o,v); -} - -void ADnoteUI::cb_stereo_i(Fl_Check_Button* o, void*) { - pars->GlobalPar.PStereo=(int) o->value(); -} -void ADnoteUI::cb_stereo(Fl_Check_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_stereo_i(o,v); -} - -void ADnoteUI::cb_Show_i(Fl_Button*, void*) { - for (int i=0;irefreshlist(); -} -ADnoteVoiceList->show(); -} -void ADnoteUI::cb_Show(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_Show_i(o,v); -} - -void ADnoteUI::cb_Show1_i(Fl_Button*, void*) { - ADnoteVoice->show(); -} -void ADnoteUI::cb_Show1(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_Show1_i(o,v); -} - -void ADnoteUI::cb_Close_i(Fl_Button*, void*) { - ADnoteGlobalParameters->hide(); -} -void ADnoteUI::cb_Close(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void ADnoteUI::cb_Resonance_i(Fl_Button*, void*) { - resui->resonancewindow->redraw(); -resui->resonancewindow->show(); -} -void ADnoteUI::cb_Resonance(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_Resonance_i(o,v); -} - -void ADnoteUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(pars); -} -void ADnoteUI::cb_C(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void ADnoteUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(pars,this); -} -void ADnoteUI::cb_P(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -void ADnoteUI::cb_Close1_i(Fl_Button*, void*) { - ADnoteVoice->hide(); -} -void ADnoteUI::cb_Close1(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_Close1_i(o,v); -} - -void ADnoteUI::cb_currentvoicecounter_i(Fl_Counter* o, void*) { - nvoice=(int)o->value()-1; -advoice->hide(); -ADnoteVoice->remove(advoice); -delete advoice; -advoice=new ADvoiceUI(0,0,765,585); -ADnoteVoice->add(advoice); -advoice->init(pars,nvoice,master); -advoice->show(); -ADnoteVoice->redraw(); -} -void ADnoteUI::cb_currentvoicecounter(Fl_Counter* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_currentvoicecounter_i(o,v); -} - -void ADnoteUI::cb_C1_i(Fl_Button*, void*) { - presetsui->copy(pars,nvoice); -} -void ADnoteUI::cb_C1(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_C1_i(o,v); -} - -void ADnoteUI::cb_P1_i(Fl_Button*, void*) { - presetsui->paste(pars,this,nvoice); -} -void ADnoteUI::cb_P1(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_P1_i(o,v); -} - -void ADnoteUI::cb_Hide_i(Fl_Button*, void*) { - ADnoteVoiceList->hide(); -} -void ADnoteUI::cb_Hide(Fl_Button* o, void* v) { - ((ADnoteUI*)(o->parent()->user_data()))->cb_Hide_i(o,v); -} - -Fl_Double_Window* ADnoteUI::make_window() { - { ADnoteGlobalParameters = new Fl_Double_Window(535, 405, "ADsynth Global Parameters of the Instrument"); - ADnoteGlobalParameters->user_data((void*)(this)); - { Fl_Group* o = new Fl_Group(5, 255, 525, 115, "FREQUENCY"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = freqenv = new EnvelopeUI(10, 295, 205, 70, "ADSynth Global - Frequency Envelope"); - freqenv->box(FL_FLAT_BOX); - freqenv->color((Fl_Color)51); - freqenv->selection_color(FL_BACKGROUND_COLOR); - freqenv->labeltype(FL_NORMAL_LABEL); - freqenv->labelfont(0); - freqenv->labelsize(14); - freqenv->labelcolor(FL_FOREGROUND_COLOR); - freqenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - freqenv->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.FreqEnvelope); - freqenv->end(); - } // EnvelopeUI* freqenv - { Fl_Counter* o = octave = new Fl_Counter(450, 275, 45, 15, "Octave"); - octave->tooltip("Octave"); - octave->type(1); - octave->labelsize(10); - octave->minimum(-8); - octave->maximum(7); - octave->step(1); - octave->textfont(1); - octave->textsize(11); - octave->callback((Fl_Callback*)cb_octave); - octave->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16; - o->value(k); - } // Fl_Counter* octave - { Fl_Counter* o = coarsedet = new Fl_Counter(455, 345, 60, 20, "Coarse det."); - coarsedet->tooltip("Coarse Detune"); - coarsedet->labelsize(10); - coarsedet->minimum(-64); - coarsedet->maximum(63); - coarsedet->step(1); - coarsedet->textfont(1); - coarsedet->textsize(11); - coarsedet->callback((Fl_Callback*)cb_coarsedet); - coarsedet->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - int k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024; - o->value(k); - o->lstep(10); - } // Fl_Counter* coarsedet - { LFOUI* o = freqlfo = new LFOUI(215, 295, 230, 70, "Frequency LFO "); - freqlfo->box(FL_FLAT_BOX); - freqlfo->color(FL_DARK1); - freqlfo->selection_color(FL_BACKGROUND_COLOR); - freqlfo->labeltype(FL_NORMAL_LABEL); - freqlfo->labelfont(0); - freqlfo->labelsize(14); - freqlfo->labelcolor(FL_FOREGROUND_COLOR); - freqlfo->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - freqlfo->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.FreqLfo); - freqlfo->end(); - } // LFOUI* freqlfo - { Fl_Slider* o = freq = new Fl_Slider(60, 275, 385, 15); - freq->tooltip("Fine Detune (cents)"); - freq->type(5); - freq->box(FL_FLAT_BOX); - freq->minimum(-8192); - freq->maximum(8191); - freq->step(1); - freq->callback((Fl_Callback*)cb_freq); - o->value(pars->GlobalPar.PDetune-8192); - } // Fl_Slider* freq - { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(12, 275, 45, 15, "Detune"); - detunevalueoutput->labelsize(10); - detunevalueoutput->minimum(-5000); - detunevalueoutput->maximum(5000); - detunevalueoutput->step(0.01); - detunevalueoutput->textfont(1); - detunevalueoutput->textsize(10); - detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput2); - detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune)); - } // Fl_Value_Output* detunevalueoutput - { Fl_Choice* o = detunetype = new Fl_Choice(450, 315, 75, 15, "Detune Type"); - detunetype->down_box(FL_BORDER_BOX); - detunetype->labelsize(10); - detunetype->textfont(1); - detunetype->textsize(10); - detunetype->callback((Fl_Callback*)cb_detunetype); - detunetype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); - o->value(pars->GlobalPar.PDetuneType-1); - } // Fl_Choice* detunetype - { WidgetPDial* o = new WidgetPDial(500, 270, 25, 25, "relBW"); - o->tooltip("Bandwidth - how the relative fine detune of the voice are changed"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_relBW); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->when(FL_WHEN_CHANGED); - o->value(pars->GlobalPar.PBandwidth); - } // WidgetPDial* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(5, 5, 240, 250, "AMPLITUDE"); - o->box(FL_THIN_UP_FRAME); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { Fl_Value_Slider* o = volume = new Fl_Value_Slider(10, 30, 160, 15, "Vol"); - volume->tooltip("Volume"); - volume->type(5); - volume->box(FL_FLAT_BOX); - volume->labelsize(11); - volume->maximum(127); - volume->step(1); - volume->callback((Fl_Callback*)cb_volume); - volume->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->GlobalPar.PVolume); - } // Fl_Value_Slider* volume - { Fl_Value_Slider* o = vsns = new Fl_Value_Slider(10, 50, 160, 15, "V.Sns"); - vsns->tooltip("Velocity Sensing Function (rightmost to disable)"); - vsns->type(5); - vsns->box(FL_FLAT_BOX); - vsns->labelsize(11); - vsns->maximum(127); - vsns->step(1); - vsns->callback((Fl_Callback*)cb_vsns); - vsns->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->GlobalPar.PAmpVelocityScaleFunction); - } // Fl_Value_Slider* vsns - { WidgetPDial* o = pan = new WidgetPDial(210, 25, 30, 30, "Pan"); - pan->tooltip("Panning (leftmost is Random)"); - pan->box(FL_ROUND_UP_BOX); - pan->color(FL_BACKGROUND_COLOR); - pan->selection_color(FL_INACTIVE_COLOR); - pan->labeltype(FL_NORMAL_LABEL); - pan->labelfont(0); - pan->labelsize(10); - pan->labelcolor(FL_FOREGROUND_COLOR); - pan->maximum(127); - pan->step(1); - pan->callback((Fl_Callback*)cb_pan); - pan->align(Fl_Align(FL_ALIGN_BOTTOM)); - pan->when(FL_WHEN_CHANGED); - o->value(pars->GlobalPar.PPanning); - } // WidgetPDial* pan - { WidgetPDial* o = pstr = new WidgetPDial(125, 227, 25, 25, "P.Str."); - pstr->tooltip("Punch Strength"); - pstr->box(FL_ROUND_UP_BOX); - pstr->color(FL_BACKGROUND_COLOR); - pstr->selection_color(FL_INACTIVE_COLOR); - pstr->labeltype(FL_NORMAL_LABEL); - pstr->labelfont(0); - pstr->labelsize(10); - pstr->labelcolor(FL_FOREGROUND_COLOR); - pstr->maximum(127); - pstr->step(1); - pstr->callback((Fl_Callback*)cb_pstr); - pstr->align(Fl_Align(FL_ALIGN_TOP)); - pstr->when(FL_WHEN_CHANGED); - o->value(pars->GlobalPar.PPunchStrength); - } // WidgetPDial* pstr - { WidgetPDial* o = pt = new WidgetPDial(155, 227, 25, 25, "P.t."); - pt->tooltip("Punch Time (duration)"); - pt->box(FL_ROUND_UP_BOX); - pt->color(FL_BACKGROUND_COLOR); - pt->selection_color(FL_INACTIVE_COLOR); - pt->labeltype(FL_NORMAL_LABEL); - pt->labelfont(0); - pt->labelsize(10); - pt->labelcolor(FL_FOREGROUND_COLOR); - pt->maximum(127); - pt->step(1); - pt->callback((Fl_Callback*)cb_pt); - pt->align(Fl_Align(FL_ALIGN_TOP)); - pt->when(FL_WHEN_CHANGED); - o->value(pars->GlobalPar.PPunchTime); - } // WidgetPDial* pt - { WidgetPDial* o = pstc = new WidgetPDial(185, 227, 25, 25, "P.Stc."); - pstc->tooltip("Punch Stretch"); - pstc->box(FL_ROUND_UP_BOX); - pstc->color(FL_BACKGROUND_COLOR); - pstc->selection_color(FL_INACTIVE_COLOR); - pstc->labeltype(FL_NORMAL_LABEL); - pstc->labelfont(0); - pstc->labelsize(10); - pstc->labelcolor(FL_FOREGROUND_COLOR); - pstc->maximum(127); - pstc->step(1); - pstc->callback((Fl_Callback*)cb_pstc); - pstc->align(Fl_Align(FL_ALIGN_TOP)); - pstc->when(FL_WHEN_CHANGED); - o->value(pars->GlobalPar.PPunchStretch); - } // WidgetPDial* pstc - { WidgetPDial* o = pvel = new WidgetPDial(215, 227, 25, 25, "P.Vel."); - pvel->tooltip("Punch Velocity Sensing"); - pvel->box(FL_ROUND_UP_BOX); - pvel->color(FL_BACKGROUND_COLOR); - pvel->selection_color(FL_INACTIVE_COLOR); - pvel->labeltype(FL_NORMAL_LABEL); - pvel->labelfont(0); - pvel->labelsize(10); - pvel->labelcolor(FL_FOREGROUND_COLOR); - pvel->maximum(127); - pvel->step(1); - pvel->callback((Fl_Callback*)cb_pvel); - pvel->align(Fl_Align(FL_ALIGN_TOP)); - pvel->when(FL_WHEN_CHANGED); - o->value(pars->GlobalPar.PPunchVelocitySensing); - } // WidgetPDial* pvel - { EnvelopeUI* o = ampenv = new EnvelopeUI(10, 75, 205, 70, "ADSynth Global - Amplitude Envelope"); - ampenv->box(FL_FLAT_BOX); - ampenv->color((Fl_Color)51); - ampenv->selection_color(FL_BACKGROUND_COLOR); - ampenv->labeltype(FL_NORMAL_LABEL); - ampenv->labelfont(0); - ampenv->labelsize(14); - ampenv->labelcolor(FL_FOREGROUND_COLOR); - ampenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - ampenv->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.AmpEnvelope); - ampenv->end(); - } // EnvelopeUI* ampenv - { LFOUI* o = amplfo = new LFOUI(10, 145, 230, 70, "Amplitude LFO "); - amplfo->box(FL_FLAT_BOX); - amplfo->color(FL_DARK1); - amplfo->selection_color(FL_BACKGROUND_COLOR); - amplfo->labeltype(FL_NORMAL_LABEL); - amplfo->labelfont(0); - amplfo->labelsize(14); - amplfo->labelcolor(FL_FOREGROUND_COLOR); - amplfo->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - amplfo->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.AmpLfo); - amplfo->end(); - } // LFOUI* amplfo - { Fl_Check_Button* o = rndgrp = new Fl_Check_Button(70, 225, 40, 25, "Rnd Grp"); - rndgrp->tooltip("How the Harmonic Amplitude is applied to voices that use the same oscillator"); - rndgrp->down_box(FL_DOWN_BOX); - rndgrp->labelsize(10); - rndgrp->callback((Fl_Callback*)cb_rndgrp); - rndgrp->align(Fl_Align(132|FL_ALIGN_INSIDE)); - o->value(pars->GlobalPar.Hrandgrouping); - } // Fl_Check_Button* rndgrp - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(245, 5, 285, 250, "FILTER"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = filterenv = new EnvelopeUI(250, 110, 275, 70, "ADSynth Global - Filter Envelope"); - filterenv->box(FL_FLAT_BOX); - filterenv->color((Fl_Color)51); - filterenv->selection_color(FL_BACKGROUND_COLOR); - filterenv->labeltype(FL_NORMAL_LABEL); - filterenv->labelfont(0); - filterenv->labelsize(14); - filterenv->labelcolor(FL_FOREGROUND_COLOR); - filterenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterenv->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.FilterEnvelope); - filterenv->end(); - } // EnvelopeUI* filterenv - { LFOUI* o = filterlfo = new LFOUI(250, 180, 230, 70, "Filter LFO"); - filterlfo->box(FL_FLAT_BOX); - filterlfo->color(FL_DARK1); - filterlfo->selection_color(FL_BACKGROUND_COLOR); - filterlfo->labeltype(FL_NORMAL_LABEL); - filterlfo->labelfont(0); - filterlfo->labelsize(14); - filterlfo->labelcolor(FL_FOREGROUND_COLOR); - filterlfo->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterlfo->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.FilterLfo); - filterlfo->end(); - } // LFOUI* filterlfo - { FilterUI* o = filterui = new FilterUI(250, 35, 275, 75, "ADsynth Global - Filter"); - filterui->box(FL_FLAT_BOX); - filterui->color(FL_LIGHT1); - filterui->selection_color(FL_BACKGROUND_COLOR); - filterui->labeltype(FL_NORMAL_LABEL); - filterui->labelfont(0); - filterui->labelsize(14); - filterui->labelcolor(FL_FOREGROUND_COLOR); - filterui->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterui->when(FL_WHEN_RELEASE); - o->init(pars->GlobalPar.GlobalFilter,&pars->GlobalPar.PFilterVelocityScale,&pars->GlobalPar.PFilterVelocityScaleFunction); - filterui->end(); - } // FilterUI* filterui - o->end(); - } // Fl_Group* o - { Fl_Check_Button* o = stereo = new Fl_Check_Button(5, 220, 65, 35, "Stereo"); - stereo->box(FL_ENGRAVED_BOX); - stereo->down_box(FL_DOWN_BOX); - stereo->labelfont(1); - stereo->labelsize(11); - stereo->callback((Fl_Callback*)cb_stereo); - o->value(pars->GlobalPar.PStereo); - } // Fl_Check_Button* stereo - { Fl_Button* o = new Fl_Button(180, 375, 125, 25, "Show Voice List"); - o->callback((Fl_Callback*)cb_Show); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(5, 375, 170, 25, "Show Voice Parameters"); - o->labelfont(1); - o->labelsize(12); - o->callback((Fl_Callback*)cb_Show1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(470, 375, 60, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(309, 375, 86, 25, "Resonance"); - o->tooltip("Resonance"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Resonance); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(405, 380, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(435, 380, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - ADnoteGlobalParameters->end(); - } // Fl_Double_Window* ADnoteGlobalParameters - { ADnoteVoice = new Fl_Double_Window(765, 620, "ADsynth Voice Parameters"); - ADnoteVoice->user_data((void*)(this)); - { ADvoiceUI* o = advoice = new ADvoiceUI(0, 0, 760, 575); - advoice->box(FL_BORDER_BOX); - advoice->color(FL_BACKGROUND_COLOR); - advoice->selection_color(FL_BACKGROUND_COLOR); - advoice->labeltype(FL_NORMAL_LABEL); - advoice->labelfont(0); - advoice->labelsize(14); - advoice->labelcolor(FL_FOREGROUND_COLOR); - advoice->align(Fl_Align(FL_ALIGN_TOP)); - advoice->when(FL_WHEN_RELEASE); - o->init(pars,nvoice,master); - o->show(); - advoice->end(); - } // ADvoiceUI* advoice - { Fl_Button* o = new Fl_Button(300, 585, 195, 25, "Close Window"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->callback((Fl_Callback*)cb_Close1); - } // Fl_Button* o - { Fl_Counter* o = currentvoicecounter = new Fl_Counter(5, 585, 130, 25, "Current Voice"); - currentvoicecounter->type(1); - currentvoicecounter->labelfont(1); - currentvoicecounter->minimum(0); - currentvoicecounter->maximum(2); - currentvoicecounter->step(1); - currentvoicecounter->value(1); - currentvoicecounter->textfont(1); - currentvoicecounter->textsize(13); - currentvoicecounter->callback((Fl_Callback*)cb_currentvoicecounter); - currentvoicecounter->align(Fl_Align(FL_ALIGN_RIGHT)); - o->bounds(1,NUM_VOICES); - } // Fl_Counter* currentvoicecounter - { Fl_Button* o = new Fl_Button(700, 590, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(730, 590, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P1); - } // Fl_Button* o - ADnoteVoice->end(); - } // Fl_Double_Window* ADnoteVoice - { ADnoteVoiceList = new Fl_Double_Window(650, 260, "ADsynth Voices list"); - ADnoteVoiceList->user_data((void*)(this)); - { Fl_Text_Display* o = new Fl_Text_Display(10, 15, 30, 10, "No."); - o->box(FL_NO_BOX); - o->labelfont(1); - o->labelsize(11); - } // Fl_Text_Display* o - { Fl_Text_Display* o = new Fl_Text_Display(145, 15, 30, 10, "Vol"); - o->box(FL_NO_BOX); - o->labelfont(1); - o->labelsize(11); - } // Fl_Text_Display* o - { Fl_Text_Display* o = new Fl_Text_Display(384, 15, 25, 10, "Detune"); - o->box(FL_NO_BOX); - o->labelfont(1); - o->labelsize(11); - } // Fl_Text_Display* o - { Fl_Text_Display* o = new Fl_Text_Display(210, 15, 30, 10, "Pan"); - o->box(FL_NO_BOX); - o->labelfont(1); - o->labelsize(11); - } // Fl_Text_Display* o - { Fl_Text_Display* o = new Fl_Text_Display(560, 15, 30, 10, "Vib. Depth"); - o->box(FL_NO_BOX); - o->labelfont(1); - o->labelsize(11); - } // Fl_Text_Display* o - { Fl_Text_Display* o = new Fl_Text_Display(245, 15, 25, 10, "R."); - o->box(FL_NO_BOX); - o->labelfont(1); - o->labelsize(11); - } // Fl_Text_Display* o - { Fl_Button* o = new Fl_Button(255, 237, 125, 20, "Hide Voice List"); - o->callback((Fl_Callback*)cb_Hide); - } // Fl_Button* o - { Fl_Scroll* o = new Fl_Scroll(0, 15, 640, 220); - o->type(2); - o->box(FL_THIN_UP_BOX); - { Fl_Pack* o = new Fl_Pack(0, 20, 620, 210); - for (int i=0;iinit(pars,i,master);} - o->end(); - } // Fl_Pack* o - o->end(); - } // Fl_Scroll* o - ADnoteVoiceList->end(); - } // Fl_Double_Window* ADnoteVoiceList - return ADnoteVoiceList; -} - -ADnoteUI::ADnoteUI(ADnoteParameters *parameters,Master *master_) { - pars=parameters; - master=master_; - nvoice=0; - resui=new ResonanceUI(pars->GlobalPar.Reson); - make_window(); -} - -ADnoteUI::~ADnoteUI() { - ADnoteVoiceList->hide(); - ADnoteGlobalParameters->hide(); - ADnoteVoice->hide(); - delete(ADnoteVoiceList); - delete(ADnoteGlobalParameters); - delete(ADnoteVoice); - delete(resui); -} - -void ADnoteUI::refresh() { - volume->value(pars->GlobalPar.PVolume); - vsns->value(pars->GlobalPar.PAmpVelocityScaleFunction); - pan->value(pars->GlobalPar.PPanning); - - stereo->value(pars->GlobalPar.PStereo); - rndgrp->value(pars->GlobalPar.Hrandgrouping); - - pstr->value(pars->GlobalPar.PPunchStrength); - pt->value(pars->GlobalPar.PPunchTime); - pstc->value(pars->GlobalPar.PPunchStretch); - pvel->value(pars->GlobalPar.PPunchVelocitySensing); - - detunevalueoutput->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune)); - freq->value(pars->GlobalPar.PDetune-8192); - - int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16; - octave->value(k); - - detunetype->value(pars->GlobalPar.PDetuneType-1); - k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024; - coarsedet->value(k); - amplfo->refresh(); - freqlfo->refresh(); - filterlfo->refresh(); - - ampenv->refresh(); - freqenv->refresh(); - filterenv->refresh(); - filterui->refresh(); - - for (int i=0;irefreshlist(); - - resui->refresh(); - currentvoicecounter->do_callback(); -} diff --git a/plugins/zynaddsubfx/src/UI/ADnoteUI.fl b/plugins/zynaddsubfx/src/UI/ADnoteUI.fl deleted file mode 100644 index 748156c74..000000000 --- a/plugins/zynaddsubfx/src/UI/ADnoteUI.fl +++ /dev/null @@ -1,1161 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0109 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "../Params/ADnoteParameters.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "ResonanceUI.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "LFOUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "OscilGenUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class ADvoicelistitem {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window ADnoteVoiceListItem { - private xywh {247 599 615 30} type Double hide - class Fl_Group - } { - Fl_Group voicelistitemgroup { - private xywh {50 0 570 25} box FLAT_BOX - code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();} - } { - Fl_Value_Slider voicevolume { - callback {pars->VoicePar[nvoice].PVolume=(int)o->value();} - tooltip Volume xywh {90 5 115 20} type {Horz Knob} box FLAT_BOX labelsize 8 align 5 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PVolume);} - } - Fl_Check_Button voiceresonanceenabled { - callback {pars->VoicePar[nvoice].Presonance=(int)o->value();} - tooltip {Resonance On/Off} xywh {245 7 15 17} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 11 align 4 - code0 {o->value(pars->VoicePar[nvoice].Presonance);} - } - Fl_Value_Slider voicelfofreq { - callback {pars->VoicePar[nvoice].FreqLfo->Pintensity=(int)o->value();} - tooltip {Frequency LFO amount} xywh {500 5 115 20} type {Horz Knob} box FLAT_BOX labelsize 8 align 5 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].FreqLfo->Pintensity);} - } - Fl_Dial voicepanning { - callback {pars->VoicePar[nvoice].PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {215 5 20 20} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PPanning);} - class WidgetPDial - } - Fl_Group voiceoscil {open - xywh {60 5 30 20} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);} - code2 {if (pars->VoicePar[nvoice].Pextoscil != -1) {osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,master);}} - } {} - Fl_Value_Output detunevalueoutput { - callback {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - xywh {265 5 45 20} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->VoicePar[nvoice].PDetuneType,0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - } - Fl_Slider voicedetune { - callback {pars->VoicePar[nvoice].PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {315 5 185 20} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->VoicePar[nvoice].PDetune-8192);} - } - Fl_Box noiselabel { - label N - callback {if (pars->VoicePar[nvoice].Type==0) { - o->hide(); - voiceresonanceenabled->activate(); - detunevalueoutput->activate(); - voicedetune->activate(); - voicelfofreq->activate(); - voiceoscil->activate(); -} else { - o->show(); - voiceresonanceenabled->deactivate(); - detunevalueoutput->deactivate(); - voicedetune->deactivate(); - voicelfofreq->deactivate(); - voiceoscil->deactivate(); -};} - xywh {65 5 20 20} labelfont 1 labelsize 13 labelcolor 7 - code0 {if (pars->VoicePar[nvoice].Type==0) o->hide();} - } - } - Fl_Check_Button voiceenabled { - label 01 - callback {pars->VoicePar[nvoice].Enabled=(int)o->value(); -if (o->value()==0) voicelistitemgroup->deactivate(); -else voicelistitemgroup->activate(); -o->redraw();} - private xywh {30 5 20 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 4 - code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));} - code1 {o->value(pars->VoicePar[nvoice].Enabled);} - } - } - } - Function {ADvoicelistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {nvoice=0; -pars=NULL;} {} - } - Function {init(ADnoteParameters *parameters,int nvoice_,Master *master_)} {} { - code {pars=parameters; -nvoice=nvoice_; -master=master_; -make_window(); -ADnoteVoiceListItem->show(); -end();} {} - } - Function {refreshlist()} {} { - code {voiceenabled->value(pars->VoicePar[nvoice].Enabled); -voiceresonanceenabled->value(pars->VoicePar[nvoice].Presonance); -voicevolume->value(pars->VoicePar[nvoice].PVolume); -voicedetune->value(pars->VoicePar[nvoice].PDetune-8192); -voicepanning->value(pars->VoicePar[nvoice].PPanning); -voicelfofreq->value(pars->VoicePar[nvoice].FreqLfo->Pintensity); -if (pars->VoicePar[nvoice].Pextoscil != -1) { - osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); -} else - osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); -if (pars->VoicePar[nvoice].Enabled==0) voicelistitemgroup->deactivate(); - else voicelistitemgroup->activate(); -detunevalueoutput->do_callback(); -noiselabel->do_callback(); -ADnoteVoiceListItem->redraw();} {} - } - Function {~ADvoicelistitem()} {} { - code {ADnoteVoiceListItem->hide(); -//delete(ADnoteVoiceListItem);} {} - } - decl {ADnoteParameters *pars;} {} - decl {int nvoice;} {} - decl {Oscilloscope *osc;} {} - decl {Master *master;} {} -} - -class ADvoiceUI {open : {public Fl_Group} -} { - Function {make_window()} {open - } { - Fl_Window ADnoteVoiceParameters { - label Voice - xywh {69 185 765 575} type Double - class Fl_Group visible - } { - Fl_Group voiceparametersgroup {open - xywh {0 0 765 580} box THIN_UP_BOX color 48 - code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();} - } { - Fl_Group voicemodegroup {open - xywh {0 5 760 575} - } { - Fl_Group voiceFMparametersgroup { - label MODULATOR - xywh {530 5 230 565} box THIN_UP_FRAME color 48 labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - code0 {if (pars->VoicePar[nvoice].PFMEnabled==0) o->deactivate();} - } { - Fl_Group modfrequency { - label {Mod.FREQUENCY} - xywh {535 220 220 145} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group voiceFMfreqenvgroup { - label {ADSynth Modulator - Frequency Envelope} - xywh {540 290 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FMFreqEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceFMfreqenvgroup->deactivate(); -else voiceFMfreqenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {545 295 50 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled);} - } - Fl_Counter {} { - label {Coarse Det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->VoicePar[nvoice].PFMCoarseDetune = k+ - (pars->VoicePar[nvoice].PFMCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {685 270 60 15} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PFMCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Counter {} { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->VoicePar[nvoice].PFMCoarseDetune = k*1024+ - pars->VoicePar[nvoice].PFMCoarseDetune%1024;} - tooltip Octave xywh {625 270 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PFMCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Slider {} { - callback {pars->VoicePar[nvoice].PFMDetune=(int)o->value()+8192; -fmdetunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {590 245 160 10} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMDetune-8192);} - } - Fl_Value_Output fmdetunevalueoutput { - label Detune - callback {o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune));} - xywh {540 245 45 13} labelsize 8 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 8 - code0 {o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune));} - code1 {//o->value(getdetune(pars->VoicePar[nvoice].PFMDetuneType,0,pars->VoicePar[nvoice].PFMDetune));} - } - Fl_Choice {} { - label {Detune Type} - callback {pars->VoicePar[nvoice].PFMDetuneType=(int) o->value(); -fmdetunevalueoutput->do_callback();} open - xywh {540 270 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->VoicePar[nvoice].PFMDetuneType);} - } {} - } - Fl_Group {} { - label {Mod.AMPLITUDE} - xywh {535 60 220 160} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider {} { - label Vol - callback {pars->VoicePar[nvoice].PFMVolume=(int)o->value();} - tooltip Volume xywh {540 80 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMVolume);} - } - Fl_Value_Slider {} { - label {V.Sns} - callback {pars->VoicePar[nvoice].PFMVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {540 100 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMVelocityScaleFunction);} - } - Fl_Group voiceFMampenvgroup { - label {ADSynth Modulator - Amplitude Envelope} open - xywh {540 145 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FMAmpEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceFMampenvgroup->deactivate(); -else voiceFMampenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {545 150 50 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled);} - } - Fl_Value_Slider {} { - label {F.Damp} - callback {pars->VoicePar[nvoice].PFMVolumeDamp=(int) o->value()+64;} - tooltip {Modulator Damp at Higher frequency} xywh {540 120 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 minimum -64 maximum 63 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMVolumeDamp-64);} - } - } - Fl_Group modoscil { - xywh {535 365 220 200} - } { - Fl_Group fmoscil {open - xywh {535 425 220 140} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {oscFM=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;} - code2 {oscFM->init(pars->VoicePar[nv].FMSmp,0,pars->VoicePar[nvoice].PFMoscilphase,master);} - } {} - Fl_Box {} { - label {Mod.Oscillator} - xywh {535 365 155 20} labelfont 1 align 20 - } - Fl_Button changeFMoscilbutton { - label Change - callback {if (oscedit!=NULL) delete(oscedit); - -int nv=nvoice; -if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil; - -oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,NULL,NULL,master);} - xywh {700 370 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 - code0 {if (pars->VoicePar[nvoice].PextFMoscil>=0) o->labelcolor(FL_BLUE);} - } - Fl_Slider {} { - label Phase - callback {pars->VoicePar[nvoice].PFMoscilphase=64-(int)o->value(); -oscFM->phase=64-(int) o->value(); -fmoscil->redraw();} - xywh {665 400 65 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(64-pars->VoicePar[nvoice].PFMoscilphase);} - } - Fl_Choice {} { - label Use - callback {pars->VoicePar[nvoice].PextFMoscil=(int)o->value()-1; -if ((int) o->value() != 0) { - oscFM->init(pars->VoicePar[(int) o->value()-1].FMSmp,master); - changeFMoscilbutton->labelcolor(FL_BLUE); -} else { - oscFM->init(pars->VoicePar[nvoice].FMSmp,master); - changeFMoscilbutton->labelcolor(FL_BLACK); -}; -voiceFMparametersgroup->redraw();} open - xywh {560 395 75 15} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 - code0 {o->add("Internal");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(pars->VoicePar[nvoice].PextFMoscil+1);} - } {} - } - Fl_Choice {} { - label {External Mod.} - callback {pars->VoicePar[nvoice].PFMVoice=(int)o->value()-1; -if ((int) o->value() != 0) { - modoscil->deactivate(); - modfrequency->deactivate(); -} else { - modoscil->activate(); - modfrequency->activate(); -}; -voiceFMparametersgroup->redraw();} open - xywh {635 40 85 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("OFF");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code2 {o->value(pars->VoicePar[nvoice].PFMVoice+1);} - code3 {if ((int) o->value() != 0) {modoscil->deactivate();modfrequency->deactivate();}} - } {} - } - Fl_Choice {} { - label {Type:} - callback {pars->VoicePar[nvoice].PFMEnabled=(int)o->value(); -if (o->value()==0) voiceFMparametersgroup->deactivate(); -else voiceFMparametersgroup->activate(); -o->redraw();} - xywh {535 40 80 20} down_box BORDER_BOX align 5 - code0 {o->value(pars->VoicePar[nvoice].PFMEnabled);} - } { - MenuItem {} { - label OFF - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label MORPH - xywh {50 50 100 20} labelfont 1 - } - MenuItem {} { - label RING - xywh {60 60 100 20} labelfont 1 - } - MenuItem {} { - label PM - xywh {70 70 100 20} labelfont 1 - } - MenuItem {} { - label FM - xywh {80 80 100 20} labelfont 1 - } - MenuItem {} { - label PITCH - xywh {90 90 100 20} labelfont 1 deactivate - } - } - Fl_Group {} { - label FREQUENCY - xywh {5 250 525 120} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group voicefreqenvgroup { - label {ADSynth Voice - Frequency Envelope} open - xywh {10 290 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FreqEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFreqEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFreqEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voicefreqenvgroup->deactivate(); -else voicefreqenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {15 295 50 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFreqEnvelopeEnabled);} - } - Fl_Group voicefreqlfogroup { - label {Frequency LFO } open - xywh {215 290 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->VoicePar[nvoice].FreqLfo);} - code1 {if (pars->VoicePar[nvoice].PFreqLfoEnabled==0) o->deactivate();} - class LFOUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFreqLfoEnabled=(int)o->value(); -if (o->value()==0) voicefreqlfogroup->deactivate(); -else voicefreqlfogroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {220 295 55 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFreqLfoEnabled);} - } - Fl_Counter {} { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->VoicePar[nvoice].PCoarseDetune = k*1024+ - pars->VoicePar[nvoice].PCoarseDetune%1024;} - tooltip Octave xywh {470 270 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter {} { - label {Coarse Det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->VoicePar[nvoice].PCoarseDetune = k+ - (pars->VoicePar[nvoice].PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {455 340 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Slider {} { - callback {pars->VoicePar[nvoice].PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {58 272 392 13} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->VoicePar[nvoice].PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - xywh {10 272 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - } - Fl_Check_Button {} { - label 440Hz - callback {int x=(int) o->value(); -pars->VoicePar[nvoice].Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate();} - tooltip {Set the voice base frequency to 440Hz} xywh {345 253 55 15} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].Pfixedfreq);} - } - Fl_Dial fixedfreqetdial { - label {Eq.T.} - callback {pars->VoicePar[nvoice].PfixedfreqET=(int) o->value();} - tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {405 255 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PfixedfreqET);} - code1 {if (pars->VoicePar[nvoice].Pfixedfreq==0) o->deactivate();} - class WidgetPDial - } - Fl_Choice {} { - label {Detune Type} - callback {pars->VoicePar[nvoice].PDetuneType=(int) o->value(); -detunevalueoutput->do_callback();} open - xywh {450 305 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->VoicePar[nvoice].PDetuneType);} - } {} - } - Fl_Group voiceoscil { - xywh {80 375 445 145} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {int nv=nvoice; if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil;} - code2 {osc->init(pars->VoicePar[nv].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);} - } {} - Fl_Button changevoiceoscilbutton { - label Change - callback {if (oscedit!=NULL) delete(oscedit); - -int nv=nvoice; -if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil; - -oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,NULL,NULL,master);} - xywh {5 475 65 20} box THIN_UP_BOX labelfont 1 labelsize 11 - code0 {if (pars->VoicePar[nvoice].Pextoscil>=0) o->labelcolor(FL_BLUE);} - } - Fl_Box {} { - label {Voice Oscillator} - xywh {5 375 75 35} labelfont 1 labelsize 12 align 128 - } - Fl_Slider {} { - label Phase - callback {pars->VoicePar[nvoice].Poscilphase=64-(int)o->value(); -osc->phase=64-(int) o->value(); -voiceoscil->redraw();} - xywh {10 420 65 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(64-pars->VoicePar[nvoice].Poscilphase);} - } - Fl_Check_Button {} { - label {R.} - callback {pars->VoicePar[nvoice].Presonance=(int) o->value();} - tooltip {Resonance On/Off} xywh {210 5 35 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].Presonance);} - } - Fl_Choice {} { - label {Use Oscil.} - callback {pars->VoicePar[nvoice].Pextoscil=(int)o->value()-1; -if ((int) o->value() != 0) { - osc->init(pars->VoicePar[(int) o->value()-1].OscilSmp,master); - changevoiceoscilbutton->labelcolor(FL_BLUE); -} else { - osc->init(pars->VoicePar[nvoice].OscilSmp,master); - changevoiceoscilbutton->labelcolor(FL_BLACK); -}; - -voiceparametersgroup->redraw(); -voiceonbutton->redraw();} open - xywh {5 455 65 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("Internal");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(pars->VoicePar[nvoice].Pextoscil+1);} - } {} - Fl_Group {} {open - xywh {5 525 515 45} box ENGRAVED_BOX - } { - Fl_Dial {} { - label Stereo - callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();} - tooltip {Stereo Spread} xywh {285 540 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_stereo_spread);} - class WidgetPDial - } - Fl_Choice {} { - label Unison - callback {pars->set_unison_size_index(nvoice,(int) o->value());} open selected - tooltip {Unison size} xywh {10 545 75 20} down_box BORDER_BOX labelfont 1 align 5 textfont 1 textsize 10 - code0 {o->add("OFF");char tmp[100];for (int i=1;ADnote_unison_sizes[i];i++){snprintf(tmp,100,"size %d",ADnote_unison_sizes[i]);o->add(tmp);};} - code1 {o->value(pars->get_unison_size_index(nvoice));} - } {} - Fl_Dial {} { - label Vibratto - callback {pars->VoicePar[nvoice].Unison_vibratto=(int)o->value();} - tooltip Vibratto xywh {340 540 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto);} - class WidgetPDial - } - Fl_Choice {} { - label Invert - callback {pars->VoicePar[nvoice].Unison_invert_phase=(int) o->value();} open - tooltip {Phase Invert} xywh {445 545 65 15} down_box BORDER_BOX labelsize 11 align 5 textfont 1 textsize 10 - code0 {o->add("None");o->add("Random");char tmp[100];for (int i=2;i<=5;i++){snprintf(tmp,100,"%d %%",100/i);o->add(tmp);};} - code1 {o->value(pars->VoicePar[nvoice].Unison_invert_phase);} - } {} - Fl_Slider {} { - label {Frequency Spread} - callback {pars->VoicePar[nvoice].Unison_frequency_spread=(int)o->value(); -unisonspreadoutput->do_callback();} - tooltip {Frequency Spread of the Unison} xywh {95 547 125 13} type {Horz Knob} box FLAT_BOX labelsize 12 align 1 maximum 127 step 1 value 64 - code0 {o->value(pars->VoicePar[nvoice].Unison_frequency_spread);} - } - Fl_Value_Output unisonspreadoutput { - label {(cents)} - callback {o->value(pars->getUnisonFrequencySpreadCents(nvoice));} - xywh {225 545 40 15} labelsize 10 align 5 maximum 1000 step 0.1 textfont 1 textsize 10 - code0 {o->value(pars->getUnisonFrequencySpreadCents(nvoice));} - } - Fl_Dial {} { - label {Vib.speed} - callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();} - tooltip {Vibratto Average Speed} xywh {390 540 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto_speed);} - class WidgetPDial - } - } - } - Fl_Group {} { - label AMPLITUDE - xywh {5 40 240 210} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider {} { - label Vol - callback {pars->VoicePar[nvoice].PVolume=(int)o->value();} - tooltip Volume xywh {10 60 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PVolume);} - } - Fl_Value_Slider {} { - label {V.Sns} - callback {pars->VoicePar[nvoice].PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 80 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PAmpVelocityScaleFunction);} - } - Fl_Group voiceampenvgroup { - label {ADSynth Voice - Amplitude Envelope} open - xywh {10 105 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].AmpEnvelope);} - code1 {if (pars->VoicePar[nvoice].PAmpEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Dial {} { - label Pan - callback {pars->VoicePar[nvoice].PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {210 60 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PPanning);} - class WidgetPDial - } - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PAmpEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceampenvgroup->deactivate(); -else voiceampenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {15 110 50 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PAmpEnvelopeEnabled);} - } - Fl_Group voiceamplfogroup { - label {Amplitude LFO } open - xywh {10 175 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->VoicePar[nvoice].AmpLfo);} - code1 {if (pars->VoicePar[nvoice].PAmpLfoEnabled==0) o->deactivate();} - class LFOUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PAmpLfoEnabled=(int)o->value(); -if (o->value()==0) voiceamplfogroup->deactivate(); -else voiceamplfogroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {15 180 55 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PAmpLfoEnabled);} - } - Fl_Check_Button {} { - label Minus - callback {pars->VoicePar[nvoice].PVolumeminus=(int)o->value();} - xywh {10 45 50 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PVolumeminus);} - } - } - Fl_Group voicefiltergroup { - label FILTER - xywh {245 5 285 245} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - code0 {if (pars->VoicePar[nvoice].PFilterEnabled==0) o->deactivate();} - } { - Fl_Group {} { - label {ADsynth Voice - Filter} open - xywh {250 30 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->VoicePar[nvoice].VoiceFilter,NULL,NULL);} - class FilterUI - } {} - Fl_Group voicefilterenvgroup { - label {ADSynth Voice - Filter Envelope} open - xywh {250 105 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FilterEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFilterEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFilterEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voicefilterenvgroup->deactivate(); -else voicefilterenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {255 110 55 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFilterEnvelopeEnabled);} - } - Fl_Group voicefilterlfogroup { - label {Filter LFO } open - xywh {250 175 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->VoicePar[nvoice].FilterLfo);} - code1 {if (pars->VoicePar[nvoice].PFilterLfoEnabled==0) o->deactivate();} - class LFOUI - } {} - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFilterLfoEnabled=(int)o->value(); -if (o->value()==0) voicefilterlfogroup->deactivate(); -else voicefilterlfogroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {255 180 55 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFilterLfoEnabled);} - } - } - Fl_Group {} { - label 01 - xywh {5 5 55 35} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 16 - code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));} - } {} - Fl_Choice {} { - callback {int x=(int) o->value(); -pars->VoicePar[nvoice].Type=x; -if (x==0) voicemodegroup->activate(); - else voicemodegroup->deactivate(); -noiselabel->do_callback();} - tooltip {Oscillator Type (sound/noise)} xywh {5 500 65 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 - code0 {o->value(pars->VoicePar[nvoice].Type);} - code1 {if (pars->VoicePar[nvoice].Type!=0) voicemodegroup->deactivate();} - } { - MenuItem {} { - label Sound - xywh {5 5 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label NOISE - xywh {15 15 100 20} labelfont 1 labelsize 11 labelcolor 1 - } - } - Fl_Check_Button bypassfiltercheckbutton { - label {Bypass Global F.} - callback {pars->VoicePar[nvoice].Pfilterbypass=(int)o->value();} - xywh {425 10 100 20} down_box DOWN_BOX labelfont 1 labelsize 10 align 148 - code0 {o->value(pars->VoicePar[nvoice].Pfilterbypass);} - } - Fl_Group {} { - xywh {115 5 95 35} box THIN_UP_BOX - } { - Fl_Value_Slider {} { - label Delay - callback {pars->VoicePar[nvoice].PDelay=(int)o->value();} - tooltip Volume xywh {120 21 84 12} type {Horz Knob} box FLAT_BOX labelsize 11 align 5 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PDelay);} - } - } - Fl_Check_Button {} { - label Enable - callback {pars->VoicePar[nvoice].PFilterEnabled=(int)o->value(); -if (o->value()==0) voicefiltergroup->deactivate(); -else voicefiltergroup->activate(); -o->redraw(); -bypassfiltercheckbutton->redraw();} - tooltip {Enable Filter} xywh {250 15 60 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PFilterEnabled);} - } - Fl_Box noiselabel { - label {White Noise} - callback {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();} - xywh {150 415 300 65} labelfont 1 labelsize 50 labelcolor 7 - code0 {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();} - } - } - Fl_Check_Button voiceonbutton { - label On - callback {pars->VoicePar[nvoice].Enabled=(int)o->value(); -if (o->value()==0) voiceparametersgroup->deactivate(); -else voiceparametersgroup->activate(); -o->redraw();} - xywh {60 5 55 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 - code0 {o->value(pars->VoicePar[nvoice].Enabled);} - } - } - } - Function {ADvoiceUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {nvoice=0; -pars=NULL; -oscedit=NULL;} {} - } - Function {init(ADnoteParameters *parameters,int nvoice_,Master *master_)} {open - } { - code {pars=parameters; -nvoice=nvoice_; -master=master_; -make_window(); -end(); -ADnoteVoiceParameters->show();} {} - } - Function {~ADvoiceUI()} {} { - code {ADnoteVoiceParameters->hide(); -hide(); -if (oscedit!=NULL) { - delete(oscedit); -}; -//delete (ADnoteVoiceParameters);} {} - } - decl {int nvoice;} {} - decl {ADnoteParameters *pars;} {} - decl {OscilEditor *oscedit;} {} - decl {Oscilloscope *osc;} {} - decl {Oscilloscope *oscFM;} {} - decl {Master *master;} {} -} - -class ADnoteUI {open : {public PresetsUI_} -} { - Function {make_window()} {open private - } { - Fl_Window ADnoteGlobalParameters { - label {ADsynth Global Parameters of the Instrument} - xywh {462 186 535 405} type Double hide - } { - Fl_Group {} { - label FREQUENCY - xywh {5 255 525 115} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group freqenv { - label {ADSynth Global - Frequency Envelope} open - xywh {10 295 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalPar.FreqEnvelope);} - class EnvelopeUI - } {} - Fl_Counter octave { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->GlobalPar.PCoarseDetune = k*1024+ - pars->GlobalPar.PCoarseDetune%1024;} - tooltip Octave xywh {450 275 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter coarsedet { - label {Coarse det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->GlobalPar.PCoarseDetune = k+ - (pars->GlobalPar.PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {455 345 60 20} labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Group freqlfo { - label {Frequency LFO } open - xywh {215 295 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->GlobalPar.FreqLfo);} - class LFOUI - } {} - Fl_Slider freq { - callback {pars->GlobalPar.PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {60 275 385 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->GlobalPar.PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));} - xywh {12 275 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));} - } - Fl_Choice detunetype { - label {Detune Type} - callback {pars->GlobalPar.PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback();} open - xywh {450 315 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->GlobalPar.PDetuneType-1);} - } {} - Fl_Dial {} { - label relBW - callback {pars->GlobalPar.PBandwidth=(int) o->value(); - -pars->getBandwidthDetuneMultiplier(); - -for (int i=0;irefreshlist(); -};} - tooltip {Bandwidth - how the relative fine detune of the voice are changed} xywh {500 270 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PBandwidth);} - class WidgetPDial - } - } - Fl_Group {} { - label AMPLITUDE - xywh {5 5 240 250} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider volume { - label Vol - callback {pars->GlobalPar.PVolume=(int)o->value();} - tooltip Volume xywh {10 30 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PVolume);} - } - Fl_Value_Slider vsns { - label {V.Sns} - callback {pars->GlobalPar.PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PAmpVelocityScaleFunction);} - } - Fl_Dial pan { - label Pan - callback {pars->GlobalPar.PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {210 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPanning);} - class WidgetPDial - } - Fl_Dial pstr { - label {P.Str.} - callback {pars->GlobalPar.PPunchStrength=(int) o->value();} - tooltip {Punch Strength} xywh {125 227 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchStrength);} - class WidgetPDial - } - Fl_Dial pt { - label {P.t.} - callback {pars->GlobalPar.PPunchTime=(int) o->value();} - tooltip {Punch Time (duration)} xywh {155 227 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchTime);} - class WidgetPDial - } - Fl_Dial pstc { - label {P.Stc.} - callback {pars->GlobalPar.PPunchStretch=(int) o->value();} - tooltip {Punch Stretch} xywh {185 227 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchStretch);} - class WidgetPDial - } - Fl_Dial pvel { - label {P.Vel.} - callback {pars->GlobalPar.PPunchVelocitySensing=(int) o->value();} - tooltip {Punch Velocity Sensing} xywh {215 227 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchVelocitySensing);} - class WidgetPDial - } - Fl_Group ampenv { - label {ADSynth Global - Amplitude Envelope} open - xywh {10 75 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalPar.AmpEnvelope);} - class EnvelopeUI - } {} - Fl_Group amplfo { - label {Amplitude LFO } open - xywh {10 145 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->GlobalPar.AmpLfo);} - class LFOUI - } {} - Fl_Check_Button rndgrp { - label {Rnd Grp} - callback {pars->GlobalPar.Hrandgrouping=(int) o->value();} - tooltip {How the Harmonic Amplitude is applied to voices that use the same oscillator} xywh {70 225 40 25} down_box DOWN_BOX labelsize 10 align 148 - code0 {o->value(pars->GlobalPar.Hrandgrouping);} - } - } - Fl_Group {} { - label FILTER - xywh {245 5 285 250} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group filterenv { - label {ADSynth Global - Filter Envelope} open - xywh {250 110 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalPar.FilterEnvelope);} - class EnvelopeUI - } {} - Fl_Group filterlfo { - label {Filter LFO} open - xywh {250 180 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->GlobalPar.FilterLfo);} - class LFOUI - } {} - Fl_Group filterui { - label {ADsynth Global - Filter} open - xywh {250 35 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->GlobalPar.GlobalFilter,&pars->GlobalPar.PFilterVelocityScale,&pars->GlobalPar.PFilterVelocityScaleFunction);} - class FilterUI - } {} - } - Fl_Check_Button stereo { - label Stereo - callback {pars->GlobalPar.PStereo=(int) o->value();} - xywh {5 220 65 35} box ENGRAVED_BOX down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->GlobalPar.PStereo);} - } - Fl_Button {} { - label {Show Voice List} - callback {for (int i=0;irefreshlist(); -} -ADnoteVoiceList->show();} - xywh {180 375 125 25} - } - Fl_Button {} { - label {Show Voice Parameters} - callback {ADnoteVoice->show();} - xywh {5 375 170 25} labelfont 1 labelsize 12 - } - Fl_Button {} { - label Close - callback {ADnoteGlobalParameters->hide();} - xywh {470 375 60 25} box THIN_UP_BOX - } - Fl_Button {} { - label Resonance - callback {resui->resonancewindow->redraw(); -resui->resonancewindow->show();} - tooltip Resonance xywh {309 375 86 25} box THIN_UP_BOX - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {405 380 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {435 380 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - Fl_Window ADnoteVoice { - label {ADsynth Voice Parameters} - xywh {152 271 765 620} type Double visible - } { - Fl_Group advoice { - xywh {0 0 760 575} box BORDER_BOX - code0 {o->init(pars,nvoice,master);} - code1 {o->show();} - class ADvoiceUI - } {} - Fl_Button {} { - label {Close Window} - callback {ADnoteVoice->hide();} - xywh {300 585 195 25} box THIN_UP_BOX labelfont 1 - } - Fl_Counter currentvoicecounter { - label {Current Voice} - callback {nvoice=(int)o->value()-1; -advoice->hide(); -ADnoteVoice->remove(advoice); -delete advoice; -advoice=new ADvoiceUI(0,0,765,585); -ADnoteVoice->add(advoice); -advoice->init(pars,nvoice,master); -advoice->show(); -ADnoteVoice->redraw();} - xywh {5 585 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13 - code0 {o->bounds(1,NUM_VOICES);} - } - Fl_Button {} { - label C - callback {presetsui->copy(pars,nvoice);} - xywh {700 590 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this,nvoice);} - xywh {730 590 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - Fl_Window ADnoteVoiceList { - label {ADsynth Voices list} - xywh {32 266 650 260} type Double hide - } { - Fl_Text_Display {} { - label {No.} - xywh {10 15 30 10} box NO_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label Vol - xywh {145 15 30 10} box NO_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label Detune - xywh {384 15 25 10} box NO_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label Pan - xywh {210 15 30 10} box NO_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label {Vib. Depth} - xywh {560 15 30 10} box NO_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label {R.} - xywh {245 15 25 10} box NO_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label {Hide Voice List} - callback {ADnoteVoiceList->hide();} - xywh {255 237 125 20} - } - Fl_Scroll {} {open - xywh {0 15 640 220} type VERTICAL box THIN_UP_BOX - } { - Fl_Pack {} {open - xywh {0 20 620 210} - code0 {for (int i=0;iinit(pars,i,master);}} - } {} - } - } - } - Function {ADnoteUI(ADnoteParameters *parameters,Master *master_)} {} { - code {pars=parameters; -master=master_; -nvoice=0; -resui=new ResonanceUI(pars->GlobalPar.Reson); -make_window();} {} - } - Function {~ADnoteUI()} {} { - code {ADnoteVoiceList->hide(); -ADnoteGlobalParameters->hide(); -ADnoteVoice->hide(); -delete(ADnoteVoiceList); -delete(ADnoteGlobalParameters); -delete(ADnoteVoice); -delete(resui);} {} - } - Function {refresh()} {} { - code {volume->value(pars->GlobalPar.PVolume); -vsns->value(pars->GlobalPar.PAmpVelocityScaleFunction); -pan->value(pars->GlobalPar.PPanning); - -stereo->value(pars->GlobalPar.PStereo); -rndgrp->value(pars->GlobalPar.Hrandgrouping); - -pstr->value(pars->GlobalPar.PPunchStrength); -pt->value(pars->GlobalPar.PPunchTime); -pstc->value(pars->GlobalPar.PPunchStretch); -pvel->value(pars->GlobalPar.PPunchVelocitySensing); - -detunevalueoutput->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune)); -freq->value(pars->GlobalPar.PDetune-8192); - -int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16; -octave->value(k); - -detunetype->value(pars->GlobalPar.PDetuneType-1); -k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024; -coarsedet->value(k); -amplfo->refresh(); -freqlfo->refresh(); -filterlfo->refresh(); - -ampenv->refresh(); -freqenv->refresh(); -filterenv->refresh(); -filterui->refresh(); - -for (int i=0;irefreshlist(); - -resui->refresh(); -currentvoicecounter->do_callback();} {} - } - decl {ADnoteParameters *pars;} {} - decl {ResonanceUI *resui;} {} - decl {Master *master;} {} - decl {int nvoice;} {} - decl {ADvoicelistitem *voicelistitem[NUM_VOICES];} {} -} diff --git a/plugins/zynaddsubfx/src/UI/ADnoteUI.h b/plugins/zynaddsubfx/src/UI/ADnoteUI.h deleted file mode 100644 index a9a573d60..000000000 --- a/plugins/zynaddsubfx/src/UI/ADnoteUI.h +++ /dev/null @@ -1,387 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef ADnoteUI_h -#define ADnoteUI_h -#include -#include "../Params/ADnoteParameters.h" -#include "../Misc/Util.h" -#include "../Misc/Master.h" -#include "ResonanceUI.h" -#include -#include -#include "WidgetPDial.h" -#include "EnvelopeUI.h" -#include "LFOUI.h" -#include "FilterUI.h" -#include "OscilGenUI.h" -#include "PresetsUI.h" -#include -#include -#include -#include -#include -#include - -class ADvoicelistitem : public Fl_Group { - Fl_Group* make_window(); - Fl_Group *ADnoteVoiceListItem; - Fl_Group *voicelistitemgroup; -public: - Fl_Value_Slider *voicevolume; -private: - void cb_voicevolume_i(Fl_Value_Slider*, void*); - static void cb_voicevolume(Fl_Value_Slider*, void*); -public: - Fl_Check_Button *voiceresonanceenabled; -private: - void cb_voiceresonanceenabled_i(Fl_Check_Button*, void*); - static void cb_voiceresonanceenabled(Fl_Check_Button*, void*); -public: - Fl_Value_Slider *voicelfofreq; -private: - void cb_voicelfofreq_i(Fl_Value_Slider*, void*); - static void cb_voicelfofreq(Fl_Value_Slider*, void*); -public: - WidgetPDial *voicepanning; -private: - void cb_voicepanning_i(WidgetPDial*, void*); - static void cb_voicepanning(WidgetPDial*, void*); -public: - Fl_Group *voiceoscil; - Fl_Value_Output *detunevalueoutput; -private: - void cb_detunevalueoutput_i(Fl_Value_Output*, void*); - static void cb_detunevalueoutput(Fl_Value_Output*, void*); -public: - Fl_Slider *voicedetune; -private: - void cb_voicedetune_i(Fl_Slider*, void*); - static void cb_voicedetune(Fl_Slider*, void*); -public: - Fl_Box *noiselabel; -private: - void cb_noiselabel_i(Fl_Box*, void*); - static void cb_noiselabel(Fl_Box*, void*); - Fl_Check_Button *voiceenabled; - void cb_voiceenabled_i(Fl_Check_Button*, void*); - static void cb_voiceenabled(Fl_Check_Button*, void*); -public: - ADvoicelistitem(int x,int y, int w, int h, const char *label=0); - void init(ADnoteParameters *parameters,int nvoice_,Master *master_); - void refreshlist(); - ~ADvoicelistitem(); -private: - ADnoteParameters *pars; - int nvoice; - Oscilloscope *osc; - Master *master; -}; -#include -#include -#include - -class ADvoiceUI : public Fl_Group { -public: - Fl_Group* make_window(); - Fl_Group *ADnoteVoiceParameters; - Fl_Group *voiceparametersgroup; - Fl_Group *voicemodegroup; - Fl_Group *voiceFMparametersgroup; - Fl_Group *modfrequency; - EnvelopeUI *voiceFMfreqenvgroup; -private: - void cb_Enable_i(Fl_Check_Button*, void*); - static void cb_Enable(Fl_Check_Button*, void*); - void cb_Coarse_i(Fl_Counter*, void*); - static void cb_Coarse(Fl_Counter*, void*); - void cb_Octave_i(Fl_Counter*, void*); - static void cb_Octave(Fl_Counter*, void*); - void cb__i(Fl_Slider*, void*); - static void cb_(Fl_Slider*, void*); -public: - Fl_Value_Output *fmdetunevalueoutput; -private: - void cb_fmdetunevalueoutput_i(Fl_Value_Output*, void*); - static void cb_fmdetunevalueoutput(Fl_Value_Output*, void*); - void cb_Detune_i(Fl_Choice*, void*); - static void cb_Detune(Fl_Choice*, void*); - void cb_Vol_i(Fl_Value_Slider*, void*); - static void cb_Vol(Fl_Value_Slider*, void*); - void cb_V_i(Fl_Value_Slider*, void*); - static void cb_V(Fl_Value_Slider*, void*); -public: - EnvelopeUI *voiceFMampenvgroup; -private: - void cb_Enable1_i(Fl_Check_Button*, void*); - static void cb_Enable1(Fl_Check_Button*, void*); - void cb_F_i(Fl_Value_Slider*, void*); - static void cb_F(Fl_Value_Slider*, void*); -public: - Fl_Group *modoscil; - Fl_Group *fmoscil; - Fl_Button *changeFMoscilbutton; -private: - void cb_changeFMoscilbutton_i(Fl_Button*, void*); - static void cb_changeFMoscilbutton(Fl_Button*, void*); - void cb_Phase_i(Fl_Slider*, void*); - static void cb_Phase(Fl_Slider*, void*); - void cb_Use_i(Fl_Choice*, void*); - static void cb_Use(Fl_Choice*, void*); - void cb_External_i(Fl_Choice*, void*); - static void cb_External(Fl_Choice*, void*); - void cb_Type_i(Fl_Choice*, void*); - static void cb_Type(Fl_Choice*, void*); - static Fl_Menu_Item menu_Type[]; -public: - EnvelopeUI *voicefreqenvgroup; -private: - void cb_Enable2_i(Fl_Check_Button*, void*); - static void cb_Enable2(Fl_Check_Button*, void*); -public: - LFOUI *voicefreqlfogroup; -private: - void cb_Enable3_i(Fl_Check_Button*, void*); - static void cb_Enable3(Fl_Check_Button*, void*); - void cb_Octave1_i(Fl_Counter*, void*); - static void cb_Octave1(Fl_Counter*, void*); - void cb_Coarse1_i(Fl_Counter*, void*); - static void cb_Coarse1(Fl_Counter*, void*); - void cb_1_i(Fl_Slider*, void*); - static void cb_1(Fl_Slider*, void*); -public: - Fl_Value_Output *detunevalueoutput; -private: - void cb_detunevalueoutput1_i(Fl_Value_Output*, void*); - static void cb_detunevalueoutput1(Fl_Value_Output*, void*); - void cb_440Hz_i(Fl_Check_Button*, void*); - static void cb_440Hz(Fl_Check_Button*, void*); -public: - WidgetPDial *fixedfreqetdial; -private: - void cb_fixedfreqetdial_i(WidgetPDial*, void*); - static void cb_fixedfreqetdial(WidgetPDial*, void*); - void cb_Detune1_i(Fl_Choice*, void*); - static void cb_Detune1(Fl_Choice*, void*); -public: - Fl_Group *voiceoscil; - Fl_Button *changevoiceoscilbutton; -private: - void cb_changevoiceoscilbutton_i(Fl_Button*, void*); - static void cb_changevoiceoscilbutton(Fl_Button*, void*); - void cb_Phase1_i(Fl_Slider*, void*); - static void cb_Phase1(Fl_Slider*, void*); - void cb_R_i(Fl_Check_Button*, void*); - static void cb_R(Fl_Check_Button*, void*); - void cb_Use1_i(Fl_Choice*, void*); - static void cb_Use1(Fl_Choice*, void*); - void cb_Stereo_i(WidgetPDial*, void*); - static void cb_Stereo(WidgetPDial*, void*); - void cb_Unison_i(Fl_Choice*, void*); - static void cb_Unison(Fl_Choice*, void*); - void cb_Vibratto_i(WidgetPDial*, void*); - static void cb_Vibratto(WidgetPDial*, void*); - void cb_Invert_i(Fl_Choice*, void*); - static void cb_Invert(Fl_Choice*, void*); - void cb_Frequency_i(Fl_Slider*, void*); - static void cb_Frequency(Fl_Slider*, void*); -public: - Fl_Value_Output *unisonspreadoutput; -private: - void cb_unisonspreadoutput_i(Fl_Value_Output*, void*); - static void cb_unisonspreadoutput(Fl_Value_Output*, void*); - void cb_Vib_i(WidgetPDial*, void*); - static void cb_Vib(WidgetPDial*, void*); - void cb_Vol1_i(Fl_Value_Slider*, void*); - static void cb_Vol1(Fl_Value_Slider*, void*); - void cb_V1_i(Fl_Value_Slider*, void*); - static void cb_V1(Fl_Value_Slider*, void*); -public: - EnvelopeUI *voiceampenvgroup; -private: - void cb_Pan_i(WidgetPDial*, void*); - static void cb_Pan(WidgetPDial*, void*); - void cb_Enable4_i(Fl_Check_Button*, void*); - static void cb_Enable4(Fl_Check_Button*, void*); -public: - LFOUI *voiceamplfogroup; -private: - void cb_Enable5_i(Fl_Check_Button*, void*); - static void cb_Enable5(Fl_Check_Button*, void*); - void cb_Minus_i(Fl_Check_Button*, void*); - static void cb_Minus(Fl_Check_Button*, void*); -public: - Fl_Group *voicefiltergroup; - EnvelopeUI *voicefilterenvgroup; -private: - void cb_Enable6_i(Fl_Check_Button*, void*); - static void cb_Enable6(Fl_Check_Button*, void*); -public: - LFOUI *voicefilterlfogroup; -private: - void cb_Enable7_i(Fl_Check_Button*, void*); - static void cb_Enable7(Fl_Check_Button*, void*); - void cb_2_i(Fl_Choice*, void*); - static void cb_2(Fl_Choice*, void*); - static Fl_Menu_Item menu_[]; -public: - Fl_Check_Button *bypassfiltercheckbutton; -private: - void cb_bypassfiltercheckbutton_i(Fl_Check_Button*, void*); - static void cb_bypassfiltercheckbutton(Fl_Check_Button*, void*); - void cb_Delay_i(Fl_Value_Slider*, void*); - static void cb_Delay(Fl_Value_Slider*, void*); - void cb_Enable8_i(Fl_Check_Button*, void*); - static void cb_Enable8(Fl_Check_Button*, void*); -public: - Fl_Box *noiselabel; -private: - void cb_noiselabel1_i(Fl_Box*, void*); - static void cb_noiselabel1(Fl_Box*, void*); -public: - Fl_Check_Button *voiceonbutton; -private: - void cb_voiceonbutton_i(Fl_Check_Button*, void*); - static void cb_voiceonbutton(Fl_Check_Button*, void*); -public: - ADvoiceUI(int x,int y, int w, int h, const char *label=0); - void init(ADnoteParameters *parameters,int nvoice_,Master *master_); - ~ADvoiceUI(); -private: - int nvoice; - ADnoteParameters *pars; - OscilEditor *oscedit; - Oscilloscope *osc; - Oscilloscope *oscFM; - Master *master; -}; -#include -#include -#include -#include - -class ADnoteUI : public PresetsUI_ { - Fl_Double_Window* make_window(); -public: - Fl_Double_Window *ADnoteGlobalParameters; - EnvelopeUI *freqenv; - Fl_Counter *octave; -private: - void cb_octave_i(Fl_Counter*, void*); - static void cb_octave(Fl_Counter*, void*); -public: - Fl_Counter *coarsedet; -private: - void cb_coarsedet_i(Fl_Counter*, void*); - static void cb_coarsedet(Fl_Counter*, void*); -public: - LFOUI *freqlfo; - Fl_Slider *freq; -private: - void cb_freq_i(Fl_Slider*, void*); - static void cb_freq(Fl_Slider*, void*); -public: - Fl_Value_Output *detunevalueoutput; -private: - void cb_detunevalueoutput2_i(Fl_Value_Output*, void*); - static void cb_detunevalueoutput2(Fl_Value_Output*, void*); -public: - Fl_Choice *detunetype; -private: - void cb_detunetype_i(Fl_Choice*, void*); - static void cb_detunetype(Fl_Choice*, void*); - void cb_relBW_i(WidgetPDial*, void*); - static void cb_relBW(WidgetPDial*, void*); -public: - Fl_Value_Slider *volume; -private: - void cb_volume_i(Fl_Value_Slider*, void*); - static void cb_volume(Fl_Value_Slider*, void*); -public: - Fl_Value_Slider *vsns; -private: - void cb_vsns_i(Fl_Value_Slider*, void*); - static void cb_vsns(Fl_Value_Slider*, void*); -public: - WidgetPDial *pan; -private: - void cb_pan_i(WidgetPDial*, void*); - static void cb_pan(WidgetPDial*, void*); -public: - WidgetPDial *pstr; -private: - void cb_pstr_i(WidgetPDial*, void*); - static void cb_pstr(WidgetPDial*, void*); -public: - WidgetPDial *pt; -private: - void cb_pt_i(WidgetPDial*, void*); - static void cb_pt(WidgetPDial*, void*); -public: - WidgetPDial *pstc; -private: - void cb_pstc_i(WidgetPDial*, void*); - static void cb_pstc(WidgetPDial*, void*); -public: - WidgetPDial *pvel; -private: - void cb_pvel_i(WidgetPDial*, void*); - static void cb_pvel(WidgetPDial*, void*); -public: - EnvelopeUI *ampenv; - LFOUI *amplfo; - Fl_Check_Button *rndgrp; -private: - void cb_rndgrp_i(Fl_Check_Button*, void*); - static void cb_rndgrp(Fl_Check_Button*, void*); -public: - EnvelopeUI *filterenv; - LFOUI *filterlfo; - FilterUI *filterui; - Fl_Check_Button *stereo; -private: - void cb_stereo_i(Fl_Check_Button*, void*); - static void cb_stereo(Fl_Check_Button*, void*); - void cb_Show_i(Fl_Button*, void*); - static void cb_Show(Fl_Button*, void*); - void cb_Show1_i(Fl_Button*, void*); - static void cb_Show1(Fl_Button*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_Resonance_i(Fl_Button*, void*); - static void cb_Resonance(Fl_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Double_Window *ADnoteVoice; - ADvoiceUI *advoice; -private: - void cb_Close1_i(Fl_Button*, void*); - static void cb_Close1(Fl_Button*, void*); -public: - Fl_Counter *currentvoicecounter; -private: - void cb_currentvoicecounter_i(Fl_Counter*, void*); - static void cb_currentvoicecounter(Fl_Counter*, void*); - void cb_C1_i(Fl_Button*, void*); - static void cb_C1(Fl_Button*, void*); - void cb_P1_i(Fl_Button*, void*); - static void cb_P1(Fl_Button*, void*); -public: - Fl_Double_Window *ADnoteVoiceList; -private: - void cb_Hide_i(Fl_Button*, void*); - static void cb_Hide(Fl_Button*, void*); -public: - ADnoteUI(ADnoteParameters *parameters,Master *master_); - ~ADnoteUI(); - void refresh(); -private: - ADnoteParameters *pars; - ResonanceUI *resui; - Master *master; - int nvoice; - ADvoicelistitem *voicelistitem[NUM_VOICES]; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/BankUI.cc b/plugins/zynaddsubfx/src/UI/BankUI.cc deleted file mode 100644 index de79932bc..000000000 --- a/plugins/zynaddsubfx/src/UI/BankUI.cc +++ /dev/null @@ -1,421 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "BankUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void BankProcess_::process() { - ; -} - -BankSlot::BankSlot(int x,int y, int w, int h, const char *label):Fl_Button(x,y,w,h,label) { - what=NULL; - whatslot=NULL; - nslot=0; - nselected=NULL; -} - -int BankSlot::handle(int event) { - if (what==NULL) return(0); - if (Fl::event_inside(this)){ - *what=0;*whatslot=nslot; - if ((event==FL_RELEASE)&&(Fl::event_button()==1))*what=1; - if ((event==FL_RELEASE)&&(Fl::event_button()==3))*what=2; - if (event==FL_PUSH) highlight=1; - }else highlight=0; - - int tmp=Fl_Button::handle(event); - if ((*what!=0) && Fl::event_inside(this)) (bp->*fnc)(); - return(tmp); -} - -void BankSlot::init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_) { - nslot=nslot_; - what=what_; - whatslot=whatslot_; - fnc=fnc_; - bp=bp_; - bank=bank_; - nselected=nselected_; - box(FL_THIN_UP_BOX); - labelfont(0); - labelsize(13); - align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); - - highlight=0; - refresh(); -} - -void BankSlot::refresh() { - if (bank->emptyslot(nslot)) { - color(46); - } else { - if (bank->isPADsynth_used(nslot)) color(26); - else color(51); - }; - - if (*nselected==nslot) color(6); - - - label(bank->getnamenumbered(nslot)); -} - -void BankUI::cb_Close_i(Fl_Button*, void*) { - bankuiwindow->hide(); -} -void BankUI::cb_Close(Fl_Button* o, void* v) { - ((BankUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void BankUI::cb_writebutton_i(Fl_Light_Button* o, void*) { - if (o->value()>0.5) mode=2; -removeselection(); -} -void BankUI::cb_writebutton(Fl_Light_Button* o, void* v) { - ((BankUI*)(o->parent()->parent()->user_data()))->cb_writebutton_i(o,v); -} - -void BankUI::cb_readbutton_i(Fl_Light_Button* o, void*) { - if (o->value()>0.5) mode=1; -removeselection(); -} -void BankUI::cb_readbutton(Fl_Light_Button* o, void* v) { - ((BankUI*)(o->parent()->parent()->user_data()))->cb_readbutton_i(o,v); -} - -void BankUI::cb_clearbutton_i(Fl_Light_Button* o, void*) { - if (o->value()>0.5) mode=3; -removeselection(); -} -void BankUI::cb_clearbutton(Fl_Light_Button* o, void* v) { - ((BankUI*)(o->parent()->parent()->user_data()))->cb_clearbutton_i(o,v); -} - -void BankUI::cb_swapbutton_i(Fl_Light_Button* o, void*) { - if (o->value()>0.5) mode=4; -removeselection(); -} -void BankUI::cb_swapbutton(Fl_Light_Button* o, void* v) { - ((BankUI*)(o->parent()->parent()->user_data()))->cb_swapbutton_i(o,v); -} - -void BankUI::cb_New_i(Fl_Button*, void*) { - const char *dirname; - -dirname=fl_input("New empty Bank:"); -if (dirname==NULL) return; - - -int result=bank->newbank(dirname); - -if (result!=0) fl_alert("Error: Could not make a new bank (directory).."); - -refreshmainwindow(); -} -void BankUI::cb_New(Fl_Button* o, void* v) { - ((BankUI*)(o->parent()->user_data()))->cb_New_i(o,v); -} - -void BankUI::cb_auto_i(Fl_Check_Button* o, void*) { - config.cfg.BankUIAutoClose=(int) o->value(); -} -void BankUI::cb_auto(Fl_Check_Button* o, void* v) { - ((BankUI*)(o->parent()->user_data()))->cb_auto_i(o,v); -} - -void BankUI::cb_banklist_i(Fl_Choice* o, void*) { - int n=o->value(); -char *dirname=bank->banks[n].dir; -if (dirname==NULL) return; - -if (bank->loadbank(dirname)==2) - fl_alert("Error: Could not load the bank from the directory\n%s.",dirname); -for (int i=0;irefresh(); -refreshmainwindow(); -} -void BankUI::cb_banklist(Fl_Choice* o, void* v) { - ((BankUI*)(o->parent()->user_data()))->cb_banklist_i(o,v); -} - -void BankUI::cb_Refresh_i(Fl_Button*, void*) { - rescan_for_banks(); -banklist->value(0); -} -void BankUI::cb_Refresh(Fl_Button* o, void* v) { - ((BankUI*)(o->parent()->user_data()))->cb_Refresh_i(o,v); -} - -void BankUI::cb_Show_i(Fl_Check_Button* o, void*) { - config.cfg.CheckPADsynth=(int) o->value(); -refreshmainwindow(); -} -void BankUI::cb_Show(Fl_Check_Button* o, void* v) { - ((BankUI*)(o->parent()->user_data()))->cb_Show_i(o,v); -} - -Fl_Double_Window* BankUI::make_window() { - { Fl_Double_Window* o = bankuiwindow = new Fl_Double_Window(785, 575, "Bank"); - bankuiwindow->user_data((void*)(this)); - { Fl_Button* o = new Fl_Button(705, 546, 70, 24, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Group* o = new Fl_Group(5, 34, 772, 491); - o->box(FL_ENGRAVED_FRAME); - { Fl_Pack* o = new Fl_Pack(10, 39, 150, 481); - o->box(FL_BORDER_BOX); - o->box(FL_NO_BOX); - for (int i=0;i<32;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; - o->end(); - } // Fl_Pack* o - { Fl_Pack* o = new Fl_Pack(163, 39, 150, 481); - o->box(FL_BORDER_BOX); - o->box(FL_NO_BOX); - for (int i=32;i<64;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; - o->end(); - } // Fl_Pack* o - { Fl_Pack* o = new Fl_Pack(316, 39, 150, 481); - o->box(FL_BORDER_BOX); - o->box(FL_NO_BOX); - for (int i=64;i<96;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; - o->end(); - } // Fl_Pack* o - { Fl_Pack* o = new Fl_Pack(469, 39, 150, 481); - o->box(FL_BORDER_BOX); - o->box(FL_NO_BOX); - for (int i=96;i<128;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; - o->end(); - } // Fl_Pack* o - { Fl_Pack* o = new Fl_Pack(622, 39, 150, 481); - o->box(FL_BORDER_BOX); - o->box(FL_NO_BOX); - for (int i=128;i<160;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; - o->end(); - } // Fl_Pack* o - o->end(); - } // Fl_Group* o - { modeselect = new Fl_Group(5, 528, 425, 42); - modeselect->box(FL_ENGRAVED_BOX); - { Fl_Light_Button* o = writebutton = new Fl_Light_Button(116, 534, 99, 30, "WRITE"); - writebutton->type(102); - writebutton->box(FL_PLASTIC_UP_BOX); - writebutton->down_box(FL_THIN_DOWN_BOX); - writebutton->selection_color((Fl_Color)1); - writebutton->labeltype(FL_ENGRAVED_LABEL); - writebutton->labelfont(1); - writebutton->labelsize(13); - writebutton->callback((Fl_Callback*)cb_writebutton); - if (bank->locked()) o->deactivate(); - } // Fl_Light_Button* writebutton - { Fl_Light_Button* o = readbutton = new Fl_Light_Button(11, 534, 99, 30, "READ"); - readbutton->type(102); - readbutton->box(FL_PLASTIC_UP_BOX); - readbutton->down_box(FL_THIN_DOWN_BOX); - readbutton->selection_color((Fl_Color)101); - readbutton->labeltype(FL_ENGRAVED_LABEL); - readbutton->labelfont(1); - readbutton->labelsize(13); - readbutton->callback((Fl_Callback*)cb_readbutton); - o->value(1); - } // Fl_Light_Button* readbutton - { Fl_Light_Button* o = clearbutton = new Fl_Light_Button(221, 534, 99, 30, "CLEAR"); - clearbutton->type(102); - clearbutton->box(FL_PLASTIC_UP_BOX); - clearbutton->down_box(FL_THIN_DOWN_BOX); - clearbutton->selection_color(FL_FOREGROUND_COLOR); - clearbutton->labeltype(FL_ENGRAVED_LABEL); - clearbutton->labelfont(1); - clearbutton->labelsize(13); - clearbutton->callback((Fl_Callback*)cb_clearbutton); - if (bank->locked()) o->deactivate(); - } // Fl_Light_Button* clearbutton - { Fl_Light_Button* o = swapbutton = new Fl_Light_Button(325, 534, 99, 30, "SWAP"); - swapbutton->type(102); - swapbutton->box(FL_PLASTIC_UP_BOX); - swapbutton->down_box(FL_THIN_DOWN_BOX); - swapbutton->selection_color((Fl_Color)227); - swapbutton->labeltype(FL_ENGRAVED_LABEL); - swapbutton->labelfont(1); - swapbutton->labelsize(13); - swapbutton->callback((Fl_Callback*)cb_swapbutton); - if (bank->locked()) o->deactivate(); - } // Fl_Light_Button* swapbutton - modeselect->end(); - } // Fl_Group* modeselect - { Fl_Button* o = new Fl_Button(685, 5, 93, 25, "New Bank..."); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_New); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(705, 529, 60, 15, "auto close"); - o->tooltip("automatically close the bank window if the instrument is loaded"); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_auto); - o->value(config.cfg.BankUIAutoClose); - } // Fl_Check_Button* o - { banklist = new Fl_Choice(5, 8, 220, 20); - banklist->down_box(FL_BORDER_BOX); - banklist->labelfont(1); - banklist->textfont(1); - banklist->textsize(11); - banklist->callback((Fl_Callback*)cb_banklist); - banklist->align(Fl_Align(FL_ALIGN_CENTER)); - } // Fl_Choice* banklist - { Fl_Button* o = new Fl_Button(230, 8, 105, 20, "Refresh bank list"); - o->tooltip("Refresh the bank list (rescan)"); - o->box(FL_THIN_UP_BOX); - o->color(FL_LIGHT1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Refresh); - } // Fl_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(435, 530, 150, 15, "Show PADsynth status"); - o->down_box(FL_DOWN_BOX); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Show); - o->value(config.cfg.CheckPADsynth); - } // Fl_Check_Button* o - o->label(bank->bankfiletitle); - if (bank->bankfiletitle==NULL) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank."); - bankuiwindow->end(); - } // Fl_Double_Window* bankuiwindow - return bankuiwindow; -} - -BankUI::BankUI(Master *master_,int *npart_) { - fnc=&BankProcess_::process; - master=master_; - npart=npart_; - bank=&master_->bank; - what=0; - nselected=-1; - make_window(); - mode=1; -} - -BankUI::~BankUI() { - bankuiwindow->hide(); - delete(bankuiwindow); -} - -void BankUI::show() { - bankuiwindow->show(); - simplesetmode(config.cfg.UserInterfaceMode==2); -} - -void BankUI::hide() { - bankuiwindow->hide(); -} - -void BankUI::init(Fl_Valuator *cbwig_) { - cbwig=cbwig_; - rescan_for_banks(); -} - -void BankUI::process() { - int slot=this->slot; - - if ((what==2)&&(bank->emptyslot(slot)==0)&&(mode!=4)) {//Rename slot - const char *tmp=fl_input("Slot (instrument) name:",(const char *)bank->getname(slot)); - if (tmp!=NULL) bank->setname(slot,tmp,-1); - bs[slot]->refresh(); - }; - - if ((what==1)&&(mode==1)&&(!bank->emptyslot(slot))){//Reads from slot - pthread_mutex_lock(&master->mutex); - bank->loadfromslot(slot,master->part[*npart]); - pthread_mutex_unlock(&master->mutex); - master->part[*npart]->applyparameters(); - snprintf((char *)master->part[*npart]->Pname,PART_MAX_NAME_LEN,"%s",bank->getname(slot)); - cbwig->do_callback(); - - if (config.cfg.BankUIAutoClose!=0) - bankuiwindow->hide(); - - }; - - if ((what==1)&&(mode==2)){//save(write) to slot - if (!bank->emptyslot(slot)){ - if (!fl_choice("Overwrite the slot no. %d ?","No","Yes",NULL,slot+1)) goto nooverwriteslot; - }; - pthread_mutex_lock(&master->mutex); - bank->savetoslot(slot,master->part[*npart]); - pthread_mutex_unlock(&master->mutex); - - bs[slot]->refresh(); - mode=1;readbutton->value(1);writebutton->value(0); - nooverwriteslot:; - }; - - - - if ((what==1)&&(mode==3)&&(!bank->emptyslot(slot))){//Clears the slot - if (fl_choice("Clear the slot no. %d ?","No","Yes",NULL,slot+1)){ - bank->clearslot(slot); - bs[slot]->refresh(); - }; - }; - - if (mode==4){//swap - bool done=false; - if ((what==1)&&(nselected>=0)){ - bank->swapslot(nselected,slot); - int ns=nselected; - nselected=-1; - bs[slot]->refresh(); - bs[ns]->refresh(); - done=true; - }; - if (((nselected<0)||(what==2))&&(!done)){ - int ns=nselected; - nselected=slot; - if (ns>0) bs[ns]->refresh(); - bs[slot]->refresh(); - }; - }; - if (mode!=4) refreshmainwindow(); -} - -void BankUI::refreshmainwindow() { - bankuiwindow->label(bank->bankfiletitle); - mode=1;readbutton->value(1);writebutton->value(0);clearbutton->value(0);swapbutton->value(0); - nselected=-1; - if (bank->locked()){ - writebutton->deactivate(); - clearbutton->deactivate(); - swapbutton->deactivate(); - } else { - writebutton->activate(); - clearbutton->activate(); - swapbutton->activate(); - }; - for (int i=0;irefresh(); -} - -void BankUI::removeselection() { - if (nselected>=0) { - int ns=nselected; - nselected=-1; - bs[ns]->refresh(); - }; -} - -void BankUI::rescan_for_banks() { - banklist->clear(); - banklist->add(" "); - bank->rescanforbanks(); - - for (int i=1;ibanks[i].name!=NULL) banklist->add(bank->banks[i].name); - }; -} - -void BankUI::simplesetmode(bool beginnerui) { - readbutton->value(1); - mode=1; - removeselection(); - if (beginnerui) modeselect->hide(); - else modeselect->show(); -} diff --git a/plugins/zynaddsubfx/src/UI/BankUI.fl b/plugins/zynaddsubfx/src/UI/BankUI.fl deleted file mode 100644 index 624450212..000000000 --- a/plugins/zynaddsubfx/src/UI/BankUI.fl +++ /dev/null @@ -1,355 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Bank.h"} {public -} - -decl {\#include "../Misc/Config.h"} {public -} - -class BankProcess_ {} { - Function {process()} {open return_type {virtual void} - } {code{;}} - decl {Bank *bank;} {public - } -} - -class BankSlot {open : {public Fl_Button,BankProcess_} -} { - Function {BankSlot(int x,int y, int w, int h, const char *label=0):Fl_Button(x,y,w,h,label)} {} { - code {what=NULL; -whatslot=NULL; -nslot=0; -nselected=NULL;} {} - } - Function {handle(int event)} {return_type int - } { - code {if (what==NULL) return(0); -if (Fl::event_inside(this)){ - *what=0;*whatslot=nslot; - if ((event==FL_RELEASE)&&(Fl::event_button()==1))*what=1; - if ((event==FL_RELEASE)&&(Fl::event_button()==3))*what=2; - if (event==FL_PUSH) highlight=1; -}else highlight=0; - -int tmp=Fl_Button::handle(event); -if ((*what!=0) && Fl::event_inside(this)) (bp->*fnc)(); -return(tmp);} {} - } - Function {init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_)} {open - } { - code {nslot=nslot_; -what=what_; -whatslot=whatslot_; -fnc=fnc_; -bp=bp_; -bank=bank_; -nselected=nselected_; -box(FL_THIN_UP_BOX); -labelfont(0); -labelsize(13); -align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); - -highlight=0; -refresh();} {selected - } - } - Function {refresh()} {} { - code {if (bank->emptyslot(nslot)) { - color(46); -} else { - if (bank->isPADsynth_used(nslot)) color(26); - else color(51); -}; - -if (*nselected==nslot) color(6); - - -label(bank->getnamenumbered(nslot));} {} - } - decl {int *what,*whatslot,nslot,highlight, *nselected;} {} - decl {void (BankProcess_:: *fnc)(void);} {} - decl {BankProcess_ *bp;} {} -} - -class BankUI {: {public BankProcess_} -} { - Function {make_window()} {} { - Fl_Window bankuiwindow { - label Bank - xywh {4 64 785 575} type Double hide - code0 {o->label(bank->bankfiletitle);} - code1 {if (bank->bankfiletitle==NULL) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank.");} - } { - Fl_Button {} { - label Close - callback {bankuiwindow->hide();} - xywh {705 546 70 24} box THIN_UP_BOX - } - Fl_Group {} { - xywh {5 34 772 491} box ENGRAVED_FRAME - } { - Fl_Pack {} { - xywh {10 39 150 481} box BORDER_BOX - code0 {o->box(FL_NO_BOX);} - code1 {for (int i=0;i<32;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {163 39 150 481} box BORDER_BOX - code0 {o->box(FL_NO_BOX);} - code1 {for (int i=32;i<64;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {316 39 150 481} box BORDER_BOX - code0 {o->box(FL_NO_BOX);} - code1 {for (int i=64;i<96;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {469 39 150 481} box BORDER_BOX - code0 {o->box(FL_NO_BOX);} - code1 {for (int i=96;i<128;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {622 39 150 481} box BORDER_BOX - code0 {o->box(FL_NO_BOX);} - code1 {for (int i=128;i<160;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - } - Fl_Group modeselect { - xywh {5 528 425 42} box ENGRAVED_BOX - } { - Fl_Light_Button writebutton { - label WRITE - callback {if (o->value()>0.5) mode=2; -removeselection();} - xywh {116 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 1 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 - code0 {if (bank->locked()) o->deactivate();} - } - Fl_Light_Button readbutton { - label READ - callback {if (o->value()>0.5) mode=1; -removeselection();} - xywh {11 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 101 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 - code0 {o->value(1);} - } - Fl_Light_Button clearbutton { - label CLEAR - callback {if (o->value()>0.5) mode=3; -removeselection();} - xywh {221 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 0 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 - code0 {if (bank->locked()) o->deactivate();} - } - Fl_Light_Button swapbutton { - label SWAP - callback {if (o->value()>0.5) mode=4; -removeselection();} - xywh {325 534 99 30} type Radio box PLASTIC_UP_BOX down_box THIN_DOWN_BOX selection_color 227 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 - code0 {if (bank->locked()) o->deactivate();} - } - } - Fl_Button {} { - label {New Bank...} - callback {const char *dirname; - -dirname=fl_input("New empty Bank:"); -if (dirname==NULL) return; - - -int result=bank->newbank(dirname); - -if (result!=0) fl_alert("Error: Could not make a new bank (directory).."); - -refreshmainwindow();} - xywh {685 5 93 25} box PLASTIC_UP_BOX labelfont 1 labelsize 11 align 128 - } - Fl_Check_Button {} { - label {auto close} - callback {config.cfg.BankUIAutoClose=(int) o->value();} - tooltip {automatically close the bank window if the instrument is loaded} xywh {705 529 60 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(config.cfg.BankUIAutoClose);} - } - Fl_Choice banklist { - callback {int n=o->value(); -char *dirname=bank->banks[n].dir; -if (dirname==NULL) return; - -if (bank->loadbank(dirname)==2) - fl_alert("Error: Could not load the bank from the directory\\n%s.",dirname); -for (int i=0;irefresh(); -refreshmainwindow();} open - xywh {5 8 220 20} down_box BORDER_BOX labelfont 1 align 0 textfont 1 textsize 11 - } {} - Fl_Button {} { - label {Refresh bank list} - callback {rescan_for_banks(); -banklist->value(0);} - tooltip {Refresh the bank list (rescan)} xywh {230 8 105 20} box THIN_UP_BOX color 50 labelsize 11 - } - Fl_Check_Button {} { - label {Show PADsynth status} - callback {config.cfg.CheckPADsynth=(int) o->value(); -refreshmainwindow();} - xywh {435 530 150 15} down_box DOWN_BOX labelsize 11 - code0 {o->value(config.cfg.CheckPADsynth);} - } - } - } - Function {BankUI(Master *master_,int *npart_)} {} { - code {fnc=&BankProcess_::process; -master=master_; -npart=npart_; -bank=&master_->bank; -what=0; -nselected=-1; -make_window(); -mode=1;} {} - } - Function {~BankUI()} {return_type virtual - } { - code {bankuiwindow->hide(); -delete(bankuiwindow);} {} - } - Function {show()} {} { - code {bankuiwindow->show(); -simplesetmode(config.cfg.UserInterfaceMode==2);} {} - } - Function {hide()} {} { - code {bankuiwindow->hide();} {} - } - Function {init(Fl_Valuator *cbwig_)} {} { - code {cbwig=cbwig_; -rescan_for_banks();} {} - } - Function {process()} {return_type void - } { - code {int slot=this->slot; - -if ((what==2)&&(bank->emptyslot(slot)==0)&&(mode!=4)) {//Rename slot - const char *tmp=fl_input("Slot (instrument) name:",(const char *)bank->getname(slot)); - if (tmp!=NULL) bank->setname(slot,tmp,-1); - bs[slot]->refresh(); -}; - -if ((what==1)&&(mode==1)&&(!bank->emptyslot(slot))){//Reads from slot - pthread_mutex_lock(&master->mutex); - bank->loadfromslot(slot,master->part[*npart]); - pthread_mutex_unlock(&master->mutex); - master->part[*npart]->applyparameters(); - snprintf((char *)master->part[*npart]->Pname,PART_MAX_NAME_LEN,"%s",bank->getname(slot)); - cbwig->do_callback(); - - if (config.cfg.BankUIAutoClose!=0) - bankuiwindow->hide(); - -}; - -if ((what==1)&&(mode==2)){//save(write) to slot - if (!bank->emptyslot(slot)){ - if (!fl_choice("Overwrite the slot no. %d ?","No","Yes",NULL,slot+1)) goto nooverwriteslot; - }; - pthread_mutex_lock(&master->mutex); - bank->savetoslot(slot,master->part[*npart]); - pthread_mutex_unlock(&master->mutex); - - bs[slot]->refresh(); - mode=1;readbutton->value(1);writebutton->value(0); - nooverwriteslot:; -}; - - - -if ((what==1)&&(mode==3)&&(!bank->emptyslot(slot))){//Clears the slot - if (fl_choice("Clear the slot no. %d ?","No","Yes",NULL,slot+1)){ - bank->clearslot(slot); - bs[slot]->refresh(); - }; -}; - -if (mode==4){//swap - bool done=false; - if ((what==1)&&(nselected>=0)){ - bank->swapslot(nselected,slot); - int ns=nselected; - nselected=-1; - bs[slot]->refresh(); - bs[ns]->refresh(); - done=true; - }; - if (((nselected<0)||(what==2))&&(!done)){ - int ns=nselected; - nselected=slot; - if (ns>0) bs[ns]->refresh(); - bs[slot]->refresh(); - }; -}; -if (mode!=4) refreshmainwindow();} {} - } - Function {refreshmainwindow()} {} { - code {bankuiwindow->label(bank->bankfiletitle); -mode=1;readbutton->value(1);writebutton->value(0);clearbutton->value(0);swapbutton->value(0); -nselected=-1; -if (bank->locked()){ - writebutton->deactivate(); - clearbutton->deactivate(); - swapbutton->deactivate(); -} else { - writebutton->activate(); - clearbutton->activate(); - swapbutton->activate(); -}; -for (int i=0;irefresh();} {} - } - Function {removeselection()} {} { - code {if (nselected>=0) { - int ns=nselected; - nselected=-1; - bs[ns]->refresh(); -};} {} - } - Function {rescan_for_banks()} {} { - code {banklist->clear(); -banklist->add(" "); -bank->rescanforbanks(); - -for (int i=1;ibanks[i].name!=NULL) banklist->add(bank->banks[i].name); -};} {} - } - Function {simplesetmode(bool beginnerui)} {} { - code {readbutton->value(1); -mode=1; -removeselection(); -if (beginnerui) modeselect->hide(); - else modeselect->show();} {} - } - decl {BankSlot *bs[BANK_SIZE];} {} - decl {int slot,what;//"what"=what button is pressed} {} - decl {int mode,*npart,nselected;} {} - decl {Master *master;} {} - decl {void (BankProcess_::* fnc)(void);} {} - decl {Fl_Valuator *cbwig;} {public - } -} diff --git a/plugins/zynaddsubfx/src/UI/BankUI.h b/plugins/zynaddsubfx/src/UI/BankUI.h deleted file mode 100644 index d498c79bb..000000000 --- a/plugins/zynaddsubfx/src/UI/BankUI.h +++ /dev/null @@ -1,101 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef BankUI_h -#define BankUI_h -#include -#include -#include -#include -#include -#include -#include "../Misc/Master.h" -#include "../Misc/Bank.h" -#include "../Misc/Config.h" - -class BankProcess_ { -public: - virtual void process(); - Bank *bank; -}; - -class BankSlot : public Fl_Button,BankProcess_ { -public: - BankSlot(int x,int y, int w, int h, const char *label=0); - int handle(int event); - void init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_); - void refresh(); -private: - int *what,*whatslot,nslot,highlight, *nselected; - void (BankProcess_:: *fnc)(void); - BankProcess_ *bp; -}; -#include -#include -#include -#include -#include -#include -#include - -class BankUI : public BankProcess_ { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *bankuiwindow; -private: - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); -public: - Fl_Group *modeselect; - Fl_Light_Button *writebutton; -private: - void cb_writebutton_i(Fl_Light_Button*, void*); - static void cb_writebutton(Fl_Light_Button*, void*); -public: - Fl_Light_Button *readbutton; -private: - void cb_readbutton_i(Fl_Light_Button*, void*); - static void cb_readbutton(Fl_Light_Button*, void*); -public: - Fl_Light_Button *clearbutton; -private: - void cb_clearbutton_i(Fl_Light_Button*, void*); - static void cb_clearbutton(Fl_Light_Button*, void*); -public: - Fl_Light_Button *swapbutton; -private: - void cb_swapbutton_i(Fl_Light_Button*, void*); - static void cb_swapbutton(Fl_Light_Button*, void*); - void cb_New_i(Fl_Button*, void*); - static void cb_New(Fl_Button*, void*); - void cb_auto_i(Fl_Check_Button*, void*); - static void cb_auto(Fl_Check_Button*, void*); -public: - Fl_Choice *banklist; -private: - void cb_banklist_i(Fl_Choice*, void*); - static void cb_banklist(Fl_Choice*, void*); - void cb_Refresh_i(Fl_Button*, void*); - static void cb_Refresh(Fl_Button*, void*); - void cb_Show_i(Fl_Check_Button*, void*); - static void cb_Show(Fl_Check_Button*, void*); -public: - BankUI(Master *master_,int *npart_); - virtual ~BankUI(); - void show(); - void hide(); - void init(Fl_Valuator *cbwig_); - void process(); - void refreshmainwindow(); - void removeselection(); - void rescan_for_banks(); - void simplesetmode(bool beginnerui); -private: - BankSlot *bs[BANK_SIZE]; - int slot,what; //"what"=what button is pressed - int mode,*npart,nselected; - Master *master; - void (BankProcess_::* fnc)(void); -public: - Fl_Valuator *cbwig; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/CMakeLists.txt b/plugins/zynaddsubfx/src/UI/CMakeLists.txt deleted file mode 100644 index 2c959e446..000000000 --- a/plugins/zynaddsubfx/src/UI/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -set(UI_fl_files - ADnoteUI.fl - BankUI.fl - ConfigUI.fl - EffUI.fl - EnvelopeUI.fl - FilterUI.fl - LFOUI.fl - MasterUI.fl - MicrotonalUI.fl - OscilGenUI.fl - PADnoteUI.fl - PartUI.fl - PresetsUI.fl - ResonanceUI.fl - SeqUI.fl - SUBnoteUI.fl - VirKeyboard.fl - WidgetPDial.fl -) - -include_directories("${CMAKE_CURRENT_BINARY_DIR}") - -set_source_files_properties(UI/MasterUI.h PROPERTIES GENERATED 1) -fltk_wrap_ui(zynaddsubfx_gui ${UI_fl_files}) - -add_library(zynaddsubfx_gui STATIC - ${UI_objs} - ${zynaddsubfx_gui_FLTK_UI_SRCS} - ) - -target_link_libraries(zynaddsubfx_gui ${FLTK_LIBRARIES} ${MYFLTK_LIBRARIES}) diff --git a/plugins/zynaddsubfx/src/UI/ConfigUI.cc b/plugins/zynaddsubfx/src/UI/ConfigUI.cc deleted file mode 100644 index 6619f749f..000000000 --- a/plugins/zynaddsubfx/src/UI/ConfigUI.cc +++ /dev/null @@ -1,562 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "ConfigUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void ConfigUI::cb_configwindow_i(Fl_Double_Window* o, void*) { - writebankcfg(); -o->hide(); -} -void ConfigUI::cb_configwindow(Fl_Double_Window* o, void* v) { - ((ConfigUI*)(o->user_data()))->cb_configwindow_i(o,v); -} - -void ConfigUI::cb__i(Fl_Choice* o, void*) { - if ((int)o->value()==0) samplerateinput->activate(); - else samplerateinput->deactivate(); - -int samplerates[8]={44100,16000,22050,32000,44100,48000,88200,96000}; -config.cfg.SampleRate=samplerates[(int)o->value()]; - -setsamplerateinput(); -} -void ConfigUI::cb_(Fl_Choice* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb__i(o,v); -} - -Fl_Menu_Item ConfigUI::menu_[] = { - {"Custom", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"16000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"22050Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"32000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"44100Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"48000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"88200Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"96000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void ConfigUI::cb_samplerateinput_i(Fl_Int_Input* o, void*) { - char *tmp; -config.cfg.SampleRate=strtoul(o->value(),&tmp,10); -} -void ConfigUI::cb_samplerateinput(Fl_Int_Input* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_samplerateinput_i(o,v); -} - -void ConfigUI::cb_Buffer_i(Fl_Int_Input* o, void*) { - char *tmp; -config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10); -} -void ConfigUI::cb_Buffer(Fl_Int_Input* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Buffer_i(o,v); -} - -void ConfigUI::cb_Swap_i(Fl_Light_Button* o, void*) { - config.cfg.SwapStereo=(int) o->value(); -} -void ConfigUI::cb_Swap(Fl_Light_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Swap_i(o,v); -} - -void ConfigUI::cb_OscilSize_i(Fl_Choice* o, void*) { - config.cfg.OscilSize=128<value(); -} -void ConfigUI::cb_OscilSize(Fl_Choice* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_OscilSize_i(o,v); -} - -Fl_Menu_Item ConfigUI::menu_OscilSize[] = { - {"128", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"256", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"512", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"1024", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"2048", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"4096", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"8192", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"16384", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void ConfigUI::cb_Dump_i(Fl_File_Input* o, void*) { - snprintf(config.cfg.DumpFile,config.maxstringsize,"%s",o->value()); -} -void ConfigUI::cb_Dump(Fl_File_Input* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Dump_i(o,v); -} - -void ConfigUI::cb_Dump1_i(Fl_Check_Button* o, void*) { - config.cfg.DumpNotesToFile=(int) o->value(); -dump.startnow();//this has effect only if this option was disabled; -} -void ConfigUI::cb_Dump1(Fl_Check_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Dump1_i(o,v); -} - -void ConfigUI::cb_Append_i(Fl_Check_Button* o, void*) { - config.cfg.DumpAppend=(int) o->value(); -} -void ConfigUI::cb_Append(Fl_Check_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Append_i(o,v); -} - -void ConfigUI::cb_OSS_i(Fl_File_Input* o, void*) { - snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value()); -} -void ConfigUI::cb_OSS(Fl_File_Input* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_OSS_i(o,v); -} - -void ConfigUI::cb_OSS1_i(Fl_File_Input* o, void*) { - snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value()); -} -void ConfigUI::cb_OSS1(Fl_File_Input* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_OSS1_i(o,v); -} - -void ConfigUI::cb_Midi_i(Fl_Counter* o, void*) { - config.cfg.WindowsMidiInId=(int) o->value(); -midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name); -} -void ConfigUI::cb_Midi(Fl_Counter* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Midi_i(o,v); -} - -void ConfigUI::cb_XML_i(Fl_Counter* o, void*) { - config.cfg.GzipCompression=(int) o->value(); -} -void ConfigUI::cb_XML(Fl_Counter* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_XML_i(o,v); -} - -void ConfigUI::cb_PADsynth_i(Fl_Choice* o, void*) { - config.cfg.Interpolation=(int) o->value(); -} -void ConfigUI::cb_PADsynth(Fl_Choice* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_PADsynth_i(o,v); -} - -Fl_Menu_Item ConfigUI::menu_PADsynth[] = { - {"Linear(fast)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Cubic(slow)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void ConfigUI::cb_Virtual_i(Fl_Choice* o, void*) { - config.cfg.VirKeybLayout=(int) o->value();; -} -void ConfigUI::cb_Virtual(Fl_Choice* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Virtual_i(o,v); -} - -Fl_Menu_Item ConfigUI::menu_Virtual[] = { - {" ", 0, 0, 0, 1, FL_NORMAL_LABEL, 1, 11, 0}, - {"QWERTY", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Dvorak", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"QWERTZ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"AZERTY", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void ConfigUI::cb_rootsbrowse_i(Fl_Browser* o, void*) { - activatebutton_rootdir(o->value()!=0); -} -void ConfigUI::cb_rootsbrowse(Fl_Browser* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_rootsbrowse_i(o,v); -} - -void ConfigUI::cb_Add_i(Fl_Button*, void*) { - const char *dirname; -dirname=fl_dir_chooser("Add a root directory for banks:",NULL,0); -if (dirname==NULL) return; - -rootsbrowse->add(dirname); -} -void ConfigUI::cb_Add(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Add_i(o,v); -} - -void ConfigUI::cb_removerootdirbutton_i(Fl_Button*, void*) { - if (rootsbrowse->value()!=0) { - rootsbrowse->remove(rootsbrowse->value()); -}; -activatebutton_rootdir(false); -} -void ConfigUI::cb_removerootdirbutton(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_removerootdirbutton_i(o,v); -} - -void ConfigUI::cb_makedefaultrootdirbutton_i(Fl_Button*, void*) { - int n=rootsbrowse->value(); - -if (n!=0) { - rootsbrowse->move(1,n); - rootsbrowse->value(1); - rootsbrowse->redraw(); -}; -activatebutton_rootdir(true); -} -void ConfigUI::cb_makedefaultrootdirbutton(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_makedefaultrootdirbutton_i(o,v); -} - -void ConfigUI::cb_presetbrowse_i(Fl_Browser* o, void*) { - activatebutton_presetdir(o->value()!=0); -} -void ConfigUI::cb_presetbrowse(Fl_Browser* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_presetbrowse_i(o,v); -} - -void ConfigUI::cb_Add1_i(Fl_Button*, void*) { - const char *dirname; -dirname=fl_dir_chooser("Add a preset directory :",NULL,0); -if (dirname==NULL) return; - -presetbrowse->add(dirname); -} -void ConfigUI::cb_Add1(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Add1_i(o,v); -} - -void ConfigUI::cb_removepresetbutton_i(Fl_Button*, void*) { - if (presetbrowse->value()!=0) { - presetbrowse->remove(presetbrowse->value()); -}; -activatebutton_presetdir(false); -} -void ConfigUI::cb_removepresetbutton(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_removepresetbutton_i(o,v); -} - -void ConfigUI::cb_makedefaultpresetbutton_i(Fl_Button*, void*) { - int n=presetbrowse->value(); - -if (n!=0) { - presetbrowse->move(1,n); - presetbrowse->value(1); - presetbrowse->redraw(); -}; -activatebutton_presetdir(true); -} -void ConfigUI::cb_makedefaultpresetbutton(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_makedefaultpresetbutton_i(o,v); -} - -void ConfigUI::cb_Close_i(Fl_Button*, void*) { - configwindow->hide(); -writebankcfg(); -writepresetcfg(); -} -void ConfigUI::cb_Close(Fl_Button* o, void* v) { - ((ConfigUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -Fl_Double_Window* ConfigUI::make_window() { - { configwindow = new Fl_Double_Window(510, 340, "ZynAddSubFX Settings"); - configwindow->callback((Fl_Callback*)cb_configwindow, (void*)(this)); - { Fl_Tabs* o = new Fl_Tabs(5, 5, 500, 305); - { Fl_Group* o = new Fl_Group(5, 25, 500, 285, "Main settings"); - { Fl_Group* o = new Fl_Group(15, 45, 165, 30, "Sample Rate"); - o->box(FL_ENGRAVED_FRAME); - { Fl_Choice* o = new Fl_Choice(20, 50, 85, 20); - o->down_box(FL_BORDER_BOX); - o->textsize(10); - o->callback((Fl_Callback*)cb_); - o->menu(menu_); - o->value(getsamplerateorder()); - } // Fl_Choice* o - { Fl_Int_Input* o = samplerateinput = new Fl_Int_Input(115, 50, 60, 20); - samplerateinput->type(2); - samplerateinput->textfont(1); - samplerateinput->callback((Fl_Callback*)cb_samplerateinput); - setsamplerateinput(); - if (getsamplerateorder()!=0) o->deactivate(); - } // Fl_Int_Input* samplerateinput - o->end(); - } // Fl_Group* o - { Fl_Int_Input* o = new Fl_Int_Input(190, 45, 60, 20, "Buffer Size"); - o->tooltip("Internal Sound Buffer Size (samples)"); - o->type(2); - o->labelsize(11); - o->textfont(1); - o->callback((Fl_Callback*)cb_Buffer); - o->align(Fl_Align(129)); - char *tmpbuf=new char[100];o->cut(0,o->maximum_size()); - snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf); - delete []tmpbuf; - } // Fl_Int_Input* o - { Fl_Light_Button* o = new Fl_Light_Button(20, 80, 85, 20, "Swap Stereo "); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Swap); - o->value(config.cfg.SwapStereo); - } // Fl_Light_Button* o - { Fl_Choice* o = new Fl_Choice(175, 80, 75, 20, "OscilSize"); - o->tooltip("ADSynth Oscillator Size (samples)"); - o->down_box(FL_BORDER_BOX); - o->labelfont(1); - o->labelsize(11); - o->textsize(10); - o->callback((Fl_Callback*)cb_OscilSize); - o->menu(menu_OscilSize); - o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1); - } // Fl_Choice* o - { Fl_Box* o = new Fl_Box(15, 275, 235, 30, "Most settings has effect only after ZynAddSubFX is restarted."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(10, 255, 240, 20, "Read the Readme.txt for other settings"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Box* o - { Fl_Group* o = new Fl_Group(15, 125, 230, 85); - o->box(FL_ENGRAVED_BOX); - { Fl_File_Input* o = new Fl_File_Input(20, 170, 220, 35, "Dump File"); - o->callback((Fl_Callback*)cb_Dump); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->insert(config.cfg.DumpFile); - } // Fl_File_Input* o - { Fl_Check_Button* o = new Fl_Check_Button(20, 130, 100, 20, "Dump notes"); - o->down_box(FL_DOWN_BOX); - o->callback((Fl_Callback*)cb_Dump1); - o->value(config.cfg.DumpNotesToFile); - } // Fl_Check_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(160, 130, 80, 20, "Append"); - o->down_box(FL_DOWN_BOX); - o->callback((Fl_Callback*)cb_Append); - o->value(config.cfg.DumpAppend); - } // Fl_Check_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(255, 45, 245, 260); - o->box(FL_ENGRAVED_FRAME); - { Fl_Box* o = new Fl_Box(260, 50, 235, 45, "Note: Not all the following settings are used (this depends on the operating \ -system, etc..)"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Box* o - { Fl_Group* o = new Fl_Group(260, 110, 235, 115, "Linux"); - o->box(FL_ENGRAVED_BOX); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - { Fl_File_Input* o = new Fl_File_Input(265, 180, 225, 35, "OSS Sequencer Device (/dev/...)"); - o->callback((Fl_Callback*)cb_OSS); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->insert(config.cfg.LinuxOSSSeqInDev); - } // Fl_File_Input* o - { Fl_File_Input* o = new Fl_File_Input(265, 130, 225, 35, "OSS Wave Out Device (/dev/...)"); - o->callback((Fl_Callback*)cb_OSS1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->insert(config.cfg.LinuxOSSWaveOutDev); - } // Fl_File_Input* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(260, 250, 235, 50, "Windows"); - o->box(FL_ENGRAVED_BOX); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - { Fl_Counter* o = new Fl_Counter(270, 270, 65, 20, "Midi In Dev"); - o->type(1); - o->labelsize(11); - o->minimum(0); - o->maximum(100); - o->step(1); - o->callback((Fl_Callback*)cb_Midi); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->maximum(config.winmidimax-1); - o->value(config.cfg.WindowsMidiInId); - } // Fl_Counter* o - { Fl_Box* o = midiinputnamebox = new Fl_Box(340, 260, 150, 35, "Midi input device name"); - midiinputnamebox->labelfont(1); - midiinputnamebox->labelsize(11); - midiinputnamebox->align(Fl_Align(196|FL_ALIGN_INSIDE)); - o->label(config.winmididevices[config.cfg.WindowsMidiInId].name); - } // Fl_Box* midiinputnamebox - o->end(); - } // Fl_Group* o - o->end(); - } // Fl_Group* o - { Fl_Counter* o = new Fl_Counter(20, 215, 65, 15, "XML compression level"); - o->tooltip("gzip compression level (0 - uncompressed)"); - o->type(1); - o->labelsize(11); - o->minimum(0); - o->maximum(9); - o->step(1); - o->callback((Fl_Callback*)cb_XML); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(config.cfg.GzipCompression); - } // Fl_Counter* o - { Fl_Choice* o = new Fl_Choice(175, 105, 75, 15, "PADsynth Interpolation"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textsize(11); - o->callback((Fl_Callback*)cb_PADsynth); - o->menu(menu_PADsynth); - o->value(config.cfg.Interpolation); - } // Fl_Choice* o - { Fl_Choice* o = new Fl_Choice(155, 235, 85, 20, "Virtual Keyboard Layout"); - o->down_box(FL_BORDER_BOX); - o->labelsize(12); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Virtual); - o->menu(menu_Virtual); - o->value(config.cfg.VirKeybLayout); - } // Fl_Choice* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(5, 25, 500, 285, "Bank root dirs"); - o->hide(); - { rootsbrowse = new Fl_Browser(15, 35, 485, 220); - rootsbrowse->type(2); - rootsbrowse->callback((Fl_Callback*)cb_rootsbrowse); - } // Fl_Browser* rootsbrowse - { Fl_Button* o = new Fl_Button(15, 265, 80, 35, "Add root directory..."); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Add); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - { Fl_Button* o = removerootdirbutton = new Fl_Button(105, 265, 80, 35, "Remove root dir..."); - removerootdirbutton->box(FL_THIN_UP_BOX); - removerootdirbutton->callback((Fl_Callback*)cb_removerootdirbutton); - removerootdirbutton->align(Fl_Align(FL_ALIGN_WRAP)); - o->deactivate(); - } // Fl_Button* removerootdirbutton - { Fl_Button* o = makedefaultrootdirbutton = new Fl_Button(190, 265, 80, 35, "Make default"); - makedefaultrootdirbutton->box(FL_THIN_UP_BOX); - makedefaultrootdirbutton->callback((Fl_Callback*)cb_makedefaultrootdirbutton); - makedefaultrootdirbutton->align(Fl_Align(FL_ALIGN_WRAP)); - o->deactivate(); - } // Fl_Button* makedefaultrootdirbutton - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(5, 25, 500, 285, "Presets dirs"); - o->hide(); - { presetbrowse = new Fl_Browser(15, 35, 485, 220); - presetbrowse->type(2); - presetbrowse->callback((Fl_Callback*)cb_presetbrowse); - } // Fl_Browser* presetbrowse - { Fl_Button* o = new Fl_Button(15, 265, 80, 35, "Add preset directory..."); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Add1); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - { Fl_Button* o = removepresetbutton = new Fl_Button(105, 265, 80, 35, "Remove preset dir..."); - removepresetbutton->box(FL_THIN_UP_BOX); - removepresetbutton->callback((Fl_Callback*)cb_removepresetbutton); - removepresetbutton->align(Fl_Align(FL_ALIGN_WRAP)); - o->deactivate(); - } // Fl_Button* removepresetbutton - { Fl_Button* o = makedefaultpresetbutton = new Fl_Button(190, 265, 80, 35, "Make default"); - makedefaultpresetbutton->box(FL_THIN_UP_BOX); - makedefaultpresetbutton->callback((Fl_Callback*)cb_makedefaultpresetbutton); - makedefaultpresetbutton->align(Fl_Align(FL_ALIGN_WRAP)); - o->deactivate(); - } // Fl_Button* makedefaultpresetbutton - o->end(); - } // Fl_Group* o - o->end(); - } // Fl_Tabs* o - { Fl_Button* o = new Fl_Button(200, 315, 105, 20, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - configwindow->end(); - } // Fl_Double_Window* configwindow - return configwindow; -} - -ConfigUI::ConfigUI() { - make_window(); - readbankcfg(); - readpresetcfg(); -} - -void ConfigUI::activatebutton_rootdir(bool active) { - if (active) { - removerootdirbutton->activate(); - makedefaultrootdirbutton->activate(); - }else{ - removerootdirbutton->deactivate(); - makedefaultrootdirbutton->deactivate(); - }; -} - -void ConfigUI::activatebutton_presetdir(bool active) { - if (active) { - removepresetbutton->activate(); - makedefaultpresetbutton->activate(); - }else{ - removepresetbutton->deactivate(); - makedefaultpresetbutton->deactivate(); - }; -} - -void ConfigUI::readbankcfg() { - rootsbrowse->clear(); - - for (int i=0;iadd(config.cfg.bankRootDirList[i]); - }; -} - -void ConfigUI::writebankcfg() { - config.clearbankrootdirlist(); - - for (int n=0;nsize();n++){ - config.cfg.bankRootDirList[n]=new char [MAX_STRING_SIZE]; - strncpy(config.cfg.bankRootDirList[n],rootsbrowse->text(n+1),MAX_STRING_SIZE); - }; -} - -void ConfigUI::readpresetcfg() { - presetbrowse->clear(); - - for (int i=0;iadd(config.cfg.presetsDirList[i]); - }; -} - -void ConfigUI::writepresetcfg() { - config.clearpresetsdirlist(); - - for (int n=0;nsize();n++){ - config.cfg.presetsDirList[n]=new char [MAX_STRING_SIZE]; - strncpy(config.cfg.presetsDirList[n],presetbrowse->text(n+1),MAX_STRING_SIZE); - }; -} - -int ConfigUI::getsamplerateorder() { - int smpr=config.cfg.SampleRate; - int order=0; - switch(smpr){ - case 16000:order=1;break; - case 22050:order=2;break; - case 32000:order=3;break; - case 44100:order=4;break; - case 48000:order=5;break; - case 88200:order=6;break; - case 96000:order=7;break; - default:order=0;break; - }; - return(order); -} - -void ConfigUI::setsamplerateinput() { - char *tmpbuf=new char[100]; - samplerateinput->cut(0,samplerateinput->maximum_size()); - snprintf(tmpbuf,100,"%d",config.cfg.SampleRate); - samplerateinput->insert(tmpbuf); - delete []tmpbuf; -} - -void ConfigUI::show() { - configwindow->show(); -} diff --git a/plugins/zynaddsubfx/src/UI/ConfigUI.fl b/plugins/zynaddsubfx/src/UI/ConfigUI.fl deleted file mode 100644 index ddb8e1bd6..000000000 --- a/plugins/zynaddsubfx/src/UI/ConfigUI.fl +++ /dev/null @@ -1,451 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0106 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Dump.h"} {public -} - -decl {extern Dump dump;} {public -} - -class ConfigUI {} { - Function {make_window()} {} { - Fl_Window configwindow { - label {ZynAddSubFX Settings} - callback {writebankcfg(); -o->hide();} - xywh {88 313 510 340} type Double hide - } { - Fl_Tabs {} { - xywh {5 5 500 305} - } { - Fl_Group {} { - label {Main settings} - xywh {5 25 500 285} - } { - Fl_Group {} { - label {Sample Rate} - xywh {15 45 165 30} box ENGRAVED_FRAME - } { - Fl_Choice {} { - callback {if ((int)o->value()==0) samplerateinput->activate(); - else samplerateinput->deactivate(); - -int samplerates[8]={44100,16000,22050,32000,44100,48000,88200,96000}; -config.cfg.SampleRate=samplerates[(int)o->value()]; - -setsamplerateinput();} - xywh {20 50 85 20} down_box BORDER_BOX textsize 10 - code0 {o->value(getsamplerateorder());} - } { - menuitem {} { - label Custom - xywh {10 10 100 20} labelfont 1 - } - menuitem {} { - label 16000Hz - xywh {30 30 100 20} labelfont 1 - } - menuitem {} { - label 22050Hz - xywh {20 20 100 20} labelfont 1 - } - menuitem {} { - label 32000Hz - xywh {30 30 100 20} labelfont 1 - } - menuitem {} { - label 44100Hz - xywh {40 40 100 20} labelfont 1 - } - menuitem {} { - label 48000Hz - xywh {50 50 100 20} labelfont 1 - } - menuitem {} { - label 88200Hz - xywh {60 60 100 20} labelfont 1 - } - menuitem {} { - label 96000Hz - xywh {70 70 100 20} labelfont 1 - } - } - Fl_Input samplerateinput { - callback {char *tmp; -config.cfg.SampleRate=strtoul(o->value(),&tmp,10);} - xywh {115 50 60 20} type Int textfont 1 - code0 {setsamplerateinput();} - code1 {if (getsamplerateorder()!=0) o->deactivate();} - } - } - Fl_Input {} { - label {Buffer Size} - callback {char *tmp; -config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);} - tooltip {Internal Sound Buffer Size (samples)} xywh {190 45 60 20} type Int labelsize 11 align 129 textfont 1 - code0 {char *tmpbuf=new char[100];o->cut(0,o->maximum_size());} - code1 {snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf);} - code2 {delete []tmpbuf;} - } - Fl_Light_Button {} { - label {Swap Stereo } - callback {config.cfg.SwapStereo=(int) o->value();} - xywh {20 80 85 20} box THIN_UP_BOX labelsize 10 - code0 {o->value(config.cfg.SwapStereo);} - } - Fl_Choice {} { - label OscilSize - callback {config.cfg.OscilSize=128<value();} - tooltip {ADSynth Oscillator Size (samples)} xywh {175 80 75 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 10 - code0 {o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1);} - } { - menuitem {} { - label 128 - xywh {25 25 100 20} labelfont 1 - } - menuitem {} { - label 256 - xywh {35 35 100 20} labelfont 1 - } - menuitem {} { - label 512 - xywh {45 45 100 20} labelfont 1 - } - menuitem {} { - label 1024 - xywh {45 45 100 20} labelfont 1 - } - menuitem {} { - label 2048 - xywh {55 55 100 20} labelfont 1 - } - menuitem {} { - label 4096 - xywh {55 55 100 20} labelfont 1 - } - menuitem {} { - label 8192 - xywh {65 65 100 20} labelfont 1 - } - menuitem {} { - label 16384 - xywh {75 75 100 20} labelfont 1 - } - } - Fl_Box {} { - label {Most settings has effect only after ZynAddSubFX is restarted.} - xywh {15 275 235 30} labelfont 1 labelsize 11 align 128 - } - Fl_Box {} { - label {Read the Readme.txt for other settings} - xywh {10 255 240 20} labelfont 1 labelsize 11 align 128 - } - Fl_Group {} { - xywh {15 125 230 85} box ENGRAVED_BOX - } { - Fl_File_Input {} { - label {Dump File} - callback {snprintf(config.cfg.DumpFile,config.maxstringsize,"%s",o->value());} - xywh {20 170 220 35} align 5 - code0 {o->insert(config.cfg.DumpFile);} - } - Fl_Check_Button {} { - label {Dump notes} - callback {config.cfg.DumpNotesToFile=(int) o->value(); -dump.startnow();//this has effect only if this option was disabled} - xywh {20 130 100 20} down_box DOWN_BOX - code0 {o->value(config.cfg.DumpNotesToFile);} - } - Fl_Check_Button {} { - label Append - callback {config.cfg.DumpAppend=(int) o->value();} - xywh {160 130 80 20} down_box DOWN_BOX - code0 {o->value(config.cfg.DumpAppend);} - } - } - Fl_Group {} { - xywh {255 45 245 260} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {Note: Not all the following settings are used (this depends on the operating system, etc..)} - xywh {260 50 235 45} labelfont 1 labelsize 11 align 128 - } - Fl_Group {} { - label Linux - xywh {260 110 235 115} box ENGRAVED_BOX labelfont 1 labelsize 13 align 5 - } { - Fl_File_Input {} { - label {OSS Sequencer Device (/dev/...)} - callback {snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value());} - xywh {265 180 225 35} align 5 - code0 {o->insert(config.cfg.LinuxOSSSeqInDev);} - } - Fl_File_Input {} { - label {OSS Wave Out Device (/dev/...)} - callback {snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value());} - xywh {265 130 225 35} align 5 - code0 {o->insert(config.cfg.LinuxOSSWaveOutDev);} - } - } - Fl_Group {} { - label Windows - xywh {260 250 235 50} box ENGRAVED_BOX labelfont 1 labelsize 13 align 5 - } { - Fl_Counter {} { - label {Midi In Dev} - callback {config.cfg.WindowsMidiInId=(int) o->value(); -midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name);} - xywh {270 270 65 20} type Simple labelsize 11 align 1 minimum 0 maximum 100 step 1 - code0 {o->maximum(config.winmidimax-1);} - code1 {o->value(config.cfg.WindowsMidiInId);} - } - Fl_Box midiinputnamebox { - label {Midi input device name} - xywh {340 260 150 35} labelfont 1 labelsize 11 align 212 - code0 {o->label(config.winmididevices[config.cfg.WindowsMidiInId].name);} - } - } - } - Fl_Counter {} { - label {XML compression level} - callback {config.cfg.GzipCompression=(int) o->value();} - tooltip {gzip compression level (0 - uncompressed)} xywh {20 215 65 15} type Simple labelsize 11 align 8 minimum 0 maximum 9 step 1 - code0 {o->value(config.cfg.GzipCompression);} - } - Fl_Choice {} { - label {PADsynth Interpolation} - callback {config.cfg.Interpolation=(int) o->value();} - xywh {175 105 75 15} down_box BORDER_BOX labelsize 10 textsize 11 - code0 {o->value(config.cfg.Interpolation);} - } { - menuitem {} { - label {Linear(fast)} - xywh {0 0 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label {Cubic(slow)} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice {} { - label {Virtual Keyboard Layout} - callback {config.cfg.VirKeybLayout=(int) o->value();;} open selected - xywh {155 235 85 20} down_box BORDER_BOX labelsize 12 textfont 1 textsize 11 - code0 {o->value(config.cfg.VirKeybLayout);} - } { - menuitem {} { - label { } - xywh {5 5 100 20} labelfont 1 labelsize 11 deactivate - } - menuitem {} { - label QWERTY - xywh {15 15 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label Dvorak - xywh {25 25 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label QWERTZ - xywh {35 35 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label AZERTY - xywh {45 45 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Group {} { - label {Bank root dirs} - xywh {5 25 500 285} hide - } { - Fl_Browser rootsbrowse { - callback {activatebutton_rootdir(o->value()!=0);} - xywh {15 35 485 220} type Hold - } - Fl_Button {} { - label {Add root directory...} - callback {const char *dirname; -dirname=fl_dir_chooser("Add a root directory for banks:",NULL,0); -if (dirname==NULL) return; - -rootsbrowse->add(dirname);} - xywh {15 265 80 35} box THIN_UP_BOX align 128 - } - Fl_Button removerootdirbutton { - label {Remove root dir...} - callback {if (rootsbrowse->value()!=0) { - rootsbrowse->remove(rootsbrowse->value()); -}; -activatebutton_rootdir(false);} - xywh {105 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - Fl_Button makedefaultrootdirbutton { - label {Make default} - callback {int n=rootsbrowse->value(); - -if (n!=0) { - rootsbrowse->move(1,n); - rootsbrowse->value(1); - rootsbrowse->redraw(); -}; -activatebutton_rootdir(true);} - xywh {190 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - } - Fl_Group {} { - label {Presets dirs} - xywh {5 25 500 285} hide - } { - Fl_Browser presetbrowse { - callback {activatebutton_presetdir(o->value()!=0);} - xywh {15 35 485 220} type Hold - } - Fl_Button {} { - label {Add preset directory...} - callback {const char *dirname; -dirname=fl_dir_chooser("Add a preset directory :",NULL,0); -if (dirname==NULL) return; - -presetbrowse->add(dirname);} - xywh {15 265 80 35} box THIN_UP_BOX align 128 - } - Fl_Button removepresetbutton { - label {Remove preset dir...} - callback {if (presetbrowse->value()!=0) { - presetbrowse->remove(presetbrowse->value()); -}; -activatebutton_presetdir(false);} - xywh {105 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - Fl_Button makedefaultpresetbutton { - label {Make default} - callback {int n=presetbrowse->value(); - -if (n!=0) { - presetbrowse->move(1,n); - presetbrowse->value(1); - presetbrowse->redraw(); -}; -activatebutton_presetdir(true);} - xywh {190 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - } - } - Fl_Button {} { - label Close - callback {configwindow->hide(); -writebankcfg(); -writepresetcfg();} - xywh {200 315 105 20} box THIN_UP_BOX - } - } - } - Function {ConfigUI()} {} { - code {make_window(); -readbankcfg(); -readpresetcfg();} {} - } - Function {activatebutton_rootdir(bool active)} {} { - code {if (active) { - removerootdirbutton->activate(); - makedefaultrootdirbutton->activate(); -}else{ - removerootdirbutton->deactivate(); - makedefaultrootdirbutton->deactivate(); -};} {} - } - Function {activatebutton_presetdir(bool active)} {} { - code {if (active) { - removepresetbutton->activate(); - makedefaultpresetbutton->activate(); -}else{ - removepresetbutton->deactivate(); - makedefaultpresetbutton->deactivate(); -};} {} - } - Function {readbankcfg()} {} { - code {rootsbrowse->clear(); - -for (int i=0;iadd(config.cfg.bankRootDirList[i]); -};} {} - } - Function {writebankcfg()} {} { - code {config.clearbankrootdirlist(); - -for (int n=0;nsize();n++){ - config.cfg.bankRootDirList[n]=new char [MAX_STRING_SIZE]; - strncpy(config.cfg.bankRootDirList[n],rootsbrowse->text(n+1),MAX_STRING_SIZE); -};} {} - } - Function {readpresetcfg()} {} { - code {presetbrowse->clear(); - -for (int i=0;iadd(config.cfg.presetsDirList[i]); -};} {} - } - Function {writepresetcfg()} {} { - code {config.clearpresetsdirlist(); - -for (int n=0;nsize();n++){ - config.cfg.presetsDirList[n]=new char [MAX_STRING_SIZE]; - strncpy(config.cfg.presetsDirList[n],presetbrowse->text(n+1),MAX_STRING_SIZE); -};} {} - } - Function {getsamplerateorder()} {return_type int - } { - code {int smpr=config.cfg.SampleRate; -int order=0; -switch(smpr){ - case 16000:order=1;break; - case 22050:order=2;break; - case 32000:order=3;break; - case 44100:order=4;break; - case 48000:order=5;break; - case 88200:order=6;break; - case 96000:order=7;break; - default:order=0;break; -}; -return(order);} {} - } - Function {setsamplerateinput()} {return_type void - } { - code {char *tmpbuf=new char[100]; -samplerateinput->cut(0,samplerateinput->maximum_size()); -snprintf(tmpbuf,100,"%d",config.cfg.SampleRate); -samplerateinput->insert(tmpbuf); -delete []tmpbuf;} {} - } - Function {show()} {} { - code {configwindow->show();} {} - } -} diff --git a/plugins/zynaddsubfx/src/UI/ConfigUI.h b/plugins/zynaddsubfx/src/UI/ConfigUI.h deleted file mode 100644 index bc0cda5c6..000000000 --- a/plugins/zynaddsubfx/src/UI/ConfigUI.h +++ /dev/null @@ -1,120 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef ConfigUI_h -#define ConfigUI_h -#include -#include -#include -#include -#include -#include "../globals.h" -#include "../Misc/Util.h" -#include "../Misc/Dump.h" -extern Dump dump; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class ConfigUI { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *configwindow; -private: - void cb_configwindow_i(Fl_Double_Window*, void*); - static void cb_configwindow(Fl_Double_Window*, void*); - void cb__i(Fl_Choice*, void*); - static void cb_(Fl_Choice*, void*); - static Fl_Menu_Item menu_[]; -public: - Fl_Int_Input *samplerateinput; -private: - void cb_samplerateinput_i(Fl_Int_Input*, void*); - static void cb_samplerateinput(Fl_Int_Input*, void*); - void cb_Buffer_i(Fl_Int_Input*, void*); - static void cb_Buffer(Fl_Int_Input*, void*); - void cb_Swap_i(Fl_Light_Button*, void*); - static void cb_Swap(Fl_Light_Button*, void*); - void cb_OscilSize_i(Fl_Choice*, void*); - static void cb_OscilSize(Fl_Choice*, void*); - static Fl_Menu_Item menu_OscilSize[]; - void cb_Dump_i(Fl_File_Input*, void*); - static void cb_Dump(Fl_File_Input*, void*); - void cb_Dump1_i(Fl_Check_Button*, void*); - static void cb_Dump1(Fl_Check_Button*, void*); - void cb_Append_i(Fl_Check_Button*, void*); - static void cb_Append(Fl_Check_Button*, void*); - void cb_OSS_i(Fl_File_Input*, void*); - static void cb_OSS(Fl_File_Input*, void*); - void cb_OSS1_i(Fl_File_Input*, void*); - static void cb_OSS1(Fl_File_Input*, void*); - void cb_Midi_i(Fl_Counter*, void*); - static void cb_Midi(Fl_Counter*, void*); -public: - Fl_Box *midiinputnamebox; -private: - void cb_XML_i(Fl_Counter*, void*); - static void cb_XML(Fl_Counter*, void*); - void cb_PADsynth_i(Fl_Choice*, void*); - static void cb_PADsynth(Fl_Choice*, void*); - static Fl_Menu_Item menu_PADsynth[]; - void cb_Virtual_i(Fl_Choice*, void*); - static void cb_Virtual(Fl_Choice*, void*); - static Fl_Menu_Item menu_Virtual[]; -public: - Fl_Browser *rootsbrowse; -private: - void cb_rootsbrowse_i(Fl_Browser*, void*); - static void cb_rootsbrowse(Fl_Browser*, void*); - void cb_Add_i(Fl_Button*, void*); - static void cb_Add(Fl_Button*, void*); -public: - Fl_Button *removerootdirbutton; -private: - void cb_removerootdirbutton_i(Fl_Button*, void*); - static void cb_removerootdirbutton(Fl_Button*, void*); -public: - Fl_Button *makedefaultrootdirbutton; -private: - void cb_makedefaultrootdirbutton_i(Fl_Button*, void*); - static void cb_makedefaultrootdirbutton(Fl_Button*, void*); -public: - Fl_Browser *presetbrowse; -private: - void cb_presetbrowse_i(Fl_Browser*, void*); - static void cb_presetbrowse(Fl_Browser*, void*); - void cb_Add1_i(Fl_Button*, void*); - static void cb_Add1(Fl_Button*, void*); -public: - Fl_Button *removepresetbutton; -private: - void cb_removepresetbutton_i(Fl_Button*, void*); - static void cb_removepresetbutton(Fl_Button*, void*); -public: - Fl_Button *makedefaultpresetbutton; -private: - void cb_makedefaultpresetbutton_i(Fl_Button*, void*); - static void cb_makedefaultpresetbutton(Fl_Button*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); -public: - ConfigUI(); - void activatebutton_rootdir(bool active); - void activatebutton_presetdir(bool active); - void readbankcfg(); - void writebankcfg(); - void readpresetcfg(); - void writepresetcfg(); - int getsamplerateorder(); - void setsamplerateinput(); - void show(); -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/EffUI.cc b/plugins/zynaddsubfx/src/UI/EffUI.cc deleted file mode 100644 index aae61d9c7..000000000 --- a/plugins/zynaddsubfx/src/UI/EffUI.cc +++ /dev/null @@ -1,4113 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "EffUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -EQGraph::EQGraph(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - eff=NULL; - maxdB=30; -} - -void EQGraph::init(EffectMgr *eff_) { - eff=eff_; - oldx=-1; - khzval=-1; -} - -void EQGraph::draw_freq_line(REALTYPE freq,int type) { - fl_color(FL_GRAY); - REALTYPE freqx=getfreqpos(freq); - switch(type){ - case 0:if (active_r()) fl_color(FL_WHITE); - else fl_color(205,205,205); - fl_line_style(FL_SOLID); - break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; - }; - - - if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h()); -} - -void EQGraph::draw() { - int ox=x(),oy=y(),lx=w(),ly=h(),i,iy,oiy; - REALTYPE freqx; - - if (active_r()) fl_color(0,70,150); - else fl_color(80,120,160); - fl_rectf(ox,oy,lx,ly); - - - //draw the lines - fl_color(FL_GRAY); - - fl_line_style(FL_SOLID); - fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - - freqx=getfreqpos(1000.0); - if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - - for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*10.0,2); - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*10.0,1); - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; - }; - - draw_freq_line(10000.0,0); - draw_freq_line(20000.0,1); - - - fl_line_style(FL_DOT); - int GY=6;if (lySAMPLE_RATE/2) break; - iy=getresponse(ly,frq); - if ((oiy>=0) && (oiy=0) && (iygetEQfreqresponse(freq); - int idbresp=(int) ((dbresp/maxdB+1.0)*maxy/2.0); - - - //fprintf(stderr,"%.5f\n",(dbresp/maxdB+1.0)*maxy/2.0); - - - return(idbresp); -} - -REALTYPE EQGraph::getfreqx(REALTYPE x) { - if (x>1.0) x=1.0; - return(20.0*pow((REALTYPE)1000.0,x)); -} - -REALTYPE EQGraph::getfreqpos(REALTYPE freq) { - if (freq<0.00001) freq=0.00001; - return(log(freq/20.0)/log(1000.0)); -} - -void EffUI::cb_revp_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); - -refresh(eff); -} -void EffUI::cb_revp(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp_i(o,v); -} - -Fl_Menu_Item EffUI::menu_revp[] = { - {"Cathedral 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Cathedral 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Cathedral 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Hall 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Hall 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Room 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Room 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Basement", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Tunnel", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echoed 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echoed 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Very Long 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Very Long 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_revp10_i(Fl_Choice* o, void*) { - eff->seteffectpar(10,(int) o->value()); -if (eff->geteffectpar(10)==2) revp12->activate(); - else revp12->deactivate(); -} -void EffUI::cb_revp10(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp10_i(o,v); -} - -Fl_Menu_Item EffUI::menu_revp10[] = { - {"Random", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Freeverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Bandwidth", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_revp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_revp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp0_i(o,v); -} - -void EffUI::cb_revp1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_revp1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp1_i(o,v); -} - -void EffUI::cb_revp2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_revp2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp2_i(o,v); -} - -void EffUI::cb_revp3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_revp3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp3_i(o,v); -} - -void EffUI::cb_revp4_i(WidgetPDial* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_revp4(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp4_i(o,v); -} - -void EffUI::cb_revp12_i(WidgetPDial* o, void*) { - eff->seteffectpar(12,(int) o->value()); -} -void EffUI::cb_revp12(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp12_i(o,v); -} - -void EffUI::cb_revp6_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_revp6(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp6_i(o,v); -} - -void EffUI::cb_revp7_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void EffUI::cb_revp7(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp7_i(o,v); -} - -void EffUI::cb_revp8_i(WidgetPDial* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void EffUI::cb_revp8(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp8_i(o,v); -} - -void EffUI::cb_revp9_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void EffUI::cb_revp9(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp9_i(o,v); -} - -void EffUI::cb_revp11_i(WidgetPDial* o, void*) { - int x=64; -if (Fl::event_button1()) x=(int)o->value(); - else o->value(x); -eff->seteffectpar(11,x); -} -void EffUI::cb_revp11(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_revp11_i(o,v); -} - -void EffUI::cb_echop_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void EffUI::cb_echop(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop_i(o,v); -} - -Fl_Menu_Item EffUI::menu_echop[] = { - {"Echo 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echo 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echo 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Simple Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Canyon", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Panning Echo 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Panning Echo 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Panning Echo 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Feedback Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_echop0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_echop0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop0_i(o,v); -} - -void EffUI::cb_echop1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_echop1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop1_i(o,v); -} - -void EffUI::cb_echop2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_echop2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop2_i(o,v); -} - -void EffUI::cb_echop3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_echop3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop3_i(o,v); -} - -void EffUI::cb_echop4_i(WidgetPDial* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_echop4(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop4_i(o,v); -} - -void EffUI::cb_echop5_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void EffUI::cb_echop5(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop5_i(o,v); -} - -void EffUI::cb_echop6_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_echop6(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_echop6_i(o,v); -} - -void EffUI::cb_chorusp_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void EffUI::cb_chorusp(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp_i(o,v); -} - -Fl_Menu_Item EffUI::menu_chorusp[] = { - {"Chorus 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Chorus 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Chorus 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Celeste 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Celeste 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_chorusp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_chorusp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp0_i(o,v); -} - -void EffUI::cb_chorusp1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_chorusp1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp1_i(o,v); -} - -void EffUI::cb_chorusp2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_chorusp2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp2_i(o,v); -} - -void EffUI::cb_chorusp3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_chorusp3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp3_i(o,v); -} - -void EffUI::cb_chorusp5_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void EffUI::cb_chorusp5(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp5_i(o,v); -} - -void EffUI::cb_chorusp6_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_chorusp6(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp6_i(o,v); -} - -void EffUI::cb_chorusp7_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void EffUI::cb_chorusp7(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp7_i(o,v); -} - -void EffUI::cb_chorusp8_i(WidgetPDial* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void EffUI::cb_chorusp8(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp8_i(o,v); -} - -void EffUI::cb_chorusp9_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void EffUI::cb_chorusp9(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp9_i(o,v); -} - -void EffUI::cb_Flange_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(10,(int) o->value()); -} -void EffUI::cb_Flange(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_Flange_i(o,v); -} - -void EffUI::cb_chorusp11_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(11,(int) o->value()); -} -void EffUI::cb_chorusp11(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp11_i(o,v); -} - -void EffUI::cb_chorusp4_i(Fl_Choice* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_chorusp4(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_chorusp4_i(o,v); -} - -Fl_Menu_Item EffUI::menu_chorusp4[] = { - {"SINE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_phaserp_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void EffUI::cb_phaserp(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp_i(o,v); -} - -Fl_Menu_Item EffUI::menu_phaserp[] = { - {"Phaser 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"APhaser 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"APhaser 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"APhaser 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"APhaser 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"APhaser 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"APhaser 6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_phaserp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_phaserp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp0_i(o,v); -} - -void EffUI::cb_phaserp1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_phaserp1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp1_i(o,v); -} - -void EffUI::cb_phaserp2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_phaserp2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp2_i(o,v); -} - -void EffUI::cb_phaserp3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_phaserp3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp3_i(o,v); -} - -void EffUI::cb_phaserp4_i(Fl_Choice* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_phaserp4(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp4_i(o,v); -} - -Fl_Menu_Item EffUI::menu_phaserp4[] = { - {"SIN", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_phaserp5_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void EffUI::cb_phaserp5(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp5_i(o,v); -} - -void EffUI::cb_phaserp6_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_phaserp6(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp6_i(o,v); -} - -void EffUI::cb_phaserp7_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void EffUI::cb_phaserp7(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp7_i(o,v); -} - -void EffUI::cb_phaserp8_i(Fl_Counter* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void EffUI::cb_phaserp8(Fl_Counter* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp8_i(o,v); -} - -void EffUI::cb_phaserp9_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void EffUI::cb_phaserp9(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp9_i(o,v); -} - -void EffUI::cb_phaserp10_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(10,(int) o->value()); -} -void EffUI::cb_phaserp10(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp10_i(o,v); -} - -void EffUI::cb_phaserp11_i(WidgetPDial* o, void*) { - eff->seteffectpar(11,(int) o->value()); -} -void EffUI::cb_phaserp11(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp11_i(o,v); -} - -void EffUI::cb_phaserp12_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(12,(int) o->value()); -} -void EffUI::cb_phaserp12(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp12_i(o,v); -} - -void EffUI::cb_phaserp13_i(WidgetPDial* o, void*) { - eff->seteffectpar(13,(int) o->value()); -} -void EffUI::cb_phaserp13(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp13_i(o,v); -} - -void EffUI::cb_phaserp14_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(14,(int) o->value()); -} -void EffUI::cb_phaserp14(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_phaserp14_i(o,v); -} - -void EffUI::cb_awp_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void EffUI::cb_awp(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp_i(o,v); -} - -Fl_Menu_Item EffUI::menu_awp[] = { - {"Alienwah 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Alienwah 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Alienwah 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Alienwah 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_awp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_awp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp0_i(o,v); -} - -void EffUI::cb_awp1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_awp1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp1_i(o,v); -} - -void EffUI::cb_awp2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_awp2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp2_i(o,v); -} - -void EffUI::cb_awp3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_awp3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp3_i(o,v); -} - -void EffUI::cb_awp5_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void EffUI::cb_awp5(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp5_i(o,v); -} - -void EffUI::cb_awp6_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_awp6(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp6_i(o,v); -} - -void EffUI::cb_awp7_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void EffUI::cb_awp7(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp7_i(o,v); -} - -void EffUI::cb_awp9_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void EffUI::cb_awp9(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp9_i(o,v); -} - -void EffUI::cb_awp4_i(Fl_Choice* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_awp4(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp4_i(o,v); -} - -Fl_Menu_Item EffUI::menu_awp4[] = { - {"SINE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_awp10_i(WidgetPDial* o, void*) { - eff->seteffectpar(10,(int) o->value()); -} -void EffUI::cb_awp10(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp10_i(o,v); -} - -void EffUI::cb_awp8_i(Fl_Counter* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void EffUI::cb_awp8(Fl_Counter* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_awp8_i(o,v); -} - -void EffUI::cb_distp_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void EffUI::cb_distp(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp_i(o,v); -} - -Fl_Menu_Item EffUI::menu_distp[] = { - {"Overdrive 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Overdrive 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"A. Exciter 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"A. Exciter 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Guitar Amp", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Quantisize", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_distp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_distp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp0_i(o,v); -} - -void EffUI::cb_distp1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_distp1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp1_i(o,v); -} - -void EffUI::cb_distp2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_distp2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp2_i(o,v); -} - -void EffUI::cb_distp3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_distp3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp3_i(o,v); -} - -void EffUI::cb_distp4_i(WidgetPDial* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_distp4(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp4_i(o,v); -} - -void EffUI::cb_distp7_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void EffUI::cb_distp7(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp7_i(o,v); -} - -void EffUI::cb_distp8_i(WidgetPDial* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void EffUI::cb_distp8(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp8_i(o,v); -} - -void EffUI::cb_distp5_i(Fl_Choice* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void EffUI::cb_distp5(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp5_i(o,v); -} - -Fl_Menu_Item EffUI::menu_distp5[] = { - {"Atan", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Asym1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Qnts", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Zigzg", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lmt", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LmtU", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LmtL", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"ILmt", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Clip", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Asym2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sgm", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_distp6_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_distp6(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp6_i(o,v); -} - -void EffUI::cb_distp9_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void EffUI::cb_distp9(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp9_i(o,v); -} - -void EffUI::cb_distp10_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(10,(int) o->value()); -} -void EffUI::cb_distp10(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_distp10_i(o,v); -} - -void EffUI::cb_eqp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -eqgraph->redraw(); -} -void EffUI::cb_eqp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_eqp0_i(o,v); -} - -void EffUI::cb_bandcounter_i(Fl_Counter* o, void*) { - eqband=(int) o->value(); -int npb=eqband*5+10; - -int type=eff->geteffectpar(npb); -typechoice->value(type); - -if (type>6) gaindial->activate(); - else gaindial->deactivate(); - -if (type==0) bandgroup->deactivate(); -else bandgroup->activate(); - -int freq=eff->geteffectpar(npb+1); -freqdial->value(freq); - -int gain=eff->geteffectpar(npb+2); -gaindial->value(gain); - -int q=eff->geteffectpar(npb+3); -qdial->value(q); - -int dbl=eff->geteffectpar(npb+4); -stagescounter->value(dbl); -} -void EffUI::cb_bandcounter(Fl_Counter* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_bandcounter_i(o,v); -} - -void EffUI::cb_freqdial_i(WidgetPDial* o, void*) { - int np=eqband*5+11; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void EffUI::cb_freqdial(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_freqdial_i(o,v); -} - -void EffUI::cb_gaindial_i(WidgetPDial* o, void*) { - int np=eqband*5+12; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void EffUI::cb_gaindial(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_gaindial_i(o,v); -} - -void EffUI::cb_qdial_i(WidgetPDial* o, void*) { - int np=eqband*5+13; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void EffUI::cb_qdial(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_qdial_i(o,v); -} - -void EffUI::cb_stagescounter_i(Fl_Counter* o, void*) { - int np=eqband*5+14; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void EffUI::cb_stagescounter(Fl_Counter* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_stagescounter_i(o,v); -} - -void EffUI::cb_typechoice_i(Fl_Choice* o, void*) { - int np=eqband*5+10; -eff->seteffectpar(np,(int) o->value()); -bandcounter->do_callback(); -eqgraph->redraw(); -} -void EffUI::cb_typechoice(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_typechoice_i(o,v); -} - -Fl_Menu_Item EffUI::menu_typechoice[] = { - {"OFF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lp1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Hp1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lp2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Hp2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Bp2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"N2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pk", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LSh", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HSh", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_dfp_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void EffUI::cb_dfp(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp_i(o,v); -} - -Fl_Menu_Item EffUI::menu_dfp[] = { - {"WahWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"AutoWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Sweep", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"VocalMorph1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"VocalMorph2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_dfp0_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void EffUI::cb_dfp0(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp0_i(o,v); -} - -void EffUI::cb_dfp1_i(WidgetPDial* o, void*) { - eff->seteffectpar(1,(int) o->value()); -} -void EffUI::cb_dfp1(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp1_i(o,v); -} - -void EffUI::cb_dfp2_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void EffUI::cb_dfp2(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp2_i(o,v); -} - -void EffUI::cb_dfp3_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void EffUI::cb_dfp3(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp3_i(o,v); -} - -void EffUI::cb_dfp5_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void EffUI::cb_dfp5(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp5_i(o,v); -} - -void EffUI::cb_dfp6_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void EffUI::cb_dfp6(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp6_i(o,v); -} - -void EffUI::cb_dfp4_i(Fl_Choice* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void EffUI::cb_dfp4(Fl_Choice* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_dfp4_i(o,v); -} - -Fl_Menu_Item EffUI::menu_dfp4[] = { - {"SINE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void EffUI::cb_Filter_i(Fl_Button*, void*) { - filterwindow->show(); -} -void EffUI::cb_Filter(Fl_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_Filter_i(o,v); -} - -void EffUI::cb_dfp7_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void EffUI::cb_dfp7(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_dfp7_i(o,v); -} - -void EffUI::cb_dfp9_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void EffUI::cb_dfp9(WidgetPDial* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_dfp9_i(o,v); -} - -void EffUI::cb_dfp8_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void EffUI::cb_dfp8(Fl_Check_Button* o, void* v) { - ((EffUI*)(o->parent()->parent()->user_data()))->cb_dfp8_i(o,v); -} - -void EffUI::cb_Close_i(Fl_Button*, void*) { - filterwindow->hide(); -} -void EffUI::cb_Close(Fl_Button* o, void* v) { - ((EffUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -EffUI::EffUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - eff=NULL; - filterwindow=NULL; -} - -EffUI::~EffUI() { - effnullwindow->hide();//delete (effnullwindow); - effreverbwindow->hide();//delete (effreverbwindow); - effechowindow->hide();//delete (effechowindow); - effchoruswindow->hide();//delete (effchoruswindow); - effphaserwindow->hide();//delete (effphaserwindow); - effalienwahwindow->hide();//delete (effalienwahwindow); - effdistorsionwindow->hide();//delete (effdistorsionwindow); - effeqwindow->hide();//delete (effeqwindow); - effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow); - - if (filterwindow!=NULL){ - filterwindow->hide(); - delete(filterwindow); - }; -} - -Fl_Group* EffUI::make_null_window() { - { effnullwindow = new Fl_Group(0, 0, 380, 95); - effnullwindow->box(FL_PLASTIC_UP_BOX); - effnullwindow->color((Fl_Color)221); - effnullwindow->selection_color(FL_BACKGROUND_COLOR); - effnullwindow->labeltype(FL_NO_LABEL); - effnullwindow->labelfont(1); - effnullwindow->labelsize(14); - effnullwindow->labelcolor(FL_FOREGROUND_COLOR); - effnullwindow->user_data((void*)(this)); - effnullwindow->align(Fl_Align(FL_ALIGN_TOP)); - effnullwindow->when(FL_WHEN_RELEASE); - { Fl_Text_Display* o = new Fl_Text_Display(120, 35, 10, 20, "No Effect"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->labelcolor((Fl_Color)43); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - effnullwindow->end(); - } // Fl_Group* effnullwindow - return effnullwindow; -} - -Fl_Group* EffUI::make_reverb_window() { - { effreverbwindow = new Fl_Group(0, 0, 380, 95); - effreverbwindow->box(FL_PLASTIC_UP_BOX); - effreverbwindow->color((Fl_Color)221); - effreverbwindow->selection_color(FL_BACKGROUND_COLOR); - effreverbwindow->labeltype(FL_NO_LABEL); - effreverbwindow->labelfont(1); - effreverbwindow->labelsize(14); - effreverbwindow->labelcolor(FL_FOREGROUND_COLOR); - effreverbwindow->user_data((void*)(this)); - effreverbwindow->align(Fl_Align(FL_ALIGN_TOP)); - effreverbwindow->when(FL_WHEN_RELEASE); - { Fl_Text_Display* o = new Fl_Text_Display(275, 10, 10, 20, "Reverb "); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { revp = new Fl_Choice(10, 15, 90, 15, "Preset"); - revp->down_box(FL_BORDER_BOX); - revp->color((Fl_Color)14); - revp->selection_color(FL_FOREGROUND_COLOR); - revp->labelfont(1); - revp->labelsize(10); - revp->textfont(1); - revp->textsize(10); - revp->textcolor(FL_BACKGROUND2_COLOR); - revp->callback((Fl_Callback*)cb_revp); - revp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - revp->menu(menu_revp); - } // Fl_Choice* revp - { revp10 = new Fl_Choice(110, 15, 85, 15, "Type"); - revp10->down_box(FL_BORDER_BOX); - revp10->color((Fl_Color)14); - revp10->labelfont(1); - revp10->labelsize(10); - revp10->textfont(1); - revp10->textsize(10); - revp10->textcolor(FL_BACKGROUND2_COLOR); - revp10->callback((Fl_Callback*)cb_revp10); - revp10->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - revp10->menu(menu_revp10); - } // Fl_Choice* revp10 - { revp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - revp0->tooltip("Effect Volume"); - revp0->box(FL_ROUND_UP_BOX); - revp0->color(FL_BACKGROUND_COLOR); - revp0->selection_color(FL_INACTIVE_COLOR); - revp0->labeltype(FL_NORMAL_LABEL); - revp0->labelfont(1); - revp0->labelsize(11); - revp0->labelcolor(FL_FOREGROUND_COLOR); - revp0->maximum(127); - revp0->callback((Fl_Callback*)cb_revp0); - revp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp0 - { revp1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - revp1->box(FL_ROUND_UP_BOX); - revp1->color(FL_BACKGROUND_COLOR); - revp1->selection_color(FL_INACTIVE_COLOR); - revp1->labeltype(FL_NORMAL_LABEL); - revp1->labelfont(1); - revp1->labelsize(11); - revp1->labelcolor(FL_FOREGROUND_COLOR); - revp1->maximum(127); - revp1->callback((Fl_Callback*)cb_revp1); - revp1->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp1->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp1 - { revp2 = new WidgetPDial(80, 40, 30, 30, "Time"); - revp2->tooltip("Duration of Effect"); - revp2->box(FL_ROUND_UP_BOX); - revp2->color(FL_BACKGROUND_COLOR); - revp2->selection_color(FL_INACTIVE_COLOR); - revp2->labeltype(FL_NORMAL_LABEL); - revp2->labelfont(1); - revp2->labelsize(11); - revp2->labelcolor(FL_FOREGROUND_COLOR); - revp2->maximum(127); - revp2->callback((Fl_Callback*)cb_revp2); - revp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp2 - { revp3 = new WidgetPDial(120, 40, 30, 30, "I.del"); - revp3->tooltip("Initial Delay"); - revp3->box(FL_ROUND_UP_BOX); - revp3->color(FL_BACKGROUND_COLOR); - revp3->selection_color(FL_INACTIVE_COLOR); - revp3->labeltype(FL_NORMAL_LABEL); - revp3->labelfont(1); - revp3->labelsize(11); - revp3->labelcolor(FL_FOREGROUND_COLOR); - revp3->maximum(127); - revp3->callback((Fl_Callback*)cb_revp3); - revp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* revp3 - { revp4 = new WidgetPDial(155, 40, 30, 30, "I.delfb"); - revp4->tooltip("Initial Delay Feedback"); - revp4->box(FL_ROUND_UP_BOX); - revp4->color(FL_BACKGROUND_COLOR); - revp4->selection_color(FL_INACTIVE_COLOR); - revp4->labeltype(FL_NORMAL_LABEL); - revp4->labelfont(1); - revp4->labelsize(11); - revp4->labelcolor(FL_FOREGROUND_COLOR); - revp4->maximum(127); - revp4->callback((Fl_Callback*)cb_revp4); - revp4->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp4->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp4 - { WidgetPDial* o = revp12 = new WidgetPDial(200, 40, 30, 30, "bw"); - revp12->box(FL_ROUND_UP_BOX); - revp12->color(FL_BACKGROUND_COLOR); - revp12->selection_color(FL_INACTIVE_COLOR); - revp12->labeltype(FL_NORMAL_LABEL); - revp12->labelfont(1); - revp12->labelsize(11); - revp12->labelcolor(FL_FOREGROUND_COLOR); - revp12->maximum(127); - revp12->callback((Fl_Callback*)cb_revp12); - revp12->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp12->when(FL_WHEN_RELEASE); - revp12->deactivate(); - if (eff->geteffectpar(10)==2) o->activate(); - } // WidgetPDial* revp12 - { revp6 = new WidgetPDial(235, 40, 30, 30, "E/R"); - revp6->box(FL_ROUND_UP_BOX); - revp6->color(FL_BACKGROUND_COLOR); - revp6->selection_color(FL_INACTIVE_COLOR); - revp6->labeltype(FL_NORMAL_LABEL); - revp6->labelfont(1); - revp6->labelsize(11); - revp6->labelcolor(FL_FOREGROUND_COLOR); - revp6->maximum(127); - revp6->callback((Fl_Callback*)cb_revp6); - revp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp6->when(FL_WHEN_CHANGED); - revp6->deactivate(); - } // WidgetPDial* revp6 - { revp7 = new WidgetPDial(270, 40, 30, 30, "LPF"); - revp7->tooltip("Low Pass Filter"); - revp7->box(FL_ROUND_UP_BOX); - revp7->color(FL_BACKGROUND_COLOR); - revp7->selection_color(FL_INACTIVE_COLOR); - revp7->labeltype(FL_NORMAL_LABEL); - revp7->labelfont(1); - revp7->labelsize(11); - revp7->labelcolor(FL_FOREGROUND_COLOR); - revp7->maximum(127); - revp7->callback((Fl_Callback*)cb_revp7); - revp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp7 - { revp8 = new WidgetPDial(305, 40, 30, 30, "HPF"); - revp8->tooltip("High Pass Filter"); - revp8->box(FL_ROUND_UP_BOX); - revp8->color(FL_BACKGROUND_COLOR); - revp8->selection_color(FL_INACTIVE_COLOR); - revp8->labeltype(FL_NORMAL_LABEL); - revp8->labelfont(1); - revp8->labelsize(11); - revp8->labelcolor(FL_FOREGROUND_COLOR); - revp8->maximum(127); - revp8->callback((Fl_Callback*)cb_revp8); - revp8->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp8->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp8 - { revp9 = new WidgetPDial(340, 40, 30, 30, "Damp"); - revp9->tooltip("Dampening"); - revp9->box(FL_ROUND_UP_BOX); - revp9->color(FL_BACKGROUND_COLOR); - revp9->selection_color(FL_INACTIVE_COLOR); - revp9->labeltype(FL_NORMAL_LABEL); - revp9->labelfont(1); - revp9->labelsize(11); - revp9->labelcolor(FL_FOREGROUND_COLOR); - revp9->minimum(64); - revp9->maximum(127); - revp9->step(1); - revp9->callback((Fl_Callback*)cb_revp9); - revp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp9 - { revp11 = new WidgetPDial(200, 10, 25, 25, "R.S."); - revp11->tooltip("RoomSize"); - revp11->box(FL_ROUND_UP_BOX); - revp11->color(FL_BACKGROUND_COLOR); - revp11->selection_color(FL_INACTIVE_COLOR); - revp11->labeltype(FL_NORMAL_LABEL); - revp11->labelfont(1); - revp11->labelsize(8); - revp11->labelcolor(FL_FOREGROUND_COLOR); - revp11->minimum(1); - revp11->maximum(127); - revp11->step(1); - revp11->callback((Fl_Callback*)cb_revp11); - revp11->align(Fl_Align(FL_ALIGN_RIGHT)); - revp11->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp11 - effreverbwindow->end(); - } // Fl_Group* effreverbwindow - return effreverbwindow; -} - -Fl_Group* EffUI::make_echo_window() { - { effechowindow = new Fl_Group(0, 0, 380, 95); - effechowindow->box(FL_PLASTIC_UP_BOX); - effechowindow->color((Fl_Color)221); - effechowindow->selection_color(FL_BACKGROUND_COLOR); - effechowindow->labeltype(FL_NO_LABEL); - effechowindow->labelfont(1); - effechowindow->labelsize(14); - effechowindow->labelcolor(FL_FOREGROUND_COLOR); - effechowindow->user_data((void*)(this)); - effechowindow->align(Fl_Align(FL_ALIGN_TOP)); - effechowindow->when(FL_WHEN_RELEASE); - { echop = new Fl_Choice(11, 15, 95, 15, "Preset"); - echop->down_box(FL_BORDER_BOX); - echop->color((Fl_Color)14); - echop->selection_color(FL_FOREGROUND_COLOR); - echop->labelfont(1); - echop->labelsize(10); - echop->textfont(1); - echop->textsize(10); - echop->textcolor(FL_BACKGROUND2_COLOR); - echop->callback((Fl_Callback*)cb_echop); - echop->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - echop->menu(menu_echop); - } // Fl_Choice* echop - { Fl_Text_Display* o = new Fl_Text_Display(295, 10, 10, 20, "Echo"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { echop0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - echop0->tooltip("Effect Volume"); - echop0->box(FL_ROUND_UP_BOX); - echop0->color(FL_BACKGROUND_COLOR); - echop0->selection_color(FL_INACTIVE_COLOR); - echop0->labeltype(FL_NORMAL_LABEL); - echop0->labelfont(1); - echop0->labelsize(11); - echop0->labelcolor(FL_FOREGROUND_COLOR); - echop0->maximum(127); - echop0->callback((Fl_Callback*)cb_echop0); - echop0->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop0->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop0 - { echop1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - echop1->box(FL_ROUND_UP_BOX); - echop1->color(FL_BACKGROUND_COLOR); - echop1->selection_color(FL_INACTIVE_COLOR); - echop1->labeltype(FL_NORMAL_LABEL); - echop1->labelfont(1); - echop1->labelsize(11); - echop1->labelcolor(FL_FOREGROUND_COLOR); - echop1->maximum(127); - echop1->callback((Fl_Callback*)cb_echop1); - echop1->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop1->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop1 - { echop2 = new WidgetPDial(80, 40, 30, 30, "Delay"); - echop2->box(FL_ROUND_UP_BOX); - echop2->color(FL_BACKGROUND_COLOR); - echop2->selection_color(FL_INACTIVE_COLOR); - echop2->labeltype(FL_NORMAL_LABEL); - echop2->labelfont(1); - echop2->labelsize(11); - echop2->labelcolor(FL_FOREGROUND_COLOR); - echop2->maximum(127); - echop2->callback((Fl_Callback*)cb_echop2); - echop2->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop2->when(FL_WHEN_RELEASE); - } // WidgetPDial* echop2 - { echop3 = new WidgetPDial(120, 40, 30, 30, "LRdl."); - echop3->tooltip("Delay Between L/R"); - echop3->box(FL_ROUND_UP_BOX); - echop3->color(FL_BACKGROUND_COLOR); - echop3->selection_color(FL_INACTIVE_COLOR); - echop3->labeltype(FL_NORMAL_LABEL); - echop3->labelfont(1); - echop3->labelsize(11); - echop3->labelcolor(FL_FOREGROUND_COLOR); - echop3->maximum(127); - echop3->callback((Fl_Callback*)cb_echop3); - echop3->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop3->when(FL_WHEN_RELEASE); - } // WidgetPDial* echop3 - { echop4 = new WidgetPDial(155, 40, 30, 30, "LRc."); - echop4->tooltip("L/R Crossover"); - echop4->box(FL_ROUND_UP_BOX); - echop4->color(FL_BACKGROUND_COLOR); - echop4->selection_color(FL_INACTIVE_COLOR); - echop4->labeltype(FL_NORMAL_LABEL); - echop4->labelfont(1); - echop4->labelsize(11); - echop4->labelcolor(FL_FOREGROUND_COLOR); - echop4->maximum(127); - echop4->callback((Fl_Callback*)cb_echop4); - echop4->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop4->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop4 - { echop5 = new WidgetPDial(195, 40, 30, 30, "Fb."); - echop5->tooltip("Feedback"); - echop5->box(FL_ROUND_UP_BOX); - echop5->color(FL_BACKGROUND_COLOR); - echop5->selection_color(FL_INACTIVE_COLOR); - echop5->labeltype(FL_NORMAL_LABEL); - echop5->labelfont(1); - echop5->labelsize(11); - echop5->labelcolor(FL_FOREGROUND_COLOR); - echop5->maximum(127); - echop5->callback((Fl_Callback*)cb_echop5); - echop5->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop5->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop5 - { echop6 = new WidgetPDial(235, 40, 30, 30, "Damp"); - echop6->tooltip("Dampening"); - echop6->box(FL_ROUND_UP_BOX); - echop6->color(FL_BACKGROUND_COLOR); - echop6->selection_color(FL_INACTIVE_COLOR); - echop6->labeltype(FL_NORMAL_LABEL); - echop6->labelfont(1); - echop6->labelsize(11); - echop6->labelcolor(FL_FOREGROUND_COLOR); - echop6->maximum(127); - echop6->callback((Fl_Callback*)cb_echop6); - echop6->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop6->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop6 - effechowindow->end(); - } // Fl_Group* effechowindow - return effechowindow; -} - -Fl_Group* EffUI::make_chorus_window() { - { effchoruswindow = new Fl_Group(0, 0, 380, 95); - effchoruswindow->box(FL_PLASTIC_UP_BOX); - effchoruswindow->color((Fl_Color)221); - effchoruswindow->selection_color(FL_BACKGROUND_COLOR); - effchoruswindow->labeltype(FL_NO_LABEL); - effchoruswindow->labelfont(1); - effchoruswindow->labelsize(14); - effchoruswindow->labelcolor(FL_FOREGROUND_COLOR); - effchoruswindow->user_data((void*)(this)); - effchoruswindow->align(Fl_Align(FL_ALIGN_TOP)); - effchoruswindow->when(FL_WHEN_RELEASE); - { chorusp = new Fl_Choice(10, 15, 90, 15, "Preset"); - chorusp->down_box(FL_BORDER_BOX); - chorusp->color((Fl_Color)14); - chorusp->selection_color(FL_FOREGROUND_COLOR); - chorusp->labelfont(1); - chorusp->labelsize(10); - chorusp->textfont(1); - chorusp->textsize(10); - chorusp->textcolor(FL_BACKGROUND2_COLOR); - chorusp->callback((Fl_Callback*)cb_chorusp); - chorusp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - chorusp->menu(menu_chorusp); - } // Fl_Choice* chorusp - { Fl_Text_Display* o = new Fl_Text_Display(265, 10, 10, 20, "Chorus"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { chorusp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - chorusp0->box(FL_ROUND_UP_BOX); - chorusp0->color(FL_BACKGROUND_COLOR); - chorusp0->selection_color(FL_INACTIVE_COLOR); - chorusp0->labeltype(FL_NORMAL_LABEL); - chorusp0->labelfont(1); - chorusp0->labelsize(11); - chorusp0->labelcolor(FL_FOREGROUND_COLOR); - chorusp0->maximum(127); - chorusp0->callback((Fl_Callback*)cb_chorusp0); - chorusp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp0 - { chorusp1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - chorusp1->box(FL_ROUND_UP_BOX); - chorusp1->color(FL_BACKGROUND_COLOR); - chorusp1->selection_color(FL_INACTIVE_COLOR); - chorusp1->labeltype(FL_NORMAL_LABEL); - chorusp1->labelfont(1); - chorusp1->labelsize(11); - chorusp1->labelcolor(FL_FOREGROUND_COLOR); - chorusp1->maximum(127); - chorusp1->callback((Fl_Callback*)cb_chorusp1); - chorusp1->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp1->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp1 - { chorusp2 = new WidgetPDial(85, 40, 30, 30, "Freq"); - chorusp2->tooltip("LFO Frequency"); - chorusp2->box(FL_ROUND_UP_BOX); - chorusp2->color(FL_BACKGROUND_COLOR); - chorusp2->selection_color(FL_INACTIVE_COLOR); - chorusp2->labeltype(FL_NORMAL_LABEL); - chorusp2->labelfont(1); - chorusp2->labelsize(11); - chorusp2->labelcolor(FL_FOREGROUND_COLOR); - chorusp2->maximum(127); - chorusp2->callback((Fl_Callback*)cb_chorusp2); - chorusp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp2 - { chorusp3 = new WidgetPDial(120, 40, 30, 30, "Rnd"); - chorusp3->tooltip("LFO Randomness"); - chorusp3->box(FL_ROUND_UP_BOX); - chorusp3->color(FL_BACKGROUND_COLOR); - chorusp3->selection_color(FL_INACTIVE_COLOR); - chorusp3->labeltype(FL_NORMAL_LABEL); - chorusp3->labelfont(1); - chorusp3->labelsize(11); - chorusp3->labelcolor(FL_FOREGROUND_COLOR); - chorusp3->maximum(127); - chorusp3->callback((Fl_Callback*)cb_chorusp3); - chorusp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* chorusp3 - { chorusp5 = new WidgetPDial(200, 40, 30, 30, "St.df"); - chorusp5->tooltip("L/R Phase Shift"); - chorusp5->box(FL_ROUND_UP_BOX); - chorusp5->color(FL_BACKGROUND_COLOR); - chorusp5->selection_color(FL_INACTIVE_COLOR); - chorusp5->labeltype(FL_NORMAL_LABEL); - chorusp5->labelfont(1); - chorusp5->labelsize(11); - chorusp5->labelcolor(FL_FOREGROUND_COLOR); - chorusp5->maximum(127); - chorusp5->callback((Fl_Callback*)cb_chorusp5); - chorusp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp5->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp5 - { chorusp6 = new WidgetPDial(235, 40, 30, 30, "Dpth"); - chorusp6->tooltip("LFO Depth"); - chorusp6->box(FL_ROUND_UP_BOX); - chorusp6->color(FL_BACKGROUND_COLOR); - chorusp6->selection_color(FL_INACTIVE_COLOR); - chorusp6->labeltype(FL_NORMAL_LABEL); - chorusp6->labelfont(1); - chorusp6->labelsize(11); - chorusp6->labelcolor(FL_FOREGROUND_COLOR); - chorusp6->maximum(127); - chorusp6->callback((Fl_Callback*)cb_chorusp6); - chorusp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp6 - { chorusp7 = new WidgetPDial(270, 40, 30, 30, "Delay"); - chorusp7->box(FL_ROUND_UP_BOX); - chorusp7->color(FL_BACKGROUND_COLOR); - chorusp7->selection_color(FL_INACTIVE_COLOR); - chorusp7->labeltype(FL_NORMAL_LABEL); - chorusp7->labelfont(1); - chorusp7->labelsize(11); - chorusp7->labelcolor(FL_FOREGROUND_COLOR); - chorusp7->maximum(127); - chorusp7->callback((Fl_Callback*)cb_chorusp7); - chorusp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp7 - { chorusp8 = new WidgetPDial(305, 40, 30, 30, "Fb"); - chorusp8->tooltip("Feedback"); - chorusp8->box(FL_ROUND_UP_BOX); - chorusp8->color(FL_BACKGROUND_COLOR); - chorusp8->selection_color(FL_INACTIVE_COLOR); - chorusp8->labeltype(FL_NORMAL_LABEL); - chorusp8->labelfont(1); - chorusp8->labelsize(11); - chorusp8->labelcolor(FL_FOREGROUND_COLOR); - chorusp8->maximum(127); - chorusp8->callback((Fl_Callback*)cb_chorusp8); - chorusp8->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp8->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp8 - { chorusp9 = new WidgetPDial(340, 40, 30, 30, "L/R"); - chorusp9->tooltip("Channel Routing"); - chorusp9->box(FL_ROUND_UP_BOX); - chorusp9->color(FL_BACKGROUND_COLOR); - chorusp9->selection_color(FL_INACTIVE_COLOR); - chorusp9->labeltype(FL_NORMAL_LABEL); - chorusp9->labelfont(1); - chorusp9->labelsize(11); - chorusp9->labelcolor(FL_FOREGROUND_COLOR); - chorusp9->maximum(127); - chorusp9->callback((Fl_Callback*)cb_chorusp9); - chorusp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp9 - { Fl_Check_Button* o = new Fl_Check_Button(120, 10, 55, 20, "Flange"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->color((Fl_Color)230); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Flange); - o->hide(); - o->deactivate(); - o->value(eff->geteffectpar(10)); - } // Fl_Check_Button* o - { chorusp11 = new Fl_Check_Button(185, 10, 70, 20, "Substract"); - chorusp11->tooltip("inverts the output"); - chorusp11->box(FL_THIN_UP_BOX); - chorusp11->down_box(FL_DOWN_BOX); - chorusp11->color((Fl_Color)230); - chorusp11->labelfont(1); - chorusp11->labelsize(10); - chorusp11->callback((Fl_Callback*)cb_chorusp11); - } // Fl_Check_Button* chorusp11 - { chorusp4 = new Fl_Choice(155, 50, 40, 15, "LFO type"); - chorusp4->tooltip("LFO function"); - chorusp4->down_box(FL_BORDER_BOX); - chorusp4->labelfont(1); - chorusp4->labelsize(10); - chorusp4->textsize(8); - chorusp4->callback((Fl_Callback*)cb_chorusp4); - chorusp4->align(Fl_Align(130)); - chorusp4->menu(menu_chorusp4); - } // Fl_Choice* chorusp4 - effchoruswindow->end(); - } // Fl_Group* effchoruswindow - return effchoruswindow; -} - -Fl_Group* EffUI::make_phaser_window() { - { effphaserwindow = new Fl_Group(0, 0, 380, 95); - effphaserwindow->box(FL_PLASTIC_UP_BOX); - effphaserwindow->color((Fl_Color)221); - effphaserwindow->selection_color(FL_BACKGROUND_COLOR); - effphaserwindow->labeltype(FL_NO_LABEL); - effphaserwindow->labelfont(1); - effphaserwindow->labelsize(14); - effphaserwindow->labelcolor(FL_FOREGROUND_COLOR); - effphaserwindow->user_data((void*)(this)); - effphaserwindow->align(Fl_Align(FL_ALIGN_TOP)); - effphaserwindow->when(FL_WHEN_RELEASE); - { phaserp = new Fl_Choice(10, 15, 100, 15, "Preset"); - phaserp->down_box(FL_BORDER_BOX); - phaserp->color((Fl_Color)14); - phaserp->selection_color(FL_FOREGROUND_COLOR); - phaserp->labelfont(1); - phaserp->labelsize(10); - phaserp->textfont(1); - phaserp->textsize(10); - phaserp->textcolor(FL_BACKGROUND2_COLOR); - phaserp->callback((Fl_Callback*)cb_phaserp); - phaserp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - phaserp->menu(menu_phaserp); - } // Fl_Choice* phaserp - { Fl_Text_Display* o = new Fl_Text_Display(275, 10, 10, 20, "Phaser"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { phaserp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - phaserp0->tooltip("Effect Volume"); - phaserp0->box(FL_ROUND_UP_BOX); - phaserp0->color(FL_BACKGROUND_COLOR); - phaserp0->selection_color(FL_INACTIVE_COLOR); - phaserp0->labeltype(FL_NORMAL_LABEL); - phaserp0->labelfont(1); - phaserp0->labelsize(11); - phaserp0->labelcolor(FL_FOREGROUND_COLOR); - phaserp0->maximum(127); - phaserp0->callback((Fl_Callback*)cb_phaserp0); - phaserp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp0 - { phaserp1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - phaserp1->box(FL_ROUND_UP_BOX); - phaserp1->color(FL_BACKGROUND_COLOR); - phaserp1->selection_color(FL_INACTIVE_COLOR); - phaserp1->labeltype(FL_NORMAL_LABEL); - phaserp1->labelfont(1); - phaserp1->labelsize(11); - phaserp1->labelcolor(FL_FOREGROUND_COLOR); - phaserp1->maximum(127); - phaserp1->callback((Fl_Callback*)cb_phaserp1); - phaserp1->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp1->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp1 - { phaserp2 = new WidgetPDial(85, 45, 25, 25, "Freq"); - phaserp2->tooltip("LFO frequency"); - phaserp2->box(FL_ROUND_UP_BOX); - phaserp2->color(FL_BACKGROUND_COLOR); - phaserp2->selection_color(FL_INACTIVE_COLOR); - phaserp2->labeltype(FL_NORMAL_LABEL); - phaserp2->labelfont(1); - phaserp2->labelsize(11); - phaserp2->labelcolor(FL_FOREGROUND_COLOR); - phaserp2->maximum(127); - phaserp2->callback((Fl_Callback*)cb_phaserp2); - phaserp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp2 - { phaserp3 = new WidgetPDial(120, 45, 25, 25, "Rnd"); - phaserp3->tooltip("LFO randomness"); - phaserp3->box(FL_ROUND_UP_BOX); - phaserp3->color(FL_BACKGROUND_COLOR); - phaserp3->selection_color(FL_INACTIVE_COLOR); - phaserp3->labeltype(FL_NORMAL_LABEL); - phaserp3->labelfont(1); - phaserp3->labelsize(11); - phaserp3->labelcolor(FL_FOREGROUND_COLOR); - phaserp3->maximum(127); - phaserp3->callback((Fl_Callback*)cb_phaserp3); - phaserp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* phaserp3 - { phaserp4 = new Fl_Choice(245, 55, 40, 15, "LFO"); - phaserp4->tooltip("LFO function"); - phaserp4->down_box(FL_BORDER_BOX); - phaserp4->labelfont(1); - phaserp4->labelsize(10); - phaserp4->textsize(8); - phaserp4->callback((Fl_Callback*)cb_phaserp4); - phaserp4->align(Fl_Align(130)); - phaserp4->menu(menu_phaserp4); - } // Fl_Choice* phaserp4 - { phaserp5 = new WidgetPDial(155, 45, 25, 25, "St.df"); - phaserp5->tooltip("Left/Right Channel Phase Shift"); - phaserp5->box(FL_ROUND_UP_BOX); - phaserp5->color(FL_BACKGROUND_COLOR); - phaserp5->selection_color(FL_INACTIVE_COLOR); - phaserp5->labeltype(FL_NORMAL_LABEL); - phaserp5->labelfont(1); - phaserp5->labelsize(11); - phaserp5->labelcolor(FL_FOREGROUND_COLOR); - phaserp5->maximum(127); - phaserp5->callback((Fl_Callback*)cb_phaserp5); - phaserp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp5->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp5 - { phaserp6 = new WidgetPDial(120, 5, 25, 25, "Dpth"); - phaserp6->tooltip("LFO Depth"); - phaserp6->box(FL_ROUND_UP_BOX); - phaserp6->color(FL_BACKGROUND_COLOR); - phaserp6->selection_color(FL_INACTIVE_COLOR); - phaserp6->labeltype(FL_NORMAL_LABEL); - phaserp6->labelfont(1); - phaserp6->labelsize(10); - phaserp6->labelcolor(FL_FOREGROUND_COLOR); - phaserp6->maximum(127); - phaserp6->callback((Fl_Callback*)cb_phaserp6); - phaserp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp6 - { phaserp7 = new WidgetPDial(185, 45, 25, 25, "Fb"); - phaserp7->tooltip("Feedback"); - phaserp7->box(FL_ROUND_UP_BOX); - phaserp7->color(FL_BACKGROUND_COLOR); - phaserp7->selection_color(FL_INACTIVE_COLOR); - phaserp7->labeltype(FL_NORMAL_LABEL); - phaserp7->labelfont(1); - phaserp7->labelsize(11); - phaserp7->labelcolor(FL_FOREGROUND_COLOR); - phaserp7->maximum(127); - phaserp7->callback((Fl_Callback*)cb_phaserp7); - phaserp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp7 - { Fl_Counter* o = phaserp8 = new Fl_Counter(290, 55, 35, 15, "Stages"); - phaserp8->type(1); - phaserp8->labelfont(1); - phaserp8->labelsize(11); - phaserp8->minimum(0); - phaserp8->maximum(127); - phaserp8->step(1); - phaserp8->callback((Fl_Callback*)cb_phaserp8); - o->range(1,MAX_PHASER_STAGES); - } // Fl_Counter* phaserp8 - { phaserp9 = new WidgetPDial(215, 45, 25, 25, "L/R"); - phaserp9->tooltip("Channel Routing"); - phaserp9->box(FL_ROUND_UP_BOX); - phaserp9->color(FL_BACKGROUND_COLOR); - phaserp9->selection_color(FL_INACTIVE_COLOR); - phaserp9->labeltype(FL_NORMAL_LABEL); - phaserp9->labelfont(1); - phaserp9->labelsize(11); - phaserp9->labelcolor(FL_FOREGROUND_COLOR); - phaserp9->maximum(127); - phaserp9->callback((Fl_Callback*)cb_phaserp9); - phaserp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp9 - { phaserp10 = new Fl_Check_Button(200, 10, 74, 20, "Substract"); - phaserp10->tooltip("inverts output"); - phaserp10->box(FL_THIN_UP_BOX); - phaserp10->down_box(FL_DOWN_BOX); - phaserp10->color((Fl_Color)230); - phaserp10->labelfont(1); - phaserp10->labelsize(10); - phaserp10->callback((Fl_Callback*)cb_phaserp10); - } // Fl_Check_Button* phaserp10 - { phaserp11 = new WidgetPDial(155, 5, 25, 25, "Phase"); - phaserp11->box(FL_ROUND_UP_BOX); - phaserp11->color(FL_BACKGROUND_COLOR); - phaserp11->selection_color(FL_INACTIVE_COLOR); - phaserp11->labeltype(FL_NORMAL_LABEL); - phaserp11->labelfont(1); - phaserp11->labelsize(10); - phaserp11->labelcolor(FL_FOREGROUND_COLOR); - phaserp11->maximum(127); - phaserp11->callback((Fl_Callback*)cb_phaserp11); - phaserp11->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp11->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp11 - { phaserp12 = new Fl_Check_Button(245, 35, 55, 15, "hyp."); - phaserp12->tooltip("hyper"); - phaserp12->down_box(FL_DOWN_BOX); - phaserp12->callback((Fl_Callback*)cb_phaserp12); - } // Fl_Check_Button* phaserp12 - { phaserp13 = new WidgetPDial(340, 50, 25, 25, "dist"); - phaserp13->tooltip("Distortion"); - phaserp13->box(FL_ROUND_UP_BOX); - phaserp13->color(FL_BACKGROUND_COLOR); - phaserp13->selection_color(FL_INACTIVE_COLOR); - phaserp13->labeltype(FL_NORMAL_LABEL); - phaserp13->labelfont(1); - phaserp13->labelsize(11); - phaserp13->labelcolor(FL_FOREGROUND_COLOR); - phaserp13->maximum(127); - phaserp13->callback((Fl_Callback*)cb_phaserp13); - phaserp13->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp13->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp13 - { phaserp14 = new Fl_Check_Button(305, 35, 70, 15, "Analog"); - phaserp14->down_box(FL_DOWN_BOX); - phaserp14->callback((Fl_Callback*)cb_phaserp14); - } // Fl_Check_Button* phaserp14 - effphaserwindow->end(); - } // Fl_Group* effphaserwindow - return effphaserwindow; -} - -Fl_Group* EffUI::make_alienwah_window() { - { effalienwahwindow = new Fl_Group(0, 0, 380, 95); - effalienwahwindow->box(FL_PLASTIC_UP_BOX); - effalienwahwindow->color((Fl_Color)221); - effalienwahwindow->selection_color(FL_BACKGROUND_COLOR); - effalienwahwindow->labeltype(FL_NO_LABEL); - effalienwahwindow->labelfont(1); - effalienwahwindow->labelsize(14); - effalienwahwindow->labelcolor(FL_FOREGROUND_COLOR); - effalienwahwindow->user_data((void*)(this)); - effalienwahwindow->align(Fl_Align(FL_ALIGN_TOP)); - effalienwahwindow->when(FL_WHEN_RELEASE); - { awp = new Fl_Choice(10, 15, 90, 15, "Preset"); - awp->down_box(FL_BORDER_BOX); - awp->color((Fl_Color)14); - awp->selection_color(FL_FOREGROUND_COLOR); - awp->labelfont(1); - awp->labelsize(10); - awp->textfont(1); - awp->textsize(10); - awp->textcolor(FL_BACKGROUND2_COLOR); - awp->callback((Fl_Callback*)cb_awp); - awp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - awp->menu(menu_awp); - } // Fl_Choice* awp - { Fl_Text_Display* o = new Fl_Text_Display(245, 10, 10, 20, "AlienWah"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { awp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - awp0->tooltip("Effect Volume"); - awp0->box(FL_ROUND_UP_BOX); - awp0->color(FL_BACKGROUND_COLOR); - awp0->selection_color(FL_INACTIVE_COLOR); - awp0->labeltype(FL_NORMAL_LABEL); - awp0->labelfont(1); - awp0->labelsize(11); - awp0->labelcolor(FL_FOREGROUND_COLOR); - awp0->maximum(127); - awp0->callback((Fl_Callback*)cb_awp0); - awp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp0 - { awp1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - awp1->box(FL_ROUND_UP_BOX); - awp1->color(FL_BACKGROUND_COLOR); - awp1->selection_color(FL_INACTIVE_COLOR); - awp1->labeltype(FL_NORMAL_LABEL); - awp1->labelfont(1); - awp1->labelsize(11); - awp1->labelcolor(FL_FOREGROUND_COLOR); - awp1->maximum(127); - awp1->callback((Fl_Callback*)cb_awp1); - awp1->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp1->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp1 - { awp2 = new WidgetPDial(85, 40, 30, 30, "Freq"); - awp2->tooltip("LFO Frequency"); - awp2->box(FL_ROUND_UP_BOX); - awp2->color(FL_BACKGROUND_COLOR); - awp2->selection_color(FL_INACTIVE_COLOR); - awp2->labeltype(FL_NORMAL_LABEL); - awp2->labelfont(1); - awp2->labelsize(11); - awp2->labelcolor(FL_FOREGROUND_COLOR); - awp2->maximum(127); - awp2->callback((Fl_Callback*)cb_awp2); - awp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp2 - { awp3 = new WidgetPDial(120, 40, 30, 30, "Rnd"); - awp3->tooltip("LFO Randomness"); - awp3->box(FL_ROUND_UP_BOX); - awp3->color(FL_BACKGROUND_COLOR); - awp3->selection_color(FL_INACTIVE_COLOR); - awp3->labeltype(FL_NORMAL_LABEL); - awp3->labelfont(1); - awp3->labelsize(11); - awp3->labelcolor(FL_FOREGROUND_COLOR); - awp3->maximum(127); - awp3->callback((Fl_Callback*)cb_awp3); - awp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* awp3 - { awp5 = new WidgetPDial(200, 40, 30, 30, "St.df"); - awp5->tooltip("Left/Right Channel Phase Shift"); - awp5->box(FL_ROUND_UP_BOX); - awp5->color(FL_BACKGROUND_COLOR); - awp5->selection_color(FL_INACTIVE_COLOR); - awp5->labeltype(FL_NORMAL_LABEL); - awp5->labelfont(1); - awp5->labelsize(11); - awp5->labelcolor(FL_FOREGROUND_COLOR); - awp5->maximum(127); - awp5->callback((Fl_Callback*)cb_awp5); - awp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp5->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp5 - { awp6 = new WidgetPDial(235, 40, 30, 30, "Dpth"); - awp6->tooltip("Depth"); - awp6->box(FL_ROUND_UP_BOX); - awp6->color(FL_BACKGROUND_COLOR); - awp6->selection_color(FL_INACTIVE_COLOR); - awp6->labeltype(FL_NORMAL_LABEL); - awp6->labelfont(1); - awp6->labelsize(11); - awp6->labelcolor(FL_FOREGROUND_COLOR); - awp6->maximum(127); - awp6->callback((Fl_Callback*)cb_awp6); - awp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp6 - { awp7 = new WidgetPDial(270, 40, 30, 30, "Fb"); - awp7->tooltip("Feedback"); - awp7->box(FL_ROUND_UP_BOX); - awp7->color(FL_BACKGROUND_COLOR); - awp7->selection_color(FL_INACTIVE_COLOR); - awp7->labeltype(FL_NORMAL_LABEL); - awp7->labelfont(1); - awp7->labelsize(11); - awp7->labelcolor(FL_FOREGROUND_COLOR); - awp7->maximum(127); - awp7->callback((Fl_Callback*)cb_awp7); - awp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp7 - { awp9 = new WidgetPDial(345, 40, 30, 30, "L/R"); - awp9->box(FL_ROUND_UP_BOX); - awp9->color(FL_BACKGROUND_COLOR); - awp9->selection_color(FL_INACTIVE_COLOR); - awp9->labeltype(FL_NORMAL_LABEL); - awp9->labelfont(1); - awp9->labelsize(11); - awp9->labelcolor(FL_FOREGROUND_COLOR); - awp9->maximum(127); - awp9->callback((Fl_Callback*)cb_awp9); - awp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp9 - { awp4 = new Fl_Choice(155, 50, 40, 15, "LFO type"); - awp4->tooltip("LFO function"); - awp4->down_box(FL_BORDER_BOX); - awp4->labelfont(1); - awp4->labelsize(10); - awp4->textsize(8); - awp4->callback((Fl_Callback*)cb_awp4); - awp4->align(Fl_Align(130)); - awp4->menu(menu_awp4); - } // Fl_Choice* awp4 - { awp10 = new WidgetPDial(160, 5, 30, 30, "Phase"); - awp10->box(FL_ROUND_UP_BOX); - awp10->color(FL_BACKGROUND_COLOR); - awp10->selection_color(FL_INACTIVE_COLOR); - awp10->labeltype(FL_NORMAL_LABEL); - awp10->labelfont(1); - awp10->labelsize(11); - awp10->labelcolor(FL_FOREGROUND_COLOR); - awp10->maximum(127); - awp10->callback((Fl_Callback*)cb_awp10); - awp10->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp10->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp10 - { Fl_Counter* o = awp8 = new Fl_Counter(305, 55, 35, 15, "Delay"); - awp8->type(1); - awp8->labelfont(1); - awp8->labelsize(11); - awp8->minimum(0); - awp8->maximum(127); - awp8->step(1); - awp8->callback((Fl_Callback*)cb_awp8); - o->range(1,MAX_ALIENWAH_DELAY); - } // Fl_Counter* awp8 - effalienwahwindow->end(); - } // Fl_Group* effalienwahwindow - return effalienwahwindow; -} - -Fl_Group* EffUI::make_distorsion_window() { - { effdistorsionwindow = new Fl_Group(0, 0, 380, 95); - effdistorsionwindow->box(FL_PLASTIC_UP_BOX); - effdistorsionwindow->color((Fl_Color)221); - effdistorsionwindow->selection_color(FL_BACKGROUND_COLOR); - effdistorsionwindow->labeltype(FL_NO_LABEL); - effdistorsionwindow->labelfont(1); - effdistorsionwindow->labelsize(14); - effdistorsionwindow->labelcolor(FL_FOREGROUND_COLOR); - effdistorsionwindow->user_data((void*)(this)); - effdistorsionwindow->align(Fl_Align(FL_ALIGN_TOP)); - effdistorsionwindow->when(FL_WHEN_RELEASE); - { distp = new Fl_Choice(11, 15, 95, 15, "Preset"); - distp->down_box(FL_BORDER_BOX); - distp->color((Fl_Color)14); - distp->selection_color(FL_FOREGROUND_COLOR); - distp->labelfont(1); - distp->labelsize(10); - distp->textfont(1); - distp->textsize(10); - distp->textcolor(FL_BACKGROUND2_COLOR); - distp->callback((Fl_Callback*)cb_distp); - distp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - distp->menu(menu_distp); - } // Fl_Choice* distp - { Fl_Text_Display* o = new Fl_Text_Display(230, 10, 10, 20, "Distortion"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { distp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - distp0->tooltip("Effect Volume"); - distp0->box(FL_ROUND_UP_BOX); - distp0->color(FL_BACKGROUND_COLOR); - distp0->selection_color(FL_INACTIVE_COLOR); - distp0->labeltype(FL_NORMAL_LABEL); - distp0->labelfont(1); - distp0->labelsize(11); - distp0->labelcolor(FL_FOREGROUND_COLOR); - distp0->maximum(127); - distp0->callback((Fl_Callback*)cb_distp0); - distp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp0 - { distp1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - distp1->box(FL_ROUND_UP_BOX); - distp1->color(FL_BACKGROUND_COLOR); - distp1->selection_color(FL_INACTIVE_COLOR); - distp1->labeltype(FL_NORMAL_LABEL); - distp1->labelfont(1); - distp1->labelsize(11); - distp1->labelcolor(FL_FOREGROUND_COLOR); - distp1->maximum(127); - distp1->callback((Fl_Callback*)cb_distp1); - distp1->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp1->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp1 - { distp2 = new WidgetPDial(80, 40, 30, 30, "LRc."); - distp2->tooltip("L/R Mix"); - distp2->box(FL_ROUND_UP_BOX); - distp2->color(FL_BACKGROUND_COLOR); - distp2->selection_color(FL_INACTIVE_COLOR); - distp2->labeltype(FL_NORMAL_LABEL); - distp2->labelfont(1); - distp2->labelsize(11); - distp2->labelcolor(FL_FOREGROUND_COLOR); - distp2->maximum(127); - distp2->callback((Fl_Callback*)cb_distp2); - distp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp2->when(FL_WHEN_RELEASE); - } // WidgetPDial* distp2 - { distp3 = new WidgetPDial(120, 40, 30, 30, "Drive"); - distp3->tooltip("Input Amplification"); - distp3->box(FL_ROUND_UP_BOX); - distp3->color(FL_BACKGROUND_COLOR); - distp3->selection_color(FL_INACTIVE_COLOR); - distp3->labeltype(FL_NORMAL_LABEL); - distp3->labelfont(1); - distp3->labelsize(11); - distp3->labelcolor(FL_FOREGROUND_COLOR); - distp3->maximum(127); - distp3->callback((Fl_Callback*)cb_distp3); - distp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* distp3 - { distp4 = new WidgetPDial(155, 40, 30, 30, "Level"); - distp4->tooltip("Output Amplification"); - distp4->box(FL_ROUND_UP_BOX); - distp4->color(FL_BACKGROUND_COLOR); - distp4->selection_color(FL_INACTIVE_COLOR); - distp4->labeltype(FL_NORMAL_LABEL); - distp4->labelfont(1); - distp4->labelsize(11); - distp4->labelcolor(FL_FOREGROUND_COLOR); - distp4->maximum(127); - distp4->callback((Fl_Callback*)cb_distp4); - distp4->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp4->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp4 - { distp7 = new WidgetPDial(285, 40, 30, 30, "LPF"); - distp7->tooltip("Low Pass Filter"); - distp7->box(FL_ROUND_UP_BOX); - distp7->color(FL_BACKGROUND_COLOR); - distp7->selection_color(FL_INACTIVE_COLOR); - distp7->labeltype(FL_NORMAL_LABEL); - distp7->labelfont(1); - distp7->labelsize(11); - distp7->labelcolor(FL_FOREGROUND_COLOR); - distp7->maximum(127); - distp7->callback((Fl_Callback*)cb_distp7); - distp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp7 - { distp8 = new WidgetPDial(320, 40, 30, 30, "HPF"); - distp8->tooltip("High Pass Filter"); - distp8->box(FL_ROUND_UP_BOX); - distp8->color(FL_BACKGROUND_COLOR); - distp8->selection_color(FL_INACTIVE_COLOR); - distp8->labeltype(FL_NORMAL_LABEL); - distp8->labelfont(1); - distp8->labelsize(11); - distp8->labelcolor(FL_FOREGROUND_COLOR); - distp8->maximum(127); - distp8->callback((Fl_Callback*)cb_distp8); - distp8->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp8->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp8 - { distp5 = new Fl_Choice(190, 50, 60, 20, "Type"); - distp5->box(FL_UP_BOX); - distp5->down_box(FL_BORDER_BOX); - distp5->labelfont(1); - distp5->labelsize(11); - distp5->textsize(10); - distp5->callback((Fl_Callback*)cb_distp5); - distp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp5->menu(menu_distp5); - } // Fl_Choice* distp5 - { distp6 = new Fl_Check_Button(260, 55, 15, 15, "Neg."); - distp6->down_box(FL_DOWN_BOX); - distp6->labelfont(1); - distp6->labelsize(11); - distp6->callback((Fl_Callback*)cb_distp6); - distp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - } // Fl_Check_Button* distp6 - { distp9 = new Fl_Check_Button(355, 60, 15, 15, "St."); - distp9->tooltip("Stereo"); - distp9->down_box(FL_DOWN_BOX); - distp9->labelfont(1); - distp9->labelsize(11); - distp9->callback((Fl_Callback*)cb_distp9); - distp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - } // Fl_Check_Button* distp9 - { distp10 = new Fl_Check_Button(355, 44, 15, 15, "PF"); - distp10->tooltip("Applies the filters(before or after) the distorsion"); - distp10->down_box(FL_DOWN_BOX); - distp10->labelfont(1); - distp10->labelsize(11); - distp10->callback((Fl_Callback*)cb_distp10); - distp10->align(Fl_Align(FL_ALIGN_TOP)); - } // Fl_Check_Button* distp10 - effdistorsionwindow->end(); - } // Fl_Group* effdistorsionwindow - return effdistorsionwindow; -} - -Fl_Group* EffUI::make_eq_window() { - { effeqwindow = new Fl_Group(0, 0, 380, 95); - effeqwindow->box(FL_PLASTIC_UP_BOX); - effeqwindow->color((Fl_Color)221); - effeqwindow->selection_color(FL_BACKGROUND_COLOR); - effeqwindow->labeltype(FL_NO_LABEL); - effeqwindow->labelfont(1); - effeqwindow->labelsize(14); - effeqwindow->labelcolor(FL_FOREGROUND_COLOR); - effeqwindow->user_data((void*)(this)); - effeqwindow->align(Fl_Align(FL_ALIGN_TOP)); - effeqwindow->when(FL_WHEN_RELEASE); - { Fl_Text_Display* o = new Fl_Text_Display(320, 10, 15, 20, "EQ"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { eqp0 = new WidgetPDial(10, 35, 30, 30, "Gain"); - eqp0->box(FL_ROUND_UP_BOX); - eqp0->color(FL_BACKGROUND_COLOR); - eqp0->selection_color(FL_INACTIVE_COLOR); - eqp0->labeltype(FL_NORMAL_LABEL); - eqp0->labelfont(1); - eqp0->labelsize(11); - eqp0->labelcolor(FL_FOREGROUND_COLOR); - eqp0->maximum(127); - eqp0->callback((Fl_Callback*)cb_eqp0); - eqp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - eqp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* eqp0 - { Fl_Counter* o = bandcounter = new Fl_Counter(240, 20, 45, 15, "B."); - bandcounter->tooltip("Band no."); - bandcounter->type(1); - bandcounter->labelfont(1); - bandcounter->labelsize(11); - bandcounter->minimum(0); - bandcounter->maximum(1); - bandcounter->step(1); - bandcounter->textfont(1); - bandcounter->textsize(11); - bandcounter->callback((Fl_Callback*)cb_bandcounter); - bandcounter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(0,MAX_EQ_BANDS-1); - } // Fl_Counter* bandcounter - { Fl_Group* o = bandgroup = new Fl_Group(245, 40, 130, 50); - bandgroup->box(FL_ENGRAVED_FRAME); - { freqdial = new WidgetPDial(250, 50, 25, 25, "Freq"); - freqdial->box(FL_ROUND_UP_BOX); - freqdial->color(FL_BACKGROUND_COLOR); - freqdial->selection_color(FL_INACTIVE_COLOR); - freqdial->labeltype(FL_NORMAL_LABEL); - freqdial->labelfont(1); - freqdial->labelsize(10); - freqdial->labelcolor(FL_FOREGROUND_COLOR); - freqdial->maximum(127); - freqdial->callback((Fl_Callback*)cb_freqdial); - freqdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - freqdial->when(3); - } // WidgetPDial* freqdial - { gaindial = new WidgetPDial(280, 50, 25, 25, "Gain"); - gaindial->box(FL_ROUND_UP_BOX); - gaindial->color(FL_BACKGROUND_COLOR); - gaindial->selection_color(FL_INACTIVE_COLOR); - gaindial->labeltype(FL_NORMAL_LABEL); - gaindial->labelfont(1); - gaindial->labelsize(10); - gaindial->labelcolor(FL_FOREGROUND_COLOR); - gaindial->maximum(127); - gaindial->step(1); - gaindial->callback((Fl_Callback*)cb_gaindial); - gaindial->align(Fl_Align(FL_ALIGN_BOTTOM)); - gaindial->when(3); - } // WidgetPDial* gaindial - { qdial = new WidgetPDial(310, 50, 25, 25, "Q"); - qdial->tooltip("Resonance/Bandwidth"); - qdial->box(FL_ROUND_UP_BOX); - qdial->color(FL_BACKGROUND_COLOR); - qdial->selection_color(FL_INACTIVE_COLOR); - qdial->labeltype(FL_NORMAL_LABEL); - qdial->labelfont(1); - qdial->labelsize(10); - qdial->labelcolor(FL_FOREGROUND_COLOR); - qdial->maximum(127); - qdial->callback((Fl_Callback*)cb_qdial); - qdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - qdial->when(3); - } // WidgetPDial* qdial - { Fl_Counter* o = stagescounter = new Fl_Counter(340, 60, 30, 15, "St."); - stagescounter->tooltip("Additional filter stages"); - stagescounter->type(1); - stagescounter->labelfont(1); - stagescounter->labelsize(10); - stagescounter->minimum(1); - stagescounter->maximum(127); - stagescounter->step(1); - stagescounter->textfont(1); - stagescounter->textsize(11); - stagescounter->callback((Fl_Callback*)cb_stagescounter); - o->bounds(0,MAX_FILTER_STAGES-1); - } // Fl_Counter* stagescounter - if (eff->geteffectpar(10)==0) o->deactivate(); - bandgroup->end(); - } // Fl_Group* bandgroup - { typechoice = new Fl_Choice(290, 20, 40, 15, "T."); - typechoice->tooltip("Type"); - typechoice->down_box(FL_BORDER_BOX); - typechoice->labelfont(1); - typechoice->labelsize(10); - typechoice->textsize(10); - typechoice->callback((Fl_Callback*)cb_typechoice); - typechoice->align(Fl_Align(FL_ALIGN_TOP)); - typechoice->when(FL_WHEN_RELEASE_ALWAYS); - typechoice->menu(menu_typechoice); - } // Fl_Choice* typechoice - { EQGraph* o = eqgraph = new EQGraph(45, 10, 190, 75); - eqgraph->box(FL_BORDER_BOX); - eqgraph->color((Fl_Color)178); - eqgraph->selection_color(FL_BACKGROUND_COLOR); - eqgraph->labeltype(FL_NORMAL_LABEL); - eqgraph->labelfont(0); - eqgraph->labelsize(14); - eqgraph->labelcolor(FL_FOREGROUND_COLOR); - eqgraph->align(Fl_Align(FL_ALIGN_CENTER)); - eqgraph->when(FL_WHEN_RELEASE); - o->init(eff); - } // EQGraph* eqgraph - effeqwindow->end(); - } // Fl_Group* effeqwindow - return effeqwindow; -} - -Fl_Group* EffUI::make_dynamicfilter_window() { - { effdynamicfilterwindow = new Fl_Group(0, 0, 380, 95); - effdynamicfilterwindow->box(FL_PLASTIC_UP_BOX); - effdynamicfilterwindow->color((Fl_Color)221); - effdynamicfilterwindow->selection_color(FL_BACKGROUND_COLOR); - effdynamicfilterwindow->labeltype(FL_NO_LABEL); - effdynamicfilterwindow->labelfont(1); - effdynamicfilterwindow->labelsize(14); - effdynamicfilterwindow->labelcolor(FL_FOREGROUND_COLOR); - effdynamicfilterwindow->user_data((void*)(this)); - effdynamicfilterwindow->align(Fl_Align(FL_ALIGN_TOP)); - effdynamicfilterwindow->when(FL_WHEN_RELEASE); - { dfp = new Fl_Choice(10, 15, 90, 15, "Preset"); - dfp->down_box(FL_BORDER_BOX); - dfp->color((Fl_Color)14); - dfp->selection_color(FL_FOREGROUND_COLOR); - dfp->labelfont(1); - dfp->labelsize(10); - dfp->textfont(1); - dfp->textsize(10); - dfp->textcolor(FL_BACKGROUND2_COLOR); - dfp->callback((Fl_Callback*)cb_dfp); - dfp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - dfp->menu(menu_dfp); - } // Fl_Choice* dfp - { Fl_Text_Display* o = new Fl_Text_Display(245, 10, 10, 20, "DynFilter"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { dfp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - dfp0->tooltip("Effect Volume"); - dfp0->box(FL_ROUND_UP_BOX); - dfp0->color(FL_BACKGROUND_COLOR); - dfp0->selection_color(FL_INACTIVE_COLOR); - dfp0->labeltype(FL_NORMAL_LABEL); - dfp0->labelfont(1); - dfp0->labelsize(11); - dfp0->labelcolor(FL_FOREGROUND_COLOR); - dfp0->maximum(127); - dfp0->callback((Fl_Callback*)cb_dfp0); - dfp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp0 - { dfp1 = new WidgetPDial(45, 40, 30, 30, "Pan"); - dfp1->box(FL_ROUND_UP_BOX); - dfp1->color(FL_BACKGROUND_COLOR); - dfp1->selection_color(FL_INACTIVE_COLOR); - dfp1->labeltype(FL_NORMAL_LABEL); - dfp1->labelfont(1); - dfp1->labelsize(11); - dfp1->labelcolor(FL_FOREGROUND_COLOR); - dfp1->maximum(127); - dfp1->callback((Fl_Callback*)cb_dfp1); - dfp1->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp1->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp1 - { dfp2 = new WidgetPDial(85, 40, 30, 30, "Freq"); - dfp2->tooltip("LFO Frequency"); - dfp2->box(FL_ROUND_UP_BOX); - dfp2->color(FL_BACKGROUND_COLOR); - dfp2->selection_color(FL_INACTIVE_COLOR); - dfp2->labeltype(FL_NORMAL_LABEL); - dfp2->labelfont(1); - dfp2->labelsize(11); - dfp2->labelcolor(FL_FOREGROUND_COLOR); - dfp2->maximum(127); - dfp2->callback((Fl_Callback*)cb_dfp2); - dfp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp2 - { dfp3 = new WidgetPDial(120, 40, 30, 30, "Rnd"); - dfp3->tooltip("LFO Randomness"); - dfp3->box(FL_ROUND_UP_BOX); - dfp3->color(FL_BACKGROUND_COLOR); - dfp3->selection_color(FL_INACTIVE_COLOR); - dfp3->labeltype(FL_NORMAL_LABEL); - dfp3->labelfont(1); - dfp3->labelsize(11); - dfp3->labelcolor(FL_FOREGROUND_COLOR); - dfp3->maximum(127); - dfp3->callback((Fl_Callback*)cb_dfp3); - dfp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* dfp3 - { dfp5 = new WidgetPDial(200, 40, 30, 30, "St.df"); - dfp5->tooltip("Left/Right Channel Phase Shift"); - dfp5->box(FL_ROUND_UP_BOX); - dfp5->color(FL_BACKGROUND_COLOR); - dfp5->selection_color(FL_INACTIVE_COLOR); - dfp5->labeltype(FL_NORMAL_LABEL); - dfp5->labelfont(1); - dfp5->labelsize(11); - dfp5->labelcolor(FL_FOREGROUND_COLOR); - dfp5->maximum(127); - dfp5->callback((Fl_Callback*)cb_dfp5); - dfp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp5->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp5 - { dfp6 = new WidgetPDial(235, 40, 30, 30, "LfoD"); - dfp6->tooltip("LFO Depth"); - dfp6->box(FL_ROUND_UP_BOX); - dfp6->color(FL_BACKGROUND_COLOR); - dfp6->selection_color(FL_INACTIVE_COLOR); - dfp6->labeltype(FL_NORMAL_LABEL); - dfp6->labelfont(1); - dfp6->labelsize(11); - dfp6->labelcolor(FL_FOREGROUND_COLOR); - dfp6->maximum(127); - dfp6->callback((Fl_Callback*)cb_dfp6); - dfp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp6 - { dfp4 = new Fl_Choice(155, 50, 40, 15, "LFO type"); - dfp4->tooltip("LFO function"); - dfp4->down_box(FL_BORDER_BOX); - dfp4->labelfont(1); - dfp4->labelsize(10); - dfp4->textsize(8); - dfp4->callback((Fl_Callback*)cb_dfp4); - dfp4->align(Fl_Align(130)); - dfp4->menu(menu_dfp4); - } // Fl_Choice* dfp4 - { Fl_Button* o = new Fl_Button(115, 10, 55, 25, "Filter"); - o->box(FL_PLASTIC_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Filter); - } // Fl_Button* o - { Fl_Group* o = new Fl_Group(270, 40, 105, 45); - o->box(FL_BORDER_BOX); - o->color((Fl_Color)181); - { dfp7 = new WidgetPDial(275, 45, 25, 25, "A.S."); - dfp7->tooltip("Filter vs Amplitude"); - dfp7->box(FL_ROUND_UP_BOX); - dfp7->color(FL_BACKGROUND_COLOR); - dfp7->selection_color(FL_INACTIVE_COLOR); - dfp7->labeltype(FL_NORMAL_LABEL); - dfp7->labelfont(1); - dfp7->labelsize(11); - dfp7->labelcolor(FL_FOREGROUND_COLOR); - dfp7->maximum(127); - dfp7->callback((Fl_Callback*)cb_dfp7); - dfp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp7 - { dfp9 = new WidgetPDial(305, 45, 25, 25, "A.M"); - dfp9->tooltip("rate that amplitude changes the filter"); - dfp9->box(FL_ROUND_UP_BOX); - dfp9->color(FL_BACKGROUND_COLOR); - dfp9->selection_color(FL_INACTIVE_COLOR); - dfp9->labeltype(FL_NORMAL_LABEL); - dfp9->labelfont(1); - dfp9->labelsize(11); - dfp9->labelcolor(FL_FOREGROUND_COLOR); - dfp9->maximum(127); - dfp9->callback((Fl_Callback*)cb_dfp9); - dfp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp9 - { dfp8 = new Fl_Check_Button(345, 55, 15, 15, "A.Inv."); - dfp8->tooltip("enable for filter frequency to lower with higher input amplitude"); - dfp8->down_box(FL_DOWN_BOX); - dfp8->labelfont(1); - dfp8->labelsize(11); - dfp8->callback((Fl_Callback*)cb_dfp8); - dfp8->align(Fl_Align(FL_ALIGN_BOTTOM)); - } // Fl_Check_Button* dfp8 - o->end(); - } // Fl_Group* o - effdynamicfilterwindow->end(); - } // Fl_Group* effdynamicfilterwindow - return effdynamicfilterwindow; -} - -Fl_Double_Window* EffUI::make_filter_window() { - { filterwindow = new Fl_Double_Window(290, 110, "Filter Parameters for DynFilter Eff."); - filterwindow->user_data((void*)(this)); - { FilterUI* o = new FilterUI(5, 5, 275, 75, "DynFilter effect - Filter"); - o->box(FL_FLAT_BOX); - o->color(FL_LIGHT1); - o->selection_color(FL_BACKGROUND_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(14); - o->labelcolor(FL_FOREGROUND_COLOR); - o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - o->when(FL_WHEN_RELEASE); - o->init(eff->filterpars,NULL,NULL); - o->use_for_dynamic_filter(); - o->end(); - } // FilterUI* o - { Fl_Button* o = new Fl_Button(105, 85, 70, 20, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - filterwindow->end(); - } // Fl_Double_Window* filterwindow - return filterwindow; -} - -void EffUI::init(EffectMgr *eff_) { - eff=eff_; - - make_null_window(); - make_reverb_window(); - make_echo_window(); - make_chorus_window(); - make_phaser_window(); - make_alienwah_window(); - make_distorsion_window(); - make_eq_window(); - make_dynamicfilter_window(); - - int px=this->parent()->x(); - int py=this->parent()->y(); - - effnullwindow->position(px,py); - effreverbwindow->position(px,py); - effechowindow->position(px,py); - effchoruswindow->position(px,py); - effphaserwindow->position(px,py); - effalienwahwindow->position(px,py); - effdistorsionwindow->position(px,py); - effeqwindow->position(px,py); - effdynamicfilterwindow->position(px,py); - - refresh(eff); -} - -void EffUI::refresh(EffectMgr *eff_) { - eff=eff_; - this->hide(); - - effnullwindow->hide(); - effreverbwindow->hide(); - effechowindow->hide(); - effchoruswindow->hide(); - effphaserwindow->hide(); - effalienwahwindow->hide(); - effdistorsionwindow->hide(); - effeqwindow->hide(); - effdynamicfilterwindow->hide(); - - eqband=0; - - if (filterwindow!=NULL){ - filterwindow->hide(); - delete(filterwindow); - filterwindow=NULL; - }; - - switch(eff->geteffect()){ - case 1: - revp->value(eff->getpreset()); - revp0->value(eff->geteffectpar(0));if (eff->insertion!=0) revp0->label("D/W"); - revp1->value(eff->geteffectpar(1)); - revp2->value(eff->geteffectpar(2)); - revp3->value(eff->geteffectpar(3)); - revp4->value(eff->geteffectpar(4)); - //revp5->value(eff->geteffectpar(5)); - revp6->value(eff->geteffectpar(6)); - revp7->value(eff->geteffectpar(7)); - revp8->value(eff->geteffectpar(8)); - revp9->value(eff->geteffectpar(9)); - revp10->value(eff->geteffectpar(10)); - revp11->value(eff->geteffectpar(11)); - revp12->value(eff->geteffectpar(12)); - - effreverbwindow->show(); - break; - case 2: - echop->value(eff->getpreset()); - echop0->value(eff->geteffectpar(0));if (eff->insertion!=0) echop0->label("D/W"); - echop1->value(eff->geteffectpar(1)); - echop2->value(eff->geteffectpar(2)); - echop3->value(eff->geteffectpar(3)); - echop4->value(eff->geteffectpar(4)); - echop5->value(eff->geteffectpar(5)); - echop6->value(eff->geteffectpar(6)); - effechowindow->show(); - break; - case 3: - chorusp->value(eff->getpreset()); - chorusp0->value(eff->geteffectpar(0));if (eff->insertion!=0) chorusp0->label("D/W"); - chorusp1->value(eff->geteffectpar(1)); - chorusp2->value(eff->geteffectpar(2)); - chorusp3->value(eff->geteffectpar(3)); - chorusp4->value(eff->geteffectpar(4)); - chorusp5->value(eff->geteffectpar(5)); - chorusp6->value(eff->geteffectpar(6)); - chorusp7->value(eff->geteffectpar(7)); - chorusp8->value(eff->geteffectpar(8)); - chorusp9->value(eff->geteffectpar(9)); - chorusp11->value(eff->geteffectpar(11)); - effchoruswindow->show(); - break; - case 4: - phaserp->value(eff->getpreset()); - phaserp0->value(eff->geteffectpar(0));if (eff->insertion!=0) phaserp0->label("D/W"); - phaserp1->value(eff->geteffectpar(1)); - phaserp2->value(eff->geteffectpar(2)); - phaserp3->value(eff->geteffectpar(3)); - phaserp4->value(eff->geteffectpar(4)); - phaserp5->value(eff->geteffectpar(5)); - phaserp6->value(eff->geteffectpar(6)); - phaserp7->value(eff->geteffectpar(7)); - phaserp8->value(eff->geteffectpar(8)); - phaserp9->value(eff->geteffectpar(9)); - phaserp10->value(eff->geteffectpar(10)); - phaserp11->value(eff->geteffectpar(11)); - phaserp12->value(eff->geteffectpar(12)); - phaserp13->value(eff->geteffectpar(13)); - phaserp14->value(eff->geteffectpar(14)); - effphaserwindow->show(); - break; - case 5: - awp->value(eff->getpreset()); - awp0->value(eff->geteffectpar(0));if (eff->insertion!=0) awp0->label("D/W"); - awp1->value(eff->geteffectpar(1)); - awp2->value(eff->geteffectpar(2)); - awp3->value(eff->geteffectpar(3)); - awp4->value(eff->geteffectpar(4)); - awp5->value(eff->geteffectpar(5)); - awp6->value(eff->geteffectpar(6)); - awp7->value(eff->geteffectpar(7)); - awp8->value(eff->geteffectpar(8)); - awp9->value(eff->geteffectpar(9)); - awp10->value(eff->geteffectpar(10)); - - effalienwahwindow->show(); - break; - case 6: - distp->value(eff->getpreset()); - distp0->value(eff->geteffectpar(0));if (eff->insertion!=0) distp0->label("D/W"); - distp1->value(eff->geteffectpar(1)); - distp2->value(eff->geteffectpar(2)); - distp3->value(eff->geteffectpar(3)); - distp4->value(eff->geteffectpar(4)); - distp5->value(eff->geteffectpar(5)); - distp6->value(eff->geteffectpar(6)); - distp7->value(eff->geteffectpar(7)); - distp8->value(eff->geteffectpar(8)); - distp9->value(eff->geteffectpar(9)); - distp10->value(eff->geteffectpar(10)); - effdistorsionwindow->show(); - break; - case 7:eqband=0; - eqp0->value(eff->geteffectpar(0)); - bandcounter->value(eqband); - bandcounter->do_callback(); - typechoice->value(eff->geteffectpar(10)); - eqgraph->redraw(); - freqdial->value(eff->geteffectpar(11)); - gaindial->value(eff->geteffectpar(12)); - if (eff->geteffectpar(10)<6) gaindial->deactivate(); - qdial->value(eff->geteffectpar(13)); - stagescounter->value(eff->geteffectpar(14)); - eqgraph->init(eff); - effeqwindow->show(); - break; - case 8:make_filter_window(); - dfp->value(eff->getpreset()); - dfp0->value(eff->geteffectpar(0));if (eff->insertion!=0) dfp0->label("D/W"); - dfp1->value(eff->geteffectpar(1)); - dfp2->value(eff->geteffectpar(2)); - dfp3->value(eff->geteffectpar(3)); - dfp4->value(eff->geteffectpar(4)); - dfp5->value(eff->geteffectpar(5)); - dfp6->value(eff->geteffectpar(6)); - dfp7->value(eff->geteffectpar(7)); - dfp8->value(eff->geteffectpar(8)); - dfp9->value(eff->geteffectpar(9)); - - - effdynamicfilterwindow->show(); - break; - default:effnullwindow->show(); - break; - }; - - this->show(); -} - -void EffUI::refresh() { - refresh(eff); -} - -void SimpleEffUI::cb_revp5_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); - -refresh(eff); -} -void SimpleEffUI::cb_revp5(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_revp5_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_revp1[] = { - {"Cathedral 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Cathedral 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Cathedral 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Hall 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Hall 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Room 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Room 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Basement", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Tunnel", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echoed 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echoed 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Very Long 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Very Long 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_revp01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_revp01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_revp01_i(o,v); -} - -void SimpleEffUI::cb_revp21_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void SimpleEffUI::cb_revp21(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_revp21_i(o,v); -} - -void SimpleEffUI::cb_revp31_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void SimpleEffUI::cb_revp31(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_revp31_i(o,v); -} - -void SimpleEffUI::cb_revp91_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void SimpleEffUI::cb_revp91(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_revp91_i(o,v); -} - -void SimpleEffUI::cb_echop7_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void SimpleEffUI::cb_echop7(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_echop7_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_echop1[] = { - {"Echo 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echo 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Echo 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Simple Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Canyon", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Panning Echo 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Panning Echo 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Panning Echo 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Feedback Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_echop01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_echop01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_echop01_i(o,v); -} - -void SimpleEffUI::cb_echop21_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void SimpleEffUI::cb_echop21(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_echop21_i(o,v); -} - -void SimpleEffUI::cb_echop51_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void SimpleEffUI::cb_echop51(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_echop51_i(o,v); -} - -void SimpleEffUI::cb_choruspa_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void SimpleEffUI::cb_choruspa(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_choruspa_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_chorusp1[] = { - {"Chorus 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Chorus 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Chorus 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Celeste 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Celeste 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Flange 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_chorusp01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_chorusp01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_chorusp01_i(o,v); -} - -void SimpleEffUI::cb_chorusp21_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void SimpleEffUI::cb_chorusp21(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_chorusp21_i(o,v); -} - -void SimpleEffUI::cb_chorusp61_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void SimpleEffUI::cb_chorusp61(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_chorusp61_i(o,v); -} - -void SimpleEffUI::cb_chorusp71_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void SimpleEffUI::cb_chorusp71(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_chorusp71_i(o,v); -} - -void SimpleEffUI::cb_chorusp81_i(WidgetPDial* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void SimpleEffUI::cb_chorusp81(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_chorusp81_i(o,v); -} - -void SimpleEffUI::cb_Flange1_i(Fl_Check_Button* o, void*) { - eff->seteffectpar(10,(int) o->value()); -} -void SimpleEffUI::cb_Flange1(Fl_Check_Button* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_Flange1_i(o,v); -} - -void SimpleEffUI::cb_phaserpa_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void SimpleEffUI::cb_phaserpa(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserpa_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_phaserp1[] = { - {"Phaser 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Phaser 6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_phaserp01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_phaserp01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserp01_i(o,v); -} - -void SimpleEffUI::cb_phaserp21_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void SimpleEffUI::cb_phaserp21(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserp21_i(o,v); -} - -void SimpleEffUI::cb_phaserp51_i(WidgetPDial* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void SimpleEffUI::cb_phaserp51(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserp51_i(o,v); -} - -void SimpleEffUI::cb_phaserp61_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void SimpleEffUI::cb_phaserp61(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserp61_i(o,v); -} - -void SimpleEffUI::cb_phaserp71_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void SimpleEffUI::cb_phaserp71(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserp71_i(o,v); -} - -void SimpleEffUI::cb_phaserp81_i(Fl_Counter* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void SimpleEffUI::cb_phaserp81(Fl_Counter* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_phaserp81_i(o,v); -} - -void SimpleEffUI::cb_awpa_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void SimpleEffUI::cb_awpa(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_awpa_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_awp1[] = { - {"Alienwah 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Alienwah 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Alienwah 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Alienwah 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_awp01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_awp01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_awp01_i(o,v); -} - -void SimpleEffUI::cb_awp21_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void SimpleEffUI::cb_awp21(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_awp21_i(o,v); -} - -void SimpleEffUI::cb_awp61_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void SimpleEffUI::cb_awp61(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_awp61_i(o,v); -} - -void SimpleEffUI::cb_awp81_i(Fl_Counter* o, void*) { - eff->seteffectpar(8,(int) o->value()); -} -void SimpleEffUI::cb_awp81(Fl_Counter* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_awp81_i(o,v); -} - -void SimpleEffUI::cb_distpa_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void SimpleEffUI::cb_distpa(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_distpa_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_distp1[] = { - {"Overdrive 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Overdrive 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"A. Exciter 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"A. Exciter 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Guitar Amp", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Quantisize", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_distp01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_distp01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_distp01_i(o,v); -} - -void SimpleEffUI::cb_distp31_i(WidgetPDial* o, void*) { - eff->seteffectpar(3,(int) o->value()); -} -void SimpleEffUI::cb_distp31(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_distp31_i(o,v); -} - -void SimpleEffUI::cb_distp41_i(WidgetPDial* o, void*) { - eff->seteffectpar(4,(int) o->value()); -} -void SimpleEffUI::cb_distp41(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_distp41_i(o,v); -} - -void SimpleEffUI::cb_distp71_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void SimpleEffUI::cb_distp71(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_distp71_i(o,v); -} - -void SimpleEffUI::cb_distp51_i(Fl_Choice* o, void*) { - eff->seteffectpar(5,(int) o->value()); -} -void SimpleEffUI::cb_distp51(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_distp51_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_distp51[] = { - {"Atan", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Asym1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Qnts", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Zigzg", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lmt", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LmtU", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LmtL", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"ILmt", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Clip", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Asym2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sgm", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_bandcounter1_i(Fl_Counter* o, void*) { - eqband=(int) o->value(); -int npb=eqband*5+10; - -int type=eff->geteffectpar(npb); -typechoice->value(type); - -if (type>6) gaindial->activate(); - else gaindial->deactivate(); - -if (type==0) bandgroup->deactivate(); -else bandgroup->activate(); - -int freq=eff->geteffectpar(npb+1); -freqdial->value(freq); - -int gain=eff->geteffectpar(npb+2); -gaindial->value(gain); - -int q=eff->geteffectpar(npb+3); -qdial->value(q); - -int dbl=eff->geteffectpar(npb+4); -stagescounter->value(dbl); -} -void SimpleEffUI::cb_bandcounter1(Fl_Counter* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_bandcounter1_i(o,v); -} - -void SimpleEffUI::cb_freqdial1_i(WidgetPDial* o, void*) { - int np=eqband*5+11; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void SimpleEffUI::cb_freqdial1(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->parent()->user_data()))->cb_freqdial1_i(o,v); -} - -void SimpleEffUI::cb_gaindial1_i(WidgetPDial* o, void*) { - int np=eqband*5+12; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void SimpleEffUI::cb_gaindial1(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->parent()->user_data()))->cb_gaindial1_i(o,v); -} - -void SimpleEffUI::cb_qdial1_i(WidgetPDial* o, void*) { - int np=eqband*5+13; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void SimpleEffUI::cb_qdial1(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->parent()->user_data()))->cb_qdial1_i(o,v); -} - -void SimpleEffUI::cb_stagescounter1_i(Fl_Counter* o, void*) { - int np=eqband*5+14; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw(); -} -void SimpleEffUI::cb_stagescounter1(Fl_Counter* o, void* v) { - ((SimpleEffUI*)(o->parent()->parent()->user_data()))->cb_stagescounter1_i(o,v); -} - -void SimpleEffUI::cb_typechoice1_i(Fl_Choice* o, void*) { - int np=eqband*5+10; -eff->seteffectpar(np,(int) o->value()); -bandcounter->do_callback(); -eqgraph->redraw(); -} -void SimpleEffUI::cb_typechoice1(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_typechoice1_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_typechoice1[] = { - {"OFF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lp1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Hp1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lp2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Hp2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Bp2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"N2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pk", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LSh", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HSh", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_dfpa_i(Fl_Choice* o, void*) { - eff->changepreset((int)o->value()); -refresh(eff); -} -void SimpleEffUI::cb_dfpa(Fl_Choice* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_dfpa_i(o,v); -} - -Fl_Menu_Item SimpleEffUI::menu_dfp1[] = { - {"WahWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"AutoWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"Sweep", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"VocalMorph1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {"VocalMorph2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7}, - {0,0,0,0,0,0,0,0,0} -}; - -void SimpleEffUI::cb_dfp01_i(WidgetPDial* o, void*) { - eff->seteffectpar(0,(int) o->value()); -} -void SimpleEffUI::cb_dfp01(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_dfp01_i(o,v); -} - -void SimpleEffUI::cb_dfp21_i(WidgetPDial* o, void*) { - eff->seteffectpar(2,(int) o->value()); -} -void SimpleEffUI::cb_dfp21(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_dfp21_i(o,v); -} - -void SimpleEffUI::cb_dfp61_i(WidgetPDial* o, void*) { - eff->seteffectpar(6,(int) o->value()); -} -void SimpleEffUI::cb_dfp61(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->user_data()))->cb_dfp61_i(o,v); -} - -void SimpleEffUI::cb_dfp71_i(WidgetPDial* o, void*) { - eff->seteffectpar(7,(int) o->value()); -} -void SimpleEffUI::cb_dfp71(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->parent()->user_data()))->cb_dfp71_i(o,v); -} - -void SimpleEffUI::cb_dfp91_i(WidgetPDial* o, void*) { - eff->seteffectpar(9,(int) o->value()); -} -void SimpleEffUI::cb_dfp91(WidgetPDial* o, void* v) { - ((SimpleEffUI*)(o->parent()->parent()->user_data()))->cb_dfp91_i(o,v); -} - -SimpleEffUI::SimpleEffUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - eff=NULL; -} - -SimpleEffUI::~SimpleEffUI() { - effnullwindow->hide();//delete (effnullwindow); - effreverbwindow->hide();//delete (effreverbwindow); - effechowindow->hide();//delete (effechowindow); - effchoruswindow->hide();//delete (effchoruswindow); - effphaserwindow->hide();//delete (effphaserwindow); - effalienwahwindow->hide();//delete (effalienwahwindow); - effdistorsionwindow->hide();//delete (effdistorsionwindow); - effeqwindow->hide();//delete (effeqwindow); - effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow); -} - -Fl_Group* SimpleEffUI::make_null_window() { - { effnullwindow = new Fl_Group(0, 0, 230, 95); - effnullwindow->box(FL_PLASTIC_UP_BOX); - effnullwindow->color((Fl_Color)221); - effnullwindow->selection_color(FL_BACKGROUND_COLOR); - effnullwindow->labeltype(FL_NO_LABEL); - effnullwindow->labelfont(1); - effnullwindow->labelsize(14); - effnullwindow->labelcolor(FL_FOREGROUND_COLOR); - effnullwindow->user_data((void*)(this)); - effnullwindow->align(Fl_Align(FL_ALIGN_TOP)); - effnullwindow->when(FL_WHEN_RELEASE); - { Fl_Text_Display* o = new Fl_Text_Display(25, 35, 35, 20, "No Effect"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->labelcolor((Fl_Color)43); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - effnullwindow->end(); - } // Fl_Group* effnullwindow - return effnullwindow; -} - -Fl_Group* SimpleEffUI::make_reverb_window() { - { effreverbwindow = new Fl_Group(0, 0, 230, 95); - effreverbwindow->box(FL_PLASTIC_UP_BOX); - effreverbwindow->color((Fl_Color)221); - effreverbwindow->selection_color(FL_BACKGROUND_COLOR); - effreverbwindow->labeltype(FL_NO_LABEL); - effreverbwindow->labelfont(1); - effreverbwindow->labelsize(14); - effreverbwindow->labelcolor(FL_FOREGROUND_COLOR); - effreverbwindow->user_data((void*)(this)); - effreverbwindow->align(Fl_Align(FL_ALIGN_TOP)); - effreverbwindow->when(FL_WHEN_RELEASE); - { Fl_Text_Display* o = new Fl_Text_Display(115, 10, 20, 20, "Reverb "); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { revp = new Fl_Choice(10, 15, 90, 15, "Preset"); - revp->down_box(FL_BORDER_BOX); - revp->color((Fl_Color)14); - revp->selection_color(FL_FOREGROUND_COLOR); - revp->labelfont(1); - revp->labelsize(10); - revp->textfont(1); - revp->textsize(10); - revp->textcolor(FL_BACKGROUND2_COLOR); - revp->callback((Fl_Callback*)cb_revp5); - revp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - revp->menu(menu_revp1); - } // Fl_Choice* revp - { revp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - revp0->tooltip("Effect Volume"); - revp0->box(FL_ROUND_UP_BOX); - revp0->color(FL_BACKGROUND_COLOR); - revp0->selection_color(FL_INACTIVE_COLOR); - revp0->labeltype(FL_NORMAL_LABEL); - revp0->labelfont(1); - revp0->labelsize(11); - revp0->labelcolor(FL_FOREGROUND_COLOR); - revp0->maximum(127); - revp0->callback((Fl_Callback*)cb_revp01); - revp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp0 - { revp2 = new WidgetPDial(45, 40, 30, 30, "Time"); - revp2->tooltip("Duration of Reverb"); - revp2->box(FL_ROUND_UP_BOX); - revp2->color(FL_BACKGROUND_COLOR); - revp2->selection_color(FL_INACTIVE_COLOR); - revp2->labeltype(FL_NORMAL_LABEL); - revp2->labelfont(1); - revp2->labelsize(11); - revp2->labelcolor(FL_FOREGROUND_COLOR); - revp2->maximum(127); - revp2->callback((Fl_Callback*)cb_revp21); - revp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp2 - { revp3 = new WidgetPDial(85, 40, 30, 30, "I.del"); - revp3->tooltip("Initial Delay"); - revp3->box(FL_ROUND_UP_BOX); - revp3->color(FL_BACKGROUND_COLOR); - revp3->selection_color(FL_INACTIVE_COLOR); - revp3->labeltype(FL_NORMAL_LABEL); - revp3->labelfont(1); - revp3->labelsize(11); - revp3->labelcolor(FL_FOREGROUND_COLOR); - revp3->maximum(127); - revp3->callback((Fl_Callback*)cb_revp31); - revp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* revp3 - { revp9 = new WidgetPDial(120, 40, 30, 30, "Damp"); - revp9->tooltip("Dampening"); - revp9->box(FL_ROUND_UP_BOX); - revp9->color(FL_BACKGROUND_COLOR); - revp9->selection_color(FL_INACTIVE_COLOR); - revp9->labeltype(FL_NORMAL_LABEL); - revp9->labelfont(1); - revp9->labelsize(11); - revp9->labelcolor(FL_FOREGROUND_COLOR); - revp9->minimum(64); - revp9->maximum(127); - revp9->step(1); - revp9->callback((Fl_Callback*)cb_revp91); - revp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - revp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* revp9 - effreverbwindow->end(); - } // Fl_Group* effreverbwindow - return effreverbwindow; -} - -Fl_Group* SimpleEffUI::make_echo_window() { - { effechowindow = new Fl_Group(0, 0, 230, 95); - effechowindow->box(FL_PLASTIC_UP_BOX); - effechowindow->color((Fl_Color)221); - effechowindow->selection_color(FL_BACKGROUND_COLOR); - effechowindow->labeltype(FL_NO_LABEL); - effechowindow->labelfont(1); - effechowindow->labelsize(14); - effechowindow->labelcolor(FL_FOREGROUND_COLOR); - effechowindow->user_data((void*)(this)); - effechowindow->align(Fl_Align(FL_ALIGN_TOP)); - effechowindow->when(FL_WHEN_RELEASE); - { echop = new Fl_Choice(11, 15, 95, 15, "Preset"); - echop->down_box(FL_BORDER_BOX); - echop->color((Fl_Color)14); - echop->selection_color(FL_FOREGROUND_COLOR); - echop->labelfont(1); - echop->labelsize(10); - echop->textfont(1); - echop->textsize(10); - echop->textcolor(FL_BACKGROUND2_COLOR); - echop->callback((Fl_Callback*)cb_echop7); - echop->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - echop->menu(menu_echop1); - } // Fl_Choice* echop - { Fl_Text_Display* o = new Fl_Text_Display(145, 10, 10, 20, "Echo"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { echop0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - echop0->tooltip("Effect Volume"); - echop0->box(FL_ROUND_UP_BOX); - echop0->color(FL_BACKGROUND_COLOR); - echop0->selection_color(FL_INACTIVE_COLOR); - echop0->labeltype(FL_NORMAL_LABEL); - echop0->labelfont(1); - echop0->labelsize(11); - echop0->labelcolor(FL_FOREGROUND_COLOR); - echop0->maximum(127); - echop0->callback((Fl_Callback*)cb_echop01); - echop0->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop0->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop0 - { echop2 = new WidgetPDial(45, 40, 30, 30, "Delay"); - echop2->box(FL_ROUND_UP_BOX); - echop2->color(FL_BACKGROUND_COLOR); - echop2->selection_color(FL_INACTIVE_COLOR); - echop2->labeltype(FL_NORMAL_LABEL); - echop2->labelfont(1); - echop2->labelsize(11); - echop2->labelcolor(FL_FOREGROUND_COLOR); - echop2->maximum(127); - echop2->callback((Fl_Callback*)cb_echop21); - echop2->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop2->when(FL_WHEN_RELEASE); - } // WidgetPDial* echop2 - { echop5 = new WidgetPDial(80, 40, 30, 30, "Fb."); - echop5->tooltip("Feedback"); - echop5->box(FL_ROUND_UP_BOX); - echop5->color(FL_BACKGROUND_COLOR); - echop5->selection_color(FL_INACTIVE_COLOR); - echop5->labeltype(FL_NORMAL_LABEL); - echop5->labelfont(1); - echop5->labelsize(11); - echop5->labelcolor(FL_FOREGROUND_COLOR); - echop5->maximum(127); - echop5->callback((Fl_Callback*)cb_echop51); - echop5->align(Fl_Align(FL_ALIGN_BOTTOM)); - echop5->when(FL_WHEN_CHANGED); - } // WidgetPDial* echop5 - effechowindow->end(); - } // Fl_Group* effechowindow - return effechowindow; -} - -Fl_Group* SimpleEffUI::make_chorus_window() { - { effchoruswindow = new Fl_Group(0, 0, 230, 95); - effchoruswindow->box(FL_PLASTIC_UP_BOX); - effchoruswindow->color((Fl_Color)221); - effchoruswindow->selection_color(FL_BACKGROUND_COLOR); - effchoruswindow->labeltype(FL_NO_LABEL); - effchoruswindow->labelfont(1); - effchoruswindow->labelsize(14); - effchoruswindow->labelcolor(FL_FOREGROUND_COLOR); - effchoruswindow->user_data((void*)(this)); - effchoruswindow->align(Fl_Align(FL_ALIGN_TOP)); - effchoruswindow->when(FL_WHEN_RELEASE); - { chorusp = new Fl_Choice(10, 15, 90, 15, "Preset"); - chorusp->down_box(FL_BORDER_BOX); - chorusp->color((Fl_Color)14); - chorusp->selection_color(FL_FOREGROUND_COLOR); - chorusp->labelfont(1); - chorusp->labelsize(10); - chorusp->textfont(1); - chorusp->textsize(10); - chorusp->textcolor(FL_BACKGROUND2_COLOR); - chorusp->callback((Fl_Callback*)cb_choruspa); - chorusp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - chorusp->menu(menu_chorusp1); - } // Fl_Choice* chorusp - { Fl_Text_Display* o = new Fl_Text_Display(120, 10, 10, 20, "Chorus"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { chorusp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - chorusp0->tooltip("Effect Volume"); - chorusp0->box(FL_ROUND_UP_BOX); - chorusp0->color(FL_BACKGROUND_COLOR); - chorusp0->selection_color(FL_INACTIVE_COLOR); - chorusp0->labeltype(FL_NORMAL_LABEL); - chorusp0->labelfont(1); - chorusp0->labelsize(11); - chorusp0->labelcolor(FL_FOREGROUND_COLOR); - chorusp0->maximum(127); - chorusp0->callback((Fl_Callback*)cb_chorusp01); - chorusp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp0 - { chorusp2 = new WidgetPDial(45, 40, 30, 30, "Freq"); - chorusp2->tooltip("LFO Frequency"); - chorusp2->box(FL_ROUND_UP_BOX); - chorusp2->color(FL_BACKGROUND_COLOR); - chorusp2->selection_color(FL_INACTIVE_COLOR); - chorusp2->labeltype(FL_NORMAL_LABEL); - chorusp2->labelfont(1); - chorusp2->labelsize(11); - chorusp2->labelcolor(FL_FOREGROUND_COLOR); - chorusp2->maximum(127); - chorusp2->callback((Fl_Callback*)cb_chorusp21); - chorusp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp2 - { chorusp6 = new WidgetPDial(80, 40, 30, 30, "Dpth"); - chorusp6->tooltip("Depth"); - chorusp6->box(FL_ROUND_UP_BOX); - chorusp6->color(FL_BACKGROUND_COLOR); - chorusp6->selection_color(FL_INACTIVE_COLOR); - chorusp6->labeltype(FL_NORMAL_LABEL); - chorusp6->labelfont(1); - chorusp6->labelsize(11); - chorusp6->labelcolor(FL_FOREGROUND_COLOR); - chorusp6->maximum(127); - chorusp6->callback((Fl_Callback*)cb_chorusp61); - chorusp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp6 - { chorusp7 = new WidgetPDial(115, 40, 30, 30, "Delay"); - chorusp7->box(FL_ROUND_UP_BOX); - chorusp7->color(FL_BACKGROUND_COLOR); - chorusp7->selection_color(FL_INACTIVE_COLOR); - chorusp7->labeltype(FL_NORMAL_LABEL); - chorusp7->labelfont(1); - chorusp7->labelsize(11); - chorusp7->labelcolor(FL_FOREGROUND_COLOR); - chorusp7->maximum(127); - chorusp7->callback((Fl_Callback*)cb_chorusp71); - chorusp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp7 - { chorusp8 = new WidgetPDial(150, 40, 30, 30, "Fb"); - chorusp8->tooltip("Feedback"); - chorusp8->box(FL_ROUND_UP_BOX); - chorusp8->color(FL_BACKGROUND_COLOR); - chorusp8->selection_color(FL_INACTIVE_COLOR); - chorusp8->labeltype(FL_NORMAL_LABEL); - chorusp8->labelfont(1); - chorusp8->labelsize(11); - chorusp8->labelcolor(FL_FOREGROUND_COLOR); - chorusp8->maximum(127); - chorusp8->callback((Fl_Callback*)cb_chorusp81); - chorusp8->align(Fl_Align(FL_ALIGN_BOTTOM)); - chorusp8->when(FL_WHEN_CHANGED); - } // WidgetPDial* chorusp8 - { Fl_Check_Button* o = new Fl_Check_Button(120, 10, 55, 20, "Flange"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->color((Fl_Color)230); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Flange1); - o->hide(); - o->deactivate(); - o->value(eff->geteffectpar(10)); - } // Fl_Check_Button* o - effchoruswindow->end(); - } // Fl_Group* effchoruswindow - return effchoruswindow; -} - -Fl_Group* SimpleEffUI::make_phaser_window() { - { effphaserwindow = new Fl_Group(0, 0, 230, 95); - effphaserwindow->box(FL_PLASTIC_UP_BOX); - effphaserwindow->color((Fl_Color)221); - effphaserwindow->selection_color(FL_BACKGROUND_COLOR); - effphaserwindow->labeltype(FL_NO_LABEL); - effphaserwindow->labelfont(1); - effphaserwindow->labelsize(14); - effphaserwindow->labelcolor(FL_FOREGROUND_COLOR); - effphaserwindow->user_data((void*)(this)); - effphaserwindow->align(Fl_Align(FL_ALIGN_TOP)); - effphaserwindow->when(FL_WHEN_RELEASE); - { phaserp = new Fl_Choice(10, 15, 90, 15, "Preset"); - phaserp->down_box(FL_BORDER_BOX); - phaserp->color((Fl_Color)14); - phaserp->selection_color(FL_FOREGROUND_COLOR); - phaserp->labelfont(1); - phaserp->labelsize(10); - phaserp->textfont(1); - phaserp->textsize(10); - phaserp->textcolor(FL_BACKGROUND2_COLOR); - phaserp->callback((Fl_Callback*)cb_phaserpa); - phaserp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - phaserp->menu(menu_phaserp1); - } // Fl_Choice* phaserp - { Fl_Text_Display* o = new Fl_Text_Display(125, 10, 10, 20, "Phaser"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { phaserp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - phaserp0->tooltip("Effect Volume"); - phaserp0->box(FL_ROUND_UP_BOX); - phaserp0->color(FL_BACKGROUND_COLOR); - phaserp0->selection_color(FL_INACTIVE_COLOR); - phaserp0->labeltype(FL_NORMAL_LABEL); - phaserp0->labelfont(1); - phaserp0->labelsize(11); - phaserp0->labelcolor(FL_FOREGROUND_COLOR); - phaserp0->maximum(127); - phaserp0->callback((Fl_Callback*)cb_phaserp01); - phaserp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp0 - { phaserp2 = new WidgetPDial(45, 40, 30, 30, "Freq"); - phaserp2->tooltip("LFO frequency"); - phaserp2->box(FL_ROUND_UP_BOX); - phaserp2->color(FL_BACKGROUND_COLOR); - phaserp2->selection_color(FL_INACTIVE_COLOR); - phaserp2->labeltype(FL_NORMAL_LABEL); - phaserp2->labelfont(1); - phaserp2->labelsize(11); - phaserp2->labelcolor(FL_FOREGROUND_COLOR); - phaserp2->maximum(127); - phaserp2->callback((Fl_Callback*)cb_phaserp21); - phaserp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp2 - { phaserp5 = new WidgetPDial(80, 40, 30, 30, "St.df"); - phaserp5->tooltip("Left/Right Channel Phase Shift"); - phaserp5->box(FL_ROUND_UP_BOX); - phaserp5->color(FL_BACKGROUND_COLOR); - phaserp5->selection_color(FL_INACTIVE_COLOR); - phaserp5->labeltype(FL_NORMAL_LABEL); - phaserp5->labelfont(1); - phaserp5->labelsize(11); - phaserp5->labelcolor(FL_FOREGROUND_COLOR); - phaserp5->maximum(127); - phaserp5->callback((Fl_Callback*)cb_phaserp51); - phaserp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp5->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp5 - { phaserp6 = new WidgetPDial(115, 40, 30, 30, "Dpth"); - phaserp6->tooltip("Depth"); - phaserp6->box(FL_ROUND_UP_BOX); - phaserp6->color(FL_BACKGROUND_COLOR); - phaserp6->selection_color(FL_INACTIVE_COLOR); - phaserp6->labeltype(FL_NORMAL_LABEL); - phaserp6->labelfont(1); - phaserp6->labelsize(11); - phaserp6->labelcolor(FL_FOREGROUND_COLOR); - phaserp6->maximum(127); - phaserp6->callback((Fl_Callback*)cb_phaserp61); - phaserp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp6 - { phaserp7 = new WidgetPDial(150, 40, 30, 30, "Fb"); - phaserp7->tooltip("Feedback"); - phaserp7->box(FL_ROUND_UP_BOX); - phaserp7->color(FL_BACKGROUND_COLOR); - phaserp7->selection_color(FL_INACTIVE_COLOR); - phaserp7->labeltype(FL_NORMAL_LABEL); - phaserp7->labelfont(1); - phaserp7->labelsize(11); - phaserp7->labelcolor(FL_FOREGROUND_COLOR); - phaserp7->maximum(127); - phaserp7->callback((Fl_Callback*)cb_phaserp71); - phaserp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - phaserp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* phaserp7 - { Fl_Counter* o = phaserp8 = new Fl_Counter(185, 55, 35, 15, "Stages"); - phaserp8->type(1); - phaserp8->labelfont(1); - phaserp8->labelsize(11); - phaserp8->minimum(0); - phaserp8->maximum(127); - phaserp8->step(1); - phaserp8->callback((Fl_Callback*)cb_phaserp81); - o->range(1,MAX_PHASER_STAGES); - } // Fl_Counter* phaserp8 - effphaserwindow->end(); - } // Fl_Group* effphaserwindow - return effphaserwindow; -} - -Fl_Group* SimpleEffUI::make_alienwah_window() { - { effalienwahwindow = new Fl_Group(0, 0, 230, 95); - effalienwahwindow->box(FL_PLASTIC_UP_BOX); - effalienwahwindow->color((Fl_Color)221); - effalienwahwindow->selection_color(FL_BACKGROUND_COLOR); - effalienwahwindow->labeltype(FL_NO_LABEL); - effalienwahwindow->labelfont(1); - effalienwahwindow->labelsize(14); - effalienwahwindow->labelcolor(FL_FOREGROUND_COLOR); - effalienwahwindow->user_data((void*)(this)); - effalienwahwindow->align(Fl_Align(FL_ALIGN_TOP)); - effalienwahwindow->when(FL_WHEN_RELEASE); - { awp = new Fl_Choice(10, 15, 90, 15, "Preset"); - awp->down_box(FL_BORDER_BOX); - awp->color((Fl_Color)14); - awp->selection_color(FL_FOREGROUND_COLOR); - awp->labelfont(1); - awp->labelsize(10); - awp->textfont(1); - awp->textsize(10); - awp->textcolor(FL_BACKGROUND2_COLOR); - awp->callback((Fl_Callback*)cb_awpa); - awp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - awp->menu(menu_awp1); - } // Fl_Choice* awp - { Fl_Text_Display* o = new Fl_Text_Display(100, 10, 10, 20, "AlienWah"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { awp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - awp0->tooltip("Effect Volume"); - awp0->box(FL_ROUND_UP_BOX); - awp0->color(FL_BACKGROUND_COLOR); - awp0->selection_color(FL_INACTIVE_COLOR); - awp0->labeltype(FL_NORMAL_LABEL); - awp0->labelfont(1); - awp0->labelsize(11); - awp0->labelcolor(FL_FOREGROUND_COLOR); - awp0->maximum(127); - awp0->callback((Fl_Callback*)cb_awp01); - awp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp0 - { awp2 = new WidgetPDial(45, 40, 30, 30, "Freq"); - awp2->tooltip("LFO frequency"); - awp2->box(FL_ROUND_UP_BOX); - awp2->color(FL_BACKGROUND_COLOR); - awp2->selection_color(FL_INACTIVE_COLOR); - awp2->labeltype(FL_NORMAL_LABEL); - awp2->labelfont(1); - awp2->labelsize(11); - awp2->labelcolor(FL_FOREGROUND_COLOR); - awp2->maximum(127); - awp2->callback((Fl_Callback*)cb_awp21); - awp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp2 - { awp6 = new WidgetPDial(85, 40, 30, 30, "Dpth"); - awp6->tooltip("Depth"); - awp6->box(FL_ROUND_UP_BOX); - awp6->color(FL_BACKGROUND_COLOR); - awp6->selection_color(FL_INACTIVE_COLOR); - awp6->labeltype(FL_NORMAL_LABEL); - awp6->labelfont(1); - awp6->labelsize(11); - awp6->labelcolor(FL_FOREGROUND_COLOR); - awp6->maximum(127); - awp6->callback((Fl_Callback*)cb_awp61); - awp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - awp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* awp6 - { Fl_Counter* o = awp8 = new Fl_Counter(125, 55, 35, 15, "Delay"); - awp8->type(1); - awp8->labelfont(1); - awp8->labelsize(11); - awp8->minimum(0); - awp8->maximum(127); - awp8->step(1); - awp8->callback((Fl_Callback*)cb_awp81); - o->range(1,MAX_ALIENWAH_DELAY); - } // Fl_Counter* awp8 - effalienwahwindow->end(); - } // Fl_Group* effalienwahwindow - return effalienwahwindow; -} - -Fl_Group* SimpleEffUI::make_distorsion_window() { - { effdistorsionwindow = new Fl_Group(0, 0, 230, 95); - effdistorsionwindow->box(FL_PLASTIC_UP_BOX); - effdistorsionwindow->color((Fl_Color)221); - effdistorsionwindow->selection_color(FL_BACKGROUND_COLOR); - effdistorsionwindow->labeltype(FL_NO_LABEL); - effdistorsionwindow->labelfont(1); - effdistorsionwindow->labelsize(14); - effdistorsionwindow->labelcolor(FL_FOREGROUND_COLOR); - effdistorsionwindow->user_data((void*)(this)); - effdistorsionwindow->align(Fl_Align(FL_ALIGN_TOP)); - effdistorsionwindow->when(FL_WHEN_RELEASE); - { distp = new Fl_Choice(11, 15, 95, 15, "Preset"); - distp->down_box(FL_BORDER_BOX); - distp->color((Fl_Color)14); - distp->selection_color(FL_FOREGROUND_COLOR); - distp->labelfont(1); - distp->labelsize(10); - distp->textfont(1); - distp->textsize(10); - distp->textcolor(FL_BACKGROUND2_COLOR); - distp->callback((Fl_Callback*)cb_distpa); - distp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - distp->menu(menu_distp1); - } // Fl_Choice* distp - { Fl_Text_Display* o = new Fl_Text_Display(110, 10, 10, 20, "Distortion"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(16); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { distp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - distp0->tooltip("Effect Volume"); - distp0->box(FL_ROUND_UP_BOX); - distp0->color(FL_BACKGROUND_COLOR); - distp0->selection_color(FL_INACTIVE_COLOR); - distp0->labeltype(FL_NORMAL_LABEL); - distp0->labelfont(1); - distp0->labelsize(11); - distp0->labelcolor(FL_FOREGROUND_COLOR); - distp0->maximum(127); - distp0->callback((Fl_Callback*)cb_distp01); - distp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp0 - { distp3 = new WidgetPDial(45, 40, 30, 30, "Drive"); - distp3->tooltip("Input amplification"); - distp3->box(FL_ROUND_UP_BOX); - distp3->color(FL_BACKGROUND_COLOR); - distp3->selection_color(FL_INACTIVE_COLOR); - distp3->labeltype(FL_NORMAL_LABEL); - distp3->labelfont(1); - distp3->labelsize(11); - distp3->labelcolor(FL_FOREGROUND_COLOR); - distp3->maximum(127); - distp3->callback((Fl_Callback*)cb_distp31); - distp3->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp3->when(FL_WHEN_RELEASE); - } // WidgetPDial* distp3 - { distp4 = new WidgetPDial(80, 40, 30, 30, "Level"); - distp4->tooltip("Output Amplification"); - distp4->box(FL_ROUND_UP_BOX); - distp4->color(FL_BACKGROUND_COLOR); - distp4->selection_color(FL_INACTIVE_COLOR); - distp4->labeltype(FL_NORMAL_LABEL); - distp4->labelfont(1); - distp4->labelsize(11); - distp4->labelcolor(FL_FOREGROUND_COLOR); - distp4->maximum(127); - distp4->callback((Fl_Callback*)cb_distp41); - distp4->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp4->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp4 - { distp7 = new WidgetPDial(190, 40, 30, 30, "LPF"); - distp7->tooltip("Low Pass Filter"); - distp7->box(FL_ROUND_UP_BOX); - distp7->color(FL_BACKGROUND_COLOR); - distp7->selection_color(FL_INACTIVE_COLOR); - distp7->labeltype(FL_NORMAL_LABEL); - distp7->labelfont(1); - distp7->labelsize(11); - distp7->labelcolor(FL_FOREGROUND_COLOR); - distp7->maximum(127); - distp7->callback((Fl_Callback*)cb_distp71); - distp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* distp7 - { distp5 = new Fl_Choice(120, 50, 60, 20, "Type"); - distp5->box(FL_UP_BOX); - distp5->down_box(FL_BORDER_BOX); - distp5->labelfont(1); - distp5->labelsize(11); - distp5->textsize(10); - distp5->callback((Fl_Callback*)cb_distp51); - distp5->align(Fl_Align(FL_ALIGN_BOTTOM)); - distp5->menu(menu_distp51); - } // Fl_Choice* distp5 - effdistorsionwindow->end(); - } // Fl_Group* effdistorsionwindow - return effdistorsionwindow; -} - -Fl_Group* SimpleEffUI::make_eq_window() { - { effeqwindow = new Fl_Group(0, 0, 230, 95); - effeqwindow->box(FL_PLASTIC_UP_BOX); - effeqwindow->color((Fl_Color)221); - effeqwindow->selection_color(FL_BACKGROUND_COLOR); - effeqwindow->labeltype(FL_NO_LABEL); - effeqwindow->labelfont(1); - effeqwindow->labelsize(14); - effeqwindow->labelcolor(FL_FOREGROUND_COLOR); - effeqwindow->user_data((void*)(this)); - effeqwindow->align(Fl_Align(FL_ALIGN_TOP)); - effeqwindow->when(FL_WHEN_RELEASE); - { Fl_Text_Display* o = new Fl_Text_Display(170, 5, 15, 25, "EQ"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { Fl_Counter* o = bandcounter = new Fl_Counter(85, 15, 45, 15, "Band"); - bandcounter->tooltip("Band no."); - bandcounter->type(1); - bandcounter->labelfont(1); - bandcounter->labelsize(11); - bandcounter->minimum(0); - bandcounter->maximum(1); - bandcounter->step(1); - bandcounter->textfont(1); - bandcounter->textsize(11); - bandcounter->callback((Fl_Callback*)cb_bandcounter1); - bandcounter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(0,MAX_EQ_BANDS-1); - } // Fl_Counter* bandcounter - { Fl_Group* o = bandgroup = new Fl_Group(5, 5, 75, 85); - bandgroup->box(FL_ENGRAVED_FRAME); - { freqdial = new WidgetPDial(10, 10, 25, 25, "Freq"); - freqdial->box(FL_ROUND_UP_BOX); - freqdial->color(FL_BACKGROUND_COLOR); - freqdial->selection_color(FL_INACTIVE_COLOR); - freqdial->labeltype(FL_NORMAL_LABEL); - freqdial->labelfont(1); - freqdial->labelsize(10); - freqdial->labelcolor(FL_FOREGROUND_COLOR); - freqdial->maximum(127); - freqdial->callback((Fl_Callback*)cb_freqdial1); - freqdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - freqdial->when(3); - } // WidgetPDial* freqdial - { gaindial = new WidgetPDial(45, 10, 25, 25, "Gain"); - gaindial->box(FL_ROUND_UP_BOX); - gaindial->color(FL_BACKGROUND_COLOR); - gaindial->selection_color(FL_INACTIVE_COLOR); - gaindial->labeltype(FL_NORMAL_LABEL); - gaindial->labelfont(1); - gaindial->labelsize(10); - gaindial->labelcolor(FL_FOREGROUND_COLOR); - gaindial->maximum(127); - gaindial->step(1); - gaindial->callback((Fl_Callback*)cb_gaindial1); - gaindial->align(Fl_Align(FL_ALIGN_BOTTOM)); - gaindial->when(3); - } // WidgetPDial* gaindial - { qdial = new WidgetPDial(10, 50, 25, 25, "Q"); - qdial->tooltip("Bandwidth/Resonance"); - qdial->box(FL_ROUND_UP_BOX); - qdial->color(FL_BACKGROUND_COLOR); - qdial->selection_color(FL_INACTIVE_COLOR); - qdial->labeltype(FL_NORMAL_LABEL); - qdial->labelfont(1); - qdial->labelsize(10); - qdial->labelcolor(FL_FOREGROUND_COLOR); - qdial->maximum(127); - qdial->callback((Fl_Callback*)cb_qdial1); - qdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - qdial->when(3); - } // WidgetPDial* qdial - { Fl_Counter* o = stagescounter = new Fl_Counter(40, 55, 30, 15, "Stages"); - stagescounter->tooltip("Additional filter stages"); - stagescounter->type(1); - stagescounter->labelfont(1); - stagescounter->labelsize(10); - stagescounter->minimum(1); - stagescounter->maximum(127); - stagescounter->step(1); - stagescounter->textfont(1); - stagescounter->textsize(11); - stagescounter->callback((Fl_Callback*)cb_stagescounter1); - o->bounds(0,MAX_FILTER_STAGES-1); - } // Fl_Counter* stagescounter - if (eff->geteffectpar(10)==0) o->deactivate(); - bandgroup->end(); - } // Fl_Group* bandgroup - { typechoice = new Fl_Choice(135, 15, 40, 15, "Type"); - typechoice->tooltip("Type"); - typechoice->down_box(FL_BORDER_BOX); - typechoice->labelfont(1); - typechoice->labelsize(10); - typechoice->textsize(10); - typechoice->callback((Fl_Callback*)cb_typechoice1); - typechoice->align(Fl_Align(FL_ALIGN_TOP)); - typechoice->when(FL_WHEN_RELEASE_ALWAYS); - typechoice->menu(menu_typechoice1); - } // Fl_Choice* typechoice - { EQGraph* o = eqgraph = new EQGraph(85, 35, 140, 55); - eqgraph->box(FL_BORDER_BOX); - eqgraph->color((Fl_Color)178); - eqgraph->selection_color(FL_BACKGROUND_COLOR); - eqgraph->labeltype(FL_NORMAL_LABEL); - eqgraph->labelfont(0); - eqgraph->labelsize(14); - eqgraph->labelcolor(FL_FOREGROUND_COLOR); - eqgraph->align(Fl_Align(FL_ALIGN_CENTER)); - eqgraph->when(FL_WHEN_RELEASE); - o->init(eff); - } // EQGraph* eqgraph - effeqwindow->end(); - } // Fl_Group* effeqwindow - return effeqwindow; -} - -Fl_Group* SimpleEffUI::make_dynamicfilter_window() { - { effdynamicfilterwindow = new Fl_Group(0, 0, 230, 95); - effdynamicfilterwindow->box(FL_PLASTIC_UP_BOX); - effdynamicfilterwindow->color((Fl_Color)221); - effdynamicfilterwindow->selection_color(FL_BACKGROUND_COLOR); - effdynamicfilterwindow->labeltype(FL_NO_LABEL); - effdynamicfilterwindow->labelfont(1); - effdynamicfilterwindow->labelsize(14); - effdynamicfilterwindow->labelcolor(FL_FOREGROUND_COLOR); - effdynamicfilterwindow->user_data((void*)(this)); - effdynamicfilterwindow->align(Fl_Align(FL_ALIGN_TOP)); - effdynamicfilterwindow->when(FL_WHEN_RELEASE); - { dfp = new Fl_Choice(10, 15, 90, 15, "Preset"); - dfp->down_box(FL_BORDER_BOX); - dfp->color((Fl_Color)14); - dfp->selection_color(FL_FOREGROUND_COLOR); - dfp->labelfont(1); - dfp->labelsize(10); - dfp->textfont(1); - dfp->textsize(10); - dfp->textcolor(FL_BACKGROUND2_COLOR); - dfp->callback((Fl_Callback*)cb_dfpa); - dfp->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - dfp->menu(menu_dfp1); - } // Fl_Choice* dfp - { Fl_Text_Display* o = new Fl_Text_Display(100, 10, 10, 20, "DynFilter"); - o->box(FL_NO_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Text_Display* o - { dfp0 = new WidgetPDial(10, 40, 30, 30, "Vol"); - dfp0->tooltip("Effect Volume"); - dfp0->box(FL_ROUND_UP_BOX); - dfp0->color(FL_BACKGROUND_COLOR); - dfp0->selection_color(FL_INACTIVE_COLOR); - dfp0->labeltype(FL_NORMAL_LABEL); - dfp0->labelfont(1); - dfp0->labelsize(11); - dfp0->labelcolor(FL_FOREGROUND_COLOR); - dfp0->maximum(127); - dfp0->callback((Fl_Callback*)cb_dfp01); - dfp0->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp0->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp0 - { dfp2 = new WidgetPDial(45, 40, 30, 30, "Freq"); - dfp2->tooltip("LFO frequency"); - dfp2->box(FL_ROUND_UP_BOX); - dfp2->color(FL_BACKGROUND_COLOR); - dfp2->selection_color(FL_INACTIVE_COLOR); - dfp2->labeltype(FL_NORMAL_LABEL); - dfp2->labelfont(1); - dfp2->labelsize(11); - dfp2->labelcolor(FL_FOREGROUND_COLOR); - dfp2->maximum(127); - dfp2->callback((Fl_Callback*)cb_dfp21); - dfp2->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp2->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp2 - { dfp6 = new WidgetPDial(80, 40, 30, 30, "LfoD"); - dfp6->tooltip("LFO depth"); - dfp6->box(FL_ROUND_UP_BOX); - dfp6->color(FL_BACKGROUND_COLOR); - dfp6->selection_color(FL_INACTIVE_COLOR); - dfp6->labeltype(FL_NORMAL_LABEL); - dfp6->labelfont(1); - dfp6->labelsize(11); - dfp6->labelcolor(FL_FOREGROUND_COLOR); - dfp6->maximum(127); - dfp6->callback((Fl_Callback*)cb_dfp61); - dfp6->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp6->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp6 - { Fl_Group* o = new Fl_Group(115, 40, 65, 45); - o->box(FL_BORDER_BOX); - o->color((Fl_Color)181); - { dfp7 = new WidgetPDial(120, 45, 25, 25, "A.S."); - dfp7->tooltip("how filter varies with amplitude"); - dfp7->box(FL_ROUND_UP_BOX); - dfp7->color(FL_BACKGROUND_COLOR); - dfp7->selection_color(FL_INACTIVE_COLOR); - dfp7->labeltype(FL_NORMAL_LABEL); - dfp7->labelfont(1); - dfp7->labelsize(11); - dfp7->labelcolor(FL_FOREGROUND_COLOR); - dfp7->maximum(127); - dfp7->callback((Fl_Callback*)cb_dfp71); - dfp7->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp7->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp7 - { dfp9 = new WidgetPDial(150, 45, 25, 25, "A.M"); - dfp9->tooltip("how quickly the filter varies with amplitude"); - dfp9->box(FL_ROUND_UP_BOX); - dfp9->color(FL_BACKGROUND_COLOR); - dfp9->selection_color(FL_INACTIVE_COLOR); - dfp9->labeltype(FL_NORMAL_LABEL); - dfp9->labelfont(1); - dfp9->labelsize(11); - dfp9->labelcolor(FL_FOREGROUND_COLOR); - dfp9->maximum(127); - dfp9->callback((Fl_Callback*)cb_dfp91); - dfp9->align(Fl_Align(FL_ALIGN_BOTTOM)); - dfp9->when(FL_WHEN_CHANGED); - } // WidgetPDial* dfp9 - o->end(); - } // Fl_Group* o - effdynamicfilterwindow->end(); - } // Fl_Group* effdynamicfilterwindow - return effdynamicfilterwindow; -} - -void SimpleEffUI::init(EffectMgr *eff_) { - eff=eff_; - - make_null_window(); - make_reverb_window(); - make_echo_window(); - make_chorus_window(); - make_phaser_window(); - make_alienwah_window(); - make_distorsion_window(); - make_eq_window(); - make_dynamicfilter_window(); - - int px=this->parent()->x(); - int py=this->parent()->y(); - - effnullwindow->position(px,py); - effreverbwindow->position(px,py); - effechowindow->position(px,py); - effchoruswindow->position(px,py); - effphaserwindow->position(px,py); - effalienwahwindow->position(px,py); - effdistorsionwindow->position(px,py); - effeqwindow->position(px,py); - effdynamicfilterwindow->position(px,py); - - refresh(eff); -} - -void SimpleEffUI::refresh(EffectMgr *eff_) { - eff=eff_; - this->hide(); - - effnullwindow->hide(); - effreverbwindow->hide(); - effechowindow->hide(); - effchoruswindow->hide(); - effphaserwindow->hide(); - effalienwahwindow->hide(); - effdistorsionwindow->hide(); - effeqwindow->hide(); - effdynamicfilterwindow->hide(); - - eqband=0; - - - switch(eff->geteffect()){ - case 1: - revp->value(eff->getpreset()); - revp0->value(eff->geteffectpar(0));if (eff->insertion!=0) revp0->label("D/W"); - revp2->value(eff->geteffectpar(2)); - revp3->value(eff->geteffectpar(3)); - revp9->value(eff->geteffectpar(9)); - effreverbwindow->show(); - break; - case 2: - echop->value(eff->getpreset()); - echop0->value(eff->geteffectpar(0));if (eff->insertion!=0) echop0->label("D/W"); - echop2->value(eff->geteffectpar(2)); - echop5->value(eff->geteffectpar(5)); - effechowindow->show(); - break; - case 3: - chorusp->value(eff->getpreset()); - chorusp0->value(eff->geteffectpar(0));if (eff->insertion!=0) chorusp0->label("D/W"); - chorusp2->value(eff->geteffectpar(2)); - chorusp6->value(eff->geteffectpar(6)); - chorusp7->value(eff->geteffectpar(7)); - chorusp8->value(eff->geteffectpar(8)); - effchoruswindow->show(); - break; - case 4: - phaserp->value(eff->getpreset()); - phaserp0->value(eff->geteffectpar(0));if (eff->insertion!=0) phaserp0->label("D/W"); - phaserp2->value(eff->geteffectpar(2)); - phaserp5->value(eff->geteffectpar(5)); - phaserp6->value(eff->geteffectpar(6)); - phaserp7->value(eff->geteffectpar(7)); - phaserp8->value(eff->geteffectpar(8)); - effphaserwindow->show(); - break; - case 5: - awp->value(eff->getpreset()); - awp0->value(eff->geteffectpar(0));if (eff->insertion!=0) awp0->label("D/W"); - awp2->value(eff->geteffectpar(2)); - awp6->value(eff->geteffectpar(6)); - awp8->value(eff->geteffectpar(8)); - effalienwahwindow->show(); - break; - case 6: - distp->value(eff->getpreset()); - distp0->value(eff->geteffectpar(0));if (eff->insertion!=0) distp0->label("D/W"); - distp3->value(eff->geteffectpar(3)); - distp4->value(eff->geteffectpar(4)); - distp5->value(eff->geteffectpar(5)); - distp7->value(eff->geteffectpar(7)); - effdistorsionwindow->show(); - break; - case 7: - bandcounter->value(eqband); - bandcounter->do_callback(); - typechoice->value(eff->geteffectpar(10)); - eqgraph->redraw(); - freqdial->value(eff->geteffectpar(11)); - gaindial->value(eff->geteffectpar(12)); - if (eff->geteffectpar(10)<6) gaindial->deactivate(); - qdial->value(eff->geteffectpar(13)); - stagescounter->value(eff->geteffectpar(14)); - eqgraph->init(eff); - effeqwindow->show(); - break; - case 8: - dfp->value(eff->getpreset()); - dfp0->value(eff->geteffectpar(0));if (eff->insertion!=0) dfp0->label("D/W"); - dfp2->value(eff->geteffectpar(2)); - dfp6->value(eff->geteffectpar(6)); - dfp7->value(eff->geteffectpar(7)); - dfp9->value(eff->geteffectpar(9)); - - - effdynamicfilterwindow->show(); - break; - default:effnullwindow->show(); - break; - }; - - this->show(); -} - -void SimpleEffUI::refresh() { - refresh(eff); -} diff --git a/plugins/zynaddsubfx/src/UI/EffUI.fl b/plugins/zynaddsubfx/src/UI/EffUI.fl deleted file mode 100644 index d82099c3e..000000000 --- a/plugins/zynaddsubfx/src/UI/EffUI.fl +++ /dev/null @@ -1,2361 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Effects/EffectMgr.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class EQGraph {: {public Fl_Box} -} { - Function {EQGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {eff=NULL; -maxdB=30;} {} - } - Function {init(EffectMgr *eff_)} {} { - code {eff=eff_; -oldx=-1; -khzval=-1;} {} - } - Function {draw_freq_line(REALTYPE freq,int type)} {} { - code {fl_color(FL_GRAY); -REALTYPE freqx=getfreqpos(freq); -switch(type){ - case 0:if (active_r()) fl_color(FL_WHITE); - else fl_color(205,205,205); - fl_line_style(FL_SOLID); - break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; -}; - - -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h());} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i,iy,oiy; -REALTYPE freqx; - -if (active_r()) fl_color(0,70,150); - else fl_color(80,120,160); -fl_rectf(ox,oy,lx,ly); - - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -freqx=getfreqpos(1000.0); -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - -for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*10.0,2); - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*10.0,1); - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; -}; - -draw_freq_line(10000.0,0); -draw_freq_line(20000.0,1); - - -fl_line_style(FL_DOT); -int GY=6;if (lySAMPLE_RATE/2) break; - iy=getresponse(ly,frq); - if ((oiy>=0) && (oiy=0) && (iygetEQfreqresponse(freq); -int idbresp=(int) ((dbresp/maxdB+1.0)*maxy/2.0); - - -//fprintf(stderr,"%.5f\\n",(dbresp/maxdB+1.0)*maxy/2.0); - - -return(idbresp);} {} - } - Function {getfreqx(REALTYPE x)} {return_type REALTYPE - } { - code {if (x>1.0) x=1.0; -return(20.0*pow((REALTYPE)1000.0,x));} {} - } - Function {getfreqpos(REALTYPE freq)} {return_type REALTYPE - } { - code {if (freq<0.00001) freq=0.00001; -return(log(freq/20.0)/log(1000.0));} {} - } - decl {int oldx;} {} - decl {REALTYPE khzval;} {public - } - decl {EffectMgr *eff;} {} - decl {int maxdB;} {} -} - -class EffUI {: {public Fl_Group,public PresetsUI_} -} { - Function {EffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {eff=NULL; -filterwindow=NULL;} {} - } - Function {~EffUI()} {} { - code {effnullwindow->hide();//delete (effnullwindow); -effreverbwindow->hide();//delete (effreverbwindow); -effechowindow->hide();//delete (effechowindow); -effchoruswindow->hide();//delete (effchoruswindow); -effphaserwindow->hide();//delete (effphaserwindow); -effalienwahwindow->hide();//delete (effalienwahwindow); -effdistorsionwindow->hide();//delete (effdistorsionwindow); -effeqwindow->hide();//delete (effeqwindow); -effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow); - -if (filterwindow!=NULL){ - filterwindow->hide(); - delete(filterwindow); -};} {} - } - Function {make_null_window()} {} { - Fl_Window effnullwindow { - xywh {216 539 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Text_Display {} { - label {No Effect} - xywh {120 35 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 labelcolor 43 align 8 - } - } - } - Function {make_reverb_window()} {} { - Fl_Window effreverbwindow { - xywh {343 337 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Text_Display {} { - label {Reverb } - xywh {275 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Choice revp { - label Preset - callback {eff->changepreset((int)o->value()); - -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Cathedral 1} - xywh {10 10 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Cathedral 2} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Cathedral 3} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Hall 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Hall 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Room 1} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Room 2} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Basement - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Tunnel - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echoed 1} - xywh {100 100 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echoed 2} - xywh {110 110 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Very Long 1} - xywh {120 120 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Very Long 2} - xywh {130 130 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Choice revp10 { - label Type - callback {eff->seteffectpar(10,(int) o->value()); -if (eff->geteffectpar(10)==2) revp12->activate(); - else revp12->deactivate();} - xywh {110 15 85 15} down_box BORDER_BOX color 14 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label Random - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Freeverb - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Bandwidth - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Dial revp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp2 { - label Time - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {Duration of Effect} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp3 { - label {I.del} - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Initial Delay} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial revp4 { - label {I.delfb} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {Initial Delay Feedback} xywh {155 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp12 { - label bw - callback {eff->seteffectpar(12,(int) o->value());} - xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 deactivate - code0 {if (eff->geteffectpar(10)==2) o->activate();} - class WidgetPDial - } - Fl_Dial revp6 { - label {E/R} - callback {eff->seteffectpar(6,(int) o->value());} - xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 deactivate - class WidgetPDial - } - Fl_Dial revp7 { - label LPF - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Low Pass Filter} xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp8 { - label HPF - callback {eff->seteffectpar(8,(int) o->value());} - tooltip {High Pass Filter} xywh {305 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp9 { - label Damp - callback {eff->seteffectpar(9,(int) o->value());} - tooltip Dampening xywh {340 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 minimum 64 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial revp11 { - label {R.S.} - callback {int x=64; -if (Fl::event_button1()) x=(int)o->value(); - else o->value(x); -eff->seteffectpar(11,x);} - tooltip RoomSize xywh {200 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 8 align 8 minimum 1 maximum 127 step 1 - class WidgetPDial - } - } - } - Function {make_echo_window()} {} { - Fl_Window effechowindow { - xywh {318 364 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice echop { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Echo 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echo 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echo 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Simple Echo} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Canyon - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Panning Echo 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Panning Echo 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Panning Echo 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Feedback Echo} - xywh {100 100 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Echo - xywh {295 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial echop0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop2 { - label Delay - callback {eff->seteffectpar(2,(int) o->value());} - xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial echop3 { - label {LRdl.} - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Delay Between L/R} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial echop4 { - label {LRc.} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {L/R Crossover} xywh {155 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop5 { - label {Fb.} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip Feedback xywh {195 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop6 { - label Damp - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Dampening xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - } - } - Function {make_chorus_window()} {} { - Fl_Window effchoruswindow { - xywh {372 287 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice chorusp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Chorus 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Chorus 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Chorus 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Celeste 1} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Celeste 2} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 4} - xywh {100 100 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 5} - xywh {110 110 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Chorus - xywh {265 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial chorusp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO Randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {L/R Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO Depth} xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp7 { - label Delay - callback {eff->seteffectpar(7,(int) o->value());} - xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp8 { - label Fb - callback {eff->seteffectpar(8,(int) o->value());} - tooltip Feedback xywh {305 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp9 { - label {L/R} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {Channel Routing} xywh {340 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button {} { - label Flange - callback {eff->seteffectpar(10,(int) o->value());} - xywh {120 10 55 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10 hide deactivate - code0 {o->value(eff->geteffectpar(10));} - } - Fl_Check_Button chorusp11 { - label Substract - callback {eff->seteffectpar(11,(int) o->value());} - tooltip {inverts the output} xywh {185 10 70 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10 - } - Fl_Choice chorusp4 { - label {LFO type} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SINE - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - } - } - Function {make_phaser_window()} {} { - Fl_Window effphaserwindow { - xywh {75 25 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice phaserp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 100 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Phaser 1} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 2} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 3} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 4} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 5} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 6} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {APhaser 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {APhaser 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {APhaser 3} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {APhaser 4} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {APhaser 5} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {APhaser 6} selected - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Phaser - xywh {275 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial phaserp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {85 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO randomness} xywh {120 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Choice phaserp4 { - label LFO - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {245 55 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SIN - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial phaserp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {155 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO Depth} xywh {120 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp7 { - label Fb - callback {eff->seteffectpar(7,(int) o->value());} - tooltip Feedback xywh {185 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter phaserp8 { - label Stages - callback {eff->seteffectpar(8,(int) o->value());} - xywh {290 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_PHASER_STAGES);} - } - Fl_Dial phaserp9 { - label {L/R} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {Channel Routing} xywh {215 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button phaserp10 { - label Substract - callback {eff->seteffectpar(10,(int) o->value());} - tooltip {inverts output} xywh {200 10 74 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10 - } - Fl_Dial phaserp11 { - label Phase - callback {eff->seteffectpar(11,(int) o->value());} - xywh {155 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127 - class WidgetPDial - } - Fl_Check_Button phaserp12 { - label {hyp.} - callback {eff->seteffectpar(12,(int) o->value());} - tooltip hyper xywh {245 35 55 15} down_box DOWN_BOX - } - Fl_Dial phaserp13 { - label dist - callback {eff->seteffectpar(13,(int) o->value());} - tooltip Distortion xywh {340 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button phaserp14 { - label Analog - callback {eff->seteffectpar(14,(int) o->value());} - xywh {305 35 70 15} down_box DOWN_BOX - } - } - } - Function {make_alienwah_window()} {} { - Fl_Window effalienwahwindow { - xywh {538 250 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice awp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Alienwah 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Alienwah 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Alienwah 3} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Alienwah 4} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label AlienWah - xywh {245 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial awp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO Randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial awp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp7 { - label Fb - callback {eff->seteffectpar(7,(int) o->value());} - tooltip Feedback xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp9 { - label {L/R} - callback {eff->seteffectpar(9,(int) o->value());} - xywh {345 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice awp4 { - label {LFO type} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SINE - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial awp10 { - label Phase - callback {eff->seteffectpar(10,(int) o->value());} - xywh {160 5 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter awp8 { - label Delay - callback {eff->seteffectpar(8,(int) o->value());} - xywh {305 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_ALIENWAH_DELAY);} - } - } - } - Function {make_distorsion_window()} {} { - Fl_Window effdistorsionwindow { - xywh {409 143 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice distp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Overdrive 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Overdrive 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {A. Exciter 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {A. Exciter 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Guitar Amp} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Quantisize - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Distortion - xywh {230 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial distp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp2 { - label {LRc.} - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {L/R Mix} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial distp3 { - label Drive - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Input Amplification} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial distp4 { - label Level - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {Output Amplification} xywh {155 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp7 { - label LPF - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Low Pass Filter} xywh {285 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp8 { - label HPF - callback {eff->seteffectpar(8,(int) o->value());} - tooltip {High Pass Filter} xywh {320 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice distp5 { - label Type - callback {eff->seteffectpar(5,(int) o->value());} - xywh {190 50 60 20} box UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 align 2 textsize 10 - } { - MenuItem {} { - label Atan - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym1 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Qnts - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Zigzg - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lmt - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtU - xywh {125 125 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtL - xywh {135 135 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ILmt - xywh {147 147 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Clip - xywh {157 157 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sgm - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - } - Fl_Check_Button distp6 { - label {Neg.} - callback {eff->seteffectpar(6,(int) o->value());} - xywh {260 55 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 2 - } - Fl_Check_Button distp9 { - label {St.} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip Stereo xywh {355 60 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 2 - } - Fl_Check_Button distp10 { - label PF - callback {eff->seteffectpar(10,(int) o->value());} - tooltip {Applies the filters(before or after) the distorsion} xywh {355 44 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 1 - } - } - } - Function {make_eq_window()} {} { - Fl_Window effeqwindow { - xywh {258 307 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Text_Display {} { - label EQ - xywh {320 10 15 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial eqp0 { - label Gain - callback {eff->seteffectpar(0,(int) o->value()); -eqgraph->redraw();} - xywh {10 35 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter bandcounter { - label {B.} - callback {eqband=(int) o->value(); -int npb=eqband*5+10; - -int type=eff->geteffectpar(npb); -typechoice->value(type); - -if (type>6) gaindial->activate(); - else gaindial->deactivate(); - -if (type==0) bandgroup->deactivate(); -else bandgroup->activate(); - -int freq=eff->geteffectpar(npb+1); -freqdial->value(freq); - -int gain=eff->geteffectpar(npb+2); -gaindial->value(gain); - -int q=eff->geteffectpar(npb+3); -qdial->value(q); - -int dbl=eff->geteffectpar(npb+4); -stagescounter->value(dbl);} - tooltip {Band no.} xywh {240 20 45 15} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 1 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_EQ_BANDS-1);} - } - Fl_Group bandgroup { - xywh {245 40 130 50} box ENGRAVED_FRAME - code0 {if (eff->geteffectpar(10)==0) o->deactivate();} - } { - Fl_Dial freqdial { - label Freq - callback {int np=eqband*5+11; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {250 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Dial gaindial { - label Gain - callback {int np=eqband*5+12; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {280 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial qdial { - label Q - callback {int np=eqband*5+13; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Resonance/Bandwidth} xywh {310 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Counter stagescounter { - label {St.} - callback {int np=eqband*5+14; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Additional filter stages} xywh {340 60 30 15} type Simple labelfont 1 labelsize 10 minimum 1 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_FILTER_STAGES-1);} - } - } - Fl_Choice typechoice { - label {T.} - callback {int np=eqband*5+10; -eff->seteffectpar(np,(int) o->value()); -bandcounter->do_callback(); -eqgraph->redraw();} - tooltip Type xywh {290 20 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 when 6 textsize 10 - } { - MenuItem {} { - label OFF - xywh {0 0 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp1 - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp1 - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp2 - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp2 - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Bp2 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label N2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pk - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HSh - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Box eqgraph { - xywh {45 10 190 75} box BORDER_BOX color 178 - code0 {o->init(eff);} - class EQGraph - } - } - } - Function {make_dynamicfilter_window()} {} { - Fl_Window effdynamicfilterwindow { - xywh {570 56 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice dfp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label WahWah - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label AutoWah - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Sweep - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label VocalMorph1 - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label VocalMorph2 - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label DynFilter - xywh {245 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial dfp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO Randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial dfp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp6 { - label LfoD - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO Depth} xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice dfp4 { - label {LFO type} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SINE - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - Fl_Button {} { - label Filter - callback {filterwindow->show();} - xywh {115 10 55 25} box PLASTIC_THIN_UP_BOX - } - Fl_Group {} { - xywh {270 40 105 45} box BORDER_BOX color 181 - } { - Fl_Dial dfp7 { - label {A.S.} - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Filter vs Amplitude} xywh {275 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp9 { - label {A.M} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {rate that amplitude changes the filter} xywh {305 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button dfp8 { - label {A.Inv.} - callback {eff->seteffectpar(8,(int) o->value());} - tooltip {enable for filter frequency to lower with higher input amplitude} xywh {345 55 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 2 - } - } - } - } - Function {make_filter_window()} {} { - Fl_Window filterwindow { - label {Filter Parameters for DynFilter Eff.} - xywh {212 170 290 110} type Double hide - } { - Fl_Group {} { - label {DynFilter effect - Filter} - xywh {5 5 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(eff->filterpars,NULL,NULL);} - code1 {o->use_for_dynamic_filter();} - class FilterUI - } {} - Fl_Button {} { - label Close - callback {filterwindow->hide();} - xywh {105 85 70 20} box THIN_UP_BOX - } - } - } - Function {init(EffectMgr *eff_)} {} { - code {eff=eff_; - -make_null_window(); -make_reverb_window(); -make_echo_window(); -make_chorus_window(); -make_phaser_window(); -make_alienwah_window(); -make_distorsion_window(); -make_eq_window(); -make_dynamicfilter_window(); - -int px=this->parent()->x(); -int py=this->parent()->y(); - -effnullwindow->position(px,py); -effreverbwindow->position(px,py); -effechowindow->position(px,py); -effchoruswindow->position(px,py); -effphaserwindow->position(px,py); -effalienwahwindow->position(px,py); -effdistorsionwindow->position(px,py); -effeqwindow->position(px,py); -effdynamicfilterwindow->position(px,py); - -refresh(eff);} {} - } - Function {refresh(EffectMgr *eff_)} {open - } { - code {eff=eff_; -this->hide(); - -effnullwindow->hide(); -effreverbwindow->hide(); -effechowindow->hide(); -effchoruswindow->hide(); -effphaserwindow->hide(); -effalienwahwindow->hide(); -effdistorsionwindow->hide(); -effeqwindow->hide(); -effdynamicfilterwindow->hide(); - -eqband=0; - -if (filterwindow!=NULL){ - filterwindow->hide(); - delete(filterwindow); - filterwindow=NULL; -}; - -switch(eff->geteffect()){ - case 1: - revp->value(eff->getpreset()); - revp0->value(eff->geteffectpar(0));if (eff->insertion!=0) revp0->label("D/W"); - revp1->value(eff->geteffectpar(1)); - revp2->value(eff->geteffectpar(2)); - revp3->value(eff->geteffectpar(3)); - revp4->value(eff->geteffectpar(4)); - //revp5->value(eff->geteffectpar(5)); - revp6->value(eff->geteffectpar(6)); - revp7->value(eff->geteffectpar(7)); - revp8->value(eff->geteffectpar(8)); - revp9->value(eff->geteffectpar(9)); - revp10->value(eff->geteffectpar(10)); - revp11->value(eff->geteffectpar(11)); - revp12->value(eff->geteffectpar(12)); - - effreverbwindow->show(); - break; - case 2: - echop->value(eff->getpreset()); - echop0->value(eff->geteffectpar(0));if (eff->insertion!=0) echop0->label("D/W"); - echop1->value(eff->geteffectpar(1)); - echop2->value(eff->geteffectpar(2)); - echop3->value(eff->geteffectpar(3)); - echop4->value(eff->geteffectpar(4)); - echop5->value(eff->geteffectpar(5)); - echop6->value(eff->geteffectpar(6)); - effechowindow->show(); - break; - case 3: - chorusp->value(eff->getpreset()); - chorusp0->value(eff->geteffectpar(0));if (eff->insertion!=0) chorusp0->label("D/W"); - chorusp1->value(eff->geteffectpar(1)); - chorusp2->value(eff->geteffectpar(2)); - chorusp3->value(eff->geteffectpar(3)); - chorusp4->value(eff->geteffectpar(4)); - chorusp5->value(eff->geteffectpar(5)); - chorusp6->value(eff->geteffectpar(6)); - chorusp7->value(eff->geteffectpar(7)); - chorusp8->value(eff->geteffectpar(8)); - chorusp9->value(eff->geteffectpar(9)); - chorusp11->value(eff->geteffectpar(11)); - effchoruswindow->show(); - break; - case 4: - phaserp->value(eff->getpreset()); - phaserp0->value(eff->geteffectpar(0));if (eff->insertion!=0) phaserp0->label("D/W"); - phaserp1->value(eff->geteffectpar(1)); - phaserp2->value(eff->geteffectpar(2)); - phaserp3->value(eff->geteffectpar(3)); - phaserp4->value(eff->geteffectpar(4)); - phaserp5->value(eff->geteffectpar(5)); - phaserp6->value(eff->geteffectpar(6)); - phaserp7->value(eff->geteffectpar(7)); - phaserp8->value(eff->geteffectpar(8)); - phaserp9->value(eff->geteffectpar(9)); - phaserp10->value(eff->geteffectpar(10)); - phaserp11->value(eff->geteffectpar(11)); - phaserp12->value(eff->geteffectpar(12)); - phaserp13->value(eff->geteffectpar(13)); - phaserp14->value(eff->geteffectpar(14)); - effphaserwindow->show(); - break; - case 5: - awp->value(eff->getpreset()); - awp0->value(eff->geteffectpar(0));if (eff->insertion!=0) awp0->label("D/W"); - awp1->value(eff->geteffectpar(1)); - awp2->value(eff->geteffectpar(2)); - awp3->value(eff->geteffectpar(3)); - awp4->value(eff->geteffectpar(4)); - awp5->value(eff->geteffectpar(5)); - awp6->value(eff->geteffectpar(6)); - awp7->value(eff->geteffectpar(7)); - awp8->value(eff->geteffectpar(8)); - awp9->value(eff->geteffectpar(9)); - awp10->value(eff->geteffectpar(10)); - - effalienwahwindow->show(); - break; - case 6: - distp->value(eff->getpreset()); - distp0->value(eff->geteffectpar(0));if (eff->insertion!=0) distp0->label("D/W"); - distp1->value(eff->geteffectpar(1)); - distp2->value(eff->geteffectpar(2)); - distp3->value(eff->geteffectpar(3)); - distp4->value(eff->geteffectpar(4)); - distp5->value(eff->geteffectpar(5)); - distp6->value(eff->geteffectpar(6)); - distp7->value(eff->geteffectpar(7)); - distp8->value(eff->geteffectpar(8)); - distp9->value(eff->geteffectpar(9)); - distp10->value(eff->geteffectpar(10)); - effdistorsionwindow->show(); - break; - case 7:eqband=0; - eqp0->value(eff->geteffectpar(0)); - bandcounter->value(eqband); - bandcounter->do_callback(); - typechoice->value(eff->geteffectpar(10)); - eqgraph->redraw(); - freqdial->value(eff->geteffectpar(11)); - gaindial->value(eff->geteffectpar(12)); - if (eff->geteffectpar(10)<6) gaindial->deactivate(); - qdial->value(eff->geteffectpar(13)); - stagescounter->value(eff->geteffectpar(14)); - eqgraph->init(eff); - effeqwindow->show(); - break; - case 8:make_filter_window(); - dfp->value(eff->getpreset()); - dfp0->value(eff->geteffectpar(0));if (eff->insertion!=0) dfp0->label("D/W"); - dfp1->value(eff->geteffectpar(1)); - dfp2->value(eff->geteffectpar(2)); - dfp3->value(eff->geteffectpar(3)); - dfp4->value(eff->geteffectpar(4)); - dfp5->value(eff->geteffectpar(5)); - dfp6->value(eff->geteffectpar(6)); - dfp7->value(eff->geteffectpar(7)); - dfp8->value(eff->geteffectpar(8)); - dfp9->value(eff->geteffectpar(9)); - - - effdynamicfilterwindow->show(); - break; - default:effnullwindow->show(); - break; -}; - -this->show();} {} - } - Function {refresh()} {open - } { - code {refresh(eff);} {} - } - decl {EffectMgr *eff;} {} - decl {int eqband;} {} -} - -class SimpleEffUI {: {public Fl_Group,public PresetsUI_} -} { - Function {SimpleEffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {eff=NULL;} {} - } - Function {~SimpleEffUI()} {} { - code {effnullwindow->hide();//delete (effnullwindow); -effreverbwindow->hide();//delete (effreverbwindow); -effechowindow->hide();//delete (effechowindow); -effchoruswindow->hide();//delete (effchoruswindow); -effphaserwindow->hide();//delete (effphaserwindow); -effalienwahwindow->hide();//delete (effalienwahwindow); -effdistorsionwindow->hide();//delete (effdistorsionwindow); -effeqwindow->hide();//delete (effeqwindow); -effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow);} {} - } - Function {make_null_window()} {} { - Fl_Window effnullwindow { - xywh {539 150 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Text_Display {} { - label {No Effect} - xywh {25 35 35 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 labelcolor 43 align 8 - } - } - } - Function {make_reverb_window()} {} { - Fl_Window effreverbwindow { - xywh {398 298 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Text_Display {} { - label {Reverb } - xywh {115 10 20 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Choice revp { - label Preset - callback {eff->changepreset((int)o->value()); - -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Cathedral 1} - xywh {10 10 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Cathedral 2} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Cathedral 3} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Hall 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Hall 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Room 1} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Room 2} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Basement - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Tunnel - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echoed 1} - xywh {100 100 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echoed 2} - xywh {110 110 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Very Long 1} - xywh {120 120 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Very Long 2} - xywh {130 130 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Dial revp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp2 { - label Time - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {Duration of Reverb} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp3 { - label {I.del} - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Initial Delay} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial revp9 { - label Damp - callback {eff->seteffectpar(9,(int) o->value());} - tooltip Dampening xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 minimum 64 maximum 127 step 1 - class WidgetPDial - } - } - } - Function {make_echo_window()} {} { - Fl_Window effechowindow { - xywh {243 350 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice echop { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Echo 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echo 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Echo 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Simple Echo} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Canyon - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Panning Echo 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Panning Echo 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Panning Echo 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Feedback Echo} - xywh {100 100 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Echo - xywh {145 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial echop0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop2 { - label Delay - callback {eff->seteffectpar(2,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial echop5 { - label {Fb.} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip Feedback xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - } - } - Function {make_chorus_window()} {} { - Fl_Window effchoruswindow { - xywh {234 353 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice chorusp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Chorus 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Chorus 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Chorus 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Celeste 1} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Celeste 2} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 4} - xywh {100 100 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Flange 5} - xywh {110 110 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Chorus - xywh {120 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial chorusp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp7 { - label Delay - callback {eff->seteffectpar(7,(int) o->value());} - xywh {115 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp8 { - label Fb - callback {eff->seteffectpar(8,(int) o->value());} - tooltip Feedback xywh {150 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button {} { - label Flange - callback {eff->seteffectpar(10,(int) o->value());} - xywh {120 10 55 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10 hide deactivate - code0 {o->value(eff->geteffectpar(10));} - } - } - } - Function {make_phaser_window()} {} { - Fl_Window effphaserwindow { - xywh {661 430 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice phaserp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Phaser 1} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 2} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 3} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 4} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 5} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Phaser 6} - xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Phaser - xywh {125 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial phaserp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {115 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp7 { - label Fb - callback {eff->seteffectpar(7,(int) o->value());} - tooltip Feedback xywh {150 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter phaserp8 { - label Stages - callback {eff->seteffectpar(8,(int) o->value());} - xywh {185 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_PHASER_STAGES);} - } - } - } - Function {make_alienwah_window()} {} { - Fl_Window effalienwahwindow { - xywh {367 170 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice awp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Alienwah 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Alienwah 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Alienwah 3} - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Alienwah 4} - xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label AlienWah - xywh {100 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial awp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter awp8 { - label Delay - callback {eff->seteffectpar(8,(int) o->value());} - xywh {125 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_ALIENWAH_DELAY);} - } - } - } - Function {make_distorsion_window()} {} { - Fl_Window effdistorsionwindow { - xywh {353 412 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice distp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Overdrive 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Overdrive 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {A. Exciter 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {A. Exciter 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label {Guitar Amp} - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Quantisize - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label Distortion - xywh {110 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 8 - } - Fl_Dial distp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp3 { - label Drive - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Input amplification} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial distp4 { - label Level - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {Output Amplification} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp7 { - label LPF - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Low Pass Filter} xywh {190 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice distp5 { - label Type - callback {eff->seteffectpar(5,(int) o->value());} - xywh {120 50 60 20} box UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 align 2 textsize 10 - } { - MenuItem {} { - label Atan - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym1 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Qnts - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Zigzg - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lmt - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtU - xywh {125 125 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtL - xywh {135 135 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ILmt - xywh {147 147 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Clip - xywh {157 157 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sgm - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - } - } - } - Function {make_eq_window()} {} { - Fl_Window effeqwindow { - xywh {318 309 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Text_Display {} { - label EQ - xywh {170 5 15 25} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Counter bandcounter { - label Band - callback {eqband=(int) o->value(); -int npb=eqband*5+10; - -int type=eff->geteffectpar(npb); -typechoice->value(type); - -if (type>6) gaindial->activate(); - else gaindial->deactivate(); - -if (type==0) bandgroup->deactivate(); -else bandgroup->activate(); - -int freq=eff->geteffectpar(npb+1); -freqdial->value(freq); - -int gain=eff->geteffectpar(npb+2); -gaindial->value(gain); - -int q=eff->geteffectpar(npb+3); -qdial->value(q); - -int dbl=eff->geteffectpar(npb+4); -stagescounter->value(dbl);} - tooltip {Band no.} xywh {85 15 45 15} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 1 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_EQ_BANDS-1);} - } - Fl_Group bandgroup { - xywh {5 5 75 85} box ENGRAVED_FRAME - code0 {if (eff->geteffectpar(10)==0) o->deactivate();} - } { - Fl_Dial freqdial { - label Freq - callback {int np=eqband*5+11; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {10 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Dial gaindial { - label Gain - callback {int np=eqband*5+12; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {45 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial qdial { - label Q - callback {int np=eqband*5+13; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Bandwidth/Resonance} xywh {10 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Counter stagescounter { - label Stages - callback {int np=eqband*5+14; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Additional filter stages} xywh {40 55 30 15} type Simple labelfont 1 labelsize 10 minimum 1 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_FILTER_STAGES-1);} - } - } - Fl_Choice typechoice { - label Type - callback {int np=eqband*5+10; -eff->seteffectpar(np,(int) o->value()); -bandcounter->do_callback(); -eqgraph->redraw();} - tooltip Type xywh {135 15 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 when 6 textsize 10 - } { - MenuItem {} { - label OFF - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp1 - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp1 - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp2 - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp2 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Bp2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label N2 - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pk - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HSh - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Box eqgraph { - xywh {85 35 140 55} box BORDER_BOX color 178 - code0 {o->init(eff);} - class EQGraph - } - } - } - Function {make_dynamicfilter_window()} {} { - Fl_Window effdynamicfilterwindow { - xywh {475 471 230 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide - class Fl_Group - } { - Fl_Choice dfp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label WahWah - xywh {30 30 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label AutoWah - xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label Sweep - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label VocalMorph1 - xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - MenuItem {} { - label VocalMorph2 - xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Text_Display {} { - label DynFilter - xywh {100 10 10 20} box NO_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 8 - } - Fl_Dial dfp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp6 { - label LfoD - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO depth} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Group {} { - xywh {115 40 65 45} box BORDER_BOX color 181 - } { - Fl_Dial dfp7 { - label {A.S.} - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {how filter varies with amplitude} xywh {120 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp9 { - label {A.M} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {how quickly the filter varies with amplitude} xywh {150 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - } - } - } - Function {init(EffectMgr *eff_)} {} { - code {eff=eff_; - -make_null_window(); -make_reverb_window(); -make_echo_window(); -make_chorus_window(); -make_phaser_window(); -make_alienwah_window(); -make_distorsion_window(); -make_eq_window(); -make_dynamicfilter_window(); - -int px=this->parent()->x(); -int py=this->parent()->y(); - -effnullwindow->position(px,py); -effreverbwindow->position(px,py); -effechowindow->position(px,py); -effchoruswindow->position(px,py); -effphaserwindow->position(px,py); -effalienwahwindow->position(px,py); -effdistorsionwindow->position(px,py); -effeqwindow->position(px,py); -effdynamicfilterwindow->position(px,py); - -refresh(eff);} {} - } - Function {refresh(EffectMgr *eff_)} {} { - code {eff=eff_; -this->hide(); - -effnullwindow->hide(); -effreverbwindow->hide(); -effechowindow->hide(); -effchoruswindow->hide(); -effphaserwindow->hide(); -effalienwahwindow->hide(); -effdistorsionwindow->hide(); -effeqwindow->hide(); -effdynamicfilterwindow->hide(); - -eqband=0; - - -switch(eff->geteffect()){ - case 1: - revp->value(eff->getpreset()); - revp0->value(eff->geteffectpar(0));if (eff->insertion!=0) revp0->label("D/W"); - revp2->value(eff->geteffectpar(2)); - revp3->value(eff->geteffectpar(3)); - revp9->value(eff->geteffectpar(9)); - effreverbwindow->show(); - break; - case 2: - echop->value(eff->getpreset()); - echop0->value(eff->geteffectpar(0));if (eff->insertion!=0) echop0->label("D/W"); - echop2->value(eff->geteffectpar(2)); - echop5->value(eff->geteffectpar(5)); - effechowindow->show(); - break; - case 3: - chorusp->value(eff->getpreset()); - chorusp0->value(eff->geteffectpar(0));if (eff->insertion!=0) chorusp0->label("D/W"); - chorusp2->value(eff->geteffectpar(2)); - chorusp6->value(eff->geteffectpar(6)); - chorusp7->value(eff->geteffectpar(7)); - chorusp8->value(eff->geteffectpar(8)); - effchoruswindow->show(); - break; - case 4: - phaserp->value(eff->getpreset()); - phaserp0->value(eff->geteffectpar(0));if (eff->insertion!=0) phaserp0->label("D/W"); - phaserp2->value(eff->geteffectpar(2)); - phaserp5->value(eff->geteffectpar(5)); - phaserp6->value(eff->geteffectpar(6)); - phaserp7->value(eff->geteffectpar(7)); - phaserp8->value(eff->geteffectpar(8)); - effphaserwindow->show(); - break; - case 5: - awp->value(eff->getpreset()); - awp0->value(eff->geteffectpar(0));if (eff->insertion!=0) awp0->label("D/W"); - awp2->value(eff->geteffectpar(2)); - awp6->value(eff->geteffectpar(6)); - awp8->value(eff->geteffectpar(8)); - effalienwahwindow->show(); - break; - case 6: - distp->value(eff->getpreset()); - distp0->value(eff->geteffectpar(0));if (eff->insertion!=0) distp0->label("D/W"); - distp3->value(eff->geteffectpar(3)); - distp4->value(eff->geteffectpar(4)); - distp5->value(eff->geteffectpar(5)); - distp7->value(eff->geteffectpar(7)); - effdistorsionwindow->show(); - break; - case 7: - bandcounter->value(eqband); - bandcounter->do_callback(); - typechoice->value(eff->geteffectpar(10)); - eqgraph->redraw(); - freqdial->value(eff->geteffectpar(11)); - gaindial->value(eff->geteffectpar(12)); - if (eff->geteffectpar(10)<6) gaindial->deactivate(); - qdial->value(eff->geteffectpar(13)); - stagescounter->value(eff->geteffectpar(14)); - eqgraph->init(eff); - effeqwindow->show(); - break; - case 8: - dfp->value(eff->getpreset()); - dfp0->value(eff->geteffectpar(0));if (eff->insertion!=0) dfp0->label("D/W"); - dfp2->value(eff->geteffectpar(2)); - dfp6->value(eff->geteffectpar(6)); - dfp7->value(eff->geteffectpar(7)); - dfp9->value(eff->geteffectpar(9)); - - - effdynamicfilterwindow->show(); - break; - default:effnullwindow->show(); - break; -}; - -this->show();} {} - } - Function {refresh()} {} { - code {refresh(eff);} {} - } - decl {EffectMgr *eff;} {} - decl {int eqband;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/EffUI.h b/plugins/zynaddsubfx/src/UI/EffUI.h deleted file mode 100644 index 92af395a9..000000000 --- a/plugins/zynaddsubfx/src/UI/EffUI.h +++ /dev/null @@ -1,820 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef EffUI_h -#define EffUI_h -#include -#include -#include -#include -#include "../globals.h" -#include "WidgetPDial.h" -#include "EnvelopeUI.h" -#include "FilterUI.h" -#include "../Misc/Util.h" -#include "../Effects/EffectMgr.h" -#include "PresetsUI.h" - -class EQGraph : public Fl_Box { -public: - EQGraph(int x,int y, int w, int h, const char *label=0); - void init(EffectMgr *eff_); - void draw_freq_line(REALTYPE freq,int type); - void draw(); - int getresponse(int maxy,REALTYPE freq); - REALTYPE getfreqx(REALTYPE x); - REALTYPE getfreqpos(REALTYPE freq); -private: - int oldx; -public: - REALTYPE khzval; -private: - EffectMgr *eff; - int maxdB; -}; -#include -#include -#include -#include -#include -#include -#include - -class EffUI : public Fl_Group,public PresetsUI_ { -public: - EffUI(int x,int y, int w, int h, const char *label=0); - ~EffUI(); - Fl_Group* make_null_window(); - Fl_Group *effnullwindow; - Fl_Group* make_reverb_window(); - Fl_Group *effreverbwindow; - Fl_Choice *revp; -private: - void cb_revp_i(Fl_Choice*, void*); - static void cb_revp(Fl_Choice*, void*); - static Fl_Menu_Item menu_revp[]; -public: - Fl_Choice *revp10; -private: - void cb_revp10_i(Fl_Choice*, void*); - static void cb_revp10(Fl_Choice*, void*); - static Fl_Menu_Item menu_revp10[]; -public: - WidgetPDial *revp0; -private: - void cb_revp0_i(WidgetPDial*, void*); - static void cb_revp0(WidgetPDial*, void*); -public: - WidgetPDial *revp1; -private: - void cb_revp1_i(WidgetPDial*, void*); - static void cb_revp1(WidgetPDial*, void*); -public: - WidgetPDial *revp2; -private: - void cb_revp2_i(WidgetPDial*, void*); - static void cb_revp2(WidgetPDial*, void*); -public: - WidgetPDial *revp3; -private: - void cb_revp3_i(WidgetPDial*, void*); - static void cb_revp3(WidgetPDial*, void*); -public: - WidgetPDial *revp4; -private: - void cb_revp4_i(WidgetPDial*, void*); - static void cb_revp4(WidgetPDial*, void*); -public: - WidgetPDial *revp12; -private: - void cb_revp12_i(WidgetPDial*, void*); - static void cb_revp12(WidgetPDial*, void*); -public: - WidgetPDial *revp6; -private: - void cb_revp6_i(WidgetPDial*, void*); - static void cb_revp6(WidgetPDial*, void*); -public: - WidgetPDial *revp7; -private: - void cb_revp7_i(WidgetPDial*, void*); - static void cb_revp7(WidgetPDial*, void*); -public: - WidgetPDial *revp8; -private: - void cb_revp8_i(WidgetPDial*, void*); - static void cb_revp8(WidgetPDial*, void*); -public: - WidgetPDial *revp9; -private: - void cb_revp9_i(WidgetPDial*, void*); - static void cb_revp9(WidgetPDial*, void*); -public: - WidgetPDial *revp11; -private: - void cb_revp11_i(WidgetPDial*, void*); - static void cb_revp11(WidgetPDial*, void*); -public: - Fl_Group* make_echo_window(); - Fl_Group *effechowindow; - Fl_Choice *echop; -private: - void cb_echop_i(Fl_Choice*, void*); - static void cb_echop(Fl_Choice*, void*); - static Fl_Menu_Item menu_echop[]; -public: - WidgetPDial *echop0; -private: - void cb_echop0_i(WidgetPDial*, void*); - static void cb_echop0(WidgetPDial*, void*); -public: - WidgetPDial *echop1; -private: - void cb_echop1_i(WidgetPDial*, void*); - static void cb_echop1(WidgetPDial*, void*); -public: - WidgetPDial *echop2; -private: - void cb_echop2_i(WidgetPDial*, void*); - static void cb_echop2(WidgetPDial*, void*); -public: - WidgetPDial *echop3; -private: - void cb_echop3_i(WidgetPDial*, void*); - static void cb_echop3(WidgetPDial*, void*); -public: - WidgetPDial *echop4; -private: - void cb_echop4_i(WidgetPDial*, void*); - static void cb_echop4(WidgetPDial*, void*); -public: - WidgetPDial *echop5; -private: - void cb_echop5_i(WidgetPDial*, void*); - static void cb_echop5(WidgetPDial*, void*); -public: - WidgetPDial *echop6; -private: - void cb_echop6_i(WidgetPDial*, void*); - static void cb_echop6(WidgetPDial*, void*); -public: - Fl_Group* make_chorus_window(); - Fl_Group *effchoruswindow; - Fl_Choice *chorusp; -private: - void cb_chorusp_i(Fl_Choice*, void*); - static void cb_chorusp(Fl_Choice*, void*); - static Fl_Menu_Item menu_chorusp[]; -public: - WidgetPDial *chorusp0; -private: - void cb_chorusp0_i(WidgetPDial*, void*); - static void cb_chorusp0(WidgetPDial*, void*); -public: - WidgetPDial *chorusp1; -private: - void cb_chorusp1_i(WidgetPDial*, void*); - static void cb_chorusp1(WidgetPDial*, void*); -public: - WidgetPDial *chorusp2; -private: - void cb_chorusp2_i(WidgetPDial*, void*); - static void cb_chorusp2(WidgetPDial*, void*); -public: - WidgetPDial *chorusp3; -private: - void cb_chorusp3_i(WidgetPDial*, void*); - static void cb_chorusp3(WidgetPDial*, void*); -public: - WidgetPDial *chorusp5; -private: - void cb_chorusp5_i(WidgetPDial*, void*); - static void cb_chorusp5(WidgetPDial*, void*); -public: - WidgetPDial *chorusp6; -private: - void cb_chorusp6_i(WidgetPDial*, void*); - static void cb_chorusp6(WidgetPDial*, void*); -public: - WidgetPDial *chorusp7; -private: - void cb_chorusp7_i(WidgetPDial*, void*); - static void cb_chorusp7(WidgetPDial*, void*); -public: - WidgetPDial *chorusp8; -private: - void cb_chorusp8_i(WidgetPDial*, void*); - static void cb_chorusp8(WidgetPDial*, void*); -public: - WidgetPDial *chorusp9; -private: - void cb_chorusp9_i(WidgetPDial*, void*); - static void cb_chorusp9(WidgetPDial*, void*); - void cb_Flange_i(Fl_Check_Button*, void*); - static void cb_Flange(Fl_Check_Button*, void*); -public: - Fl_Check_Button *chorusp11; -private: - void cb_chorusp11_i(Fl_Check_Button*, void*); - static void cb_chorusp11(Fl_Check_Button*, void*); -public: - Fl_Choice *chorusp4; -private: - void cb_chorusp4_i(Fl_Choice*, void*); - static void cb_chorusp4(Fl_Choice*, void*); - static Fl_Menu_Item menu_chorusp4[]; -public: - Fl_Group* make_phaser_window(); - Fl_Group *effphaserwindow; - Fl_Choice *phaserp; -private: - void cb_phaserp_i(Fl_Choice*, void*); - static void cb_phaserp(Fl_Choice*, void*); - static Fl_Menu_Item menu_phaserp[]; -public: - WidgetPDial *phaserp0; -private: - void cb_phaserp0_i(WidgetPDial*, void*); - static void cb_phaserp0(WidgetPDial*, void*); -public: - WidgetPDial *phaserp1; -private: - void cb_phaserp1_i(WidgetPDial*, void*); - static void cb_phaserp1(WidgetPDial*, void*); -public: - WidgetPDial *phaserp2; -private: - void cb_phaserp2_i(WidgetPDial*, void*); - static void cb_phaserp2(WidgetPDial*, void*); -public: - WidgetPDial *phaserp3; -private: - void cb_phaserp3_i(WidgetPDial*, void*); - static void cb_phaserp3(WidgetPDial*, void*); -public: - Fl_Choice *phaserp4; -private: - void cb_phaserp4_i(Fl_Choice*, void*); - static void cb_phaserp4(Fl_Choice*, void*); - static Fl_Menu_Item menu_phaserp4[]; -public: - WidgetPDial *phaserp5; -private: - void cb_phaserp5_i(WidgetPDial*, void*); - static void cb_phaserp5(WidgetPDial*, void*); -public: - WidgetPDial *phaserp6; -private: - void cb_phaserp6_i(WidgetPDial*, void*); - static void cb_phaserp6(WidgetPDial*, void*); -public: - WidgetPDial *phaserp7; -private: - void cb_phaserp7_i(WidgetPDial*, void*); - static void cb_phaserp7(WidgetPDial*, void*); -public: - Fl_Counter *phaserp8; -private: - void cb_phaserp8_i(Fl_Counter*, void*); - static void cb_phaserp8(Fl_Counter*, void*); -public: - WidgetPDial *phaserp9; -private: - void cb_phaserp9_i(WidgetPDial*, void*); - static void cb_phaserp9(WidgetPDial*, void*); -public: - Fl_Check_Button *phaserp10; -private: - void cb_phaserp10_i(Fl_Check_Button*, void*); - static void cb_phaserp10(Fl_Check_Button*, void*); -public: - WidgetPDial *phaserp11; -private: - void cb_phaserp11_i(WidgetPDial*, void*); - static void cb_phaserp11(WidgetPDial*, void*); -public: - Fl_Check_Button *phaserp12; -private: - void cb_phaserp12_i(Fl_Check_Button*, void*); - static void cb_phaserp12(Fl_Check_Button*, void*); -public: - WidgetPDial *phaserp13; -private: - void cb_phaserp13_i(WidgetPDial*, void*); - static void cb_phaserp13(WidgetPDial*, void*); -public: - Fl_Check_Button *phaserp14; -private: - void cb_phaserp14_i(Fl_Check_Button*, void*); - static void cb_phaserp14(Fl_Check_Button*, void*); -public: - Fl_Group* make_alienwah_window(); - Fl_Group *effalienwahwindow; - Fl_Choice *awp; -private: - void cb_awp_i(Fl_Choice*, void*); - static void cb_awp(Fl_Choice*, void*); - static Fl_Menu_Item menu_awp[]; -public: - WidgetPDial *awp0; -private: - void cb_awp0_i(WidgetPDial*, void*); - static void cb_awp0(WidgetPDial*, void*); -public: - WidgetPDial *awp1; -private: - void cb_awp1_i(WidgetPDial*, void*); - static void cb_awp1(WidgetPDial*, void*); -public: - WidgetPDial *awp2; -private: - void cb_awp2_i(WidgetPDial*, void*); - static void cb_awp2(WidgetPDial*, void*); -public: - WidgetPDial *awp3; -private: - void cb_awp3_i(WidgetPDial*, void*); - static void cb_awp3(WidgetPDial*, void*); -public: - WidgetPDial *awp5; -private: - void cb_awp5_i(WidgetPDial*, void*); - static void cb_awp5(WidgetPDial*, void*); -public: - WidgetPDial *awp6; -private: - void cb_awp6_i(WidgetPDial*, void*); - static void cb_awp6(WidgetPDial*, void*); -public: - WidgetPDial *awp7; -private: - void cb_awp7_i(WidgetPDial*, void*); - static void cb_awp7(WidgetPDial*, void*); -public: - WidgetPDial *awp9; -private: - void cb_awp9_i(WidgetPDial*, void*); - static void cb_awp9(WidgetPDial*, void*); -public: - Fl_Choice *awp4; -private: - void cb_awp4_i(Fl_Choice*, void*); - static void cb_awp4(Fl_Choice*, void*); - static Fl_Menu_Item menu_awp4[]; -public: - WidgetPDial *awp10; -private: - void cb_awp10_i(WidgetPDial*, void*); - static void cb_awp10(WidgetPDial*, void*); -public: - Fl_Counter *awp8; -private: - void cb_awp8_i(Fl_Counter*, void*); - static void cb_awp8(Fl_Counter*, void*); -public: - Fl_Group* make_distorsion_window(); - Fl_Group *effdistorsionwindow; - Fl_Choice *distp; -private: - void cb_distp_i(Fl_Choice*, void*); - static void cb_distp(Fl_Choice*, void*); - static Fl_Menu_Item menu_distp[]; -public: - WidgetPDial *distp0; -private: - void cb_distp0_i(WidgetPDial*, void*); - static void cb_distp0(WidgetPDial*, void*); -public: - WidgetPDial *distp1; -private: - void cb_distp1_i(WidgetPDial*, void*); - static void cb_distp1(WidgetPDial*, void*); -public: - WidgetPDial *distp2; -private: - void cb_distp2_i(WidgetPDial*, void*); - static void cb_distp2(WidgetPDial*, void*); -public: - WidgetPDial *distp3; -private: - void cb_distp3_i(WidgetPDial*, void*); - static void cb_distp3(WidgetPDial*, void*); -public: - WidgetPDial *distp4; -private: - void cb_distp4_i(WidgetPDial*, void*); - static void cb_distp4(WidgetPDial*, void*); -public: - WidgetPDial *distp7; -private: - void cb_distp7_i(WidgetPDial*, void*); - static void cb_distp7(WidgetPDial*, void*); -public: - WidgetPDial *distp8; -private: - void cb_distp8_i(WidgetPDial*, void*); - static void cb_distp8(WidgetPDial*, void*); -public: - Fl_Choice *distp5; -private: - void cb_distp5_i(Fl_Choice*, void*); - static void cb_distp5(Fl_Choice*, void*); - static Fl_Menu_Item menu_distp5[]; -public: - Fl_Check_Button *distp6; -private: - void cb_distp6_i(Fl_Check_Button*, void*); - static void cb_distp6(Fl_Check_Button*, void*); -public: - Fl_Check_Button *distp9; -private: - void cb_distp9_i(Fl_Check_Button*, void*); - static void cb_distp9(Fl_Check_Button*, void*); -public: - Fl_Check_Button *distp10; -private: - void cb_distp10_i(Fl_Check_Button*, void*); - static void cb_distp10(Fl_Check_Button*, void*); -public: - Fl_Group* make_eq_window(); - Fl_Group *effeqwindow; - WidgetPDial *eqp0; -private: - void cb_eqp0_i(WidgetPDial*, void*); - static void cb_eqp0(WidgetPDial*, void*); -public: - Fl_Counter *bandcounter; -private: - void cb_bandcounter_i(Fl_Counter*, void*); - static void cb_bandcounter(Fl_Counter*, void*); -public: - Fl_Group *bandgroup; - WidgetPDial *freqdial; -private: - void cb_freqdial_i(WidgetPDial*, void*); - static void cb_freqdial(WidgetPDial*, void*); -public: - WidgetPDial *gaindial; -private: - void cb_gaindial_i(WidgetPDial*, void*); - static void cb_gaindial(WidgetPDial*, void*); -public: - WidgetPDial *qdial; -private: - void cb_qdial_i(WidgetPDial*, void*); - static void cb_qdial(WidgetPDial*, void*); -public: - Fl_Counter *stagescounter; -private: - void cb_stagescounter_i(Fl_Counter*, void*); - static void cb_stagescounter(Fl_Counter*, void*); -public: - Fl_Choice *typechoice; -private: - void cb_typechoice_i(Fl_Choice*, void*); - static void cb_typechoice(Fl_Choice*, void*); - static Fl_Menu_Item menu_typechoice[]; -public: - EQGraph *eqgraph; - Fl_Group* make_dynamicfilter_window(); - Fl_Group *effdynamicfilterwindow; - Fl_Choice *dfp; -private: - void cb_dfp_i(Fl_Choice*, void*); - static void cb_dfp(Fl_Choice*, void*); - static Fl_Menu_Item menu_dfp[]; -public: - WidgetPDial *dfp0; -private: - void cb_dfp0_i(WidgetPDial*, void*); - static void cb_dfp0(WidgetPDial*, void*); -public: - WidgetPDial *dfp1; -private: - void cb_dfp1_i(WidgetPDial*, void*); - static void cb_dfp1(WidgetPDial*, void*); -public: - WidgetPDial *dfp2; -private: - void cb_dfp2_i(WidgetPDial*, void*); - static void cb_dfp2(WidgetPDial*, void*); -public: - WidgetPDial *dfp3; -private: - void cb_dfp3_i(WidgetPDial*, void*); - static void cb_dfp3(WidgetPDial*, void*); -public: - WidgetPDial *dfp5; -private: - void cb_dfp5_i(WidgetPDial*, void*); - static void cb_dfp5(WidgetPDial*, void*); -public: - WidgetPDial *dfp6; -private: - void cb_dfp6_i(WidgetPDial*, void*); - static void cb_dfp6(WidgetPDial*, void*); -public: - Fl_Choice *dfp4; -private: - void cb_dfp4_i(Fl_Choice*, void*); - static void cb_dfp4(Fl_Choice*, void*); - static Fl_Menu_Item menu_dfp4[]; - void cb_Filter_i(Fl_Button*, void*); - static void cb_Filter(Fl_Button*, void*); -public: - WidgetPDial *dfp7; -private: - void cb_dfp7_i(WidgetPDial*, void*); - static void cb_dfp7(WidgetPDial*, void*); -public: - WidgetPDial *dfp9; -private: - void cb_dfp9_i(WidgetPDial*, void*); - static void cb_dfp9(WidgetPDial*, void*); -public: - Fl_Check_Button *dfp8; -private: - void cb_dfp8_i(Fl_Check_Button*, void*); - static void cb_dfp8(Fl_Check_Button*, void*); -public: - Fl_Double_Window* make_filter_window(); - Fl_Double_Window *filterwindow; -private: - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); -public: - void init(EffectMgr *eff_); - void refresh(EffectMgr *eff_); - void refresh(); -private: - EffectMgr *eff; - int eqband; -}; - -class SimpleEffUI : public Fl_Group,public PresetsUI_ { -public: - SimpleEffUI(int x,int y, int w, int h, const char *label=0); - ~SimpleEffUI(); - Fl_Group* make_null_window(); - Fl_Group *effnullwindow; - Fl_Group* make_reverb_window(); - Fl_Group *effreverbwindow; - Fl_Choice *revp; -private: - void cb_revp5_i(Fl_Choice*, void*); - static void cb_revp5(Fl_Choice*, void*); - static Fl_Menu_Item menu_revp1[]; -public: - WidgetPDial *revp0; -private: - void cb_revp01_i(WidgetPDial*, void*); - static void cb_revp01(WidgetPDial*, void*); -public: - WidgetPDial *revp2; -private: - void cb_revp21_i(WidgetPDial*, void*); - static void cb_revp21(WidgetPDial*, void*); -public: - WidgetPDial *revp3; -private: - void cb_revp31_i(WidgetPDial*, void*); - static void cb_revp31(WidgetPDial*, void*); -public: - WidgetPDial *revp9; -private: - void cb_revp91_i(WidgetPDial*, void*); - static void cb_revp91(WidgetPDial*, void*); -public: - Fl_Group* make_echo_window(); - Fl_Group *effechowindow; - Fl_Choice *echop; -private: - void cb_echop7_i(Fl_Choice*, void*); - static void cb_echop7(Fl_Choice*, void*); - static Fl_Menu_Item menu_echop1[]; -public: - WidgetPDial *echop0; -private: - void cb_echop01_i(WidgetPDial*, void*); - static void cb_echop01(WidgetPDial*, void*); -public: - WidgetPDial *echop2; -private: - void cb_echop21_i(WidgetPDial*, void*); - static void cb_echop21(WidgetPDial*, void*); -public: - WidgetPDial *echop5; -private: - void cb_echop51_i(WidgetPDial*, void*); - static void cb_echop51(WidgetPDial*, void*); -public: - Fl_Group* make_chorus_window(); - Fl_Group *effchoruswindow; - Fl_Choice *chorusp; -private: - void cb_choruspa_i(Fl_Choice*, void*); - static void cb_choruspa(Fl_Choice*, void*); - static Fl_Menu_Item menu_chorusp1[]; -public: - WidgetPDial *chorusp0; -private: - void cb_chorusp01_i(WidgetPDial*, void*); - static void cb_chorusp01(WidgetPDial*, void*); -public: - WidgetPDial *chorusp2; -private: - void cb_chorusp21_i(WidgetPDial*, void*); - static void cb_chorusp21(WidgetPDial*, void*); -public: - WidgetPDial *chorusp6; -private: - void cb_chorusp61_i(WidgetPDial*, void*); - static void cb_chorusp61(WidgetPDial*, void*); -public: - WidgetPDial *chorusp7; -private: - void cb_chorusp71_i(WidgetPDial*, void*); - static void cb_chorusp71(WidgetPDial*, void*); -public: - WidgetPDial *chorusp8; -private: - void cb_chorusp81_i(WidgetPDial*, void*); - static void cb_chorusp81(WidgetPDial*, void*); - void cb_Flange1_i(Fl_Check_Button*, void*); - static void cb_Flange1(Fl_Check_Button*, void*); -public: - Fl_Group* make_phaser_window(); - Fl_Group *effphaserwindow; - Fl_Choice *phaserp; -private: - void cb_phaserpa_i(Fl_Choice*, void*); - static void cb_phaserpa(Fl_Choice*, void*); - static Fl_Menu_Item menu_phaserp1[]; -public: - WidgetPDial *phaserp0; -private: - void cb_phaserp01_i(WidgetPDial*, void*); - static void cb_phaserp01(WidgetPDial*, void*); -public: - WidgetPDial *phaserp2; -private: - void cb_phaserp21_i(WidgetPDial*, void*); - static void cb_phaserp21(WidgetPDial*, void*); -public: - WidgetPDial *phaserp5; -private: - void cb_phaserp51_i(WidgetPDial*, void*); - static void cb_phaserp51(WidgetPDial*, void*); -public: - WidgetPDial *phaserp6; -private: - void cb_phaserp61_i(WidgetPDial*, void*); - static void cb_phaserp61(WidgetPDial*, void*); -public: - WidgetPDial *phaserp7; -private: - void cb_phaserp71_i(WidgetPDial*, void*); - static void cb_phaserp71(WidgetPDial*, void*); -public: - Fl_Counter *phaserp8; -private: - void cb_phaserp81_i(Fl_Counter*, void*); - static void cb_phaserp81(Fl_Counter*, void*); -public: - Fl_Group* make_alienwah_window(); - Fl_Group *effalienwahwindow; - Fl_Choice *awp; -private: - void cb_awpa_i(Fl_Choice*, void*); - static void cb_awpa(Fl_Choice*, void*); - static Fl_Menu_Item menu_awp1[]; -public: - WidgetPDial *awp0; -private: - void cb_awp01_i(WidgetPDial*, void*); - static void cb_awp01(WidgetPDial*, void*); -public: - WidgetPDial *awp2; -private: - void cb_awp21_i(WidgetPDial*, void*); - static void cb_awp21(WidgetPDial*, void*); -public: - WidgetPDial *awp6; -private: - void cb_awp61_i(WidgetPDial*, void*); - static void cb_awp61(WidgetPDial*, void*); -public: - Fl_Counter *awp8; -private: - void cb_awp81_i(Fl_Counter*, void*); - static void cb_awp81(Fl_Counter*, void*); -public: - Fl_Group* make_distorsion_window(); - Fl_Group *effdistorsionwindow; - Fl_Choice *distp; -private: - void cb_distpa_i(Fl_Choice*, void*); - static void cb_distpa(Fl_Choice*, void*); - static Fl_Menu_Item menu_distp1[]; -public: - WidgetPDial *distp0; -private: - void cb_distp01_i(WidgetPDial*, void*); - static void cb_distp01(WidgetPDial*, void*); -public: - WidgetPDial *distp3; -private: - void cb_distp31_i(WidgetPDial*, void*); - static void cb_distp31(WidgetPDial*, void*); -public: - WidgetPDial *distp4; -private: - void cb_distp41_i(WidgetPDial*, void*); - static void cb_distp41(WidgetPDial*, void*); -public: - WidgetPDial *distp7; -private: - void cb_distp71_i(WidgetPDial*, void*); - static void cb_distp71(WidgetPDial*, void*); -public: - Fl_Choice *distp5; -private: - void cb_distp51_i(Fl_Choice*, void*); - static void cb_distp51(Fl_Choice*, void*); - static Fl_Menu_Item menu_distp51[]; -public: - Fl_Group* make_eq_window(); - Fl_Group *effeqwindow; - Fl_Counter *bandcounter; -private: - void cb_bandcounter1_i(Fl_Counter*, void*); - static void cb_bandcounter1(Fl_Counter*, void*); -public: - Fl_Group *bandgroup; - WidgetPDial *freqdial; -private: - void cb_freqdial1_i(WidgetPDial*, void*); - static void cb_freqdial1(WidgetPDial*, void*); -public: - WidgetPDial *gaindial; -private: - void cb_gaindial1_i(WidgetPDial*, void*); - static void cb_gaindial1(WidgetPDial*, void*); -public: - WidgetPDial *qdial; -private: - void cb_qdial1_i(WidgetPDial*, void*); - static void cb_qdial1(WidgetPDial*, void*); -public: - Fl_Counter *stagescounter; -private: - void cb_stagescounter1_i(Fl_Counter*, void*); - static void cb_stagescounter1(Fl_Counter*, void*); -public: - Fl_Choice *typechoice; -private: - void cb_typechoice1_i(Fl_Choice*, void*); - static void cb_typechoice1(Fl_Choice*, void*); - static Fl_Menu_Item menu_typechoice1[]; -public: - EQGraph *eqgraph; - Fl_Group* make_dynamicfilter_window(); - Fl_Group *effdynamicfilterwindow; - Fl_Choice *dfp; -private: - void cb_dfpa_i(Fl_Choice*, void*); - static void cb_dfpa(Fl_Choice*, void*); - static Fl_Menu_Item menu_dfp1[]; -public: - WidgetPDial *dfp0; -private: - void cb_dfp01_i(WidgetPDial*, void*); - static void cb_dfp01(WidgetPDial*, void*); -public: - WidgetPDial *dfp2; -private: - void cb_dfp21_i(WidgetPDial*, void*); - static void cb_dfp21(WidgetPDial*, void*); -public: - WidgetPDial *dfp6; -private: - void cb_dfp61_i(WidgetPDial*, void*); - static void cb_dfp61(WidgetPDial*, void*); -public: - WidgetPDial *dfp7; -private: - void cb_dfp71_i(WidgetPDial*, void*); - static void cb_dfp71(WidgetPDial*, void*); -public: - WidgetPDial *dfp9; -private: - void cb_dfp91_i(WidgetPDial*, void*); - static void cb_dfp91(WidgetPDial*, void*); -public: - void init(EffectMgr *eff_); - void refresh(EffectMgr *eff_); - void refresh(); -private: - EffectMgr *eff; - int eqband; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/EnvelopeUI.cc b/plugins/zynaddsubfx/src/UI/EnvelopeUI.cc deleted file mode 100644 index 78d2b17cd..000000000 --- a/plugins/zynaddsubfx/src/UI/EnvelopeUI.cc +++ /dev/null @@ -1,1525 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "EnvelopeUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -EnvelopeFreeEdit::EnvelopeFreeEdit(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - env=NULL; - pair=NULL; -} - -void EnvelopeFreeEdit::init(EnvelopeParams *env_) { - env=env_; - oldx=-1; - currentpoint=-1; - cpx=0; - lastpoint=-1; -} - -void EnvelopeFreeEdit::setpair(Fl_Box *pair_) { - pair=pair_; -} - -int EnvelopeFreeEdit::getpointx(int n) { - int lx=w()-10; - int npoints=env->Penvpoints; - - float sum=0; - for (int i=1;igetdt(i)+1; - - float sumbefore=0;//the sum of all points before the computed point - for (int i=1;i<=n;i++) sumbefore+=env->getdt(i)+1; - - return((int) (sumbefore/(REALTYPE) sum*lx)); -} - -int EnvelopeFreeEdit::getpointy(int n) { - int ly=h()-10; - - return((int) ((1.0-env->Penvval[n]/127.0)*ly)); -} - -int EnvelopeFreeEdit::getnearest(int x,int y) { - x-=5;y-=5; - - int nearestpoint=0; - int nearestval=1000000;//a big value - for (int i=0;iPenvpoints;i++){ - int distance=abs(x-getpointx(i))+abs(y-getpointy(i)); - if (distancePfreemode==0) env->converttofree(); - int npoints=env->Penvpoints; - - if (active_r()) fl_color(FL_BLACK); - else fl_color(90,90,90); - if (!active_r()) currentpoint=-1; - - fl_rectf(ox,oy,lx,ly); - - ox+=5;oy+=5;lx-=10;ly-=10; - - //draw the lines - fl_color(FL_GRAY); - - fl_line_style(FL_SOLID); - fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - - //draws the evelope points and lines - Fl_Color alb=FL_WHITE; - if (!active_r()) alb=fl_rgb_color(180,180,180); - fl_color(alb); - int oldxx=0,xx=0,oldyy=0,yy=getpointy(0); - fl_rectf(ox-3,oy+yy-3,6,6); - for (int i=1;i=0){ - fl_color(FL_CYAN); - fl_rectf(ox+getpointx(lastpoint)-5,oy+getpointy(lastpoint)-5,10,10); - }; - - //draw the sustain position - if (env->Penvsustain>0){ - fl_color(FL_YELLOW); - xx=getpointx(env->Penvsustain); - fl_line(ox+xx,oy+0,ox+xx,oy+ly); - }; - - //Show the envelope duration and the current line duration - fl_font(FL_HELVETICA|FL_BOLD,10); - float time=0.0; - if (currentpoint<=0){ - fl_color(alb); - for (int i=1;igetdt(i); - } else { - fl_color(255,0,0); - time=env->getdt(currentpoint); - }; - char tmpstr[20]; - if (time<1000.0) snprintf((char *)&tmpstr,20,"%.1fms",time); - else snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0); - fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0); -} - -int EnvelopeFreeEdit::handle(int event) { - int x_=Fl::event_x()-x(); - int y_=Fl::event_y()-y(); - - if (event==FL_PUSH) { - currentpoint=getnearest(x_,y_); - cpx=x_; - cpdt=env->Penvdt[currentpoint]; - lastpoint=currentpoint; - redraw(); - if (pair!=NULL) pair->redraw(); - }; - - if (event==FL_RELEASE){ - currentpoint=-1; - redraw(); - if (pair!=NULL) pair->redraw(); - }; - - if ((event==FL_DRAG)&&(currentpoint>=0)){ - int ny=127-(int) (y_*127.0/h()); - if (ny<0) ny=0;if (ny>127) ny=127; - env->Penvval[currentpoint]=ny; - - int dx=(int)((x_-cpx)*0.1); - int newdt=cpdt+dx; - if (newdt<0) newdt=0;if (newdt>127) newdt=127; - if (currentpoint!=0) env->Penvdt[currentpoint]=newdt; - else env->Penvdt[currentpoint]=0; - - redraw(); - if (pair!=NULL) pair->redraw(); - }; - - - return(1); -} - -void EnvelopeUI::cb_addpoint_i(Fl_Button*, void*) { - int curpoint=freeedit->lastpoint; -if (curpoint<0) return; -//if (curpoint>=env->Penvpoints-1) return; -if (env->Penvpoints>=MAX_ENVELOPE_POINTS) return; - -for (int i=env->Penvpoints;i>=curpoint+1;i--){ - env->Penvdt[i]=env->Penvdt[i-1]; - env->Penvval[i]=env->Penvval[i-1]; -}; - -if (curpoint==0) { - env->Penvdt[1]=64; -}; - -env->Penvpoints++; -if (curpoint<=env->Penvsustain) env->Penvsustain++; - -freeedit->lastpoint+=1; -freeedit->redraw(); -envfree->redraw(); - -sustaincounter->value(env->Penvsustain); -sustaincounter->maximum(env->Penvpoints-2); -} -void EnvelopeUI::cb_addpoint(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_addpoint_i(o,v); -} - -void EnvelopeUI::cb_deletepoint_i(Fl_Button*, void*) { - int curpoint=freeedit->lastpoint; -if (curpoint<1) return; -if (curpoint>=env->Penvpoints-1) return; -if (env->Penvpoints<=3) return; - -for (int i=curpoint+1;iPenvpoints;i++){ - env->Penvdt[i-1]=env->Penvdt[i]; - env->Penvval[i-1]=env->Penvval[i]; -}; - -env->Penvpoints--; - -if (curpoint<=env->Penvsustain) env->Penvsustain--; - - -freeedit->lastpoint-=1; -freeedit->redraw(); -envfree->redraw(); - -sustaincounter->value(env->Penvsustain); -sustaincounter->maximum(env->Penvpoints-2); -} -void EnvelopeUI::cb_deletepoint(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_deletepoint_i(o,v); -} - -void EnvelopeUI::cb_freemodebutton_i(Fl_Light_Button*, void*) { - reinit(); - -freeedit->lastpoint=-1; -freeedit->redraw(); -} -void EnvelopeUI::cb_freemodebutton(Fl_Light_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_freemodebutton_i(o,v); -} - -void EnvelopeUI::cb_forcedreleasecheck_i(Fl_Check_Button* o, void*) { - env->Pforcedrelease=(int)o->value(); -} -void EnvelopeUI::cb_forcedreleasecheck(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_forcedreleasecheck_i(o,v); -} - -void EnvelopeUI::cb_envstretchdial_i(WidgetPDial* o, void*) { - env->Penvstretch=(int)o->value(); -} -void EnvelopeUI::cb_envstretchdial(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_envstretchdial_i(o,v); -} - -void EnvelopeUI::cb_Close_i(Fl_Button*, void*) { - freemodeeditwindow->hide(); -} -void EnvelopeUI::cb_Close(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void EnvelopeUI::cb_linearenvelopecheck_i(Fl_Check_Button* o, void*) { - env->Plinearenvelope=(int)o->value(); -} -void EnvelopeUI::cb_linearenvelopecheck(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_linearenvelopecheck_i(o,v); -} - -void EnvelopeUI::cb_sustaincounter_i(Fl_Counter* o, void*) { - env->Penvsustain=(int) o->value(); -freeedit->redraw(); -envfree->redraw(); -} -void EnvelopeUI::cb_sustaincounter(Fl_Counter* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_sustaincounter_i(o,v); -} - -void EnvelopeUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(env); -} -void EnvelopeUI::cb_C(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void EnvelopeUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(env,this); -} -void EnvelopeUI::cb_P(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -void EnvelopeUI::cb_e1adt_i(WidgetPDial* o, void*) { - env->PA_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e1adt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1adt_i(o,v); -} - -void EnvelopeUI::cb_e1ddt_i(WidgetPDial* o, void*) { - env->PD_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e1ddt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1ddt_i(o,v); -} - -void EnvelopeUI::cb_e1rdt_i(WidgetPDial* o, void*) { - env->PR_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e1rdt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1rdt_i(o,v); -} - -void EnvelopeUI::cb_e1sval_i(WidgetPDial* o, void*) { - env->PS_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e1sval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1sval_i(o,v); -} - -void EnvelopeUI::cb_e1forcedrelease_i(Fl_Check_Button* o, void*) { - env->Pforcedrelease=(int)o->value(); -} -void EnvelopeUI::cb_e1forcedrelease(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1forcedrelease_i(o,v); -} - -void EnvelopeUI::cb_e1envstretch_i(WidgetPDial* o, void*) { - env->Penvstretch=(int)o->value(); -} -void EnvelopeUI::cb_e1envstretch(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1envstretch_i(o,v); -} - -void EnvelopeUI::cb_E_i(Fl_Button*, void*) { - freemodeeditwindow->show(); -} -void EnvelopeUI::cb_E(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_E_i(o,v); -} - -void EnvelopeUI::cb_e1linearenvelope_i(Fl_Check_Button* o, void*) { - env->Plinearenvelope=(int)o->value(); -} -void EnvelopeUI::cb_e1linearenvelope(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e1linearenvelope_i(o,v); -} - -void EnvelopeUI::cb_C1_i(Fl_Button*, void*) { - presetsui->copy(env); -} -void EnvelopeUI::cb_C1(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_C1_i(o,v); -} - -void EnvelopeUI::cb_P1_i(Fl_Button*, void*) { - presetsui->paste(env,this); -} -void EnvelopeUI::cb_P1(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_P1_i(o,v); -} - -void EnvelopeUI::cb_e2aval_i(WidgetPDial* o, void*) { - env->PA_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e2aval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e2aval_i(o,v); -} - -void EnvelopeUI::cb_e2adt_i(WidgetPDial* o, void*) { - env->PA_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e2adt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e2adt_i(o,v); -} - -void EnvelopeUI::cb_e2rval_i(WidgetPDial* o, void*) { - env->PR_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e2rval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e2rval_i(o,v); -} - -void EnvelopeUI::cb_e2rdt_i(WidgetPDial* o, void*) { - env->PR_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e2rdt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e2rdt_i(o,v); -} - -void EnvelopeUI::cb_e2envstretch_i(WidgetPDial* o, void*) { - env->Penvstretch=(int)o->value(); -} -void EnvelopeUI::cb_e2envstretch(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e2envstretch_i(o,v); -} - -void EnvelopeUI::cb_e2forcedrelease_i(Fl_Check_Button* o, void*) { - env->Pforcedrelease=(int)o->value(); -} -void EnvelopeUI::cb_e2forcedrelease(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e2forcedrelease_i(o,v); -} - -void EnvelopeUI::cb_C2_i(Fl_Button*, void*) { - presetsui->copy(env); -} -void EnvelopeUI::cb_C2(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_C2_i(o,v); -} - -void EnvelopeUI::cb_P2_i(Fl_Button*, void*) { - presetsui->paste(env,this); -} -void EnvelopeUI::cb_P2(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_P2_i(o,v); -} - -void EnvelopeUI::cb_E1_i(Fl_Button*, void*) { - freemodeeditwindow->show(); -} -void EnvelopeUI::cb_E1(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_E1_i(o,v); -} - -void EnvelopeUI::cb_e3aval_i(WidgetPDial* o, void*) { - env->PA_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e3aval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3aval_i(o,v); -} - -void EnvelopeUI::cb_e3adt_i(WidgetPDial* o, void*) { - env->PA_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e3adt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3adt_i(o,v); -} - -void EnvelopeUI::cb_e3dval_i(WidgetPDial* o, void*) { - env->PD_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e3dval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3dval_i(o,v); -} - -void EnvelopeUI::cb_e3ddt_i(WidgetPDial* o, void*) { - env->PD_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e3ddt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3ddt_i(o,v); -} - -void EnvelopeUI::cb_e3rdt_i(WidgetPDial* o, void*) { - env->PR_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e3rdt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3rdt_i(o,v); -} - -void EnvelopeUI::cb_e3rval_i(WidgetPDial* o, void*) { - env->PR_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e3rval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3rval_i(o,v); -} - -void EnvelopeUI::cb_e3envstretch_i(WidgetPDial* o, void*) { - env->Penvstretch=(int)o->value(); -} -void EnvelopeUI::cb_e3envstretch(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3envstretch_i(o,v); -} - -void EnvelopeUI::cb_e3forcedrelease_i(Fl_Check_Button* o, void*) { - env->Pforcedrelease=(int)o->value(); -} -void EnvelopeUI::cb_e3forcedrelease(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e3forcedrelease_i(o,v); -} - -void EnvelopeUI::cb_E2_i(Fl_Button*, void*) { - freemodeeditwindow->show(); -} -void EnvelopeUI::cb_E2(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_E2_i(o,v); -} - -void EnvelopeUI::cb_C3_i(Fl_Button*, void*) { - presetsui->copy(env); -} -void EnvelopeUI::cb_C3(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_C3_i(o,v); -} - -void EnvelopeUI::cb_P3_i(Fl_Button*, void*) { - presetsui->paste(env,this); -} -void EnvelopeUI::cb_P3(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_P3_i(o,v); -} - -void EnvelopeUI::cb_e4aval_i(WidgetPDial* o, void*) { - env->PA_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e4aval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e4aval_i(o,v); -} - -void EnvelopeUI::cb_e4adt_i(WidgetPDial* o, void*) { - env->PA_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e4adt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e4adt_i(o,v); -} - -void EnvelopeUI::cb_e4rval_i(WidgetPDial* o, void*) { - env->PR_val=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e4rval(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e4rval_i(o,v); -} - -void EnvelopeUI::cb_e4rdt_i(WidgetPDial* o, void*) { - env->PR_dt=(int)o->value(); -freeedit->redraw(); -} -void EnvelopeUI::cb_e4rdt(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e4rdt_i(o,v); -} - -void EnvelopeUI::cb_e4envstretch_i(WidgetPDial* o, void*) { - env->Penvstretch=(int)o->value(); -} -void EnvelopeUI::cb_e4envstretch(WidgetPDial* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e4envstretch_i(o,v); -} - -void EnvelopeUI::cb_e4forcedrelease_i(Fl_Check_Button* o, void*) { - env->Pforcedrelease=(int)o->value(); -} -void EnvelopeUI::cb_e4forcedrelease(Fl_Check_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_e4forcedrelease_i(o,v); -} - -void EnvelopeUI::cb_C4_i(Fl_Button*, void*) { - presetsui->copy(env); -} -void EnvelopeUI::cb_C4(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_C4_i(o,v); -} - -void EnvelopeUI::cb_P4_i(Fl_Button*, void*) { - presetsui->paste(env,this); -} -void EnvelopeUI::cb_P4(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_P4_i(o,v); -} - -void EnvelopeUI::cb_E3_i(Fl_Button*, void*) { - freemodeeditwindow->show(); -} -void EnvelopeUI::cb_E3(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->user_data()))->cb_E3_i(o,v); -} - -void EnvelopeUI::cb_freeeditsmall_i(EnvelopeFreeEdit*, void*) { - envfree->redraw(); -} -void EnvelopeUI::cb_freeeditsmall(EnvelopeFreeEdit* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_freeeditsmall_i(o,v); -} - -void EnvelopeUI::cb_E4_i(Fl_Button*, void*) { - freemodeeditwindow->show(); -} -void EnvelopeUI::cb_E4(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_E4_i(o,v); -} - -void EnvelopeUI::cb_C5_i(Fl_Button*, void*) { - presetsui->copy(env); -} -void EnvelopeUI::cb_C5(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_C5_i(o,v); -} - -void EnvelopeUI::cb_P5_i(Fl_Button*, void*) { - presetsui->paste(env,this); -} -void EnvelopeUI::cb_P5(Fl_Button* o, void* v) { - ((EnvelopeUI*)(o->parent()->parent()->user_data()))->cb_P5_i(o,v); -} - -EnvelopeUI::EnvelopeUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - env=NULL; - freemodeeditwindow=NULL; - envADSR=NULL; - envASR=NULL; - envADSRfilter=NULL; - envASRbw=NULL; - envfree=NULL; -} - -EnvelopeUI::~EnvelopeUI() { - envwindow->hide(); - hide(); - freemodeeditwindow->hide(); - delete (freemodeeditwindow); -} - -Fl_Double_Window* EnvelopeUI::make_freemode_edit_window() { - { freemodeeditwindow = new Fl_Double_Window(575, 180, "Envelope"); - freemodeeditwindow->user_data((void*)(this)); - { EnvelopeFreeEdit* o = freeedit = new EnvelopeFreeEdit(5, 5, 565, 145, "Envelope"); - freeedit->box(FL_FLAT_BOX); - freeedit->color(FL_FOREGROUND_COLOR); - freeedit->selection_color(FL_BACKGROUND_COLOR); - freeedit->labeltype(FL_NORMAL_LABEL); - freeedit->labelfont(0); - freeedit->labelsize(14); - freeedit->labelcolor(FL_FOREGROUND_COLOR); - freeedit->align(Fl_Align(FL_ALIGN_CENTER)); - freeedit->when(FL_WHEN_RELEASE); - o->init(env); - } // EnvelopeFreeEdit* freeedit - { Fl_Button* o = addpoint = new Fl_Button(115, 155, 80, 20, "Add point"); - addpoint->box(FL_THIN_UP_BOX); - addpoint->callback((Fl_Callback*)cb_addpoint); - if (env->Pfreemode==0) o->hide(); - } // Fl_Button* addpoint - { Fl_Button* o = deletepoint = new Fl_Button(200, 155, 80, 20, "Delete point"); - deletepoint->box(FL_THIN_UP_BOX); - deletepoint->callback((Fl_Callback*)cb_deletepoint); - if (env->Pfreemode==0) o->hide(); - } // Fl_Button* deletepoint - { freemodebutton = new Fl_Light_Button(10, 155, 95, 25, "FreeMode"); - freemodebutton->tooltip("Enable or disable the freemode"); - freemodebutton->box(FL_PLASTIC_UP_BOX); - freemodebutton->callback((Fl_Callback*)cb_freemodebutton); - } // Fl_Light_Button* freemodebutton - { Fl_Check_Button* o = forcedreleasecheck = new Fl_Check_Button(410, 165, 40, 15, "frcR"); - forcedreleasecheck->tooltip("Forced Relase"); - forcedreleasecheck->down_box(FL_DOWN_BOX); - forcedreleasecheck->labelsize(10); - forcedreleasecheck->callback((Fl_Callback*)cb_forcedreleasecheck); - o->value(env->Pforcedrelease); - if (env->Pfreemode==0) o->hide(); - } // Fl_Check_Button* forcedreleasecheck - { WidgetPDial* o = envstretchdial = new WidgetPDial(380, 155, 25, 25, "Str."); - envstretchdial->tooltip("Envelope stretch (on lower notes make the envelope longer)"); - envstretchdial->box(FL_ROUND_UP_BOX); - envstretchdial->color(FL_BACKGROUND_COLOR); - envstretchdial->selection_color(FL_INACTIVE_COLOR); - envstretchdial->labeltype(FL_NORMAL_LABEL); - envstretchdial->labelfont(0); - envstretchdial->labelsize(10); - envstretchdial->labelcolor(FL_FOREGROUND_COLOR); - envstretchdial->maximum(127); - envstretchdial->step(1); - envstretchdial->callback((Fl_Callback*)cb_envstretchdial); - envstretchdial->align(Fl_Align(FL_ALIGN_LEFT)); - envstretchdial->when(FL_WHEN_CHANGED); - o->value(env->Penvstretch); - if (env->Pfreemode==0) o->hide(); - } // WidgetPDial* envstretchdial - { Fl_Button* o = new Fl_Button(510, 155, 60, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Check_Button* o = linearenvelopecheck = new Fl_Check_Button(410, 151, 30, 15, "L"); - linearenvelopecheck->tooltip("Linear Envelope"); - linearenvelopecheck->down_box(FL_DOWN_BOX); - linearenvelopecheck->labelsize(10); - linearenvelopecheck->callback((Fl_Callback*)cb_linearenvelopecheck); - o->value(env->Plinearenvelope); - if ((env->Pfreemode==0)||(env->Envmode>2)) o->hide(); - } // Fl_Check_Button* linearenvelopecheck - { Fl_Counter* o = sustaincounter = new Fl_Counter(315, 155, 40, 15, "Sust"); - sustaincounter->tooltip("Sustain (0 is disabled)"); - sustaincounter->type(1); - sustaincounter->labelsize(11); - sustaincounter->minimum(0); - sustaincounter->maximum(127); - sustaincounter->step(1); - sustaincounter->callback((Fl_Callback*)cb_sustaincounter); - sustaincounter->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(env->Penvsustain); - if (env->Pfreemode==0) o->hide(); - o->maximum(env->Penvpoints-2); - } // Fl_Counter* sustaincounter - { Fl_Button* o = new Fl_Button(465, 160, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(482, 160, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - freemodeeditwindow->end(); - } // Fl_Double_Window* freemodeeditwindow - return freemodeeditwindow; -} - -Fl_Group* EnvelopeUI::make_ADSR_window() { - { envADSR = new Fl_Group(0, 0, 205, 70); - envADSR->box(FL_FLAT_BOX); - envADSR->color(FL_LIGHT1); - envADSR->selection_color(FL_BACKGROUND_COLOR); - envADSR->labeltype(FL_NO_LABEL); - envADSR->labelfont(1); - envADSR->labelsize(14); - envADSR->labelcolor(FL_FOREGROUND_COLOR); - envADSR->user_data((void*)(this)); - envADSR->align(Fl_Align(FL_ALIGN_TOP)); - envADSR->when(FL_WHEN_RELEASE); - { Fl_Group* o = new Fl_Group(0, 0, 205, 70, "Amplitude Envelope"); - o->box(FL_PLASTIC_UP_BOX); - o->color(FL_CYAN); - o->labeltype(FL_ENGRAVED_LABEL); - o->labelsize(10); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { WidgetPDial* o = e1adt = new WidgetPDial(5, 20, 30, 30, "A.dt"); - e1adt->tooltip("Attack time"); - e1adt->box(FL_ROUND_UP_BOX); - e1adt->color(FL_BACKGROUND_COLOR); - e1adt->selection_color(FL_INACTIVE_COLOR); - e1adt->labeltype(FL_NORMAL_LABEL); - e1adt->labelfont(0); - e1adt->labelsize(10); - e1adt->labelcolor(FL_FOREGROUND_COLOR); - e1adt->maximum(127); - e1adt->step(1); - e1adt->callback((Fl_Callback*)cb_e1adt); - e1adt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e1adt->when(FL_WHEN_CHANGED); - o->value(env->PA_dt); - } // WidgetPDial* e1adt - { WidgetPDial* o = e1ddt = new WidgetPDial(40, 20, 30, 30, "D.dt"); - e1ddt->tooltip("Decay time"); - e1ddt->box(FL_ROUND_UP_BOX); - e1ddt->color(FL_BACKGROUND_COLOR); - e1ddt->selection_color(FL_INACTIVE_COLOR); - e1ddt->labeltype(FL_NORMAL_LABEL); - e1ddt->labelfont(0); - e1ddt->labelsize(10); - e1ddt->labelcolor(FL_FOREGROUND_COLOR); - e1ddt->maximum(127); - e1ddt->step(1); - e1ddt->callback((Fl_Callback*)cb_e1ddt); - e1ddt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e1ddt->when(FL_WHEN_CHANGED); - o->value(env->PD_dt); - } // WidgetPDial* e1ddt - { WidgetPDial* o = e1rdt = new WidgetPDial(110, 20, 30, 30, "R.dt"); - e1rdt->tooltip("Release time"); - e1rdt->box(FL_ROUND_UP_BOX); - e1rdt->color(FL_BACKGROUND_COLOR); - e1rdt->selection_color(FL_INACTIVE_COLOR); - e1rdt->labeltype(FL_NORMAL_LABEL); - e1rdt->labelfont(0); - e1rdt->labelsize(10); - e1rdt->labelcolor(FL_FOREGROUND_COLOR); - e1rdt->maximum(127); - e1rdt->step(1); - e1rdt->callback((Fl_Callback*)cb_e1rdt); - e1rdt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e1rdt->when(FL_WHEN_CHANGED); - o->value(env->PR_dt); - } // WidgetPDial* e1rdt - { WidgetPDial* o = e1sval = new WidgetPDial(75, 20, 30, 30, "S.val"); - e1sval->tooltip("Sustain value"); - e1sval->box(FL_ROUND_UP_BOX); - e1sval->color(FL_BACKGROUND_COLOR); - e1sval->selection_color(FL_INACTIVE_COLOR); - e1sval->labeltype(FL_NORMAL_LABEL); - e1sval->labelfont(0); - e1sval->labelsize(10); - e1sval->labelcolor(FL_FOREGROUND_COLOR); - e1sval->maximum(127); - e1sval->step(1); - e1sval->callback((Fl_Callback*)cb_e1sval); - e1sval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e1sval->when(FL_WHEN_CHANGED); - o->value(env->PS_val); - } // WidgetPDial* e1sval - { Fl_Check_Button* o = e1forcedrelease = new Fl_Check_Button(180, 35, 20, 15, "frcR"); - e1forcedrelease->tooltip("Forced Relase"); - e1forcedrelease->down_box(FL_DOWN_BOX); - e1forcedrelease->labelsize(10); - e1forcedrelease->callback((Fl_Callback*)cb_e1forcedrelease); - e1forcedrelease->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - o->value(env->Pforcedrelease); - } // Fl_Check_Button* e1forcedrelease - { WidgetPDial* o = e1envstretch = new WidgetPDial(145, 25, 25, 25, "Stretch"); - e1envstretch->tooltip("Envelope stretch (on lower notes makes the envelope longer)"); - e1envstretch->box(FL_ROUND_UP_BOX); - e1envstretch->color(FL_BACKGROUND_COLOR); - e1envstretch->selection_color(FL_INACTIVE_COLOR); - e1envstretch->labeltype(FL_NORMAL_LABEL); - e1envstretch->labelfont(0); - e1envstretch->labelsize(10); - e1envstretch->labelcolor(FL_FOREGROUND_COLOR); - e1envstretch->maximum(127); - e1envstretch->step(1); - e1envstretch->callback((Fl_Callback*)cb_e1envstretch); - e1envstretch->align(Fl_Align(FL_ALIGN_BOTTOM)); - e1envstretch->when(FL_WHEN_CHANGED); - o->value(env->Penvstretch); - } // WidgetPDial* e1envstretch - { Fl_Button* o = new Fl_Button(185, 5, 15, 15, "E"); - o->tooltip("Envelope window"); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_E); - } // Fl_Button* o - { Fl_Check_Button* o = e1linearenvelope = new Fl_Check_Button(180, 20, 15, 15, "L"); - e1linearenvelope->tooltip("The evelope is linear"); - e1linearenvelope->down_box(FL_DOWN_BOX); - e1linearenvelope->labelsize(10); - e1linearenvelope->callback((Fl_Callback*)cb_e1linearenvelope); - e1linearenvelope->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(env->Plinearenvelope); - } // Fl_Check_Button* e1linearenvelope - { Fl_Button* o = new Fl_Button(150, 5, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(167, 5, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P1); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - envADSR->end(); - } // Fl_Group* envADSR - return envADSR; -} - -Fl_Group* EnvelopeUI::make_ASR_window() { - { envASR = new Fl_Group(0, 0, 210, 70); - envASR->box(FL_FLAT_BOX); - envASR->color(FL_BACKGROUND_COLOR); - envASR->selection_color(FL_BACKGROUND_COLOR); - envASR->labeltype(FL_NO_LABEL); - envASR->labelfont(0); - envASR->labelsize(14); - envASR->labelcolor(FL_FOREGROUND_COLOR); - envASR->user_data((void*)(this)); - envASR->align(Fl_Align(FL_ALIGN_TOP)); - envASR->when(FL_WHEN_RELEASE); - { Fl_Group* o = new Fl_Group(0, 0, 210, 70, "Frequency Envelope"); - o->box(FL_PLASTIC_UP_BOX); - o->color(FL_CYAN); - o->labeltype(FL_ENGRAVED_LABEL); - o->labelsize(10); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { WidgetPDial* o = e2aval = new WidgetPDial(5, 20, 30, 30, "A.val"); - e2aval->tooltip("Starting value"); - e2aval->box(FL_ROUND_UP_BOX); - e2aval->color(FL_BACKGROUND_COLOR); - e2aval->selection_color(FL_INACTIVE_COLOR); - e2aval->labeltype(FL_NORMAL_LABEL); - e2aval->labelfont(0); - e2aval->labelsize(10); - e2aval->labelcolor(FL_FOREGROUND_COLOR); - e2aval->maximum(127); - e2aval->step(1); - e2aval->callback((Fl_Callback*)cb_e2aval); - e2aval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e2aval->when(FL_WHEN_CHANGED); - o->value(env->PA_val); - } // WidgetPDial* e2aval - { WidgetPDial* o = e2adt = new WidgetPDial(40, 20, 30, 30, "A.dt"); - e2adt->tooltip("Attack time"); - e2adt->box(FL_ROUND_UP_BOX); - e2adt->color(FL_BACKGROUND_COLOR); - e2adt->selection_color(FL_INACTIVE_COLOR); - e2adt->labeltype(FL_NORMAL_LABEL); - e2adt->labelfont(0); - e2adt->labelsize(10); - e2adt->labelcolor(FL_FOREGROUND_COLOR); - e2adt->maximum(127); - e2adt->step(1); - e2adt->callback((Fl_Callback*)cb_e2adt); - e2adt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e2adt->when(FL_WHEN_CHANGED); - o->value(env->PA_dt); - } // WidgetPDial* e2adt - { WidgetPDial* o = e2rval = new WidgetPDial(110, 20, 30, 30, "R.val"); - e2rval->tooltip("Release value"); - e2rval->box(FL_ROUND_UP_BOX); - e2rval->color(FL_BACKGROUND_COLOR); - e2rval->selection_color(FL_INACTIVE_COLOR); - e2rval->labeltype(FL_NORMAL_LABEL); - e2rval->labelfont(0); - e2rval->labelsize(10); - e2rval->labelcolor(FL_FOREGROUND_COLOR); - e2rval->maximum(127); - e2rval->step(1); - e2rval->callback((Fl_Callback*)cb_e2rval); - e2rval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e2rval->when(FL_WHEN_CHANGED); - o->value(env->PR_val); - } // WidgetPDial* e2rval - { WidgetPDial* o = e2rdt = new WidgetPDial(75, 20, 30, 30, "R.dt"); - e2rdt->tooltip("Release time"); - e2rdt->box(FL_ROUND_UP_BOX); - e2rdt->color(FL_BACKGROUND_COLOR); - e2rdt->selection_color(FL_INACTIVE_COLOR); - e2rdt->labeltype(FL_NORMAL_LABEL); - e2rdt->labelfont(0); - e2rdt->labelsize(10); - e2rdt->labelcolor(FL_FOREGROUND_COLOR); - e2rdt->maximum(127); - e2rdt->step(1); - e2rdt->callback((Fl_Callback*)cb_e2rdt); - e2rdt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e2rdt->when(FL_WHEN_CHANGED); - o->value(env->PR_dt); - } // WidgetPDial* e2rdt - { WidgetPDial* o = e2envstretch = new WidgetPDial(145, 25, 25, 25, "Stretch"); - e2envstretch->tooltip("Envelope stretch (on lower notes makes the envelope longer)"); - e2envstretch->box(FL_ROUND_UP_BOX); - e2envstretch->color(FL_BACKGROUND_COLOR); - e2envstretch->selection_color(FL_INACTIVE_COLOR); - e2envstretch->labeltype(FL_NORMAL_LABEL); - e2envstretch->labelfont(0); - e2envstretch->labelsize(10); - e2envstretch->labelcolor(FL_FOREGROUND_COLOR); - e2envstretch->maximum(127); - e2envstretch->step(1); - e2envstretch->callback((Fl_Callback*)cb_e2envstretch); - e2envstretch->align(Fl_Align(FL_ALIGN_BOTTOM)); - e2envstretch->when(FL_WHEN_CHANGED); - o->value(env->Penvstretch); - } // WidgetPDial* e2envstretch - { Fl_Check_Button* o = e2forcedrelease = new Fl_Check_Button(180, 25, 15, 25, "frcR"); - e2forcedrelease->tooltip("Forced release"); - e2forcedrelease->down_box(FL_DOWN_BOX); - e2forcedrelease->labelsize(10); - e2forcedrelease->callback((Fl_Callback*)cb_e2forcedrelease); - e2forcedrelease->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - o->value(env->Pforcedrelease); - } // Fl_Check_Button* e2forcedrelease - { Fl_Button* o = new Fl_Button(155, 5, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C2); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(172, 5, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P2); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(190, 5, 15, 15, "E"); - o->tooltip("Envelope window"); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_E1); - } // Fl_Button* o - envASR->end(); - } // Fl_Group* envASR - return envASR; -} - -Fl_Group* EnvelopeUI::make_ADSRfilter_window() { - { envADSRfilter = new Fl_Group(0, 0, 275, 70); - envADSRfilter->box(FL_FLAT_BOX); - envADSRfilter->color(FL_LIGHT1); - envADSRfilter->selection_color(FL_BACKGROUND_COLOR); - envADSRfilter->labeltype(FL_NO_LABEL); - envADSRfilter->labelfont(1); - envADSRfilter->labelsize(14); - envADSRfilter->labelcolor(FL_FOREGROUND_COLOR); - envADSRfilter->user_data((void*)(this)); - envADSRfilter->align(Fl_Align(FL_ALIGN_TOP)); - envADSRfilter->when(FL_WHEN_RELEASE); - { Fl_Group* o = new Fl_Group(0, 0, 275, 70, "Filter Envelope"); - o->box(FL_PLASTIC_UP_BOX); - o->color(FL_CYAN); - o->labeltype(FL_ENGRAVED_LABEL); - o->labelsize(10); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { WidgetPDial* o = e3aval = new WidgetPDial(5, 20, 30, 30, "A.val"); - e3aval->tooltip("Starting value"); - e3aval->box(FL_ROUND_UP_BOX); - e3aval->color(FL_BACKGROUND_COLOR); - e3aval->selection_color(FL_INACTIVE_COLOR); - e3aval->labeltype(FL_NORMAL_LABEL); - e3aval->labelfont(0); - e3aval->labelsize(10); - e3aval->labelcolor(FL_FOREGROUND_COLOR); - e3aval->maximum(127); - e3aval->step(1); - e3aval->callback((Fl_Callback*)cb_e3aval); - e3aval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3aval->when(FL_WHEN_CHANGED); - o->value(env->PA_val); - } // WidgetPDial* e3aval - { WidgetPDial* o = e3adt = new WidgetPDial(40, 20, 30, 30, "A.dt"); - e3adt->tooltip("Attack time"); - e3adt->box(FL_ROUND_UP_BOX); - e3adt->color(FL_BACKGROUND_COLOR); - e3adt->selection_color(FL_INACTIVE_COLOR); - e3adt->labeltype(FL_NORMAL_LABEL); - e3adt->labelfont(0); - e3adt->labelsize(10); - e3adt->labelcolor(FL_FOREGROUND_COLOR); - e3adt->maximum(127); - e3adt->step(1); - e3adt->callback((Fl_Callback*)cb_e3adt); - e3adt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3adt->when(FL_WHEN_CHANGED); - o->value(env->PA_dt); - } // WidgetPDial* e3adt - { WidgetPDial* o = e3dval = new WidgetPDial(75, 20, 30, 30, "D.val"); - e3dval->tooltip("decay value"); - e3dval->box(FL_ROUND_UP_BOX); - e3dval->color(FL_BACKGROUND_COLOR); - e3dval->selection_color(FL_INACTIVE_COLOR); - e3dval->labeltype(FL_NORMAL_LABEL); - e3dval->labelfont(0); - e3dval->labelsize(10); - e3dval->labelcolor(FL_FOREGROUND_COLOR); - e3dval->maximum(127); - e3dval->step(1); - e3dval->callback((Fl_Callback*)cb_e3dval); - e3dval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3dval->when(FL_WHEN_CHANGED); - o->value(env->PD_val); - } // WidgetPDial* e3dval - { WidgetPDial* o = e3ddt = new WidgetPDial(110, 20, 30, 30, "D.dt"); - e3ddt->tooltip("decay time"); - e3ddt->box(FL_ROUND_UP_BOX); - e3ddt->color(FL_BACKGROUND_COLOR); - e3ddt->selection_color(FL_INACTIVE_COLOR); - e3ddt->labeltype(FL_NORMAL_LABEL); - e3ddt->labelfont(0); - e3ddt->labelsize(10); - e3ddt->labelcolor(FL_FOREGROUND_COLOR); - e3ddt->maximum(127); - e3ddt->step(1); - e3ddt->callback((Fl_Callback*)cb_e3ddt); - e3ddt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3ddt->when(FL_WHEN_CHANGED); - o->value(env->PD_dt); - } // WidgetPDial* e3ddt - { WidgetPDial* o = e3rdt = new WidgetPDial(145, 20, 30, 30, "R.dt"); - e3rdt->tooltip("Release time"); - e3rdt->box(FL_ROUND_UP_BOX); - e3rdt->color(FL_BACKGROUND_COLOR); - e3rdt->selection_color(FL_INACTIVE_COLOR); - e3rdt->labeltype(FL_NORMAL_LABEL); - e3rdt->labelfont(0); - e3rdt->labelsize(10); - e3rdt->labelcolor(FL_FOREGROUND_COLOR); - e3rdt->maximum(127); - e3rdt->step(1); - e3rdt->callback((Fl_Callback*)cb_e3rdt); - e3rdt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3rdt->when(FL_WHEN_CHANGED); - o->value(env->PR_dt); - } // WidgetPDial* e3rdt - { WidgetPDial* o = e3rval = new WidgetPDial(180, 20, 30, 30, "R.val"); - e3rval->tooltip("Release value"); - e3rval->box(FL_ROUND_UP_BOX); - e3rval->color(FL_BACKGROUND_COLOR); - e3rval->selection_color(FL_INACTIVE_COLOR); - e3rval->labeltype(FL_NORMAL_LABEL); - e3rval->labelfont(0); - e3rval->labelsize(10); - e3rval->labelcolor(FL_FOREGROUND_COLOR); - e3rval->maximum(127); - e3rval->step(1); - e3rval->callback((Fl_Callback*)cb_e3rval); - e3rval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3rval->when(FL_WHEN_CHANGED); - o->value(env->PR_val); - } // WidgetPDial* e3rval - { WidgetPDial* o = e3envstretch = new WidgetPDial(215, 25, 25, 25, "Stretch"); - e3envstretch->tooltip("Envelope stretch (on lower notes makes the envelope longer)"); - e3envstretch->box(FL_ROUND_UP_BOX); - e3envstretch->color(FL_BACKGROUND_COLOR); - e3envstretch->selection_color(FL_INACTIVE_COLOR); - e3envstretch->labeltype(FL_NORMAL_LABEL); - e3envstretch->labelfont(0); - e3envstretch->labelsize(10); - e3envstretch->labelcolor(FL_FOREGROUND_COLOR); - e3envstretch->maximum(127); - e3envstretch->step(1); - e3envstretch->callback((Fl_Callback*)cb_e3envstretch); - e3envstretch->align(Fl_Align(FL_ALIGN_BOTTOM)); - e3envstretch->when(FL_WHEN_CHANGED); - o->value(env->Penvstretch); - } // WidgetPDial* e3envstretch - { Fl_Check_Button* o = e3forcedrelease = new Fl_Check_Button(250, 30, 15, 20, "frcR"); - e3forcedrelease->tooltip("Forced Relase"); - e3forcedrelease->down_box(FL_DOWN_BOX); - e3forcedrelease->labelsize(10); - e3forcedrelease->callback((Fl_Callback*)cb_e3forcedrelease); - e3forcedrelease->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - o->value(env->Pforcedrelease); - } // Fl_Check_Button* e3forcedrelease - { Fl_Button* o = new Fl_Button(255, 5, 15, 15, "E"); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_E2); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(220, 5, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C3); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(237, 5, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P3); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - envADSRfilter->end(); - } // Fl_Group* envADSRfilter - return envADSRfilter; -} - -Fl_Group* EnvelopeUI::make_ASRbw_window() { - { envASRbw = new Fl_Group(0, 0, 210, 70); - envASRbw->box(FL_FLAT_BOX); - envASRbw->color(FL_BACKGROUND_COLOR); - envASRbw->selection_color(FL_BACKGROUND_COLOR); - envASRbw->labeltype(FL_NO_LABEL); - envASRbw->labelfont(0); - envASRbw->labelsize(14); - envASRbw->labelcolor(FL_FOREGROUND_COLOR); - envASRbw->user_data((void*)(this)); - envASRbw->align(Fl_Align(FL_ALIGN_TOP)); - envASRbw->when(FL_WHEN_RELEASE); - { Fl_Group* o = new Fl_Group(0, 0, 210, 70, "BandWidth Envelope"); - o->box(FL_PLASTIC_UP_BOX); - o->color(FL_CYAN); - o->labeltype(FL_ENGRAVED_LABEL); - o->labelsize(10); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { WidgetPDial* o = e4aval = new WidgetPDial(5, 20, 30, 30, "A.val"); - e4aval->tooltip("Starting value"); - e4aval->box(FL_ROUND_UP_BOX); - e4aval->color(FL_BACKGROUND_COLOR); - e4aval->selection_color(FL_INACTIVE_COLOR); - e4aval->labeltype(FL_NORMAL_LABEL); - e4aval->labelfont(0); - e4aval->labelsize(10); - e4aval->labelcolor(FL_FOREGROUND_COLOR); - e4aval->maximum(127); - e4aval->step(1); - e4aval->callback((Fl_Callback*)cb_e4aval); - e4aval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e4aval->when(FL_WHEN_CHANGED); - o->value(env->PA_val); - } // WidgetPDial* e4aval - { WidgetPDial* o = e4adt = new WidgetPDial(40, 20, 30, 30, "A.dt"); - e4adt->tooltip("Attack time"); - e4adt->box(FL_ROUND_UP_BOX); - e4adt->color(FL_BACKGROUND_COLOR); - e4adt->selection_color(FL_INACTIVE_COLOR); - e4adt->labeltype(FL_NORMAL_LABEL); - e4adt->labelfont(0); - e4adt->labelsize(10); - e4adt->labelcolor(FL_FOREGROUND_COLOR); - e4adt->maximum(127); - e4adt->step(1); - e4adt->callback((Fl_Callback*)cb_e4adt); - e4adt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e4adt->when(FL_WHEN_CHANGED); - o->value(env->PA_dt); - } // WidgetPDial* e4adt - { WidgetPDial* o = e4rval = new WidgetPDial(110, 20, 30, 30, "R.val"); - e4rval->tooltip("Release value"); - e4rval->box(FL_ROUND_UP_BOX); - e4rval->color(FL_BACKGROUND_COLOR); - e4rval->selection_color(FL_INACTIVE_COLOR); - e4rval->labeltype(FL_NORMAL_LABEL); - e4rval->labelfont(0); - e4rval->labelsize(10); - e4rval->labelcolor(FL_FOREGROUND_COLOR); - e4rval->maximum(127); - e4rval->step(1); - e4rval->callback((Fl_Callback*)cb_e4rval); - e4rval->align(Fl_Align(FL_ALIGN_BOTTOM)); - e4rval->when(FL_WHEN_CHANGED); - o->value(env->PR_val); - } // WidgetPDial* e4rval - { WidgetPDial* o = e4rdt = new WidgetPDial(75, 20, 30, 30, "R.dt"); - e4rdt->tooltip("Release time"); - e4rdt->box(FL_ROUND_UP_BOX); - e4rdt->color(FL_BACKGROUND_COLOR); - e4rdt->selection_color(FL_INACTIVE_COLOR); - e4rdt->labeltype(FL_NORMAL_LABEL); - e4rdt->labelfont(0); - e4rdt->labelsize(10); - e4rdt->labelcolor(FL_FOREGROUND_COLOR); - e4rdt->maximum(127); - e4rdt->step(1); - e4rdt->callback((Fl_Callback*)cb_e4rdt); - e4rdt->align(Fl_Align(FL_ALIGN_BOTTOM)); - e4rdt->when(FL_WHEN_CHANGED); - o->value(env->PR_dt); - } // WidgetPDial* e4rdt - { WidgetPDial* o = e4envstretch = new WidgetPDial(145, 25, 25, 25, "Stretch"); - e4envstretch->tooltip("Envelope stretch (on lower notes makes the envelope longer)"); - e4envstretch->box(FL_ROUND_UP_BOX); - e4envstretch->color(FL_BACKGROUND_COLOR); - e4envstretch->selection_color(FL_INACTIVE_COLOR); - e4envstretch->labeltype(FL_NORMAL_LABEL); - e4envstretch->labelfont(0); - e4envstretch->labelsize(10); - e4envstretch->labelcolor(FL_FOREGROUND_COLOR); - e4envstretch->maximum(127); - e4envstretch->step(1); - e4envstretch->callback((Fl_Callback*)cb_e4envstretch); - e4envstretch->align(Fl_Align(FL_ALIGN_BOTTOM)); - e4envstretch->when(FL_WHEN_CHANGED); - o->value(env->Penvstretch); - } // WidgetPDial* e4envstretch - { Fl_Check_Button* o = e4forcedrelease = new Fl_Check_Button(180, 25, 15, 25, "frcR"); - e4forcedrelease->tooltip("Forced release"); - e4forcedrelease->down_box(FL_DOWN_BOX); - e4forcedrelease->labelsize(10); - e4forcedrelease->callback((Fl_Callback*)cb_e4forcedrelease); - e4forcedrelease->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - o->value(env->Pforcedrelease); - } // Fl_Check_Button* e4forcedrelease - { Fl_Button* o = new Fl_Button(155, 5, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C4); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(172, 5, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P4); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(190, 5, 15, 15, "E"); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_E3); - } // Fl_Button* o - envASRbw->end(); - } // Fl_Group* envASRbw - return envASRbw; -} - -Fl_Group* EnvelopeUI::make_free_window() { - { envfree = new Fl_Group(0, 0, 205, 70); - envfree->box(FL_FLAT_BOX); - envfree->color(FL_LIGHT1); - envfree->selection_color(FL_BACKGROUND_COLOR); - envfree->labeltype(FL_NO_LABEL); - envfree->labelfont(1); - envfree->labelsize(14); - envfree->labelcolor(FL_FOREGROUND_COLOR); - envfree->user_data((void*)(this)); - envfree->align(Fl_Align(FL_ALIGN_TOP)); - envfree->when(FL_WHEN_RELEASE); - { envfreegroup = new Fl_Group(0, 0, 205, 70, "Amplitude Envelope"); - envfreegroup->box(FL_PLASTIC_UP_BOX); - envfreegroup->color(FL_CYAN); - envfreegroup->labeltype(FL_ENGRAVED_LABEL); - envfreegroup->labelsize(10); - envfreegroup->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeFreeEdit* o = freeeditsmall = new EnvelopeFreeEdit(5, 20, 195, 45, "Envelope"); - freeeditsmall->box(FL_FLAT_BOX); - freeeditsmall->color(FL_FOREGROUND_COLOR); - freeeditsmall->selection_color(FL_BACKGROUND_COLOR); - freeeditsmall->labeltype(FL_NORMAL_LABEL); - freeeditsmall->labelfont(0); - freeeditsmall->labelsize(14); - freeeditsmall->labelcolor(FL_FOREGROUND_COLOR); - freeeditsmall->callback((Fl_Callback*)cb_freeeditsmall); - freeeditsmall->align(Fl_Align(FL_ALIGN_CENTER)); - freeeditsmall->when(FL_WHEN_RELEASE); - Fl_Group::current()->resizable(freeeditsmall); - o->init(env); - } // EnvelopeFreeEdit* freeeditsmall - { Fl_Button* o = new Fl_Button(185, 5, 15, 15, "E"); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_E4); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(150, 5, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C5); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(167, 5, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P5); - } // Fl_Button* o - envfreegroup->end(); - Fl_Group::current()->resizable(envfreegroup); - } // Fl_Group* envfreegroup - envfree->end(); - } // Fl_Group* envfree - return envfree; -} - -void EnvelopeUI::init(EnvelopeParams *env_) { - env=env_; - make_ADSR_window(); - make_ASR_window(); - make_ADSRfilter_window(); - make_ASRbw_window(); - make_free_window(); - - make_freemode_edit_window(); - - envwindow=NULL; - if (env->Envmode==3) envfreegroup->label("Frequency Envelope"); - if (env->Envmode==4) envfreegroup->label("Filter Envelope"); - if (env->Envmode==5) envfreegroup->label("Bandwidth Envelope"); - - freemodeeditwindow->label(this->label()); - - - freeeditsmall->setpair(freeedit); - freeedit->setpair(freeeditsmall); - - - refresh(); -} - -void EnvelopeUI::reinit() { - if (env->Pfreemode!=0){ - int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL); - if (env->Pfreemode!=0) freemodebutton->value(1); - else freemodebutton->value(0); - if (answer==0) return; - }; - - if (env->Pfreemode==0) env->Pfreemode=1; - else env->Pfreemode=0; - - hide(); - int winx=freemodeeditwindow->x(); - int winy=freemodeeditwindow->y(); - - freemodeeditwindow->hide(); - - envwindow->hide(); - Fl_Group *par=envwindow->parent(); - par->hide(); - - - refresh(); - envwindow->show(); - par->redraw(); - - par->show(); - show(); - freemodeeditwindow->position(winx,winy); - freemodeeditwindow->show(); - - if (env->Pfreemode!=0) { - freemodebutton->value(1); - addpoint->show(); - deletepoint->show(); - forcedreleasecheck->show(); - }else{ - freemodebutton->value(0); - addpoint->hide(); - deletepoint->hide(); - forcedreleasecheck->hide(); - }; -} - -void EnvelopeUI::refresh() { - freemodebutton->value(env->Pfreemode); - - sustaincounter->value(env->Penvsustain); - if (env->Pfreemode==0) sustaincounter->hide(); - else sustaincounter->show(); - sustaincounter->maximum(env->Penvpoints-2); - - envstretchdial->value(env->Penvstretch); - if (env->Pfreemode==0) envstretchdial->hide(); - else envstretchdial->show(); - - linearenvelopecheck->value(env->Plinearenvelope); - if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide(); - else linearenvelopecheck->show(); - - forcedreleasecheck->value(env->Pforcedrelease); - if (env->Pfreemode==0) forcedreleasecheck->hide(); - - freeedit->redraw(); - - - if (env->Pfreemode==0){ - switch(env->Envmode){ - case(1): - case(2): - e1adt->value(env->PA_dt); - e1ddt->value(env->PD_dt); - e1sval->value(env->PS_val); - e1rdt->value(env->PR_dt); - e1envstretch->value(env->Penvstretch); - e1linearenvelope->value(env->Plinearenvelope); - e1forcedrelease->value(env->Pforcedrelease); - break; - case(3): - e2aval->value(env->PA_val); - e2adt->value(env->PA_dt); - e2rdt->value(env->PR_dt); - e2rval->value(env->PR_val); - e2envstretch->value(env->Penvstretch); - e2forcedrelease->value(env->Pforcedrelease); - break; - case(4): - e3aval->value(env->PA_val); - e3adt->value(env->PA_dt); - e3dval->value(env->PD_val); - e3ddt->value(env->PD_dt); - e3rdt->value(env->PR_dt); - e3rval->value(env->PR_val); - e3envstretch->value(env->Penvstretch); - e3forcedrelease->value(env->Pforcedrelease); - break; - case(5): - e4aval->value(env->PA_val); - e4adt->value(env->PA_dt); - e4rdt->value(env->PR_dt); - e4rval->value(env->PR_val); - e4envstretch->value(env->Penvstretch); - e4forcedrelease->value(env->Pforcedrelease); - break; - default: - break; - }; - }else{ - envfree->redraw(); - }; - - - envADSR->hide(); - envASR->hide(); - envADSRfilter->hide(); - envASRbw->hide(); - envfree->hide(); - - if (env->Pfreemode==0){ - switch(env->Envmode){ - case(1): - case(2): - envwindow=envADSR; - break; - case(3): - envwindow=envASR; - break; - case(4): - envwindow=envADSRfilter; - break; - case(5): - envwindow=envASRbw; - break; - default: - break; - }; - }else{ - envwindow=envfree; - }; - - envwindow->resize(this->x(),this->y(),this->w(),this->h()); - - envwindow->show(); -} diff --git a/plugins/zynaddsubfx/src/UI/EnvelopeUI.fl b/plugins/zynaddsubfx/src/UI/EnvelopeUI.fl deleted file mode 100644 index 3b49da3b5..000000000 --- a/plugins/zynaddsubfx/src/UI/EnvelopeUI.fl +++ /dev/null @@ -1,851 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0106 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/EnvelopeParams.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class EnvelopeFreeEdit {: {public Fl_Box} -} { - Function {EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {env=NULL; -pair=NULL;} {} - } - Function {init(EnvelopeParams *env_)} {} { - code {env=env_; -oldx=-1; -currentpoint=-1; -cpx=0; -lastpoint=-1;} {} - } - Function {setpair(Fl_Box *pair_)} {} { - code {pair=pair_;} {} - } - Function {getpointx(int n)} {return_type int - } { - code {int lx=w()-10; -int npoints=env->Penvpoints; - -float sum=0; -for (int i=1;igetdt(i)+1; - -float sumbefore=0;//the sum of all points before the computed point -for (int i=1;i<=n;i++) sumbefore+=env->getdt(i)+1; - -return((int) (sumbefore/(REALTYPE) sum*lx));} {} - } - Function {getpointy(int n)} {return_type int - } { - code {int ly=h()-10; - -return((int) ((1.0-env->Penvval[n]/127.0)*ly));} {} - } - Function {getnearest(int x,int y)} {return_type int - } { - code {x-=5;y-=5; - -int nearestpoint=0; -int nearestval=1000000;//a big value -for (int i=0;iPenvpoints;i++){ - int distance=abs(x-getpointx(i))+abs(y-getpointy(i)); - if (distancePfreemode==0) env->converttofree(); -int npoints=env->Penvpoints; - -if (active_r()) fl_color(FL_BLACK); - else fl_color(90,90,90); -if (!active_r()) currentpoint=-1; - -fl_rectf(ox,oy,lx,ly); - -ox+=5;oy+=5;lx-=10;ly-=10; - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -//draws the evelope points and lines -Fl_Color alb=FL_WHITE; -if (!active_r()) alb=fl_rgb_color(180,180,180); -fl_color(alb); -int oldxx=0,xx=0,oldyy=0,yy=getpointy(0); -fl_rectf(ox-3,oy+yy-3,6,6); -for (int i=1;i=0){ - fl_color(FL_CYAN); - fl_rectf(ox+getpointx(lastpoint)-5,oy+getpointy(lastpoint)-5,10,10); -}; - -//draw the sustain position -if (env->Penvsustain>0){ - fl_color(FL_YELLOW); - xx=getpointx(env->Penvsustain); - fl_line(ox+xx,oy+0,ox+xx,oy+ly); -}; - -//Show the envelope duration and the current line duration -fl_font(FL_HELVETICA|FL_BOLD,10); -float time=0.0; -if (currentpoint<=0){ - fl_color(alb); - for (int i=1;igetdt(i); -} else { - fl_color(255,0,0); - time=env->getdt(currentpoint); -}; -char tmpstr[20]; -if (time<1000.0) snprintf((char *)&tmpstr,20,"%.1fms",time); - else snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0); -fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0);} {} - } - Function {handle(int event)} {return_type int - } { - code {int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); - -if (event==FL_PUSH) { - currentpoint=getnearest(x_,y_); - cpx=x_; - cpdt=env->Penvdt[currentpoint]; - lastpoint=currentpoint; - redraw(); - if (pair!=NULL) pair->redraw(); -}; - -if (event==FL_RELEASE){ - currentpoint=-1; - redraw(); - if (pair!=NULL) pair->redraw(); -}; - -if ((event==FL_DRAG)&&(currentpoint>=0)){ - int ny=127-(int) (y_*127.0/h()); - if (ny<0) ny=0;if (ny>127) ny=127; - env->Penvval[currentpoint]=ny; - - int dx=(int)((x_-cpx)*0.1); - int newdt=cpdt+dx; - if (newdt<0) newdt=0;if (newdt>127) newdt=127; - if (currentpoint!=0) env->Penvdt[currentpoint]=newdt; - else env->Penvdt[currentpoint]=0; - - redraw(); - if (pair!=NULL) pair->redraw(); -}; - - -return(1);} {} - } - decl {Fl_Box *pair;} {} - decl {EnvelopeParams *env;} {} - decl {int oldx;} {} - decl {int currentpoint,cpx,cpdt;} {} - decl {int lastpoint;} {public - } -} - -class EnvelopeUI {: {public Fl_Group,PresetsUI_} -} { - Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {env=NULL; -freemodeeditwindow=NULL; -envADSR=NULL; -envASR=NULL; -envADSRfilter=NULL; -envASRbw=NULL; -envfree=NULL;} {} - } - Function {~EnvelopeUI()} {} { - code {envwindow->hide(); -hide(); -freemodeeditwindow->hide(); -delete (freemodeeditwindow);} {} - } - Function {make_freemode_edit_window()} {} { - Fl_Window freemodeeditwindow { - label Envelope - xywh {60 308 575 180} type Double hide - } { - Fl_Box freeedit { - label Envelope - xywh {5 5 565 145} box FLAT_BOX color 0 - code0 {o->init(env);} - class EnvelopeFreeEdit - } - Fl_Button addpoint { - label {Add point} - callback {int curpoint=freeedit->lastpoint; -if (curpoint<0) return; -//if (curpoint>=env->Penvpoints-1) return; -if (env->Penvpoints>=MAX_ENVELOPE_POINTS) return; - -for (int i=env->Penvpoints;i>=curpoint+1;i--){ - env->Penvdt[i]=env->Penvdt[i-1]; - env->Penvval[i]=env->Penvval[i-1]; -}; - -if (curpoint==0) { - env->Penvdt[1]=64; -}; - -env->Penvpoints++; -if (curpoint<=env->Penvsustain) env->Penvsustain++; - -freeedit->lastpoint+=1; -freeedit->redraw(); -envfree->redraw(); - -sustaincounter->value(env->Penvsustain); -sustaincounter->maximum(env->Penvpoints-2);} - xywh {115 155 80 20} box THIN_UP_BOX - code0 {if (env->Pfreemode==0) o->hide();} - } - Fl_Button deletepoint { - label {Delete point} - callback {int curpoint=freeedit->lastpoint; -if (curpoint<1) return; -if (curpoint>=env->Penvpoints-1) return; -if (env->Penvpoints<=3) return; - -for (int i=curpoint+1;iPenvpoints;i++){ - env->Penvdt[i-1]=env->Penvdt[i]; - env->Penvval[i-1]=env->Penvval[i]; -}; - -env->Penvpoints--; - -if (curpoint<=env->Penvsustain) env->Penvsustain--; - - -freeedit->lastpoint-=1; -freeedit->redraw(); -envfree->redraw(); - -sustaincounter->value(env->Penvsustain); -sustaincounter->maximum(env->Penvpoints-2);} - xywh {200 155 80 20} box THIN_UP_BOX - code0 {if (env->Pfreemode==0) o->hide();} - } - Fl_Light_Button freemodebutton { - label FreeMode - callback {reinit(); - -freeedit->lastpoint=-1; -freeedit->redraw();} - tooltip {Enable or disable the freemode} xywh {10 155 95 25} box PLASTIC_UP_BOX - } - Fl_Check_Button forcedreleasecheck { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced Relase} xywh {410 165 40 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(env->Pforcedrelease);} - code1 {if (env->Pfreemode==0) o->hide();} - } - Fl_Dial envstretchdial { - label {Str.} - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes make the envelope longer)} xywh {380 155 25 25} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - code1 {if (env->Pfreemode==0) o->hide();} - class WidgetPDial - } - Fl_Button {} { - label Close - callback {freemodeeditwindow->hide();} - xywh {510 155 60 25} box THIN_UP_BOX - } - Fl_Check_Button linearenvelopecheck { - label L - callback {env->Plinearenvelope=(int)o->value();} - tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(env->Plinearenvelope);} - code1 {if ((env->Pfreemode==0)||(env->Envmode>2)) o->hide();} - } - Fl_Counter sustaincounter { - label Sust - callback {env->Penvsustain=(int) o->value(); -freeedit->redraw(); -envfree->redraw();} - tooltip {Sustain (0 is disabled)} xywh {315 155 40 15} type Simple labelsize 11 align 4 minimum 0 maximum 127 step 1 - code0 {o->value(env->Penvsustain);} - code1 {if (env->Pfreemode==0) o->hide();} - code2 {o->maximum(env->Penvpoints-2);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - } - Function {make_ADSR_window()} {} { - Fl_Window envADSR { - xywh {108 336 205 70} type Double color 50 labelfont 1 hide - class Fl_Group - } { - Fl_Group {} { - label {Amplitude Envelope} - xywh {0 0 205 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - } { - Fl_Dial e1adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e1ddt { - label {D.dt} - callback {env->PD_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Decay time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PD_dt);} - class WidgetPDial - } - Fl_Dial e1rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e1sval { - label {S.val} - callback {env->PS_val=(int)o->value(); -freeedit->redraw();} - tooltip {Sustain value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PS_val);} - class WidgetPDial - } - Fl_Check_Button e1forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced Relase} xywh {180 35 20 15} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Dial e1envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - tooltip {Envelope window} xywh {185 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10 - } - Fl_Check_Button e1linearenvelope { - label L - callback {env->Plinearenvelope=(int)o->value();} - tooltip {The evelope is linear} xywh {180 20 15 15} down_box DOWN_BOX labelsize 10 align 4 - code0 {o->value(env->Plinearenvelope);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - } - } - Function {make_ASR_window()} {} { - Fl_Window envASR { - xywh {71 320 210 70} type Double hide - class Fl_Group - } { - Fl_Group {} { - label {Frequency Envelope} - xywh {0 0 210 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - } { - Fl_Dial e2aval { - label {A.val} - callback {env->PA_val=(int)o->value(); -freeedit->redraw();} - tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_val);} - class WidgetPDial - } - Fl_Dial e2adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e2rval { - label {R.val} - callback {env->PR_val=(int)o->value(); -freeedit->redraw();} - tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_val);} - class WidgetPDial - } - Fl_Dial e2rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e2envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Check_Button e2forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - tooltip {Envelope window} xywh {190 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10 - } - } - } - Function {make_ADSRfilter_window()} {} { - Fl_Window envADSRfilter { - xywh {87 143 275 70} type Double color 50 labelfont 1 hide - class Fl_Group - } { - Fl_Group {} { - label {Filter Envelope} - xywh {0 0 275 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - } { - Fl_Dial e3aval { - label {A.val} - callback {env->PA_val=(int)o->value(); -freeedit->redraw();} - tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_val);} - class WidgetPDial - } - Fl_Dial e3adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e3dval { - label {D.val} - callback {env->PD_val=(int)o->value(); -freeedit->redraw();} - tooltip {decay value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PD_val);} - class WidgetPDial - } - Fl_Dial e3ddt { - label {D.dt} - callback {env->PD_dt=(int)o->value(); -freeedit->redraw();} - tooltip {decay time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PD_dt);} - class WidgetPDial - } - Fl_Dial e3rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {145 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e3rval { - label {R.val} - callback {env->PR_val=(int)o->value(); -freeedit->redraw();} - tooltip {Release value} xywh {180 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_val);} - class WidgetPDial - } - Fl_Dial e3envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {215 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Check_Button e3forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced Relase} xywh {250 30 15 20} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - xywh {255 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - } - } - Function {make_ASRbw_window()} {} { - Fl_Window envASRbw { - xywh {224 539 210 70} type Double hide - class Fl_Group - } { - Fl_Group {} { - label {BandWidth Envelope} - xywh {0 0 210 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - } { - Fl_Dial e4aval { - label {A.val} - callback {env->PA_val=(int)o->value(); -freeedit->redraw();} - tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_val);} - class WidgetPDial - } - Fl_Dial e4adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e4rval { - label {R.val} - callback {env->PR_val=(int)o->value(); -freeedit->redraw();} - tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_val);} - class WidgetPDial - } - Fl_Dial e4rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e4envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Check_Button e4forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - xywh {190 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10 - } - } - } - Function {make_free_window()} {} { - Fl_Window envfree { - xywh {373 413 205 70} type Double color 50 labelfont 1 hide resizable - class Fl_Group - } { - Fl_Group envfreegroup { - label {Amplitude Envelope} - xywh {0 0 205 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 resizable - } { - Fl_Box freeeditsmall { - label Envelope - callback {envfree->redraw();} - xywh {5 20 195 45} box FLAT_BOX color 0 resizable - code0 {o->init(env);} - class EnvelopeFreeEdit - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - xywh {185 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - } - } - Function {init(EnvelopeParams *env_)} {} { - code {env=env_; -make_ADSR_window(); -make_ASR_window(); -make_ADSRfilter_window(); -make_ASRbw_window(); -make_free_window(); - -make_freemode_edit_window(); - -envwindow=NULL; -if (env->Envmode==3) envfreegroup->label("Frequency Envelope"); -if (env->Envmode==4) envfreegroup->label("Filter Envelope"); -if (env->Envmode==5) envfreegroup->label("Bandwidth Envelope"); - -freemodeeditwindow->label(this->label()); - - -freeeditsmall->setpair(freeedit); -freeedit->setpair(freeeditsmall); - - -refresh();} {} - } - Function {reinit()} {} { - code {if (env->Pfreemode!=0){ - int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL); - if (env->Pfreemode!=0) freemodebutton->value(1); - else freemodebutton->value(0); - if (answer==0) return; -}; - -if (env->Pfreemode==0) env->Pfreemode=1; - else env->Pfreemode=0; - -hide(); -int winx=freemodeeditwindow->x(); -int winy=freemodeeditwindow->y(); - -freemodeeditwindow->hide(); - -envwindow->hide(); -Fl_Group *par=envwindow->parent(); -par->hide(); - - -refresh(); -envwindow->show(); -par->redraw(); - -par->show(); -show(); -freemodeeditwindow->position(winx,winy); -freemodeeditwindow->show(); - -if (env->Pfreemode!=0) { - freemodebutton->value(1); - addpoint->show(); - deletepoint->show(); - forcedreleasecheck->show(); -}else{ - freemodebutton->value(0); - addpoint->hide(); - deletepoint->hide(); - forcedreleasecheck->hide(); -};} {selected - } - } - Function {refresh()} {} { - code {freemodebutton->value(env->Pfreemode); - -sustaincounter->value(env->Penvsustain); -if (env->Pfreemode==0) sustaincounter->hide(); - else sustaincounter->show(); -sustaincounter->maximum(env->Penvpoints-2); - -envstretchdial->value(env->Penvstretch); -if (env->Pfreemode==0) envstretchdial->hide(); - else envstretchdial->show(); - -linearenvelopecheck->value(env->Plinearenvelope); -if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide(); - else linearenvelopecheck->show(); - -forcedreleasecheck->value(env->Pforcedrelease); -if (env->Pfreemode==0) forcedreleasecheck->hide(); - -freeedit->redraw(); - - -if (env->Pfreemode==0){ - switch(env->Envmode){ - case(1): - case(2): - e1adt->value(env->PA_dt); - e1ddt->value(env->PD_dt); - e1sval->value(env->PS_val); - e1rdt->value(env->PR_dt); - e1envstretch->value(env->Penvstretch); - e1linearenvelope->value(env->Plinearenvelope); - e1forcedrelease->value(env->Pforcedrelease); - break; - case(3): - e2aval->value(env->PA_val); - e2adt->value(env->PA_dt); - e2rdt->value(env->PR_dt); - e2rval->value(env->PR_val); - e2envstretch->value(env->Penvstretch); - e2forcedrelease->value(env->Pforcedrelease); - break; - case(4): - e3aval->value(env->PA_val); - e3adt->value(env->PA_dt); - e3dval->value(env->PD_val); - e3ddt->value(env->PD_dt); - e3rdt->value(env->PR_dt); - e3rval->value(env->PR_val); - e3envstretch->value(env->Penvstretch); - e3forcedrelease->value(env->Pforcedrelease); - break; - case(5): - e4aval->value(env->PA_val); - e4adt->value(env->PA_dt); - e4rdt->value(env->PR_dt); - e4rval->value(env->PR_val); - e4envstretch->value(env->Penvstretch); - e4forcedrelease->value(env->Pforcedrelease); - break; - default: - break; - }; -}else{ - envfree->redraw(); -}; - - -envADSR->hide(); -envASR->hide(); -envADSRfilter->hide(); -envASRbw->hide(); -envfree->hide(); - -if (env->Pfreemode==0){ - switch(env->Envmode){ - case(1): - case(2): - envwindow=envADSR; - break; - case(3): - envwindow=envASR; - break; - case(4): - envwindow=envADSRfilter; - break; - case(5): - envwindow=envASRbw; - break; - default: - break; - }; -}else{ - envwindow=envfree; -}; - -envwindow->resize(this->x(),this->y(),this->w(),this->h()); - -envwindow->show();} {} - } - decl {EnvelopeParams *env;} {} - decl {Fl_Group *envwindow;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/EnvelopeUI.h b/plugins/zynaddsubfx/src/UI/EnvelopeUI.h deleted file mode 100644 index 724745c57..000000000 --- a/plugins/zynaddsubfx/src/UI/EnvelopeUI.h +++ /dev/null @@ -1,280 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef EnvelopeUI_h -#define EnvelopeUI_h -#include -#include "WidgetPDial.h" -#include -#include -#include "../globals.h" -#include -#include "../Params/EnvelopeParams.h" -#include -#include -#include -#include "PresetsUI.h" - -class EnvelopeFreeEdit : public Fl_Box { -public: - EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0); - void init(EnvelopeParams *env_); - void setpair(Fl_Box *pair_); - int getpointx(int n); - int getpointy(int n); - int getnearest(int x,int y); -private: - void draw(); -public: - int handle(int event); -private: - Fl_Box *pair; - EnvelopeParams *env; - int oldx; - int currentpoint,cpx,cpdt; -public: - int lastpoint; -}; -#include -#include -#include -#include -#include -#include - -class EnvelopeUI : public Fl_Group,PresetsUI_ { -public: - EnvelopeUI(int x,int y, int w, int h, const char *label=0); - ~EnvelopeUI(); - Fl_Double_Window* make_freemode_edit_window(); - Fl_Double_Window *freemodeeditwindow; - EnvelopeFreeEdit *freeedit; - Fl_Button *addpoint; -private: - void cb_addpoint_i(Fl_Button*, void*); - static void cb_addpoint(Fl_Button*, void*); -public: - Fl_Button *deletepoint; -private: - void cb_deletepoint_i(Fl_Button*, void*); - static void cb_deletepoint(Fl_Button*, void*); -public: - Fl_Light_Button *freemodebutton; -private: - void cb_freemodebutton_i(Fl_Light_Button*, void*); - static void cb_freemodebutton(Fl_Light_Button*, void*); -public: - Fl_Check_Button *forcedreleasecheck; -private: - void cb_forcedreleasecheck_i(Fl_Check_Button*, void*); - static void cb_forcedreleasecheck(Fl_Check_Button*, void*); -public: - WidgetPDial *envstretchdial; -private: - void cb_envstretchdial_i(WidgetPDial*, void*); - static void cb_envstretchdial(WidgetPDial*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); -public: - Fl_Check_Button *linearenvelopecheck; -private: - void cb_linearenvelopecheck_i(Fl_Check_Button*, void*); - static void cb_linearenvelopecheck(Fl_Check_Button*, void*); -public: - Fl_Counter *sustaincounter; -private: - void cb_sustaincounter_i(Fl_Counter*, void*); - static void cb_sustaincounter(Fl_Counter*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Group* make_ADSR_window(); - Fl_Group *envADSR; - WidgetPDial *e1adt; -private: - void cb_e1adt_i(WidgetPDial*, void*); - static void cb_e1adt(WidgetPDial*, void*); -public: - WidgetPDial *e1ddt; -private: - void cb_e1ddt_i(WidgetPDial*, void*); - static void cb_e1ddt(WidgetPDial*, void*); -public: - WidgetPDial *e1rdt; -private: - void cb_e1rdt_i(WidgetPDial*, void*); - static void cb_e1rdt(WidgetPDial*, void*); -public: - WidgetPDial *e1sval; -private: - void cb_e1sval_i(WidgetPDial*, void*); - static void cb_e1sval(WidgetPDial*, void*); -public: - Fl_Check_Button *e1forcedrelease; -private: - void cb_e1forcedrelease_i(Fl_Check_Button*, void*); - static void cb_e1forcedrelease(Fl_Check_Button*, void*); -public: - WidgetPDial *e1envstretch; -private: - void cb_e1envstretch_i(WidgetPDial*, void*); - static void cb_e1envstretch(WidgetPDial*, void*); - void cb_E_i(Fl_Button*, void*); - static void cb_E(Fl_Button*, void*); -public: - Fl_Check_Button *e1linearenvelope; -private: - void cb_e1linearenvelope_i(Fl_Check_Button*, void*); - static void cb_e1linearenvelope(Fl_Check_Button*, void*); - void cb_C1_i(Fl_Button*, void*); - static void cb_C1(Fl_Button*, void*); - void cb_P1_i(Fl_Button*, void*); - static void cb_P1(Fl_Button*, void*); -public: - Fl_Group* make_ASR_window(); - Fl_Group *envASR; - WidgetPDial *e2aval; -private: - void cb_e2aval_i(WidgetPDial*, void*); - static void cb_e2aval(WidgetPDial*, void*); -public: - WidgetPDial *e2adt; -private: - void cb_e2adt_i(WidgetPDial*, void*); - static void cb_e2adt(WidgetPDial*, void*); -public: - WidgetPDial *e2rval; -private: - void cb_e2rval_i(WidgetPDial*, void*); - static void cb_e2rval(WidgetPDial*, void*); -public: - WidgetPDial *e2rdt; -private: - void cb_e2rdt_i(WidgetPDial*, void*); - static void cb_e2rdt(WidgetPDial*, void*); -public: - WidgetPDial *e2envstretch; -private: - void cb_e2envstretch_i(WidgetPDial*, void*); - static void cb_e2envstretch(WidgetPDial*, void*); -public: - Fl_Check_Button *e2forcedrelease; -private: - void cb_e2forcedrelease_i(Fl_Check_Button*, void*); - static void cb_e2forcedrelease(Fl_Check_Button*, void*); - void cb_C2_i(Fl_Button*, void*); - static void cb_C2(Fl_Button*, void*); - void cb_P2_i(Fl_Button*, void*); - static void cb_P2(Fl_Button*, void*); - void cb_E1_i(Fl_Button*, void*); - static void cb_E1(Fl_Button*, void*); -public: - Fl_Group* make_ADSRfilter_window(); - Fl_Group *envADSRfilter; - WidgetPDial *e3aval; -private: - void cb_e3aval_i(WidgetPDial*, void*); - static void cb_e3aval(WidgetPDial*, void*); -public: - WidgetPDial *e3adt; -private: - void cb_e3adt_i(WidgetPDial*, void*); - static void cb_e3adt(WidgetPDial*, void*); -public: - WidgetPDial *e3dval; -private: - void cb_e3dval_i(WidgetPDial*, void*); - static void cb_e3dval(WidgetPDial*, void*); -public: - WidgetPDial *e3ddt; -private: - void cb_e3ddt_i(WidgetPDial*, void*); - static void cb_e3ddt(WidgetPDial*, void*); -public: - WidgetPDial *e3rdt; -private: - void cb_e3rdt_i(WidgetPDial*, void*); - static void cb_e3rdt(WidgetPDial*, void*); -public: - WidgetPDial *e3rval; -private: - void cb_e3rval_i(WidgetPDial*, void*); - static void cb_e3rval(WidgetPDial*, void*); -public: - WidgetPDial *e3envstretch; -private: - void cb_e3envstretch_i(WidgetPDial*, void*); - static void cb_e3envstretch(WidgetPDial*, void*); -public: - Fl_Check_Button *e3forcedrelease; -private: - void cb_e3forcedrelease_i(Fl_Check_Button*, void*); - static void cb_e3forcedrelease(Fl_Check_Button*, void*); - void cb_E2_i(Fl_Button*, void*); - static void cb_E2(Fl_Button*, void*); - void cb_C3_i(Fl_Button*, void*); - static void cb_C3(Fl_Button*, void*); - void cb_P3_i(Fl_Button*, void*); - static void cb_P3(Fl_Button*, void*); -public: - Fl_Group* make_ASRbw_window(); - Fl_Group *envASRbw; - WidgetPDial *e4aval; -private: - void cb_e4aval_i(WidgetPDial*, void*); - static void cb_e4aval(WidgetPDial*, void*); -public: - WidgetPDial *e4adt; -private: - void cb_e4adt_i(WidgetPDial*, void*); - static void cb_e4adt(WidgetPDial*, void*); -public: - WidgetPDial *e4rval; -private: - void cb_e4rval_i(WidgetPDial*, void*); - static void cb_e4rval(WidgetPDial*, void*); -public: - WidgetPDial *e4rdt; -private: - void cb_e4rdt_i(WidgetPDial*, void*); - static void cb_e4rdt(WidgetPDial*, void*); -public: - WidgetPDial *e4envstretch; -private: - void cb_e4envstretch_i(WidgetPDial*, void*); - static void cb_e4envstretch(WidgetPDial*, void*); -public: - Fl_Check_Button *e4forcedrelease; -private: - void cb_e4forcedrelease_i(Fl_Check_Button*, void*); - static void cb_e4forcedrelease(Fl_Check_Button*, void*); - void cb_C4_i(Fl_Button*, void*); - static void cb_C4(Fl_Button*, void*); - void cb_P4_i(Fl_Button*, void*); - static void cb_P4(Fl_Button*, void*); - void cb_E3_i(Fl_Button*, void*); - static void cb_E3(Fl_Button*, void*); -public: - Fl_Group* make_free_window(); - Fl_Group *envfree; - Fl_Group *envfreegroup; - EnvelopeFreeEdit *freeeditsmall; -private: - void cb_freeeditsmall_i(EnvelopeFreeEdit*, void*); - static void cb_freeeditsmall(EnvelopeFreeEdit*, void*); - void cb_E4_i(Fl_Button*, void*); - static void cb_E4(Fl_Button*, void*); - void cb_C5_i(Fl_Button*, void*); - static void cb_C5(Fl_Button*, void*); - void cb_P5_i(Fl_Button*, void*); - static void cb_P5(Fl_Button*, void*); -public: - void init(EnvelopeParams *env_); - void reinit(); - void refresh(); -private: - EnvelopeParams *env; - Fl_Group *envwindow; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/FilterUI.cc b/plugins/zynaddsubfx/src/UI/FilterUI.cc deleted file mode 100644 index 935f2f513..000000000 --- a/plugins/zynaddsubfx/src/UI/FilterUI.cc +++ /dev/null @@ -1,987 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "FilterUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -FormantFilterGraph::FormantFilterGraph(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - pars=NULL; - nvowel=NULL; - nformant=NULL; - graphpoints=NULL; -} - -void FormantFilterGraph::init(FilterParams *pars_,int *nvowel_,int *nformant_) { - pars=pars_; - nvowel=nvowel_; - nformant=nformant_; - oldx=-1; - graphpoints=new REALTYPE [w()]; -} - -void FormantFilterGraph::draw_freq_line(REALTYPE freq,int type) { - REALTYPE freqx=pars->getfreqpos(freq); - switch(type){ - case 0:fl_line_style(FL_SOLID);break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; - }; - - - if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h()); -} - -void FormantFilterGraph::draw() { - int maxdB=30; - int ox=x(),oy=y(),lx=w(),ly=h(),i,oiy; - REALTYPE freqx; - - fl_color(FL_BLACK); - fl_rectf(ox,oy,lx,ly); - - - //draw the lines - fl_color(FL_GRAY); - - fl_line_style(FL_SOLID); - //fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - - freqx=pars->getfreqpos(1000.0); - if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - - for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; - }; - - draw_freq_line(10000.0,0); - draw_freq_line(20000.0,1); - - fl_line_style(FL_DOT); - int GY=10;if (lyPnumformants){ - draw_freq_line(pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq),2); - - //show some information (like current formant frequency,amplitude) - char tmpstr[20]; - - snprintf(tmpstr,20,"%.2f kHz",pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq)*0.001); - fl_draw(tmpstr,ox+1,oy+1,40,12,FL_ALIGN_LEFT,NULL,0); - - snprintf(tmpstr,20,"%d dB",(int)( rap2dB(1e-9 + pars->getformantamp(pars->Pvowels[*nvowel].formants[*nformant].amp)) + pars->getgain() )); - fl_draw(tmpstr,ox+1,oy+15,40,12,FL_ALIGN_LEFT,NULL,0); - - }; - - //draw the data - - fl_color(FL_RED); - fl_line_style(FL_SOLID); - - pars->formantfilterH(*nvowel,lx,graphpoints); - - oiy=(int) ((graphpoints[0]/maxdB+1.0)*ly/2.0); - for (i=1;i=0)&&(oiy>=0)&&(iyPtype=(int)o->value(); -pars->changed=true; -} -void FilterUI::cb_analogfiltertypechoice(Fl_Choice* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_analogfiltertypechoice_i(o,v); -} - -Fl_Menu_Item FilterUI::menu_analogfiltertypechoice[] = { - {"LPF1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HPF1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LPF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HPF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"BPF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"NF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"PkF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LSh2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HSh2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void FilterUI::cb_svfiltertypechoice_i(Fl_Choice* o, void*) { - pars->Ptype=(int)o->value(); -pars->changed=true; -} -void FilterUI::cb_svfiltertypechoice(Fl_Choice* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_svfiltertypechoice_i(o,v); -} - -Fl_Menu_Item FilterUI::menu_svfiltertypechoice[] = { - {"1LPF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"1HPF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"1BPF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"1NF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void FilterUI::cb_filtertype_i(Fl_Choice* o, void*) { - switchcategory((int)o->value()); -pars->changed=true; -} -void FilterUI::cb_filtertype(Fl_Choice* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_filtertype_i(o,v); -} - -Fl_Menu_Item FilterUI::menu_filtertype[] = { - {"Analog", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Formant", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"StVarF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void FilterUI::cb_cfreqdial_i(WidgetPDial* o, void*) { - pars->Pfreq=(int)o->value(); -} -void FilterUI::cb_cfreqdial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_cfreqdial_i(o,v); -} - -void FilterUI::cb_qdial_i(WidgetPDial* o, void*) { - pars->Pq=(int)o->value(); -formantfiltergraph->redraw(); -} -void FilterUI::cb_qdial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_qdial_i(o,v); -} - -void FilterUI::cb_freqtrdial_i(WidgetPDial* o, void*) { - pars->Pfreqtrack=(int) o->value(); -} -void FilterUI::cb_freqtrdial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_freqtrdial_i(o,v); -} - -void FilterUI::cb_vsnsadial_i(WidgetPDial* o, void*) { - if (velsnsamp!=NULL) *velsnsamp=(int)o->value(); -} -void FilterUI::cb_vsnsadial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_vsnsadial_i(o,v); -} - -void FilterUI::cb_vsnsdial_i(WidgetPDial* o, void*) { - if (velsns!=NULL) *velsns=(int)o->value(); -} -void FilterUI::cb_vsnsdial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_vsnsdial_i(o,v); -} - -void FilterUI::cb_gaindial_i(WidgetPDial* o, void*) { - pars->Pgain=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true; -} -void FilterUI::cb_gaindial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_gaindial_i(o,v); -} - -void FilterUI::cb_stcounter_i(Fl_Choice* o, void*) { - pars->Pstages=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true; -} -void FilterUI::cb_stcounter(Fl_Choice* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_stcounter_i(o,v); -} - -void FilterUI::cb_editbutton_i(Fl_Button*, void*) { - formantparswindow->show(); -} -void FilterUI::cb_editbutton(Fl_Button* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_editbutton_i(o,v); -} - -void FilterUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(pars); -} -void FilterUI::cb_C(Fl_Button* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void FilterUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(pars,this); -} -void FilterUI::cb_P(Fl_Button* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -void FilterUI::cb_Formant_i(Fl_Counter* o, void*) { - nformant=(int) o->value(); -update_formant_window(); -formantfiltergraph->redraw(); -} -void FilterUI::cb_Formant(Fl_Counter* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Formant_i(o,v); -} - -void FilterUI::cb_Vowel_i(Fl_Counter* o, void*) { - nvowel=(int) o->value(); -update_formant_window(); -formantfiltergraph->redraw(); -} -void FilterUI::cb_Vowel(Fl_Counter* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Vowel_i(o,v); -} - -void FilterUI::cb_formant_freq_dial_i(WidgetPDial* o, void*) { - pars->Pvowels[nvowel].formants[nformant].freq=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true; -} -void FilterUI::cb_formant_freq_dial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->parent()->user_data()))->cb_formant_freq_dial_i(o,v); -} - -void FilterUI::cb_formant_q_dial_i(WidgetPDial* o, void*) { - pars->Pvowels[nvowel].formants[nformant].q=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true; -} -void FilterUI::cb_formant_q_dial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->parent()->user_data()))->cb_formant_q_dial_i(o,v); -} - -void FilterUI::cb_formant_amp_dial_i(WidgetPDial* o, void*) { - pars->Pvowels[nvowel].formants[nformant].amp=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true; -} -void FilterUI::cb_formant_amp_dial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->parent()->user_data()))->cb_formant_amp_dial_i(o,v); -} - -void FilterUI::cb_Seq_i(Fl_Counter* o, void*) { - pars->Psequencesize=(int) o->value(); -update_formant_window(); -pars->changed=true; -} -void FilterUI::cb_Seq(Fl_Counter* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Seq_i(o,v); -} - -void FilterUI::cb_S_i(Fl_Counter* o, void*) { - nseqpos=(int) o->value(); -update_formant_window(); -pars->changed=true; -} -void FilterUI::cb_S(Fl_Counter* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_S_i(o,v); -} - -void FilterUI::cb_vowel_counter_i(Fl_Counter* o, void*) { - pars->Psequence[nseqpos].nvowel=(int) o->value(); -pars->changed=true; -} -void FilterUI::cb_vowel_counter(Fl_Counter* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_vowel_counter_i(o,v); -} - -void FilterUI::cb_Neg_i(Fl_Check_Button* o, void*) { - pars->Psequencereversed=(int) o->value(); -pars->changed=true; -} -void FilterUI::cb_Neg(Fl_Check_Button* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Neg_i(o,v); -} - -void FilterUI::cb_strchdial_i(WidgetPDial* o, void*) { - pars->Psequencestretch=(int) o->value(); -pars->changed=true; -} -void FilterUI::cb_strchdial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->parent()->user_data()))->cb_strchdial_i(o,v); -} - -void FilterUI::cb_Num_i(Fl_Counter* o, void*) { - pars->Pnumformants=(int) o->value(); -update_formant_window(); -pars->changed=true; -formantfiltergraph->redraw(); -} -void FilterUI::cb_Num(Fl_Counter* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_Num_i(o,v); -} - -void FilterUI::cb_frsldial_i(WidgetPDial* o, void*) { - pars->Pformantslowness=(int) o->value(); -pars->changed=true; -} -void FilterUI::cb_frsldial(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_frsldial_i(o,v); -} - -void FilterUI::cb_centerfreqvo_i(Fl_Value_Output* o, void*) { - o->value(pars->getcenterfreq()/1000.0); -} -void FilterUI::cb_centerfreqvo(Fl_Value_Output* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_centerfreqvo_i(o,v); -} - -void FilterUI::cb_octavesfreqvo_i(Fl_Value_Output* o, void*) { - o->value(pars->getoctavesfreq()); -} -void FilterUI::cb_octavesfreqvo(Fl_Value_Output* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_octavesfreqvo_i(o,v); -} - -void FilterUI::cb_cfknob_i(Fl_Slider* o, void*) { - pars->Pcenterfreq=(int)o->value(); -centerfreqvo->do_callback(); -formantfiltergraph->redraw(); -pars->changed=true; -} -void FilterUI::cb_cfknob(Fl_Slider* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_cfknob_i(o,v); -} - -void FilterUI::cb_octknob_i(Fl_Slider* o, void*) { - pars->Poctavesfreq=(int)o->value(); -octavesfreqvo->do_callback(); -formantfiltergraph->redraw(); -} -void FilterUI::cb_octknob(Fl_Slider* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_octknob_i(o,v); -} - -void FilterUI::cb_wvknob_i(WidgetPDial* o, void*) { - pars->Pvowelclearness=(int) o->value(); -pars->changed=true; -} -void FilterUI::cb_wvknob(WidgetPDial* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_wvknob_i(o,v); -} - -void FilterUI::cb_Close_i(Fl_Button*, void*) { - formantparswindow->hide(); -} -void FilterUI::cb_Close(Fl_Button* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void FilterUI::cb_C1_i(Fl_Button*, void*) { - presetsui->copy(pars,nvowel); -} -void FilterUI::cb_C1(Fl_Button* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_C1_i(o,v); -} - -void FilterUI::cb_P1_i(Fl_Button*, void*) { - presetsui->paste(pars,this,nvowel); -} -void FilterUI::cb_P1(Fl_Button* o, void* v) { - ((FilterUI*)(o->parent()->user_data()))->cb_P1_i(o,v); -} - -FilterUI::FilterUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - pars=NULL; - velsnsamp=NULL; - velsns=NULL; - nvowel=0;nformant=0;nseqpos=0; -} - -FilterUI::~FilterUI() { - filterui->hide(); - formantparswindow->hide(); - hide(); - //delete (filterui); - delete (formantparswindow); -} - -Fl_Group* FilterUI::make_window() { - { filterui = new Fl_Group(0, 0, 275, 75); - filterui->box(FL_FLAT_BOX); - filterui->color(FL_LIGHT1); - filterui->selection_color(FL_BACKGROUND_COLOR); - filterui->labeltype(FL_NO_LABEL); - filterui->labelfont(1); - filterui->labelsize(14); - filterui->labelcolor(FL_FOREGROUND_COLOR); - filterui->user_data((void*)(this)); - filterui->align(Fl_Align(FL_ALIGN_TOP)); - filterui->when(FL_WHEN_RELEASE); - { filterparamswindow = new Fl_Group(0, 0, 275, 75, "Filter Parameters"); - filterparamswindow->box(FL_PLASTIC_UP_BOX); - filterparamswindow->color((Fl_Color)183); - filterparamswindow->labeltype(FL_ENGRAVED_LABEL); - filterparamswindow->labelsize(10); - filterparamswindow->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { Fl_Choice* o = analogfiltertypechoice = new Fl_Choice(10, 50, 50, 15, "FilterType"); - analogfiltertypechoice->tooltip("The Filter type"); - analogfiltertypechoice->down_box(FL_BORDER_BOX); - analogfiltertypechoice->labelsize(10); - analogfiltertypechoice->textsize(10); - analogfiltertypechoice->callback((Fl_Callback*)cb_analogfiltertypechoice); - analogfiltertypechoice->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - analogfiltertypechoice->menu(menu_analogfiltertypechoice); - o->value(pars->Ptype); - } // Fl_Choice* analogfiltertypechoice - { Fl_Choice* o = svfiltertypechoice = new Fl_Choice(10, 50, 50, 15, "FilterType"); - svfiltertypechoice->tooltip("The Filter type"); - svfiltertypechoice->down_box(FL_BORDER_BOX); - svfiltertypechoice->labelsize(10); - svfiltertypechoice->textsize(10); - svfiltertypechoice->callback((Fl_Callback*)cb_svfiltertypechoice); - svfiltertypechoice->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - svfiltertypechoice->menu(menu_svfiltertypechoice); - o->value(pars->Ptype); - } // Fl_Choice* svfiltertypechoice - { Fl_Choice* o = filtertype = new Fl_Choice(10, 20, 60, 15, "Category"); - filtertype->tooltip("The Category of the Filter (Analog/Formantic/etc.)"); - filtertype->down_box(FL_BORDER_BOX); - filtertype->labelsize(10); - filtertype->textsize(10); - filtertype->callback((Fl_Callback*)cb_filtertype); - filtertype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - filtertype->menu(menu_filtertype); - o->value(pars->Pcategory); - } // Fl_Choice* filtertype - { WidgetPDial* o = cfreqdial = new WidgetPDial(75, 25, 30, 30, "C.Freq"); - cfreqdial->tooltip("Center Frequency of the Filter or the base position in the vowel\'s sequence"); - cfreqdial->box(FL_ROUND_UP_BOX); - cfreqdial->color(FL_BACKGROUND_COLOR); - cfreqdial->selection_color(FL_INACTIVE_COLOR); - cfreqdial->labeltype(FL_NORMAL_LABEL); - cfreqdial->labelfont(0); - cfreqdial->labelsize(10); - cfreqdial->labelcolor(FL_FOREGROUND_COLOR); - cfreqdial->maximum(127); - cfreqdial->step(1); - cfreqdial->callback((Fl_Callback*)cb_cfreqdial); - cfreqdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - cfreqdial->when(FL_WHEN_CHANGED); - o->value(pars->Pfreq); - } // WidgetPDial* cfreqdial - { WidgetPDial* o = qdial = new WidgetPDial(110, 25, 30, 30, "Q"); - qdial->tooltip("Filter resonance or bandwidth"); - qdial->box(FL_ROUND_UP_BOX); - qdial->color(FL_BACKGROUND_COLOR); - qdial->selection_color(FL_INACTIVE_COLOR); - qdial->labeltype(FL_NORMAL_LABEL); - qdial->labelfont(0); - qdial->labelsize(10); - qdial->labelcolor(FL_FOREGROUND_COLOR); - qdial->maximum(127); - qdial->step(1); - qdial->callback((Fl_Callback*)cb_qdial); - qdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - qdial->when(FL_WHEN_CHANGED); - o->value(pars->Pq); - } // WidgetPDial* qdial - { WidgetPDial* o = freqtrdial = new WidgetPDial(215, 25, 30, 30, "freq.tr."); - freqtrdial->tooltip("Filter frequency tracking (left is negative, middle is 0, and right is positi\ -ve)"); - freqtrdial->box(FL_ROUND_UP_BOX); - freqtrdial->color(FL_BACKGROUND_COLOR); - freqtrdial->selection_color(FL_INACTIVE_COLOR); - freqtrdial->labeltype(FL_NORMAL_LABEL); - freqtrdial->labelfont(0); - freqtrdial->labelsize(10); - freqtrdial->labelcolor(FL_FOREGROUND_COLOR); - freqtrdial->maximum(127); - freqtrdial->step(1); - freqtrdial->callback((Fl_Callback*)cb_freqtrdial); - freqtrdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - freqtrdial->when(FL_WHEN_CHANGED); - o->value(pars->Pfreqtrack); - } // WidgetPDial* freqtrdial - { vsnsadial = new WidgetPDial(145, 25, 30, 30, "V.SnsA."); - vsnsadial->tooltip("Velocity sensing amount of the Filter"); - vsnsadial->box(FL_ROUND_UP_BOX); - vsnsadial->color(FL_BACKGROUND_COLOR); - vsnsadial->selection_color(FL_INACTIVE_COLOR); - vsnsadial->labeltype(FL_NORMAL_LABEL); - vsnsadial->labelfont(0); - vsnsadial->labelsize(10); - vsnsadial->labelcolor(FL_FOREGROUND_COLOR); - vsnsadial->maximum(127); - vsnsadial->step(1); - vsnsadial->callback((Fl_Callback*)cb_vsnsadial); - vsnsadial->align(Fl_Align(FL_ALIGN_BOTTOM)); - vsnsadial->when(FL_WHEN_CHANGED); - } // WidgetPDial* vsnsadial - { vsnsdial = new WidgetPDial(180, 25, 30, 30, "V.Sns."); - vsnsdial->tooltip("Velocity Sensing Function of the Filter"); - vsnsdial->box(FL_ROUND_UP_BOX); - vsnsdial->color(FL_BACKGROUND_COLOR); - vsnsdial->selection_color(FL_INACTIVE_COLOR); - vsnsdial->labeltype(FL_NORMAL_LABEL); - vsnsdial->labelfont(0); - vsnsdial->labelsize(10); - vsnsdial->labelcolor(FL_FOREGROUND_COLOR); - vsnsdial->maximum(127); - vsnsdial->step(1); - vsnsdial->callback((Fl_Callback*)cb_vsnsdial); - vsnsdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - vsnsdial->when(FL_WHEN_CHANGED); - } // WidgetPDial* vsnsdial - { WidgetPDial* o = gaindial = new WidgetPDial(250, 35, 20, 20, "gain"); - gaindial->tooltip("Filter output gain/damp"); - gaindial->box(FL_ROUND_UP_BOX); - gaindial->color(FL_BACKGROUND_COLOR); - gaindial->selection_color(FL_INACTIVE_COLOR); - gaindial->labeltype(FL_NORMAL_LABEL); - gaindial->labelfont(0); - gaindial->labelsize(10); - gaindial->labelcolor(FL_FOREGROUND_COLOR); - gaindial->maximum(127); - gaindial->step(1); - gaindial->callback((Fl_Callback*)cb_gaindial); - gaindial->align(Fl_Align(FL_ALIGN_BOTTOM)); - gaindial->when(FL_WHEN_CHANGED); - o->value(pars->Pgain); - } // WidgetPDial* gaindial - { Fl_Choice* o = stcounter = new Fl_Choice(235, 5, 35, 15, "St"); - stcounter->tooltip("Filter stages (in order to increase dB/oct. value and the order of the filter\ -)"); - stcounter->down_box(FL_BORDER_BOX); - stcounter->labelsize(10); - stcounter->textfont(1); - stcounter->textsize(10); - stcounter->callback((Fl_Callback*)cb_stcounter); - for (int i=0;iadd(tmp);}; - o->value(pars->Pstages); - } // Fl_Choice* stcounter - filterparamswindow->end(); - } // Fl_Group* filterparamswindow - { editbutton = new Fl_Button(15, 40, 50, 25, "Edit"); - editbutton->box(FL_PLASTIC_UP_BOX); - editbutton->labelfont(1); - editbutton->labelsize(11); - editbutton->callback((Fl_Callback*)cb_editbutton); - } // Fl_Button* editbutton - { Fl_Button* o = new Fl_Button(186, 5, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(203, 5, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - filterui->end(); - } // Fl_Group* filterui - return filterui; -} - -Fl_Double_Window* FilterUI::make_formant_window() { - { formantparswindow = new Fl_Double_Window(700, 205, "Formant Filter Parameters"); - formantparswindow->user_data((void*)(this)); - { Fl_Group* o = new Fl_Group(485, 47, 105, 113); - o->box(FL_THIN_UP_BOX); - { Fl_Counter* o = new Fl_Counter(545, 80, 40, 15, "Formant "); - o->type(1); - o->labelfont(1); - o->labelsize(10); - o->minimum(0); - o->maximum(127); - o->step(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Formant); - o->align(Fl_Align(FL_ALIGN_LEFT)); - o->bounds(0,FF_MAX_FORMANTS-1); - o->value(nformant); - } // Fl_Counter* o - { Fl_Counter* o = new Fl_Counter(545, 55, 40, 20, "Vowel no."); - o->type(1); - o->labelfont(1); - o->labelsize(10); - o->minimum(0); - o->maximum(127); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Vowel); - o->align(Fl_Align(FL_ALIGN_LEFT)); - o->bounds(0,FF_MAX_VOWELS-1); - o->value(nvowel); - } // Fl_Counter* o - { formantparsgroup = new Fl_Group(490, 105, 95, 50); - formantparsgroup->box(FL_ENGRAVED_FRAME); - { formant_freq_dial = new WidgetPDial(495, 115, 25, 25, "freq"); - formant_freq_dial->tooltip("Formant frequency"); - formant_freq_dial->box(FL_ROUND_UP_BOX); - formant_freq_dial->color(FL_BACKGROUND_COLOR); - formant_freq_dial->selection_color(FL_INACTIVE_COLOR); - formant_freq_dial->labeltype(FL_NORMAL_LABEL); - formant_freq_dial->labelfont(0); - formant_freq_dial->labelsize(10); - formant_freq_dial->labelcolor(FL_FOREGROUND_COLOR); - formant_freq_dial->maximum(127); - formant_freq_dial->step(1); - formant_freq_dial->callback((Fl_Callback*)cb_formant_freq_dial); - formant_freq_dial->align(Fl_Align(FL_ALIGN_BOTTOM)); - formant_freq_dial->when(FL_WHEN_CHANGED); - } // WidgetPDial* formant_freq_dial - { formant_q_dial = new WidgetPDial(525, 115, 24, 25, "Q"); - formant_q_dial->tooltip("Formant\'s Q"); - formant_q_dial->box(FL_ROUND_UP_BOX); - formant_q_dial->color(FL_BACKGROUND_COLOR); - formant_q_dial->selection_color(FL_INACTIVE_COLOR); - formant_q_dial->labeltype(FL_NORMAL_LABEL); - formant_q_dial->labelfont(0); - formant_q_dial->labelsize(10); - formant_q_dial->labelcolor(FL_FOREGROUND_COLOR); - formant_q_dial->maximum(127); - formant_q_dial->step(1); - formant_q_dial->callback((Fl_Callback*)cb_formant_q_dial); - formant_q_dial->align(Fl_Align(FL_ALIGN_BOTTOM)); - formant_q_dial->when(FL_WHEN_CHANGED); - } // WidgetPDial* formant_q_dial - { formant_amp_dial = new WidgetPDial(555, 115, 24, 25, "amp"); - formant_amp_dial->tooltip("Formant amplitude"); - formant_amp_dial->box(FL_ROUND_UP_BOX); - formant_amp_dial->color(FL_BACKGROUND_COLOR); - formant_amp_dial->selection_color(FL_INACTIVE_COLOR); - formant_amp_dial->labeltype(FL_NORMAL_LABEL); - formant_amp_dial->labelfont(0); - formant_amp_dial->labelsize(10); - formant_amp_dial->labelcolor(FL_FOREGROUND_COLOR); - formant_amp_dial->maximum(127); - formant_amp_dial->step(1); - formant_amp_dial->callback((Fl_Callback*)cb_formant_amp_dial); - formant_amp_dial->align(Fl_Align(FL_ALIGN_BOTTOM)); - formant_amp_dial->when(FL_WHEN_CHANGED); - } // WidgetPDial* formant_amp_dial - formantparsgroup->end(); - } // Fl_Group* formantparsgroup - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(590, 47, 100, 113); - o->box(FL_THIN_UP_BOX); - { Fl_Counter* o = new Fl_Counter(595, 62, 55, 20, "Seq.Size"); - o->type(1); - o->labelfont(1); - o->labelsize(10); - o->minimum(0); - o->maximum(127); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Seq); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->bounds(1,FF_MAX_SEQUENCE-1); - o->value(pars->Psequencesize); - } // Fl_Counter* o - { Fl_Counter* o = new Fl_Counter(595, 97, 40, 15, "S.Pos."); - o->tooltip("Current position from the sequence"); - o->type(1); - o->labelfont(1); - o->labelsize(10); - o->minimum(0); - o->maximum(127); - o->step(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_S); - o->align(Fl_Align(FL_ALIGN_TOP_RIGHT)); - o->bounds(0,FF_MAX_SEQUENCE-2); - o->value(nseqpos); - } // Fl_Counter* o - { Fl_Counter* o = vowel_counter = new Fl_Counter(640, 97, 40, 15, "Vowel"); - vowel_counter->type(1); - vowel_counter->labelsize(10); - vowel_counter->minimum(0); - vowel_counter->maximum(127); - vowel_counter->step(1); - vowel_counter->textsize(10); - vowel_counter->callback((Fl_Callback*)cb_vowel_counter); - vowel_counter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(0,FF_MAX_VOWELS-1); - } // Fl_Counter* vowel_counter - { Fl_Check_Button* o = new Fl_Check_Button(625, 132, 60, 20, "Neg.Input"); - o->tooltip("Negate the input from LFO/envelopes/etc."); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Neg); - o->value(pars->Psequencereversed); - } // Fl_Check_Button* o - { WidgetPDial* o = strchdial = new WidgetPDial(595, 130, 25, 25, "Strch"); - strchdial->tooltip("Sequence Stretch"); - strchdial->box(FL_ROUND_UP_BOX); - strchdial->color(FL_BACKGROUND_COLOR); - strchdial->selection_color(FL_INACTIVE_COLOR); - strchdial->labeltype(FL_NORMAL_LABEL); - strchdial->labelfont(0); - strchdial->labelsize(10); - strchdial->labelcolor(FL_FOREGROUND_COLOR); - strchdial->maximum(127); - strchdial->step(1); - strchdial->callback((Fl_Callback*)cb_strchdial); - strchdial->align(Fl_Align(FL_ALIGN_TOP)); - strchdial->when(FL_WHEN_CHANGED); - o->value(pars->Psequencestretch); - } // WidgetPDial* strchdial - o->end(); - } // Fl_Group* o - { Fl_Counter* o = new Fl_Counter(485, 15, 65, 20, "Num.Formants"); - o->type(1); - o->labelfont(1); - o->labelsize(10); - o->minimum(0); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Num); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->bounds(1,FF_MAX_FORMANTS); - o->value(pars->Pnumformants); - } // Fl_Counter* o - { WidgetPDial* o = frsldial = new WidgetPDial(565, 15, 25, 25, "Fr.Sl."); - frsldial->tooltip("Formant\'s Slowness (Morphing)"); - frsldial->box(FL_ROUND_UP_BOX); - frsldial->color(FL_BACKGROUND_COLOR); - frsldial->selection_color(FL_INACTIVE_COLOR); - frsldial->labeltype(FL_NORMAL_LABEL); - frsldial->labelfont(1); - frsldial->labelsize(10); - frsldial->labelcolor(FL_FOREGROUND_COLOR); - frsldial->maximum(127); - frsldial->step(1); - frsldial->callback((Fl_Callback*)cb_frsldial); - frsldial->align(Fl_Align(FL_ALIGN_TOP)); - frsldial->when(FL_WHEN_CHANGED); - o->value(pars->Pformantslowness); - } // WidgetPDial* frsldial - { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(515, 164, 33, 18, "C.f."); - centerfreqvo->tooltip("Center Frequency (kHz)"); - centerfreqvo->minimum(1); - centerfreqvo->maximum(10); - centerfreqvo->step(0.01); - centerfreqvo->value(1); - centerfreqvo->textfont(1); - centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo); - centerfreqvo->when(3); - o->value(pars->getcenterfreq()/1000.0); - } // Fl_Value_Output* centerfreqvo - { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(515, 182, 33, 18, "Oct."); - octavesfreqvo->tooltip("No. of octaves"); - octavesfreqvo->minimum(1); - octavesfreqvo->maximum(127); - octavesfreqvo->step(1); - octavesfreqvo->value(5); - octavesfreqvo->textfont(1); - octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo); - octavesfreqvo->when(3); - o->value(pars->getoctavesfreq()); - } // Fl_Value_Output* octavesfreqvo - { Fl_Slider* o = cfknob = new Fl_Slider(551, 167, 84, 15); - cfknob->type(5); - cfknob->box(FL_FLAT_BOX); - cfknob->maximum(127); - cfknob->callback((Fl_Callback*)cb_cfknob); - o->value(pars->Pcenterfreq); - } // Fl_Slider* cfknob - { Fl_Slider* o = octknob = new Fl_Slider(551, 185, 84, 15); - octknob->type(5); - octknob->box(FL_FLAT_BOX); - octknob->maximum(127); - octknob->callback((Fl_Callback*)cb_octknob); - o->value(pars->Poctavesfreq); - } // Fl_Slider* octknob - { FormantFilterGraph* o = formantfiltergraph = new FormantFilterGraph(5, 5, 475, 195); - formantfiltergraph->box(FL_BORDER_BOX); - formantfiltergraph->color(FL_BACKGROUND_COLOR); - formantfiltergraph->selection_color(FL_BACKGROUND_COLOR); - formantfiltergraph->labeltype(FL_NORMAL_LABEL); - formantfiltergraph->labelfont(0); - formantfiltergraph->labelsize(14); - formantfiltergraph->labelcolor(FL_FOREGROUND_COLOR); - formantfiltergraph->align(Fl_Align(FL_ALIGN_CENTER)); - formantfiltergraph->when(FL_WHEN_RELEASE); - o->init(pars,&nvowel,&nformant); - } // FormantFilterGraph* formantfiltergraph - { WidgetPDial* o = wvknob = new WidgetPDial(600, 15, 25, 25, "Vw.Cl."); - wvknob->tooltip("Vowel \"clearness\" (how the mixed vowels are avoided)"); - wvknob->box(FL_ROUND_UP_BOX); - wvknob->color(FL_BACKGROUND_COLOR); - wvknob->selection_color(FL_INACTIVE_COLOR); - wvknob->labeltype(FL_NORMAL_LABEL); - wvknob->labelfont(1); - wvknob->labelsize(10); - wvknob->labelcolor(FL_FOREGROUND_COLOR); - wvknob->maximum(127); - wvknob->step(1); - wvknob->callback((Fl_Callback*)cb_wvknob); - wvknob->align(Fl_Align(FL_ALIGN_TOP)); - wvknob->when(FL_WHEN_CHANGED); - o->value(pars->Pvowelclearness); - } // WidgetPDial* wvknob - { Fl_Button* o = new Fl_Button(645, 180, 50, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(635, 25, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(665, 25, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P1); - } // Fl_Button* o - { new Fl_Box(635, 10, 55, 15, "Vowel"); - } // Fl_Box* o - formantparswindow->end(); - } // Fl_Double_Window* formantparswindow - return formantparswindow; -} - -void FilterUI::update_formant_window() { - formant_freq_dial->value(pars->Pvowels[nvowel].formants[nformant].freq); - formant_q_dial->value(pars->Pvowels[nvowel].formants[nformant].q); - formant_amp_dial->value(pars->Pvowels[nvowel].formants[nformant].amp); - if (nformantPnumformants) formantparsgroup->activate(); - else formantparsgroup->deactivate(); - - if (nseqposPsequencesize) vowel_counter->activate(); - else vowel_counter->deactivate(); - - - vowel_counter->value(pars->Psequence[nseqpos].nvowel); -} - -void FilterUI::refresh() { - update_formant_window(); - formantfiltergraph->redraw(); - - if (pars->Pcategory==0) svfiltertypechoice->value(pars->Ptype); - if (pars->Pcategory==2) analogfiltertypechoice->value(pars->Ptype); - - filtertype->value(pars->Pcategory); - - cfreqdial->value(pars->Pfreq); - qdial->value(pars->Pq); - - freqtrdial->value(pars->Pfreqtrack); - gaindial->value(pars->Pgain); - - stcounter->value(pars->Pstages); - - int categ=pars->Pcategory; - if ((categ==0)||(categ==2)) { - if (categ==0) { - analogfiltertypechoice->show(); - svfiltertypechoice->hide(); - } else { - svfiltertypechoice->show(); - analogfiltertypechoice->hide(); - }; - editbutton->hide(); - formantparswindow->hide(); - cfreqdial->label("C.freq"); - } else { - analogfiltertypechoice->hide(); - svfiltertypechoice->hide(); - editbutton->show(); - cfreqdial->label("BS.pos"); - }; - - filterparamswindow->redraw(); -} - -void FilterUI::init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_) { - pars=filterpars_; - velsnsamp=velsnsamp_; - velsns=velsns_; - - make_window(); - end(); - make_formant_window(); - - - filterui->resize(this->x(),this->y(),this->w(),this->h()); - - - if (velsnsamp==NULL){ - vsnsadial->deactivate(); - vsnsadial->value(127); - } else vsnsadial->value(*velsnsamp); - - if (velsns==NULL){ - vsnsdial->deactivate(); - vsnsdial->value(127); - } else vsnsdial->value(*velsns); - - switchcategory(pars->Pcategory); - - - formantparswindow->label(this->label()); - - update_formant_window(); -} - -void FilterUI::switchcategory(int newcat) { - if (pars->Pcategory!=newcat){ - pars->Pgain=64; - gaindial->value(64); - analogfiltertypechoice->value(0); - analogfiltertypechoice->do_callback(); - svfiltertypechoice->value(0); - svfiltertypechoice->do_callback(); - }; - pars->Pcategory=newcat; - - refresh(); -} - -void FilterUI::use_for_dynamic_filter() { - freqtrdial->deactivate(); - gaindial->when(0); - - cfknob->when(FL_WHEN_RELEASE); - octknob->when(FL_WHEN_RELEASE); - - frsldial->when(0); - wvknob->when(0); - formant_freq_dial->when(0); - formant_q_dial->when(0); - formant_amp_dial->when(0); - strchdial->when(0); -} diff --git a/plugins/zynaddsubfx/src/UI/FilterUI.fl b/plugins/zynaddsubfx/src/UI/FilterUI.fl deleted file mode 100644 index 298d1403d..000000000 --- a/plugins/zynaddsubfx/src/UI/FilterUI.fl +++ /dev/null @@ -1,624 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0106 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/FilterParams.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class FormantFilterGraph {: {public Fl_Box} -} { - Function {FormantFilterGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {pars=NULL; -nvowel=NULL; -nformant=NULL; -graphpoints=NULL;} {} - } - Function {init(FilterParams *pars_,int *nvowel_,int *nformant_)} {} { - code {pars=pars_; -nvowel=nvowel_; -nformant=nformant_; -oldx=-1; -graphpoints=new REALTYPE [w()];} {} - } - Function {draw_freq_line(REALTYPE freq,int type)} {} { - code {REALTYPE freqx=pars->getfreqpos(freq); -switch(type){ - case 0:fl_line_style(FL_SOLID);break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; -}; - - -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h());} {} - } - Function {draw()} {open - } { - code {int maxdB=30; -int ox=x(),oy=y(),lx=w(),ly=h(),i,oiy; -REALTYPE freqx; - -fl_color(FL_BLACK); -fl_rectf(ox,oy,lx,ly); - - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -//fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -freqx=pars->getfreqpos(1000.0); -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - -for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; -}; - -draw_freq_line(10000.0,0); -draw_freq_line(20000.0,1); - -fl_line_style(FL_DOT); -int GY=10;if (lyPnumformants){ - draw_freq_line(pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq),2); - -//show some information (like current formant frequency,amplitude) - char tmpstr[20]; - - snprintf(tmpstr,20,"%.2f kHz",pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq)*0.001); - fl_draw(tmpstr,ox+1,oy+1,40,12,FL_ALIGN_LEFT,NULL,0); - - snprintf(tmpstr,20,"%d dB",(int)( rap2dB(1e-9 + pars->getformantamp(pars->Pvowels[*nvowel].formants[*nformant].amp)) + pars->getgain() )); - fl_draw(tmpstr,ox+1,oy+15,40,12,FL_ALIGN_LEFT,NULL,0); - -}; - -//draw the data - -fl_color(FL_RED); -fl_line_style(FL_SOLID); - -pars->formantfilterH(*nvowel,lx,graphpoints); - -oiy=(int) ((graphpoints[0]/maxdB+1.0)*ly/2.0); -for (i=1;i=0)&&(oiy>=0)&&(iyhide(); -formantparswindow->hide(); -hide(); -//delete (filterui); -delete (formantparswindow);} {} - } - Function {make_window()} {} { - Fl_Window filterui { - xywh {211 312 275 75} type Double color 50 labelfont 1 hide - class Fl_Group - } { - Fl_Group filterparamswindow { - label {Filter Parameters} - xywh {0 0 275 75} box PLASTIC_UP_BOX color 183 labeltype ENGRAVED_LABEL labelsize 10 align 17 - } { - Fl_Choice analogfiltertypechoice { - label FilterType - callback {pars->Ptype=(int)o->value(); -pars->changed=true;} - tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code1 {o->value(pars->Ptype);} - } { - menuitem {} { - label LPF1 - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label HPF1 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label LPF2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label HPF2 - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label BPF2 - xywh {82 82 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label NF2 - xywh {94 94 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label PkF2 - xywh {104 104 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label LSh2 - xywh {114 114 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label HSh2 - xywh {124 124 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice svfiltertypechoice { - label FilterType - callback {pars->Ptype=(int)o->value(); -pars->changed=true;} - tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code1 {o->value(pars->Ptype);} - } { - menuitem {} { - label 1LPF - xywh {134 134 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label 1HPF - xywh {144 144 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label 1BPF - xywh {154 154 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label 1NF - xywh {164 164 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice filtertype { - label Category - callback {switchcategory((int)o->value()); -pars->changed=true;} - tooltip {The Category of the Filter (Analog/Formantic/etc.)} xywh {10 20 60 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Pcategory);} - } { - menuitem {} { - label Analog - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Formant - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label StVarF - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial cfreqdial { - label {C.Freq} - callback {pars->Pfreq=(int)o->value();} - tooltip {Center Frequency of the Filter or the base position in the vowel's sequence} xywh {75 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pfreq);} - class WidgetPDial - } - Fl_Dial qdial { - label Q - callback {pars->Pq=(int)o->value(); -formantfiltergraph->redraw();} - tooltip {Filter resonance or bandwidth} xywh {110 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pq);} - class WidgetPDial - } - Fl_Dial freqtrdial { - label {freq.tr.} - callback {pars->Pfreqtrack=(int) o->value();} - tooltip {Filter frequency tracking (left is negative, middle is 0, and right is positive)} xywh {215 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pfreqtrack);} - class WidgetPDial - } - Fl_Dial vsnsadial { - label {V.SnsA.} - callback {if (velsnsamp!=NULL) *velsnsamp=(int)o->value();} - tooltip {Velocity sensing amount of the Filter} xywh {145 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial vsnsdial { - label {V.Sns.} - callback {if (velsns!=NULL) *velsns=(int)o->value();} - tooltip {Velocity Sensing Function of the Filter} xywh {180 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial gaindial { - label gain - callback {pars->Pgain=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Filter output gain/damp} xywh {250 35 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pgain);} - class WidgetPDial - } - Fl_Choice stcounter { - label St - callback {pars->Pstages=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} open - tooltip {Filter stages (in order to increase dB/oct. value and the order of the filter)} xywh {235 5 35 15} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 - code1 {for (int i=0;iadd(tmp);};} - code2 {o->value(pars->Pstages);} - } {} - } - Fl_Button editbutton { - label Edit - callback {formantparswindow->show();} - xywh {15 40 50 25} box PLASTIC_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - } - Function {make_formant_window()} {} { - Fl_Window formantparswindow { - label {Formant Filter Parameters} - xywh {47 301 700 205} type Double hide - } { - Fl_Group {} { - xywh {485 47 105 113} box THIN_UP_BOX - } { - Fl_Counter {} { - label {Formant } - callback {nformant=(int) o->value(); -update_formant_window(); -formantfiltergraph->redraw();} - xywh {545 80 40 15} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->bounds(0,FF_MAX_FORMANTS-1);} - code1 {o->value(nformant);} - } - Fl_Counter {} { - label {Vowel no.} - callback {nvowel=(int) o->value(); -update_formant_window(); -formantfiltergraph->redraw();} - xywh {545 55 40 20} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,FF_MAX_VOWELS-1);} - code1 {o->value(nvowel);} - } - Fl_Group formantparsgroup { - xywh {490 105 95 50} box ENGRAVED_FRAME - } { - Fl_Dial formant_freq_dial { - label freq - callback {pars->Pvowels[nvowel].formants[nformant].freq=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Formant frequency} xywh {495 115 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial formant_q_dial { - label Q - callback {pars->Pvowels[nvowel].formants[nformant].q=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Formant's Q} xywh {525 115 24 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial formant_amp_dial { - label amp - callback {pars->Pvowels[nvowel].formants[nformant].amp=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Formant amplitude} xywh {555 115 24 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - } - } - Fl_Group {} { - xywh {590 47 100 113} box THIN_UP_BOX - } { - Fl_Counter {} { - label {Seq.Size} - callback {pars->Psequencesize=(int) o->value(); -update_formant_window(); -pars->changed=true;} - xywh {595 62 55 20} type Simple labelfont 1 labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(1,FF_MAX_SEQUENCE-1);} - code1 {o->value(pars->Psequencesize);} - } - Fl_Counter {} { - label {S.Pos.} - callback {nseqpos=(int) o->value(); -update_formant_window(); -pars->changed=true;} - tooltip {Current position from the sequence} xywh {595 97 40 15} type Simple labelfont 1 labelsize 10 align 9 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->bounds(0,FF_MAX_SEQUENCE-2);} - code1 {o->value(nseqpos);} - } - Fl_Counter vowel_counter { - label Vowel - callback {pars->Psequence[nseqpos].nvowel=(int) o->value(); -pars->changed=true;} - xywh {640 97 40 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->bounds(0,FF_MAX_VOWELS-1);} - } - Fl_Check_Button {} { - label {Neg.Input} - callback {pars->Psequencereversed=(int) o->value(); -pars->changed=true;} - tooltip {Negate the input from LFO/envelopes/etc.} xywh {625 132 60 20} down_box DOWN_BOX labelsize 10 - code0 {o->value(pars->Psequencereversed);} - } - Fl_Dial strchdial { - label Strch - callback {pars->Psequencestretch=(int) o->value(); -pars->changed=true;} - tooltip {Sequence Stretch} xywh {595 130 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Psequencestretch);} - class WidgetPDial - } - } - Fl_Counter {} { - label {Num.Formants} - callback {pars->Pnumformants=(int) o->value(); -update_formant_window(); -pars->changed=true; -formantfiltergraph->redraw();} - xywh {485 15 65 20} type Simple labelfont 1 labelsize 10 align 5 minimum 0 maximum 127 step 1 - code0 {o->bounds(1,FF_MAX_FORMANTS);} - code1 {o->value(pars->Pnumformants);} - } - Fl_Dial frsldial { - label {Fr.Sl.} - callback {pars->Pformantslowness=(int) o->value(); -pars->changed=true;} - tooltip {Formant's Slowness (Morphing)} xywh {565 15 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Pformantslowness);} - class WidgetPDial - } - Fl_Value_Output centerfreqvo { - label {C.f.} - callback {o->value(pars->getcenterfreq()/1000.0);} - tooltip {Center Frequency (kHz)} xywh {515 164 33 18} when 3 minimum 1 maximum 10 step 0.01 value 1 textfont 1 - code0 {o->value(pars->getcenterfreq()/1000.0);} - } - Fl_Value_Output octavesfreqvo { - label {Oct.} - callback {o->value(pars->getoctavesfreq());} - tooltip {No. of octaves} xywh {515 182 33 18} when 3 minimum 1 maximum 127 step 1 value 5 textfont 1 - code0 {o->value(pars->getoctavesfreq());} - } - Fl_Slider cfknob { - callback {pars->Pcenterfreq=(int)o->value(); -centerfreqvo->do_callback(); -formantfiltergraph->redraw(); -pars->changed=true;} - xywh {551 167 84 15} type {Horz Knob} box FLAT_BOX maximum 127 - code0 {o->value(pars->Pcenterfreq);} - } - Fl_Slider octknob { - callback {pars->Poctavesfreq=(int)o->value(); -octavesfreqvo->do_callback(); -formantfiltergraph->redraw();} - xywh {551 185 84 15} type {Horz Knob} box FLAT_BOX maximum 127 - code0 {o->value(pars->Poctavesfreq);} - } - Fl_Box formantfiltergraph { - xywh {5 5 475 195} box BORDER_BOX - code0 {o->init(pars,&nvowel,&nformant);} - class FormantFilterGraph - } - Fl_Dial wvknob { - label {Vw.Cl.} - callback {pars->Pvowelclearness=(int) o->value(); -pars->changed=true;} - tooltip {Vowel "clearness" (how the mixed vowels are avoided)} xywh {600 15 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Pvowelclearness);} - class WidgetPDial - } - Fl_Button {} { - label Close - callback {formantparswindow->hide();} - xywh {645 180 50 25} box THIN_UP_BOX - } - Fl_Button {} { - label C - callback {presetsui->copy(pars,nvowel);} - xywh {635 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this,nvowel);} - xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Box {} { - label Vowel - xywh {635 10 55 15} - } - } - } - Function {update_formant_window()} {} { - code {formant_freq_dial->value(pars->Pvowels[nvowel].formants[nformant].freq); -formant_q_dial->value(pars->Pvowels[nvowel].formants[nformant].q); -formant_amp_dial->value(pars->Pvowels[nvowel].formants[nformant].amp); -if (nformantPnumformants) formantparsgroup->activate(); - else formantparsgroup->deactivate(); - -if (nseqposPsequencesize) vowel_counter->activate(); - else vowel_counter->deactivate(); - - -vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {} - } - Function {refresh()} {} { - code {update_formant_window(); -formantfiltergraph->redraw(); - -if (pars->Pcategory==0) svfiltertypechoice->value(pars->Ptype); -if (pars->Pcategory==2) analogfiltertypechoice->value(pars->Ptype); - -filtertype->value(pars->Pcategory); - -cfreqdial->value(pars->Pfreq); -qdial->value(pars->Pq); - -freqtrdial->value(pars->Pfreqtrack); -gaindial->value(pars->Pgain); - -stcounter->value(pars->Pstages); - -int categ=pars->Pcategory; -if ((categ==0)||(categ==2)) { - if (categ==0) { - analogfiltertypechoice->show(); - svfiltertypechoice->hide(); - } else { - svfiltertypechoice->show(); - analogfiltertypechoice->hide(); - }; - editbutton->hide(); - formantparswindow->hide(); - cfreqdial->label("C.freq"); -} else { - analogfiltertypechoice->hide(); - svfiltertypechoice->hide(); - editbutton->show(); - cfreqdial->label("BS.pos"); -}; - -filterparamswindow->redraw();} {selected - } - } - Function {init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_)} {} { - code {pars=filterpars_; -velsnsamp=velsnsamp_; -velsns=velsns_; - -make_window(); -end(); -make_formant_window(); - - -filterui->resize(this->x(),this->y(),this->w(),this->h()); - - -if (velsnsamp==NULL){ - vsnsadial->deactivate(); - vsnsadial->value(127); - } else vsnsadial->value(*velsnsamp); - -if (velsns==NULL){ - vsnsdial->deactivate(); - vsnsdial->value(127); - } else vsnsdial->value(*velsns); - -switchcategory(pars->Pcategory); - - -formantparswindow->label(this->label()); - -update_formant_window();} {} - } - Function {switchcategory(int newcat)} {} { - code {if (pars->Pcategory!=newcat){ - pars->Pgain=64; - gaindial->value(64); - analogfiltertypechoice->value(0); - analogfiltertypechoice->do_callback(); - svfiltertypechoice->value(0); - svfiltertypechoice->do_callback(); -}; -pars->Pcategory=newcat; - -refresh();} {} - } - Function {use_for_dynamic_filter()} {} { - code {freqtrdial->deactivate(); -gaindial->when(0); - -cfknob->when(FL_WHEN_RELEASE); -octknob->when(FL_WHEN_RELEASE); - -frsldial->when(0); -wvknob->when(0); -formant_freq_dial->when(0); -formant_q_dial->when(0); -formant_amp_dial->when(0); -strchdial->when(0);} {} - } - decl {FilterParams *pars;} {} - decl {unsigned char *velsnsamp,*velsns;} {} - decl {int nvowel,nformant,nseqpos;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/FilterUI.h b/plugins/zynaddsubfx/src/UI/FilterUI.h deleted file mode 100644 index 60f292b18..000000000 --- a/plugins/zynaddsubfx/src/UI/FilterUI.h +++ /dev/null @@ -1,198 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef FilterUI_h -#define FilterUI_h -#include -#include "WidgetPDial.h" -#include -#include -#include "../globals.h" -#include -#include "../Params/FilterParams.h" -#include -#include -#include -#include "PresetsUI.h" - -class FormantFilterGraph : public Fl_Box { -public: - FormantFilterGraph(int x,int y, int w, int h, const char *label=0); - void init(FilterParams *pars_,int *nvowel_,int *nformant_); - void draw_freq_line(REALTYPE freq,int type); - void draw(); - ~FormantFilterGraph(); -private: - FilterParams *pars; - int oldx; - int *nvowel,*nformant; - REALTYPE *graphpoints; -}; -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class FilterUI : public Fl_Group,PresetsUI_ { -public: - FilterUI(int x,int y, int w, int h, const char *label=0); - ~FilterUI(); - Fl_Group* make_window(); - Fl_Group *filterui; - Fl_Group *filterparamswindow; - Fl_Choice *analogfiltertypechoice; -private: - void cb_analogfiltertypechoice_i(Fl_Choice*, void*); - static void cb_analogfiltertypechoice(Fl_Choice*, void*); - static Fl_Menu_Item menu_analogfiltertypechoice[]; -public: - Fl_Choice *svfiltertypechoice; -private: - void cb_svfiltertypechoice_i(Fl_Choice*, void*); - static void cb_svfiltertypechoice(Fl_Choice*, void*); - static Fl_Menu_Item menu_svfiltertypechoice[]; -public: - Fl_Choice *filtertype; -private: - void cb_filtertype_i(Fl_Choice*, void*); - static void cb_filtertype(Fl_Choice*, void*); - static Fl_Menu_Item menu_filtertype[]; -public: - WidgetPDial *cfreqdial; -private: - void cb_cfreqdial_i(WidgetPDial*, void*); - static void cb_cfreqdial(WidgetPDial*, void*); -public: - WidgetPDial *qdial; -private: - void cb_qdial_i(WidgetPDial*, void*); - static void cb_qdial(WidgetPDial*, void*); -public: - WidgetPDial *freqtrdial; -private: - void cb_freqtrdial_i(WidgetPDial*, void*); - static void cb_freqtrdial(WidgetPDial*, void*); -public: - WidgetPDial *vsnsadial; -private: - void cb_vsnsadial_i(WidgetPDial*, void*); - static void cb_vsnsadial(WidgetPDial*, void*); -public: - WidgetPDial *vsnsdial; -private: - void cb_vsnsdial_i(WidgetPDial*, void*); - static void cb_vsnsdial(WidgetPDial*, void*); -public: - WidgetPDial *gaindial; -private: - void cb_gaindial_i(WidgetPDial*, void*); - static void cb_gaindial(WidgetPDial*, void*); -public: - Fl_Choice *stcounter; -private: - void cb_stcounter_i(Fl_Choice*, void*); - static void cb_stcounter(Fl_Choice*, void*); -public: - Fl_Button *editbutton; -private: - void cb_editbutton_i(Fl_Button*, void*); - static void cb_editbutton(Fl_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Double_Window* make_formant_window(); - Fl_Double_Window *formantparswindow; -private: - void cb_Formant_i(Fl_Counter*, void*); - static void cb_Formant(Fl_Counter*, void*); - void cb_Vowel_i(Fl_Counter*, void*); - static void cb_Vowel(Fl_Counter*, void*); -public: - Fl_Group *formantparsgroup; - WidgetPDial *formant_freq_dial; -private: - void cb_formant_freq_dial_i(WidgetPDial*, void*); - static void cb_formant_freq_dial(WidgetPDial*, void*); -public: - WidgetPDial *formant_q_dial; -private: - void cb_formant_q_dial_i(WidgetPDial*, void*); - static void cb_formant_q_dial(WidgetPDial*, void*); -public: - WidgetPDial *formant_amp_dial; -private: - void cb_formant_amp_dial_i(WidgetPDial*, void*); - static void cb_formant_amp_dial(WidgetPDial*, void*); - void cb_Seq_i(Fl_Counter*, void*); - static void cb_Seq(Fl_Counter*, void*); - void cb_S_i(Fl_Counter*, void*); - static void cb_S(Fl_Counter*, void*); -public: - Fl_Counter *vowel_counter; -private: - void cb_vowel_counter_i(Fl_Counter*, void*); - static void cb_vowel_counter(Fl_Counter*, void*); - void cb_Neg_i(Fl_Check_Button*, void*); - static void cb_Neg(Fl_Check_Button*, void*); -public: - WidgetPDial *strchdial; -private: - void cb_strchdial_i(WidgetPDial*, void*); - static void cb_strchdial(WidgetPDial*, void*); - void cb_Num_i(Fl_Counter*, void*); - static void cb_Num(Fl_Counter*, void*); -public: - WidgetPDial *frsldial; -private: - void cb_frsldial_i(WidgetPDial*, void*); - static void cb_frsldial(WidgetPDial*, void*); -public: - Fl_Value_Output *centerfreqvo; -private: - void cb_centerfreqvo_i(Fl_Value_Output*, void*); - static void cb_centerfreqvo(Fl_Value_Output*, void*); -public: - Fl_Value_Output *octavesfreqvo; -private: - void cb_octavesfreqvo_i(Fl_Value_Output*, void*); - static void cb_octavesfreqvo(Fl_Value_Output*, void*); -public: - Fl_Slider *cfknob; -private: - void cb_cfknob_i(Fl_Slider*, void*); - static void cb_cfknob(Fl_Slider*, void*); -public: - Fl_Slider *octknob; -private: - void cb_octknob_i(Fl_Slider*, void*); - static void cb_octknob(Fl_Slider*, void*); -public: - FormantFilterGraph *formantfiltergraph; - WidgetPDial *wvknob; -private: - void cb_wvknob_i(WidgetPDial*, void*); - static void cb_wvknob(WidgetPDial*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_C1_i(Fl_Button*, void*); - static void cb_C1(Fl_Button*, void*); - void cb_P1_i(Fl_Button*, void*); - static void cb_P1(Fl_Button*, void*); -public: - void update_formant_window(); - void refresh(); - void init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_); - void switchcategory(int newcat); - void use_for_dynamic_filter(); -private: - FilterParams *pars; - unsigned char *velsnsamp,*velsns; - int nvowel,nformant,nseqpos; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/LFOUI.cc b/plugins/zynaddsubfx/src/UI/LFOUI.cc deleted file mode 100644 index 120600891..000000000 --- a/plugins/zynaddsubfx/src/UI/LFOUI.cc +++ /dev/null @@ -1,289 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "LFOUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void LFOUI::cb_freq_i(WidgetPDial* o, void*) { - pars->Pfreq=o->value(); -} -void LFOUI::cb_freq(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_freq_i(o,v); -} - -void LFOUI::cb_intensity_i(WidgetPDial* o, void*) { - pars->Pintensity=(int)o->value(); -} -void LFOUI::cb_intensity(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_intensity_i(o,v); -} - -void LFOUI::cb_delay_i(WidgetPDial* o, void*) { - pars->Pdelay=(int)o->value(); -} -void LFOUI::cb_delay(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_delay_i(o,v); -} - -void LFOUI::cb_startphase_i(WidgetPDial* o, void*) { - pars->Pstartphase=(int)o->value(); -} -void LFOUI::cb_startphase(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_startphase_i(o,v); -} - -void LFOUI::cb_randomness_i(WidgetPDial* o, void*) { - pars->Prandomness=(int)o->value(); -} -void LFOUI::cb_randomness(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_randomness_i(o,v); -} - -void LFOUI::cb_LFOtype_i(Fl_Choice* o, void*) { - pars->PLFOtype=(int)o->value(); -} -void LFOUI::cb_LFOtype(Fl_Choice* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_LFOtype_i(o,v); -} - -Fl_Menu_Item LFOUI::menu_LFOtype[] = { - {"SINE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"SQR", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"R.up", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"R.dn", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"E1dn", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"E2dn", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void LFOUI::cb_continous_i(Fl_Check_Button* o, void*) { - pars->Pcontinous=(int)o->value(); -} -void LFOUI::cb_continous(Fl_Check_Button* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_continous_i(o,v); -} - -void LFOUI::cb_freqrand_i(WidgetPDial* o, void*) { - pars->Pfreqrand=(int)o->value(); -} -void LFOUI::cb_freqrand(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_freqrand_i(o,v); -} - -void LFOUI::cb_stretch_i(WidgetPDial* o, void*) { - pars->Pstretch=(int)o->value(); -} -void LFOUI::cb_stretch(WidgetPDial* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_stretch_i(o,v); -} - -void LFOUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(pars); -} -void LFOUI::cb_C(Fl_Button* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_C_i(o,v); -} - -void LFOUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(pars,this); -} -void LFOUI::cb_P(Fl_Button* o, void* v) { - ((LFOUI*)(o->parent()->parent()->user_data()))->cb_P_i(o,v); -} - -LFOUI::LFOUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - pars=NULL; -} - -LFOUI::~LFOUI() { - lfoui->hide(); - hide(); - //delete (lfoui); -} - -Fl_Group* LFOUI::make_window() { - { lfoui = new Fl_Group(0, 0, 230, 70); - lfoui->box(FL_FLAT_BOX); - lfoui->color(FL_LIGHT1); - lfoui->selection_color(FL_BACKGROUND_COLOR); - lfoui->labeltype(FL_NO_LABEL); - lfoui->labelfont(1); - lfoui->labelsize(14); - lfoui->labelcolor(FL_FOREGROUND_COLOR); - lfoui->user_data((void*)(this)); - lfoui->align(Fl_Align(FL_ALIGN_TOP)); - lfoui->when(FL_WHEN_RELEASE); - { lfoparamswindow = new Fl_Group(0, 0, 230, 70, "LFO"); - lfoparamswindow->box(FL_PLASTIC_UP_BOX); - lfoparamswindow->color(FL_CYAN); - lfoparamswindow->labeltype(FL_ENGRAVED_LABEL); - lfoparamswindow->labelsize(10); - lfoparamswindow->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { freq = new WidgetPDial(5, 20, 30, 30, "Freq."); - freq->tooltip("LFO Frequency"); - freq->box(FL_ROUND_UP_BOX); - freq->color(FL_BACKGROUND_COLOR); - freq->selection_color(FL_INACTIVE_COLOR); - freq->labeltype(FL_NORMAL_LABEL); - freq->labelfont(0); - freq->labelsize(10); - freq->labelcolor(FL_FOREGROUND_COLOR); - freq->step(1e-05); - freq->callback((Fl_Callback*)cb_freq); - freq->align(Fl_Align(FL_ALIGN_BOTTOM)); - freq->when(FL_WHEN_CHANGED); - } // WidgetPDial* freq - { intensity = new WidgetPDial(40, 20, 30, 30, "Depth"); - intensity->tooltip("LFO Amount"); - intensity->box(FL_ROUND_UP_BOX); - intensity->color(FL_BACKGROUND_COLOR); - intensity->selection_color(FL_INACTIVE_COLOR); - intensity->labeltype(FL_NORMAL_LABEL); - intensity->labelfont(0); - intensity->labelsize(10); - intensity->labelcolor(FL_FOREGROUND_COLOR); - intensity->maximum(127); - intensity->step(1); - intensity->callback((Fl_Callback*)cb_intensity); - intensity->align(Fl_Align(FL_ALIGN_BOTTOM)); - intensity->when(FL_WHEN_CHANGED); - } // WidgetPDial* intensity - { delay = new WidgetPDial(110, 20, 30, 30, "Delay"); - delay->tooltip("LFO delay"); - delay->box(FL_ROUND_UP_BOX); - delay->color(FL_BACKGROUND_COLOR); - delay->selection_color(FL_INACTIVE_COLOR); - delay->labeltype(FL_NORMAL_LABEL); - delay->labelfont(0); - delay->labelsize(10); - delay->labelcolor(FL_FOREGROUND_COLOR); - delay->maximum(127); - delay->step(1); - delay->callback((Fl_Callback*)cb_delay); - delay->align(Fl_Align(FL_ALIGN_BOTTOM)); - delay->when(FL_WHEN_CHANGED); - } // WidgetPDial* delay - { startphase = new WidgetPDial(75, 20, 30, 30, "Start"); - startphase->tooltip("LFO Startphase (leftmost is Random)"); - startphase->box(FL_ROUND_UP_BOX); - startphase->color(FL_BACKGROUND_COLOR); - startphase->selection_color(FL_INACTIVE_COLOR); - startphase->labeltype(FL_NORMAL_LABEL); - startphase->labelfont(0); - startphase->labelsize(10); - startphase->labelcolor(FL_FOREGROUND_COLOR); - startphase->maximum(127); - startphase->step(1); - startphase->callback((Fl_Callback*)cb_startphase); - startphase->align(Fl_Align(FL_ALIGN_BOTTOM)); - startphase->when(FL_WHEN_CHANGED); - } // WidgetPDial* startphase - { randomness = new WidgetPDial(180, 7, 20, 20, "A.R."); - randomness->tooltip("LFO Amplitude Randomness"); - randomness->box(FL_ROUND_UP_BOX); - randomness->color(FL_BACKGROUND_COLOR); - randomness->selection_color(FL_INACTIVE_COLOR); - randomness->labeltype(FL_NORMAL_LABEL); - randomness->labelfont(0); - randomness->labelsize(10); - randomness->labelcolor(FL_FOREGROUND_COLOR); - randomness->maximum(127); - randomness->step(1); - randomness->callback((Fl_Callback*)cb_randomness); - randomness->align(Fl_Align(FL_ALIGN_BOTTOM)); - randomness->when(FL_WHEN_CHANGED); - } // WidgetPDial* randomness - { LFOtype = new Fl_Choice(180, 40, 45, 15, "Type"); - LFOtype->tooltip("LFO function"); - LFOtype->down_box(FL_BORDER_BOX); - LFOtype->labelsize(10); - LFOtype->textsize(8); - LFOtype->callback((Fl_Callback*)cb_LFOtype); - LFOtype->align(Fl_Align(FL_ALIGN_BOTTOM)); - LFOtype->menu(menu_LFOtype); - } // Fl_Choice* LFOtype - { continous = new Fl_Check_Button(165, 35, 15, 15, "C."); - continous->tooltip("Continous LFO"); - continous->down_box(FL_DOWN_BOX); - continous->labelsize(10); - continous->callback((Fl_Callback*)cb_continous); - continous->align(Fl_Align(FL_ALIGN_BOTTOM)); - } // Fl_Check_Button* continous - { freqrand = new WidgetPDial(205, 7, 20, 20, "F.R."); - freqrand->tooltip("LFO Frequency Randomness"); - freqrand->box(FL_ROUND_UP_BOX); - freqrand->color(FL_BACKGROUND_COLOR); - freqrand->selection_color(FL_INACTIVE_COLOR); - freqrand->labeltype(FL_NORMAL_LABEL); - freqrand->labelfont(0); - freqrand->labelsize(10); - freqrand->labelcolor(FL_FOREGROUND_COLOR); - freqrand->maximum(127); - freqrand->step(1); - freqrand->callback((Fl_Callback*)cb_freqrand); - freqrand->align(Fl_Align(FL_ALIGN_BOTTOM)); - freqrand->when(FL_WHEN_CHANGED); - } // WidgetPDial* freqrand - { stretch = new WidgetPDial(144, 30, 20, 20, "Str."); - stretch->tooltip("LFO stretch"); - stretch->box(FL_ROUND_UP_BOX); - stretch->color(FL_BACKGROUND_COLOR); - stretch->selection_color(FL_INACTIVE_COLOR); - stretch->labeltype(FL_NORMAL_LABEL); - stretch->labelfont(0); - stretch->labelsize(10); - stretch->labelcolor(FL_FOREGROUND_COLOR); - stretch->maximum(127); - stretch->step(1); - stretch->callback((Fl_Callback*)cb_stretch); - stretch->align(Fl_Align(FL_ALIGN_BOTTOM)); - stretch->when(FL_WHEN_CHANGED); - } // WidgetPDial* stretch - { Fl_Button* o = new Fl_Button(145, 10, 15, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(162, 10, 15, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - lfoparamswindow->end(); - } // Fl_Group* lfoparamswindow - lfoui->end(); - } // Fl_Group* lfoui - return lfoui; -} - -void LFOUI::refresh() { - freq->value(pars->Pfreq); - intensity->value(pars->Pintensity); - startphase->value(pars->Pstartphase); - delay->value(pars->Pdelay); - continous->value(pars->Pcontinous); - stretch->value(pars->Pstretch); - randomness->value(pars->Prandomness); - freqrand->value(pars->Pfreqrand); - LFOtype->value(pars->PLFOtype); -} - -void LFOUI::init(LFOParams *lfopars_) { - pars=lfopars_; - - make_window(); - end(); - - refresh(); - - lfoui->resize(this->x(),this->y(),this->w(),this->h()); - - lfoparamswindow->label(this->label()); -} diff --git a/plugins/zynaddsubfx/src/UI/LFOUI.fl b/plugins/zynaddsubfx/src/UI/LFOUI.fl deleted file mode 100644 index ca0433a2d..000000000 --- a/plugins/zynaddsubfx/src/UI/LFOUI.fl +++ /dev/null @@ -1,176 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0105 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/LFOParams.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class LFOUI {: {public Fl_Group, PresetsUI_} -} { - Function {LFOUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {pars=NULL;} {} - } - Function {~LFOUI()} {} { - code {lfoui->hide(); -hide(); -//delete (lfoui);} {} - } - Function {make_window()} {} { - Fl_Window lfoui { - xywh {66 328 230 70} type Double color 50 labelfont 1 hide - class Fl_Group - } { - Fl_Group lfoparamswindow { - label LFO - xywh {0 0 230 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - } { - Fl_Dial freq { - label {Freq.} - callback {pars->Pfreq=o->value();} - tooltip {LFO Frequency} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 step 1e-05 - class WidgetPDial - } - Fl_Dial intensity { - label Depth - callback {pars->Pintensity=(int)o->value();} - tooltip {LFO Amount} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial delay { - label Delay - callback {pars->Pdelay=(int)o->value();} - tooltip {LFO delay} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial startphase { - label Start - callback {pars->Pstartphase=(int)o->value();} - tooltip {LFO Startphase (leftmost is Random)} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial randomness { - label {A.R.} - callback {pars->Prandomness=(int)o->value();} - tooltip {LFO Amplitude Randomness} xywh {180 7 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Choice LFOtype { - label Type - callback {pars->PLFOtype=(int)o->value();} - tooltip {LFO function} xywh {180 40 45 15} down_box BORDER_BOX labelsize 10 align 2 textsize 8 - } { - menuitem {} { - label SINE - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label TRI - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label SQR - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label {R.up} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label {R.dn} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label E1dn - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label E2dn - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - } - Fl_Check_Button continous { - label {C.} - callback {pars->Pcontinous=(int)o->value();} - tooltip {Continous LFO} xywh {165 35 15 15} down_box DOWN_BOX labelsize 10 align 2 - } - Fl_Dial freqrand { - label {F.R.} - callback {pars->Pfreqrand=(int)o->value();} - tooltip {LFO Frequency Randomness} xywh {205 7 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial stretch { - label {Str.} - callback {pars->Pstretch=(int)o->value();} - tooltip {LFO stretch} xywh {144 30 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} selected - xywh {145 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} selected - xywh {162 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 - } - } - } - } - Function {refresh()} {} { - code {freq->value(pars->Pfreq); -intensity->value(pars->Pintensity); -startphase->value(pars->Pstartphase); -delay->value(pars->Pdelay); -continous->value(pars->Pcontinous); -stretch->value(pars->Pstretch); -randomness->value(pars->Prandomness); -freqrand->value(pars->Pfreqrand); -LFOtype->value(pars->PLFOtype);} {} - } - Function {init(LFOParams *lfopars_)} {} { - code {pars=lfopars_; - -make_window(); -end(); - -refresh(); - -lfoui->resize(this->x(),this->y(),this->w(),this->h()); - -lfoparamswindow->label(this->label());} {} - } - decl {LFOParams *pars;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/LFOUI.h b/plugins/zynaddsubfx/src/UI/LFOUI.h deleted file mode 100644 index 6959fe3f3..000000000 --- a/plugins/zynaddsubfx/src/UI/LFOUI.h +++ /dev/null @@ -1,83 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef LFOUI_h -#define LFOUI_h -#include -#include "WidgetPDial.h" -#include -#include -#include "../globals.h" -#include -#include "../Params/LFOParams.h" -#include -#include -#include -#include "PresetsUI.h" -#include -#include -#include -#include - -class LFOUI : public Fl_Group, PresetsUI_ { -public: - LFOUI(int x,int y, int w, int h, const char *label=0); - ~LFOUI(); - Fl_Group* make_window(); - Fl_Group *lfoui; - Fl_Group *lfoparamswindow; - WidgetPDial *freq; -private: - void cb_freq_i(WidgetPDial*, void*); - static void cb_freq(WidgetPDial*, void*); -public: - WidgetPDial *intensity; -private: - void cb_intensity_i(WidgetPDial*, void*); - static void cb_intensity(WidgetPDial*, void*); -public: - WidgetPDial *delay; -private: - void cb_delay_i(WidgetPDial*, void*); - static void cb_delay(WidgetPDial*, void*); -public: - WidgetPDial *startphase; -private: - void cb_startphase_i(WidgetPDial*, void*); - static void cb_startphase(WidgetPDial*, void*); -public: - WidgetPDial *randomness; -private: - void cb_randomness_i(WidgetPDial*, void*); - static void cb_randomness(WidgetPDial*, void*); -public: - Fl_Choice *LFOtype; -private: - void cb_LFOtype_i(Fl_Choice*, void*); - static void cb_LFOtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_LFOtype[]; -public: - Fl_Check_Button *continous; -private: - void cb_continous_i(Fl_Check_Button*, void*); - static void cb_continous(Fl_Check_Button*, void*); -public: - WidgetPDial *freqrand; -private: - void cb_freqrand_i(WidgetPDial*, void*); - static void cb_freqrand(WidgetPDial*, void*); -public: - WidgetPDial *stretch; -private: - void cb_stretch_i(WidgetPDial*, void*); - static void cb_stretch(WidgetPDial*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - void refresh(); - void init(LFOParams *lfopars_); -private: - LFOParams *pars; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/MasterUI.cc b/plugins/zynaddsubfx/src/UI/MasterUI.cc deleted file mode 100644 index 966088460..000000000 --- a/plugins/zynaddsubfx/src/UI/MasterUI.cc +++ /dev/null @@ -1,2504 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "MasterUI.h" -//Copyright (c) 2002-2009 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -VUMeter::VUMeter(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - master=NULL; - npart=-1; -} - -void VUMeter::init(Master *master_,int part_) { - //the "part_" parameters sets the part (if it is >=0), else it sets the master - master=master_; - label(NULL); - npart=part_; - olddbl=0.0; - olddbr=0.0; - oldrmsdbl=0.0; - oldrmsdbr=0.0; -} - -void VUMeter::draw_master() { - #define MIN_DB (-48) - - int ox=x(); int oy=y(); int lx=w(); int ly=h(); - - pthread_mutex_lock(&master->mutex); - REALTYPE dbl=rap2dB(master->vuoutpeakl); - REALTYPE dbr=rap2dB(master->vuoutpeakr); - REALTYPE rmsdbl=rap2dB(master->vurmspeakl); - REALTYPE rmsdbr=rap2dB(master->vurmspeakr); - REALTYPE maxdbl=rap2dB(master->vumaxoutpeakl); - REALTYPE maxdbr=rap2dB(master->vumaxoutpeakr); - int clipped=master->vuclipped; - pthread_mutex_unlock(&master->mutex); - - dbl=(MIN_DB-dbl)/MIN_DB; - if (dbl<0.0) dbl=0.0; - else if (dbl>1.0)dbl=1.0; - - dbr=(MIN_DB-dbr)/MIN_DB; - if (dbr<0.0) dbr=0.0; - else if (dbr>1.0) dbr=1.0; - - dbl=dbl*0.4+olddbl*0.6; - dbr=dbr*0.4+olddbr*0.6; - - olddbl=dbl; - olddbr=dbr; - - #define VULENX (lx-35) - #define VULENY (ly/2-3) - - dbl*=VULENX;dbr*=VULENX; - - int idbl=(int) dbl; - int idbr=(int) dbr; - - //compute RMS - start - rmsdbl=(MIN_DB-rmsdbl)/MIN_DB; - if (rmsdbl<0.0) rmsdbl=0.0; - else if (rmsdbl>1.0) rmsdbl=1.0; - - rmsdbr=(MIN_DB-rmsdbr)/MIN_DB; - if (rmsdbr<0.0) rmsdbr=0.0; - else if (rmsdbr>1.0) rmsdbr=1.0; - - rmsdbl=rmsdbl*0.4+oldrmsdbl*0.6; - rmsdbr=rmsdbr*0.4+oldrmsdbr*0.6; - - oldrmsdbl=rmsdbl; - oldrmsdbr=rmsdbr; - - - rmsdbl*=VULENX;rmsdbr*=VULENX; - - int irmsdbl=(int) rmsdbl; - int irmsdbr=(int) rmsdbr; - //compute RMS - end - - - - //draw the vu-meter lines - //db - fl_rectf(ox,oy,idbr,VULENY,0,200,255); - fl_rectf(ox,oy+ly/2,idbl,VULENY,0,200,255); - //black - fl_rectf(ox+idbr,oy,VULENX-idbr,VULENY,0,0,0); - fl_rectf(ox+idbl,oy+ly/2,VULENX-idbl,VULENY,0,0,0); - - //draw the scales - REALTYPE tmp=VULENX*1.0/MIN_DB; - for (int i=1;i<1-MIN_DB;i++){ - int tx=VULENX+(int) (tmp*i); - fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,160,200); - if (i%5==0) fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,230,240); - if (i%10==0) fl_rectf(ox+tx-1,oy,2,VULENY+ly/2,0,225,255); - }; - - //rms - if (irmsdbr>2) fl_rectf(ox+irmsdbr-1,oy,3,VULENY,255,255,0); - if (irmsdbl>2) fl_rectf(ox+irmsdbl-1,oy+ly/2,3,VULENY,255,255,0); - - - //draw the red box if clipping has occured - if (clipped==0) fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,0,0,10); - else fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,250,10,10); - - //draw the maxdB - fl_font(FL_HELVETICA|FL_BOLD,10); - fl_color(255,255,255); - char tmpstr[10]; - if ((maxdbl>MIN_DB-20)){ - snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbr); - fl_draw(tmpstr,ox+VULENX+1,oy+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0); - }; - if ((maxdbr>MIN_DB-20)){ - snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbl); - fl_draw(tmpstr,ox+VULENX+1,oy+ly/2+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0); - }; -} - -void VUMeter::draw_part() { - #define MIN_DB (-48) - int ox=x(); int oy=y(); int lx=w(); int ly=h(); - - if (!active_r()){ - pthread_mutex_lock(&master->mutex); - int fakedb=master->fakepeakpart[npart]; - pthread_mutex_unlock(&master->mutex); - fl_rectf(ox,oy,lx,ly,140,140,140); - if (fakedb>0){ - fakedb=(int)(fakedb/255.0*ly)+4; - fl_rectf(ox+2,oy+ly-fakedb,lx-4,fakedb,0,0,0); - }; - - return; - }; - - //draw the vu lines - pthread_mutex_lock(&master->mutex); - REALTYPE db=rap2dB(master->vuoutpeakpart[npart]); - pthread_mutex_unlock(&master->mutex); - - db=(MIN_DB-db)/MIN_DB; - if (db<0.0) db=0.0; - else if (db>1.0) db=1.0; - - db*=ly-2; - - int idb=(int) db; - - fl_rectf(ox,oy+ly-idb,lx,idb,0,200,255); - fl_rectf(ox,oy,lx,ly-idb,0,0,0); - - - //draw the scales - REALTYPE tmp=ly*1.0/MIN_DB; - for (int i=1;i<1-MIN_DB;i++){ - int ty=ly+(int) (tmp*i); - if (i%5==0) fl_rectf(ox,oy+ly-ty,lx,1,0,160,200); - if (i%10==0) fl_rectf(ox,oy+ly-ty,lx,1,0,230,240); - }; -} - -void VUMeter::draw() { - if (npart>=0) draw_part(); - else draw_master(); -} - -void VUMeter::tickdraw(VUMeter *o) { - o->redraw(); -} - -void VUMeter::tick(void *v) { - tickdraw((VUMeter *) v); - Fl::add_timeout(1.0/25.0,tick,v);//25 fps -} - -int VUMeter::handle(int event) { - switch(event){ - case FL_SHOW: - tick(this); - break; - case FL_HIDE: - Fl::remove_timeout(tick,this); - break; - case FL_PUSH: - if (npart>=0) break; - pthread_mutex_lock(&master->mutex); - master->vuresetpeaks(); - pthread_mutex_unlock(&master->mutex); - break; - }; - return(1); -} - -SysEffSend::SysEffSend(int x,int y, int w, int h, const char *label):WidgetPDial(x,y,w,h,label) { - master=NULL; - neff1=0; - neff2=0; -} - -void SysEffSend::init(Master *master_,int neff1_,int neff2_) { - neff1=neff1_; - neff2=neff2_; - master=master_; - minimum(0); - maximum(127); - step(1); - labelfont(1); - labelsize(10); - align(FL_ALIGN_TOP); - - value(master->Psysefxsend[neff1][neff2]); - char tmp[20];snprintf(tmp,20,"%d->%d",neff1+1,neff2+1); - this->copy_label(tmp); -} - -SysEffSend::~SysEffSend() { - hide(); -} - -int SysEffSend::handle(int event) { - if ((event==FL_PUSH) || (event==FL_DRAG)){ - master->setPsysefxsend(neff1,neff2,(int) value()); - }; - - return(WidgetPDial::handle(event)); -} - -void Panellistitem::cb_partname_i(Fl_Button*, void*) { - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -bankui->show(); -} -void Panellistitem::cb_partname(Fl_Button* o, void* v) { - ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partname_i(o,v); -} - -void Panellistitem::cb_partvolume_i(Fl_Slider* o, void*) { - master->part[npart]->setPvolume((int) o->value()); -} -void Panellistitem::cb_partvolume(Fl_Slider* o, void* v) { - ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partvolume_i(o,v); -} - -void Panellistitem::cb_partpanning_i(WidgetPDial* o, void*) { - master->part[npart]->setPpanning((int) o->value()); -} -void Panellistitem::cb_partpanning(WidgetPDial* o, void* v) { - ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partpanning_i(o,v); -} - -void Panellistitem::cb_edit_i(Fl_Button*, void*) { - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -} -void Panellistitem::cb_edit(Fl_Button* o, void* v) { - ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_edit_i(o,v); -} - -void Panellistitem::cb_partrcv_i(Fl_Choice* o, void*) { - master->part[npart]->Prcvchn=(int) o->value(); -} -void Panellistitem::cb_partrcv(Fl_Choice* o, void* v) { - ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partrcv_i(o,v); -} - -void Panellistitem::cb_partenabled_i(Fl_Check_Button* o, void*) { - pthread_mutex_lock(&master->mutex); - master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if ((int) o->value()==0) panellistitemgroup->deactivate(); - else { - panellistitemgroup->activate(); - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); - }; -}; - -o->redraw(); -} -void Panellistitem::cb_partenabled(Fl_Check_Button* o, void* v) { - ((Panellistitem*)(o->parent()->user_data()))->cb_partenabled_i(o,v); -} - -Fl_Group* Panellistitem::make_window() { - { panellistitem = new Fl_Group(0, 0, 70, 260); - panellistitem->box(FL_FLAT_BOX); - panellistitem->color(FL_BACKGROUND_COLOR); - panellistitem->selection_color(FL_BACKGROUND_COLOR); - panellistitem->labeltype(FL_NO_LABEL); - panellistitem->labelfont(0); - panellistitem->labelsize(14); - panellistitem->labelcolor(FL_FOREGROUND_COLOR); - panellistitem->user_data((void*)(this)); - panellistitem->align(Fl_Align(FL_ALIGN_TOP)); - panellistitem->when(FL_WHEN_RELEASE); - { Fl_Group* o = panellistitemgroup = new Fl_Group(0, 20, 70, 240); - panellistitemgroup->box(FL_PLASTIC_THIN_UP_BOX); - { Fl_Group* o = new Fl_Group(45, 65, 15, 110); - o->box(FL_ENGRAVED_FRAME); - { VUMeter* o = new VUMeter(45, 65, 15, 110, "V U"); - o->box(FL_FLAT_BOX); - o->color(FL_FOREGROUND_COLOR); - o->selection_color((Fl_Color)75); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(14); - o->labelcolor((Fl_Color)55); - o->align(Fl_Align(FL_ALIGN_WRAP)); - o->when(FL_WHEN_RELEASE); - o->init(master,npart); - } // VUMeter* o - o->end(); - } // Fl_Group* o - { partname = new Fl_Button(5, 27, 60, 30, " "); - partname->box(FL_THIN_DOWN_BOX); - partname->down_box(FL_FLAT_BOX); - partname->labelfont(1); - partname->labelsize(10); - partname->callback((Fl_Callback*)cb_partname); - partname->align(Fl_Align(192|FL_ALIGN_INSIDE)); - } // Fl_Button* partname - { Fl_Slider* o = partvolume = new Fl_Slider(10, 65, 30, 110); - partvolume->type(4); - partvolume->box(FL_FLAT_BOX); - partvolume->minimum(127); - partvolume->maximum(0); - partvolume->step(1); - partvolume->value(127); - partvolume->callback((Fl_Callback*)cb_partvolume); - o->value(master->part[npart]->Pvolume); - } // Fl_Slider* partvolume - { WidgetPDial* o = partpanning = new WidgetPDial(20, 180, 30, 30); - partpanning->box(FL_OVAL_BOX); - partpanning->color(FL_BACKGROUND_COLOR); - partpanning->selection_color(FL_INACTIVE_COLOR); - partpanning->labeltype(FL_NORMAL_LABEL); - partpanning->labelfont(0); - partpanning->labelsize(14); - partpanning->labelcolor(FL_FOREGROUND_COLOR); - partpanning->maximum(127); - partpanning->step(1); - partpanning->callback((Fl_Callback*)cb_partpanning); - partpanning->align(Fl_Align(FL_ALIGN_BOTTOM)); - partpanning->when(FL_WHEN_CHANGED); - o->value(master->part[npart]->Ppanning); - } // WidgetPDial* partpanning - { Fl_Button* o = new Fl_Button(15, 235, 40, 20, "edit"); - o->box(FL_PLASTIC_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_edit); - } // Fl_Button* o - { Fl_Choice* o = partrcv = new Fl_Choice(10, 213, 50, 15); - partrcv->tooltip("receive from Midi channel"); - partrcv->down_box(FL_BORDER_BOX); - partrcv->labelsize(10); - partrcv->textfont(1); - partrcv->textsize(10); - partrcv->callback((Fl_Callback*)cb_partrcv); - partrcv->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Dr10");}; - o->value(master->part[npart]->Prcvchn); - } // Fl_Choice* partrcv - if (master->part[npart]->Penabled==0) o->deactivate(); - panellistitemgroup->end(); - } // Fl_Group* panellistitemgroup - { Fl_Check_Button* o = partenabled = new Fl_Check_Button(5, 0, 45, 20, "01"); - partenabled->down_box(FL_DOWN_BOX); - partenabled->labeltype(FL_EMBOSSED_LABEL); - partenabled->labelfont(1); - partenabled->labelsize(13); - partenabled->callback((Fl_Callback*)cb_partenabled); - partenabled->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE)); - char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp); - o->value(master->part[npart]->Penabled); - } // Fl_Check_Button* partenabled - panellistitem->end(); - } // Fl_Group* panellistitem - return panellistitem; -} - -Panellistitem::Panellistitem(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - npart=0; - master=NULL; - bankui=NULL; -} - -void Panellistitem::init(Master *master_, int npart_,BankUI *bankui_) { - npart=npart_; - master=master_; - bankui=bankui_; - - make_window(); - panellistitem->show(); - end(); -} - -void Panellistitem::refresh() { - partenabled->value(master->part[npart]->Penabled); - if (master->part[npart]->Penabled!=0) panellistitemgroup->activate(); - else panellistitemgroup->deactivate(); - - partvolume->value(master->part[npart]->Pvolume); - partpanning->value(master->part[npart]->Ppanning); - partrcv->value(master->part[npart]->Prcvchn); - - partname->label((char *)master->part[npart]->Pname); - - if ((int)bankui->cbwig->value()!=(npart+1)) - panellistitemgroup->color(fl_rgb_color(160,160,160)); - else - panellistitemgroup->color(fl_rgb_color(50,190,240)); - - panellistitemgroup->redraw(); -} - -Panellistitem::~Panellistitem() { - panellistitem->hide(); - //delete(panellistitem); -} - -void MasterUI::cb_masterwindow_i(Fl_Double_Window*, void*) { - #ifdef VSTAUDIOOUT -fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it."); -#else -//if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) { - config.save(); - *exitprogram=1; -//}; -#endif -} -void MasterUI::cb_masterwindow(Fl_Double_Window* o, void* v) { - ((MasterUI*)(o->user_data()))->cb_masterwindow_i(o,v); -} - -void MasterUI::cb_New_i(Fl_Menu_*, void*) { - do_new_master(); -} -void MasterUI::cb_New(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_New_i(o,v); -} - -void MasterUI::cb_Open_i(Fl_Menu_*, void*) { - do_load_master(); -} -void MasterUI::cb_Open(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Open_i(o,v); -} - -void MasterUI::cb_Save_i(Fl_Menu_*, void*) { - do_save_master(); -} -void MasterUI::cb_Save(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Save_i(o,v); -} - -void MasterUI::cb_Load_i(Fl_Menu_*, void*) { - char *filename; -filename=fl_file_chooser("Open:","({*.xsz})",NULL,0); -if (filename==NULL) return; - -pthread_mutex_lock(&master->mutex); - //clear all parameters - master->microtonal.defaults(); - - //load the data - int result=master->microtonal.loadXML(filename); -pthread_mutex_unlock(&master->mutex); - - - delete microtonalui; - microtonalui=new MicrotonalUI(&master->microtonal); - -if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not a scale file."); - else if (result<0) fl_alert("Error: Could not load the file."); -} -void MasterUI::cb_Load(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Load_i(o,v); -} - -void MasterUI::cb_Save1_i(Fl_Menu_*, void*) { - char *filename; -int result=0; - -filename=fl_file_chooser("Save:","({*.xsz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xsz"); - -result=fileexists(filename); -if (result) { - result=0; - if (!fl_choice("The file exists. \nOverwrite it?","No","Yes",NULL)) return; - -}; - - -pthread_mutex_lock(&master->mutex); -result=master->microtonal.saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - - -updatepanel(); -} -void MasterUI::cb_Save1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Save1_i(o,v); -} - -void MasterUI::cb_Show_i(Fl_Menu_*, void*) { - microtonalui->show(); -} -void MasterUI::cb_Show(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Show_i(o,v); -} - -void MasterUI::cb_Settings_i(Fl_Menu_*, void*) { - configui->show(); -} -void MasterUI::cb_Settings(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Settings_i(o,v); -} - -void MasterUI::cb_Copyright_i(Fl_Menu_*, void*) { - aboutwindow->show(); -} -void MasterUI::cb_Copyright(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Copyright_i(o,v); -} - -void MasterUI::cb_E_i(Fl_Menu_*, void*) { - masterwindow->do_callback(); -} -void MasterUI::cb_E(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_E_i(o,v); -} - -void MasterUI::cb_Clear_i(Fl_Menu_*, void*) { - if (fl_choice("Clear instrument's parameters ?","No","Yes",NULL)){ -// int npart=(int)npartcounter->value()-1; - pthread_mutex_lock(&master->mutex); - master->part[npart]->defaultsinstrument(); - pthread_mutex_unlock(&master->mutex); - - npartcounter->do_callback(); -}; - -updatepanel(); -} -void MasterUI::cb_Clear(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Clear_i(o,v); -} - -void MasterUI::cb_Open1_i(Fl_Menu_*, void*) { - const char *filename; -filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); -if (filename==NULL) return; - - -pthread_mutex_lock(&master->mutex); -// int npart=(int)npartcounter->value()-1; - - //clear all instrument parameters, first - master->part[npart]->defaultsinstrument(); - - //load the instr. parameters - int result=master->part[npart]->loadXMLinstrument(filename); - -pthread_mutex_unlock(&master->mutex); -master->part[npart]->applyparameters(); - -npartcounter->do_callback(); -updatepanel(); - -if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not an instrument file."); - else if (result<0) fl_alert("Error: Could not load the file."); -} -void MasterUI::cb_Open1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Open1_i(o,v); -} - -void MasterUI::cb_Save2_i(Fl_Menu_*, void*) { - char *filename; - -filename=fl_file_chooser("Save:","({*.xiz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xiz"); - -int result=fileexists(filename); -if (result) { - result=0; - if (!fl_choice("The file exists. \nOverwrite it?","No","Yes",NULL)) return; - -}; - - -pthread_mutex_lock(&master->mutex); -result=master->part[npart]->saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - -updatepanel(); -} -void MasterUI::cb_Save2(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Save2_i(o,v); -} - -void MasterUI::cb_Show1_i(Fl_Menu_*, void*) { - bankui->show(); -} -void MasterUI::cb_Show1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Show1_i(o,v); -} - -void MasterUI::cb_Virtual_i(Fl_Menu_*, void*) { - virkeyboard->show(); -} -void MasterUI::cb_Virtual(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Virtual_i(o,v); -} - -void MasterUI::cb_Choose_i(Fl_Menu_*, void*) { - char *filename; -recordbutton->deactivate(); -pausebutton->deactivate(); -pauselabel->deactivate(); -stopbutton->deactivate(); -filename=fl_file_chooser("Record to audio file:","(*.wav)",NULL,0); -if (filename==NULL) return; -fl_filename_setext(filename,".wav"); - -int result=master->HDDRecorder.preparefile(filename,0); -if (result==1) { - result=0; - if (fl_choice("The file exists. \nOverwrite it?","No","Yes",NULL)) - master->HDDRecorder.preparefile(filename,1); -}; -if (result==0) recordbutton->activate(); - -if (result!=0) fl_alert("Error: Could not save the file."); -} -void MasterUI::cb_Choose(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Choose_i(o,v); -} - -void MasterUI::cb_Show2_i(Fl_Menu_*, void*) { - sequi->show(); -} -void MasterUI::cb_Show2(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Show2_i(o,v); -} - -void MasterUI::cb_Switch_i(Fl_Menu_*, void*) { - if (fl_choice("Switch the User Interface to Beginner mode ?","No","Yes",NULL)){ - masterwindow->hide(); - refresh_master_ui(); - simplemasterwindow->show(); - config.cfg.UserInterfaceMode=2; -}; -} -void MasterUI::cb_Switch(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Switch_i(o,v); -} - -Fl_Menu_Item MasterUI::menu_mastermenu[] = { - {"&File", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"&New (erase all)...", 0, (Fl_Callback*)MasterUI::cb_New, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Open Parameters...", 0, (Fl_Callback*)MasterUI::cb_Open, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Save All Parameters...", 0, (Fl_Callback*)MasterUI::cb_Save, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Load Scale Settings...", 0, (Fl_Callback*)MasterUI::cb_Load, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"Save Sc&ale Settings ..", 0, (Fl_Callback*)MasterUI::cb_Save1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"Show Scale Settings...", 0, (Fl_Callback*)MasterUI::cb_Show, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Settings...", 0, (Fl_Callback*)MasterUI::cb_Settings, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Copyright...", 0, (Fl_Callback*)MasterUI::cb_Copyright, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"E&xit", 0, (Fl_Callback*)MasterUI::cb_E, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {"&Instrument", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Clear Instrument...", 0, (Fl_Callback*)MasterUI::cb_Clear, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Open Instrument...", 0, (Fl_Callback*)MasterUI::cb_Open1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Save Instrument ...", 0, (Fl_Callback*)MasterUI::cb_Save2, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"Show Instrument &Bank...", 0, (Fl_Callback*)MasterUI::cb_Show1, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Virtual Keyboard...", 0, (Fl_Callback*)MasterUI::cb_Virtual, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {"&Record", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Choose WAV file...", 0, (Fl_Callback*)MasterUI::cb_Choose, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {"&Sequencer", 0, 0, 0, 80, FL_NORMAL_LABEL, 0, 14, 0}, - {"Show &Sequencer...", 0, (Fl_Callback*)MasterUI::cb_Show2, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {"Misc", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"Switch User Interface Mode", 0, (Fl_Callback*)MasterUI::cb_Switch, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0} -}; -Fl_Menu_Item* MasterUI::recordmenu = MasterUI::menu_mastermenu + 18; - -void MasterUI::cb_mastervolumedial_i(WidgetPDial* o, void*) { - master->setPvolume((int) o->value()); -} -void MasterUI::cb_mastervolumedial(WidgetPDial* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_mastervolumedial_i(o,v); -} - -void MasterUI::cb_masterkeyshiftcounter_i(Fl_Counter* o, void*) { - master->setPkeyshift((int) o->value()+64); -} -void MasterUI::cb_masterkeyshiftcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_masterkeyshiftcounter_i(o,v); -} - -void MasterUI::cb_Panic_i(Fl_Button*, void*) { - virkeyboard->relaseallkeys(); -pthread_mutex_lock(&master->mutex); -master->shutup=1; -pthread_mutex_unlock(&master->mutex); -} -void MasterUI::cb_Panic(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Panic_i(o,v); -} - -void MasterUI::cb_syseffnocounter_i(Fl_Counter* o, void*) { - nsyseff=(int) o->value()-1; -sysefftype->value(master->sysefx[nsyseff]->geteffect()); -syseffectui->refresh(master->sysefx[nsyseff]); -} -void MasterUI::cb_syseffnocounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_syseffnocounter_i(o,v); -} - -void MasterUI::cb_sysefftype_i(Fl_Choice* o, void*) { - pthread_mutex_lock(&master->mutex); -master->sysefx[nsyseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -syseffectui->refresh(master->sysefx[nsyseff]); -} -void MasterUI::cb_sysefftype(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_sysefftype_i(o,v); -} - -Fl_Menu_Item MasterUI::menu_sysefftype[] = { - {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void MasterUI::cb_Send_i(Fl_Button*, void*) { - syseffsendwindow->show(); -} -void MasterUI::cb_Send(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_Send_i(o,v); -} - -void MasterUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(master->sysefx[nsyseff]); -} -void MasterUI::cb_C(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_C_i(o,v); -} - -void MasterUI::cb_P_i(Fl_Button*, void*) { - pthread_mutex_lock(&master->mutex); -presetsui->paste(master->sysefx[nsyseff],syseffectui); -pthread_mutex_unlock(&master->mutex); -} -void MasterUI::cb_P(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_P_i(o,v); -} - -void MasterUI::cb_inseffnocounter_i(Fl_Counter* o, void*) { - ninseff=(int) o->value()-1; -insefftype->value(master->insefx[ninseff]->geteffect()); -inseffpart->value(master->Pinsparts[ninseff]+2); -inseffectui->refresh(master->insefx[ninseff]); - -if (master->Pinsparts[ninseff]!=-1) { - insefftype->activate(); - inseffectui->activate(); - inseffectuigroup->activate(); -} else { - insefftype->deactivate(); - inseffectui->deactivate(); - inseffectuigroup->deactivate(); -}; -} -void MasterUI::cb_inseffnocounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_inseffnocounter_i(o,v); -} - -void MasterUI::cb_insefftype_i(Fl_Choice* o, void*) { - pthread_mutex_lock(&master->mutex); -master->insefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -inseffectui->refresh(master->insefx[ninseff]); -inseffectui->show(); -} -void MasterUI::cb_insefftype(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_insefftype_i(o,v); -} - -Fl_Menu_Item MasterUI::menu_insefftype[] = { - {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void MasterUI::cb_inseffpart_i(Fl_Choice* o, void*) { - master->Pinsparts[ninseff]=(int) o->value()-2; -if ((int) o->value()==1){ - inseffectuigroup->deactivate(); - insefftype->deactivate(); - inseffectui->deactivate(); -} else { - inseffectuigroup->activate(); - insefftype->activate(); - inseffectui->activate(); -}; -master->insefx[ninseff]->cleanup(); -} -void MasterUI::cb_inseffpart(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_inseffpart_i(o,v); -} - -void MasterUI::cb_C1_i(Fl_Button*, void*) { - presetsui->copy(master->insefx[ninseff]); -} -void MasterUI::cb_C1(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_C1_i(o,v); -} - -void MasterUI::cb_P1_i(Fl_Button*, void*) { - pthread_mutex_lock(&master->mutex); -presetsui->paste(master->insefx[ninseff],inseffectui); -pthread_mutex_unlock(&master->mutex); -} -void MasterUI::cb_P1(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_P1_i(o,v); -} - -void MasterUI::cb_Scales_i(Fl_Button*, void*) { - microtonalui->show(); -} -void MasterUI::cb_Scales(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Scales_i(o,v); -} - -void MasterUI::cb_recordbutton_i(Fl_Button* o, void*) { - o->deactivate(); -recordmenu->deactivate(); -recordmenu->label("&Record(*)"); -stopbutton->activate(); -pausebutton->activate(); -pauselabel->activate(); -master->HDDRecorder.start(); -master->vuresetpeaks(); -mastermenu->redraw(); -} -void MasterUI::cb_recordbutton(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_recordbutton_i(o,v); -} - -void MasterUI::cb_stopbutton_i(Fl_Button* o, void*) { - o->deactivate(); -master->HDDRecorder.stop(); -recordbutton->deactivate(); -pausebutton->deactivate(); -pauselabel->deactivate(); -recordmenu->activate(); -recordmenu->label("&Record"); -mastermenu->redraw(); -} -void MasterUI::cb_stopbutton(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_stopbutton_i(o,v); -} - -void MasterUI::cb_pausebutton_i(Fl_Button* o, void*) { - o->deactivate(); -master->HDDRecorder.pause(); -recordbutton->activate(); -mastermenu->redraw(); -} -void MasterUI::cb_pausebutton(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_pausebutton_i(o,v); -} - -void MasterUI::cb_nrpnbutton_i(Fl_Check_Button* o, void*) { - master->ctl.NRPN.receive=(int) o->value(); -} -void MasterUI::cb_nrpnbutton(Fl_Check_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_nrpnbutton_i(o,v); -} - -void MasterUI::cb_npartcounter_i(Fl_Counter* o, void*) { - int nval=(int) o->value()-1; -partuigroup->remove(partui); -delete partui; -partui=new PartUI(0,0,765,525); -partuigroup->add(partui); -partui->init(master->part[nval],master,nval,bankui); -partui->redraw(); -o->redraw(); -npart=nval; - -updatepanel(); -simplenpartcounter->value(nval+1); -simplenpartcounter->do_callback(); -} -void MasterUI::cb_npartcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_npartcounter_i(o,v); -} - -void MasterUI::cb_vK_i(Fl_Button*, void*) { - virkeyboard->show(); -} -void MasterUI::cb_vK(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_vK_i(o,v); -} - -void MasterUI::cb_R_i(Fl_Button*, void*) { - globalfinedetuneslider->value(64.0); -globalfinedetuneslider->do_callback(); -} -void MasterUI::cb_R(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_R_i(o,v); -} - -void MasterUI::cb_globalfinedetuneslider_i(WidgetPDial* o, void*) { - master->microtonal.Pglobalfinedetune=(int) o->value(); -} -void MasterUI::cb_globalfinedetuneslider(WidgetPDial* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_globalfinedetuneslider_i(o,v); -} - -void MasterUI::cb_Panel_i(Fl_Button*, void*) { - updatepanel(); -panelwindow->show(); -} -void MasterUI::cb_Panel(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Panel_i(o,v); -} - -void MasterUI::cb_Close_i(Fl_Button*, void*) { - aboutwindow->hide(); -} -void MasterUI::cb_Close(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void MasterUI::cb_Close1_i(Fl_Button*, void*) { - syseffsendwindow->hide(); -} -void MasterUI::cb_Close1(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Close1_i(o,v); -} - -void MasterUI::cb_Close2_i(Fl_Button*, void*) { - panelwindow->hide(); -updatepanel(); -} -void MasterUI::cb_Close2(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Close2_i(o,v); -} - -void MasterUI::cb_Refresh_i(Fl_Button*, void*) { - updatepanel(); -} -void MasterUI::cb_Refresh(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Refresh_i(o,v); -} - -void MasterUI::cb_simplemasterwindow_i(Fl_Double_Window*, void*) { - #ifdef VSTAUDIOOUT -fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it."); -#else -//if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) { - config.save(); - *exitprogram=1; -//}; -#endif -} -void MasterUI::cb_simplemasterwindow(Fl_Double_Window* o, void* v) { - ((MasterUI*)(o->user_data()))->cb_simplemasterwindow_i(o,v); -} - -void MasterUI::cb_New1_i(Fl_Menu_*, void*) { - do_new_master(); -} -void MasterUI::cb_New1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_New1_i(o,v); -} - -void MasterUI::cb_Open2_i(Fl_Menu_*, void*) { - do_load_master(); -} -void MasterUI::cb_Open2(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Open2_i(o,v); -} - -void MasterUI::cb_Save3_i(Fl_Menu_*, void*) { - do_save_master(); -} -void MasterUI::cb_Save3(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Save3_i(o,v); -} - -void MasterUI::cb_Settings1_i(Fl_Menu_*, void*) { - configui->show(); -} -void MasterUI::cb_Settings1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Settings1_i(o,v); -} - -void MasterUI::cb_Copyright1_i(Fl_Menu_*, void*) { - aboutwindow->show(); -} -void MasterUI::cb_Copyright1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Copyright1_i(o,v); -} - -void MasterUI::cb_E1_i(Fl_Menu_*, void*) { - masterwindow->do_callback(); -} -void MasterUI::cb_E1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_E1_i(o,v); -} - -void MasterUI::cb_Open3_i(Fl_Menu_*, void*) { - const char *filename; -filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); -if (filename==NULL) return; - - -pthread_mutex_lock(&master->mutex); -// int npart=(int)npartcounter->value()-1; - - //clear all instrument parameters, first - master->part[npart]->defaultsinstrument(); - - //load the instr. parameters - int result=master->part[npart]->loadXMLinstrument(filename); - -pthread_mutex_unlock(&master->mutex); -master->part[npart]->applyparameters(); - -simplenpartcounter->do_callback(); - -if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not an instrument file."); - else if (result<0) fl_alert("Error: Could not load the file."); -} -void MasterUI::cb_Open3(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Open3_i(o,v); -} - -void MasterUI::cb_Show3_i(Fl_Menu_*, void*) { - bankui->show(); -} -void MasterUI::cb_Show3(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Show3_i(o,v); -} - -void MasterUI::cb_Switch1_i(Fl_Menu_*, void*) { - if (fl_choice("Switch the User Interface to Advanced mode ?","No","Yes",NULL)){ - simplemasterwindow->hide(); - refresh_master_ui(); - masterwindow->show(); - config.cfg.UserInterfaceMode=1; -}; -} -void MasterUI::cb_Switch1(Fl_Menu_* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Switch1_i(o,v); -} - -Fl_Menu_Item MasterUI::menu_[] = { - {"&File", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"&New (erase all)...", 0, (Fl_Callback*)MasterUI::cb_New1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Open Parameters...", 0, (Fl_Callback*)MasterUI::cb_Open2, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Save All Parameters...", 0, (Fl_Callback*)MasterUI::cb_Save3, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Settings...", 0, (Fl_Callback*)MasterUI::cb_Settings1, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Copyright...", 0, (Fl_Callback*)MasterUI::cb_Copyright1, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {"E&xit", 0, (Fl_Callback*)MasterUI::cb_E1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {"&Instrument", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"&Open Instrument...", 0, (Fl_Callback*)MasterUI::cb_Open3, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {"Show Instrument &Bank...", 0, (Fl_Callback*)MasterUI::cb_Show3, 0, 128, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {"Misc", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {"Switch User Interface Mode", 0, (Fl_Callback*)MasterUI::cb_Switch1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0} -}; - -void MasterUI::cb_partname1_i(Fl_Button*, void*) { - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -bankui->show(); -} -void MasterUI::cb_partname1(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partname1_i(o,v); -} - -void MasterUI::cb_partpanning1_i(Fl_Slider* o, void*) { - master->part[npart]->setPpanning((int) o->value()); -} -void MasterUI::cb_partpanning1(Fl_Slider* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partpanning1_i(o,v); -} - -void MasterUI::cb_partrcv1_i(Fl_Choice* o, void*) { - virkeys->relaseallkeys(0); -master->part[npart]->Prcvchn=(int) o->value(); -virkeys->midich=(int) o->value(); -} -void MasterUI::cb_partrcv1(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partrcv1_i(o,v); -} - -void MasterUI::cb_partvolume1_i(WidgetPDial* o, void*) { - master->part[npart]->setPvolume((int) o->value()); -} -void MasterUI::cb_partvolume1(WidgetPDial* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partvolume1_i(o,v); -} - -void MasterUI::cb_simplepartportamento_i(Fl_Check_Button* o, void*) { - master->part[npart]->ctl.portamento.portamento=(int) o->value(); -} -void MasterUI::cb_simplepartportamento(Fl_Check_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplepartportamento_i(o,v); -} - -void MasterUI::cb_simpleminkcounter_i(Fl_Counter* o, void*) { - master->part[npart]->Pminkey=(int) o->value(); -if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); -} -void MasterUI::cb_simpleminkcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simpleminkcounter_i(o,v); -} - -void MasterUI::cb_simplemaxkcounter_i(Fl_Counter* o, void*) { - master->part[npart]->Pmaxkey=(int) o->value(); - -if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); -} -void MasterUI::cb_simplemaxkcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplemaxkcounter_i(o,v); -} - -void MasterUI::cb_m_i(Fl_Button*, void*) { - if (master->part[npart]->lastnote>=0) simpleminkcounter->value(master->part[npart]->lastnote); -simpleminkcounter->do_callback(); -simplemaxkcounter->do_callback(); -} -void MasterUI::cb_m(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_m_i(o,v); -} - -void MasterUI::cb_M_i(Fl_Button*, void*) { - if (master->part[npart]->lastnote>=0) simplemaxkcounter->value(master->part[npart]->lastnote); -simplemaxkcounter->do_callback(); -simpleminkcounter->do_callback(); -} -void MasterUI::cb_M(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_M_i(o,v); -} - -void MasterUI::cb_R1_i(Fl_Button*, void*) { - simpleminkcounter->value(0); -simpleminkcounter->do_callback(); -simplemaxkcounter->value(127); -simplemaxkcounter->do_callback(); -} -void MasterUI::cb_R1(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_R1_i(o,v); -} - -void MasterUI::cb_simplepartkeyshiftcounter_i(Fl_Counter* o, void*) { - master->part[npart]->Pkeyshift=(int) o->value()+64; -} -void MasterUI::cb_simplepartkeyshiftcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplepartkeyshiftcounter_i(o,v); -} - -void MasterUI::cb_simplesyseffsend_i(WidgetPDial* o, void*) { - master->setPsysefxvol(npart,nsyseff,(int) o->value()); -} -void MasterUI::cb_simplesyseffsend(WidgetPDial* o, void* v) { - ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplesyseffsend_i(o,v); -} - -void MasterUI::cb_partenabled1_i(Fl_Check_Button* o, void*) { - pthread_mutex_lock(&master->mutex); - master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if ((int) o->value()==0) simplelistitemgroup->deactivate(); - else { - simplelistitemgroup->activate(); - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); - }; -}; - -o->redraw(); -} -void MasterUI::cb_partenabled1(Fl_Check_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_partenabled1_i(o,v); -} - -void MasterUI::cb_simplesyseffnocounter_i(Fl_Counter* o, void*) { - nsyseff=(int) o->value()-1; -simplesysefftype->value(master->sysefx[nsyseff]->geteffect()); -simplesyseffectui->refresh(master->sysefx[nsyseff]); -simplerefresh(); -} -void MasterUI::cb_simplesyseffnocounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simplesyseffnocounter_i(o,v); -} - -void MasterUI::cb_simplesysefftype_i(Fl_Choice* o, void*) { - pthread_mutex_lock(&master->mutex); -master->sysefx[nsyseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -simplesyseffectui->refresh(master->sysefx[nsyseff]); -} -void MasterUI::cb_simplesysefftype(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simplesysefftype_i(o,v); -} - -Fl_Menu_Item MasterUI::menu_simplesysefftype[] = { - {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void MasterUI::cb_Send1_i(Fl_Button*, void*) { - syseffsendwindow->show(); -} -void MasterUI::cb_Send1(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Send1_i(o,v); -} - -void MasterUI::cb_P2_i(Fl_Button*, void*) { - pthread_mutex_lock(&master->mutex); -presetsui->paste(master->sysefx[nsyseff],simplesyseffectui); -pthread_mutex_unlock(&master->mutex); -} -void MasterUI::cb_P2(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_P2_i(o,v); -} - -void MasterUI::cb_simpleinseffnocounter_i(Fl_Counter* o, void*) { - ninseff=(int) o->value()-1; -simpleinsefftype->value(master->insefx[ninseff]->geteffect()); -simpleinseffpart->value(master->Pinsparts[ninseff]+2); -simpleinseffectui->refresh(master->insefx[ninseff]); - -if (master->Pinsparts[ninseff]!=-1) { - simpleinsefftype->activate(); - simpleinseffectui->activate(); - simpleinseffectuigroup->activate(); -} else { - simpleinsefftype->deactivate(); - simpleinseffectui->deactivate(); - simpleinseffectuigroup->deactivate(); -}; -} -void MasterUI::cb_simpleinseffnocounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simpleinseffnocounter_i(o,v); -} - -void MasterUI::cb_simpleinsefftype_i(Fl_Choice* o, void*) { - pthread_mutex_lock(&master->mutex); -master->insefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -simpleinseffectui->refresh(master->insefx[ninseff]); -simpleinseffectui->show(); -} -void MasterUI::cb_simpleinsefftype(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simpleinsefftype_i(o,v); -} - -Fl_Menu_Item MasterUI::menu_simpleinsefftype[] = { - {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void MasterUI::cb_simpleinseffpart_i(Fl_Choice* o, void*) { - master->Pinsparts[ninseff]=(int) o->value()-2; -if ((int) o->value()==1){ - simpleinseffectuigroup->deactivate(); - simpleinsefftype->deactivate(); - simpleinseffectui->deactivate(); -} else { - simpleinseffectuigroup->activate(); - simpleinsefftype->activate(); - simpleinseffectui->activate(); -}; -master->insefx[ninseff]->cleanup(); -} -void MasterUI::cb_simpleinseffpart(Fl_Choice* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simpleinseffpart_i(o,v); -} - -void MasterUI::cb_P3_i(Fl_Button*, void*) { - pthread_mutex_lock(&master->mutex); -presetsui->paste(master->insefx[ninseff],simpleinseffectui); -pthread_mutex_unlock(&master->mutex); -} -void MasterUI::cb_P3(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_P3_i(o,v); -} - -void MasterUI::cb_simplemastervolumedial_i(WidgetPDial* o, void*) { - master->setPvolume((int) o->value()); -} -void MasterUI::cb_simplemastervolumedial(WidgetPDial* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_simplemastervolumedial_i(o,v); -} - -void MasterUI::cb_simplemasterkeyshiftcounter_i(Fl_Counter* o, void*) { - master->setPkeyshift((int) o->value()+64); -} -void MasterUI::cb_simplemasterkeyshiftcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_simplemasterkeyshiftcounter_i(o,v); -} - -void MasterUI::cb_Stop_i(Fl_Button*, void*) { - virkeyboard->relaseallkeys(); -pthread_mutex_lock(&master->mutex); -master->shutup=1; -pthread_mutex_unlock(&master->mutex); -} -void MasterUI::cb_Stop(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Stop_i(o,v); -} - -void MasterUI::cb_Reset_i(Fl_Button*, void*) { - simpleglobalfinedetuneslider->value(64.0); -simpleglobalfinedetuneslider->do_callback(); -} -void MasterUI::cb_Reset(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Reset_i(o,v); -} - -void MasterUI::cb_simpleglobalfinedetuneslider_i(WidgetPDial* o, void*) { - master->microtonal.Pglobalfinedetune=(int) o->value(); -} -void MasterUI::cb_simpleglobalfinedetuneslider(WidgetPDial* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_simpleglobalfinedetuneslider_i(o,v); -} - -void MasterUI::cb_simplenpartcounter_i(Fl_Counter* o, void*) { - virkeys->relaseallkeys(0); -npartcounter->value(o->value()); -npart=(int) o->value()-1; - -simplerefresh(); -virkeys->midich=master->part[npart]->Prcvchn; -} -void MasterUI::cb_simplenpartcounter(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_simplenpartcounter_i(o,v); -} - -void MasterUI::cb_Keyb_i(Fl_Counter* o, void*) { - virkeys->relaseallkeys(0); -virkeys->midioct=(int) o->value(); -virkeys->take_focus(); -} -void MasterUI::cb_Keyb(Fl_Counter* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Keyb_i(o,v); -} - -void MasterUI::cb_selectuiwindow_i(Fl_Double_Window*, void*) { - *exitprogram=1; -} -void MasterUI::cb_selectuiwindow(Fl_Double_Window* o, void* v) { - ((MasterUI*)(o->user_data()))->cb_selectuiwindow_i(o,v); -} - -void MasterUI::cb_Advanced_i(Fl_Button*, void*) { - config.cfg.UserInterfaceMode=1; -masterwindow->show(); -selectuiwindow->hide(); -} -void MasterUI::cb_Advanced(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Advanced_i(o,v); -} - -void MasterUI::cb_Beginner_i(Fl_Button*, void*) { - simplemasterwindow->show(); -selectuiwindow->hide(); -config.cfg.UserInterfaceMode=2; -} -void MasterUI::cb_Beginner(Fl_Button* o, void* v) { - ((MasterUI*)(o->parent()->user_data()))->cb_Beginner_i(o,v); -} - -Fl_Double_Window* MasterUI::make_window() { - { masterwindow = new Fl_Double_Window(390, 465, "zynaddsubfx"); - masterwindow->callback((Fl_Callback*)cb_masterwindow, (void*)(this)); - { mastermenu = new Fl_Menu_Bar(-5, 0, 690, 25); - mastermenu->menu(menu_mastermenu); - } // Fl_Menu_Bar* mastermenu - { WidgetPDial* o = mastervolumedial = new WidgetPDial(5, 30, 30, 30, "M.Vol"); - mastervolumedial->tooltip("Master Volume"); - mastervolumedial->box(FL_ROUND_UP_BOX); - mastervolumedial->color(FL_BACKGROUND_COLOR); - mastervolumedial->selection_color(FL_INACTIVE_COLOR); - mastervolumedial->labeltype(FL_NORMAL_LABEL); - mastervolumedial->labelfont(1); - mastervolumedial->labelsize(11); - mastervolumedial->labelcolor(FL_FOREGROUND_COLOR); - mastervolumedial->maximum(127); - mastervolumedial->step(1); - mastervolumedial->callback((Fl_Callback*)cb_mastervolumedial); - mastervolumedial->align(Fl_Align(130)); - mastervolumedial->when(FL_WHEN_CHANGED); - o->value(master->Pvolume); - } // WidgetPDial* mastervolumedial - { Fl_Counter* o = masterkeyshiftcounter = new Fl_Counter(45, 31, 90, 20, "Master KeyShift"); - masterkeyshiftcounter->labelsize(11); - masterkeyshiftcounter->minimum(-64); - masterkeyshiftcounter->maximum(64); - masterkeyshiftcounter->step(1); - masterkeyshiftcounter->callback((Fl_Callback*)cb_masterkeyshiftcounter); - o->lstep(12); - o->value(master->Pkeyshift-64); - } // Fl_Counter* masterkeyshiftcounter - { Fl_Button* o = new Fl_Button(293, 29, 92, 31, "Panic!"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)231); - o->labelfont(1); - o->callback((Fl_Callback*)cb_Panic); - } // Fl_Button* o - { partuigroup = new Fl_Group(0, 242, 390, 183); - partuigroup->box(FL_ENGRAVED_FRAME); - { PartUI* o = partui = new PartUI(4, 245, 383, 175); - partui->box(FL_FLAT_BOX); - partui->color(FL_BACKGROUND_COLOR); - partui->selection_color(FL_BACKGROUND_COLOR); - partui->labeltype(FL_NORMAL_LABEL); - partui->labelfont(0); - partui->labelsize(14); - partui->labelcolor(FL_FOREGROUND_COLOR); - partui->align(Fl_Align(FL_ALIGN_TOP)); - partui->when(FL_WHEN_RELEASE); - o->init(master->part[0],master,0,bankui); - o->show(); - partui->end(); - } // PartUI* partui - partuigroup->end(); - } // Fl_Group* partuigroup - { Fl_Tabs* o = new Fl_Tabs(0, 80, 390, 160); - { Fl_Group* o = new Fl_Group(0, 100, 390, 140, "System Effects"); - o->box(FL_ENGRAVED_FRAME); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelsize(15); - o->align(Fl_Align(FL_ALIGN_TOP_RIGHT|FL_ALIGN_INSIDE)); - { Fl_Counter* o = syseffnocounter = new Fl_Counter(5, 120, 80, 20, "Sys.Effect No."); - syseffnocounter->type(1); - syseffnocounter->labelfont(1); - syseffnocounter->labelsize(10); - syseffnocounter->minimum(0); - syseffnocounter->maximum(127); - syseffnocounter->step(1); - syseffnocounter->value(1); - syseffnocounter->textfont(1); - syseffnocounter->callback((Fl_Callback*)cb_syseffnocounter); - syseffnocounter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(1,NUM_SYS_EFX); - o->value(nsyseff+1); - } // Fl_Counter* syseffnocounter - { Fl_Choice* o = sysefftype = new Fl_Choice(315, 125, 70, 15, "EffType"); - sysefftype->down_box(FL_BORDER_BOX); - sysefftype->labelsize(10); - sysefftype->callback((Fl_Callback*)cb_sysefftype); - sysefftype->menu(menu_sysefftype); - o->value(master->sysefx[nsyseff]->geteffect()); - } // Fl_Choice* sysefftype - { syseffectuigroup = new Fl_Group(5, 140, 380, 95); - syseffectuigroup->box(FL_FLAT_BOX); - syseffectuigroup->color((Fl_Color)48); - { EffUI* o = syseffectui = new EffUI(5, 140, 380, 95); - syseffectui->box(FL_NO_BOX); - syseffectui->color(FL_BACKGROUND_COLOR); - syseffectui->selection_color(FL_BACKGROUND_COLOR); - syseffectui->labeltype(FL_NORMAL_LABEL); - syseffectui->labelfont(0); - syseffectui->labelsize(14); - syseffectui->labelcolor(FL_FOREGROUND_COLOR); - syseffectui->align(Fl_Align(FL_ALIGN_TOP)); - syseffectui->when(FL_WHEN_RELEASE); - o->init(master->sysefx[nsyseff]); - syseffectui->end(); - } // EffUI* syseffectui - syseffectuigroup->end(); - } // Fl_Group* syseffectuigroup - { Fl_Button* o = new Fl_Button(95, 120, 75, 20, "Send to..."); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Send); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(215, 124, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(245, 124, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(0, 100, 390, 140, "Insertion Effects"); - o->box(FL_ENGRAVED_FRAME); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelsize(15); - o->align(Fl_Align(FL_ALIGN_TOP_RIGHT|FL_ALIGN_INSIDE)); - o->hide(); - { Fl_Counter* o = inseffnocounter = new Fl_Counter(5, 120, 80, 20, "Ins.Effect No."); - inseffnocounter->type(1); - inseffnocounter->labelfont(1); - inseffnocounter->labelsize(10); - inseffnocounter->minimum(0); - inseffnocounter->maximum(127); - inseffnocounter->step(1); - inseffnocounter->value(1); - inseffnocounter->textfont(1); - inseffnocounter->callback((Fl_Callback*)cb_inseffnocounter); - inseffnocounter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(1,NUM_INS_EFX); - o->value(ninseff+1); - } // Fl_Counter* inseffnocounter - { Fl_Choice* o = insefftype = new Fl_Choice(315, 125, 70, 15, "EffType"); - insefftype->down_box(FL_BORDER_BOX); - insefftype->labelsize(10); - insefftype->callback((Fl_Callback*)cb_insefftype); - insefftype->menu(menu_insefftype); - o->value(master->insefx[ninseff]->geteffect()); - if (master->Pinsparts[ninseff]== -1) o->deactivate(); - } // Fl_Choice* insefftype - { inseffectuigroup = new Fl_Group(5, 140, 380, 95); - inseffectuigroup->box(FL_FLAT_BOX); - inseffectuigroup->color((Fl_Color)48); - { EffUI* o = inseffectui = new EffUI(5, 140, 380, 95); - inseffectui->box(FL_NO_BOX); - inseffectui->color(FL_BACKGROUND_COLOR); - inseffectui->selection_color(FL_BACKGROUND_COLOR); - inseffectui->labeltype(FL_NORMAL_LABEL); - inseffectui->labelfont(0); - inseffectui->labelsize(14); - inseffectui->labelcolor(FL_FOREGROUND_COLOR); - inseffectui->align(Fl_Align(FL_ALIGN_TOP)); - inseffectui->when(FL_WHEN_RELEASE); - o->init(master->insefx[ninseff]); - if (master->Pinsparts[ninseff]== -1) o->deactivate(); - inseffectui->end(); - } // EffUI* inseffectui - inseffectuigroup->end(); - } // Fl_Group* inseffectuigroup - { Fl_Choice* o = inseffpart = new Fl_Choice(95, 120, 80, 20, "Insert To."); - inseffpart->down_box(FL_BORDER_BOX); - inseffpart->labelfont(1); - inseffpart->labelsize(10); - inseffpart->textsize(10); - inseffpart->callback((Fl_Callback*)cb_inseffpart); - inseffpart->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("Master Out");o->add("Off"); - char tmp[50]; for (int i=0;iadd(tmp);}; - o->value(master->Pinsparts[ninseff]+2); - } // Fl_Choice* inseffpart - { Fl_Button* o = new Fl_Button(215, 124, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(245, 124, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P1); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - o->end(); - } // Fl_Tabs* o - { Fl_Button* o = new Fl_Button(330, 80, 56, 19, "Scales"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)231); - o->labeltype(FL_ENGRAVED_LABEL); - o->labelfont(1); - o->callback((Fl_Callback*)cb_Scales); - } // Fl_Button* o - { Fl_Group* o = new Fl_Group(172, 30, 117, 45); - o->box(FL_ENGRAVED_BOX); - { recordbutton = new Fl_Button(181, 36, 21, 21, "Rec."); - recordbutton->tooltip("Start Recording"); - recordbutton->box(FL_ROUND_UP_BOX); - recordbutton->color(FL_RED); - recordbutton->labelfont(1); - recordbutton->labelsize(10); - recordbutton->callback((Fl_Callback*)cb_recordbutton); - recordbutton->align(Fl_Align(FL_ALIGN_BOTTOM)); - recordbutton->deactivate(); - } // Fl_Button* recordbutton - { stopbutton = new Fl_Button(259, 36, 21, 21, "Stop"); - stopbutton->tooltip("Stop Recording and close the audio file"); - stopbutton->box(FL_THIN_UP_BOX); - stopbutton->color((Fl_Color)4); - stopbutton->labelfont(1); - stopbutton->labelsize(10); - stopbutton->callback((Fl_Callback*)cb_stopbutton); - stopbutton->align(Fl_Align(FL_ALIGN_BOTTOM)); - stopbutton->deactivate(); - } // Fl_Button* stopbutton - { pausebutton = new Fl_Button(220, 36, 21, 21, "@||"); - pausebutton->tooltip("Pause Recording"); - pausebutton->box(FL_THIN_UP_BOX); - pausebutton->color((Fl_Color)4); - pausebutton->selection_color((Fl_Color)4); - pausebutton->labelfont(1); - pausebutton->labelcolor((Fl_Color)3); - pausebutton->callback((Fl_Callback*)cb_pausebutton); - pausebutton->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); - pausebutton->deactivate(); - } // Fl_Button* pausebutton - { pauselabel = new Fl_Box(214, 56, 30, 15, "Pause"); - pauselabel->labelfont(1); - pauselabel->labelsize(10); - pauselabel->deactivate(); - } // Fl_Box* pauselabel - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(1, 427, 389, 33); - o->box(FL_ENGRAVED_FRAME); - { VUMeter* o = new VUMeter(4, 430, 384, 30, "VU-Meter"); - o->box(FL_FLAT_BOX); - o->color((Fl_Color)48); - o->selection_color((Fl_Color)75); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(14); - o->labelcolor(FL_FOREGROUND_COLOR); - o->align(Fl_Align(FL_ALIGN_CENTER)); - o->when(FL_WHEN_RELEASE); - o->init(master,-1); - } // VUMeter* o - o->end(); - } // Fl_Group* o - { Fl_Check_Button* o = nrpnbutton = new Fl_Check_Button(45, 65, 47, 10, "NRPN"); - nrpnbutton->tooltip("Receive NRPNs"); - nrpnbutton->down_box(FL_DOWN_BOX); - nrpnbutton->labelsize(10); - nrpnbutton->callback((Fl_Callback*)cb_nrpnbutton); - o->value(master->ctl.NRPN.receive); - } // Fl_Check_Button* nrpnbutton - { Fl_Counter* o = npartcounter = new Fl_Counter(5, 247, 70, 23); - npartcounter->tooltip("The part number"); - npartcounter->type(1); - npartcounter->labelfont(1); - npartcounter->minimum(0); - npartcounter->maximum(127); - npartcounter->step(1); - npartcounter->value(1); - npartcounter->textfont(1); - npartcounter->callback((Fl_Callback*)cb_npartcounter); - o->bounds(1,NUM_MIDI_PARTS); - bankui->init(o); - } // Fl_Counter* npartcounter - { Fl_Button* o = new Fl_Button(292, 80, 35, 19, "vK"); - o->tooltip("Virtual Keyboard"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)231); - o->labeltype(FL_ENGRAVED_LABEL); - o->labelfont(1); - o->callback((Fl_Callback*)cb_vK); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(140, 65, 30, 10, "R.D."); - o->tooltip("Master fine detune reset"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_R); - } // Fl_Button* o - { WidgetPDial* o = globalfinedetuneslider = new WidgetPDial(143, 30, 20, 20, "F.Det."); - globalfinedetuneslider->tooltip("global fine detune"); - globalfinedetuneslider->box(FL_ROUND_UP_BOX); - globalfinedetuneslider->color(FL_BACKGROUND_COLOR); - globalfinedetuneslider->selection_color(FL_INACTIVE_COLOR); - globalfinedetuneslider->labeltype(FL_NORMAL_LABEL); - globalfinedetuneslider->labelfont(0); - globalfinedetuneslider->labelsize(10); - globalfinedetuneslider->labelcolor(FL_FOREGROUND_COLOR); - globalfinedetuneslider->maximum(127); - globalfinedetuneslider->step(1); - globalfinedetuneslider->value(64); - globalfinedetuneslider->callback((Fl_Callback*)cb_globalfinedetuneslider); - globalfinedetuneslider->align(Fl_Align(130)); - globalfinedetuneslider->when(FL_WHEN_CHANGED); - o->value(master->microtonal.Pglobalfinedetune); - } // WidgetPDial* globalfinedetuneslider - { Fl_Button* o = new Fl_Button(293, 62, 92, 16, "Panel Window"); - o->tooltip("Panel Window"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)183); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Panel); - } // Fl_Button* o - masterwindow->xclass("zynaddsubfx"); - masterwindow->end(); - } // Fl_Double_Window* masterwindow - { aboutwindow = new Fl_Double_Window(365, 280, "Copyright..."); - aboutwindow->user_data((void*)(this)); - { Fl_Box* o = new Fl_Box(15, 35, 335, 55, "Copyright (c) 2002-2009 Nasca O. PAUL and others. Please read AUTHORS.txt"); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelsize(15); - o->align(Fl_Align(192|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(15, 90, 335, 145, "This is free software; you may redistribute it and/or modify it under the ter\ -ms of the \nversion 2 (or any later version) of the GNU General Public License\ - as published by the Free Software Fundation.\n This program comes with\n ABS\ -OLUTELY NO WARRANTY. \n See the version 2 (or any later version) of the \nGNU \ -General Public License for details."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Button* o = new Fl_Button(80, 245, 190, 25, "Close this window"); - o->box(FL_THIN_UP_BOX); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Box* o = new Fl_Box(15, 5, 335, 30, "ZynAddSubFX"); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(20); - o->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); - } // Fl_Box* o - aboutwindow->end(); - } // Fl_Double_Window* aboutwindow - { syseffsendwindow = new Fl_Double_Window(120, 250, "System Effects Send"); - syseffsendwindow->user_data((void*)(this)); - { Fl_Scroll* o = new Fl_Scroll(0, 45, 120, 170); - o->box(FL_FLAT_BOX); - for (int neff1=0;neff1x()+(neff2-1)*35,o->y()+15+neff1*50,30,30);syseffsend[neff1][neff2]->label("aaa");syseffsend[neff1][neff2]->init(master,neff1,neff2);}; - o->end(); - Fl_Group::current()->resizable(o); - } // Fl_Scroll* o - { Fl_Button* o = new Fl_Button(25, 220, 80, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close1); - } // Fl_Button* o - { Fl_Box* o = new Fl_Box(5, 5, 110, 35, "Send system effect\'s output to other system effects"); - o->labelsize(10); - o->align(Fl_Align(192)); - } // Fl_Box* o - syseffsendwindow->end(); - } // Fl_Double_Window* syseffsendwindow - { panelwindow = new Fl_Double_Window(630, 635, "ZynAddSubFX Panel"); - panelwindow->user_data((void*)(this)); - { Fl_Scroll* o = new Fl_Scroll(0, 5, 570, 310); - o->type(1); - o->box(FL_THIN_UP_BOX); - { Fl_Pack* o = new Fl_Pack(5, 10, 560, 285); - o->type(1); - for (int i=0;iinit(master,i,bankui);} - o->end(); - } // Fl_Pack* o - o->end(); - } // Fl_Scroll* o - { Fl_Scroll* o = new Fl_Scroll(0, 320, 570, 310); - o->type(1); - o->box(FL_THIN_UP_BOX); - { Fl_Pack* o = new Fl_Pack(5, 325, 560, 285); - o->type(1); - for (int i=NUM_MIDI_PARTS/2;iinit(master,i,bankui);} - o->end(); - } // Fl_Pack* o - o->end(); - } // Fl_Scroll* o - { Fl_Button* o = new Fl_Button(575, 605, 50, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->labelsize(13); - o->callback((Fl_Callback*)cb_Close2); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(575, 570, 55, 25, "Refresh"); - o->box(FL_THIN_UP_BOX); - o->labelsize(13); - o->callback((Fl_Callback*)cb_Refresh); - } // Fl_Button* o - panelwindow->end(); - } // Fl_Double_Window* panelwindow - { simplemasterwindow = new Fl_Double_Window(600, 335, "ZynAddSubFX"); - simplemasterwindow->callback((Fl_Callback*)cb_simplemasterwindow, (void*)(this)); - { Fl_Menu_Bar* o = new Fl_Menu_Bar(0, 0, 690, 25); - o->menu(menu_); - } // Fl_Menu_Bar* o - { Fl_Group* o = simplelistitemgroup = new Fl_Group(125, 65, 215, 150); - simplelistitemgroup->box(FL_ENGRAVED_BOX); - { partname = new Fl_Button(130, 72, 205, 18); - partname->box(FL_PLASTIC_THIN_DOWN_BOX); - partname->down_box(FL_FLAT_BOX); - partname->color((Fl_Color)247); - partname->labelfont(1); - partname->labelsize(11); - partname->callback((Fl_Callback*)cb_partname1); - partname->align(Fl_Align(192|FL_ALIGN_INSIDE)); - } // Fl_Button* partname - { Fl_Slider* o = partpanning = new Fl_Slider(185, 95, 70, 15, "Pan"); - partpanning->type(5); - partpanning->box(FL_FLAT_BOX); - partpanning->maximum(127); - partpanning->step(1); - partpanning->value(64); - partpanning->callback((Fl_Callback*)cb_partpanning1); - o->value(master->part[npart]->Ppanning); - } // Fl_Slider* partpanning - { Fl_Choice* o = partrcv = new Fl_Choice(140, 157, 65, 18, "Midi Channel Receive"); - partrcv->tooltip("receive from Midi channel"); - partrcv->down_box(FL_BORDER_BOX); - partrcv->labelsize(10); - partrcv->textfont(1); - partrcv->callback((Fl_Callback*)cb_partrcv1); - partrcv->align(Fl_Align(130)); - char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Dr10");}; - o->value(master->part[npart]->Prcvchn); - } // Fl_Choice* partrcv - { WidgetPDial* o = partvolume = new WidgetPDial(145, 95, 30, 30); - partvolume->box(FL_OVAL_BOX); - partvolume->color(FL_BACKGROUND_COLOR); - partvolume->selection_color(FL_INACTIVE_COLOR); - partvolume->labeltype(FL_NORMAL_LABEL); - partvolume->labelfont(0); - partvolume->labelsize(14); - partvolume->labelcolor(FL_FOREGROUND_COLOR); - partvolume->maximum(127); - partvolume->step(1); - partvolume->callback((Fl_Callback*)cb_partvolume1); - partvolume->align(Fl_Align(FL_ALIGN_BOTTOM)); - partvolume->when(FL_WHEN_CHANGED); - o->value(master->part[npart]->Pvolume); - } // WidgetPDial* partvolume - { new Fl_Box(130, 125, 60, 15, "Volume"); - } // Fl_Box* o - { Fl_Check_Button* o = simplepartportamento = new Fl_Check_Button(260, 95, 75, 20, "Portamento"); - simplepartportamento->tooltip("Enable/Disable the portamento"); - simplepartportamento->down_box(FL_DOWN_BOX); - simplepartportamento->labelfont(1); - simplepartportamento->labelsize(10); - simplepartportamento->callback((Fl_Callback*)cb_simplepartportamento); - o->value(master->part[npart]->ctl.portamento.portamento); - } // Fl_Check_Button* simplepartportamento - { Fl_Counter* o = simpleminkcounter = new Fl_Counter(210, 158, 40, 15, "Min.key"); - simpleminkcounter->tooltip("Minimum key (that the part receives NoteOn messages)"); - simpleminkcounter->type(1); - simpleminkcounter->labelfont(1); - simpleminkcounter->labelsize(10); - simpleminkcounter->minimum(0); - simpleminkcounter->maximum(127); - simpleminkcounter->step(1); - simpleminkcounter->textsize(10); - simpleminkcounter->callback((Fl_Callback*)cb_simpleminkcounter); - o->value(master->part[npart]->Pminkey); - } // Fl_Counter* simpleminkcounter - { Fl_Counter* o = simplemaxkcounter = new Fl_Counter(255, 158, 40, 15, "Max.key"); - simplemaxkcounter->tooltip("Maximum key (that the part receives NoteOn messages)"); - simplemaxkcounter->type(1); - simplemaxkcounter->labelfont(1); - simplemaxkcounter->labelsize(10); - simplemaxkcounter->minimum(0); - simplemaxkcounter->maximum(127); - simplemaxkcounter->step(1); - simplemaxkcounter->textsize(10); - simplemaxkcounter->callback((Fl_Callback*)cb_simplemaxkcounter); - o->value(master->part[npart]->Pmaxkey); - } // Fl_Counter* simplemaxkcounter - { Fl_Button* o = new Fl_Button(230, 188, 15, 12, "m"); - o->tooltip("set the minimum key to the last pressed key"); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_m); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(260, 188, 15, 12, "M"); - o->tooltip("set the maximum key to the last pressed key"); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_M); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(245, 188, 15, 12, "R"); - o->tooltip("reset the minimum key to 0 and maximum key to 127"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_R1); - } // Fl_Button* o - { Fl_Counter* o = simplepartkeyshiftcounter = new Fl_Counter(240, 120, 90, 20, "KeyShift"); - simplepartkeyshiftcounter->labelsize(11); - simplepartkeyshiftcounter->minimum(-64); - simplepartkeyshiftcounter->maximum(64); - simplepartkeyshiftcounter->step(1); - simplepartkeyshiftcounter->callback((Fl_Callback*)cb_simplepartkeyshiftcounter); - o->lstep(12); - o->value(master->part[npart]->Pkeyshift-64); - } // Fl_Counter* simplepartkeyshiftcounter - { simplesyseffsend = new WidgetPDial(300, 160, 30, 30); - simplesyseffsend->box(FL_OVAL_BOX); - simplesyseffsend->color(FL_BACKGROUND_COLOR); - simplesyseffsend->selection_color(FL_INACTIVE_COLOR); - simplesyseffsend->labeltype(FL_NORMAL_LABEL); - simplesyseffsend->labelfont(0); - simplesyseffsend->labelsize(14); - simplesyseffsend->labelcolor(FL_FOREGROUND_COLOR); - simplesyseffsend->maximum(127); - simplesyseffsend->step(1); - simplesyseffsend->callback((Fl_Callback*)cb_simplesyseffsend); - simplesyseffsend->align(Fl_Align(FL_ALIGN_BOTTOM)); - simplesyseffsend->when(FL_WHEN_CHANGED); - } // WidgetPDial* simplesyseffsend - { new Fl_Box(295, 190, 40, 15, "Effect"); - } // Fl_Box* o - if (master->part[npart]->Penabled==0) o->deactivate(); - simplelistitemgroup->end(); - } // Fl_Group* simplelistitemgroup - { Fl_Check_Button* o = partenabled = new Fl_Check_Button(250, 40, 85, 20, "Enabled"); - partenabled->down_box(FL_DOWN_BOX); - partenabled->labeltype(FL_EMBOSSED_LABEL); - partenabled->labelfont(1); - partenabled->labelsize(13); - partenabled->callback((Fl_Callback*)cb_partenabled1); - partenabled->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE)); - //char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp); - o->value(master->part[npart]->Penabled); - } // Fl_Check_Button* partenabled - { VirKeys* o = virkeys = new VirKeys(5, 215, 590, 80, "Keyboard"); - virkeys->box(FL_BORDER_BOX); - virkeys->color((Fl_Color)17); - virkeys->selection_color(FL_BACKGROUND_COLOR); - virkeys->labeltype(FL_NORMAL_LABEL); - virkeys->labelfont(0); - virkeys->labelsize(14); - virkeys->labelcolor(FL_FOREGROUND_COLOR); - virkeys->align(Fl_Align(FL_ALIGN_CENTER)); - virkeys->when(FL_WHEN_RELEASE); - o->init(master); - } // VirKeys* virkeys - { Fl_Group* o = new Fl_Group(340, 30, 255, 185); - o->box(FL_ENGRAVED_BOX); - { Fl_Tabs* o = new Fl_Tabs(345, 35, 245, 175); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - { Fl_Group* o = new Fl_Group(345, 55, 245, 155, "System Effects"); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - o->labelsize(12); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - o->hide(); - { Fl_Counter* o = simplesyseffnocounter = new Fl_Counter(350, 75, 80, 20, "Sys.Effect No."); - simplesyseffnocounter->type(1); - simplesyseffnocounter->labelfont(1); - simplesyseffnocounter->labelsize(10); - simplesyseffnocounter->minimum(0); - simplesyseffnocounter->maximum(127); - simplesyseffnocounter->step(1); - simplesyseffnocounter->value(1); - simplesyseffnocounter->textfont(1); - simplesyseffnocounter->callback((Fl_Callback*)cb_simplesyseffnocounter); - simplesyseffnocounter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(1,NUM_SYS_EFX); - o->value(nsyseff+1); - } // Fl_Counter* simplesyseffnocounter - { Fl_Choice* o = simplesysefftype = new Fl_Choice(515, 80, 70, 15, "EffType"); - simplesysefftype->down_box(FL_BORDER_BOX); - simplesysefftype->labelsize(10); - simplesysefftype->callback((Fl_Callback*)cb_simplesysefftype); - simplesysefftype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - simplesysefftype->menu(menu_simplesysefftype); - o->value(master->sysefx[nsyseff]->geteffect()); - } // Fl_Choice* simplesysefftype - { simplesyseffectuigroup = new Fl_Group(350, 95, 235, 95); - simplesyseffectuigroup->box(FL_FLAT_BOX); - simplesyseffectuigroup->color((Fl_Color)48); - { SimpleEffUI* o = simplesyseffectui = new SimpleEffUI(350, 95, 234, 95); - simplesyseffectui->box(FL_NO_BOX); - simplesyseffectui->color(FL_BACKGROUND_COLOR); - simplesyseffectui->selection_color(FL_BACKGROUND_COLOR); - simplesyseffectui->labeltype(FL_NORMAL_LABEL); - simplesyseffectui->labelfont(0); - simplesyseffectui->labelsize(14); - simplesyseffectui->labelcolor(FL_FOREGROUND_COLOR); - simplesyseffectui->align(Fl_Align(FL_ALIGN_TOP)); - simplesyseffectui->when(FL_WHEN_RELEASE); - o->init(master->sysefx[nsyseff]); - simplesyseffectui->end(); - } // SimpleEffUI* simplesyseffectui - simplesyseffectuigroup->end(); - } // Fl_Group* simplesyseffectuigroup - { Fl_Button* o = new Fl_Button(435, 75, 75, 20, "Send to..."); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Send1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(560, 65, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P2); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(345, 55, 245, 155, "Insertion Effects"); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - o->labelsize(12); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - { Fl_Counter* o = simpleinseffnocounter = new Fl_Counter(350, 75, 80, 20, "Ins.Effect No."); - simpleinseffnocounter->type(1); - simpleinseffnocounter->labelfont(1); - simpleinseffnocounter->labelsize(10); - simpleinseffnocounter->minimum(0); - simpleinseffnocounter->maximum(127); - simpleinseffnocounter->step(1); - simpleinseffnocounter->value(1); - simpleinseffnocounter->textfont(1); - simpleinseffnocounter->callback((Fl_Callback*)cb_simpleinseffnocounter); - simpleinseffnocounter->align(Fl_Align(FL_ALIGN_TOP)); - o->bounds(1,NUM_INS_EFX); - o->value(ninseff+1); - } // Fl_Counter* simpleinseffnocounter - { Fl_Choice* o = simpleinsefftype = new Fl_Choice(515, 80, 70, 15, "EffType"); - simpleinsefftype->down_box(FL_BORDER_BOX); - simpleinsefftype->labelsize(10); - simpleinsefftype->callback((Fl_Callback*)cb_simpleinsefftype); - simpleinsefftype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - simpleinsefftype->menu(menu_simpleinsefftype); - o->value(master->insefx[ninseff]->geteffect()); - if (master->Pinsparts[ninseff]== -1) o->deactivate(); - } // Fl_Choice* simpleinsefftype - { simpleinseffectuigroup = new Fl_Group(350, 95, 234, 95); - simpleinseffectuigroup->box(FL_FLAT_BOX); - simpleinseffectuigroup->color((Fl_Color)48); - { SimpleEffUI* o = simpleinseffectui = new SimpleEffUI(350, 95, 234, 95); - simpleinseffectui->box(FL_NO_BOX); - simpleinseffectui->color(FL_BACKGROUND_COLOR); - simpleinseffectui->selection_color(FL_BACKGROUND_COLOR); - simpleinseffectui->labeltype(FL_NORMAL_LABEL); - simpleinseffectui->labelfont(0); - simpleinseffectui->labelsize(14); - simpleinseffectui->labelcolor(FL_FOREGROUND_COLOR); - simpleinseffectui->align(Fl_Align(FL_ALIGN_TOP)); - simpleinseffectui->when(FL_WHEN_RELEASE); - o->init(master->insefx[ninseff]); - if (master->Pinsparts[ninseff]== -1) o->deactivate(); - simpleinseffectui->end(); - } // SimpleEffUI* simpleinseffectui - simpleinseffectuigroup->end(); - } // Fl_Group* simpleinseffectuigroup - { Fl_Choice* o = simpleinseffpart = new Fl_Choice(435, 75, 80, 20, "Insert To."); - simpleinseffpart->down_box(FL_BORDER_BOX); - simpleinseffpart->labelfont(1); - simpleinseffpart->labelsize(10); - simpleinseffpart->textsize(10); - simpleinseffpart->callback((Fl_Callback*)cb_simpleinseffpart); - simpleinseffpart->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("Master Out");o->add("Off"); - char tmp[50]; for (int i=0;iadd(tmp);}; - o->value(master->Pinsparts[ninseff]+2); - } // Fl_Choice* simpleinseffpart - { Fl_Button* o = new Fl_Button(560, 65, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P3); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - o->end(); - } // Fl_Tabs* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(5, 300, 590, 30); - o->box(FL_ENGRAVED_FRAME); - { VUMeter* o = new VUMeter(5, 300, 590, 30, "VU-Meter"); - o->box(FL_FLAT_BOX); - o->color((Fl_Color)41); - o->selection_color((Fl_Color)75); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(14); - o->labelcolor(FL_FOREGROUND_COLOR); - o->align(Fl_Align(FL_ALIGN_CENTER)); - o->when(FL_WHEN_RELEASE); - o->init(master,-1); - } // VUMeter* o - o->end(); - } // Fl_Group* o - { WidgetPDial* o = simplemastervolumedial = new WidgetPDial(10, 35, 40, 40, "Master Volume"); - simplemastervolumedial->tooltip("Master Volume"); - simplemastervolumedial->box(FL_ROUND_UP_BOX); - simplemastervolumedial->color(FL_BACKGROUND_COLOR); - simplemastervolumedial->selection_color(FL_INACTIVE_COLOR); - simplemastervolumedial->labeltype(FL_NORMAL_LABEL); - simplemastervolumedial->labelfont(1); - simplemastervolumedial->labelsize(11); - simplemastervolumedial->labelcolor(FL_FOREGROUND_COLOR); - simplemastervolumedial->maximum(127); - simplemastervolumedial->step(1); - simplemastervolumedial->callback((Fl_Callback*)cb_simplemastervolumedial); - simplemastervolumedial->align(Fl_Align(130)); - simplemastervolumedial->when(FL_WHEN_CHANGED); - o->value(master->Pvolume); - } // WidgetPDial* simplemastervolumedial - { Fl_Counter* o = simplemasterkeyshiftcounter = new Fl_Counter(25, 110, 90, 20, "Master KeyShift"); - simplemasterkeyshiftcounter->labelsize(11); - simplemasterkeyshiftcounter->minimum(-64); - simplemasterkeyshiftcounter->maximum(64); - simplemasterkeyshiftcounter->step(1); - simplemasterkeyshiftcounter->callback((Fl_Callback*)cb_simplemasterkeyshiftcounter); - o->lstep(12); - o->value(master->Pkeyshift-64); - } // Fl_Counter* simplemasterkeyshiftcounter - { Fl_Button* o = new Fl_Button(5, 149, 115, 31, "Stop ALL sounds!"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)231); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Stop); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(70, 32, 50, 10, "Reset"); - o->tooltip("Master fine detune reset"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Reset); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - { WidgetPDial* o = simpleglobalfinedetuneslider = new WidgetPDial(80, 45, 30, 30, "Fine Detune"); - simpleglobalfinedetuneslider->tooltip("global fine detune"); - simpleglobalfinedetuneslider->box(FL_ROUND_UP_BOX); - simpleglobalfinedetuneslider->color(FL_BACKGROUND_COLOR); - simpleglobalfinedetuneslider->selection_color(FL_INACTIVE_COLOR); - simpleglobalfinedetuneslider->labeltype(FL_NORMAL_LABEL); - simpleglobalfinedetuneslider->labelfont(0); - simpleglobalfinedetuneslider->labelsize(11); - simpleglobalfinedetuneslider->labelcolor(FL_FOREGROUND_COLOR); - simpleglobalfinedetuneslider->maximum(127); - simpleglobalfinedetuneslider->step(1); - simpleglobalfinedetuneslider->value(64); - simpleglobalfinedetuneslider->callback((Fl_Callback*)cb_simpleglobalfinedetuneslider); - simpleglobalfinedetuneslider->align(Fl_Align(130)); - simpleglobalfinedetuneslider->when(FL_WHEN_CHANGED); - o->value(master->microtonal.Pglobalfinedetune); - } // WidgetPDial* simpleglobalfinedetuneslider - { Fl_Counter* o = simplenpartcounter = new Fl_Counter(170, 40, 70, 20, "Part"); - simplenpartcounter->tooltip("The part number"); - simplenpartcounter->type(1); - simplenpartcounter->labelfont(1); - simplenpartcounter->minimum(0); - simplenpartcounter->maximum(127); - simplenpartcounter->step(1); - simplenpartcounter->value(1); - simplenpartcounter->textfont(1); - simplenpartcounter->callback((Fl_Callback*)cb_simplenpartcounter); - simplenpartcounter->align(Fl_Align(FL_ALIGN_LEFT)); - o->bounds(1,NUM_MIDI_PARTS); - } // Fl_Counter* simplenpartcounter - { Fl_Counter* o = new Fl_Counter(5, 195, 55, 20, "Keyb.Oct."); - o->tooltip("Midi Octave"); - o->type(1); - o->labelsize(11); - o->minimum(0); - o->maximum(5); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Keyb); - o->align(Fl_Align(FL_ALIGN_RIGHT)); - o->when(FL_WHEN_RELEASE_ALWAYS); - o->value(virkeys->midioct); - } // Fl_Counter* o - simplemasterwindow->end(); - } // Fl_Double_Window* simplemasterwindow - { selectuiwindow = new Fl_Double_Window(430, 250, "User Interface mode"); - selectuiwindow->callback((Fl_Callback*)cb_selectuiwindow, (void*)(this)); - { Fl_Box* o = new Fl_Box(5, 5, 425, 40, "Welcome to ZynAddSubFX"); - o->labeltype(FL_SHADOW_LABEL); - o->labelfont(1); - o->labelsize(26); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(10, 50, 265, 25, "Please choose the interface mode:"); - o->labelfont(1); - o->labelsize(13); - } // Fl_Box* o - { Fl_Button* o = new Fl_Button(10, 165, 100, 35, "Advanced"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)229); - o->labelfont(1); - o->labelsize(16); - o->callback((Fl_Callback*)cb_Advanced); - } // Fl_Button* o - { Fl_Box* o = new Fl_Box(110, 165, 310, 35, ".. if you have used ZynAddSubFX before, or you like to have full controll to \ -all parameters."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Button* o = new Fl_Button(10, 80, 100, 65, "Beginner"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)238); - o->labelfont(1); - o->labelsize(16); - o->callback((Fl_Callback*)cb_Beginner); - } // Fl_Button* o - { Fl_Box* o = new Fl_Box(110, 75, 320, 75, "..if you are a beginner, you prefer using presets or you prefer to use simple\ -r user interfaces. Most functionality of ZynAddSubFX will be hidden in this mo\ -de to make simple the learning/using it."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(30, 215, 360, 25, "You can switch the interface modes anytime you want."); - o->box(FL_BORDER_BOX); - o->color((Fl_Color)51); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - } // Fl_Box* o - selectuiwindow->set_non_modal(); - selectuiwindow->end(); - } // Fl_Double_Window* selectuiwindow - return selectuiwindow; -} - -void MasterUI::updatesendwindow() { - for (int neff1=0;neff1value(master->Psysefxsend[neff1][neff2]); -} - -void MasterUI::updatepanel() { - for (int npart=0;npartrefresh(); - }; -} - -void MasterUI::setfilelabel(const char *filename) { - if (filename!=NULL) snprintf(&masterwindowlabel[0],100,"%s - ZynAddSubFX",fl_filename_name(filename)); - else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX"); - masterwindowlabel[99]='\0'; - masterwindow->label(&masterwindowlabel[0]); - simplemasterwindow->label(&masterwindowlabel[0]); -} - -MasterUI::MasterUI(Master *master_,int *exitprogram_) { - master=master_; - exitprogram=exitprogram_; - ninseff=0; - nsyseff=0; - npart=0; - - for (int i=0;imicrotonal); - virkeyboard=new VirKeyboard(master); - bankui=new BankUI(master,&npart); - configui=new ConfigUI(); - sequi=new SeqUI(master); - - make_window(); - #ifdef OS_WINDOWS - masterwindow->icon((char *)LoadIcon(GetModuleHandle(NULL), "zynaddsubfx_icon")); - #endif - presetsui=new PresetsUI(); - setfilelabel(NULL); - swapefftype=0; - simplerefresh(); -} - -MasterUI::~MasterUI() { - masterwindow->hide(); - delete masterwindow; - simplemasterwindow->hide(); - delete simplemasterwindow; - aboutwindow->hide(); - delete aboutwindow; - syseffsendwindow->hide(); - delete syseffsendwindow; - - delete virkeyboard; - delete microtonalui; - delete bankui; - delete configui; - delete sequi; - - delete presetsui; - delete panelwindow; - delete selectuiwindow; -} - -void MasterUI::showUI() { - switch (config.cfg.UserInterfaceMode){ - case 0:selectuiwindow->show(); - break; - case 1:masterwindow->show(); - break; - case 2:simplemasterwindow->show(); - break; - }; -} - -void MasterUI::simplerefresh() { - partenabled->value(master->part[npart]->Penabled); - if (master->part[npart]->Penabled!=0) simplelistitemgroup->activate(); - else simplelistitemgroup->deactivate(); - - partvolume->value(master->part[npart]->Pvolume); - partpanning->value(master->part[npart]->Ppanning); - partrcv->value(master->part[npart]->Prcvchn); - - if (master->part[npart]->Pname[0]!=0) partname->label((char *)master->part[npart]->Pname); - else partname->label("Click here to load a instrument"); - - simplelistitemgroup->redraw(); - simplepartportamento->value(master->part[npart]->ctl.portamento.portamento); - simpleminkcounter->value(master->part[npart]->Pminkey); - simplemaxkcounter->value(master->part[npart]->Pmaxkey); - - simplepartkeyshiftcounter->value(master->part[npart]->Pkeyshift-64); - simplesyseffsend->value(master->Psysefxvol[nsyseff][npart]); -} - -void MasterUI::do_new_master() { - if (fl_choice("Clear *ALL* the parameters ?","No","Yes",NULL)){ - delete microtonalui; - - pthread_mutex_lock(&master->mutex); - master->defaults(); - pthread_mutex_unlock(&master->mutex); - - npartcounter->value(1); - refresh_master_ui(); - - }; - - updatepanel(); -} - -void MasterUI::do_load_master(const char* file ) { - const char *filename; - if (file == NULL) { - filename=fl_file_chooser("Open:","({*.xmz})",NULL,0); - if (filename==NULL) return; - } - else { - filename = file; - } - - - pthread_mutex_lock(&master->mutex); - //clear all parameters - master->defaults(); - - //load the data - int result=master->loadXML(filename); - pthread_mutex_unlock(&master->mutex); - master->applyparameters(); - - npartcounter->value(1); - refresh_master_ui(); - updatepanel(); - if (result>=0) setfilelabel(filename); - - - if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not a zynaddsubfx parameters file."); - else if (result<0) fl_alert("Error: Could not load the file."); -} - -void MasterUI::do_save_master(const char* file ) { - const char *filename; - char *tmp; - int result=0; - if (file == NULL) { - tmp=fl_file_chooser("Save:","({*.xmz})",NULL,0); - if (tmp==NULL) return; - tmp=fl_filename_setext(tmp,".xmz"); - filename=tmp; - result=fileexists(tmp); - if (result) { - result=0; - if (!fl_choice("The file exists. Overwrite it?","No","Yes",NULL)) return; - - } - } - else { - filename = file; - } - - - pthread_mutex_lock(&master->mutex); - result=master->saveXML(filename); - pthread_mutex_unlock(&master->mutex); - - if (result<0) fl_alert("Error: Could not save the file."); - else setfilelabel(filename); - - updatepanel(); -} - -void MasterUI::refresh_master_ui() { - ninseff=0; - nsyseff=0; - npart=0; - - //the Master UI - npartcounter->do_callback(); - syseffnocounter->do_callback(); - inseffnocounter->do_callback(); - masterkeyshiftcounter->value(master->Pkeyshift-64); - mastervolumedial->value(master->Pvolume); - globalfinedetuneslider->value(master->microtonal.Pglobalfinedetune); - microtonalui=new MicrotonalUI(&master->microtonal); - nrpnbutton->value(master->ctl.NRPN.receive); - updatesendwindow(); - updatepanel(); - - //the simle MasterUI - simplenpartcounter->value(1); - simplesyseffnocounter->value(1); - simpleinseffnocounter->value(1); - simplenpartcounter->do_callback(); - simplesyseffnocounter->do_callback(); - simpleinseffnocounter->do_callback(); - simplemasterkeyshiftcounter->value(master->Pkeyshift-64); - simplemastervolumedial->value(master->Pvolume); - simpleglobalfinedetuneslider->value(master->microtonal.Pglobalfinedetune); - virkeys->midich=master->part[npart]->Prcvchn; - - simplerefresh(); - bankui->hide(); -} diff --git a/plugins/zynaddsubfx/src/UI/MasterUI.fl b/plugins/zynaddsubfx/src/UI/MasterUI.fl deleted file mode 100644 index b97b77326..000000000 --- a/plugins/zynaddsubfx/src/UI/MasterUI.fl +++ /dev/null @@ -1,1815 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2009 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "ADnoteUI.h"} {public -} - -decl {\#include "SUBnoteUI.h"} {public -} - -decl {\#include "EffUI.h"} {public -} - -decl {\#include "VirKeyboard.h"} {public -} - -decl {\#include "ConfigUI.h"} {public -} - -decl {\#include "BankUI.h"} {public -} - -decl {\#include "PartUI.h"} {public -} - -decl {\#include "MicrotonalUI.h"} {public -} - -decl {\#include "SeqUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Part.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../globals.h"} {public -} - -class VUMeter {: {public Fl_Box} -} { - Function {VUMeter(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {master=NULL; -npart=-1;} {} - } - Function {init(Master *master_,int part_)} {} { - code {//the "part_" parameters sets the part (if it is >=0), else it sets the master -master=master_; -label(NULL); -npart=part_; -olddbl=0.0; -olddbr=0.0; -oldrmsdbl=0.0; -oldrmsdbr=0.0;} {} - } - Function {draw_master()} {} { - code {\#define MIN_DB (-48) - -int ox=x(); int oy=y(); int lx=w(); int ly=h(); - -pthread_mutex_lock(&master->mutex); -REALTYPE dbl=rap2dB(master->vuoutpeakl); -REALTYPE dbr=rap2dB(master->vuoutpeakr); -REALTYPE rmsdbl=rap2dB(master->vurmspeakl); -REALTYPE rmsdbr=rap2dB(master->vurmspeakr); -REALTYPE maxdbl=rap2dB(master->vumaxoutpeakl); -REALTYPE maxdbr=rap2dB(master->vumaxoutpeakr); -int clipped=master->vuclipped; -pthread_mutex_unlock(&master->mutex); - -dbl=(MIN_DB-dbl)/MIN_DB; -if (dbl<0.0) dbl=0.0; - else if (dbl>1.0)dbl=1.0; - -dbr=(MIN_DB-dbr)/MIN_DB; -if (dbr<0.0) dbr=0.0; - else if (dbr>1.0) dbr=1.0; - -dbl=dbl*0.4+olddbl*0.6; -dbr=dbr*0.4+olddbr*0.6; - -olddbl=dbl; -olddbr=dbr; - -\#define VULENX (lx-35) -\#define VULENY (ly/2-3) - -dbl*=VULENX;dbr*=VULENX; - -int idbl=(int) dbl; -int idbr=(int) dbr; - -//compute RMS - start -rmsdbl=(MIN_DB-rmsdbl)/MIN_DB; -if (rmsdbl<0.0) rmsdbl=0.0; - else if (rmsdbl>1.0) rmsdbl=1.0; - -rmsdbr=(MIN_DB-rmsdbr)/MIN_DB; -if (rmsdbr<0.0) rmsdbr=0.0; - else if (rmsdbr>1.0) rmsdbr=1.0; - -rmsdbl=rmsdbl*0.4+oldrmsdbl*0.6; -rmsdbr=rmsdbr*0.4+oldrmsdbr*0.6; - -oldrmsdbl=rmsdbl; -oldrmsdbr=rmsdbr; - - -rmsdbl*=VULENX;rmsdbr*=VULENX; - -int irmsdbl=(int) rmsdbl; -int irmsdbr=(int) rmsdbr; -//compute RMS - end - - - -//draw the vu-meter lines -//db -fl_rectf(ox,oy,idbr,VULENY,0,200,255); -fl_rectf(ox,oy+ly/2,idbl,VULENY,0,200,255); -//black -fl_rectf(ox+idbr,oy,VULENX-idbr,VULENY,0,0,0); -fl_rectf(ox+idbl,oy+ly/2,VULENX-idbl,VULENY,0,0,0); - -//draw the scales -REALTYPE tmp=VULENX*1.0/MIN_DB; -for (int i=1;i<1-MIN_DB;i++){ - int tx=VULENX+(int) (tmp*i); - fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,160,200); - if (i%5==0) fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,230,240); - if (i%10==0) fl_rectf(ox+tx-1,oy,2,VULENY+ly/2,0,225,255); -}; - -//rms -if (irmsdbr>2) fl_rectf(ox+irmsdbr-1,oy,3,VULENY,255,255,0); -if (irmsdbl>2) fl_rectf(ox+irmsdbl-1,oy+ly/2,3,VULENY,255,255,0); - - -//draw the red box if clipping has occured -if (clipped==0) fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,0,0,10); - else fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,250,10,10); - -//draw the maxdB -fl_font(FL_HELVETICA|FL_BOLD,10); -fl_color(255,255,255); -char tmpstr[10]; -if ((maxdbl>MIN_DB-20)){ - snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbr); - fl_draw(tmpstr,ox+VULENX+1,oy+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0); -}; -if ((maxdbr>MIN_DB-20)){ - snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbl); - fl_draw(tmpstr,ox+VULENX+1,oy+ly/2+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0); -};} {} - } - Function {draw_part()} {} { - code {\#define MIN_DB (-48) -int ox=x(); int oy=y(); int lx=w(); int ly=h(); - -if (!active_r()){ - pthread_mutex_lock(&master->mutex); - int fakedb=master->fakepeakpart[npart]; - pthread_mutex_unlock(&master->mutex); - fl_rectf(ox,oy,lx,ly,140,140,140); - if (fakedb>0){ - fakedb=(int)(fakedb/255.0*ly)+4; - fl_rectf(ox+2,oy+ly-fakedb,lx-4,fakedb,0,0,0); - }; - - return; -}; - -//draw the vu lines -pthread_mutex_lock(&master->mutex); - REALTYPE db=rap2dB(master->vuoutpeakpart[npart]); -pthread_mutex_unlock(&master->mutex); - -db=(MIN_DB-db)/MIN_DB; -if (db<0.0) db=0.0; - else if (db>1.0) db=1.0; - -db*=ly-2; - -int idb=(int) db; - -fl_rectf(ox,oy+ly-idb,lx,idb,0,200,255); -fl_rectf(ox,oy,lx,ly-idb,0,0,0); - - -//draw the scales -REALTYPE tmp=ly*1.0/MIN_DB; - for (int i=1;i<1-MIN_DB;i++){ - int ty=ly+(int) (tmp*i); - if (i%5==0) fl_rectf(ox,oy+ly-ty,lx,1,0,160,200); - if (i%10==0) fl_rectf(ox,oy+ly-ty,lx,1,0,230,240); -};} {} - } - Function {draw()} {} { - code {if (npart>=0) draw_part(); - else draw_master();} {} - } - Function {tickdraw(VUMeter *o)} {return_type {static void} - } { - code {o->redraw();} {} - } - Function {tick(void *v)} {return_type {static void} - } { - code {tickdraw((VUMeter *) v); -Fl::add_timeout(1.0/25.0,tick,v);//25 fps} {} - } - Function {handle(int event)} {return_type int - } { - code {switch(event){ - case FL_SHOW: - tick(this); - break; - case FL_HIDE: - Fl::remove_timeout(tick,this); - break; - case FL_PUSH: - if (npart>=0) break; - pthread_mutex_lock(&master->mutex); - master->vuresetpeaks(); - pthread_mutex_unlock(&master->mutex); - break; -}; -return(1);} {} - } - decl {Master *master;} {} - decl {int npart;} {} - decl {float olddbl,olddbr;} {} - decl {float oldrmsdbl,oldrmsdbr;} {} -} - -class SysEffSend {: {public WidgetPDial} -} { - Function {SysEffSend(int x,int y, int w, int h, const char *label=0):WidgetPDial(x,y,w,h,label)} {} { - code {master=NULL; -neff1=0; -neff2=0;} {} - } - Function {init(Master *master_,int neff1_,int neff2_)} {} { - code {neff1=neff1_; -neff2=neff2_; -master=master_; -minimum(0); -maximum(127); -step(1); -labelfont(1); -labelsize(10); -align(FL_ALIGN_TOP); - -value(master->Psysefxsend[neff1][neff2]); -char tmp[20];snprintf(tmp,20,"%d->%d",neff1+1,neff2+1); -this->copy_label(tmp);} {} - } - Function {~SysEffSend()} {} { - code {hide();} {} - } - Function {handle(int event)} {return_type int - } { - code {if ((event==FL_PUSH) || (event==FL_DRAG)){ - master->setPsysefxsend(neff1,neff2,(int) value()); -}; - -return(WidgetPDial::handle(event));} {} - } - decl {Master *master;} {} - decl {int neff1;} {} - decl {int neff2;} {} -} - -class Panellistitem {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window panellistitem { - private xywh {315 213 70 260} type Double hide - class Fl_Group - } { - Fl_Group panellistitemgroup { - private xywh {0 20 70 240} box PLASTIC_THIN_UP_BOX - code0 {if (master->part[npart]->Penabled==0) o->deactivate();} - } { - Fl_Group {} { - xywh {45 65 15 110} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {V U} - xywh {45 65 15 110} box FLAT_BOX color 0 selection_color 75 labelcolor 55 align 128 - code0 {o->init(master,npart);} - class VUMeter - } - } - Fl_Button partname { - label { } - callback {if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -bankui->show();} - xywh {5 27 60 30} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 10 align 208 - } - Fl_Slider partvolume { - callback {master->part[npart]->setPvolume((int) o->value());} - xywh {10 65 30 110} type {Vert Knob} box FLAT_BOX minimum 127 maximum 0 step 1 value 127 - code0 {o->value(master->part[npart]->Pvolume);} - } - Fl_Dial partpanning { - callback {master->part[npart]->setPpanning((int) o->value());} - xywh {20 180 30 30} maximum 127 step 1 - code0 {o->value(master->part[npart]->Ppanning);} - class WidgetPDial - } - Fl_Button {} { - label edit - callback {if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -};} - xywh {15 235 40 20} box PLASTIC_UP_BOX labelsize 10 - } - Fl_Choice partrcv { - callback {master->part[npart]->Prcvchn=(int) o->value();} - tooltip {receive from Midi channel} xywh {10 213 50 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Dr10");};} - code1 {o->value(master->part[npart]->Prcvchn);} - } {} - } - Fl_Check_Button partenabled { - label 01 - callback {pthread_mutex_lock(&master->mutex); - master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if ((int) o->value()==0) panellistitemgroup->deactivate(); - else { - panellistitemgroup->activate(); - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); - }; -}; - -o->redraw();} - private xywh {5 0 45 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 24 - code0 {char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);} - code1 {o->value(master->part[npart]->Penabled);} - } - } - } - Function {Panellistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {npart=0; -master=NULL; -bankui=NULL;} {} - } - Function {init(Master *master_, int npart_,BankUI *bankui_)} {} { - code {npart=npart_; -master=master_; -bankui=bankui_; - -make_window(); -panellistitem->show(); -end();} {} - } - Function {refresh()} {} { - code {partenabled->value(master->part[npart]->Penabled); -if (master->part[npart]->Penabled!=0) panellistitemgroup->activate(); - else panellistitemgroup->deactivate(); - -partvolume->value(master->part[npart]->Pvolume); -partpanning->value(master->part[npart]->Ppanning); -partrcv->value(master->part[npart]->Prcvchn); - -partname->label((char *)master->part[npart]->Pname); - -if ((int)bankui->cbwig->value()!=(npart+1)) - panellistitemgroup->color(fl_rgb_color(160,160,160)); -else - panellistitemgroup->color(fl_rgb_color(50,190,240)); - -panellistitemgroup->redraw();} {} - } - Function {~Panellistitem()} {} { - code {panellistitem->hide(); -//delete(panellistitem);} {} - } - decl {int npart;} {} - decl {Master *master;} {} - decl {BankUI *bankui;} {} -} - -class MasterUI {} { - Function {make_window()} {} { - Fl_Window masterwindow { - label zynaddsubfx - callback {\#ifdef VSTAUDIOOUT -fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it."); -\#else -//if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) { - config.save(); - *exitprogram=1; -//}; -\#endif} - xywh {585 104 390 465} type Double xclass zynaddsubfx visible - } { - Fl_Menu_Bar mastermenu { - xywh {-5 0 690 25} - } { - Submenu {} { - label {&File} - xywh {0 0 100 20} - } { - MenuItem {} { - label {&New (erase all)...} - callback {do_new_master();} - xywh {20 20 100 20} - } - MenuItem {} { - label {&Open Parameters...} - callback {do_load_master();} - xywh {20 20 100 20} - } - MenuItem {} { - label {&Save All Parameters...} - callback {do_save_master();} - xywh {10 10 100 20} divider - } - MenuItem {} { - label {&Load Scale Settings...} - callback {char *filename; -filename=fl_file_chooser("Open:","({*.xsz})",NULL,0); -if (filename==NULL) return; - -pthread_mutex_lock(&master->mutex); - //clear all parameters - master->microtonal.defaults(); - - //load the data - int result=master->microtonal.loadXML(filename); -pthread_mutex_unlock(&master->mutex); - - - delete microtonalui; - microtonalui=new MicrotonalUI(&master->microtonal); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a scale file."); - else if (result<0) fl_alert("Error: Could not load the file.");} - xywh {35 35 100 20} - } - MenuItem {} { - label {Save Sc&ale Settings ..} - callback {char *filename; -int result=0; - -filename=fl_file_chooser("Save:","({*.xsz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xsz"); - -result=fileexists(filename); -if (result) { - result=0; - if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return; - -}; - - -pthread_mutex_lock(&master->mutex); -result=master->microtonal.saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - - -updatepanel();} - xywh {25 25 100 20} - } - MenuItem {} { - label {Show Scale Settings...} - callback {microtonalui->show();} - xywh {0 0 100 20} divider - } - MenuItem {} { - label {&Settings...} - callback {configui->show();} - xywh {25 25 100 20} divider - } - MenuItem {} { - label {&Copyright...} - callback {aboutwindow->show();} - xywh {15 15 100 20} divider - } - MenuItem {} { - label {E&xit} - callback {masterwindow->do_callback();} - xywh {10 10 100 20} - } - } - Submenu {} { - label {&Instrument} - xywh {10 10 100 20} - } { - MenuItem {} { - label {&Clear Instrument...} - callback {if (fl_choice("Clear instrument's parameters ?","No","Yes",NULL)){ -// int npart=(int)npartcounter->value()-1; - pthread_mutex_lock(&master->mutex); - master->part[npart]->defaultsinstrument(); - pthread_mutex_unlock(&master->mutex); - - npartcounter->do_callback(); -}; - -updatepanel();} - xywh {35 35 100 20} - } - MenuItem {} { - label {&Open Instrument...} - callback {const char *filename; -filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); -if (filename==NULL) return; - - -pthread_mutex_lock(&master->mutex); -// int npart=(int)npartcounter->value()-1; - - //clear all instrument parameters, first - master->part[npart]->defaultsinstrument(); - - //load the instr. parameters - int result=master->part[npart]->loadXMLinstrument(filename); - -pthread_mutex_unlock(&master->mutex); -master->part[npart]->applyparameters(); - -npartcounter->do_callback(); -updatepanel(); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file."); - else if (result<0) fl_alert("Error: Could not load the file.");} - xywh {30 30 100 20} - } - MenuItem {} { - label {&Save Instrument ...} - callback {char *filename; - -filename=fl_file_chooser("Save:","({*.xiz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xiz"); - -int result=fileexists(filename); -if (result) { - result=0; - if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return; - -}; - - -pthread_mutex_lock(&master->mutex); -result=master->part[npart]->saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - -updatepanel();} - xywh {20 20 100 20} divider - } - MenuItem {} { - label {Show Instrument &Bank...} - callback {bankui->show();} - xywh {0 0 100 20} divider - } - MenuItem {} { - label {&Virtual Keyboard...} - callback {virkeyboard->show();} - xywh {10 10 100 20} - } - } - Submenu recordmenu { - label {&Record} - xywh {0 0 100 20} - } { - MenuItem {} { - label {&Choose WAV file...} - callback {char *filename; -recordbutton->deactivate(); -pausebutton->deactivate(); -pauselabel->deactivate(); -stopbutton->deactivate(); -filename=fl_file_chooser("Record to audio file:","(*.wav)",NULL,0); -if (filename==NULL) return; -fl_filename_setext(filename,".wav"); - -int result=master->HDDRecorder.preparefile(filename,0); -if (result==1) { - result=0; - if (fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) - master->HDDRecorder.preparefile(filename,1); -}; -if (result==0) recordbutton->activate(); - -if (result!=0) fl_alert("Error: Could not save the file.");} - xywh {0 0 100 20} - } - } - Submenu {} { - label {&Sequencer} - xywh {0 0 100 20} hide - } { - MenuItem {} { - label {Show &Sequencer...} - callback {sequi->show();} - xywh {0 0 100 20} - } - } - Submenu {} { - label Misc - xywh {10 10 100 20} - } { - MenuItem {} { - label {Switch User Interface Mode} - callback {if (fl_choice("Switch the User Interface to Beginner mode ?","No","Yes",NULL)){ - masterwindow->hide(); - refresh_master_ui(); - simplemasterwindow->show(); - config.cfg.UserInterfaceMode=2; -};} - xywh {10 10 100 20} - } - } - } - Fl_Dial mastervolumedial { - label {M.Vol} - callback {master->setPvolume((int) o->value());} - tooltip {Master Volume} xywh {5 30 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 align 130 maximum 127 step 1 - code0 {o->value(master->Pvolume);} - class WidgetPDial - } - Fl_Counter masterkeyshiftcounter { - label {Master KeyShift} - callback {master->setPkeyshift((int) o->value()+64);} - xywh {45 31 90 20} labelsize 11 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(master->Pkeyshift-64);} - } - Fl_Button {} { - label {Panic!} - callback {virkeyboard->relaseallkeys(); -pthread_mutex_lock(&master->mutex); -master->shutup=1; -pthread_mutex_unlock(&master->mutex);} - xywh {293 29 92 31} box PLASTIC_UP_BOX color 231 labelfont 1 - } - Fl_Group partuigroup { - xywh {0 242 390 183} box ENGRAVED_FRAME - } { - Fl_Group partui { - xywh {4 245 383 175} box FLAT_BOX - code0 {o->init(master->part[0],master,0,bankui);} - code1 {o->show();} - class PartUI - } {} - } - Fl_Tabs {} { - xywh {0 80 390 160} - } { - Fl_Group {} { - label {System Effects} - xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 15 align 25 - } { - Fl_Counter syseffnocounter { - label {Sys.Effect No.} - callback {nsyseff=(int) o->value()-1; -sysefftype->value(master->sysefx[nsyseff]->geteffect()); -syseffectui->refresh(master->sysefx[nsyseff]);} - xywh {5 120 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_SYS_EFX);} - code1 {o->value(nsyseff+1);} - } - Fl_Choice sysefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->sysefx[nsyseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -syseffectui->refresh(master->sysefx[nsyseff]);} - xywh {315 125 70 15} down_box BORDER_BOX labelsize 10 - code0 {o->value(master->sysefx[nsyseff]->geteffect());} - } { - MenuItem {} { - label {No Effect} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group syseffectuigroup { - xywh {5 140 380 95} box FLAT_BOX color 48 - } { - Fl_Group syseffectui { - xywh {5 140 380 95} - code0 {o->init(master->sysefx[nsyseff]);} - class EffUI - } {} - } - Fl_Button {} { - label {Send to...} - callback {syseffsendwindow->show();} - xywh {95 120 75 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label C - callback {presetsui->copy(master->sysefx[nsyseff]);} - xywh {215 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->sysefx[nsyseff],syseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {245 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - Fl_Group {} { - label {Insertion Effects} - xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 15 align 25 hide - } { - Fl_Counter inseffnocounter { - label {Ins.Effect No.} - callback {ninseff=(int) o->value()-1; -insefftype->value(master->insefx[ninseff]->geteffect()); -inseffpart->value(master->Pinsparts[ninseff]+2); -inseffectui->refresh(master->insefx[ninseff]); - -if (master->Pinsparts[ninseff]!=-1) { - insefftype->activate(); - inseffectui->activate(); - inseffectuigroup->activate(); -} else { - insefftype->deactivate(); - inseffectui->deactivate(); - inseffectuigroup->deactivate(); -};} - xywh {5 120 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_INS_EFX);} - code1 {o->value(ninseff+1);} - } - Fl_Choice insefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->insefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -inseffectui->refresh(master->insefx[ninseff]); -inseffectui->show();} - xywh {315 125 70 15} down_box BORDER_BOX labelsize 10 - code0 {o->value(master->insefx[ninseff]->geteffect());} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - } { - MenuItem {} { - label {No Effect} - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group inseffectuigroup { - xywh {5 140 380 95} box FLAT_BOX color 48 - } { - Fl_Group inseffectui { - xywh {5 140 380 95} - code0 {o->init(master->insefx[ninseff]);} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - class EffUI - } {} - } - Fl_Choice inseffpart { - label {Insert To.} - callback {master->Pinsparts[ninseff]=(int) o->value()-2; -if ((int) o->value()==1){ - inseffectuigroup->deactivate(); - insefftype->deactivate(); - inseffectui->deactivate(); -} else { - inseffectuigroup->activate(); - insefftype->activate(); - inseffectui->activate(); -}; -master->insefx[ninseff]->cleanup();} open - xywh {95 120 80 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10 - code0 {o->add("Master Out");o->add("Off");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(master->Pinsparts[ninseff]+2);} - } {} - Fl_Button {} { - label C - callback {presetsui->copy(master->insefx[ninseff]);} - xywh {215 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->insefx[ninseff],inseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {245 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - } - Fl_Button {} { - label Scales - callback {microtonalui->show();} - xywh {330 80 56 19} box PLASTIC_UP_BOX color 231 labeltype ENGRAVED_LABEL labelfont 1 - } - Fl_Group {} { - xywh {172 30 117 45} box ENGRAVED_BOX - } { - Fl_Button recordbutton { - label {Rec.} - callback {o->deactivate(); -recordmenu->deactivate(); -recordmenu->label("&Record(*)"); -stopbutton->activate(); -pausebutton->activate(); -pauselabel->activate(); -master->HDDRecorder.start(); -master->vuresetpeaks(); -mastermenu->redraw();} - tooltip {Start Recording} xywh {181 36 21 21} box ROUND_UP_BOX color 88 labelfont 1 labelsize 10 align 2 deactivate - } - Fl_Button stopbutton { - label Stop - callback {o->deactivate(); -master->HDDRecorder.stop(); -recordbutton->deactivate(); -pausebutton->deactivate(); -pauselabel->deactivate(); -recordmenu->activate(); -recordmenu->label("&Record"); -mastermenu->redraw();} - tooltip {Stop Recording and close the audio file} xywh {259 36 21 21} box THIN_UP_BOX color 4 labelfont 1 labelsize 10 align 2 deactivate - } - Fl_Button pausebutton { - label {@||} - callback {o->deactivate(); -master->HDDRecorder.pause(); -recordbutton->activate(); -mastermenu->redraw();} - tooltip {Pause Recording} xywh {220 36 21 21} box THIN_UP_BOX color 4 selection_color 4 labelfont 1 labelcolor 3 align 16 deactivate - } - Fl_Box pauselabel { - label Pause - xywh {214 56 30 15} labelfont 1 labelsize 10 deactivate - } - } - Fl_Group {} { - xywh {1 427 389 33} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {VU-Meter} - xywh {4 430 384 30} box FLAT_BOX color 48 selection_color 75 - code0 {o->init(master,-1);} - class VUMeter - } - } - Fl_Check_Button nrpnbutton { - label NRPN - callback {master->ctl.NRPN.receive=(int) o->value();} - tooltip {Receive NRPNs} xywh {45 65 47 10} down_box DOWN_BOX labelsize 10 - code0 {o->value(master->ctl.NRPN.receive);} - } - Fl_Counter npartcounter { - callback {int nval=(int) o->value()-1; -partuigroup->remove(partui); -delete partui; -partui=new PartUI(0,0,765,525); -partuigroup->add(partui); -partui->init(master->part[nval],master,nval,bankui); -partui->redraw(); -o->redraw(); -npart=nval; - -updatepanel(); -simplenpartcounter->value(nval+1); -simplenpartcounter->do_callback();} - tooltip {The part number} xywh {5 247 70 23} type Simple labelfont 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_MIDI_PARTS);} - code1 {bankui->init(o);} - } - Fl_Button {} { - label vK - callback {virkeyboard->show();} - tooltip {Virtual Keyboard} xywh {292 80 35 19} box PLASTIC_UP_BOX color 231 labeltype ENGRAVED_LABEL labelfont 1 - } - Fl_Button {} { - label {R.D.} - callback {globalfinedetuneslider->value(64.0); -globalfinedetuneslider->do_callback();} - tooltip {Master fine detune reset} xywh {140 65 30 10} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Dial globalfinedetuneslider { - label {F.Det.} - callback {master->microtonal.Pglobalfinedetune=(int) o->value();} - tooltip {global fine detune} xywh {143 30 20 20} box ROUND_UP_BOX labelsize 10 align 130 maximum 127 step 1 value 64 - code0 {o->value(master->microtonal.Pglobalfinedetune);} - class WidgetPDial - } - Fl_Button {} { - label {Panel Window} - callback {updatepanel(); -panelwindow->show();} - tooltip {Panel Window} xywh {293 62 92 16} box PLASTIC_UP_BOX color 183 labelfont 1 labelsize 10 - } - } - Fl_Window aboutwindow { - label {Copyright...} - xywh {411 344 365 280} type Double hide - } { - Fl_Box {} { - label {Copyright (c) 2002-2009 Nasca O. PAUL and others. Please read AUTHORS.txt} - xywh {15 35 335 55} labeltype EMBOSSED_LABEL labelsize 15 align 208 - } - Fl_Box {} { - label {This is free software; you may redistribute it and/or modify it under the terms of the -version 2 (or any later version) of the GNU General Public License as published by the Free Software Fundation. - This program comes with - ABSOLUTELY NO WARRANTY. - See the version 2 (or any later version) of the -GNU General Public License for details.} - xywh {15 90 335 145} labelfont 1 labelsize 11 align 144 - } - Fl_Button {} { - label {Close this window} - callback {aboutwindow->hide();} - xywh {80 245 190 25} box THIN_UP_BOX labelsize 11 - } - Fl_Box {} { - label ZynAddSubFX - xywh {15 5 335 30} labeltype EMBOSSED_LABEL labelfont 1 labelsize 20 align 16 - } - } - Fl_Window syseffsendwindow { - label {System Effects Send} - xywh {171 234 120 250} type Double hide resizable - } { - Fl_Scroll {} {open - xywh {0 45 120 170} box FLAT_BOX resizable - code0 {for (int neff1=0;neff1x()+(neff2-1)*35,o->y()+15+neff1*50,30,30);syseffsend[neff1][neff2]->label("aaa");syseffsend[neff1][neff2]->init(master,neff1,neff2);};} - } {} - Fl_Button {} { - label Close - callback {syseffsendwindow->hide();} - xywh {25 220 80 25} box THIN_UP_BOX - } - Fl_Box {} { - label {Send system effect's output to other system effects} - xywh {5 5 110 35} labelsize 10 align 192 - } - } - Fl_Window panelwindow { - label {ZynAddSubFX Panel} - xywh {89 59 630 635} type Double hide - } { - Fl_Scroll {} { - xywh {0 5 570 310} type HORIZONTAL box THIN_UP_BOX - } { - Fl_Pack {} { - xywh {5 10 560 285} type HORIZONTAL - code0 {for (int i=0;iinit(master,i,bankui);}} - } {} - } - Fl_Scroll {} { - xywh {0 320 570 310} type HORIZONTAL box THIN_UP_BOX - } { - Fl_Pack {} { - xywh {5 325 560 285} type HORIZONTAL - code0 {for (int i=NUM_MIDI_PARTS/2;iinit(master,i,bankui);}} - } {} - } - Fl_Button {} { - label Close - callback {panelwindow->hide(); -updatepanel();} - xywh {575 605 50 25} box THIN_UP_BOX labelsize 13 - } - Fl_Button {} { - label Refresh - callback {updatepanel();} - xywh {575 570 55 25} box THIN_UP_BOX labelsize 13 - } - } - Fl_Window simplemasterwindow { - label ZynAddSubFX - callback {\#ifdef VSTAUDIOOUT -fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it."); -\#else -//if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) { - config.save(); - *exitprogram=1; -//}; -\#endif} - xywh {400 405 600 335} type Double hide - } { - Fl_Menu_Bar {} { - xywh {0 0 690 25} - } { - Submenu {} { - label {&File} - xywh {10 10 100 20} - } { - MenuItem {} { - label {&New (erase all)...} - callback {do_new_master();} - xywh {30 30 100 20} - } - MenuItem {} { - label {&Open Parameters...} - callback {do_load_master();} - xywh {30 30 100 20} - } - MenuItem {} { - label {&Save All Parameters...} - callback {do_save_master();} - xywh {20 20 100 20} divider - } - MenuItem {} { - label {&Settings...} - callback {configui->show();} - xywh {35 35 100 20} divider - } - MenuItem {} { - label {&Copyright...} - callback {aboutwindow->show();} - xywh {25 25 100 20} divider - } - MenuItem {} { - label {E&xit} - callback {masterwindow->do_callback();} - xywh {20 20 100 20} - } - } - Submenu {} { - label {&Instrument} - xywh {20 20 100 20} - } { - MenuItem {} { - label {&Open Instrument...} - callback {const char *filename; -filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); -if (filename==NULL) return; - - -pthread_mutex_lock(&master->mutex); -// int npart=(int)npartcounter->value()-1; - - //clear all instrument parameters, first - master->part[npart]->defaultsinstrument(); - - //load the instr. parameters - int result=master->part[npart]->loadXMLinstrument(filename); - -pthread_mutex_unlock(&master->mutex); -master->part[npart]->applyparameters(); - -simplenpartcounter->do_callback(); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file."); - else if (result<0) fl_alert("Error: Could not load the file.");} - xywh {40 40 100 20} - } - MenuItem {} { - label {Show Instrument &Bank...} - callback {bankui->show();} - xywh {10 10 100 20} divider - } - } - Submenu {} { - label Misc - xywh {0 0 100 20} - } { - MenuItem {} { - label {Switch User Interface Mode} - callback {if (fl_choice("Switch the User Interface to Advanced mode ?","No","Yes",NULL)){ - simplemasterwindow->hide(); - refresh_master_ui(); - masterwindow->show(); - config.cfg.UserInterfaceMode=1; -};} - xywh {0 0 100 20} - } - } - } - Fl_Group simplelistitemgroup { - private xywh {125 65 215 150} box ENGRAVED_BOX - code0 {if (master->part[npart]->Penabled==0) o->deactivate();} - } { - Fl_Button partname { - callback {if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -bankui->show();} - xywh {130 72 205 18} box PLASTIC_THIN_DOWN_BOX down_box FLAT_BOX color 247 labelfont 1 labelsize 11 align 208 - } - Fl_Slider partpanning { - label Pan - callback {master->part[npart]->setPpanning((int) o->value());} - xywh {185 95 70 15} type {Horz Knob} box FLAT_BOX maximum 127 step 1 value 64 - code0 {o->value(master->part[npart]->Ppanning);} - } - Fl_Choice partrcv { - label {Midi Channel Receive} - callback {virkeys->relaseallkeys(0); -master->part[npart]->Prcvchn=(int) o->value(); -virkeys->midich=(int) o->value();} open - tooltip {receive from Midi channel} xywh {140 157 65 18} down_box BORDER_BOX labelsize 10 align 130 textfont 1 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Dr10");};} - code1 {o->value(master->part[npart]->Prcvchn);} - } {} - Fl_Dial partvolume { - callback {master->part[npart]->setPvolume((int) o->value());} - xywh {145 95 30 30} maximum 127 step 1 - code0 {o->value(master->part[npart]->Pvolume);} - class WidgetPDial - } - Fl_Box {} { - label Volume - xywh {130 125 60 15} - } - Fl_Check_Button simplepartportamento { - label Portamento - callback {master->part[npart]->ctl.portamento.portamento=(int) o->value();} - tooltip {Enable/Disable the portamento} xywh {260 95 75 20} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(master->part[npart]->ctl.portamento.portamento);} - } - Fl_Counter simpleminkcounter { - label {Min.key} - callback {master->part[npart]->Pminkey=(int) o->value(); -if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Minimum key (that the part receives NoteOn messages)} xywh {210 158 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(master->part[npart]->Pminkey);} - } - Fl_Counter simplemaxkcounter { - label {Max.key} - callback {master->part[npart]->Pmaxkey=(int) o->value(); - -if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Maximum key (that the part receives NoteOn messages)} xywh {255 158 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(master->part[npart]->Pmaxkey);} - } - Fl_Button {} { - label m - callback {if (master->part[npart]->lastnote>=0) simpleminkcounter->value(master->part[npart]->lastnote); -simpleminkcounter->do_callback(); -simplemaxkcounter->do_callback();} - tooltip {set the minimum key to the last pressed key} xywh {230 188 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label M - callback {if (master->part[npart]->lastnote>=0) simplemaxkcounter->value(master->part[npart]->lastnote); -simplemaxkcounter->do_callback(); -simpleminkcounter->do_callback();} - tooltip {set the maximum key to the last pressed key} xywh {260 188 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label R - callback {simpleminkcounter->value(0); -simpleminkcounter->do_callback(); -simplemaxkcounter->value(127); -simplemaxkcounter->do_callback();} - tooltip {reset the minimum key to 0 and maximum key to 127} xywh {245 188 15 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Counter simplepartkeyshiftcounter { - label KeyShift - callback {master->part[npart]->Pkeyshift=(int) o->value()+64;} - xywh {240 120 90 20} labelsize 11 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(master->part[npart]->Pkeyshift-64);} - } - Fl_Dial simplesyseffsend { - callback {master->setPsysefxvol(npart,nsyseff,(int) o->value());} - xywh {300 160 30 30} maximum 127 step 1 - class WidgetPDial - } - Fl_Box {} { - label Effect - xywh {295 190 40 15} - } - } - Fl_Check_Button partenabled { - label Enabled - callback {pthread_mutex_lock(&master->mutex); - master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if ((int) o->value()==0) simplelistitemgroup->deactivate(); - else { - simplelistitemgroup->activate(); - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); - }; -}; - -o->redraw();} - private xywh {250 40 85 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 24 - code0 {//char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);} - code1 {o->value(master->part[npart]->Penabled);} - } - Fl_Box virkeys { - label Keyboard - xywh {5 215 590 80} box BORDER_BOX color 17 - code0 {o->init(master);} - class VirKeys - } - Fl_Group {} { - xywh {340 30 255 185} box ENGRAVED_BOX - } { - Fl_Tabs {} { - xywh {345 35 245 175} align 18 - } { - Fl_Group {} { - label {System Effects} - xywh {345 55 245 155} box ENGRAVED_FRAME labelfont 1 labelsize 12 align 18 hide - } { - Fl_Counter simplesyseffnocounter { - label {Sys.Effect No.} - callback {nsyseff=(int) o->value()-1; -simplesysefftype->value(master->sysefx[nsyseff]->geteffect()); -simplesyseffectui->refresh(master->sysefx[nsyseff]); -simplerefresh();} - xywh {350 75 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_SYS_EFX);} - code1 {o->value(nsyseff+1);} - } - Fl_Choice simplesysefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->sysefx[nsyseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -simplesyseffectui->refresh(master->sysefx[nsyseff]);} - xywh {515 80 70 15} down_box BORDER_BOX labelsize 10 align 5 - code0 {o->value(master->sysefx[nsyseff]->geteffect());} - } { - MenuItem {} { - label {No Effect} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group simplesyseffectuigroup { - xywh {350 95 235 95} box FLAT_BOX color 48 - } { - Fl_Group simplesyseffectui { - xywh {350 95 234 95} - code0 {o->init(master->sysefx[nsyseff]);} - class SimpleEffUI - } {} - } - Fl_Button {} { - label {Send to...} - callback {syseffsendwindow->show();} - xywh {435 75 75 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->sysefx[nsyseff],simplesyseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - Fl_Group {} { - label {Insertion Effects} - xywh {345 55 245 155} box ENGRAVED_FRAME labelfont 1 labelsize 12 align 18 - } { - Fl_Counter simpleinseffnocounter { - label {Ins.Effect No.} - callback {ninseff=(int) o->value()-1; -simpleinsefftype->value(master->insefx[ninseff]->geteffect()); -simpleinseffpart->value(master->Pinsparts[ninseff]+2); -simpleinseffectui->refresh(master->insefx[ninseff]); - -if (master->Pinsparts[ninseff]!=-1) { - simpleinsefftype->activate(); - simpleinseffectui->activate(); - simpleinseffectuigroup->activate(); -} else { - simpleinsefftype->deactivate(); - simpleinseffectui->deactivate(); - simpleinseffectuigroup->deactivate(); -};} - xywh {350 75 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_INS_EFX);} - code1 {o->value(ninseff+1);} - } - Fl_Choice simpleinsefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->insefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -simpleinseffectui->refresh(master->insefx[ninseff]); -simpleinseffectui->show();} selected - xywh {515 80 70 15} down_box BORDER_BOX labelsize 10 align 5 - code0 {o->value(master->insefx[ninseff]->geteffect());} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - } { - MenuItem {} { - label {No Effect} - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group simpleinseffectuigroup { - xywh {350 95 234 95} box FLAT_BOX color 48 - } { - Fl_Group simpleinseffectui { - xywh {350 95 234 95} - code0 {o->init(master->insefx[ninseff]);} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - class SimpleEffUI - } {} - } - Fl_Choice simpleinseffpart { - label {Insert To.} - callback {master->Pinsparts[ninseff]=(int) o->value()-2; -if ((int) o->value()==1){ - simpleinseffectuigroup->deactivate(); - simpleinsefftype->deactivate(); - simpleinseffectui->deactivate(); -} else { - simpleinseffectuigroup->activate(); - simpleinsefftype->activate(); - simpleinseffectui->activate(); -}; -master->insefx[ninseff]->cleanup();} open - xywh {435 75 80 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10 - code0 {o->add("Master Out");o->add("Off");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(master->Pinsparts[ninseff]+2);} - } {} - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->insefx[ninseff],simpleinseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - } - } - Fl_Group {} { - xywh {5 300 590 30} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {VU-Meter} - xywh {5 300 590 30} box FLAT_BOX color 41 selection_color 75 - code0 {o->init(master,-1);} - class VUMeter - } - } - Fl_Dial simplemastervolumedial { - label {Master Volume} - callback {master->setPvolume((int) o->value());} - tooltip {Master Volume} xywh {10 35 40 40} box ROUND_UP_BOX labelfont 1 labelsize 11 align 130 maximum 127 step 1 - code0 {o->value(master->Pvolume);} - class WidgetPDial - } - Fl_Counter simplemasterkeyshiftcounter { - label {Master KeyShift} - callback {master->setPkeyshift((int) o->value()+64);} - xywh {25 110 90 20} labelsize 11 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(master->Pkeyshift-64);} - } - Fl_Button {} { - label {Stop ALL sounds!} - callback {virkeyboard->relaseallkeys(); -pthread_mutex_lock(&master->mutex); -master->shutup=1; -pthread_mutex_unlock(&master->mutex);} - xywh {5 149 115 31} box PLASTIC_UP_BOX color 231 labelfont 1 labelsize 11 - } - Fl_Button {} { - label Reset - callback {simpleglobalfinedetuneslider->value(64.0); -simpleglobalfinedetuneslider->do_callback();} - tooltip {Master fine detune reset} xywh {70 32 50 10} box THIN_UP_BOX labelfont 1 labelsize 11 align 128 - } - Fl_Dial simpleglobalfinedetuneslider { - label {Fine Detune} - callback {master->microtonal.Pglobalfinedetune=(int) o->value();} - tooltip {global fine detune} xywh {80 45 30 30} box ROUND_UP_BOX labelsize 11 align 130 maximum 127 step 1 value 64 - code0 {o->value(master->microtonal.Pglobalfinedetune);} - class WidgetPDial - } - Fl_Counter simplenpartcounter { - label Part - callback {virkeys->relaseallkeys(0); -npartcounter->value(o->value()); -npart=(int) o->value()-1; - -simplerefresh(); -virkeys->midich=master->part[npart]->Prcvchn;} - tooltip {The part number} xywh {170 40 70 20} type Simple labelfont 1 align 4 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_MIDI_PARTS);} - } - Fl_Counter {} { - label {Keyb.Oct.} - callback {virkeys->relaseallkeys(0); -virkeys->midioct=(int) o->value(); -virkeys->take_focus();} - tooltip {Midi Octave} xywh {5 195 55 20} type Simple labelsize 11 align 8 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 11 - code0 {o->value(virkeys->midioct);} - } - } - Fl_Window selectuiwindow { - label {User Interface mode} - callback {*exitprogram=1;} - xywh {342 246 430 250} type Double hide non_modal - } { - Fl_Box {} { - label {Welcome to ZynAddSubFX} - xywh {5 5 425 40} labeltype SHADOW_LABEL labelfont 1 labelsize 26 - } - Fl_Box {} { - label {Please choose the interface mode:} - xywh {10 50 265 25} labelfont 1 labelsize 13 - } - Fl_Button {} { - label Advanced - callback {config.cfg.UserInterfaceMode=1; -masterwindow->show(); -selectuiwindow->hide();} - xywh {10 165 100 35} box PLASTIC_UP_BOX color 229 labelfont 1 labelsize 16 - } - Fl_Box {} { - label {.. if you have used ZynAddSubFX before, or you like to have full controll to all parameters.} - xywh {110 165 310 35} labelfont 1 labelsize 11 align 144 - } - Fl_Button {} { - label Beginner - callback {simplemasterwindow->show(); -selectuiwindow->hide(); -config.cfg.UserInterfaceMode=2;} - xywh {10 80 100 65} box PLASTIC_UP_BOX color 238 labelfont 1 labelsize 16 - } - Fl_Box {} { - label {..if you are a beginner, you prefer using presets or you prefer to use simpler user interfaces. Most functionality of ZynAddSubFX will be hidden in this mode to make simple the learning/using it.} - xywh {110 75 320 75} labelfont 1 labelsize 11 align 144 - } - Fl_Box {} { - label {You can switch the interface modes anytime you want.} - xywh {30 215 360 25} box BORDER_BOX color 51 labelfont 1 labelsize 11 align 144 - } - } - } - Function {updatesendwindow()} {} { - code {for (int neff1=0;neff1value(master->Psysefxsend[neff1][neff2]);} {} - } - Function {updatepanel()} {} { - code {for (int npart=0;npartrefresh(); -};} {} - } - Function {setfilelabel(const char *filename)} {} { - code {if (filename!=NULL) snprintf(&masterwindowlabel[0],100,"%s - ZynAddSubFX",fl_filename_name(filename)); - else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX"); -masterwindowlabel[99]='\\0'; -masterwindow->label(&masterwindowlabel[0]); -simplemasterwindow->label(&masterwindowlabel[0]);} {} - } - Function {MasterUI(Master *master_,int *exitprogram_)} {} { - code {master=master_; -exitprogram=exitprogram_; -ninseff=0; -nsyseff=0; -npart=0; - -for (int i=0;imicrotonal); -virkeyboard=new VirKeyboard(master); -bankui=new BankUI(master,&npart); -configui=new ConfigUI(); -sequi=new SeqUI(master); - -make_window(); -\#ifdef OS_WINDOWS -masterwindow->icon((char *)LoadIcon(GetModuleHandle(NULL), "zynaddsubfx_icon")); -\#endif -presetsui=new PresetsUI(); -setfilelabel(NULL); -swapefftype=0; -simplerefresh();} {} - } - Function {~MasterUI()} {} { - code {masterwindow->hide(); -delete masterwindow; -simplemasterwindow->hide(); -delete simplemasterwindow; -aboutwindow->hide(); -delete aboutwindow; -syseffsendwindow->hide(); -delete syseffsendwindow; - -delete virkeyboard; -delete microtonalui; -delete bankui; -delete configui; -delete sequi; - -delete presetsui; -delete panelwindow; -delete selectuiwindow;} {} - } - Function {showUI()} {} { - code {switch (config.cfg.UserInterfaceMode){ - case 0:selectuiwindow->show(); - break; - case 1:masterwindow->show(); - break; - case 2:simplemasterwindow->show(); - break; -};} {} - } - Function {simplerefresh()} {} { - code {partenabled->value(master->part[npart]->Penabled); -if (master->part[npart]->Penabled!=0) simplelistitemgroup->activate(); - else simplelistitemgroup->deactivate(); - -partvolume->value(master->part[npart]->Pvolume); -partpanning->value(master->part[npart]->Ppanning); -partrcv->value(master->part[npart]->Prcvchn); - -if (master->part[npart]->Pname[0]!=0) partname->label((char *)master->part[npart]->Pname); - else partname->label("Click here to load a instrument"); - -simplelistitemgroup->redraw(); -simplepartportamento->value(master->part[npart]->ctl.portamento.portamento); -simpleminkcounter->value(master->part[npart]->Pminkey); -simplemaxkcounter->value(master->part[npart]->Pmaxkey); - -simplepartkeyshiftcounter->value(master->part[npart]->Pkeyshift-64); -simplesyseffsend->value(master->Psysefxvol[nsyseff][npart]);} {} - } - Function {do_new_master()} {} { - code {if (fl_choice("Clear *ALL* the parameters ?","No","Yes",NULL)){ - delete microtonalui; - - pthread_mutex_lock(&master->mutex); - master->defaults(); - pthread_mutex_unlock(&master->mutex); - - npartcounter->value(1); - refresh_master_ui(); - -}; - -updatepanel();} {} - } - Function {do_load_master(const char* file = NULL)} {} { - code {const char *filename; - if (file == NULL) { - filename=fl_file_chooser("Open:","({*.xmz})",NULL,0); - if (filename==NULL) return; - } - else { - filename = file; - } - - -pthread_mutex_lock(&master->mutex); - //clear all parameters - master->defaults(); - - //load the data - int result=master->loadXML(filename); -pthread_mutex_unlock(&master->mutex); -master->applyparameters(); - -npartcounter->value(1); -refresh_master_ui(); -updatepanel(); -if (result>=0) setfilelabel(filename); - - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a zynaddsubfx parameters file."); - else if (result<0) fl_alert("Error: Could not load the file.");} {} - } - Function {do_save_master(const char* file = NULL)} {} { - code {const char *filename; -char *tmp; - int result=0; - if (file == NULL) { - tmp=fl_file_chooser("Save:","({*.xmz})",NULL,0); - if (tmp==NULL) return; - tmp=fl_filename_setext(tmp,".xmz"); - filename=tmp; - result=fileexists(tmp); - if (result) { - result=0; - if (!fl_choice("The file exists. Overwrite it?","No","Yes",NULL)) return; - - } - } - else { - filename = file; - } - - -pthread_mutex_lock(&master->mutex); -result=master->saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - else setfilelabel(filename); - -updatepanel();} {} - } - Function {refresh_master_ui()} {} { - code {ninseff=0; -nsyseff=0; -npart=0; - -//the Master UI -npartcounter->do_callback(); -syseffnocounter->do_callback(); -inseffnocounter->do_callback(); -masterkeyshiftcounter->value(master->Pkeyshift-64); -mastervolumedial->value(master->Pvolume); -globalfinedetuneslider->value(master->microtonal.Pglobalfinedetune); -microtonalui=new MicrotonalUI(&master->microtonal); -nrpnbutton->value(master->ctl.NRPN.receive); -updatesendwindow(); -updatepanel(); - -//the simle MasterUI -simplenpartcounter->value(1); -simplesyseffnocounter->value(1); -simpleinseffnocounter->value(1); -simplenpartcounter->do_callback(); -simplesyseffnocounter->do_callback(); -simpleinseffnocounter->do_callback(); -simplemasterkeyshiftcounter->value(master->Pkeyshift-64); -simplemastervolumedial->value(master->Pvolume); -simpleglobalfinedetuneslider->value(master->microtonal.Pglobalfinedetune); -virkeys->midich=master->part[npart]->Prcvchn; - -simplerefresh(); -bankui->hide();} {} - } - decl {Master *master;} {} - decl {MicrotonalUI *microtonalui;} {} - decl {SeqUI *sequi;} {} - decl {BankUI *bankui;} {} - decl {int ninseff,npart;} {} - decl {int nsyseff;} {} - decl {int *exitprogram;} {} - decl {SysEffSend *syseffsend[NUM_SYS_EFX][NUM_SYS_EFX];} {} - decl {VirKeyboard *virkeyboard;} {} - decl {ConfigUI *configui;} {} - decl {int swapefftype;} {} - decl {char masterwindowlabel[100];} {} - decl {Panellistitem *panellistitem[NUM_MIDI_PARTS];} {} -} diff --git a/plugins/zynaddsubfx/src/UI/MasterUI.h b/plugins/zynaddsubfx/src/UI/MasterUI.h deleted file mode 100644 index fc1db4b59..000000000 --- a/plugins/zynaddsubfx/src/UI/MasterUI.h +++ /dev/null @@ -1,448 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef MasterUI_h -#define MasterUI_h -#include -#include -#include -#include -#include "WidgetPDial.h" -#include "ADnoteUI.h" -#include "SUBnoteUI.h" -#include "EffUI.h" -#include "VirKeyboard.h" -#include "ConfigUI.h" -#include "BankUI.h" -#include "PartUI.h" -#include "MicrotonalUI.h" -#include "SeqUI.h" -#include "PresetsUI.h" -#include "../Misc/Master.h" -#include "../Misc/Part.h" -#include "../Misc/Util.h" -#include "../globals.h" - -class VUMeter : public Fl_Box { -public: - VUMeter(int x,int y, int w, int h, const char *label=0); - void init(Master *master_,int part_); - void draw_master(); - void draw_part(); - void draw(); - static void tickdraw(VUMeter *o); - static void tick(void *v); - int handle(int event); -private: - Master *master; - int npart; - float olddbl,olddbr; - float oldrmsdbl,oldrmsdbr; -}; - -class SysEffSend : public WidgetPDial { -public: - SysEffSend(int x,int y, int w, int h, const char *label=0); - void init(Master *master_,int neff1_,int neff2_); - ~SysEffSend(); - int handle(int event); -private: - Master *master; - int neff1; - int neff2; -}; -#include -#include -#include -#include -#include - -class Panellistitem : public Fl_Group { - Fl_Group* make_window(); - Fl_Group *panellistitem; - Fl_Group *panellistitemgroup; -public: - Fl_Button *partname; -private: - void cb_partname_i(Fl_Button*, void*); - static void cb_partname(Fl_Button*, void*); -public: - Fl_Slider *partvolume; -private: - void cb_partvolume_i(Fl_Slider*, void*); - static void cb_partvolume(Fl_Slider*, void*); -public: - WidgetPDial *partpanning; -private: - void cb_partpanning_i(WidgetPDial*, void*); - static void cb_partpanning(WidgetPDial*, void*); - void cb_edit_i(Fl_Button*, void*); - static void cb_edit(Fl_Button*, void*); -public: - Fl_Choice *partrcv; -private: - void cb_partrcv_i(Fl_Choice*, void*); - static void cb_partrcv(Fl_Choice*, void*); - Fl_Check_Button *partenabled; - void cb_partenabled_i(Fl_Check_Button*, void*); - static void cb_partenabled(Fl_Check_Button*, void*); -public: - Panellistitem(int x,int y, int w, int h, const char *label=0); - void init(Master *master_, int npart_,BankUI *bankui_); - void refresh(); - ~Panellistitem(); -private: - int npart; - Master *master; - BankUI *bankui; -}; -#include -#include -#include -#include -#include -#include -#include - -class MasterUI { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *masterwindow; -private: - void cb_masterwindow_i(Fl_Double_Window*, void*); - static void cb_masterwindow(Fl_Double_Window*, void*); -public: - Fl_Menu_Bar *mastermenu; - static Fl_Menu_Item menu_mastermenu[]; -private: - void cb_New_i(Fl_Menu_*, void*); - static void cb_New(Fl_Menu_*, void*); - void cb_Open_i(Fl_Menu_*, void*); - static void cb_Open(Fl_Menu_*, void*); - void cb_Save_i(Fl_Menu_*, void*); - static void cb_Save(Fl_Menu_*, void*); - void cb_Load_i(Fl_Menu_*, void*); - static void cb_Load(Fl_Menu_*, void*); - void cb_Save1_i(Fl_Menu_*, void*); - static void cb_Save1(Fl_Menu_*, void*); - void cb_Show_i(Fl_Menu_*, void*); - static void cb_Show(Fl_Menu_*, void*); - void cb_Settings_i(Fl_Menu_*, void*); - static void cb_Settings(Fl_Menu_*, void*); - void cb_Copyright_i(Fl_Menu_*, void*); - static void cb_Copyright(Fl_Menu_*, void*); - void cb_E_i(Fl_Menu_*, void*); - static void cb_E(Fl_Menu_*, void*); - void cb_Clear_i(Fl_Menu_*, void*); - static void cb_Clear(Fl_Menu_*, void*); - void cb_Open1_i(Fl_Menu_*, void*); - static void cb_Open1(Fl_Menu_*, void*); - void cb_Save2_i(Fl_Menu_*, void*); - static void cb_Save2(Fl_Menu_*, void*); - void cb_Show1_i(Fl_Menu_*, void*); - static void cb_Show1(Fl_Menu_*, void*); - void cb_Virtual_i(Fl_Menu_*, void*); - static void cb_Virtual(Fl_Menu_*, void*); -public: - static Fl_Menu_Item *recordmenu; -private: - void cb_Choose_i(Fl_Menu_*, void*); - static void cb_Choose(Fl_Menu_*, void*); - void cb_Show2_i(Fl_Menu_*, void*); - static void cb_Show2(Fl_Menu_*, void*); - void cb_Switch_i(Fl_Menu_*, void*); - static void cb_Switch(Fl_Menu_*, void*); -public: - WidgetPDial *mastervolumedial; -private: - void cb_mastervolumedial_i(WidgetPDial*, void*); - static void cb_mastervolumedial(WidgetPDial*, void*); -public: - Fl_Counter *masterkeyshiftcounter; -private: - void cb_masterkeyshiftcounter_i(Fl_Counter*, void*); - static void cb_masterkeyshiftcounter(Fl_Counter*, void*); - void cb_Panic_i(Fl_Button*, void*); - static void cb_Panic(Fl_Button*, void*); -public: - Fl_Group *partuigroup; - PartUI *partui; - Fl_Counter *syseffnocounter; -private: - void cb_syseffnocounter_i(Fl_Counter*, void*); - static void cb_syseffnocounter(Fl_Counter*, void*); -public: - Fl_Choice *sysefftype; -private: - void cb_sysefftype_i(Fl_Choice*, void*); - static void cb_sysefftype(Fl_Choice*, void*); - static Fl_Menu_Item menu_sysefftype[]; -public: - Fl_Group *syseffectuigroup; - EffUI *syseffectui; -private: - void cb_Send_i(Fl_Button*, void*); - static void cb_Send(Fl_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Counter *inseffnocounter; -private: - void cb_inseffnocounter_i(Fl_Counter*, void*); - static void cb_inseffnocounter(Fl_Counter*, void*); -public: - Fl_Choice *insefftype; -private: - void cb_insefftype_i(Fl_Choice*, void*); - static void cb_insefftype(Fl_Choice*, void*); - static Fl_Menu_Item menu_insefftype[]; -public: - Fl_Group *inseffectuigroup; - EffUI *inseffectui; - Fl_Choice *inseffpart; -private: - void cb_inseffpart_i(Fl_Choice*, void*); - static void cb_inseffpart(Fl_Choice*, void*); - void cb_C1_i(Fl_Button*, void*); - static void cb_C1(Fl_Button*, void*); - void cb_P1_i(Fl_Button*, void*); - static void cb_P1(Fl_Button*, void*); - void cb_Scales_i(Fl_Button*, void*); - static void cb_Scales(Fl_Button*, void*); -public: - Fl_Button *recordbutton; -private: - void cb_recordbutton_i(Fl_Button*, void*); - static void cb_recordbutton(Fl_Button*, void*); -public: - Fl_Button *stopbutton; -private: - void cb_stopbutton_i(Fl_Button*, void*); - static void cb_stopbutton(Fl_Button*, void*); -public: - Fl_Button *pausebutton; -private: - void cb_pausebutton_i(Fl_Button*, void*); - static void cb_pausebutton(Fl_Button*, void*); -public: - Fl_Box *pauselabel; - Fl_Check_Button *nrpnbutton; -private: - void cb_nrpnbutton_i(Fl_Check_Button*, void*); - static void cb_nrpnbutton(Fl_Check_Button*, void*); -public: - Fl_Counter *npartcounter; -private: - void cb_npartcounter_i(Fl_Counter*, void*); - static void cb_npartcounter(Fl_Counter*, void*); - void cb_vK_i(Fl_Button*, void*); - static void cb_vK(Fl_Button*, void*); - void cb_R_i(Fl_Button*, void*); - static void cb_R(Fl_Button*, void*); -public: - WidgetPDial *globalfinedetuneslider; -private: - void cb_globalfinedetuneslider_i(WidgetPDial*, void*); - static void cb_globalfinedetuneslider(WidgetPDial*, void*); - void cb_Panel_i(Fl_Button*, void*); - static void cb_Panel(Fl_Button*, void*); -public: - Fl_Double_Window *aboutwindow; -private: - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); -public: - Fl_Double_Window *syseffsendwindow; -private: - void cb_Close1_i(Fl_Button*, void*); - static void cb_Close1(Fl_Button*, void*); -public: - Fl_Double_Window *panelwindow; -private: - void cb_Close2_i(Fl_Button*, void*); - static void cb_Close2(Fl_Button*, void*); - void cb_Refresh_i(Fl_Button*, void*); - static void cb_Refresh(Fl_Button*, void*); -public: - Fl_Double_Window *simplemasterwindow; -private: - void cb_simplemasterwindow_i(Fl_Double_Window*, void*); - static void cb_simplemasterwindow(Fl_Double_Window*, void*); - static Fl_Menu_Item menu_[]; - void cb_New1_i(Fl_Menu_*, void*); - static void cb_New1(Fl_Menu_*, void*); - void cb_Open2_i(Fl_Menu_*, void*); - static void cb_Open2(Fl_Menu_*, void*); - void cb_Save3_i(Fl_Menu_*, void*); - static void cb_Save3(Fl_Menu_*, void*); - void cb_Settings1_i(Fl_Menu_*, void*); - static void cb_Settings1(Fl_Menu_*, void*); - void cb_Copyright1_i(Fl_Menu_*, void*); - static void cb_Copyright1(Fl_Menu_*, void*); - void cb_E1_i(Fl_Menu_*, void*); - static void cb_E1(Fl_Menu_*, void*); - void cb_Open3_i(Fl_Menu_*, void*); - static void cb_Open3(Fl_Menu_*, void*); - void cb_Show3_i(Fl_Menu_*, void*); - static void cb_Show3(Fl_Menu_*, void*); - void cb_Switch1_i(Fl_Menu_*, void*); - static void cb_Switch1(Fl_Menu_*, void*); - Fl_Group *simplelistitemgroup; -public: - Fl_Button *partname; -private: - void cb_partname1_i(Fl_Button*, void*); - static void cb_partname1(Fl_Button*, void*); -public: - Fl_Slider *partpanning; -private: - void cb_partpanning1_i(Fl_Slider*, void*); - static void cb_partpanning1(Fl_Slider*, void*); -public: - Fl_Choice *partrcv; -private: - void cb_partrcv1_i(Fl_Choice*, void*); - static void cb_partrcv1(Fl_Choice*, void*); -public: - WidgetPDial *partvolume; -private: - void cb_partvolume1_i(WidgetPDial*, void*); - static void cb_partvolume1(WidgetPDial*, void*); -public: - Fl_Check_Button *simplepartportamento; -private: - void cb_simplepartportamento_i(Fl_Check_Button*, void*); - static void cb_simplepartportamento(Fl_Check_Button*, void*); -public: - Fl_Counter *simpleminkcounter; -private: - void cb_simpleminkcounter_i(Fl_Counter*, void*); - static void cb_simpleminkcounter(Fl_Counter*, void*); -public: - Fl_Counter *simplemaxkcounter; -private: - void cb_simplemaxkcounter_i(Fl_Counter*, void*); - static void cb_simplemaxkcounter(Fl_Counter*, void*); - void cb_m_i(Fl_Button*, void*); - static void cb_m(Fl_Button*, void*); - void cb_M_i(Fl_Button*, void*); - static void cb_M(Fl_Button*, void*); - void cb_R1_i(Fl_Button*, void*); - static void cb_R1(Fl_Button*, void*); -public: - Fl_Counter *simplepartkeyshiftcounter; -private: - void cb_simplepartkeyshiftcounter_i(Fl_Counter*, void*); - static void cb_simplepartkeyshiftcounter(Fl_Counter*, void*); -public: - WidgetPDial *simplesyseffsend; -private: - void cb_simplesyseffsend_i(WidgetPDial*, void*); - static void cb_simplesyseffsend(WidgetPDial*, void*); - Fl_Check_Button *partenabled; - void cb_partenabled1_i(Fl_Check_Button*, void*); - static void cb_partenabled1(Fl_Check_Button*, void*); -public: - VirKeys *virkeys; - Fl_Counter *simplesyseffnocounter; -private: - void cb_simplesyseffnocounter_i(Fl_Counter*, void*); - static void cb_simplesyseffnocounter(Fl_Counter*, void*); -public: - Fl_Choice *simplesysefftype; -private: - void cb_simplesysefftype_i(Fl_Choice*, void*); - static void cb_simplesysefftype(Fl_Choice*, void*); - static Fl_Menu_Item menu_simplesysefftype[]; -public: - Fl_Group *simplesyseffectuigroup; - SimpleEffUI *simplesyseffectui; -private: - void cb_Send1_i(Fl_Button*, void*); - static void cb_Send1(Fl_Button*, void*); - void cb_P2_i(Fl_Button*, void*); - static void cb_P2(Fl_Button*, void*); -public: - Fl_Counter *simpleinseffnocounter; -private: - void cb_simpleinseffnocounter_i(Fl_Counter*, void*); - static void cb_simpleinseffnocounter(Fl_Counter*, void*); -public: - Fl_Choice *simpleinsefftype; -private: - void cb_simpleinsefftype_i(Fl_Choice*, void*); - static void cb_simpleinsefftype(Fl_Choice*, void*); - static Fl_Menu_Item menu_simpleinsefftype[]; -public: - Fl_Group *simpleinseffectuigroup; - SimpleEffUI *simpleinseffectui; - Fl_Choice *simpleinseffpart; -private: - void cb_simpleinseffpart_i(Fl_Choice*, void*); - static void cb_simpleinseffpart(Fl_Choice*, void*); - void cb_P3_i(Fl_Button*, void*); - static void cb_P3(Fl_Button*, void*); -public: - WidgetPDial *simplemastervolumedial; -private: - void cb_simplemastervolumedial_i(WidgetPDial*, void*); - static void cb_simplemastervolumedial(WidgetPDial*, void*); -public: - Fl_Counter *simplemasterkeyshiftcounter; -private: - void cb_simplemasterkeyshiftcounter_i(Fl_Counter*, void*); - static void cb_simplemasterkeyshiftcounter(Fl_Counter*, void*); - void cb_Stop_i(Fl_Button*, void*); - static void cb_Stop(Fl_Button*, void*); - void cb_Reset_i(Fl_Button*, void*); - static void cb_Reset(Fl_Button*, void*); -public: - WidgetPDial *simpleglobalfinedetuneslider; -private: - void cb_simpleglobalfinedetuneslider_i(WidgetPDial*, void*); - static void cb_simpleglobalfinedetuneslider(WidgetPDial*, void*); -public: - Fl_Counter *simplenpartcounter; -private: - void cb_simplenpartcounter_i(Fl_Counter*, void*); - static void cb_simplenpartcounter(Fl_Counter*, void*); - void cb_Keyb_i(Fl_Counter*, void*); - static void cb_Keyb(Fl_Counter*, void*); -public: - Fl_Double_Window *selectuiwindow; -private: - void cb_selectuiwindow_i(Fl_Double_Window*, void*); - static void cb_selectuiwindow(Fl_Double_Window*, void*); - void cb_Advanced_i(Fl_Button*, void*); - static void cb_Advanced(Fl_Button*, void*); - void cb_Beginner_i(Fl_Button*, void*); - static void cb_Beginner(Fl_Button*, void*); -public: - void updatesendwindow(); - void updatepanel(); - void setfilelabel(const char *filename); - MasterUI(Master *master_,int *exitprogram_); - ~MasterUI(); - void showUI(); - void simplerefresh(); - void do_new_master(); - void do_load_master(const char* file = NULL); - void do_save_master(const char* file = NULL); - void refresh_master_ui(); -private: - Master *master; - MicrotonalUI *microtonalui; - SeqUI *sequi; - BankUI *bankui; - int ninseff,npart; - int nsyseff; - int *exitprogram; - SysEffSend *syseffsend[NUM_SYS_EFX][NUM_SYS_EFX]; - VirKeyboard *virkeyboard; - ConfigUI *configui; - int swapefftype; - char masterwindowlabel[100]; - Panellistitem *panellistitem[NUM_MIDI_PARTS]; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/MicrotonalUI.cc b/plugins/zynaddsubfx/src/UI/MicrotonalUI.cc deleted file mode 100644 index a58bbf021..000000000 --- a/plugins/zynaddsubfx/src/UI/MicrotonalUI.cc +++ /dev/null @@ -1,463 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "MicrotonalUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void MicrotonalUI::cb_Invert_i(Fl_Check_Button* o, void*) { - microtonal->Pinvertupdown=(int) o->value(); -if (microtonal->Pinvertupdown==0) centerinvertcounter->deactivate(); - else centerinvertcounter->activate(); -} -void MicrotonalUI::cb_Invert(Fl_Check_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Invert_i(o,v); -} - -void MicrotonalUI::cb_centerinvertcounter_i(Fl_Counter* o, void*) { - microtonal->Pinvertupdowncenter=(int) o->value(); -} -void MicrotonalUI::cb_centerinvertcounter(Fl_Counter* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_centerinvertcounter_i(o,v); -} - -void MicrotonalUI::cb_applybutton_i(Fl_Button*, void*) { - apply(); -} -void MicrotonalUI::cb_applybutton(Fl_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_applybutton_i(o,v); -} - -void MicrotonalUI::cb_octavesizeoutput_i(Fl_Value_Output* o, void*) { - o->value(microtonal->getoctavesize()); -} -void MicrotonalUI::cb_octavesizeoutput(Fl_Value_Output* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_octavesizeoutput_i(o,v); -} - -void MicrotonalUI::cb_nameinput_i(Fl_Input* o, void*) { - snprintf((char *)microtonal->Pname,MICROTONAL_MAX_NAME_LEN,"%s",o->value()); -} -void MicrotonalUI::cb_nameinput(Fl_Input* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_nameinput_i(o,v); -} - -void MicrotonalUI::cb_commentinput_i(Fl_Input* o, void*) { - snprintf((char *)microtonal->Pcomment,MICROTONAL_MAX_NAME_LEN,"%s",o->value()); -} -void MicrotonalUI::cb_commentinput(Fl_Input* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_commentinput_i(o,v); -} - -void MicrotonalUI::cb_Shift_i(Fl_Counter* o, void*) { - microtonal->Pscaleshift=(int) o->value()+64; -} -void MicrotonalUI::cb_Shift(Fl_Counter* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Shift_i(o,v); -} - -void MicrotonalUI::cb_Import_i(Fl_Button*, void*) { - const char *filename; -filename=fl_file_chooser("Open:","(*.scl)",NULL,0); -if (filename==NULL) return; -int result=microtonal->loadscl(filename); -if (result==0) { - updateTuningsInput(); - nameinput->cut(0,nameinput->maximum_size()); - nameinput->insert((char *)microtonal->Pname); - nameinput->position(0); - commentinput->cut(0,commentinput->maximum_size()); - commentinput->insert((char *)microtonal->Pname); - commentinput->position(0); - tuningsinput->position(0); - octavesizeoutput->do_callback(); - } else { - fl_alert("Error: Could not load the file."); - }; -} -void MicrotonalUI::cb_Import(Fl_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Import_i(o,v); -} - -void MicrotonalUI::cb_firstnotecounter_i(Fl_Counter* o, void*) { - microtonal->Pfirstkey=(int) o->value(); -} -void MicrotonalUI::cb_firstnotecounter(Fl_Counter* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_firstnotecounter_i(o,v); -} - -void MicrotonalUI::cb_lastnotecounter_i(Fl_Counter* o, void*) { - microtonal->Plastkey=(int) o->value(); -} -void MicrotonalUI::cb_lastnotecounter(Fl_Counter* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_lastnotecounter_i(o,v); -} - -void MicrotonalUI::cb_middlenotecounter_i(Fl_Counter* o, void*) { - microtonal->Pmiddlenote=(int) o->value(); -} -void MicrotonalUI::cb_middlenotecounter(Fl_Counter* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_middlenotecounter_i(o,v); -} - -void MicrotonalUI::cb_mapsizeoutput_i(Fl_Value_Output* o, void*) { - o->value(microtonal->Pmapsize); -} -void MicrotonalUI::cb_mapsizeoutput(Fl_Value_Output* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_mapsizeoutput_i(o,v); -} - -void MicrotonalUI::cb_mappingenabledbutton_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -microtonal->Pmappingenabled=x; -if (x==0) keymappinggroup->deactivate(); - else keymappinggroup->activate(); -o->show(); -} -void MicrotonalUI::cb_mappingenabledbutton(Fl_Check_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_mappingenabledbutton_i(o,v); -} - -void MicrotonalUI::cb_Import1_i(Fl_Button*, void*) { - const char *filename; -filename=fl_file_chooser("Open:","(*.kbm)",NULL,0); -if (filename==NULL) return; -int result=microtonal->loadkbm(filename); -if (result==0) { - updateMappingInput(); - mappinginput->position(0); - mapsizeoutput->do_callback(); - firstnotecounter->value(microtonal->Pfirstkey); - lastnotecounter->value(microtonal->Plastkey); - middlenotecounter->value(microtonal->Pmiddlenote); - mapsizeoutput->do_callback(); - mappingenabledbutton->value(microtonal->Pmappingenabled); - mappingenabledbutton->do_callback(); - afreqinput->value(microtonal->PAfreq); - anotecounter->value(microtonal->PAnote); - anotecounter->do_callback(); - } else { - fl_alert("Error: Could not load the file."); - }; -} -void MicrotonalUI::cb_Import1(Fl_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Import1_i(o,v); -} - -void MicrotonalUI::cb_anotecounter_i(Fl_Counter* o, void*) { - microtonal->PAnote=(int) o->value(); -if (microtonal->getnotefreq(microtonal->PAnote,0)<0.0) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); - -o->redraw(); -} -void MicrotonalUI::cb_anotecounter(Fl_Counter* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_anotecounter_i(o,v); -} - -void MicrotonalUI::cb_afreqinput_i(Fl_Value_Input* o, void*) { - microtonal->PAfreq=o->value(); -} -void MicrotonalUI::cb_afreqinput(Fl_Value_Input* o, void* v) { - ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_afreqinput_i(o,v); -} - -void MicrotonalUI::cb_Close_i(Fl_Button*, void*) { - microtonaluiwindow->hide(); -} -void MicrotonalUI::cb_Close(Fl_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void MicrotonalUI::cb_Enable_i(Fl_Check_Button* o, void*) { - microtonal->Penabled=(int) o->value(); -if (microtonal->Penabled==0) microtonalgroup->deactivate(); - else microtonalgroup->activate(); -} -void MicrotonalUI::cb_Enable(Fl_Check_Button* o, void* v) { - ((MicrotonalUI*)(o->parent()->user_data()))->cb_Enable_i(o,v); -} - -Fl_Double_Window* MicrotonalUI::make_window() { - { microtonaluiwindow = new Fl_Double_Window(405, 450, "Scales"); - microtonaluiwindow->user_data((void*)(this)); - { Fl_Group* o = new Fl_Group(249, 2, 155, 45); - o->tooltip("Center where the note\'s freqs. are turned upside-down"); - o->box(FL_ENGRAVED_FRAME); - { Fl_Check_Button* o = new Fl_Check_Button(254, 13, 55, 30, "Invert keys"); - o->tooltip("Turn upside-down the note frequencies"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Invert); - o->align(Fl_Align(132|FL_ALIGN_INSIDE)); - o->value(microtonal->Pinvertupdown); - } // Fl_Check_Button* o - { Fl_Counter* o = centerinvertcounter = new Fl_Counter(319, 13, 80, 20, "Center"); - centerinvertcounter->labelfont(1); - centerinvertcounter->labelsize(11); - centerinvertcounter->minimum(0); - centerinvertcounter->maximum(127); - centerinvertcounter->step(1); - centerinvertcounter->textfont(1); - centerinvertcounter->callback((Fl_Callback*)cb_centerinvertcounter); - centerinvertcounter->align(Fl_Align(130)); - o->lstep(microtonal->getoctavesize()); - o->value(microtonal->Pinvertupdowncenter); - if (microtonal->Pinvertupdown==0) o->deactivate(); - } // Fl_Counter* centerinvertcounter - o->end(); - } // Fl_Group* o - { Fl_Group* o = microtonalgroup = new Fl_Group(3, 49, 402, 398); - microtonalgroup->box(FL_ENGRAVED_FRAME); - { applybutton = new Fl_Button(8, 413, 107, 28, "Retune"); - applybutton->tooltip("Retune the synth accorging to the inputs from \"Tunnings\" and \"Keyboard Map\ -pings\""); - applybutton->box(FL_THIN_UP_BOX); - applybutton->labeltype(FL_EMBOSSED_LABEL); - applybutton->labelfont(1); - applybutton->labelsize(13); - applybutton->callback((Fl_Callback*)cb_applybutton); - } // Fl_Button* applybutton - { Fl_Value_Output* o = octavesizeoutput = new Fl_Value_Output(150, 423, 35, 17, "nts./oct."); - octavesizeoutput->tooltip("Notes/Octave"); - octavesizeoutput->labelsize(10); - octavesizeoutput->maximum(500); - octavesizeoutput->step(1); - octavesizeoutput->value(12); - octavesizeoutput->textfont(1); - octavesizeoutput->callback((Fl_Callback*)cb_octavesizeoutput); - octavesizeoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(microtonal->getoctavesize()); - } // Fl_Value_Output* octavesizeoutput - { Fl_Input* o = nameinput = new Fl_Input(8, 64, 285, 25, "Name:"); - nameinput->labelfont(1); - nameinput->labelsize(11); - nameinput->callback((Fl_Callback*)cb_nameinput); - nameinput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->insert((char *)microtonal->Pname); - } // Fl_Input* nameinput - { tuningsinput = new Fl_Input(8, 144, 182, 264, "Tunings:"); - tuningsinput->type(4); - tuningsinput->labelfont(1); - tuningsinput->labelsize(11); - tuningsinput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - tuningsinput->when(FL_WHEN_NEVER); - updateTuningsInput(); - } // Fl_Input* tuningsinput - { Fl_Input* o = commentinput = new Fl_Input(8, 104, 391, 25, "Comment:"); - commentinput->labelfont(1); - commentinput->labelsize(11); - commentinput->callback((Fl_Callback*)cb_commentinput); - commentinput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->insert((char *)microtonal->Pcomment); - } // Fl_Input* commentinput - { Fl_Counter* o = new Fl_Counter(313, 69, 70, 20, "Shift"); - o->type(1); - o->labelsize(11); - o->minimum(-63); - o->maximum(64); - o->step(1); - o->textfont(1); - o->callback((Fl_Callback*)cb_Shift); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->value(microtonal->Pscaleshift-64); - } // Fl_Counter* o - { Fl_Button* o = new Fl_Button(243, 411, 84, 15, "Import .SCL file"); - o->tooltip("Inport Scala .scl file (tunnings)"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Import); - } // Fl_Button* o - { keymappinggroup = new Fl_Group(193, 144, 206, 264, "Keyboard Mapping"); - keymappinggroup->box(FL_ENGRAVED_BOX); - keymappinggroup->labelfont(1); - keymappinggroup->labelsize(11); - { mappinginput = new Fl_Input(250, 147, 146, 258); - mappinginput->type(4); - mappinginput->labelfont(1); - mappinginput->labelsize(11); - mappinginput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - mappinginput->when(FL_WHEN_NEVER); - updateMappingInput(); - } // Fl_Input* mappinginput - { Fl_Counter* o = firstnotecounter = new Fl_Counter(199, 195, 42, 18, "First note"); - firstnotecounter->tooltip("First MIDI note number"); - firstnotecounter->type(1); - firstnotecounter->labelsize(10); - firstnotecounter->minimum(0); - firstnotecounter->maximum(127); - firstnotecounter->step(1); - firstnotecounter->textfont(1); - firstnotecounter->textsize(11); - firstnotecounter->callback((Fl_Callback*)cb_firstnotecounter); - firstnotecounter->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(microtonal->Pfirstkey); - } // Fl_Counter* firstnotecounter - { Fl_Counter* o = lastnotecounter = new Fl_Counter(199, 225, 42, 18, "Last note"); - lastnotecounter->tooltip("Last MIDI note number"); - lastnotecounter->type(1); - lastnotecounter->labelsize(10); - lastnotecounter->minimum(0); - lastnotecounter->maximum(127); - lastnotecounter->step(1); - lastnotecounter->value(127); - lastnotecounter->textfont(1); - lastnotecounter->textsize(11); - lastnotecounter->callback((Fl_Callback*)cb_lastnotecounter); - lastnotecounter->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(microtonal->Plastkey); - } // Fl_Counter* lastnotecounter - { Fl_Counter* o = middlenotecounter = new Fl_Counter(199, 267, 42, 18, "Midle note"); - middlenotecounter->tooltip("Midle note (where scale degree 0 is mapped to)"); - middlenotecounter->type(1); - middlenotecounter->labelsize(10); - middlenotecounter->minimum(0); - middlenotecounter->maximum(127); - middlenotecounter->step(1); - middlenotecounter->value(60); - middlenotecounter->textfont(1); - middlenotecounter->textsize(11); - middlenotecounter->callback((Fl_Callback*)cb_middlenotecounter); - middlenotecounter->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(microtonal->Pmiddlenote); - } // Fl_Counter* middlenotecounter - { Fl_Value_Output* o = mapsizeoutput = new Fl_Value_Output(201, 382, 44, 20, "Map Size"); - mapsizeoutput->labelsize(10); - mapsizeoutput->maximum(500); - mapsizeoutput->step(1); - mapsizeoutput->value(12); - mapsizeoutput->textfont(1); - mapsizeoutput->callback((Fl_Callback*)cb_mapsizeoutput); - mapsizeoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(microtonal->Pmapsize); - } // Fl_Value_Output* mapsizeoutput - keymappinggroup->end(); - } // Fl_Group* keymappinggroup - { Fl_Check_Button* o = mappingenabledbutton = new Fl_Check_Button(198, 150, 48, 21, "ON"); - mappingenabledbutton->tooltip("Enable the Mapping (otherwise the mapping is linear)"); - mappingenabledbutton->box(FL_FLAT_BOX); - mappingenabledbutton->down_box(FL_DOWN_BOX); - mappingenabledbutton->labelfont(1); - mappingenabledbutton->callback((Fl_Callback*)cb_mappingenabledbutton); - o->value(microtonal->Pmappingenabled); - if (microtonal->Pmappingenabled==0) keymappinggroup->deactivate(); - } // Fl_Check_Button* mappingenabledbutton - { Fl_Button* o = new Fl_Button(243, 428, 84, 16, "Import .kbm file"); - o->tooltip("Inport Scala .kbm file (keyboard mapping)"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Import1); - } // Fl_Button* o - if (microtonal->Penabled==0) o->deactivate(); - microtonalgroup->end(); - } // Fl_Group* microtonalgroup - { Fl_Group* o = new Fl_Group(108, 2, 140, 45); - o->box(FL_ENGRAVED_FRAME); - { Fl_Counter* o = anotecounter = new Fl_Counter(173, 17, 65, 20, "\"A\" Note"); - anotecounter->tooltip("The \"A\" note (the reference note for which freq. (\"A\" freq) is given)"); - anotecounter->labelfont(1); - anotecounter->labelsize(10); - anotecounter->minimum(0); - anotecounter->maximum(127); - anotecounter->step(1); - anotecounter->value(69); - anotecounter->textfont(1); - anotecounter->textsize(10); - anotecounter->callback((Fl_Callback*)cb_anotecounter); - anotecounter->align(Fl_Align(129)); - o->lstep(12); - o->value(microtonal->PAnote); - } // Fl_Counter* anotecounter - { Fl_Value_Input* o = afreqinput = new Fl_Value_Input(118, 17, 45, 20, "\"A\" Freq."); - afreqinput->tooltip("The freq. of \"A\" note (default=440.0)"); - afreqinput->labelfont(1); - afreqinput->labelsize(10); - afreqinput->minimum(1); - afreqinput->maximum(20000); - afreqinput->step(0.001); - afreqinput->value(440); - afreqinput->textfont(1); - afreqinput->textsize(10); - afreqinput->callback((Fl_Callback*)cb_afreqinput); - afreqinput->align(Fl_Align(FL_ALIGN_TOP)); - o->value(microtonal->PAfreq); - } // Fl_Value_Input* afreqinput - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(333, 413, 67, 28, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(3, 3, 102, 45, "Enable Microtonal"); - o->box(FL_PLASTIC_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Enable); - o->align(Fl_Align(132|FL_ALIGN_INSIDE)); - o->value(microtonal->Penabled); - } // Fl_Check_Button* o - microtonaluiwindow->end(); - } // Fl_Double_Window* microtonaluiwindow - return microtonaluiwindow; -} - -void MicrotonalUI::updateTuningsInput() { - char *tmpbuf=new char[100]; - - tuningsinput->cut(0,tuningsinput->maximum_size()); - - for (int i=0;igetoctavesize();i++){ - if (i!=0) tuningsinput->insert("\n"); - microtonal->tuningtoline(i,tmpbuf,100); - tuningsinput->insert(tmpbuf); - }; - - delete []tmpbuf; -} - -void MicrotonalUI::updateMappingInput() { - char *tmpbuf=new char[100]; - - mappinginput->cut(0,tuningsinput->maximum_size()); - - for (int i=0;iPmapsize;i++){ - if (i!=0) mappinginput->insert("\n"); - if ((microtonal->Pmapping[i])==-1) - snprintf(tmpbuf,100,"x"); - else snprintf(tmpbuf,100,"%d",microtonal->Pmapping[i]); - mappinginput->insert(tmpbuf); - }; - - delete []tmpbuf; -} - -MicrotonalUI::MicrotonalUI(Microtonal *microtonal_) { - microtonal=microtonal_; - - make_window(); -} - -MicrotonalUI::~MicrotonalUI() { - microtonaluiwindow->hide(); - delete(microtonaluiwindow); -} - -void MicrotonalUI::show() { - microtonaluiwindow->show(); -} - -void MicrotonalUI::apply() { - int err=microtonal->texttotunings(tuningsinput->value()); - if (err>=0) fl_alert("Parse Error: The input may contain only numbers (like 232.59)\n or divisions (like 121/64)."); - if (err==-2) fl_alert("Parse Error: The input is empty."); - octavesizeoutput->do_callback(); - - microtonal->texttomapping(mappinginput->value()); - mapsizeoutput->do_callback(); - anotecounter->do_callback(); - - //applybutton->color(FL_GRAY); -} diff --git a/plugins/zynaddsubfx/src/UI/MicrotonalUI.fl b/plugins/zynaddsubfx/src/UI/MicrotonalUI.fl deleted file mode 100644 index adc08b551..000000000 --- a/plugins/zynaddsubfx/src/UI/MicrotonalUI.fl +++ /dev/null @@ -1,270 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0106 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../Misc/Microtonal.h"} {public -} - -class MicrotonalUI {} { - Function {make_window()} {} { - Fl_Window microtonaluiwindow { - label Scales - xywh {99 164 405 450} type Double hide - } { - Fl_Group {} { - tooltip {Center where the note's freqs. are turned upside-down} xywh {249 2 155 45} box ENGRAVED_FRAME - } { - Fl_Check_Button {} { - label {Invert keys} - callback {microtonal->Pinvertupdown=(int) o->value(); -if (microtonal->Pinvertupdown==0) centerinvertcounter->deactivate(); - else centerinvertcounter->activate();} - tooltip {Turn upside-down the note frequencies} xywh {254 13 55 30} down_box DOWN_BOX labelfont 1 labelsize 11 align 148 - code0 {o->value(microtonal->Pinvertupdown);} - } - Fl_Counter centerinvertcounter { - label Center - callback {microtonal->Pinvertupdowncenter=(int) o->value();} - xywh {319 13 80 20} labelfont 1 labelsize 11 align 130 minimum 0 maximum 127 step 1 textfont 1 - code0 {o->lstep(microtonal->getoctavesize());} - code1 {o->value(microtonal->Pinvertupdowncenter);} - code2 {if (microtonal->Pinvertupdown==0) o->deactivate();} - } - } - Fl_Group microtonalgroup {selected - xywh {3 49 402 398} box ENGRAVED_FRAME - code0 {if (microtonal->Penabled==0) o->deactivate();} - } { - Fl_Button applybutton { - label Retune - callback {apply();} - tooltip {Retune the synth accorging to the inputs from "Tunnings" and "Keyboard Mappings"} xywh {8 413 107 28} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 - } - Fl_Value_Output octavesizeoutput { - label {nts./oct.} - callback {o->value(microtonal->getoctavesize());} - tooltip {Notes/Octave} xywh {150 423 35 17} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1 - code0 {o->value(microtonal->getoctavesize());} - } - Fl_Input nameinput { - label {Name:} - callback {snprintf((char *)microtonal->Pname,MICROTONAL_MAX_NAME_LEN,"%s",o->value());} - xywh {8 64 285 25} labelfont 1 labelsize 11 align 5 - code0 {o->insert((char *)microtonal->Pname);} - } - Fl_Input tuningsinput { - label {Tunings:} - xywh {8 144 182 264} type Multiline labelfont 1 labelsize 11 align 5 when 2 - code0 {updateTuningsInput();} - } - Fl_Input commentinput { - label {Comment:} - callback {snprintf((char *)microtonal->Pcomment,MICROTONAL_MAX_NAME_LEN,"%s",o->value());} - xywh {8 104 391 25} labelfont 1 labelsize 11 align 5 - code0 {o->insert((char *)microtonal->Pcomment);} - } - Fl_Counter {} { - label Shift - callback {microtonal->Pscaleshift=(int) o->value()+64;} - xywh {313 69 70 20} type Simple labelsize 11 align 1 minimum -63 maximum 64 step 1 textfont 1 - code0 {o->value(microtonal->Pscaleshift-64);} - } - Fl_Button {} { - label {Import .SCL file} - callback {const char *filename; -filename=fl_file_chooser("Open:","(*.scl)",NULL,0); -if (filename==NULL) return; -int result=microtonal->loadscl(filename); -if (result==0) { - updateTuningsInput(); - nameinput->cut(0,nameinput->maximum_size()); - nameinput->insert((char *)microtonal->Pname); - nameinput->position(0); - commentinput->cut(0,commentinput->maximum_size()); - commentinput->insert((char *)microtonal->Pname); - commentinput->position(0); - tuningsinput->position(0); - octavesizeoutput->do_callback(); - } else { - fl_alert("Error: Could not load the file."); - };} - tooltip {Inport Scala .scl file (tunnings)} xywh {243 411 84 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Group keymappinggroup { - label {Keyboard Mapping} open - xywh {193 144 206 264} box ENGRAVED_BOX labelfont 1 labelsize 11 - } { - Fl_Input mappinginput { - xywh {250 147 146 258} type Multiline labelfont 1 labelsize 11 align 5 when 2 - code0 {updateMappingInput();} - } - Fl_Counter firstnotecounter { - label {First note} - callback {microtonal->Pfirstkey=(int) o->value();} - tooltip {First MIDI note number} xywh {199 195 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->value(microtonal->Pfirstkey);} - } - Fl_Counter lastnotecounter { - label {Last note} - callback {microtonal->Plastkey=(int) o->value();} - tooltip {Last MIDI note number} xywh {199 225 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 11 - code0 {o->value(microtonal->Plastkey);} - } - Fl_Counter middlenotecounter { - label {Midle note} - callback {microtonal->Pmiddlenote=(int) o->value();} - tooltip {Midle note (where scale degree 0 is mapped to)} xywh {199 267 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 60 textfont 1 textsize 11 - code0 {o->value(microtonal->Pmiddlenote);} - } - Fl_Value_Output mapsizeoutput { - label {Map Size} - callback {o->value(microtonal->Pmapsize);} - xywh {201 382 44 20} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1 - code0 {o->value(microtonal->Pmapsize);} - } - } - Fl_Check_Button mappingenabledbutton { - label ON - callback {int x=(int) o->value(); -microtonal->Pmappingenabled=x; -if (x==0) keymappinggroup->deactivate(); - else keymappinggroup->activate(); -o->show();} - tooltip {Enable the Mapping (otherwise the mapping is linear)} xywh {198 150 48 21} box FLAT_BOX down_box DOWN_BOX labelfont 1 - code0 {o->value(microtonal->Pmappingenabled);} - code1 {if (microtonal->Pmappingenabled==0) keymappinggroup->deactivate();} - } - Fl_Button {} { - label {Import .kbm file} - callback {const char *filename; -filename=fl_file_chooser("Open:","(*.kbm)",NULL,0); -if (filename==NULL) return; -int result=microtonal->loadkbm(filename); -if (result==0) { - updateMappingInput(); - mappinginput->position(0); - mapsizeoutput->do_callback(); - firstnotecounter->value(microtonal->Pfirstkey); - lastnotecounter->value(microtonal->Plastkey); - middlenotecounter->value(microtonal->Pmiddlenote); - mapsizeoutput->do_callback(); - mappingenabledbutton->value(microtonal->Pmappingenabled); - mappingenabledbutton->do_callback(); - afreqinput->value(microtonal->PAfreq); - anotecounter->value(microtonal->PAnote); - anotecounter->do_callback(); - } else { - fl_alert("Error: Could not load the file."); - };} - tooltip {Inport Scala .kbm file (keyboard mapping)} xywh {243 428 84 16} box THIN_UP_BOX labelfont 1 labelsize 10 - } - } - Fl_Group {} { - xywh {108 2 140 45} box ENGRAVED_FRAME - } { - Fl_Counter anotecounter { - label {"A" Note} - callback {microtonal->PAnote=(int) o->value(); -if (microtonal->getnotefreq(microtonal->PAnote,0)<0.0) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); - -o->redraw();} - tooltip {The "A" note (the reference note for which freq. ("A" freq) is given)} xywh {173 17 65 20} labelfont 1 labelsize 10 align 129 minimum 0 maximum 127 step 1 value 69 textfont 1 textsize 10 - code0 {o->lstep(12);} - code1 {o->value(microtonal->PAnote);} - } - Fl_Value_Input afreqinput { - label {"A" Freq.} - callback {microtonal->PAfreq=o->value();} - tooltip {The freq. of "A" note (default=440.0)} xywh {118 17 45 20} labelfont 1 labelsize 10 align 1 minimum 1 maximum 20000 step 0.001 value 440 textfont 1 textsize 10 - code0 {o->value(microtonal->PAfreq);} - } - } - Fl_Button {} { - label Close - callback {microtonaluiwindow->hide();} - xywh {333 413 67 28} box THIN_UP_BOX - } - Fl_Check_Button {} { - label {Enable Microtonal} - callback {microtonal->Penabled=(int) o->value(); -if (microtonal->Penabled==0) microtonalgroup->deactivate(); - else microtonalgroup->activate();} - xywh {3 3 102 45} box PLASTIC_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 align 148 - code0 {o->value(microtonal->Penabled);} - } - } - } - Function {updateTuningsInput()} {} { - code {char *tmpbuf=new char[100]; - -tuningsinput->cut(0,tuningsinput->maximum_size()); - -for (int i=0;igetoctavesize();i++){ - if (i!=0) tuningsinput->insert("\\n"); - microtonal->tuningtoline(i,tmpbuf,100); - tuningsinput->insert(tmpbuf); -}; - -delete []tmpbuf;} {} - } - Function {updateMappingInput()} {} { - code {char *tmpbuf=new char[100]; - -mappinginput->cut(0,tuningsinput->maximum_size()); - -for (int i=0;iPmapsize;i++){ - if (i!=0) mappinginput->insert("\\n"); - if ((microtonal->Pmapping[i])==-1) - snprintf(tmpbuf,100,"x"); - else snprintf(tmpbuf,100,"%d",microtonal->Pmapping[i]); - mappinginput->insert(tmpbuf); -}; - -delete []tmpbuf;} {} - } - Function {MicrotonalUI(Microtonal *microtonal_)} {} { - code {microtonal=microtonal_; - -make_window();} {} - } - Function {~MicrotonalUI()} {} { - code {microtonaluiwindow->hide(); -delete(microtonaluiwindow);} {} - } - Function {show()} {} { - code {microtonaluiwindow->show();} {} - } - Function {apply()} {} { - code {int err=microtonal->texttotunings(tuningsinput->value()); -if (err>=0) fl_alert("Parse Error: The input may contain only numbers (like 232.59)\\n or divisions (like 121/64)."); -if (err==-2) fl_alert("Parse Error: The input is empty."); -octavesizeoutput->do_callback(); - -microtonal->texttomapping(mappinginput->value()); -mapsizeoutput->do_callback(); -anotecounter->do_callback(); - -//applybutton->color(FL_GRAY);} {} - } - decl {Microtonal *microtonal;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/MicrotonalUI.h b/plugins/zynaddsubfx/src/UI/MicrotonalUI.h deleted file mode 100644 index 3668b41e5..000000000 --- a/plugins/zynaddsubfx/src/UI/MicrotonalUI.h +++ /dev/null @@ -1,112 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef MicrotonalUI_h -#define MicrotonalUI_h -#include -#include -#include -#include -#include -#include -#include "../Misc/Microtonal.h" -#include -#include -#include -#include -#include -#include -#include -#include - -class MicrotonalUI { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *microtonaluiwindow; -private: - void cb_Invert_i(Fl_Check_Button*, void*); - static void cb_Invert(Fl_Check_Button*, void*); -public: - Fl_Counter *centerinvertcounter; -private: - void cb_centerinvertcounter_i(Fl_Counter*, void*); - static void cb_centerinvertcounter(Fl_Counter*, void*); -public: - Fl_Group *microtonalgroup; - Fl_Button *applybutton; -private: - void cb_applybutton_i(Fl_Button*, void*); - static void cb_applybutton(Fl_Button*, void*); -public: - Fl_Value_Output *octavesizeoutput; -private: - void cb_octavesizeoutput_i(Fl_Value_Output*, void*); - static void cb_octavesizeoutput(Fl_Value_Output*, void*); -public: - Fl_Input *nameinput; -private: - void cb_nameinput_i(Fl_Input*, void*); - static void cb_nameinput(Fl_Input*, void*); -public: - Fl_Input *tuningsinput; - Fl_Input *commentinput; -private: - void cb_commentinput_i(Fl_Input*, void*); - static void cb_commentinput(Fl_Input*, void*); - void cb_Shift_i(Fl_Counter*, void*); - static void cb_Shift(Fl_Counter*, void*); - void cb_Import_i(Fl_Button*, void*); - static void cb_Import(Fl_Button*, void*); -public: - Fl_Group *keymappinggroup; - Fl_Input *mappinginput; - Fl_Counter *firstnotecounter; -private: - void cb_firstnotecounter_i(Fl_Counter*, void*); - static void cb_firstnotecounter(Fl_Counter*, void*); -public: - Fl_Counter *lastnotecounter; -private: - void cb_lastnotecounter_i(Fl_Counter*, void*); - static void cb_lastnotecounter(Fl_Counter*, void*); -public: - Fl_Counter *middlenotecounter; -private: - void cb_middlenotecounter_i(Fl_Counter*, void*); - static void cb_middlenotecounter(Fl_Counter*, void*); -public: - Fl_Value_Output *mapsizeoutput; -private: - void cb_mapsizeoutput_i(Fl_Value_Output*, void*); - static void cb_mapsizeoutput(Fl_Value_Output*, void*); -public: - Fl_Check_Button *mappingenabledbutton; -private: - void cb_mappingenabledbutton_i(Fl_Check_Button*, void*); - static void cb_mappingenabledbutton(Fl_Check_Button*, void*); - void cb_Import1_i(Fl_Button*, void*); - static void cb_Import1(Fl_Button*, void*); -public: - Fl_Counter *anotecounter; -private: - void cb_anotecounter_i(Fl_Counter*, void*); - static void cb_anotecounter(Fl_Counter*, void*); -public: - Fl_Value_Input *afreqinput; -private: - void cb_afreqinput_i(Fl_Value_Input*, void*); - static void cb_afreqinput(Fl_Value_Input*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_Enable_i(Fl_Check_Button*, void*); - static void cb_Enable(Fl_Check_Button*, void*); -public: - void updateTuningsInput(); - void updateMappingInput(); - MicrotonalUI(Microtonal *microtonal_); - ~MicrotonalUI(); - void show(); - void apply(); -private: - Microtonal *microtonal; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/OscilGenUI.cc b/plugins/zynaddsubfx/src/UI/OscilGenUI.cc deleted file mode 100644 index 2925a1e14..000000000 --- a/plugins/zynaddsubfx/src/UI/OscilGenUI.cc +++ /dev/null @@ -1,1410 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "OscilGenUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later -#include -#include -#include -#include - -OscilSpectrum::OscilSpectrum(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - oscil=NULL; -} - -void OscilSpectrum::init(OscilGen *oscil_,int oscbase_,Master *master_) { - oscil=oscil_; - oscbase=oscbase_; - master=master_; -} - -void OscilSpectrum::draw() { - int ox=x(),oy=y(),lx=w(),ly=h(),i; - const int maxdb=60;//must be multiple of 10 - int GX=2; - int n=lx/GX-1; - if (n>OSCIL_SIZE/2) n=OSCIL_SIZE/2; - - REALTYPE x; - REALTYPE* spc=new REALTYPE[n]; - for (i=0;imutex); - if (oscbase==0) oscil->getspectrum(n,spc,0); - else oscil->getspectrum(n,spc,1); - pthread_mutex_unlock(&master->mutex); - - //normalize - REALTYPE max=0; - for (i=0;iactive_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->color()); - fl_line_style(FL_DOT); - - for (i=1;iactive_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); - fl_line_style(0); - - //draws the spectrum - for (i=0;idB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else x=0; - - int val=(int) ((ly-2)*x); - if (val>0) fl_line(ox+tmp,oy+ly-2-val,ox+tmp,oy+ly-2); - } - delete [] spc; -} - -PSlider::PSlider(int x,int y, int w, int h, const char *label):Fl_Slider(x,y,w,h,label) { - ; -} - -int PSlider::handle(int event) { - int X=x(),Y=y(),W=w(),H=h(); - - if ((!Fl::event_buttons())|| (event==0)||(Fl::event_shift()==0)) return(Fl_Slider::handle(event)); - - if (!Fl::event_inside(X,Y,W,H)) { - if (event==FL_DRAG){ - Fl_Slider::handle(FL_RELEASE); - Fl_Slider::handle(FL_LEAVE); - deactivate(); - activate(); - return(1); - }else{ - return(Fl_Slider::handle(event)); - }; - } else { - //Fl_Slider::handle(FL_FOCUS); - Fl_Slider::handle(FL_PUSH); - }; - - return(1); -} - -Oscilloscope::Oscilloscope(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - oscil=NULL; - phase=64; - oscbase=0; -} - -void Oscilloscope::init(OscilGen *oscil_,Master *master_) { - oscil=oscil_; - master=master_; -} - -void Oscilloscope::init(OscilGen *oscil_,int oscbase_,Master *master_) { - oscil=oscil_; - oscbase=oscbase_; - master=master_; -} - -void Oscilloscope::init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_) { - oscil=oscil_; - oscbase=oscbase_; - phase=phase_; - master=master_; -} - -void Oscilloscope::draw() { - int ox=x(),oy=y(),lx=w(),ly=h()-1,i; - REALTYPE smps[OSCIL_SIZE]; - pthread_mutex_lock(&master->mutex); - if (oscbase==0) oscil->get(smps,-1.0); - else oscil->getcurrentbasefunction(smps); - pthread_mutex_unlock(&master->mutex); - - if (damage()!=1){ - fl_color(0,0,0); - fl_rectf(ox,oy,lx,ly); - }; - - //normalize - REALTYPE max=0; - for (i=0;iactive_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); - int GX=16;if (lxactive_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->labelcolor()); - int lw=1; - //if ((lx<135)||(ly<135)) lw=1; - fl_line_style(0,lw); - int ph=(int)((phase-64.0)/128.0*OSCIL_SIZE+OSCIL_SIZE); - for (i=1;ivalue(x); - else x=127-(int)o->value(); -if (x==64) o->selection_color(0); - else o->selection_color(222); - -pthread_mutex_lock(&master->mutex); - oscil->Phmag[n]=x; - if (x==64) { - oscil->Phphase[n]=64; - phase->value(64); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -}; -} -void Oscilharmonic::cb_mag(PSlider* o, void* v) { - ((Oscilharmonic*)(o->parent()->user_data()))->cb_mag_i(o,v); -} - -void Oscilharmonic::cb_phase_i(PSlider* o, void*) { - int x=64; -if (Fl::event_button3()) o->value(x); - else x=(int)o->value(); - -pthread_mutex_lock(&master->mutex); - oscil->Phphase[n]=x; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -}; -} -void Oscilharmonic::cb_phase(PSlider* o, void* v) { - ((Oscilharmonic*)(o->parent()->user_data()))->cb_phase_i(o,v); -} - -Fl_Group* Oscilharmonic::make_window() { - { harmonic = new Fl_Group(0, 0, 90, 225); - harmonic->box(FL_FLAT_BOX); - harmonic->color(FL_BACKGROUND_COLOR); - harmonic->selection_color(FL_BACKGROUND_COLOR); - harmonic->labeltype(FL_NO_LABEL); - harmonic->labelfont(0); - harmonic->labelsize(14); - harmonic->labelcolor(FL_FOREGROUND_COLOR); - harmonic->user_data((void*)(this)); - harmonic->align(Fl_Align(FL_ALIGN_TOP)); - harmonic->when(FL_WHEN_RELEASE); - { PSlider* o = mag = new PSlider(0, 15, 15, 115); - mag->type(4); - mag->box(FL_FLAT_BOX); - mag->color(FL_BACKGROUND_COLOR); - mag->selection_color((Fl_Color)222); - mag->labeltype(FL_NORMAL_LABEL); - mag->labelfont(0); - mag->labelsize(14); - mag->labelcolor(FL_FOREGROUND_COLOR); - mag->maximum(127); - mag->step(1); - mag->value(64); - mag->callback((Fl_Callback*)cb_mag); - mag->align(Fl_Align(FL_ALIGN_BOTTOM)); - mag->when(FL_WHEN_CHANGED); - o->value(127-oscil->Phmag[n]); - if (oscil->Phmag[n]==64) o->selection_color(0); - } // PSlider* mag - { PSlider* o = phase = new PSlider(0, 135, 15, 75); - phase->type(4); - phase->box(FL_FLAT_BOX); - phase->color(FL_BACKGROUND_COLOR); - phase->selection_color((Fl_Color)222); - phase->labeltype(FL_NORMAL_LABEL); - phase->labelfont(0); - phase->labelsize(14); - phase->labelcolor(FL_FOREGROUND_COLOR); - phase->maximum(127); - phase->step(1); - phase->value(64); - phase->callback((Fl_Callback*)cb_phase); - phase->align(Fl_Align(FL_ALIGN_BOTTOM)); - phase->when(FL_WHEN_CHANGED); - o->value(oscil->Phphase[n]); - } // PSlider* phase - { Fl_Box* o = new Fl_Box(15, 70, 5, 5); - o->box(FL_FLAT_BOX); - o->color(FL_DARK2); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(15, 170, 5, 5); - o->box(FL_FLAT_BOX); - o->color(FL_DARK2); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(0, 210, 20, 15, "01"); - o->labelfont(1); - o->labelsize(9); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(0, 0, 20, 15, "01"); - o->labelfont(1); - o->labelsize(9); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); - } // Fl_Box* o - harmonic->end(); - } // Fl_Group* harmonic - return harmonic; -} - -Oscilharmonic::Oscilharmonic(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - n=0; - oscil=NULL; - display=NULL; - applybutton=NULL; - cbwidget=NULL; -} - -void Oscilharmonic::init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, Master *master_) { - oscil=oscil_; - n=n_; - display=display_; - master=master_; - oldosc=oldosc_; - cbwidget=cbwidget_; - applybutton=applybutton_; - make_window(); - end(); - harmonic->show(); -} - -void Oscilharmonic::refresh() { - mag->value(127-oscil->Phmag[n]); - phase->value(oscil->Phphase[n]); - - if (oscil->Phmag[n]==64) mag->selection_color(0); - else mag->selection_color(222); -} - -Oscilharmonic::~Oscilharmonic() { - harmonic->hide(); - //delete(harmonic); -} - -void OscilEditor::cb_applybutton_i(Fl_Button*, void*) { - applybutton->color(FL_GRAY); -applybutton->redraw(); -if (cbapplywidget!=NULL) { - cbapplywidget->do_callback(); - cbapplywidget->color(FL_GRAY); - cbapplywidget->redraw(); -}; -} -void OscilEditor::cb_applybutton(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_applybutton_i(o,v); -} - -void OscilEditor::cb_rndslider_i(Fl_Value_Slider* o, void*) { - oscil->Prand=(int)o->value()+64; -oscildisplaygroup->redraw(); -oldosc->redraw(); -} -void OscilEditor::cb_rndslider(Fl_Value_Slider* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_rndslider_i(o,v); -} - -void OscilEditor::cb_hrndtype_i(Fl_Choice* o, void*) { - oscil->Pamprandtype=(int) o->value(); -} -void OscilEditor::cb_hrndtype(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->parent()->user_data()))->cb_hrndtype_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_hrndtype[] = { - {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sin", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_hrnddial_i(WidgetPDial* o, void*) { - oscil->Pamprandpower=(int) o->value(); -} -void OscilEditor::cb_hrnddial(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->parent()->user_data()))->cb_hrnddial_i(o,v); -} - -void OscilEditor::cb_bfslider_i(WidgetPDial* o, void*) { - oscil->Pbasefuncpar=(int)o->value()+64; -basefuncdisplaygroup->redraw(); -bfparval->value(oscil->Pbasefuncpar-64); - -redrawoscil(); -} -void OscilEditor::cb_bfslider(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_bfslider_i(o,v); -} - -void OscilEditor::cb_bftype_i(Fl_Choice* o, void*) { - oscil->Pcurrentbasefunc=(int) o->value(); - -basefuncdisplaygroup->redraw(); -redrawoscil(); - -if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); - else basefuncmodulation->activate(); -} -void OscilEditor::cb_bftype(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_bftype_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_bftype[] = { - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Triangle", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Pulse", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Saw", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Power", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Gauss", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Diode", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"AbsSine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"PulseSine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"StrchSine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Chirp", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"AbsStrSine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Chebyshev", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Sqr", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_bfmodtype_i(Fl_Choice* o, void*) { - oscil->Pbasefuncmodulation=(int) o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil(); -} -void OscilEditor::cb_bfmodtype(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->parent()->user_data()))->cb_bfmodtype_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_bfmodtype[] = { - {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Rev", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_bfmodpar1_i(WidgetPDial* o, void*) { - oscil->Pbasefuncmodulationpar1=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil(); -} -void OscilEditor::cb_bfmodpar1(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->parent()->user_data()))->cb_bfmodpar1_i(o,v); -} - -void OscilEditor::cb_bfmodpar2_i(WidgetPDial* o, void*) { - oscil->Pbasefuncmodulationpar2=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil(); -} -void OscilEditor::cb_bfmodpar2(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->parent()->user_data()))->cb_bfmodpar2_i(o,v); -} - -void OscilEditor::cb_bfmodpar3_i(WidgetPDial* o, void*) { - oscil->Pbasefuncmodulationpar3=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil(); -} -void OscilEditor::cb_bfmodpar3(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->parent()->user_data()))->cb_bfmodpar3_i(o,v); -} - -void OscilEditor::cb_magtype_i(Fl_Choice* o, void*) { - oscil->Phmagtype=(int) o->value(); -basefuncdisplaygroup->redraw(); - -redrawoscil(); -} -void OscilEditor::cb_magtype(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_magtype_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_magtype[] = { - {"Linear", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-40dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-60dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-80dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-100dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_Use_i(Fl_Button*, void*) { - oscil->useasbase(); -if (autoclearbutton->value()){ - for (int i=0;imag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; - }; - oscil->Phmag[0]=127; - - oscil->Pharmonicshift=0; - harmonicshiftcounter->value(0); - - h[0]->mag->value(0); - wshbutton->value(0); - wshbutton->do_callback(); - fltbutton->value(0); - fltbutton->do_callback(); - sabutton->value(0); - sabutton->do_callback(); -}; - -pthread_mutex_lock(&master->mutex); - for (int i=0;iPhmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -basefuncdisplaygroup->redraw(); -redrawoscil(); -} -void OscilEditor::cb_Use(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_Use_i(o,v); -} - -void OscilEditor::cb_Close_i(Fl_Button*, void*) { - osceditUI->hide(); -} -void OscilEditor::cb_Close(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void OscilEditor::cb_Clear_i(Fl_Button*, void*) { - if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return; - -for (int i=0;imag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; -}; -oscil->Phmag[0]=127; -h[0]->mag->value(0); - -for (int i=0;iPhmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); -}; - -//harmonics->redraw(); - -pthread_mutex_lock(&master->mutex); - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -redrawoscil(); -} -void OscilEditor::cb_Clear(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_Clear_i(o,v); -} - -void OscilEditor::cb_wshbutton_i(Fl_Choice* o, void*) { - oscil->Pwaveshapingfunction=(int) o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil(); -} -void OscilEditor::cb_wshbutton(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_wshbutton_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_wshbutton[] = { - {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Atan", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Asym1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Qnts", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Zigzg", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lmt", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LmtU", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LmtL", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"ILmt", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Clip", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Asym2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sgm", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_wshpar_i(WidgetPDial* o, void*) { - oscil->Pwaveshaping=(int)o->value()+64; -wsparval->value(oscil->Pwaveshaping-64); -redrawoscil(); -} -void OscilEditor::cb_wshpar(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_wshpar_i(o,v); -} - -void OscilEditor::cb_fltbutton_i(Fl_Choice* o, void*) { - oscil->Pfiltertype=(int) o->value(); - -redrawoscil(); -} -void OscilEditor::cb_fltbutton(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_fltbutton_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_fltbutton[] = { - {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LP1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HP1a", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HP1b", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"BP1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"BS1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LP2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"HP2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"BP2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"BS2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Cos", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sin", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"LSh", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"S", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_filtervalue1_i(WidgetPDial* o, void*) { - oscil->Pfilterpar1=(int)o->value(); - -redrawoscil(); -} -void OscilEditor::cb_filtervalue1(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_filtervalue1_i(o,v); -} - -void OscilEditor::cb_filterpref_i(Fl_Check_Button* o, void*) { - oscil->Pfilterbeforews=(int)o->value(); - -redrawoscil(); -} -void OscilEditor::cb_filterpref(Fl_Check_Button* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_filterpref_i(o,v); -} - -void OscilEditor::cb_filtervalue2_i(WidgetPDial* o, void*) { - oscil->Pfilterpar2=(int)o->value(); - -redrawoscil(); -} -void OscilEditor::cb_filtervalue2(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_filtervalue2_i(o,v); -} - -void OscilEditor::cb_sabutton_i(Fl_Choice* o, void*) { - oscil->Psatype=(int) o->value(); -redrawoscil(); -} -void OscilEditor::cb_sabutton(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_sabutton_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_sabutton[] = { - {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"ThrsD", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"ThrsU", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_sadjpar_i(WidgetPDial* o, void*) { - oscil->Psapar=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_sadjpar(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_sadjpar_i(o,v); -} - -void OscilEditor::cb_harmonicshiftcounter_i(Fl_Counter* o, void*) { - oscil->Pharmonicshift=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_harmonicshiftcounter(Fl_Counter* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_harmonicshiftcounter_i(o,v); -} - -void OscilEditor::cb_harmonicshiftpre_i(Fl_Check_Button* o, void*) { - oscil->Pharmonicshiftfirst=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_harmonicshiftpre(Fl_Check_Button* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_harmonicshiftpre_i(o,v); -} - -void OscilEditor::cb_R_i(Fl_Button*, void*) { - oscil->Pharmonicshift=0; -harmonicshiftcounter->value(0); -redrawoscil(); -} -void OscilEditor::cb_R(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_R_i(o,v); -} - -void OscilEditor::cb_adhrtype_i(Fl_Choice* o, void*) { - oscil->Padaptiveharmonics=(int) o->value(); -redrawoscil(); -} -void OscilEditor::cb_adhrtype(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_adhrtype_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_adhrtype[] = { - {"OFF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"ON", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Square", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"2xSub", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"2xAdd", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"3xSub", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"3xAdd", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"4xSub", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"4xAdd", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_adhrpow_i(WidgetPDial* o, void*) { - oscil->Padaptiveharmonicspower=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_adhrpow(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_adhrpow_i(o,v); -} - -void OscilEditor::cb_adhrbf_i(WidgetPDial* o, void*) { - oscil->Padaptiveharmonicsbasefreq=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_adhrbf(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_adhrbf_i(o,v); -} - -void OscilEditor::cb_adhrpar_i(Fl_Slider* o, void*) { - oscil->Padaptiveharmonicspar=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_adhrpar(Fl_Slider* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_adhrpar_i(o,v); -} - -void OscilEditor::cb_modtype_i(Fl_Choice* o, void*) { - oscil->Pmodulation=(int) o->value(); - -redrawoscil(); -} -void OscilEditor::cb_modtype(Fl_Choice* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_modtype_i(o,v); -} - -Fl_Menu_Item OscilEditor::menu_modtype[] = { - {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Rev", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Pow", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void OscilEditor::cb_modpar1_i(WidgetPDial* o, void*) { - oscil->Pmodulationpar1=(int)o->value(); - -redrawoscil(); -} -void OscilEditor::cb_modpar1(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_modpar1_i(o,v); -} - -void OscilEditor::cb_modpar2_i(WidgetPDial* o, void*) { - oscil->Pmodulationpar2=(int)o->value(); - -redrawoscil(); -} -void OscilEditor::cb_modpar2(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_modpar2_i(o,v); -} - -void OscilEditor::cb_modpar3_i(WidgetPDial* o, void*) { - oscil->Pmodulationpar3=(int)o->value(); -redrawoscil(); -} -void OscilEditor::cb_modpar3(WidgetPDial* o, void* v) { - ((OscilEditor*)(o->parent()->parent()->user_data()))->cb_modpar3_i(o,v); -} - -void OscilEditor::cb_Sine_i(Fl_Button*, void*) { - if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return; - -pthread_mutex_lock(&master->mutex); - oscil->convert2sine(0); -pthread_mutex_unlock(&master->mutex); - -redrawoscil(); -refresh(); -} -void OscilEditor::cb_Sine(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_Sine_i(o,v); -} - -void OscilEditor::cb_C_i(Fl_Button*, void*) { - presetsui->copy(oscil); -} -void OscilEditor::cb_C(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void OscilEditor::cb_P_i(Fl_Button*, void*) { - presetsui->paste(oscil,this); -} -void OscilEditor::cb_P(Fl_Button* o, void* v) { - ((OscilEditor*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -Fl_Double_Window* OscilEditor::make_window() { - { Fl_Double_Window* o = osceditUI = new Fl_Double_Window(735, 595, "ADsynth Oscillator Editor"); - osceditUI->user_data((void*)(this)); - { Fl_Button* o = applybutton = new Fl_Button(300, 280, 60, 20, "Apply"); - applybutton->box(FL_THIN_UP_BOX); - applybutton->labelfont(1); - applybutton->callback((Fl_Callback*)cb_applybutton); - if (!oscil->ADvsPAD) o->hide(); - } // Fl_Button* applybutton - { oscildisplaygroup = new Fl_Group(5, 5, 360, 300); - oscildisplaygroup->box(FL_ENGRAVED_FRAME); - { Fl_Group* o = new Fl_Group(10, 85, 350, 190); - o->box(FL_THIN_DOWN_BOX); - o->color(FL_GRAY0); - o->selection_color((Fl_Color)71); - o->labelcolor((Fl_Color)179); - Oscilloscope *osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),""); - osc->init(oscil,master); - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(120, 10, 110, 20, "Oscillator"); - o->box(FL_FLAT_BOX); - o->labelfont(1); - } // Fl_Box* o - { Fl_Value_Slider* o = rndslider = new Fl_Value_Slider(140, 285, 100, 10, "rnd"); - rndslider->tooltip("Oscilator Phase Randomness: smaller than 0 is \"group\", larger than 0 is for\ - each harmonic"); - rndslider->type(5); - rndslider->box(FL_FLAT_BOX); - rndslider->labelsize(10); - rndslider->minimum(-64); - rndslider->maximum(63); - rndslider->step(1); - rndslider->callback((Fl_Callback*)cb_rndslider); - rndslider->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - if (oscil->ADvsPAD) o->hide(); - } // Fl_Value_Slider* rndslider - { Fl_Group* o = new Fl_Group(10, 30, 350, 50); - o->box(FL_THIN_DOWN_BOX); - o->color(FL_GRAY0); - o->selection_color((Fl_Color)218); - o->labelcolor(FL_GREEN); - OscilSpectrum *spc=new OscilSpectrum(o->x(),o->y(),o->w(),o->h(),""); - spc->init(oscil,0,master); - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(246, 277, 115, 25); - o->box(FL_ENGRAVED_BOX); - { hrndtype = new Fl_Choice(281, 282, 50, 15, "H.rnd"); - hrndtype->tooltip("Harmonic Amplitude Randomness"); - hrndtype->down_box(FL_BORDER_BOX); - hrndtype->labelsize(10); - hrndtype->textsize(10); - hrndtype->callback((Fl_Callback*)cb_hrndtype); - hrndtype->menu(menu_hrndtype); - } // Fl_Choice* hrndtype - { hrnddial = new WidgetPDial(338, 280, 18, 18); - hrnddial->tooltip("Oscillator\'s spectrum adjust parameter"); - hrnddial->box(FL_OVAL_BOX); - hrnddial->color(FL_BACKGROUND_COLOR); - hrnddial->selection_color(FL_INACTIVE_COLOR); - hrnddial->labeltype(FL_NORMAL_LABEL); - hrnddial->labelfont(0); - hrnddial->labelsize(14); - hrnddial->labelcolor(FL_FOREGROUND_COLOR); - hrnddial->maximum(127); - hrnddial->step(1); - hrnddial->callback((Fl_Callback*)cb_hrnddial); - hrnddial->align(Fl_Align(FL_ALIGN_BOTTOM)); - hrnddial->when(FL_WHEN_CHANGED); - } // WidgetPDial* hrnddial - if (oscil->ADvsPAD) o->hide(); - o->end(); - } // Fl_Group* o - oscildisplaygroup->end(); - } // Fl_Group* oscildisplaygroup - { Fl_Box* o = new Fl_Box(495, 15, 110, 20, "Base Func."); - o->box(FL_FLAT_BOX); - o->labelfont(1); - } // Fl_Box* o - { basefuncdisplaygroup = new Fl_Group(365, 5, 360, 300); - basefuncdisplaygroup->box(FL_ENGRAVED_FRAME); - { Fl_Group* o = new Fl_Group(370, 85, 350, 190); - o->box(FL_THIN_DOWN_BOX); - o->color(FL_GRAY0); - o->selection_color((Fl_Color)71); - o->labelcolor((Fl_Color)179); - Oscilloscope *osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),""); - osc->init(oscil,1,master); - o->end(); - } // Fl_Group* o - { bfslider = new WidgetPDial(520, 280, 20, 20); - bfslider->tooltip("Base Function Parameter"); - bfslider->box(FL_OVAL_BOX); - bfslider->color(FL_BACKGROUND_COLOR); - bfslider->selection_color(FL_INACTIVE_COLOR); - bfslider->labeltype(FL_NORMAL_LABEL); - bfslider->labelfont(0); - bfslider->labelsize(14); - bfslider->labelcolor(FL_FOREGROUND_COLOR); - bfslider->minimum(-64); - bfslider->maximum(63); - bfslider->step(1); - bfslider->callback((Fl_Callback*)cb_bfslider); - bfslider->align(Fl_Align(FL_ALIGN_BOTTOM)); - bfslider->when(FL_WHEN_CHANGED); - } // WidgetPDial* bfslider - { bftype = new Fl_Choice(370, 285, 90, 15, "Base.F.."); - bftype->down_box(FL_BORDER_BOX); - bftype->labelsize(10); - bftype->textsize(11); - bftype->callback((Fl_Callback*)cb_bftype); - bftype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - bftype->menu(menu_bftype); - } // Fl_Choice* bftype - { Fl_Box* o = new Fl_Box(480, 10, 110, 20, "Base Func."); - o->box(FL_FLAT_BOX); - o->labelfont(1); - } // Fl_Box* o - { Fl_Group* o = new Fl_Group(370, 30, 350, 50); - o->box(FL_THIN_DOWN_BOX); - o->color(FL_GRAY0); - o->selection_color((Fl_Color)218); - o->labelcolor(FL_GREEN); - OscilSpectrum *spc=new OscilSpectrum (o->x(),o->y(),o->w(),o->h(),""); - spc->init(oscil,1,master); - o->end(); - } // Fl_Group* o - { bfparval = new Fl_Value_Output(490, 285, 25, 15, "Par."); - bfparval->labelsize(12); - bfparval->minimum(-63); - bfparval->maximum(63); - bfparval->step(1); - } // Fl_Value_Output* bfparval - { basefuncmodulation = new Fl_Group(550, 276, 169, 25); - basefuncmodulation->box(FL_ENGRAVED_BOX); - { bfmodtype = new Fl_Choice(599, 281, 50, 15, "B.F.Mod."); - bfmodtype->tooltip("Base function modulation"); - bfmodtype->down_box(FL_BORDER_BOX); - bfmodtype->labelsize(10); - bfmodtype->textsize(10); - bfmodtype->callback((Fl_Callback*)cb_bfmodtype); - bfmodtype->menu(menu_bfmodtype); - } // Fl_Choice* bfmodtype - { bfmodpar1 = new WidgetPDial(659, 281, 15, 15); - bfmodpar1->tooltip("Oscillator\'s modulation parameter 1"); - bfmodpar1->box(FL_OVAL_BOX); - bfmodpar1->color(FL_BACKGROUND_COLOR); - bfmodpar1->selection_color(FL_INACTIVE_COLOR); - bfmodpar1->labeltype(FL_NORMAL_LABEL); - bfmodpar1->labelfont(0); - bfmodpar1->labelsize(14); - bfmodpar1->labelcolor(FL_FOREGROUND_COLOR); - bfmodpar1->maximum(127); - bfmodpar1->step(1); - bfmodpar1->callback((Fl_Callback*)cb_bfmodpar1); - bfmodpar1->align(Fl_Align(FL_ALIGN_BOTTOM)); - bfmodpar1->when(FL_WHEN_CHANGED); - } // WidgetPDial* bfmodpar1 - { bfmodpar2 = new WidgetPDial(679, 281, 15, 15); - bfmodpar2->tooltip("Oscillator\'s modulation parameter 2"); - bfmodpar2->box(FL_OVAL_BOX); - bfmodpar2->color(FL_BACKGROUND_COLOR); - bfmodpar2->selection_color(FL_INACTIVE_COLOR); - bfmodpar2->labeltype(FL_NORMAL_LABEL); - bfmodpar2->labelfont(0); - bfmodpar2->labelsize(14); - bfmodpar2->labelcolor(FL_FOREGROUND_COLOR); - bfmodpar2->maximum(127); - bfmodpar2->step(1); - bfmodpar2->callback((Fl_Callback*)cb_bfmodpar2); - bfmodpar2->align(Fl_Align(FL_ALIGN_BOTTOM)); - bfmodpar2->when(FL_WHEN_CHANGED); - } // WidgetPDial* bfmodpar2 - { bfmodpar3 = new WidgetPDial(699, 281, 15, 15); - bfmodpar3->tooltip("Oscillator\'s modulation parameter 3"); - bfmodpar3->box(FL_OVAL_BOX); - bfmodpar3->color(FL_BACKGROUND_COLOR); - bfmodpar3->selection_color(FL_INACTIVE_COLOR); - bfmodpar3->labeltype(FL_NORMAL_LABEL); - bfmodpar3->labelfont(0); - bfmodpar3->labelsize(14); - bfmodpar3->labelcolor(FL_FOREGROUND_COLOR); - bfmodpar3->maximum(127); - bfmodpar3->step(1); - bfmodpar3->callback((Fl_Callback*)cb_bfmodpar3); - bfmodpar3->align(Fl_Align(FL_ALIGN_BOTTOM)); - bfmodpar3->when(FL_WHEN_CHANGED); - } // WidgetPDial* bfmodpar3 - if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); - basefuncmodulation->end(); - } // Fl_Group* basefuncmodulation - basefuncdisplaygroup->end(); - } // Fl_Group* basefuncdisplaygroup - { magtype = new Fl_Choice(70, 280, 65, 20, "Mag.Type"); - magtype->down_box(FL_BORDER_BOX); - magtype->labelsize(11); - magtype->textsize(11); - magtype->callback((Fl_Callback*)cb_magtype); - magtype->menu(menu_magtype); - } // Fl_Choice* magtype - { Fl_Button* o = new Fl_Button(5, 313, 85, 20, "Use as base"); - o->tooltip("Use this Oscillator as base function"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Use); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(668, 565, 62, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(670, 505, 55, 15, "Clear"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Clear); - } // Fl_Button* o - { Fl_Group* o = new Fl_Group(135, 308, 150, 30); - o->box(FL_ENGRAVED_BOX); - { wshbutton = new Fl_Choice(165, 313, 55, 20, "Wsh."); - wshbutton->tooltip("Waveshaping function"); - wshbutton->down_box(FL_BORDER_BOX); - wshbutton->labelsize(10); - wshbutton->textsize(10); - wshbutton->callback((Fl_Callback*)cb_wshbutton); - wshbutton->menu(menu_wshbutton); - } // Fl_Choice* wshbutton - { wshpar = new WidgetPDial(260, 313, 20, 20); - wshpar->tooltip("Waveshaping Parameter"); - wshpar->box(FL_OVAL_BOX); - wshpar->color(FL_BACKGROUND_COLOR); - wshpar->selection_color(FL_INACTIVE_COLOR); - wshpar->labeltype(FL_NORMAL_LABEL); - wshpar->labelfont(0); - wshpar->labelsize(14); - wshpar->labelcolor(FL_FOREGROUND_COLOR); - wshpar->minimum(-64); - wshpar->maximum(63); - wshpar->step(1); - wshpar->callback((Fl_Callback*)cb_wshpar); - wshpar->align(Fl_Align(FL_ALIGN_BOTTOM)); - wshpar->when(FL_WHEN_CHANGED); - } // WidgetPDial* wshpar - { wsparval = new Fl_Value_Output(228, 316, 25, 15); - wsparval->labelsize(12); - wsparval->minimum(-63); - wsparval->maximum(63); - wsparval->step(1); - } // Fl_Value_Output* wsparval - o->end(); - } // Fl_Group* o - { autoclearbutton = new Fl_Light_Button(95, 313, 35, 20, "Clr."); - autoclearbutton->tooltip("Auto clear when using the oscillator as base function"); - autoclearbutton->box(FL_THIN_UP_BOX); - autoclearbutton->value(1); - autoclearbutton->labelfont(1); - autoclearbutton->labelsize(10); - } // Fl_Light_Button* autoclearbutton - { Fl_Group* o = new Fl_Group(285, 308, 155, 30); - o->box(FL_ENGRAVED_BOX); - { fltbutton = new Fl_Choice(315, 313, 50, 20, "Filter"); - fltbutton->tooltip("Oscillator\'s filter type"); - fltbutton->down_box(FL_BORDER_BOX); - fltbutton->labelsize(10); - fltbutton->textsize(10); - fltbutton->callback((Fl_Callback*)cb_fltbutton); - fltbutton->menu(menu_fltbutton); - } // Fl_Choice* fltbutton - { filtervalue1 = new WidgetPDial(367, 313, 20, 20); - filtervalue1->tooltip("Oscillator\'s filter parameter1"); - filtervalue1->box(FL_OVAL_BOX); - filtervalue1->color(FL_BACKGROUND_COLOR); - filtervalue1->selection_color(FL_INACTIVE_COLOR); - filtervalue1->labeltype(FL_NORMAL_LABEL); - filtervalue1->labelfont(0); - filtervalue1->labelsize(14); - filtervalue1->labelcolor(FL_FOREGROUND_COLOR); - filtervalue1->maximum(127); - filtervalue1->step(1); - filtervalue1->callback((Fl_Callback*)cb_filtervalue1); - filtervalue1->align(Fl_Align(FL_ALIGN_BOTTOM)); - filtervalue1->when(FL_WHEN_CHANGED); - } // WidgetPDial* filtervalue1 - { filterpref = new Fl_Check_Button(415, 313, 20, 20, "p"); - filterpref->tooltip("Apply the filter before the waveshaping"); - filterpref->down_box(FL_DOWN_BOX); - filterpref->labelsize(10); - filterpref->callback((Fl_Callback*)cb_filterpref); - filterpref->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Check_Button* filterpref - { filtervalue2 = new WidgetPDial(392, 313, 20, 20); - filtervalue2->tooltip("Oscillator\'s filter parameter2"); - filtervalue2->box(FL_OVAL_BOX); - filtervalue2->color(FL_BACKGROUND_COLOR); - filtervalue2->selection_color(FL_INACTIVE_COLOR); - filtervalue2->labeltype(FL_NORMAL_LABEL); - filtervalue2->labelfont(0); - filtervalue2->labelsize(14); - filtervalue2->labelcolor(FL_FOREGROUND_COLOR); - filtervalue2->maximum(127); - filtervalue2->step(1); - filtervalue2->callback((Fl_Callback*)cb_filtervalue2); - filtervalue2->align(Fl_Align(FL_ALIGN_BOTTOM)); - filtervalue2->when(FL_WHEN_CHANGED); - } // WidgetPDial* filtervalue2 - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(590, 308, 135, 30); - o->box(FL_ENGRAVED_BOX); - { sabutton = new Fl_Choice(630, 313, 60, 20, "Sp.adj."); - sabutton->tooltip("Oscillator\'s spectrum adjust"); - sabutton->down_box(FL_BORDER_BOX); - sabutton->labelsize(10); - sabutton->textsize(10); - sabutton->callback((Fl_Callback*)cb_sabutton); - sabutton->menu(menu_sabutton); - } // Fl_Choice* sabutton - { sadjpar = new WidgetPDial(695, 313, 20, 20); - sadjpar->tooltip("Oscillator\'s spectrum adjust parameter"); - sadjpar->box(FL_OVAL_BOX); - sadjpar->color(FL_BACKGROUND_COLOR); - sadjpar->selection_color(FL_INACTIVE_COLOR); - sadjpar->labeltype(FL_NORMAL_LABEL); - sadjpar->labelfont(0); - sadjpar->labelsize(14); - sadjpar->labelcolor(FL_FOREGROUND_COLOR); - sadjpar->maximum(127); - sadjpar->step(1); - sadjpar->callback((Fl_Callback*)cb_sadjpar); - sadjpar->align(Fl_Align(FL_ALIGN_BOTTOM)); - sadjpar->when(FL_WHEN_CHANGED); - } // WidgetPDial* sadjpar - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(665, 340, 65, 65); - o->box(FL_ENGRAVED_BOX); - { harmonicshiftcounter = new Fl_Counter(670, 365, 55, 15, "Harmonic Shift"); - harmonicshiftcounter->type(1); - harmonicshiftcounter->labelsize(10); - harmonicshiftcounter->minimum(-64); - harmonicshiftcounter->maximum(64); - harmonicshiftcounter->step(1); - harmonicshiftcounter->textfont(1); - harmonicshiftcounter->textsize(10); - harmonicshiftcounter->callback((Fl_Callback*)cb_harmonicshiftcounter); - harmonicshiftcounter->align(Fl_Align(129)); - } // Fl_Counter* harmonicshiftcounter - { harmonicshiftpre = new Fl_Check_Button(690, 385, 34, 15, "preH"); - harmonicshiftpre->tooltip("Apply the harmonic shift before the waveshaping and filtering"); - harmonicshiftpre->down_box(FL_DOWN_BOX); - harmonicshiftpre->labelsize(10); - harmonicshiftpre->callback((Fl_Callback*)cb_harmonicshiftpre); - harmonicshiftpre->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Check_Button* harmonicshiftpre - { Fl_Button* o = new Fl_Button(670, 385, 20, 15, "R"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_R); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(665, 410, 65, 90); - o->box(FL_ENGRAVED_FRAME); - { adhrtype = new Fl_Choice(670, 425, 55, 15, "Adpt.Harm."); - adhrtype->tooltip("The type of the addaptive harmonics"); - adhrtype->down_box(FL_BORDER_BOX); - adhrtype->labelsize(10); - adhrtype->textsize(10); - adhrtype->callback((Fl_Callback*)cb_adhrtype); - adhrtype->align(Fl_Align(129)); - adhrtype->when(FL_WHEN_RELEASE_ALWAYS); - adhrtype->menu(menu_adhrtype); - } // Fl_Choice* adhrtype - { adhrpow = new WidgetPDial(700, 460, 25, 25, "pow"); - adhrpow->tooltip("Adaptive harmonics power"); - adhrpow->box(FL_OVAL_BOX); - adhrpow->color(FL_BACKGROUND_COLOR); - adhrpow->selection_color(FL_INACTIVE_COLOR); - adhrpow->labeltype(FL_NORMAL_LABEL); - adhrpow->labelfont(0); - adhrpow->labelsize(10); - adhrpow->labelcolor(FL_FOREGROUND_COLOR); - adhrpow->maximum(200); - adhrpow->step(1); - adhrpow->callback((Fl_Callback*)cb_adhrpow); - adhrpow->align(Fl_Align(FL_ALIGN_BOTTOM)); - adhrpow->when(FL_WHEN_CHANGED); - } // WidgetPDial* adhrpow - { adhrbf = new WidgetPDial(670, 460, 25, 25, "baseF"); - adhrbf->tooltip("Adaptive harmonics base frequency"); - adhrbf->box(FL_OVAL_BOX); - adhrbf->color(FL_BACKGROUND_COLOR); - adhrbf->selection_color(FL_INACTIVE_COLOR); - adhrbf->labeltype(FL_NORMAL_LABEL); - adhrbf->labelfont(0); - adhrbf->labelsize(10); - adhrbf->labelcolor(FL_FOREGROUND_COLOR); - adhrbf->maximum(255); - adhrbf->step(1); - adhrbf->callback((Fl_Callback*)cb_adhrbf); - adhrbf->align(Fl_Align(FL_ALIGN_BOTTOM)); - adhrbf->when(FL_WHEN_CHANGED); - } // WidgetPDial* adhrbf - { adhrpar = new Fl_Slider(670, 445, 55, 10); - adhrpar->type(5); - adhrpar->box(FL_FLAT_BOX); - adhrpar->maximum(100); - adhrpar->step(1); - adhrpar->value(50); - adhrpar->callback((Fl_Callback*)cb_adhrpar); - } // Fl_Slider* adhrpar - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(440, 308, 150, 30); - o->box(FL_ENGRAVED_BOX); - { modtype = new Fl_Choice(470, 315, 50, 15, "Mod."); - modtype->tooltip("modulation"); - modtype->down_box(FL_BORDER_BOX); - modtype->labelsize(10); - modtype->textsize(10); - modtype->callback((Fl_Callback*)cb_modtype); - modtype->menu(menu_modtype); - } // Fl_Choice* modtype - { modpar1 = new WidgetPDial(530, 315, 15, 15); - modpar1->tooltip("Oscillator\'s modulation parameter 1"); - modpar1->box(FL_OVAL_BOX); - modpar1->color(FL_BACKGROUND_COLOR); - modpar1->selection_color(FL_INACTIVE_COLOR); - modpar1->labeltype(FL_NORMAL_LABEL); - modpar1->labelfont(0); - modpar1->labelsize(14); - modpar1->labelcolor(FL_FOREGROUND_COLOR); - modpar1->maximum(127); - modpar1->step(1); - modpar1->callback((Fl_Callback*)cb_modpar1); - modpar1->align(Fl_Align(FL_ALIGN_BOTTOM)); - modpar1->when(FL_WHEN_CHANGED); - } // WidgetPDial* modpar1 - { modpar2 = new WidgetPDial(550, 315, 15, 15); - modpar2->tooltip("Oscillator\'s modulation parameter 2"); - modpar2->box(FL_OVAL_BOX); - modpar2->color(FL_BACKGROUND_COLOR); - modpar2->selection_color(FL_INACTIVE_COLOR); - modpar2->labeltype(FL_NORMAL_LABEL); - modpar2->labelfont(0); - modpar2->labelsize(14); - modpar2->labelcolor(FL_FOREGROUND_COLOR); - modpar2->maximum(127); - modpar2->step(1); - modpar2->callback((Fl_Callback*)cb_modpar2); - modpar2->align(Fl_Align(FL_ALIGN_BOTTOM)); - modpar2->when(FL_WHEN_CHANGED); - } // WidgetPDial* modpar2 - { modpar3 = new WidgetPDial(570, 315, 15, 15); - modpar3->tooltip("Oscillator\'s modulation parameter 3"); - modpar3->box(FL_OVAL_BOX); - modpar3->color(FL_BACKGROUND_COLOR); - modpar3->selection_color(FL_INACTIVE_COLOR); - modpar3->labeltype(FL_NORMAL_LABEL); - modpar3->labelfont(0); - modpar3->labelsize(14); - modpar3->labelcolor(FL_FOREGROUND_COLOR); - modpar3->maximum(127); - modpar3->step(1); - modpar3->callback((Fl_Callback*)cb_modpar3); - modpar3->align(Fl_Align(FL_ALIGN_BOTTOM)); - modpar3->when(FL_WHEN_CHANGED); - } // WidgetPDial* modpar3 - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(670, 525, 55, 15, "Sine"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Sine); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(670, 545, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(700, 545, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - { _this_has_to_be_the_last = new Fl_Scroll(5, 340, 660, 250); - _this_has_to_be_the_last->type(1); - _this_has_to_be_the_last->box(FL_ENGRAVED_BOX); - { Fl_Pack* o = harmonics = new Fl_Pack(10, 345, 650, 225); - harmonics->type(1); - for (int i=0;ih(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,cbwidget,applybutton,master);} - harmonics->end(); - } // Fl_Pack* harmonics - _this_has_to_be_the_last->end(); - } // Fl_Scroll* _this_has_to_be_the_last - if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor"); - osceditUI->end(); - } // Fl_Double_Window* osceditUI - return osceditUI; -} - -OscilEditor::OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_,Master *master_) { - oscil=oscil_; - oldosc=oldosc_; - cbwidget=cbwidget_; - cbapplywidget=cbapplywidget_; - master=master_; - - make_window(); - - refresh(); - osceditUI->show(); -} - -OscilEditor::~OscilEditor() { - osceditUI->hide(); - //for (int i=0;ivalue(oscil->Phmagtype); - rndslider->value(oscil->Prand-64); - - hrndtype->value(oscil->Pamprandtype); - hrnddial->value(oscil->Pamprandpower); - - bftype->value(oscil->Pcurrentbasefunc); - bfparval->value(oscil->Pbasefuncpar-64); - bfslider->value(oscil->Pbasefuncpar-64); - - bfmodtype->value(oscil->Pbasefuncmodulation); - bfmodpar1->value(oscil->Pbasefuncmodulationpar1); - bfmodpar2->value(oscil->Pbasefuncmodulationpar2); - bfmodpar3->value(oscil->Pbasefuncmodulationpar3); - - wshbutton->value(oscil->Pwaveshapingfunction); - wsparval->value(oscil->Pwaveshaping-64); - wshpar->value(oscil->Pwaveshaping-64); - - fltbutton->value(oscil->Pfiltertype); - filtervalue1->value(oscil->Pfilterpar1); - filtervalue2->value(oscil->Pfilterpar2); - filterpref->value(oscil->Pfilterbeforews); - - modtype->value(oscil->Pmodulation); - modpar1->value(oscil->Pmodulationpar1); - modpar2->value(oscil->Pmodulationpar2); - modpar3->value(oscil->Pmodulationpar3); - - sabutton->value(oscil->Psatype); - sadjpar->value(oscil->Psapar); - - harmonicshiftcounter->value(oscil->Pharmonicshift); - harmonicshiftpre->value(oscil->Pharmonicshiftfirst); - - adhrtype->value(oscil->Padaptiveharmonics); - adhrbf->value(oscil->Padaptiveharmonicsbasefreq); - adhrpow->value(oscil->Padaptiveharmonicspower); - adhrtype->value(oscil->Padaptiveharmonicspar); - - for (int i=0;irefresh(); - - pthread_mutex_lock(&master->mutex); - oscil->prepare(); - pthread_mutex_unlock(&master->mutex); - - basefuncdisplaygroup->redraw(); - redrawoscil(); -} - -void OscilEditor::redrawoscil() { - oscildisplaygroup->redraw(); - oldosc->redraw(); - if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); - }; -} diff --git a/plugins/zynaddsubfx/src/UI/OscilGenUI.fl b/plugins/zynaddsubfx/src/UI/OscilGenUI.fl deleted file mode 100644 index d686b2ecb..000000000 --- a/plugins/zynaddsubfx/src/UI/OscilGenUI.fl +++ /dev/null @@ -1,1133 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0109 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "../Synth/OscilGen.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "ResonanceUI.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "LFOUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class OscilSpectrum {: {public Fl_Box} -} { - Function {OscilSpectrum(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {oscil=NULL;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -master=master_;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i; -const int maxdb=60;//must be multiple of 10 -int GX=2; -int n=lx/GX-1; -if (n>OSCIL_SIZE/2) n=OSCIL_SIZE/2; - -REALTYPE x; -REALTYPE* spc=new REALTYPE[n]; -for (i=0;imutex); -if (oscbase==0) oscil->getspectrum(n,spc,0); - else oscil->getspectrum(n,spc,1); -pthread_mutex_unlock(&master->mutex); - -//normalize -REALTYPE max=0; -for (i=0;iactive_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->color()); -fl_line_style(FL_DOT); - -for (i=1;iactive_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); -fl_line_style(0); - -//draws the spectrum -for (i=0;idB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else x=0; - - int val=(int) ((ly-2)*x); - if (val>0) fl_line(ox+tmp,oy+ly-2-val,ox+tmp,oy+ly-2); -} -delete [] spc;} {selected - } - } - decl {OscilGen *oscil;} {} - decl {int oscbase;} {} - decl {Master *master;} {} -} - -class PSlider {: {public Fl_Slider} -} { - Function {PSlider(int x,int y, int w, int h, const char *label=0):Fl_Slider(x,y,w,h,label)} {} {code{;}} - Function {handle(int event)} {return_type int - } { - code {int X=x(),Y=y(),W=w(),H=h(); - -if ((!Fl::event_buttons())|| (event==0)||(Fl::event_shift()==0)) return(Fl_Slider::handle(event)); - -if (!Fl::event_inside(X,Y,W,H)) { - if (event==FL_DRAG){ - Fl_Slider::handle(FL_RELEASE); - Fl_Slider::handle(FL_LEAVE); - deactivate(); - activate(); - return(1); - }else{ - return(Fl_Slider::handle(event)); - }; -} else { - //Fl_Slider::handle(FL_FOCUS); - Fl_Slider::handle(FL_PUSH); -}; - -return(1);} {} - } -} - -class Oscilloscope {: {public Fl_Box} -} { - Function {Oscilloscope(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {oscil=NULL; -phase=64; -oscbase=0;} {} - } - Function {init(OscilGen *oscil_,Master *master_)} {} { - code {oscil=oscil_; -master=master_;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -master=master_;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -phase=phase_; -master=master_;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h()-1,i; -REALTYPE smps[OSCIL_SIZE]; -pthread_mutex_lock(&master->mutex); -if (oscbase==0) oscil->get(smps,-1.0); - else oscil->getcurrentbasefunction(smps); -pthread_mutex_unlock(&master->mutex); - -if (damage()!=1){ - fl_color(0,0,0); - fl_rectf(ox,oy,lx,ly); -}; - -//normalize -REALTYPE max=0; -for (i=0;iactive_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); -int GX=16;if (lxactive_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->labelcolor()); -int lw=1; -//if ((lx<135)||(ly<135)) lw=1; -fl_line_style(0,lw); -int ph=(int)((phase-64.0)/128.0*OSCIL_SIZE+OSCIL_SIZE); -for (i=1;ivalue(x); - else x=127-(int)o->value(); -if (x==64) o->selection_color(0); - else o->selection_color(222); - -pthread_mutex_lock(&master->mutex); - oscil->Phmag[n]=x; - if (x==64) { - oscil->Phphase[n]=64; - phase->value(64); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} - xywh {0 15 15 115} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(127-oscil->Phmag[n]);} - code1 {if (oscil->Phmag[n]==64) o->selection_color(0);} - class PSlider - } - Fl_Slider phase { - callback {int x=64; -if (Fl::event_button3()) o->value(x); - else x=(int)o->value(); - -pthread_mutex_lock(&master->mutex); - oscil->Phphase[n]=x; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} - xywh {0 135 15 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(oscil->Phphase[n]);} - class PSlider - } - Fl_Box {} { - xywh {15 70 5 5} box FLAT_BOX color 45 - } - Fl_Box {} { - xywh {15 170 5 5} box FLAT_BOX color 45 - } - Fl_Box {} { - label 01 - xywh {0 210 20 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - Fl_Box {} { - label 01 - xywh {0 0 20 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - } - } - Function {Oscilharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0; -oscil=NULL; -display=NULL; -applybutton=NULL; -cbwidget=NULL;} {} - } - Function {init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, Master *master_)} {} { - code {oscil=oscil_; -n=n_; -display=display_; -master=master_; -oldosc=oldosc_; -cbwidget=cbwidget_; -applybutton=applybutton_; -make_window(); -end(); -harmonic->show();} {} - } - Function {refresh()} {} { - code {mag->value(127-oscil->Phmag[n]); -phase->value(oscil->Phphase[n]); - -if (oscil->Phmag[n]==64) mag->selection_color(0); - else mag->selection_color(222);} {} - } - Function {~Oscilharmonic()} {} { - code {harmonic->hide(); -//delete(harmonic);} {} - } - decl {OscilGen *oscil;} {} - decl {Fl_Group *display;} {} - decl {int n;} {} - decl {Fl_Widget *oldosc,*cbwidget,*applybutton;} {} - decl {Master *master;} {} -} - -class OscilEditor {: {public PresetsUI_} -} { - Function {make_window()} {} { - Fl_Window osceditUI { - label {ADsynth Oscillator Editor} - xywh {131 90 735 595} type Double hide - code0 {if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} - } { - Fl_Button applybutton { - label Apply - callback {applybutton->color(FL_GRAY); -applybutton->redraw(); -if (cbapplywidget!=NULL) { - cbapplywidget->do_callback(); - cbapplywidget->color(FL_GRAY); - cbapplywidget->redraw(); -};} - xywh {300 280 60 20} box THIN_UP_BOX labelfont 1 - code0 {if (!oscil->ADvsPAD) o->hide();} - } - Fl_Group oscildisplaygroup { - xywh {5 5 360 300} box ENGRAVED_FRAME - } { - Fl_Group {} {open - xywh {10 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {Oscilloscope *osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(oscil,master);} - } {} - Fl_Box {} { - label Oscillator - xywh {120 10 110 20} box FLAT_BOX labelfont 1 - } - Fl_Value_Slider rndslider { - label rnd - callback {oscil->Prand=(int)o->value()+64; -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {140 285 100 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {if (oscil->ADvsPAD) o->hide();} - } - Fl_Group {} {open - xywh {10 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 - code0 {OscilSpectrum *spc=new OscilSpectrum(o->x(),o->y(),o->w(),o->h(),"");} - code1 {spc->init(oscil,0,master);} - } {} - Fl_Group {} { - xywh {246 277 115 25} box ENGRAVED_BOX - code0 {if (oscil->ADvsPAD) o->hide();} - } { - Fl_Choice hrndtype { - label {H.rnd} - callback {oscil->Pamprandtype=(int) o->value();} - tooltip {Harmonic Amplitude Randomness} xywh {281 282 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sin - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hrnddial { - callback {oscil->Pamprandpower=(int) o->value();} - tooltip {Oscillator's spectrum adjust parameter} xywh {338 280 18 18} maximum 127 step 1 - class WidgetPDial - } - } - } - Fl_Box {} { - label {Base Func.} - xywh {495 15 110 20} box FLAT_BOX labelfont 1 - } - Fl_Group basefuncdisplaygroup { - xywh {365 5 360 300} box ENGRAVED_FRAME - } { - Fl_Group {} { - xywh {370 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {Oscilloscope *osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(oscil,1,master);} - } {} - Fl_Dial bfslider { - callback {oscil->Pbasefuncpar=(int)o->value()+64; -basefuncdisplaygroup->redraw(); -bfparval->value(oscil->Pbasefuncpar-64); - -redrawoscil();} - tooltip {Base Function Parameter} xywh {520 280 20 20} minimum -64 maximum 63 step 1 - class WidgetPDial - } - Fl_Choice bftype { - label {Base.F..} - callback {oscil->Pcurrentbasefunc=(int) o->value(); - -basefuncdisplaygroup->redraw(); -redrawoscil(); - -if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); - else basefuncmodulation->activate();} - xywh {370 285 90 15} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - } { - MenuItem {} { - label Sine - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Triangle - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Pulse - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Saw - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Power - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Gauss - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Diode - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label AbsSine - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PulseSine - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label StrchSine - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Chirp - xywh {100 100 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label AbsStrSine - xywh {102 102 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Chebyshev - xywh {112 112 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Sqr - xywh {122 122 100 20} labelfont 1 labelsize 11 - } - } - Fl_Box {} { - label {Base Func.} - xywh {480 10 110 20} box FLAT_BOX labelfont 1 - } - Fl_Group {} {open - xywh {370 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 - code0 {OscilSpectrum *spc=new OscilSpectrum (o->x(),o->y(),o->w(),o->h(),"");} - code1 {spc->init(oscil,1,master);} - } {} - Fl_Value_Output bfparval { - label {Par.} - xywh {490 285 25 15} labelsize 12 minimum -63 maximum 63 step 1 - } - Fl_Group basefuncmodulation { - xywh {550 276 169 25} box ENGRAVED_BOX - code0 {if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();} - } { - Fl_Choice bfmodtype { - label {B.F.Mod.} - callback {oscil->Pbasefuncmodulation=(int) o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Base function modulation} xywh {599 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Rev - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial bfmodpar1 { - callback {oscil->Pbasefuncmodulationpar1=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 1} xywh {659 281 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial bfmodpar2 { - callback {oscil->Pbasefuncmodulationpar2=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 2} xywh {679 281 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial bfmodpar3 { - callback {oscil->Pbasefuncmodulationpar3=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 3} xywh {699 281 15 15} maximum 127 step 1 - class WidgetPDial - } - } - } - Fl_Choice magtype { - label {Mag.Type} - callback {oscil->Phmagtype=(int) o->value(); -basefuncdisplaygroup->redraw(); - -redrawoscil();} - xywh {70 280 65 20} down_box BORDER_BOX labelsize 11 textsize 11 - } { - MenuItem {} { - label Linear - xywh {0 0 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-40dB} - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-60dB} - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-80dB} - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-100dB} - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - } - Fl_Button {} { - label {Use as base} - callback {oscil->useasbase(); -if (autoclearbutton->value()){ - for (int i=0;imag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; - }; - oscil->Phmag[0]=127; - - oscil->Pharmonicshift=0; - harmonicshiftcounter->value(0); - - h[0]->mag->value(0); - wshbutton->value(0); - wshbutton->do_callback(); - fltbutton->value(0); - fltbutton->do_callback(); - sabutton->value(0); - sabutton->do_callback(); -}; - -pthread_mutex_lock(&master->mutex); - for (int i=0;iPhmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Use this Oscillator as base function} xywh {5 313 85 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label Close - callback {osceditUI->hide();} - xywh {668 565 62 25} box THIN_UP_BOX - } - Fl_Button {} { - label Clear - callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return; - -for (int i=0;imag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; -}; -oscil->Phmag[0]=127; -h[0]->mag->value(0); - -for (int i=0;iPhmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); -}; - -//harmonics->redraw(); - -pthread_mutex_lock(&master->mutex); - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -redrawoscil();} - xywh {670 505 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Group {} { - xywh {135 308 150 30} box ENGRAVED_BOX - } { - Fl_Choice wshbutton { - label {Wsh.} - callback {oscil->Pwaveshapingfunction=(int) o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} open - tooltip {Waveshaping function} xywh {165 313 55 20} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Atan - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym1 - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Qnts - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Zigzg - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lmt - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtU - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtL - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ILmt - xywh {127 127 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Clip - xywh {137 137 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow2 - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sgm - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial wshpar { - callback {oscil->Pwaveshaping=(int)o->value()+64; -wsparval->value(oscil->Pwaveshaping-64); -redrawoscil();} - tooltip {Waveshaping Parameter} xywh {260 313 20 20} minimum -64 maximum 63 step 1 - class WidgetPDial - } - Fl_Value_Output wsparval { - xywh {228 316 25 15} labelsize 12 minimum -63 maximum 63 step 1 - } - } - Fl_Light_Button autoclearbutton { - label {Clr.} - tooltip {Auto clear when using the oscillator as base function} xywh {95 313 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 - } - Fl_Group {} { - xywh {285 308 155 30} box ENGRAVED_BOX - } { - Fl_Choice fltbutton { - label Filter - callback {oscil->Pfiltertype=(int) o->value(); - -redrawoscil();} - tooltip {Oscillator's filter type} xywh {315 313 50 20} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LP1 - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HP1a - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HP1b - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BP1 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BS1 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LP2 - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HP2 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BP2 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BS2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Cos - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sin - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label S - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial filtervalue1 { - callback {oscil->Pfilterpar1=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's filter parameter1} xywh {367 313 20 20} maximum 127 step 1 - class WidgetPDial - } - Fl_Check_Button filterpref { - label p - callback {oscil->Pfilterbeforews=(int)o->value(); - -redrawoscil();} - tooltip {Apply the filter before the waveshaping} xywh {415 313 20 20} down_box DOWN_BOX labelsize 10 align 24 - } - Fl_Dial filtervalue2 { - callback {oscil->Pfilterpar2=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's filter parameter2} xywh {392 313 20 20} maximum 127 step 1 - class WidgetPDial - } - } - Fl_Group {} { - xywh {590 308 135 30} box ENGRAVED_BOX - } { - Fl_Choice sabutton { - label {Sp.adj.} - callback {oscil->Psatype=(int) o->value(); -redrawoscil();} - tooltip {Oscillator's spectrum adjust} xywh {630 313 60 20} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ThrsD - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ThrsU - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial sadjpar { - callback {oscil->Psapar=(int)o->value(); -redrawoscil();} - tooltip {Oscillator's spectrum adjust parameter} xywh {695 313 20 20} maximum 127 step 1 - class WidgetPDial - } - } - Fl_Group {} { - xywh {665 340 65 65} box ENGRAVED_BOX - } { - Fl_Counter harmonicshiftcounter { - label {Harmonic Shift} - callback {oscil->Pharmonicshift=(int)o->value(); -redrawoscil();} - xywh {670 365 55 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10 - } - Fl_Check_Button harmonicshiftpre { - label preH - callback {oscil->Pharmonicshiftfirst=(int)o->value(); -redrawoscil();} - tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {690 385 34 15} down_box DOWN_BOX labelsize 10 align 24 - } - Fl_Button {} { - label R - callback {oscil->Pharmonicshift=0; -harmonicshiftcounter->value(0); -redrawoscil();} - xywh {670 385 20 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - } - Fl_Group {} { - xywh {665 410 65 90} box ENGRAVED_FRAME - } { - Fl_Choice adhrtype { - label {Adpt.Harm.} - callback {oscil->Padaptiveharmonics=(int) o->value(); -redrawoscil();} - tooltip {The type of the addaptive harmonics} xywh {670 425 55 15} down_box BORDER_BOX labelsize 10 align 129 when 6 textsize 10 - } { - MenuItem {} { - label OFF - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ON - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Square - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 2xSub - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 2xAdd - xywh {120 120 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 3xSub - xywh {120 120 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 3xAdd - xywh {130 130 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 4xSub - xywh {130 130 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 4xAdd - xywh {140 140 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial adhrpow { - label pow - callback {oscil->Padaptiveharmonicspower=(int)o->value(); -redrawoscil();} - tooltip {Adaptive harmonics power} xywh {700 460 25 25} labelsize 10 maximum 200 step 1 - class WidgetPDial - } - Fl_Dial adhrbf { - label baseF - callback {oscil->Padaptiveharmonicsbasefreq=(int)o->value(); -redrawoscil();} - tooltip {Adaptive harmonics base frequency} xywh {670 460 25 25} labelsize 10 maximum 255 step 1 - class WidgetPDial - } - Fl_Slider adhrpar { - callback {oscil->Padaptiveharmonicspar=(int)o->value(); -redrawoscil();} - xywh {670 445 55 10} type {Horz Knob} box FLAT_BOX maximum 100 step 1 value 50 - } - } - Fl_Group {} { - xywh {440 308 150 30} box ENGRAVED_BOX - } { - Fl_Choice modtype { - label {Mod.} - callback {oscil->Pmodulation=(int) o->value(); - -redrawoscil();} - tooltip modulation xywh {470 315 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Rev - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial modpar1 { - callback {oscil->Pmodulationpar1=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's modulation parameter 1} xywh {530 315 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial modpar2 { - callback {oscil->Pmodulationpar2=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's modulation parameter 2} xywh {550 315 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial modpar3 { - callback {oscil->Pmodulationpar3=(int)o->value(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 3} xywh {570 315 15 15} maximum 127 step 1 - class WidgetPDial - } - } - Fl_Button {} { - label Sine - callback {if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return; - -pthread_mutex_lock(&master->mutex); - oscil->convert2sine(0); -pthread_mutex_unlock(&master->mutex); - -redrawoscil(); -refresh();} - xywh {670 525 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label C - callback {presetsui->copy(oscil);} - xywh {670 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(oscil,this);} - xywh {700 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Scroll _this_has_to_be_the_last { - xywh {5 340 660 250} type HORIZONTAL box ENGRAVED_BOX - } { - Fl_Pack harmonics {open - xywh {10 345 650 225} type HORIZONTAL - code0 {for (int i=0;ih(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,cbwidget,applybutton,master);}} - } {} - } - } - } - Function {OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_,Master *master_)} {} { - code {oscil=oscil_; -oldosc=oldosc_; -cbwidget=cbwidget_; -cbapplywidget=cbapplywidget_; -master=master_; - -make_window(); - -refresh(); -osceditUI->show();} {} - } - Function {~OscilEditor()} {} { - code {osceditUI->hide(); -//for (int i=0;ivalue(oscil->Phmagtype); -rndslider->value(oscil->Prand-64); - -hrndtype->value(oscil->Pamprandtype); -hrnddial->value(oscil->Pamprandpower); - -bftype->value(oscil->Pcurrentbasefunc); -bfparval->value(oscil->Pbasefuncpar-64); -bfslider->value(oscil->Pbasefuncpar-64); - -bfmodtype->value(oscil->Pbasefuncmodulation); -bfmodpar1->value(oscil->Pbasefuncmodulationpar1); -bfmodpar2->value(oscil->Pbasefuncmodulationpar2); -bfmodpar3->value(oscil->Pbasefuncmodulationpar3); - -wshbutton->value(oscil->Pwaveshapingfunction); -wsparval->value(oscil->Pwaveshaping-64); -wshpar->value(oscil->Pwaveshaping-64); - -fltbutton->value(oscil->Pfiltertype); -filtervalue1->value(oscil->Pfilterpar1); -filtervalue2->value(oscil->Pfilterpar2); -filterpref->value(oscil->Pfilterbeforews); - -modtype->value(oscil->Pmodulation); -modpar1->value(oscil->Pmodulationpar1); -modpar2->value(oscil->Pmodulationpar2); -modpar3->value(oscil->Pmodulationpar3); - -sabutton->value(oscil->Psatype); -sadjpar->value(oscil->Psapar); - -harmonicshiftcounter->value(oscil->Pharmonicshift); -harmonicshiftpre->value(oscil->Pharmonicshiftfirst); - -adhrtype->value(oscil->Padaptiveharmonics); -adhrbf->value(oscil->Padaptiveharmonicsbasefreq); -adhrpow->value(oscil->Padaptiveharmonicspower); -adhrtype->value(oscil->Padaptiveharmonicspar); - -for (int i=0;irefresh(); - -pthread_mutex_lock(&master->mutex); - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -basefuncdisplaygroup->redraw(); -redrawoscil();} {} - } - Function {redrawoscil()} {} { - code {oscildisplaygroup->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} {} - } - decl {OscilGen *oscil;} {} - decl {Fl_Widget *oldosc,*cbwidget,*cbapplywidget;} {} - decl {Oscilharmonic *h[MAX_AD_HARMONICS];} {} - decl {Master *master;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/OscilGenUI.h b/plugins/zynaddsubfx/src/UI/OscilGenUI.h deleted file mode 100644 index 0cd795bc8..000000000 --- a/plugins/zynaddsubfx/src/UI/OscilGenUI.h +++ /dev/null @@ -1,281 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef OscilGenUI_h -#define OscilGenUI_h -#include -#include "../Synth/OscilGen.h" -#include "../Misc/Util.h" -#include "../Misc/Master.h" -#include "ResonanceUI.h" -#include -#include -#include -#include "WidgetPDial.h" -#include "EnvelopeUI.h" -#include "LFOUI.h" -#include "FilterUI.h" -#include "PresetsUI.h" - -class OscilSpectrum : public Fl_Box { -public: - OscilSpectrum(int x,int y, int w, int h, const char *label=0); - void init(OscilGen *oscil_,int oscbase_,Master *master_); - void draw(); -private: - OscilGen *oscil; - int oscbase; - Master *master; -}; - -class PSlider : public Fl_Slider { -public: - PSlider(int x,int y, int w, int h, const char *label=0); - int handle(int event); -}; - -class Oscilloscope : public Fl_Box { -public: - Oscilloscope(int x,int y, int w, int h, const char *label=0); - void init(OscilGen *oscil_,Master *master_); - void init(OscilGen *oscil_,int oscbase_,Master *master_); - void init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_); - void draw(); -private: - OscilGen *oscil; - int oscbase; -public: - int phase; -private: - Master *master; -}; -#include - -class Oscilharmonic : public Fl_Group { - Fl_Group* make_window(); - Fl_Group *harmonic; -public: - PSlider *mag; -private: - void cb_mag_i(PSlider*, void*); - static void cb_mag(PSlider*, void*); -public: - PSlider *phase; -private: - void cb_phase_i(PSlider*, void*); - static void cb_phase(PSlider*, void*); -public: - Oscilharmonic(int x,int y, int w, int h, const char *label=0); - void init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, Master *master_); - void refresh(); - ~Oscilharmonic(); -private: - OscilGen *oscil; - Fl_Group *display; - int n; - Fl_Widget *oldosc,*cbwidget,*applybutton; - Master *master; -}; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class OscilEditor : public PresetsUI_ { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *osceditUI; - Fl_Button *applybutton; -private: - void cb_applybutton_i(Fl_Button*, void*); - static void cb_applybutton(Fl_Button*, void*); -public: - Fl_Group *oscildisplaygroup; - Fl_Value_Slider *rndslider; -private: - void cb_rndslider_i(Fl_Value_Slider*, void*); - static void cb_rndslider(Fl_Value_Slider*, void*); -public: - Fl_Choice *hrndtype; -private: - void cb_hrndtype_i(Fl_Choice*, void*); - static void cb_hrndtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_hrndtype[]; -public: - WidgetPDial *hrnddial; -private: - void cb_hrnddial_i(WidgetPDial*, void*); - static void cb_hrnddial(WidgetPDial*, void*); -public: - Fl_Group *basefuncdisplaygroup; - WidgetPDial *bfslider; -private: - void cb_bfslider_i(WidgetPDial*, void*); - static void cb_bfslider(WidgetPDial*, void*); -public: - Fl_Choice *bftype; -private: - void cb_bftype_i(Fl_Choice*, void*); - static void cb_bftype(Fl_Choice*, void*); - static Fl_Menu_Item menu_bftype[]; -public: - Fl_Value_Output *bfparval; - Fl_Group *basefuncmodulation; - Fl_Choice *bfmodtype; -private: - void cb_bfmodtype_i(Fl_Choice*, void*); - static void cb_bfmodtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_bfmodtype[]; -public: - WidgetPDial *bfmodpar1; -private: - void cb_bfmodpar1_i(WidgetPDial*, void*); - static void cb_bfmodpar1(WidgetPDial*, void*); -public: - WidgetPDial *bfmodpar2; -private: - void cb_bfmodpar2_i(WidgetPDial*, void*); - static void cb_bfmodpar2(WidgetPDial*, void*); -public: - WidgetPDial *bfmodpar3; -private: - void cb_bfmodpar3_i(WidgetPDial*, void*); - static void cb_bfmodpar3(WidgetPDial*, void*); -public: - Fl_Choice *magtype; -private: - void cb_magtype_i(Fl_Choice*, void*); - static void cb_magtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_magtype[]; - void cb_Use_i(Fl_Button*, void*); - static void cb_Use(Fl_Button*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_Clear_i(Fl_Button*, void*); - static void cb_Clear(Fl_Button*, void*); -public: - Fl_Choice *wshbutton; -private: - void cb_wshbutton_i(Fl_Choice*, void*); - static void cb_wshbutton(Fl_Choice*, void*); - static Fl_Menu_Item menu_wshbutton[]; -public: - WidgetPDial *wshpar; -private: - void cb_wshpar_i(WidgetPDial*, void*); - static void cb_wshpar(WidgetPDial*, void*); -public: - Fl_Value_Output *wsparval; - Fl_Light_Button *autoclearbutton; - Fl_Choice *fltbutton; -private: - void cb_fltbutton_i(Fl_Choice*, void*); - static void cb_fltbutton(Fl_Choice*, void*); - static Fl_Menu_Item menu_fltbutton[]; -public: - WidgetPDial *filtervalue1; -private: - void cb_filtervalue1_i(WidgetPDial*, void*); - static void cb_filtervalue1(WidgetPDial*, void*); -public: - Fl_Check_Button *filterpref; -private: - void cb_filterpref_i(Fl_Check_Button*, void*); - static void cb_filterpref(Fl_Check_Button*, void*); -public: - WidgetPDial *filtervalue2; -private: - void cb_filtervalue2_i(WidgetPDial*, void*); - static void cb_filtervalue2(WidgetPDial*, void*); -public: - Fl_Choice *sabutton; -private: - void cb_sabutton_i(Fl_Choice*, void*); - static void cb_sabutton(Fl_Choice*, void*); - static Fl_Menu_Item menu_sabutton[]; -public: - WidgetPDial *sadjpar; -private: - void cb_sadjpar_i(WidgetPDial*, void*); - static void cb_sadjpar(WidgetPDial*, void*); -public: - Fl_Counter *harmonicshiftcounter; -private: - void cb_harmonicshiftcounter_i(Fl_Counter*, void*); - static void cb_harmonicshiftcounter(Fl_Counter*, void*); -public: - Fl_Check_Button *harmonicshiftpre; -private: - void cb_harmonicshiftpre_i(Fl_Check_Button*, void*); - static void cb_harmonicshiftpre(Fl_Check_Button*, void*); - void cb_R_i(Fl_Button*, void*); - static void cb_R(Fl_Button*, void*); -public: - Fl_Choice *adhrtype; -private: - void cb_adhrtype_i(Fl_Choice*, void*); - static void cb_adhrtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_adhrtype[]; -public: - WidgetPDial *adhrpow; -private: - void cb_adhrpow_i(WidgetPDial*, void*); - static void cb_adhrpow(WidgetPDial*, void*); -public: - WidgetPDial *adhrbf; -private: - void cb_adhrbf_i(WidgetPDial*, void*); - static void cb_adhrbf(WidgetPDial*, void*); -public: - Fl_Slider *adhrpar; -private: - void cb_adhrpar_i(Fl_Slider*, void*); - static void cb_adhrpar(Fl_Slider*, void*); -public: - Fl_Choice *modtype; -private: - void cb_modtype_i(Fl_Choice*, void*); - static void cb_modtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_modtype[]; -public: - WidgetPDial *modpar1; -private: - void cb_modpar1_i(WidgetPDial*, void*); - static void cb_modpar1(WidgetPDial*, void*); -public: - WidgetPDial *modpar2; -private: - void cb_modpar2_i(WidgetPDial*, void*); - static void cb_modpar2(WidgetPDial*, void*); -public: - WidgetPDial *modpar3; -private: - void cb_modpar3_i(WidgetPDial*, void*); - static void cb_modpar3(WidgetPDial*, void*); - void cb_Sine_i(Fl_Button*, void*); - static void cb_Sine(Fl_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Scroll *_this_has_to_be_the_last; - Fl_Pack *harmonics; - OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_,Master *master_); - ~OscilEditor(); - void refresh(); - void redrawoscil(); -private: - OscilGen *oscil; - Fl_Widget *oldosc,*cbwidget,*cbapplywidget; - Oscilharmonic *h[MAX_AD_HARMONICS]; - Master *master; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/PADnoteUI.cc b/plugins/zynaddsubfx/src/UI/PADnoteUI.cc deleted file mode 100644 index a2abb9a05..000000000 --- a/plugins/zynaddsubfx/src/UI/PADnoteUI.cc +++ /dev/null @@ -1,1504 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "PADnoteUI.h" -#include -#include -#include -#include - -PADnoteHarmonicProfile::PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - pars=NULL; -} - -void PADnoteHarmonicProfile::init(PADnoteParameters *pars,Master *master_) { - master=master_; - this->pars=pars; -} - -void PADnoteHarmonicProfile::draw() { - int ox=x(),oy=y(),lx=w(),ly=h(); - if (!visible()) return; - REALTYPE smps[lx]; - - REALTYPE realbw=pars->getprofile(smps,lx); - bool active=active_r(); - - //draw the equivalent bandwidth - if (active) fl_color(220,220,220); - else fl_color(160,165,165); - fl_line_style(0); - int rbw=(int)(realbw*(lx-1.0)/2.0); - for (int i=lx/2-rbw;i<(lx/2+rbw);i++) fl_line(ox+i,oy,ox+i,oy+ly-1); - - fl_line_style(0); - if (active) fl_color(200,200,200); - else fl_color(160,160,160); - for (int i=1;i<10;i++){ - int kx=(int)(lx/10.0*i); - fl_line(ox+kx,oy,ox+kx,oy+ly-1); - }; - for (int i=1;i<5;i++){ - int ky=(int)(ly/5.0*i); - fl_line(ox,oy+ly-ky,ox+lx,oy+ly-ky-1); - }; - - - fl_color(120,120,120); - fl_line_style(FL_DOT); - fl_line(ox+lx/2,oy,ox+lx/2,oy+ly); - - //draw the graph - fl_line_style(0); - int old=0; - for (int i=0;i0) fl_line(ox+i-1,oy+ly-2-old,ox+i,oy+ly-2-val); - old=val; - }; - - - fl_line_style(FL_DASH); - if (active) fl_color(0,100,220); - else fl_color(150,160,170); - fl_line(ox+lx/2-rbw,oy,ox+lx/2-rbw,oy+ly-1); - fl_line(ox+lx/2+rbw,oy,ox+lx/2+rbw,oy+ly-1); - - fl_line_style(0); -} - -PADnoteOvertonePosition::PADnoteOvertonePosition(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - pars=NULL; -} - -void PADnoteOvertonePosition::init(PADnoteParameters *pars,Master *master_) { - master=master_; - this->pars=pars; -} - -void PADnoteOvertonePosition::draw() { - if (!visible()) return; - const int maxdb=60; - - int ox=x(),oy=y(),lx=w(),ly=h(); - const int maxharmonic=64; - - - for (int i=1;imutex); - pars->oscilgen->getspectrum(n,spc,0); - pthread_mutex_unlock(&master->mutex); - - - //normalize - REALTYPE max=0; - for (int i=0;igetNhr(i); - int kx=(int)(lx/(REALTYPE)maxharmonic*nhr); - if ((kx<0)||(kx>lx)) continue; - - spectrum[kx]=spc[i-1]/max+1e-9; - - }; - - fl_color(180,0,0); - fl_line_style(0); - - if (pars->Pmode==2){ - int old=0; - for (int i=1;i1e-10)||(i==(lx-1))){ - int delta=i-old; - REALTYPE val1=spectrum[old]; - REALTYPE val2=spectrum[i]; - - REALTYPE idelta=1.0/delta; - for (int j=0;jdB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else continue; - int yy=(int)(x*ly); - fl_line(ox+i,oy+ly-1-yy,ox+i,oy+ly-1); - - }; -} - -void PADnoteUI::cb__i(Fl_Tabs* o, void*) { - if (o->value()!=harmonicstructuregroup) applybutton->hide(); - else applybutton->show(); -} -void PADnoteUI::cb_(Fl_Tabs* o, void* v) { - ((PADnoteUI*)(o->parent()->user_data()))->cb__i(o,v); -} - -void PADnoteUI::cb_hpbasepar1_i(WidgetPDial* o, void*) { - pars->Php.base.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpbasepar1(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpbasepar1_i(o,v); -} - -void PADnoteUI::cb_hpbasetype_i(Fl_Choice* o, void*) { - pars->Php.base.type=o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpbasetype(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpbasetype_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_hpbasetype[] = { - {"Gauss", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Square", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"DoubleExp", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_hpfreqmult_i(WidgetPDial* o, void*) { - pars->Php.freqmult=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpfreqmult(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpfreqmult_i(o,v); -} - -void PADnoteUI::cb_hpmpar1_i(WidgetPDial* o, void*) { - pars->Php.modulator.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpmpar1(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpmpar1_i(o,v); -} - -void PADnoteUI::cb_hpmfreq_i(WidgetPDial* o, void*) { - pars->Php.modulator.freq=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpmfreq(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpmfreq_i(o,v); -} - -void PADnoteUI::cb_hpamptype_i(Fl_Choice* o, void*) { - pars->Php.amp.type=o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpamptype(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_hpamptype_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_hpamptype[] = { - {"OFF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Gauss", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Flat", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_hpampmode_i(Fl_Choice* o, void*) { - pars->Php.amp.mode=o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpampmode(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_hpampmode_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_hpampmode[] = { - {"Sum", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Mult", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Div1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Div2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_hpamppar1_i(WidgetPDial* o, void*) { - pars->Php.amp.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpamppar1(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_hpamppar1_i(o,v); -} - -void PADnoteUI::cb_hpamppar2_i(WidgetPDial* o, void*) { - pars->Php.amp.par2=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpamppar2(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_hpamppar2_i(o,v); -} - -void PADnoteUI::cb_hpautoscale_i(Fl_Check_Button* o, void*) { - pars->Php.autoscale=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpautoscale(Fl_Check_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpautoscale_i(o,v); -} - -void PADnoteUI::cb_hponehalf_i(Fl_Choice* o, void*) { - pars->Php.onehalf=o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hponehalf(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hponehalf_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_hponehalf[] = { - {"Full", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Upper Half", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Lower Half", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_hpwidth_i(WidgetPDial* o, void*) { - pars->Php.width=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hpwidth(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hpwidth_i(o,v); -} - -void PADnoteUI::cb_Change_i(Fl_Button*, void*) { - if (oscui!=NULL) delete (oscui); -oscui=new OscilEditor(pars->oscilgen,osc,cbwidget,applybutton,master); -} -void PADnoteUI::cb_Change(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_Change_i(o,v); -} - -void PADnoteUI::cb_cbwidget_i(Fl_Box*, void*) { - overtonepos->redraw(); -applybutton->color(FL_RED); -applybutton->redraw(); -} -void PADnoteUI::cb_cbwidget(Fl_Box* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_cbwidget_i(o,v); -} - -void PADnoteUI::cb_Resonance_i(Fl_Button*, void*) { - resui->resonancewindow->redraw(); -resui->resonancewindow->show(); -resui->setcbwidget(cbwidget,applybutton); -} -void PADnoteUI::cb_Resonance(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_Resonance_i(o,v); -} - -void PADnoteUI::cb_bwdial_i(WidgetPDial* o, void*) { - bwcents->value(pars->setPbandwidth((int) o->value())); -cbwidget->do_callback(); -} -void PADnoteUI::cb_bwdial(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_bwdial_i(o,v); -} - -void PADnoteUI::cb_hrpostype_i(Fl_Choice* o, void*) { - pars->Phrpos.type=o->value(); -overtonepos->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hrpostype(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hrpostype_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_hrpostype[] = { - {"Harmonic", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"ShiftU", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"ShiftL", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"PowerU", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"PowerL", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Sine", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Power", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_hrpospar1_i(WidgetPDial* o, void*) { - pars->Phrpos.par1=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hrpospar1(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hrpospar1_i(o,v); -} - -void PADnoteUI::cb_hrpospar2_i(WidgetPDial* o, void*) { - pars->Phrpos.par2=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hrpospar2(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hrpospar2_i(o,v); -} - -void PADnoteUI::cb_hrpospar3_i(WidgetPDial* o, void*) { - pars->Phrpos.par3=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_hrpospar3(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hrpospar3_i(o,v); -} - -void PADnoteUI::cb_bwscale_i(Fl_Choice* o, void*) { - pars->Pbwscale=(int) o->value(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_bwscale(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_bwscale_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_bwscale[] = { - {"Normal", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"EqualHz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Quater", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Half", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"75%", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"150%", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Double", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Inv.Half", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_qsamplesize_i(Fl_Choice* o, void*) { - pars->Pquality.samplesize=(int) o->value(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_qsamplesize(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_qsamplesize_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_qsamplesize[] = { - {"16k (Tiny)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"32k", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"64k (Small)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"128k", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"256k (Normal)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"512k", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"1M (Big)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_qsmpoct_i(Fl_Choice* o, void*) { - pars->Pquality.smpoct=(int) o->value(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_qsmpoct(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_qsmpoct_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_qsmpoct[] = { - {"0.5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"12", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_qoct_i(Fl_Choice* o, void*) { - pars->Pquality.oct=(int) o->value(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_qoct(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_qoct_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_qoct[] = { - {"1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"7", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"8", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_qbasenote_i(Fl_Choice* o, void*) { - pars->Pquality.basenote=(int) o->value(); -cbwidget->do_callback(); -} -void PADnoteUI::cb_qbasenote(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_qbasenote_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_qbasenote[] = { - {"C-2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"G-2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"C-3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"G-3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"C-4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"G-4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"C-5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"G-5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {"G-6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_spectrummode_i(Fl_Choice* o, void*) { - pars->Pmode=(int) o->value(); - -if (pars->Pmode==0){ - bwprofilegroup->activate(); - bwdial->activate(); - bwcents->activate(); - hprofile->activate(); - hprofile->color(54); - bwscale->activate(); -} else { - bwprofilegroup->deactivate(); - bwdial->deactivate(); - bwcents->deactivate(); - hprofile->deactivate(); - hprofile->color(48); - bwscale->deactivate(); -}; - -cbwidget->do_callback(); -} -void PADnoteUI::cb_spectrummode(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->user_data()))->cb_spectrummode_i(o,v); -} - -Fl_Menu_Item PADnoteUI::menu_spectrummode[] = { - {"Bandwidth", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Discrete", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Continous", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PADnoteUI::cb_octave_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=16; -pars->PCoarseDetune = k*1024+ - pars->PCoarseDetune%1024; -} -void PADnoteUI::cb_octave(Fl_Counter* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_octave_i(o,v); -} - -void PADnoteUI::cb_coarsedet_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=1024; -pars->PCoarseDetune = k+ - (pars->PCoarseDetune/1024)*1024; -} -void PADnoteUI::cb_coarsedet(Fl_Counter* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_coarsedet_i(o,v); -} - -void PADnoteUI::cb_detune_i(Fl_Slider* o, void*) { - pars->PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback(); -} -void PADnoteUI::cb_detune(Fl_Slider* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_detune_i(o,v); -} - -void PADnoteUI::cb_detunevalueoutput_i(Fl_Value_Output* o, void*) { - o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); -} -void PADnoteUI::cb_detunevalueoutput(Fl_Value_Output* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_detunevalueoutput_i(o,v); -} - -void PADnoteUI::cb_detunetype_i(Fl_Choice* o, void*) { - pars->PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback(); -} -void PADnoteUI::cb_detunetype(Fl_Choice* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_detunetype_i(o,v); -} - -void PADnoteUI::cb_hz440_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -pars->Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate(); -} -void PADnoteUI::cb_hz440(Fl_Check_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_hz440_i(o,v); -} - -void PADnoteUI::cb_fixedfreqetdial_i(WidgetPDial* o, void*) { - pars->PfixedfreqET=(int) o->value(); -} -void PADnoteUI::cb_fixedfreqetdial(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_fixedfreqetdial_i(o,v); -} - -void PADnoteUI::cb_volume_i(Fl_Value_Slider* o, void*) { - pars->PVolume=(int)o->value(); -} -void PADnoteUI::cb_volume(Fl_Value_Slider* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_volume_i(o,v); -} - -void PADnoteUI::cb_vsns_i(Fl_Value_Slider* o, void*) { - pars->PAmpVelocityScaleFunction=(int) o->value(); -} -void PADnoteUI::cb_vsns(Fl_Value_Slider* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_vsns_i(o,v); -} - -void PADnoteUI::cb_pan_i(WidgetPDial* o, void*) { - pars->PPanning=(int) o->value(); -} -void PADnoteUI::cb_pan(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_pan_i(o,v); -} - -void PADnoteUI::cb_pstr_i(WidgetPDial* o, void*) { - pars->PPunchStrength=(int) o->value(); -} -void PADnoteUI::cb_pstr(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_pstr_i(o,v); -} - -void PADnoteUI::cb_pt_i(WidgetPDial* o, void*) { - pars->PPunchTime=(int) o->value(); -} -void PADnoteUI::cb_pt(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_pt_i(o,v); -} - -void PADnoteUI::cb_pstc_i(WidgetPDial* o, void*) { - pars->PPunchStretch=(int) o->value(); -} -void PADnoteUI::cb_pstc(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_pstc_i(o,v); -} - -void PADnoteUI::cb_pvel_i(WidgetPDial* o, void*) { - pars->PPunchVelocitySensing=(int) o->value(); -} -void PADnoteUI::cb_pvel(WidgetPDial* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_pvel_i(o,v); -} - -void PADnoteUI::cb_stereo_i(Fl_Check_Button* o, void*) { - pars->PStereo=(int) o->value(); -hprofile->redraw(); -} -void PADnoteUI::cb_stereo(Fl_Check_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_stereo_i(o,v); -} - -void PADnoteUI::cb_applybutton_i(Fl_Button* o, void*) { - pars->applyparameters(true); -o->color(FL_GRAY); -if (oscui!=NULL) { - oscui->applybutton->color(FL_GRAY); - oscui->applybutton->redraw(); -}; -if (resui!=NULL) { - resui->applybutton->color(FL_GRAY); - resui->applybutton->redraw(); -}; -} -void PADnoteUI::cb_applybutton(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->user_data()))->cb_applybutton_i(o,v); -} - -void PADnoteUI::cb_Close_i(Fl_Button*, void*) { - padnotewindow->hide(); -} -void PADnoteUI::cb_Close(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void PADnoteUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(pars); -} -void PADnoteUI::cb_C(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void PADnoteUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(pars,this); -} -void PADnoteUI::cb_P(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -void PADnoteUI::cb_export_i(Fl_Button*, void*) { - char *filename; -filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0); -if (filename==NULL) return; -fl_filename_setext(filename,""); - - - -pars->export2wav(filename); -} -void PADnoteUI::cb_export(Fl_Button* o, void* v) { - ((PADnoteUI*)(o->parent()->user_data()))->cb_export_i(o,v); -} - -PADnoteUI::PADnoteUI(PADnoteParameters *parameters,Master *master_) { - pars=parameters; - master=master_; - oscui=NULL; - resui=new ResonanceUI(pars->resonance); - make_window(); -} - -Fl_Double_Window* PADnoteUI::make_window() { - { padnotewindow = new Fl_Double_Window(535, 450, "PAD synth Parameters"); - padnotewindow->user_data((void*)(this)); - { Fl_Tabs* o = new Fl_Tabs(0, 0, 535, 395); - o->callback((Fl_Callback*)cb_); - { harmonicstructuregroup = new Fl_Group(0, 20, 535, 375, "Harmonic Structure"); - harmonicstructuregroup->box(FL_ENGRAVED_BOX); - { Fl_Group* o = bwprofilegroup = new Fl_Group(5, 30, 90, 260); - bwprofilegroup->box(FL_ENGRAVED_BOX); - { WidgetPDial* o = hpbasepar1 = new WidgetPDial(20, 75, 25, 25, "Width"); - hpbasepar1->box(FL_ROUND_UP_BOX); - hpbasepar1->color(FL_BACKGROUND_COLOR); - hpbasepar1->selection_color(FL_INACTIVE_COLOR); - hpbasepar1->labeltype(FL_NORMAL_LABEL); - hpbasepar1->labelfont(0); - hpbasepar1->labelsize(10); - hpbasepar1->labelcolor(FL_FOREGROUND_COLOR); - hpbasepar1->maximum(127); - hpbasepar1->step(1); - hpbasepar1->callback((Fl_Callback*)cb_hpbasepar1); - hpbasepar1->align(Fl_Align(FL_ALIGN_TOP)); - hpbasepar1->when(FL_WHEN_CHANGED); - o->value(pars->Php.base.par1); - } // WidgetPDial* hpbasepar1 - { Fl_Choice* o = hpbasetype = new Fl_Choice(15, 45, 75, 15, "Base Type"); - hpbasetype->down_box(FL_BORDER_BOX); - hpbasetype->labelsize(10); - hpbasetype->textsize(10); - hpbasetype->callback((Fl_Callback*)cb_hpbasetype); - hpbasetype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - hpbasetype->menu(menu_hpbasetype); - o->value(pars->Php.base.type); - } // Fl_Choice* hpbasetype - { WidgetPDial* o = hpfreqmult = new WidgetPDial(55, 75, 25, 25, "FreqMlt"); - hpfreqmult->box(FL_ROUND_UP_BOX); - hpfreqmult->color(FL_BACKGROUND_COLOR); - hpfreqmult->selection_color(FL_INACTIVE_COLOR); - hpfreqmult->labeltype(FL_NORMAL_LABEL); - hpfreqmult->labelfont(0); - hpfreqmult->labelsize(10); - hpfreqmult->labelcolor(FL_FOREGROUND_COLOR); - hpfreqmult->maximum(127); - hpfreqmult->step(1); - hpfreqmult->callback((Fl_Callback*)cb_hpfreqmult); - hpfreqmult->align(Fl_Align(FL_ALIGN_TOP)); - hpfreqmult->when(FL_WHEN_CHANGED); - o->value(pars->Php.freqmult); - } // WidgetPDial* hpfreqmult - { WidgetPDial* o = hpmpar1 = new WidgetPDial(15, 115, 20, 20, "Str"); - hpmpar1->box(FL_ROUND_UP_BOX); - hpmpar1->color(FL_BACKGROUND_COLOR); - hpmpar1->selection_color(FL_INACTIVE_COLOR); - hpmpar1->labeltype(FL_NORMAL_LABEL); - hpmpar1->labelfont(0); - hpmpar1->labelsize(10); - hpmpar1->labelcolor(FL_FOREGROUND_COLOR); - hpmpar1->maximum(127); - hpmpar1->step(1); - hpmpar1->callback((Fl_Callback*)cb_hpmpar1); - hpmpar1->align(Fl_Align(FL_ALIGN_TOP)); - hpmpar1->when(FL_WHEN_CHANGED); - o->value(pars->Php.modulator.par1); - } // WidgetPDial* hpmpar1 - { WidgetPDial* o = hpmfreq = new WidgetPDial(40, 115, 20, 20, "SFreq"); - hpmfreq->box(FL_ROUND_UP_BOX); - hpmfreq->color(FL_BACKGROUND_COLOR); - hpmfreq->selection_color(FL_INACTIVE_COLOR); - hpmfreq->labeltype(FL_NORMAL_LABEL); - hpmfreq->labelfont(0); - hpmfreq->labelsize(10); - hpmfreq->labelcolor(FL_FOREGROUND_COLOR); - hpmfreq->maximum(127); - hpmfreq->step(1); - hpmfreq->callback((Fl_Callback*)cb_hpmfreq); - hpmfreq->align(Fl_Align(FL_ALIGN_TOP)); - hpmfreq->when(FL_WHEN_CHANGED); - o->value(pars->Php.modulator.freq); - } // WidgetPDial* hpmfreq - { Fl_Group* o = new Fl_Group(10, 160, 80, 105); - o->box(FL_BORDER_BOX); - { Fl_Choice* o = hpamptype = new Fl_Choice(15, 175, 70, 15, "AmpMultiplier"); - hpamptype->down_box(FL_BORDER_BOX); - hpamptype->labelsize(10); - hpamptype->textsize(10); - hpamptype->callback((Fl_Callback*)cb_hpamptype); - hpamptype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - hpamptype->menu(menu_hpamptype); - o->value(pars->Php.amp.type); - } // Fl_Choice* hpamptype - { Fl_Choice* o = hpampmode = new Fl_Choice(15, 205, 70, 15, "AmpMode"); - hpampmode->down_box(FL_BORDER_BOX); - hpampmode->labelsize(10); - hpampmode->textsize(10); - hpampmode->callback((Fl_Callback*)cb_hpampmode); - hpampmode->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - hpampmode->menu(menu_hpampmode); - o->value(pars->Php.amp.mode); - } // Fl_Choice* hpampmode - { WidgetPDial* o = hpamppar1 = new WidgetPDial(15, 235, 25, 25, "Par1"); - hpamppar1->box(FL_ROUND_UP_BOX); - hpamppar1->color(FL_BACKGROUND_COLOR); - hpamppar1->selection_color(FL_INACTIVE_COLOR); - hpamppar1->labeltype(FL_NORMAL_LABEL); - hpamppar1->labelfont(0); - hpamppar1->labelsize(10); - hpamppar1->labelcolor(FL_FOREGROUND_COLOR); - hpamppar1->maximum(127); - hpamppar1->step(1); - hpamppar1->callback((Fl_Callback*)cb_hpamppar1); - hpamppar1->align(Fl_Align(FL_ALIGN_TOP)); - hpamppar1->when(FL_WHEN_CHANGED); - o->value(pars->Php.amp.par1); - } // WidgetPDial* hpamppar1 - { WidgetPDial* o = hpamppar2 = new WidgetPDial(55, 235, 25, 25, "Par2"); - hpamppar2->box(FL_ROUND_UP_BOX); - hpamppar2->color(FL_BACKGROUND_COLOR); - hpamppar2->selection_color(FL_INACTIVE_COLOR); - hpamppar2->labeltype(FL_NORMAL_LABEL); - hpamppar2->labelfont(0); - hpamppar2->labelsize(10); - hpamppar2->labelcolor(FL_FOREGROUND_COLOR); - hpamppar2->maximum(127); - hpamppar2->step(1); - hpamppar2->callback((Fl_Callback*)cb_hpamppar2); - hpamppar2->align(Fl_Align(FL_ALIGN_TOP)); - hpamppar2->when(FL_WHEN_CHANGED); - o->value(pars->Php.amp.par2); - } // WidgetPDial* hpamppar2 - o->end(); - } // Fl_Group* o - { Fl_Check_Button* o = hpautoscale = new Fl_Check_Button(10, 270, 60, 15, "autoscale"); - hpautoscale->down_box(FL_DOWN_BOX); - hpautoscale->labelsize(10); - hpautoscale->callback((Fl_Callback*)cb_hpautoscale); - o->value(pars->Php.autoscale); - } // Fl_Check_Button* hpautoscale - { Fl_Choice* o = hponehalf = new Fl_Choice(10, 143, 80, 15); - hponehalf->down_box(FL_BORDER_BOX); - hponehalf->labelsize(10); - hponehalf->textsize(10); - hponehalf->callback((Fl_Callback*)cb_hponehalf); - hponehalf->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - hponehalf->menu(menu_hponehalf); - o->value(pars->Php.onehalf); - } // Fl_Choice* hponehalf - { WidgetPDial* o = hpwidth = new WidgetPDial(65, 115, 20, 20, "Size"); - hpwidth->box(FL_ROUND_UP_BOX); - hpwidth->color(FL_BACKGROUND_COLOR); - hpwidth->selection_color(FL_INACTIVE_COLOR); - hpwidth->labeltype(FL_NORMAL_LABEL); - hpwidth->labelfont(0); - hpwidth->labelsize(10); - hpwidth->labelcolor(FL_FOREGROUND_COLOR); - hpwidth->maximum(127); - hpwidth->step(1); - hpwidth->callback((Fl_Callback*)cb_hpwidth); - hpwidth->align(Fl_Align(FL_ALIGN_TOP)); - hpwidth->when(FL_WHEN_CHANGED); - o->value(pars->Php.width); - } // WidgetPDial* hpwidth - if (pars->Pmode!=0) o->deactivate(); - bwprofilegroup->end(); - } // Fl_Group* bwprofilegroup - { Fl_Group* o = new Fl_Group(100, 155, 270, 135); - o->box(FL_THIN_DOWN_BOX); - o->color(FL_GRAY0); - o->selection_color((Fl_Color)71); - o->labelcolor((Fl_Color)179); - o->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),""); - osc->init(pars->oscilgen,master); - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(375, 270, 60, 20, "Change"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Change); - } // Fl_Button* o - { cbwidget = new Fl_Box(125, 135, 205, 20, "Harmonic Content"); - cbwidget->callback((Fl_Callback*)cb_cbwidget); - cbwidget->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); - } // Fl_Box* cbwidget - { Fl_Button* o = new Fl_Button(375, 225, 80, 20, "Resonance"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Resonance); - } // Fl_Button* o - { WidgetPDial* o = bwdial = new WidgetPDial(15, 295, 35, 35, "BandWidth"); - bwdial->box(FL_ROUND_UP_BOX); - bwdial->color(FL_BACKGROUND_COLOR); - bwdial->selection_color(FL_INACTIVE_COLOR); - bwdial->labeltype(FL_NORMAL_LABEL); - bwdial->labelfont(0); - bwdial->labelsize(10); - bwdial->labelcolor(FL_FOREGROUND_COLOR); - bwdial->maximum(1000); - bwdial->step(1); - bwdial->callback((Fl_Callback*)cb_bwdial); - bwdial->align(Fl_Align(FL_ALIGN_BOTTOM)); - bwdial->when(FL_WHEN_CHANGED); - o->value(pars->Pbandwidth); - if (pars->Pmode!=0) o->deactivate(); - } // WidgetPDial* bwdial - { Fl_Value_Output* o = bwcents = new Fl_Value_Output(55, 305, 55, 15, "cents"); - bwcents->labelsize(10); - bwcents->maximum(10000); - bwcents->step(0.1); - bwcents->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - o->value(pars->setPbandwidth(pars->Pbandwidth)); - if (pars->Pmode!=0) o->deactivate(); - } // Fl_Value_Output* bwcents - { Fl_Group* o = new Fl_Group(315, 295, 215, 45); - o->box(FL_ENGRAVED_BOX); - { Fl_Choice* o = hrpostype = new Fl_Choice(325, 310, 80, 20, "OvertonesPosition"); - hrpostype->down_box(FL_BORDER_BOX); - hrpostype->labelsize(10); - hrpostype->textsize(11); - hrpostype->callback((Fl_Callback*)cb_hrpostype); - hrpostype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - hrpostype->menu(menu_hrpostype); - o->value(pars->Phrpos.type); - } // Fl_Choice* hrpostype - { WidgetPDial* o = hrpospar1 = new WidgetPDial(425, 310, 25, 25, "Par1"); - hrpospar1->box(FL_ROUND_UP_BOX); - hrpospar1->color(FL_BACKGROUND_COLOR); - hrpospar1->selection_color(FL_INACTIVE_COLOR); - hrpospar1->labeltype(FL_NORMAL_LABEL); - hrpospar1->labelfont(0); - hrpospar1->labelsize(10); - hrpospar1->labelcolor(FL_FOREGROUND_COLOR); - hrpospar1->maximum(255); - hrpospar1->step(1); - hrpospar1->callback((Fl_Callback*)cb_hrpospar1); - hrpospar1->align(Fl_Align(FL_ALIGN_TOP)); - hrpospar1->when(FL_WHEN_CHANGED); - o->value(pars->Phrpos.par1); - } // WidgetPDial* hrpospar1 - { WidgetPDial* o = hrpospar2 = new WidgetPDial(460, 310, 25, 25, "Par2"); - hrpospar2->box(FL_ROUND_UP_BOX); - hrpospar2->color(FL_BACKGROUND_COLOR); - hrpospar2->selection_color(FL_INACTIVE_COLOR); - hrpospar2->labeltype(FL_NORMAL_LABEL); - hrpospar2->labelfont(0); - hrpospar2->labelsize(10); - hrpospar2->labelcolor(FL_FOREGROUND_COLOR); - hrpospar2->maximum(255); - hrpospar2->step(1); - hrpospar2->callback((Fl_Callback*)cb_hrpospar2); - hrpospar2->align(Fl_Align(FL_ALIGN_TOP)); - hrpospar2->when(FL_WHEN_CHANGED); - o->value(pars->Phrpos.par2); - } // WidgetPDial* hrpospar2 - { WidgetPDial* o = hrpospar3 = new WidgetPDial(495, 310, 25, 25, "ForceH"); - hrpospar3->box(FL_ROUND_UP_BOX); - hrpospar3->color(FL_BACKGROUND_COLOR); - hrpospar3->selection_color(FL_INACTIVE_COLOR); - hrpospar3->labeltype(FL_NORMAL_LABEL); - hrpospar3->labelfont(0); - hrpospar3->labelsize(10); - hrpospar3->labelcolor(FL_FOREGROUND_COLOR); - hrpospar3->maximum(255); - hrpospar3->step(1); - hrpospar3->callback((Fl_Callback*)cb_hrpospar3); - hrpospar3->align(Fl_Align(FL_ALIGN_TOP)); - hrpospar3->when(FL_WHEN_CHANGED); - o->value(pars->Phrpos.par3); - } // WidgetPDial* hrpospar3 - o->end(); - } // Fl_Group* o - { Fl_Choice* o = bwscale = new Fl_Choice(120, 305, 80, 20, "Bandwidth Scale"); - bwscale->down_box(FL_BORDER_BOX); - bwscale->labelsize(10); - bwscale->textsize(11); - bwscale->callback((Fl_Callback*)cb_bwscale); - bwscale->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - bwscale->menu(menu_bwscale); - o->value(pars->Pbwscale); - if (pars->Pmode!=0) o->deactivate(); - } // Fl_Choice* bwscale - { Fl_Group* o = overtonepos = new Fl_Group(5, 345, 525, 45); - overtonepos->box(FL_FLAT_BOX); - overtonepos->color(FL_LIGHT3); - overtonepos->selection_color((Fl_Color)218); - overtonepos->labelcolor(FL_GREEN); - PADnoteOvertonePosition *opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),""); - opui->init(pars,master); - overtonepos->end(); - } // Fl_Group* overtonepos - { Fl_Choice* o = qsamplesize = new Fl_Choice(375, 190, 115, 20, "Sample Size"); - qsamplesize->down_box(FL_BORDER_BOX); - qsamplesize->labelsize(10); - qsamplesize->textsize(11); - qsamplesize->callback((Fl_Callback*)cb_qsamplesize); - qsamplesize->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - qsamplesize->menu(menu_qsamplesize); - o->value(pars->Pquality.samplesize); - } // Fl_Choice* qsamplesize - { Fl_Choice* o = qsmpoct = new Fl_Choice(430, 155, 45, 20, "smp/oct"); - qsmpoct->down_box(FL_BORDER_BOX); - qsmpoct->labelsize(11); - qsmpoct->textsize(11); - qsmpoct->callback((Fl_Callback*)cb_qsmpoct); - qsmpoct->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - qsmpoct->menu(menu_qsmpoct); - o->value(pars->Pquality.smpoct); - } // Fl_Choice* qsmpoct - { Fl_Choice* o = qoct = new Fl_Choice(480, 155, 45, 20, "no.oct"); - qoct->down_box(FL_BORDER_BOX); - qoct->labelsize(11); - qoct->textsize(11); - qoct->callback((Fl_Callback*)cb_qoct); - qoct->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - qoct->menu(menu_qoct); - o->value(pars->Pquality.oct); - } // Fl_Choice* qoct - { Fl_Choice* o = qbasenote = new Fl_Choice(375, 155, 50, 20, "base"); - qbasenote->down_box(FL_BORDER_BOX); - qbasenote->labelsize(11); - qbasenote->textsize(11); - qbasenote->callback((Fl_Callback*)cb_qbasenote); - qbasenote->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - qbasenote->menu(menu_qbasenote); - o->value(pars->Pquality.basenote); - } // Fl_Choice* qbasenote - { Fl_Group* o = hprofile = new Fl_Group(100, 45, 430, 90); - hprofile->box(FL_FLAT_BOX); - hprofile->color(FL_LIGHT3); - hprofile->selection_color((Fl_Color)218); - hprofile->labelcolor(FL_GREEN); - PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),""); - hpui->init(pars,master); - if (pars->Pmode!=0) { o->deactivate(); o->color(48);}; - hprofile->end(); - } // Fl_Group* hprofile - { new Fl_Box(160, 25, 315, 20, "Profile of One Harmonic (Frequency Distribution)"); - } // Fl_Box* o - { Fl_Choice* o = spectrummode = new Fl_Choice(220, 305, 90, 20, "Spectrum Mode"); - spectrummode->down_box(FL_BORDER_BOX); - spectrummode->labelfont(1); - spectrummode->labelsize(10); - spectrummode->textsize(11); - spectrummode->callback((Fl_Callback*)cb_spectrummode); - spectrummode->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - spectrummode->menu(menu_spectrummode); - o->value(pars->Pmode); - } // Fl_Choice* spectrummode - harmonicstructuregroup->end(); - } // Fl_Group* harmonicstructuregroup - { Fl_Group* o = new Fl_Group(0, 20, 535, 375, "Envelopes&LFOs"); - o->box(FL_ENGRAVED_BOX); - o->hide(); - { Fl_Group* o = new Fl_Group(5, 275, 525, 115, "FREQUENCY"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = freqenv = new EnvelopeUI(10, 315, 205, 70, "PADSynth - Frequency Envelope"); - freqenv->box(FL_FLAT_BOX); - freqenv->color((Fl_Color)51); - freqenv->selection_color(FL_BACKGROUND_COLOR); - freqenv->labeltype(FL_NORMAL_LABEL); - freqenv->labelfont(0); - freqenv->labelsize(14); - freqenv->labelcolor(FL_FOREGROUND_COLOR); - freqenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - freqenv->when(FL_WHEN_RELEASE); - o->init(pars->FreqEnvelope); - freqenv->end(); - } // EnvelopeUI* freqenv - { Fl_Counter* o = octave = new Fl_Counter(470, 295, 45, 15, "Octave"); - octave->tooltip("Octave"); - octave->type(1); - octave->labelsize(10); - octave->minimum(-8); - octave->maximum(7); - octave->step(1); - octave->textfont(1); - octave->textsize(11); - octave->callback((Fl_Callback*)cb_octave); - octave->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->PCoarseDetune/1024; - if (k>=8) k-=16; - o->value(k); - } // Fl_Counter* octave - { Fl_Counter* o = coarsedet = new Fl_Counter(455, 365, 60, 20, "Coarse det."); - coarsedet->tooltip("Coarse Detune"); - coarsedet->labelsize(10); - coarsedet->minimum(-64); - coarsedet->maximum(63); - coarsedet->step(1); - coarsedet->textfont(1); - coarsedet->textsize(11); - coarsedet->callback((Fl_Callback*)cb_coarsedet); - coarsedet->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - int k=pars->PCoarseDetune%1024; - if (k>=512) k-=1024; - o->value(k); - o->lstep(10); - } // Fl_Counter* coarsedet - { LFOUI* o = freqlfo = new LFOUI(215, 315, 230, 70, "Frequency LFO "); - freqlfo->box(FL_FLAT_BOX); - freqlfo->color(FL_DARK1); - freqlfo->selection_color(FL_BACKGROUND_COLOR); - freqlfo->labeltype(FL_NORMAL_LABEL); - freqlfo->labelfont(0); - freqlfo->labelsize(14); - freqlfo->labelcolor(FL_FOREGROUND_COLOR); - freqlfo->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - freqlfo->when(FL_WHEN_RELEASE); - o->init(pars->FreqLfo); - freqlfo->end(); - } // LFOUI* freqlfo - { Fl_Slider* o = detune = new Fl_Slider(60, 295, 295, 15); - detune->tooltip("Fine Detune (cents)"); - detune->type(5); - detune->box(FL_FLAT_BOX); - detune->minimum(-8192); - detune->maximum(8191); - detune->step(1); - detune->callback((Fl_Callback*)cb_detune); - o->value(pars->PDetune-8192); - } // Fl_Slider* detune - { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(12, 295, 45, 15, "Detune"); - detunevalueoutput->labelsize(10); - detunevalueoutput->minimum(-5000); - detunevalueoutput->maximum(5000); - detunevalueoutput->step(0.01); - detunevalueoutput->textfont(1); - detunevalueoutput->textsize(10); - detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput); - detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); - } // Fl_Value_Output* detunevalueoutput - { Fl_Choice* o = detunetype = new Fl_Choice(450, 335, 75, 15, "Detune Type"); - detunetype->down_box(FL_BORDER_BOX); - detunetype->labelsize(10); - detunetype->textfont(1); - detunetype->textsize(10); - detunetype->callback((Fl_Callback*)cb_detunetype); - detunetype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); - o->value(pars->PDetuneType-1); - } // Fl_Choice* detunetype - { Fl_Check_Button* o = hz440 = new Fl_Check_Button(365, 295, 50, 15, "440Hz"); - hz440->tooltip("set the base frequency to 440Hz"); - hz440->down_box(FL_DOWN_BOX); - hz440->labelfont(1); - hz440->labelsize(10); - hz440->callback((Fl_Callback*)cb_hz440); - o->value(pars->Pfixedfreq); - } // Fl_Check_Button* hz440 - { WidgetPDial* o = fixedfreqetdial = new WidgetPDial(420, 295, 15, 15, "Eq.T."); - fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\ -cy)"); - fixedfreqetdial->box(FL_ROUND_UP_BOX); - fixedfreqetdial->color(FL_BACKGROUND_COLOR); - fixedfreqetdial->selection_color(FL_INACTIVE_COLOR); - fixedfreqetdial->labeltype(FL_NORMAL_LABEL); - fixedfreqetdial->labelfont(0); - fixedfreqetdial->labelsize(10); - fixedfreqetdial->labelcolor(FL_FOREGROUND_COLOR); - fixedfreqetdial->maximum(127); - fixedfreqetdial->step(1); - fixedfreqetdial->callback((Fl_Callback*)cb_fixedfreqetdial); - fixedfreqetdial->align(Fl_Align(FL_ALIGN_RIGHT)); - fixedfreqetdial->when(FL_WHEN_CHANGED); - o->value(pars->PfixedfreqET); - if (pars->Pfixedfreq==0) o->deactivate(); - } // WidgetPDial* fixedfreqetdial - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(5, 25, 240, 250, "AMPLITUDE"); - o->box(FL_THIN_UP_FRAME); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { Fl_Value_Slider* o = volume = new Fl_Value_Slider(10, 50, 160, 15, "Vol"); - volume->tooltip("Volume"); - volume->type(5); - volume->box(FL_FLAT_BOX); - volume->labelsize(11); - volume->maximum(127); - volume->step(1); - volume->callback((Fl_Callback*)cb_volume); - volume->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->PVolume); - } // Fl_Value_Slider* volume - { Fl_Value_Slider* o = vsns = new Fl_Value_Slider(10, 70, 160, 15, "V.Sns"); - vsns->tooltip("Velocity Sensing Function (rightmost to disable)"); - vsns->type(5); - vsns->box(FL_FLAT_BOX); - vsns->labelsize(11); - vsns->maximum(127); - vsns->step(1); - vsns->callback((Fl_Callback*)cb_vsns); - vsns->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->PAmpVelocityScaleFunction); - } // Fl_Value_Slider* vsns - { WidgetPDial* o = pan = new WidgetPDial(210, 45, 30, 30, "Pan"); - pan->tooltip("Panning (leftmost is Random)"); - pan->box(FL_ROUND_UP_BOX); - pan->color(FL_BACKGROUND_COLOR); - pan->selection_color(FL_INACTIVE_COLOR); - pan->labeltype(FL_NORMAL_LABEL); - pan->labelfont(0); - pan->labelsize(10); - pan->labelcolor(FL_FOREGROUND_COLOR); - pan->maximum(127); - pan->step(1); - pan->callback((Fl_Callback*)cb_pan); - pan->align(Fl_Align(FL_ALIGN_BOTTOM)); - pan->when(FL_WHEN_CHANGED); - o->value(pars->PPanning); - } // WidgetPDial* pan - { WidgetPDial* o = pstr = new WidgetPDial(125, 247, 25, 25, "P.Str."); - pstr->tooltip("Punch Strength"); - pstr->box(FL_ROUND_UP_BOX); - pstr->color(FL_BACKGROUND_COLOR); - pstr->selection_color(FL_INACTIVE_COLOR); - pstr->labeltype(FL_NORMAL_LABEL); - pstr->labelfont(0); - pstr->labelsize(10); - pstr->labelcolor(FL_FOREGROUND_COLOR); - pstr->maximum(127); - pstr->step(1); - pstr->callback((Fl_Callback*)cb_pstr); - pstr->align(Fl_Align(FL_ALIGN_TOP)); - pstr->when(FL_WHEN_CHANGED); - o->value(pars->PPunchStrength); - } // WidgetPDial* pstr - { WidgetPDial* o = pt = new WidgetPDial(155, 247, 25, 25, "P.t."); - pt->tooltip("Punch Time (duration)"); - pt->box(FL_ROUND_UP_BOX); - pt->color(FL_BACKGROUND_COLOR); - pt->selection_color(FL_INACTIVE_COLOR); - pt->labeltype(FL_NORMAL_LABEL); - pt->labelfont(0); - pt->labelsize(10); - pt->labelcolor(FL_FOREGROUND_COLOR); - pt->maximum(127); - pt->step(1); - pt->callback((Fl_Callback*)cb_pt); - pt->align(Fl_Align(FL_ALIGN_TOP)); - pt->when(FL_WHEN_CHANGED); - o->value(pars->PPunchTime); - } // WidgetPDial* pt - { WidgetPDial* o = pstc = new WidgetPDial(185, 247, 25, 25, "P.Stc."); - pstc->tooltip("Punch Stretch"); - pstc->box(FL_ROUND_UP_BOX); - pstc->color(FL_BACKGROUND_COLOR); - pstc->selection_color(FL_INACTIVE_COLOR); - pstc->labeltype(FL_NORMAL_LABEL); - pstc->labelfont(0); - pstc->labelsize(10); - pstc->labelcolor(FL_FOREGROUND_COLOR); - pstc->maximum(127); - pstc->step(1); - pstc->callback((Fl_Callback*)cb_pstc); - pstc->align(Fl_Align(FL_ALIGN_TOP)); - pstc->when(FL_WHEN_CHANGED); - o->value(pars->PPunchStretch); - } // WidgetPDial* pstc - { WidgetPDial* o = pvel = new WidgetPDial(215, 247, 25, 25, "P.Vel."); - pvel->tooltip("Punch Velocity Sensing"); - pvel->box(FL_ROUND_UP_BOX); - pvel->color(FL_BACKGROUND_COLOR); - pvel->selection_color(FL_INACTIVE_COLOR); - pvel->labeltype(FL_NORMAL_LABEL); - pvel->labelfont(0); - pvel->labelsize(10); - pvel->labelcolor(FL_FOREGROUND_COLOR); - pvel->maximum(127); - pvel->step(1); - pvel->callback((Fl_Callback*)cb_pvel); - pvel->align(Fl_Align(FL_ALIGN_TOP)); - pvel->when(FL_WHEN_CHANGED); - o->value(pars->PPunchVelocitySensing); - } // WidgetPDial* pvel - { EnvelopeUI* o = ampenv = new EnvelopeUI(10, 95, 205, 70, "PADSynth - Amplitude Envelope"); - ampenv->box(FL_FLAT_BOX); - ampenv->color((Fl_Color)51); - ampenv->selection_color(FL_BACKGROUND_COLOR); - ampenv->labeltype(FL_NORMAL_LABEL); - ampenv->labelfont(0); - ampenv->labelsize(14); - ampenv->labelcolor(FL_FOREGROUND_COLOR); - ampenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - ampenv->when(FL_WHEN_RELEASE); - o->init(pars->AmpEnvelope); - ampenv->end(); - } // EnvelopeUI* ampenv - { LFOUI* o = amplfo = new LFOUI(10, 165, 230, 70, "Amplitude LFO "); - amplfo->box(FL_FLAT_BOX); - amplfo->color(FL_DARK1); - amplfo->selection_color(FL_BACKGROUND_COLOR); - amplfo->labeltype(FL_NORMAL_LABEL); - amplfo->labelfont(0); - amplfo->labelsize(14); - amplfo->labelcolor(FL_FOREGROUND_COLOR); - amplfo->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - amplfo->when(FL_WHEN_RELEASE); - o->init(pars->AmpLfo); - amplfo->end(); - } // LFOUI* amplfo - { Fl_Check_Button* o = stereo = new Fl_Check_Button(15, 245, 70, 25, "Stereo"); - stereo->down_box(FL_DOWN_BOX); - stereo->callback((Fl_Callback*)cb_stereo); - o->value(pars->PStereo); - } // Fl_Check_Button* stereo - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(245, 25, 285, 250, "FILTER"); - o->box(FL_THIN_UP_BOX); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->labelsize(13); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = filterenv = new EnvelopeUI(250, 130, 275, 70, "PADSynth - Filter Envelope"); - filterenv->box(FL_FLAT_BOX); - filterenv->color((Fl_Color)51); - filterenv->selection_color(FL_BACKGROUND_COLOR); - filterenv->labeltype(FL_NORMAL_LABEL); - filterenv->labelfont(0); - filterenv->labelsize(14); - filterenv->labelcolor(FL_FOREGROUND_COLOR); - filterenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterenv->when(FL_WHEN_RELEASE); - o->init(pars->FilterEnvelope); - filterenv->end(); - } // EnvelopeUI* filterenv - { LFOUI* o = filterlfo = new LFOUI(250, 200, 230, 70, "Filter LFO "); - filterlfo->box(FL_FLAT_BOX); - filterlfo->color(FL_DARK1); - filterlfo->selection_color(FL_BACKGROUND_COLOR); - filterlfo->labeltype(FL_NORMAL_LABEL); - filterlfo->labelfont(0); - filterlfo->labelsize(14); - filterlfo->labelcolor(FL_FOREGROUND_COLOR); - filterlfo->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterlfo->when(FL_WHEN_RELEASE); - o->init(pars->FilterLfo); - filterlfo->end(); - } // LFOUI* filterlfo - { FilterUI* o = filterui = new FilterUI(250, 55, 275, 75, "PADsynth - Filter"); - filterui->box(FL_FLAT_BOX); - filterui->color(FL_LIGHT1); - filterui->selection_color(FL_BACKGROUND_COLOR); - filterui->labeltype(FL_NORMAL_LABEL); - filterui->labelfont(0); - filterui->labelsize(14); - filterui->labelcolor(FL_FOREGROUND_COLOR); - filterui->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterui->when(FL_WHEN_RELEASE); - o->init(pars->GlobalFilter,&pars->PFilterVelocityScale,&pars->PFilterVelocityScaleFunction); - filterui->end(); - } // FilterUI* filterui - o->end(); - } // Fl_Group* o - o->end(); - } // Fl_Group* o - o->end(); - } // Fl_Tabs* o - { Fl_Button* o = applybutton = new Fl_Button(45, 405, 185, 40, "Apply Changes"); - applybutton->box(FL_THIN_UP_BOX); - applybutton->labelfont(1); - applybutton->labelsize(16); - applybutton->callback((Fl_Callback*)cb_applybutton); - o->color(FL_RED); - } // Fl_Button* applybutton - { Fl_Button* o = new Fl_Button(320, 405, 175, 40, "Close"); - o->box(FL_THIN_UP_BOX); - o->labelsize(17); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(240, 430, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(270, 430, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(240, 405, 55, 15, "export"); - o->tooltip("export samples as wav file"); - o->box(FL_THIN_UP_BOX); - o->color(FL_WHITE); - o->labelsize(11); - o->callback((Fl_Callback*)cb_export); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - padnotewindow->end(); - } // Fl_Double_Window* padnotewindow - return padnotewindow; -} - -void PADnoteUI::refresh() { - volume->value(pars->PVolume); - vsns->value(pars->PAmpVelocityScaleFunction); - pan->value(pars->PPanning); - - stereo->value(pars->PStereo); - - - pstr->value(pars->PPunchStrength); - pt->value(pars->PPunchTime); - pstc->value(pars->PPunchStretch); - pvel->value(pars->PPunchVelocitySensing); - - detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); - detune->value(pars->PDetune-8192); - - int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; - octave->value(k); - - detunetype->value(pars->PDetuneType-1); - k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; - coarsedet->value(k); - - hz440->value(pars->Pfixedfreq); - fixedfreqetdial->value(pars->PfixedfreqET); - - amplfo->refresh(); - freqlfo->refresh(); - filterlfo->refresh(); - - ampenv->refresh(); - freqenv->refresh(); - filterenv->refresh(); - filterui->refresh(); - - - /* harmonic structure parametrs */ - - resui->refresh(); - if (oscui!=NULL) oscui->refresh(); - - hpbasetype->value(pars->Php.base.type); - hpbasepar1->value(pars->Php.base.par1); - hpfreqmult->value(pars->Php.freqmult); - - hpmpar1->value(pars->Php.modulator.par1); - hpmfreq->value(pars->Php.modulator.freq); - hpwidth->value(pars->Php.width); - - hponehalf->value(pars->Php.onehalf); - hpamptype->value(pars->Php.amp.type); - hpampmode->value(pars->Php.amp.mode); - hpamppar1->value(pars->Php.amp.par1); - hpamppar2->value(pars->Php.amp.par2); - hpautoscale->value(pars->Php.autoscale); - - bwdial->value(pars->Pbandwidth); - if (pars->Pmode==0){ - bwprofilegroup->activate(); - bwdial->activate(); - bwcents->activate(); - hprofile->activate(); - hprofile->color(54); - bwscale->activate(); - } else { - bwprofilegroup->deactivate(); - bwdial->deactivate(); - bwcents->deactivate(); - hprofile->deactivate(); - hprofile->color(48); - bwscale->activate(); - }; - - spectrummode->value(pars->Pmode); - - qbasenote->value(pars->Pquality.basenote); - qsmpoct->value(pars->Pquality.smpoct); - qoct->value(pars->Pquality.oct); - qsamplesize->value(pars->Pquality.samplesize); - - hrpostype->value(pars->Phrpos.type); - hrpospar1->value(pars->Phrpos.par1); - hrpospar2->value(pars->Phrpos.par2); - hrpospar3->value(pars->Phrpos.par3); - - hprofile->redraw(); - overtonepos->redraw(); - - osc->redraw(); - pars->applyparameters(true); - applybutton->color(FL_GRAY); - applybutton->parent()->redraw(); -} - -PADnoteUI::~PADnoteUI() { - delete(oscui); - delete(resui); - - padnotewindow->hide(); - delete(padnotewindow); -} diff --git a/plugins/zynaddsubfx/src/UI/PADnoteUI.fl b/plugins/zynaddsubfx/src/UI/PADnoteUI.fl deleted file mode 100644 index 74441c199..000000000 --- a/plugins/zynaddsubfx/src/UI/PADnoteUI.fl +++ /dev/null @@ -1,1101 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {\#include "../Params/PADnoteParameters.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "ResonanceUI.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "LFOUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "OscilGenUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class PADnoteHarmonicProfile {: {public Fl_Box} -} { - Function {PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {pars=NULL;} {} - } - Function {init(PADnoteParameters *pars,Master *master_)} {} { - code {master=master_; -this->pars=pars;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(); -if (!visible()) return; -REALTYPE smps[lx]; - -REALTYPE realbw=pars->getprofile(smps,lx); -bool active=active_r(); - -//draw the equivalent bandwidth -if (active) fl_color(220,220,220); - else fl_color(160,165,165); -fl_line_style(0); -int rbw=(int)(realbw*(lx-1.0)/2.0); -for (int i=lx/2-rbw;i<(lx/2+rbw);i++) fl_line(ox+i,oy,ox+i,oy+ly-1); - -fl_line_style(0); -if (active) fl_color(200,200,200); - else fl_color(160,160,160); -for (int i=1;i<10;i++){ - int kx=(int)(lx/10.0*i); - fl_line(ox+kx,oy,ox+kx,oy+ly-1); -}; -for (int i=1;i<5;i++){ - int ky=(int)(ly/5.0*i); - fl_line(ox,oy+ly-ky,ox+lx,oy+ly-ky-1); -}; - - -fl_color(120,120,120); -fl_line_style(FL_DOT); -fl_line(ox+lx/2,oy,ox+lx/2,oy+ly); - -//draw the graph -fl_line_style(0); -int old=0; -for (int i=0;i0) fl_line(ox+i-1,oy+ly-2-old,ox+i,oy+ly-2-val); - old=val; -}; - - -fl_line_style(FL_DASH); -if (active) fl_color(0,100,220); - else fl_color(150,160,170); -fl_line(ox+lx/2-rbw,oy,ox+lx/2-rbw,oy+ly-1); -fl_line(ox+lx/2+rbw,oy,ox+lx/2+rbw,oy+ly-1); - -fl_line_style(0);} {} - } - decl {Master *master;} {} - decl {PADnoteParameters *pars;} {public - } -} - -class PADnoteOvertonePosition {: {public Fl_Box} -} { - Function {PADnoteOvertonePosition(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {pars=NULL;} {} - } - Function {init(PADnoteParameters *pars,Master *master_)} {} { - code {master=master_; -this->pars=pars;} {} - } - Function {draw()} {} { - code {if (!visible()) return; -const int maxdb=60; - -int ox=x(),oy=y(),lx=w(),ly=h(); -const int maxharmonic=64; - - -for (int i=1;imutex); -pars->oscilgen->getspectrum(n,spc,0); -pthread_mutex_unlock(&master->mutex); - - -//normalize -REALTYPE max=0; -for (int i=0;igetNhr(i); - int kx=(int)(lx/(REALTYPE)maxharmonic*nhr); - if ((kx<0)||(kx>lx)) continue; - - spectrum[kx]=spc[i-1]/max+1e-9; - -}; - -fl_color(180,0,0); -fl_line_style(0); - -if (pars->Pmode==2){ - int old=0; - for (int i=1;i1e-10)||(i==(lx-1))){ - int delta=i-old; - REALTYPE val1=spectrum[old]; - REALTYPE val2=spectrum[i]; - - REALTYPE idelta=1.0/delta; - for (int j=0;jdB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else continue; - int yy=(int)(x*ly); - fl_line(ox+i,oy+ly-1-yy,ox+i,oy+ly-1); - -};} {} - } - decl {Master *master;} {} - decl {PADnoteParameters *pars;} {public - } -} - -class PADnoteUI {open : {public PresetsUI_} -} { - Function {PADnoteUI(PADnoteParameters *parameters,Master *master_)} {open - } { - code {pars=parameters; -master=master_; -oscui=NULL; -resui=new ResonanceUI(pars->resonance); -make_window();} {} - } - Function {make_window()} {open - } { - Fl_Window padnotewindow { - label {PAD synth Parameters} open - xywh {281 302 535 450} type Double visible - } { - Fl_Tabs {} { - callback {if (o->value()!=harmonicstructuregroup) applybutton->hide(); - else applybutton->show();} - xywh {0 0 535 395} - } { - Fl_Group harmonicstructuregroup { - label {Harmonic Structure} - xywh {0 20 535 375} box ENGRAVED_BOX - } { - Fl_Group bwprofilegroup { - xywh {5 30 90 260} box ENGRAVED_BOX - code0 {if (pars->Pmode!=0) o->deactivate();} - } { - Fl_Dial hpbasepar1 { - label Width - callback {pars->Php.base.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {20 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.base.par1);} - class WidgetPDial - } - Fl_Choice hpbasetype { - label {Base Type} - callback {pars->Php.base.type=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 45 75 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.base.type);} - } { - MenuItem {} { - label Gauss - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Square - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DoubleExp - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hpfreqmult { - label FreqMlt - callback {pars->Php.freqmult=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {55 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.freqmult);} - class WidgetPDial - } - Fl_Dial hpmpar1 { - label Str - callback {pars->Php.modulator.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.modulator.par1);} - class WidgetPDial - } - Fl_Dial hpmfreq { - label SFreq - callback {pars->Php.modulator.freq=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {40 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.modulator.freq);} - class WidgetPDial - } - Fl_Group {} { - xywh {10 160 80 105} box BORDER_BOX - } { - Fl_Choice hpamptype { - label AmpMultiplier - callback {pars->Php.amp.type=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 175 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.amp.type);} - } { - MenuItem {} { - label OFF - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Gauss - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Flat - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice hpampmode { - label AmpMode - callback {pars->Php.amp.mode=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 205 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.amp.mode);} - } { - MenuItem {} { - label Sum - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Mult - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Div1 - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Div2 - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hpamppar1 { - label Par1 - callback {pars->Php.amp.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.amp.par1);} - class WidgetPDial - } - Fl_Dial hpamppar2 { - label Par2 - callback {pars->Php.amp.par2=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {55 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.amp.par2);} - class WidgetPDial - } - } - Fl_Check_Button hpautoscale { - label autoscale - callback {pars->Php.autoscale=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {10 270 60 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(pars->Php.autoscale);} - } - Fl_Choice hponehalf { - callback {pars->Php.onehalf=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {10 143 80 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.onehalf);} - } { - MenuItem {} { - label Full - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Upper Half} - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Lower Half} - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hpwidth { - label Size - callback {pars->Php.width=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {65 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.width);} - class WidgetPDial - } - } - Fl_Group {} { - xywh {100 155 270 135} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 align 6 - code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(pars->oscilgen,master);} - } {} - Fl_Button {} { - label Change - callback {if (oscui!=NULL) delete (oscui); -oscui=new OscilEditor(pars->oscilgen,osc,cbwidget,applybutton,master);} - xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Box cbwidget { - label {Harmonic Content} - callback {overtonepos->redraw(); -applybutton->color(FL_RED); -applybutton->redraw();} - xywh {125 135 205 20} align 16 - } - Fl_Button {} { - label Resonance - callback {resui->resonancewindow->redraw(); -resui->resonancewindow->show(); -resui->setcbwidget(cbwidget,applybutton);} - xywh {375 225 80 20} box THIN_UP_BOX - } - Fl_Dial bwdial { - label BandWidth - callback {bwcents->value(pars->setPbandwidth((int) o->value())); -cbwidget->do_callback();} - xywh {15 295 35 35} box ROUND_UP_BOX labelsize 10 maximum 1000 step 1 - code0 {o->value(pars->Pbandwidth);} - code1 {if (pars->Pmode!=0) o->deactivate();} - class WidgetPDial - } - Fl_Value_Output bwcents { - label cents - xywh {55 305 55 15} labelsize 10 align 6 maximum 10000 step 0.1 - code0 {o->value(pars->setPbandwidth(pars->Pbandwidth));} - code1 {if (pars->Pmode!=0) o->deactivate();} - } - Fl_Group {} { - xywh {315 295 215 45} box ENGRAVED_BOX - } { - Fl_Choice hrpostype { - label OvertonesPosition - callback {pars->Phrpos.type=o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Phrpos.type);} - } { - MenuItem {} { - label Harmonic - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label ShiftU - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label ShiftL - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PowerU - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PowerL - xywh {100 100 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Sine - xywh {110 110 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Power - xywh {120 120 100 20} labelfont 1 labelsize 11 - } - } - Fl_Dial hrpospar1 { - label Par1 - callback {pars->Phrpos.par1=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 - code0 {o->value(pars->Phrpos.par1);} - class WidgetPDial - } - Fl_Dial hrpospar2 { - label Par2 - callback {pars->Phrpos.par2=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 - code0 {o->value(pars->Phrpos.par2);} - class WidgetPDial - } - Fl_Dial hrpospar3 { - label ForceH - callback {pars->Phrpos.par3=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 - code0 {o->value(pars->Phrpos.par3);} - class WidgetPDial - } - } - Fl_Choice bwscale { - label {Bandwidth Scale} - callback {pars->Pbwscale=(int) o->value(); -cbwidget->do_callback();} - xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Pbwscale);} - code1 {if (pars->Pmode!=0) o->deactivate();} - } { - MenuItem {} { - label Normal - xywh {95 95 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label EqualHz - xywh {105 105 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Quater - xywh {115 115 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Half - xywh {125 125 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {75%} - xywh {135 135 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {150%} - xywh {145 145 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Double - xywh {145 145 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Inv.Half} - xywh {155 155 100 20} labelfont 1 labelsize 11 - } - } - Fl_Group overtonepos { - xywh {5 345 525 45} box FLAT_BOX color 54 selection_color 218 labelcolor 63 - code0 {PADnoteOvertonePosition *opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),"");} - code1 {opui->init(pars,master);} - } {} - Fl_Choice qsamplesize { - label {Sample Size} - callback {pars->Pquality.samplesize=(int) o->value(); -cbwidget->do_callback();} - xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Pquality.samplesize);} - } { - MenuItem {} { - label {16k (Tiny)} - xywh {155 155 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 32k - xywh {165 165 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {64k (Small)} - xywh {175 175 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 128k - xywh {185 185 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {256k (Normal)} - xywh {205 205 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 512k - xywh {200 200 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {1M (Big)} - xywh {205 205 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice qsmpoct { - label {smp/oct} - callback {pars->Pquality.smpoct=(int) o->value(); -cbwidget->do_callback();} - xywh {430 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - code0 {o->value(pars->Pquality.smpoct);} - } { - MenuItem {} { - label {0.5} - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 1 - xywh {0 0 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 2 - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 3 - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 4 - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 6 - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 12 - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice qoct { - label {no.oct} - callback {pars->Pquality.oct=(int) o->value(); -cbwidget->do_callback();} - xywh {480 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - code0 {o->value(pars->Pquality.oct);} - } { - MenuItem {} { - label 1 - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 2 - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 3 - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 4 - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 5 - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 6 - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 7 - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 8 - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice qbasenote { - label base - callback {pars->Pquality.basenote=(int) o->value(); -cbwidget->do_callback();} - xywh {375 155 50 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - code0 {o->value(pars->Pquality.basenote);} - } { - MenuItem {} { - label {C-2} - xywh {10 10 100 20} labelfont 1 - } - MenuItem {} { - label {G-2} - xywh {20 20 100 20} labelfont 1 - } - MenuItem {} { - label {C-3} - xywh {20 20 100 20} labelfont 1 - } - MenuItem {} { - label {G-3} - xywh {30 30 100 20} labelfont 1 - } - MenuItem {} { - label {C-4} - xywh {30 30 100 20} labelfont 1 - } - MenuItem {} { - label {G-4} - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label {C-5} - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label {G-5} - xywh {50 50 100 20} labelfont 1 - } - MenuItem {} { - label {G-6} - xywh {60 60 100 20} labelfont 1 - } - } - Fl_Group hprofile { - xywh {100 45 430 90} box FLAT_BOX color 54 selection_color 218 labelcolor 63 - code0 {PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");} - code1 {hpui->init(pars,master);} - code2 {if (pars->Pmode!=0) { o->deactivate(); o->color(48);};} - } {} - Fl_Box {} { - label {Profile of One Harmonic (Frequency Distribution)} - xywh {160 25 315 20} - } - Fl_Choice spectrummode { - label {Spectrum Mode} - callback {pars->Pmode=(int) o->value(); - -if (pars->Pmode==0){ - bwprofilegroup->activate(); - bwdial->activate(); - bwcents->activate(); - hprofile->activate(); - hprofile->color(54); - bwscale->activate(); -} else { - bwprofilegroup->deactivate(); - bwdial->deactivate(); - bwcents->deactivate(); - hprofile->deactivate(); - hprofile->color(48); - bwscale->deactivate(); -}; - -cbwidget->do_callback();} - xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Pmode);} - } { - MenuItem {} { - label Bandwidth - xywh {105 105 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Discrete - xywh {125 125 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Continous - xywh {115 115 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Group {} { - label {Envelopes&LFOs} - xywh {0 20 535 375} box ENGRAVED_BOX hide - } { - Fl_Group {} { - label FREQUENCY - xywh {5 275 525 115} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group freqenv { - label {PADSynth - Frequency Envelope} open - xywh {10 315 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->FreqEnvelope);} - class EnvelopeUI - } {} - Fl_Counter octave { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->PCoarseDetune = k*1024+ - pars->PCoarseDetune%1024;} - tooltip Octave xywh {470 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter coarsedet { - label {Coarse det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->PCoarseDetune = k+ - (pars->PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {455 365 60 20} labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Group freqlfo { - label {Frequency LFO } open - xywh {215 315 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->FreqLfo);} - class LFOUI - } {} - Fl_Slider detune { - callback {pars->PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {60 295 295 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - xywh {12 295 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - } - Fl_Choice detunetype { - label {Detune Type} - callback {pars->PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback();} open - xywh {450 335 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->PDetuneType-1);} - } {} - Fl_Check_Button hz440 { - label 440Hz - callback {int x=(int) o->value(); -pars->Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate();} - tooltip {set the base frequency to 440Hz} xywh {365 295 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->Pfixedfreq);} - } - Fl_Dial fixedfreqetdial { - label {Eq.T.} - callback {pars->PfixedfreqET=(int) o->value();} - tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 - code0 {o->value(pars->PfixedfreqET);} - code1 {if (pars->Pfixedfreq==0) o->deactivate();} - class WidgetPDial - } - } - Fl_Group {} { - label AMPLITUDE - xywh {5 25 240 250} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider volume { - label Vol - callback {pars->PVolume=(int)o->value();} - tooltip Volume xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PVolume);} - } - Fl_Value_Slider vsns { - label {V.Sns} - callback {pars->PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 70 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PAmpVelocityScaleFunction);} - } - Fl_Dial pan { - label Pan - callback {pars->PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->PPanning);} - class WidgetPDial - } - Fl_Dial pstr { - label {P.Str.} - callback {pars->PPunchStrength=(int) o->value();} - tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchStrength);} - class WidgetPDial - } - Fl_Dial pt { - label {P.t.} - callback {pars->PPunchTime=(int) o->value();} - tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchTime);} - class WidgetPDial - } - Fl_Dial pstc { - label {P.Stc.} - callback {pars->PPunchStretch=(int) o->value();} - tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchStretch);} - class WidgetPDial - } - Fl_Dial pvel { - label {P.Vel.} - callback {pars->PPunchVelocitySensing=(int) o->value();} - tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchVelocitySensing);} - class WidgetPDial - } - Fl_Group ampenv { - label {PADSynth - Amplitude Envelope} open - xywh {10 95 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->AmpEnvelope);} - class EnvelopeUI - } {} - Fl_Group amplfo { - label {Amplitude LFO } open - xywh {10 165 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->AmpLfo);} - class LFOUI - } {} - Fl_Check_Button stereo { - label Stereo - callback {pars->PStereo=(int) o->value(); -hprofile->redraw();} - xywh {15 245 70 25} down_box DOWN_BOX - code0 {o->value(pars->PStereo);} - } - } - Fl_Group {} { - label FILTER - xywh {245 25 285 250} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group filterenv { - label {PADSynth - Filter Envelope} open - xywh {250 130 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->FilterEnvelope);} - class EnvelopeUI - } {} - Fl_Group filterlfo { - label {Filter LFO } open - xywh {250 200 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->FilterLfo);} - class LFOUI - } {} - Fl_Group filterui { - label {PADsynth - Filter} open - xywh {250 55 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->GlobalFilter,&pars->PFilterVelocityScale,&pars->PFilterVelocityScaleFunction);} - class FilterUI - } {} - } - } - } - Fl_Button applybutton { - label {Apply Changes} - callback {pars->applyparameters(true); -o->color(FL_GRAY); -if (oscui!=NULL) { - oscui->applybutton->color(FL_GRAY); - oscui->applybutton->redraw(); -}; -if (resui!=NULL) { - resui->applybutton->color(FL_GRAY); - resui->applybutton->redraw(); -};} - xywh {45 405 185 40} box THIN_UP_BOX labelfont 1 labelsize 16 - code0 {o->color(FL_RED);} - } - Fl_Button {} { - label Close - callback {padnotewindow->hide();} - xywh {320 405 175 40} box THIN_UP_BOX labelsize 17 - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {240 430 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {270 430 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label export - callback {char *filename; -filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0); -if (filename==NULL) return; -fl_filename_setext(filename,""); - - - -pars->export2wav(filename);} selected - tooltip {export samples as wav file} xywh {240 405 55 15} box THIN_UP_BOX color 255 labelsize 11 align 128 - } - } - } - Function {refresh()} {} { - code {volume->value(pars->PVolume); -vsns->value(pars->PAmpVelocityScaleFunction); -pan->value(pars->PPanning); - -stereo->value(pars->PStereo); - - -pstr->value(pars->PPunchStrength); -pt->value(pars->PPunchTime); -pstc->value(pars->PPunchStretch); -pvel->value(pars->PPunchVelocitySensing); - -detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); -detune->value(pars->PDetune-8192); - -int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; -octave->value(k); - -detunetype->value(pars->PDetuneType-1); -k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; -coarsedet->value(k); - -hz440->value(pars->Pfixedfreq); -fixedfreqetdial->value(pars->PfixedfreqET); - -amplfo->refresh(); -freqlfo->refresh(); -filterlfo->refresh(); - -ampenv->refresh(); -freqenv->refresh(); -filterenv->refresh(); -filterui->refresh(); - - -/* harmonic structure parametrs */ - -resui->refresh(); -if (oscui!=NULL) oscui->refresh(); - -hpbasetype->value(pars->Php.base.type); -hpbasepar1->value(pars->Php.base.par1); -hpfreqmult->value(pars->Php.freqmult); - -hpmpar1->value(pars->Php.modulator.par1); -hpmfreq->value(pars->Php.modulator.freq); -hpwidth->value(pars->Php.width); - -hponehalf->value(pars->Php.onehalf); -hpamptype->value(pars->Php.amp.type); -hpampmode->value(pars->Php.amp.mode); -hpamppar1->value(pars->Php.amp.par1); -hpamppar2->value(pars->Php.amp.par2); -hpautoscale->value(pars->Php.autoscale); - -bwdial->value(pars->Pbandwidth); -if (pars->Pmode==0){ - bwprofilegroup->activate(); - bwdial->activate(); - bwcents->activate(); - hprofile->activate(); - hprofile->color(54); - bwscale->activate(); -} else { - bwprofilegroup->deactivate(); - bwdial->deactivate(); - bwcents->deactivate(); - hprofile->deactivate(); - hprofile->color(48); - bwscale->activate(); -}; - -spectrummode->value(pars->Pmode); - -qbasenote->value(pars->Pquality.basenote); -qsmpoct->value(pars->Pquality.smpoct); -qoct->value(pars->Pquality.oct); -qsamplesize->value(pars->Pquality.samplesize); - -hrpostype->value(pars->Phrpos.type); -hrpospar1->value(pars->Phrpos.par1); -hrpospar2->value(pars->Phrpos.par2); -hrpospar3->value(pars->Phrpos.par3); - -hprofile->redraw(); -overtonepos->redraw(); - -osc->redraw(); -pars->applyparameters(true); -applybutton->color(FL_GRAY); -applybutton->parent()->redraw();} {} - } - Function {~PADnoteUI()} {} { - code {delete(oscui); -delete(resui); - -padnotewindow->hide(); -delete(padnotewindow);} {} - } - decl {PADnoteParameters *pars;} {public - } - decl {Master *master;} {public - } - decl {OscilEditor *oscui;} {public - } - decl {Oscilloscope *osc;} {public - } - decl {ResonanceUI *resui;} {public - } -} diff --git a/plugins/zynaddsubfx/src/UI/PADnoteUI.h b/plugins/zynaddsubfx/src/UI/PADnoteUI.h deleted file mode 100644 index e21f494de..000000000 --- a/plugins/zynaddsubfx/src/UI/PADnoteUI.h +++ /dev/null @@ -1,305 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef PADnoteUI_h -#define PADnoteUI_h -#include -#include "../Params/PADnoteParameters.h" -#include "../Misc/Util.h" -#include "../Misc/Master.h" -#include "ResonanceUI.h" -#include -#include -#include -#include "WidgetPDial.h" -#include "EnvelopeUI.h" -#include "LFOUI.h" -#include "FilterUI.h" -#include "OscilGenUI.h" -#include "PresetsUI.h" - -class PADnoteHarmonicProfile : public Fl_Box { -public: - PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0); - void init(PADnoteParameters *pars,Master *master_); - void draw(); -private: - Master *master; -public: - PADnoteParameters *pars; -}; - -class PADnoteOvertonePosition : public Fl_Box { -public: - PADnoteOvertonePosition(int x,int y, int w, int h, const char *label=0); - void init(PADnoteParameters *pars,Master *master_); - void draw(); -private: - Master *master; -public: - PADnoteParameters *pars; -}; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class PADnoteUI : public PresetsUI_ { -public: - PADnoteUI(PADnoteParameters *parameters,Master *master_); - Fl_Double_Window* make_window(); - Fl_Double_Window *padnotewindow; -private: - void cb__i(Fl_Tabs*, void*); - static void cb_(Fl_Tabs*, void*); -public: - Fl_Group *harmonicstructuregroup; - Fl_Group *bwprofilegroup; - WidgetPDial *hpbasepar1; -private: - void cb_hpbasepar1_i(WidgetPDial*, void*); - static void cb_hpbasepar1(WidgetPDial*, void*); -public: - Fl_Choice *hpbasetype; -private: - void cb_hpbasetype_i(Fl_Choice*, void*); - static void cb_hpbasetype(Fl_Choice*, void*); - static Fl_Menu_Item menu_hpbasetype[]; -public: - WidgetPDial *hpfreqmult; -private: - void cb_hpfreqmult_i(WidgetPDial*, void*); - static void cb_hpfreqmult(WidgetPDial*, void*); -public: - WidgetPDial *hpmpar1; -private: - void cb_hpmpar1_i(WidgetPDial*, void*); - static void cb_hpmpar1(WidgetPDial*, void*); -public: - WidgetPDial *hpmfreq; -private: - void cb_hpmfreq_i(WidgetPDial*, void*); - static void cb_hpmfreq(WidgetPDial*, void*); -public: - Fl_Choice *hpamptype; -private: - void cb_hpamptype_i(Fl_Choice*, void*); - static void cb_hpamptype(Fl_Choice*, void*); - static Fl_Menu_Item menu_hpamptype[]; -public: - Fl_Choice *hpampmode; -private: - void cb_hpampmode_i(Fl_Choice*, void*); - static void cb_hpampmode(Fl_Choice*, void*); - static Fl_Menu_Item menu_hpampmode[]; -public: - WidgetPDial *hpamppar1; -private: - void cb_hpamppar1_i(WidgetPDial*, void*); - static void cb_hpamppar1(WidgetPDial*, void*); -public: - WidgetPDial *hpamppar2; -private: - void cb_hpamppar2_i(WidgetPDial*, void*); - static void cb_hpamppar2(WidgetPDial*, void*); -public: - Fl_Check_Button *hpautoscale; -private: - void cb_hpautoscale_i(Fl_Check_Button*, void*); - static void cb_hpautoscale(Fl_Check_Button*, void*); -public: - Fl_Choice *hponehalf; -private: - void cb_hponehalf_i(Fl_Choice*, void*); - static void cb_hponehalf(Fl_Choice*, void*); - static Fl_Menu_Item menu_hponehalf[]; -public: - WidgetPDial *hpwidth; -private: - void cb_hpwidth_i(WidgetPDial*, void*); - static void cb_hpwidth(WidgetPDial*, void*); - void cb_Change_i(Fl_Button*, void*); - static void cb_Change(Fl_Button*, void*); -public: - Fl_Box *cbwidget; -private: - void cb_cbwidget_i(Fl_Box*, void*); - static void cb_cbwidget(Fl_Box*, void*); - void cb_Resonance_i(Fl_Button*, void*); - static void cb_Resonance(Fl_Button*, void*); -public: - WidgetPDial *bwdial; -private: - void cb_bwdial_i(WidgetPDial*, void*); - static void cb_bwdial(WidgetPDial*, void*); -public: - Fl_Value_Output *bwcents; - Fl_Choice *hrpostype; -private: - void cb_hrpostype_i(Fl_Choice*, void*); - static void cb_hrpostype(Fl_Choice*, void*); - static Fl_Menu_Item menu_hrpostype[]; -public: - WidgetPDial *hrpospar1; -private: - void cb_hrpospar1_i(WidgetPDial*, void*); - static void cb_hrpospar1(WidgetPDial*, void*); -public: - WidgetPDial *hrpospar2; -private: - void cb_hrpospar2_i(WidgetPDial*, void*); - static void cb_hrpospar2(WidgetPDial*, void*); -public: - WidgetPDial *hrpospar3; -private: - void cb_hrpospar3_i(WidgetPDial*, void*); - static void cb_hrpospar3(WidgetPDial*, void*); -public: - Fl_Choice *bwscale; -private: - void cb_bwscale_i(Fl_Choice*, void*); - static void cb_bwscale(Fl_Choice*, void*); - static Fl_Menu_Item menu_bwscale[]; -public: - Fl_Group *overtonepos; - Fl_Choice *qsamplesize; -private: - void cb_qsamplesize_i(Fl_Choice*, void*); - static void cb_qsamplesize(Fl_Choice*, void*); - static Fl_Menu_Item menu_qsamplesize[]; -public: - Fl_Choice *qsmpoct; -private: - void cb_qsmpoct_i(Fl_Choice*, void*); - static void cb_qsmpoct(Fl_Choice*, void*); - static Fl_Menu_Item menu_qsmpoct[]; -public: - Fl_Choice *qoct; -private: - void cb_qoct_i(Fl_Choice*, void*); - static void cb_qoct(Fl_Choice*, void*); - static Fl_Menu_Item menu_qoct[]; -public: - Fl_Choice *qbasenote; -private: - void cb_qbasenote_i(Fl_Choice*, void*); - static void cb_qbasenote(Fl_Choice*, void*); - static Fl_Menu_Item menu_qbasenote[]; -public: - Fl_Group *hprofile; - Fl_Choice *spectrummode; -private: - void cb_spectrummode_i(Fl_Choice*, void*); - static void cb_spectrummode(Fl_Choice*, void*); - static Fl_Menu_Item menu_spectrummode[]; -public: - EnvelopeUI *freqenv; - Fl_Counter *octave; -private: - void cb_octave_i(Fl_Counter*, void*); - static void cb_octave(Fl_Counter*, void*); -public: - Fl_Counter *coarsedet; -private: - void cb_coarsedet_i(Fl_Counter*, void*); - static void cb_coarsedet(Fl_Counter*, void*); -public: - LFOUI *freqlfo; - Fl_Slider *detune; -private: - void cb_detune_i(Fl_Slider*, void*); - static void cb_detune(Fl_Slider*, void*); -public: - Fl_Value_Output *detunevalueoutput; -private: - void cb_detunevalueoutput_i(Fl_Value_Output*, void*); - static void cb_detunevalueoutput(Fl_Value_Output*, void*); -public: - Fl_Choice *detunetype; -private: - void cb_detunetype_i(Fl_Choice*, void*); - static void cb_detunetype(Fl_Choice*, void*); -public: - Fl_Check_Button *hz440; -private: - void cb_hz440_i(Fl_Check_Button*, void*); - static void cb_hz440(Fl_Check_Button*, void*); -public: - WidgetPDial *fixedfreqetdial; -private: - void cb_fixedfreqetdial_i(WidgetPDial*, void*); - static void cb_fixedfreqetdial(WidgetPDial*, void*); -public: - Fl_Value_Slider *volume; -private: - void cb_volume_i(Fl_Value_Slider*, void*); - static void cb_volume(Fl_Value_Slider*, void*); -public: - Fl_Value_Slider *vsns; -private: - void cb_vsns_i(Fl_Value_Slider*, void*); - static void cb_vsns(Fl_Value_Slider*, void*); -public: - WidgetPDial *pan; -private: - void cb_pan_i(WidgetPDial*, void*); - static void cb_pan(WidgetPDial*, void*); -public: - WidgetPDial *pstr; -private: - void cb_pstr_i(WidgetPDial*, void*); - static void cb_pstr(WidgetPDial*, void*); -public: - WidgetPDial *pt; -private: - void cb_pt_i(WidgetPDial*, void*); - static void cb_pt(WidgetPDial*, void*); -public: - WidgetPDial *pstc; -private: - void cb_pstc_i(WidgetPDial*, void*); - static void cb_pstc(WidgetPDial*, void*); -public: - WidgetPDial *pvel; -private: - void cb_pvel_i(WidgetPDial*, void*); - static void cb_pvel(WidgetPDial*, void*); -public: - EnvelopeUI *ampenv; - LFOUI *amplfo; - Fl_Check_Button *stereo; -private: - void cb_stereo_i(Fl_Check_Button*, void*); - static void cb_stereo(Fl_Check_Button*, void*); -public: - EnvelopeUI *filterenv; - LFOUI *filterlfo; - FilterUI *filterui; - Fl_Button *applybutton; -private: - void cb_applybutton_i(Fl_Button*, void*); - static void cb_applybutton(Fl_Button*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); - void cb_export_i(Fl_Button*, void*); - static void cb_export(Fl_Button*, void*); -public: - void refresh(); - ~PADnoteUI(); - PADnoteParameters *pars; - Master *master; - OscilEditor *oscui; - Oscilloscope *osc; - ResonanceUI *resui; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/PartUI.cc b/plugins/zynaddsubfx/src/UI/PartUI.cc deleted file mode 100644 index 37e11f8b3..000000000 --- a/plugins/zynaddsubfx/src/UI/PartUI.cc +++ /dev/null @@ -1,1880 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "PartUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void PartSysEffSend::cb_01_i(WidgetPDial* o, void*) { - master->setPsysefxvol(npart,neff,(int) o->value()); -} -void PartSysEffSend::cb_01(WidgetPDial* o, void* v) { - ((PartSysEffSend*)(o->parent()->user_data()))->cb_01_i(o,v); -} - -Fl_Group* PartSysEffSend::make_window() { - { syseffsend = new Fl_Group(0, 0, 90, 35); - syseffsend->box(FL_FLAT_BOX); - syseffsend->color(FL_BACKGROUND_COLOR); - syseffsend->selection_color(FL_BACKGROUND_COLOR); - syseffsend->labeltype(FL_NO_LABEL); - syseffsend->labelfont(0); - syseffsend->labelsize(14); - syseffsend->labelcolor(FL_FOREGROUND_COLOR); - syseffsend->user_data((void*)(this)); - syseffsend->align(Fl_Align(FL_ALIGN_TOP)); - syseffsend->when(FL_WHEN_RELEASE); - { WidgetPDial* o = new WidgetPDial(0, 0, 25, 25, "01"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(1); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_01); - o->align(Fl_Align(130)); - o->when(FL_WHEN_CHANGED); - o->size(25,25); - o->value(master->Psysefxvol[neff][npart]); - char tmp[10];snprintf(tmp,10,"%d",neff+1);o->copy_label(tmp); - } // WidgetPDial* o - syseffsend->end(); - } // Fl_Group* syseffsend - return syseffsend; -} - -PartSysEffSend::PartSysEffSend(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - master=NULL; - neff=0; - npart=0; -} - -void PartSysEffSend::init(Master *master_,int npart_,int neff_) { - npart=npart_; - neff=neff_; - master=master_; - make_window(); - syseffsend->show(); - end(); -} - -PartSysEffSend::~PartSysEffSend() { - syseffsend->hide(); - //delete(syseffsend); -} - -void PartUI_::showparameters(int kititem,int engine) { -} - -void PartKitItem::cb_minkcounter_i(Fl_Counter* o, void*) { - part->kit[n].Pminkey=(int)o->value(); -} -void PartKitItem::cb_minkcounter(Fl_Counter* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_minkcounter_i(o,v); -} - -void PartKitItem::cb_m_i(Fl_Button*, void*) { - if (part->lastnote>=0) minkcounter->value(part->lastnote); -minkcounter->do_callback(); -maxkcounter->do_callback(); -} -void PartKitItem::cb_m(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_m_i(o,v); -} - -void PartKitItem::cb_M_i(Fl_Button*, void*) { - if (part->lastnote>=0) maxkcounter->value(part->lastnote); -maxkcounter->do_callback(); -minkcounter->do_callback(); -} -void PartKitItem::cb_M(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_M_i(o,v); -} - -void PartKitItem::cb_R_i(Fl_Button*, void*) { - minkcounter->value(0); -minkcounter->do_callback(); -maxkcounter->value(127); -maxkcounter->do_callback(); -} -void PartKitItem::cb_R(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_R_i(o,v); -} - -void PartKitItem::cb_adeditbutton_i(Fl_Button*, void*) { - partui->showparameters(n,0); -} -void PartKitItem::cb_adeditbutton(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_adeditbutton_i(o,v); -} - -void PartKitItem::cb_subeditbutton_i(Fl_Button*, void*) { - partui->showparameters(n,1); -} -void PartKitItem::cb_subeditbutton(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_subeditbutton_i(o,v); -} - -void PartKitItem::cb_mutedcheck_i(Fl_Check_Button* o, void*) { - part->kit[n].Pmuted=(int)o->value(); -} -void PartKitItem::cb_mutedcheck(Fl_Check_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_mutedcheck_i(o,v); -} - -void PartKitItem::cb_maxkcounter_i(Fl_Counter* o, void*) { - part->kit[n].Pmaxkey=(int)o->value(); -} -void PartKitItem::cb_maxkcounter(Fl_Counter* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_maxkcounter_i(o,v); -} - -void PartKitItem::cb_labelbutton_i(Fl_Button*, void*) { - const char *tmp=fl_input("Kit item name:",(const char *)part->kit[n].Pname); -if (tmp!=NULL) snprintf((char *)part->kit[n].Pname,PART_MAX_NAME_LEN,"%s",tmp); -} -void PartKitItem::cb_labelbutton(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_labelbutton_i(o,v); -} - -void PartKitItem::cb_adcheck_i(Fl_Check_Button* o, void*) { - part->kit[n].Padenabled=(int)o->value(); -if (part->kit[n].Padenabled!=0) adeditbutton->activate(); - else adeditbutton->deactivate(); -} -void PartKitItem::cb_adcheck(Fl_Check_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_adcheck_i(o,v); -} - -void PartKitItem::cb_subcheck_i(Fl_Check_Button* o, void*) { - part->kit[n].Psubenabled=(int)o->value(); -if (part->kit[n].Psubenabled!=0) subeditbutton->activate(); - else subeditbutton->deactivate(); -} -void PartKitItem::cb_subcheck(Fl_Check_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_subcheck_i(o,v); -} - -void PartKitItem::cb_sendtoeffect_i(Fl_Choice* o, void*) { - if (o->value()!=0) part->kit[n].Psendtoparteffect=(int)o->value()-1; - else part->kit[n].Psendtoparteffect=127; -} -void PartKitItem::cb_sendtoeffect(Fl_Choice* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_sendtoeffect_i(o,v); -} - -void PartKitItem::cb_padeditbutton_i(Fl_Button*, void*) { - partui->showparameters(n,2); -} -void PartKitItem::cb_padeditbutton(Fl_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_padeditbutton_i(o,v); -} - -void PartKitItem::cb_padcheck_i(Fl_Check_Button* o, void*) { - part->kit[n].Ppadenabled=(int)o->value(); -if (part->kit[n].Ppadenabled!=0) padeditbutton->activate(); - else padeditbutton->deactivate(); -} -void PartKitItem::cb_padcheck(Fl_Check_Button* o, void* v) { - ((PartKitItem*)(o->parent()->parent()->user_data()))->cb_padcheck_i(o,v); -} - -void PartKitItem::cb_enabledcheck_i(Fl_Check_Button* o, void*) { - int answer=1; -if (o->value()==0) answer=fl_choice("Delete the item?","No","Yes",NULL); -if (answer!=0){ -pthread_mutex_lock(&master->mutex); - part->setkititemstatus(n,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if (o->value()==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); -o->redraw(); -partui->showparameters(n,-1);//use to delete the ui, if it is not to item 0 -} else o->value(1); -} -void PartKitItem::cb_enabledcheck(Fl_Check_Button* o, void* v) { - ((PartKitItem*)(o->parent()->user_data()))->cb_enabledcheck_i(o,v); -} - -Fl_Group* PartKitItem::make_window() { - { partkititem = new Fl_Group(0, 0, 670, 30); - partkititem->box(FL_FLAT_BOX); - partkititem->color(FL_BACKGROUND_COLOR); - partkititem->selection_color(FL_BACKGROUND_COLOR); - partkititem->labeltype(FL_NO_LABEL); - partkititem->labelfont(0); - partkititem->labelsize(14); - partkititem->labelcolor(FL_FOREGROUND_COLOR); - partkititem->user_data((void*)(this)); - partkititem->align(Fl_Align(FL_ALIGN_TOP)); - partkititem->when(FL_WHEN_RELEASE); - { Fl_Group* o = partkititemgroup = new Fl_Group(55, 0, 605, 20); - partkititemgroup->box(FL_FLAT_BOX); - { Fl_Counter* o = minkcounter = new Fl_Counter(225, 0, 55, 15); - minkcounter->type(1); - minkcounter->minimum(0); - minkcounter->maximum(128); - minkcounter->step(1); - minkcounter->callback((Fl_Callback*)cb_minkcounter); - o->value(part->kit[n].Pminkey); - } // Fl_Counter* minkcounter - { Fl_Button* o = new Fl_Button(285, 3, 15, 12, "m"); - o->tooltip("set the minimum key to the last pressed key"); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_m); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(315, 3, 15, 12, "M"); - o->tooltip("set the maximum key to the last pressed key"); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_M); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(300, 3, 15, 12, "R"); - o->tooltip("reset the minimum key to 0 and maximum key to 127"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_R); - } // Fl_Button* o - { Fl_Button* o = adeditbutton = new Fl_Button(420, 0, 40, 15, "edit"); - adeditbutton->box(FL_THIN_UP_BOX); - adeditbutton->labelsize(11); - adeditbutton->callback((Fl_Callback*)cb_adeditbutton); - if (part->kit[n].Padenabled==0) o->deactivate(); - if (n==0) o->hide(); - } // Fl_Button* adeditbutton - { Fl_Button* o = subeditbutton = new Fl_Button(490, 0, 40, 15, "edit"); - subeditbutton->box(FL_THIN_UP_BOX); - subeditbutton->labelsize(11); - subeditbutton->callback((Fl_Callback*)cb_subeditbutton); - if (part->kit[n].Psubenabled==0) o->deactivate(); - if (n==0) o->hide(); - } // Fl_Button* subeditbutton - { Fl_Check_Button* o = mutedcheck = new Fl_Check_Button(60, 0, 20, 15); - mutedcheck->down_box(FL_DOWN_BOX); - mutedcheck->labelfont(1); - mutedcheck->labelsize(11); - mutedcheck->callback((Fl_Callback*)cb_mutedcheck); - mutedcheck->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(part->kit[n].Pmuted); - } // Fl_Check_Button* mutedcheck - { Fl_Counter* o = maxkcounter = new Fl_Counter(335, 0, 55, 15); - maxkcounter->type(1); - maxkcounter->minimum(0); - maxkcounter->maximum(128); - maxkcounter->step(1); - maxkcounter->callback((Fl_Callback*)cb_maxkcounter); - o->value(part->kit[n].Pmaxkey); - } // Fl_Counter* maxkcounter - { Fl_Button* o = labelbutton = new Fl_Button(90, 0, 130, 15, "Bass Drum"); - labelbutton->box(FL_THIN_DOWN_BOX); - labelbutton->down_box(FL_FLAT_BOX); - labelbutton->labelfont(1); - labelbutton->labelsize(10); - labelbutton->callback((Fl_Callback*)cb_labelbutton); - labelbutton->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - o->label((char *)part->kit[n].Pname); - } // Fl_Button* labelbutton - { Fl_Check_Button* o = adcheck = new Fl_Check_Button(400, 0, 20, 15); - adcheck->down_box(FL_DOWN_BOX); - adcheck->labelfont(1); - adcheck->labelsize(11); - adcheck->callback((Fl_Callback*)cb_adcheck); - adcheck->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(part->kit[n].Padenabled); - if (n==0) o->hide(); - } // Fl_Check_Button* adcheck - { Fl_Check_Button* o = subcheck = new Fl_Check_Button(470, 0, 20, 15); - subcheck->down_box(FL_DOWN_BOX); - subcheck->labelfont(1); - subcheck->labelsize(11); - subcheck->callback((Fl_Callback*)cb_subcheck); - subcheck->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(part->kit[n].Psubenabled); - if (n==0) o->hide(); - } // Fl_Check_Button* subcheck - { Fl_Choice* o = sendtoeffect = new Fl_Choice(615, 0, 45, 15); - sendtoeffect->down_box(FL_BORDER_BOX); - sendtoeffect->labelsize(10); - sendtoeffect->textfont(1); - sendtoeffect->textsize(10); - sendtoeffect->callback((Fl_Callback*)cb_sendtoeffect); - sendtoeffect->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("OFF");char nrstr[10]; for(int i=0;iadd(nrstr);}; - o->value(part->kit[n].Psendtoparteffect+1);if (part->kit[n].Psendtoparteffect==127) o->value(0); - } // Fl_Choice* sendtoeffect - { Fl_Button* o = padeditbutton = new Fl_Button(560, 0, 40, 15, "edit"); - padeditbutton->box(FL_THIN_UP_BOX); - padeditbutton->labelsize(11); - padeditbutton->callback((Fl_Callback*)cb_padeditbutton); - if (part->kit[n].Ppadenabled==0) o->deactivate(); - if (n==0) o->hide(); - } // Fl_Button* padeditbutton - { Fl_Check_Button* o = padcheck = new Fl_Check_Button(540, 0, 20, 15); - padcheck->down_box(FL_DOWN_BOX); - padcheck->labelfont(1); - padcheck->labelsize(11); - padcheck->callback((Fl_Callback*)cb_padcheck); - padcheck->align(Fl_Align(FL_ALIGN_LEFT)); - o->value(part->kit[n].Ppadenabled); - if (n==0) o->hide(); - } // Fl_Check_Button* padcheck - if (part->kit[n].Penabled==0) o->deactivate(); - partkititemgroup->end(); - } // Fl_Group* partkititemgroup - { Fl_Check_Button* o = enabledcheck = new Fl_Check_Button(30, 0, 20, 15, "01"); - enabledcheck->down_box(FL_DOWN_BOX); - enabledcheck->labeltype(FL_EMBOSSED_LABEL); - enabledcheck->labelfont(1); - enabledcheck->labelsize(13); - enabledcheck->callback((Fl_Callback*)cb_enabledcheck); - enabledcheck->align(Fl_Align(FL_ALIGN_LEFT)); - snprintf(label,10,"%d",n+1);o->label(label); - o->value(part->kit[n].Penabled); - if (n==0) o->deactivate(); - } // Fl_Check_Button* enabledcheck - partkititem->end(); - } // Fl_Group* partkititem - return partkititem; -} - -PartKitItem::PartKitItem(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - n=0; - part=NULL; -} - -void PartKitItem::refresh() { - enabledcheck->value(part->kit[n].Penabled); - if (part->kit[n].Penabled==0) partkititemgroup->deactivate(); - else partkititemgroup->activate(); - - mutedcheck->value(part->kit[n].Pmuted); - labelbutton->label((char *)part->kit[n].Pname); - minkcounter->value(part->kit[n].Pminkey); - maxkcounter->value(part->kit[n].Pmaxkey); - adcheck->value(part->kit[n].Padenabled); - adcheck->do_callback(); - subcheck->value(part->kit[n].Psubenabled); - subcheck->do_callback(); - - sendtoeffect->value(part->kit[n].Psendtoparteffect+1); - if (part->kit[n].Psendtoparteffect==127) sendtoeffect->value(0); - - this->redraw(); -} - -void PartKitItem::init(Part *part_,int n_,Master *master_,PartUI_ *partui_) { - part=part_; - n=n_; - partui=partui_; - master=master_; - make_window(); - //partkititem->show(); - end(); -} - -PartKitItem::~PartKitItem() { - partkititem->hide(); - //delete(partkititem); -} - -void PartUI::cb_Pan_i(WidgetPDial* o, void*) { - part->setPpanning((int) o->value()); -} -void PartUI::cb_Pan(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Pan_i(o,v); -} - -void PartUI::cb_KeyShift_i(Fl_Counter* o, void*) { - part->Pkeyshift=(int) o->value()+64; -} -void PartUI::cb_KeyShift(Fl_Counter* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_KeyShift_i(o,v); -} - -void PartUI::cb_Grand_i(Fl_Button*, void*) { - int event=Fl::event_button(); -if (event==FL_RIGHT_MOUSE){ - const char *tmp=fl_input("Instrument name:",(const char *)part->Pname); - if (tmp!=NULL) snprintf((char *)part->Pname,PART_MAX_NAME_LEN,"%s",tmp); -} else { - if (event==FL_LEFT_MOUSE) bankui->show(); - else instrumenteditwindow->show(); -}; -} -void PartUI::cb_Grand(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Grand_i(o,v); -} - -void PartUI::cb_NoteOn_i(Fl_Check_Button* o, void*) { - part->Pnoteon=(int) o->value(); -} -void PartUI::cb_NoteOn(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_NoteOn_i(o,v); -} - -void PartUI::cb_minkcounter1_i(Fl_Counter* o, void*) { - part->Pminkey=(int) o->value(); -if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); -} -void PartUI::cb_minkcounter1(Fl_Counter* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_minkcounter1_i(o,v); -} - -void PartUI::cb_maxkcounter1_i(Fl_Counter* o, void*) { - part->Pmaxkey=(int) o->value(); - -if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); -} -void PartUI::cb_maxkcounter1(Fl_Counter* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_maxkcounter1_i(o,v); -} - -void PartUI::cb_Volume_i(WidgetPDial* o, void*) { - part->setPvolume((int) o->value()); -} -void PartUI::cb_Volume(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Volume_i(o,v); -} - -void PartUI::cb_Vel_i(WidgetPDial* o, void*) { - part->Pveloffs=(int) o->value(); -} -void PartUI::cb_Vel(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Vel_i(o,v); -} - -void PartUI::cb_Vel1_i(WidgetPDial* o, void*) { - part->Pvelsns=(int) o->value(); -} -void PartUI::cb_Vel1(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Vel1_i(o,v); -} - -void PartUI::cb_Controllers_i(Fl_Button*, void*) { - ctlwindow->show(); -} -void PartUI::cb_Controllers(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Controllers_i(o,v); -} - -void PartUI::cb_Portamento_i(Fl_Check_Button* o, void*) { - part->ctl.portamento.portamento=(int) o->value(); -} -void PartUI::cb_Portamento(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Portamento_i(o,v); -} - -void PartUI::cb_Edit_i(Fl_Button*, void*) { - instrumenteditwindow->show(); -} -void PartUI::cb_Edit(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Edit_i(o,v); -} - -void PartUI::cb_m1_i(Fl_Button*, void*) { - if (part->lastnote>=0) minkcounter->value(part->lastnote); -minkcounter->do_callback(); -maxkcounter->do_callback(); -} -void PartUI::cb_m1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_m1_i(o,v); -} - -void PartUI::cb_M1_i(Fl_Button*, void*) { - if (part->lastnote>=0) maxkcounter->value(part->lastnote); -maxkcounter->do_callback(); -minkcounter->do_callback(); -} -void PartUI::cb_M1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_M1_i(o,v); -} - -void PartUI::cb_R1_i(Fl_Button*, void*) { - minkcounter->value(0); -minkcounter->do_callback(); -maxkcounter->value(127); -maxkcounter->do_callback(); -} -void PartUI::cb_R1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_R1_i(o,v); -} - -void PartUI::cb_MIDI_i(Fl_Choice* o, void*) { - part->Prcvchn=(int) o->value(); -} -void PartUI::cb_MIDI(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_MIDI_i(o,v); -} - -void PartUI::cb_keylimitlist_i(Fl_Choice* o, void*) { - int val=0; -val=atoi(o->text()); -part->setkeylimit(val); -} -void PartUI::cb_keylimitlist(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_keylimitlist_i(o,v); -} - -void PartUI::cb_Mode_i(Fl_Choice* o, void*) { - if ((int) o->value()==0){ /* Poly (implies no legato) */ - part->Ppolymode=1; - part->Plegatomode=0; -} else { - if ((int) o->value()==1){ /* Mono (implies no legato) */ - part->Ppolymode=0; - part->Plegatomode=0; - } else { - if ((int) o->value()==2){ /* Legato (implies mono) */ - part->Ppolymode=0; - part->Plegatomode=1; - }; - }; -}; -} -void PartUI::cb_Mode(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Mode_i(o,v); -} - -void PartUI::cb_Enabled_i(Fl_Check_Button* o, void*) { - pthread_mutex_lock(&master->mutex); -master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); -if (part->Penabled==0) partgroupui->deactivate(); - else partgroupui->activate(); -} -void PartUI::cb_Enabled(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Enabled_i(o,v); -} - -void PartUI::cb_Expr_i(Fl_Check_Button* o, void*) { - part->ctl.expression.receive=(int) o->value(); -} -void PartUI::cb_Expr(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Expr_i(o,v); -} - -void PartUI::cb_PanDpth_i(WidgetPDial* o, void*) { - part->ctl.panning.depth=(int) o->value(); -} -void PartUI::cb_PanDpth(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_PanDpth_i(o,v); -} - -void PartUI::cb_FltCut_i(WidgetPDial* o, void*) { - part->ctl.filtercutoff.depth=(int) o->value(); -} -void PartUI::cb_FltCut(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_FltCut_i(o,v); -} - -void PartUI::cb_FltQ_i(WidgetPDial* o, void*) { - part->ctl.filterq.depth=(int) o->value(); -} -void PartUI::cb_FltQ(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_FltQ_i(o,v); -} - -void PartUI::cb_BwDpth_i(WidgetPDial* o, void*) { - part->ctl.bandwidth.depth=(int) o->value(); -} -void PartUI::cb_BwDpth(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_BwDpth_i(o,v); -} - -void PartUI::cb_ModWh_i(WidgetPDial* o, void*) { - part->ctl.modwheel.depth=(int) o->value(); -} -void PartUI::cb_ModWh(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_ModWh_i(o,v); -} - -void PartUI::cb_PWheelB_i(Fl_Counter* o, void*) { - part->ctl.pitchwheel.bendrange=(int) o->value(); -} -void PartUI::cb_PWheelB(Fl_Counter* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_PWheelB_i(o,v); -} - -void PartUI::cb_FMamp_i(Fl_Check_Button* o, void*) { - part->ctl.fmamp.receive=(int) o->value(); -} -void PartUI::cb_FMamp(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_FMamp_i(o,v); -} - -void PartUI::cb_Vol_i(Fl_Check_Button* o, void*) { - part->ctl.volume.receive=(int) o->value(); -} -void PartUI::cb_Vol(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Vol_i(o,v); -} - -void PartUI::cb_Sustain_i(Fl_Check_Button* o, void*) { - part->ctl.sustain.receive=(int) o->value(); -if (part->ctl.sustain.receive==0) { - part->RelaseSustainedKeys(); - part->ctl.setsustain(0); -}; -} -void PartUI::cb_Sustain(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Sustain_i(o,v); -} - -void PartUI::cb_Close_i(Fl_Button*, void*) { - ctlwindow->hide(); -} -void PartUI::cb_Close(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void PartUI::cb_Reset_i(Fl_Button*, void*) { - part->SetController(C_resetallcontrollers,0); -} -void PartUI::cb_Reset(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Reset_i(o,v); -} - -void PartUI::cb_Rcv_i(Fl_Check_Button* o, void*) { - part->ctl.portamento.receive=(int) o->value(); -} -void PartUI::cb_Rcv(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Rcv_i(o,v); -} - -void PartUI::cb_time_i(WidgetPDial* o, void*) { - part->ctl.portamento.time=(int) o->value(); -} -void PartUI::cb_time(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_time_i(o,v); -} - -void PartUI::cb_thresh_i(Fl_Counter* o, void*) { - part->ctl.portamento.pitchthresh=(int) o->value(); -} -void PartUI::cb_thresh(Fl_Counter* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_thresh_i(o,v); -} - -void PartUI::cb_th_i(Fl_Check_Button* o, void*) { - part->ctl.portamento.pitchthreshtype=(int) o->value(); -} -void PartUI::cb_th(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_th_i(o,v); -} - -void PartUI::cb_t_i(WidgetPDial* o, void*) { - int x=(int) o->value(); - -part->ctl.portamento.updowntimestretch=x; -} -void PartUI::cb_t(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_t_i(o,v); -} - -void PartUI::cb_propta_i(WidgetPDial* o, void*) { - part->ctl.portamento.propRate=(int) o->value(); -} -void PartUI::cb_propta(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_propta_i(o,v); -} - -void PartUI::cb_proptb_i(WidgetPDial* o, void*) { - part->ctl.portamento.propDepth=(int) o->value(); -} -void PartUI::cb_proptb(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_proptb_i(o,v); -} - -void PartUI::cb_Proprt_i(Fl_Check_Button* o, void*) { - part->ctl.portamento.proportional=(int) o->value(); -if(o->value()){propta->activate();proptb->activate();} -else {propta->deactivate();proptb->deactivate();}; -} -void PartUI::cb_Proprt(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Proprt_i(o,v); -} - -void PartUI::cb_BWdpth_i(WidgetPDial* o, void*) { - part->ctl.resonancebandwidth.depth=(int) o->value(); -} -void PartUI::cb_BWdpth(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_BWdpth_i(o,v); -} - -void PartUI::cb_CFdpth_i(WidgetPDial* o, void*) { - part->ctl.resonancecenter.depth=(int) o->value(); -} -void PartUI::cb_CFdpth(WidgetPDial* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_CFdpth_i(o,v); -} - -void PartUI::cb_Exp_i(Fl_Check_Button* o, void*) { - part->ctl.modwheel.exponential=(int) o->value(); -} -void PartUI::cb_Exp(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Exp_i(o,v); -} - -void PartUI::cb_Exp1_i(Fl_Check_Button* o, void*) { - part->ctl.bandwidth.exponential=(int) o->value(); -} -void PartUI::cb_Exp1(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Exp1_i(o,v); -} - -void PartUI::cb_inseffnocounter_i(Fl_Counter* o, void*) { - ninseff=(int) o->value()-1; -insefftype->value(part->partefx[ninseff]->geteffect()); -//insefftype->do_callback(); -inseffectui->refresh(part->partefx[ninseff]); -int x=part->Pefxroute[ninseff]; -if (x==127) x=1; -bypasseff->value(part->Pefxbypass[ninseff]); - -sendtochoice->value(x); -} -void PartUI::cb_inseffnocounter(Fl_Counter* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_inseffnocounter_i(o,v); -} - -void PartUI::cb_insefftype_i(Fl_Choice* o, void*) { - pthread_mutex_lock(part->mutex); -part->partefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(part->mutex); -inseffectui->refresh(part->partefx[ninseff]); -} -void PartUI::cb_insefftype(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_insefftype_i(o,v); -} - -Fl_Menu_Item PartUI::menu_insefftype[] = { - {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PartUI::cb_Close1_i(Fl_Button*, void*) { - partfx->hide(); -} -void PartUI::cb_Close1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Close1_i(o,v); -} - -void PartUI::cb_sendtochoice_i(Fl_Choice* o, void*) { - int x=(int) o->value(); -part->Pefxroute[ninseff]=x; -if (x==2) part->partefx[ninseff]->setdryonly(true); - else part->partefx[ninseff]->setdryonly(false); -} -void PartUI::cb_sendtochoice(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_sendtochoice_i(o,v); -} - -Fl_Menu_Item PartUI::menu_sendtochoice[] = { - {"Next Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Part Out", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"Dry Out", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PartUI::cb_bypasseff_i(Fl_Check_Button* o, void*) { - part->Pefxbypass[ninseff]=(((int)o->value())!=0); -} -void PartUI::cb_bypasseff(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_bypasseff_i(o,v); -} - -void PartUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(part->partefx[ninseff]); -} -void PartUI::cb_C(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void PartUI::cb_P_i(Fl_Button*, void*) { - pthread_mutex_lock(&master->mutex); -presetsui->paste(part->partefx[ninseff],inseffectui); -pthread_mutex_unlock(&master->mutex); -} -void PartUI::cb_P(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -void PartUI::cb_Close2_i(Fl_Button*, void*) { - instrumentkitlist->hide(); -} -void PartUI::cb_Close2(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Close2_i(o,v); -} - -void PartUI::cb_Mode1_i(Fl_Choice* o, void*) { - part->Pkitmode=(int) o->value(); -if (part->Pkitmode==0) { - kitlist->deactivate(); - } else { - kitlist->activate(); -}; -} -void PartUI::cb_Mode1(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Mode1_i(o,v); -} - -Fl_Menu_Item PartUI::menu_Mode[] = { - {"OFF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"MULTI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"SINGLE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PartUI::cb_Drum_i(Fl_Check_Button* o, void*) { - part->Pdrummode=(int) o->value(); -} -void PartUI::cb_Drum(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Drum_i(o,v); -} - -void PartUI::cb_padeditbutton1_i(Fl_Button*, void*) { - showparameters(0,2); -} -void PartUI::cb_padeditbutton1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->parent()->user_data()))->cb_padeditbutton1_i(o,v); -} - -void PartUI::cb_padsynenabledcheck_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -part->kit[0].Ppadenabled=x; -if (x==0) padeditbutton->deactivate(); - else padeditbutton->activate(); -} -void PartUI::cb_padsynenabledcheck(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->parent()->user_data()))->cb_padsynenabledcheck_i(o,v); -} - -void PartUI::cb_adsynenabledcheck_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -part->kit[0].Padenabled=x; -if (x==0) adeditbutton->deactivate(); - else adeditbutton->activate(); -} -void PartUI::cb_adsynenabledcheck(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->parent()->user_data()))->cb_adsynenabledcheck_i(o,v); -} - -void PartUI::cb_adeditbutton1_i(Fl_Button*, void*) { - showparameters(0,0); -} -void PartUI::cb_adeditbutton1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->parent()->user_data()))->cb_adeditbutton1_i(o,v); -} - -void PartUI::cb_subsynenabledcheck_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -part->kit[0].Psubenabled=x; -if (x==0) subeditbutton->deactivate(); - else subeditbutton->activate(); -} -void PartUI::cb_subsynenabledcheck(Fl_Check_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->parent()->user_data()))->cb_subsynenabledcheck_i(o,v); -} - -void PartUI::cb_subeditbutton1_i(Fl_Button*, void*) { - showparameters(0,1); -} -void PartUI::cb_subeditbutton1(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->parent()->user_data()))->cb_subeditbutton1_i(o,v); -} - -void PartUI::cb_Kit_i(Fl_Button*, void*) { - instrumentkitlist->show(); -} -void PartUI::cb_Kit(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Kit_i(o,v); -} - -void PartUI::cb_Effects_i(Fl_Button*, void*) { - partfx->show(); -} -void PartUI::cb_Effects(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Effects_i(o,v); -} - -void PartUI::cb_Author_i(Fl_Input* o, void*) { - snprintf((char *)part->info.Pauthor,MAX_INFO_TEXT_SIZE,"%s",o->value()); -} -void PartUI::cb_Author(Fl_Input* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Author_i(o,v); -} - -void PartUI::cb_Comments_i(Fl_Input* o, void*) { - snprintf((char *)part->info.Pcomments,MAX_INFO_TEXT_SIZE,"%s",o->value()); -} -void PartUI::cb_Comments(Fl_Input* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Comments_i(o,v); -} - -void PartUI::cb_Type_i(Fl_Choice* o, void*) { - part->info.Ptype=o->value(); -} -void PartUI::cb_Type(Fl_Choice* o, void* v) { - ((PartUI*)(o->parent()->parent()->user_data()))->cb_Type_i(o,v); -} - -Fl_Menu_Item PartUI::menu_Type[] = { - {"--------------------------", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Piano", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Chromatic Percussion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Organ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Guitar", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Bass", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Solo Strings", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Ensemble", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Brass", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Reed", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Pipe", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Synth Lead", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Synth Pad", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Synth Effects", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Ethnic", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Percussive", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Sound Effects", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void PartUI::cb_Close3_i(Fl_Button*, void*) { - instrumenteditwindow->hide(); -} -void PartUI::cb_Close3(Fl_Button* o, void* v) { - ((PartUI*)(o->parent()->user_data()))->cb_Close3_i(o,v); -} - -Fl_Group* PartUI::make_window() { - { partgroup = new Fl_Group(0, 0, 385, 180); - partgroup->box(FL_FLAT_BOX); - partgroup->color(FL_BACKGROUND_COLOR); - partgroup->selection_color(FL_BACKGROUND_COLOR); - partgroup->labeltype(FL_NO_LABEL); - partgroup->labelfont(0); - partgroup->labelsize(14); - partgroup->labelcolor(FL_FOREGROUND_COLOR); - partgroup->user_data((void*)(this)); - partgroup->align(Fl_Align(FL_ALIGN_TOP)); - partgroup->when(FL_WHEN_RELEASE); - { Fl_Group* o = partgroupui = new Fl_Group(0, 0, 385, 180); - { WidgetPDial* o = new WidgetPDial(50, 40, 25, 25, "Pan"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Pan); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->Ppanning); - } // WidgetPDial* o - { Fl_Counter* o = new Fl_Counter(195, 45, 90, 20, "KeyShift"); - o->labelsize(11); - o->minimum(-64); - o->maximum(64); - o->step(1); - o->callback((Fl_Callback*)cb_KeyShift); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->lstep(12); - o->value(part->Pkeyshift-64); - } // Fl_Counter* o - { Fl_Scroll* o = new Fl_Scroll(166, 91, 125, 60); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - o->labelsize(10); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE)); - { Fl_Pack* o = new Fl_Pack(171, 96, 115, 35); - o->type(1); - o->spacing(5); - for (int i=0;iinit(master,npart,i);} - o->end(); - } // Fl_Pack* o - o->end(); - } // Fl_Scroll* o - { Fl_Button* o = new Fl_Button(195, 5, 185, 20, "Grand Piano"); - o->tooltip("left mousebutton - to choose/save/.. from/to bank or right mousebutton to cha\ -nge the name or middle button to change the instrument information"); - o->box(FL_THIN_DOWN_BOX); - o->down_box(FL_FLAT_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Grand); - o->align(Fl_Align(68|FL_ALIGN_INSIDE)); - o->label((char *)part->Pname); - } // Fl_Button* o - { Fl_Box* o = new Fl_Box(166, 81, 95, 10, "To Sys.Efx."); - o->labelfont(1); - o->labelsize(10); - } // Fl_Box* o - { Fl_Check_Button* o = new Fl_Check_Button(10, 155, 65, 20, "NoteOn"); - o->tooltip("set if the part receives NoteOn messages"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_NoteOn); - o->value(part->Pnoteon); - } // Fl_Check_Button* o - { Fl_Counter* o = minkcounter = new Fl_Counter(295, 125, 40, 15, "Min.k"); - minkcounter->tooltip("Minimum key (that the part receives NoteOn messages)"); - minkcounter->type(1); - minkcounter->labelfont(1); - minkcounter->labelsize(10); - minkcounter->minimum(0); - minkcounter->maximum(127); - minkcounter->step(1); - minkcounter->textsize(10); - minkcounter->callback((Fl_Callback*)cb_minkcounter1); - o->value(part->Pminkey); - } // Fl_Counter* minkcounter - { Fl_Counter* o = maxkcounter = new Fl_Counter(340, 125, 40, 15, "Max.k"); - maxkcounter->tooltip("Maximum key (that the part receives NoteOn messages)"); - maxkcounter->type(1); - maxkcounter->labelfont(1); - maxkcounter->labelsize(10); - maxkcounter->minimum(0); - maxkcounter->maximum(127); - maxkcounter->step(1); - maxkcounter->textsize(10); - maxkcounter->callback((Fl_Callback*)cb_maxkcounter1); - o->value(part->Pmaxkey); - } // Fl_Counter* maxkcounter - { WidgetPDial* o = new WidgetPDial(10, 35, 30, 30, "Volume"); - o->tooltip("Part Volume"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Volume); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->Pvolume); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(135, 40, 25, 25, "Vel.Ofs."); - o->tooltip("Velocity Offset"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vel); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->Pveloffs); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(95, 40, 25, 25, "Vel.Sns."); - o->tooltip("Velocity Sensing Function"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vel1); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->Pvelsns); - } // WidgetPDial* o - { Fl_Button* o = new Fl_Button(295, 90, 85, 30, "Controllers"); - o->box(FL_PLASTIC_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Controllers); - } // Fl_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(95, 155, 88, 20, "Portamento"); - o->tooltip("Enable/Disable the portamento"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Portamento); - o->value(part->ctl.portamento.portamento); - } // Fl_Check_Button* o - { Fl_Button* o = new Fl_Button(15, 90, 130, 30, "Edit instrument"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)230); - o->labelfont(1); - o->labelsize(13); - o->callback((Fl_Callback*)cb_Edit); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(315, 155, 15, 12, "m"); - o->tooltip("set the minimum key to the last pressed key"); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_m1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(345, 155, 15, 12, "M"); - o->tooltip("set the maximum key to the last pressed key"); - o->box(FL_THIN_UP_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_M1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(330, 155, 15, 12, "R"); - o->tooltip("reset the minimum key to 0 and maximum key to 127"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_R1); - } // Fl_Button* o - { Fl_Choice* o = new Fl_Choice(310, 45, 70, 20, "MIDI Chn.Rcv."); - o->tooltip("receive from Midi channel"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_MIDI); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drms10");}; - o->value(part->Prcvchn); - } // Fl_Choice* o - { keylimitlist = new Fl_Choice(215, 155, 50, 20, "KLmt"); - keylimitlist->tooltip("Key Limit"); - keylimitlist->down_box(FL_BORDER_BOX); - keylimitlist->labelsize(10); - keylimitlist->textfont(1); - keylimitlist->textsize(10); - keylimitlist->callback((Fl_Callback*)cb_keylimitlist); - keylimitlist->align(Fl_Align(FL_ALIGN_RIGHT)); - } // Fl_Choice* keylimitlist - { Fl_Choice* o = new Fl_Choice(80, 130, 64, 18, "Mode :"); - o->tooltip("Poly, Mono or Legato mode"); - o->down_box(FL_BORDER_BOX); - o->labelfont(1); - o->labelsize(11); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Mode); - o->add("Poly"); o->add("Mono"); o->add("Legato"); - if (part->Ppolymode!=0) o->value(0); else o->value(1); - if (part->Ppolymode==0 && part->Plegatomode!=0) o->value(2); - } // Fl_Choice* o - if (part->Penabled==0) o->deactivate(); - partgroupui->end(); - } // Fl_Group* partgroupui - { Fl_Check_Button* o = new Fl_Check_Button(90, 5, 75, 20, "Enabled"); - o->down_box(FL_DOWN_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Enabled); - o->value(part->Penabled); - } // Fl_Check_Button* o - partgroup->end(); - } // Fl_Group* partgroup - { ctlwindow = new Fl_Double_Window(500, 130, "Controllers"); - ctlwindow->user_data((void*)(this)); - { Fl_Check_Button* o = new Fl_Check_Button(155, 55, 45, 20, "Expr"); - o->tooltip("Expression enable"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Expr); - o->value(part->ctl.expression.receive); - } // Fl_Check_Button* o - { WidgetPDial* o = new WidgetPDial(10, 55, 30, 30, "PanDpth"); - o->tooltip("Panning Depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_PanDpth); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.panning.depth); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(90, 55, 30, 30, "FltCut"); - o->tooltip("Filter Cutoff depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_FltCut); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.filtercutoff.depth); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(50, 55, 30, 30, "FltQ"); - o->tooltip("Filter Q depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_FltQ); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.filterq.depth); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(125, 10, 30, 30, "BwDpth"); - o->tooltip("BandWidth depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_BwDpth); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.bandwidth.depth); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(50, 10, 30, 30, "ModWh"); - o->tooltip("Modulation Wheel depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_ModWh); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.modwheel.depth); - } // WidgetPDial* o - { Fl_Counter* o = new Fl_Counter(165, 15, 110, 20, "PWheelB.Rng (cents)"); - o->tooltip("Pitch Wheel Bend Range (cents)"); - o->labelsize(10); - o->minimum(-6400); - o->maximum(6400); - o->step(1); - o->callback((Fl_Callback*)cb_PWheelB); - o->align(Fl_Align(FL_ALIGN_TOP)); - o->value(part->ctl.pitchwheel.bendrange); - o->lstep(100); - } // Fl_Counter* o - { Fl_Check_Button* o = new Fl_Check_Button(205, 55, 60, 20, "FMamp"); - o->tooltip("FM amplitude enable"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_FMamp); - o->value(part->ctl.fmamp.receive); - } // Fl_Check_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(155, 80, 45, 20, "Vol"); - o->tooltip("Volume enable"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Vol); - o->value(part->ctl.volume.receive); - } // Fl_Check_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(205, 80, 60, 20, "Sustain"); - o->tooltip("Sustain pedal enable"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Sustain); - o->value(part->ctl.sustain.receive); - } // Fl_Check_Button* o - { Fl_Button* o = new Fl_Button(330, 105, 95, 20, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(5, 105, 210, 20, "Reset all controllers"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Reset); - } // Fl_Button* o - { Fl_Group* o = new Fl_Group(280, 15, 160, 90, "Portamento"); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - o->labelsize(10); - { Fl_Check_Button* o = new Fl_Check_Button(285, 20, 40, 20, "Rcv"); - o->tooltip("Receive Portamento Controllers"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Rcv); - o->value(part->ctl.portamento.receive); - } // Fl_Check_Button* o - { WidgetPDial* o = new WidgetPDial(285, 60, 25, 25, "time"); - o->tooltip("Portamento time"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_time); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.portamento.time); - } // WidgetPDial* o - { Fl_Counter* o = new Fl_Counter(340, 20, 50, 20, "thresh"); - o->tooltip("Minimum or max. difference of the notes in order to do the portamento (x 100 \ -cents)"); - o->type(1); - o->labelsize(10); - o->minimum(0); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_thresh); - o->value(part->ctl.portamento.pitchthresh); - } // Fl_Counter* o - { Fl_Check_Button* o = new Fl_Check_Button(365, 70, 15, 15, "th.type"); - o->tooltip("Threshold type (min/max)"); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_th); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->value(part->ctl.portamento.pitchthreshtype); - } // Fl_Check_Button* o - { Fl_Box* o = new Fl_Box(340, 50, 55, 15, "x100 cnt."); - o->labelsize(10); - o->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { WidgetPDial* o = new WidgetPDial(315, 60, 25, 25, "t.dn/up"); - o->tooltip("Portamento time stretch (up/down)"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_t); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.portamento.updowntimestretch); - } // WidgetPDial* o - { WidgetPDial* o = propta = new WidgetPDial(405, 20, 25, 25, "Prp.Rate"); - propta->tooltip("Distance required to double change from nonpropotinal portamento time"); - propta->box(FL_OVAL_BOX); - propta->color(FL_BACKGROUND_COLOR); - propta->selection_color(FL_INACTIVE_COLOR); - propta->labeltype(FL_NORMAL_LABEL); - propta->labelfont(0); - propta->labelsize(9); - propta->labelcolor(FL_FOREGROUND_COLOR); - propta->maximum(127); - propta->step(1); - propta->callback((Fl_Callback*)cb_propta); - propta->align(Fl_Align(FL_ALIGN_BOTTOM)); - propta->when(FL_WHEN_CHANGED); - o->value(part->ctl.portamento.propRate); - } // WidgetPDial* propta - { WidgetPDial* o = proptb = new WidgetPDial(405, 60, 25, 25, "Prp.Dpth"); - proptb->tooltip("The difference from nonproportinal portamento"); - proptb->box(FL_OVAL_BOX); - proptb->color(FL_BACKGROUND_COLOR); - proptb->selection_color(FL_INACTIVE_COLOR); - proptb->labeltype(FL_NORMAL_LABEL); - proptb->labelfont(0); - proptb->labelsize(9); - proptb->labelcolor(FL_FOREGROUND_COLOR); - proptb->maximum(127); - proptb->step(1); - proptb->callback((Fl_Callback*)cb_proptb); - proptb->align(Fl_Align(FL_ALIGN_BOTTOM)); - proptb->when(FL_WHEN_CHANGED); - o->value(part->ctl.portamento.propDepth); - } // WidgetPDial* proptb - { Fl_Check_Button* o = new Fl_Check_Button(285, 40, 50, 15, "Proprt."); - o->tooltip("Enable Proportinal Portamento (over fixed Portamento)"); - o->box(FL_THIN_UP_BOX); - o->down_box(FL_DOWN_BOX); - o->labelsize(9); - o->callback((Fl_Callback*)cb_Proprt); - o->value(part->ctl.portamento.proportional); - if(o->value()){propta->activate();proptb->activate();} - else {propta->deactivate();proptb->deactivate();} - } // Fl_Check_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(440, 15, 50, 90, "Resonance"); - o->box(FL_ENGRAVED_BOX); - o->labelfont(1); - o->labelsize(10); - { WidgetPDial* o = new WidgetPDial(450, 60, 25, 25, "BWdpth"); - o->tooltip("BandWidth controller depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_BWdpth); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.resonancebandwidth.depth); - } // WidgetPDial* o - { WidgetPDial* o = new WidgetPDial(450, 20, 25, 25, "CFdpth"); - o->tooltip("Center Frequency controller Depth"); - o->box(FL_OVAL_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_CFdpth); - o->align(Fl_Align(FL_ALIGN_BOTTOM)); - o->when(FL_WHEN_CHANGED); - o->value(part->ctl.resonancecenter.depth); - } // WidgetPDial* o - o->end(); - } // Fl_Group* o - { Fl_Check_Button* o = new Fl_Check_Button(10, 15, 40, 25, "Exp MWh"); - o->tooltip("Exponential modulation wheel"); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Exp); - o->align(Fl_Align(132|FL_ALIGN_INSIDE)); - o->value(part->ctl.modwheel.exponential); - } // Fl_Check_Button* o - { Fl_Check_Button* o = new Fl_Check_Button(85, 15, 35, 25, "Exp BW"); - o->tooltip("Exponential BandWidth Controller"); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Exp1); - o->align(Fl_Align(132|FL_ALIGN_INSIDE)); - o->value(part->ctl.bandwidth.exponential); - } // Fl_Check_Button* o - ctlwindow->end(); - } // Fl_Double_Window* ctlwindow - { partfx = new Fl_Double_Window(390, 145, "Part\'s Insert Effects"); - partfx->user_data((void*)(this)); - { Fl_Counter* o = inseffnocounter = new Fl_Counter(5, 110, 80, 20, "FX No."); - inseffnocounter->type(1); - inseffnocounter->labelfont(1); - inseffnocounter->minimum(1); - inseffnocounter->maximum(127); - inseffnocounter->step(1); - inseffnocounter->textfont(1); - inseffnocounter->callback((Fl_Callback*)cb_inseffnocounter); - inseffnocounter->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - o->bounds(1,NUM_PART_EFX); - o->value(ninseff+1); - } // Fl_Counter* inseffnocounter - { Fl_Choice* o = insefftype = new Fl_Choice(155, 110, 70, 15, "EffType"); - insefftype->down_box(FL_BORDER_BOX); - insefftype->labelsize(10); - insefftype->callback((Fl_Callback*)cb_insefftype); - insefftype->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - insefftype->menu(menu_insefftype); - o->value(part->partefx[ninseff]->geteffect()); - } // Fl_Choice* insefftype - { inseffectuigroup = new Fl_Group(5, 5, 380, 100); - inseffectuigroup->box(FL_FLAT_BOX); - inseffectuigroup->color((Fl_Color)48); - { EffUI* o = inseffectui = new EffUI(5, 5, 380, 95); - inseffectui->box(FL_NO_BOX); - inseffectui->color(FL_BACKGROUND_COLOR); - inseffectui->selection_color(FL_BACKGROUND_COLOR); - inseffectui->labeltype(FL_NORMAL_LABEL); - inseffectui->labelfont(0); - inseffectui->labelsize(14); - inseffectui->labelcolor(FL_FOREGROUND_COLOR); - inseffectui->align(Fl_Align(FL_ALIGN_TOP)); - inseffectui->when(FL_WHEN_RELEASE); - o->init(part->partefx[ninseff]); - inseffectui->end(); - } // EffUI* inseffectui - inseffectuigroup->end(); - } // Fl_Group* inseffectuigroup - { Fl_Button* o = new Fl_Button(325, 115, 60, 20, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close1); - } // Fl_Button* o - { Fl_Choice* o = sendtochoice = new Fl_Choice(235, 110, 80, 15, "Send To."); - sendtochoice->down_box(FL_BORDER_BOX); - sendtochoice->labelsize(10); - sendtochoice->callback((Fl_Callback*)cb_sendtochoice); - sendtochoice->align(Fl_Align(FL_ALIGN_BOTTOM_LEFT)); - sendtochoice->menu(menu_sendtochoice); - int x=part->Pefxroute[ninseff]; if (x==127) x=1; - o->value(x); - } // Fl_Choice* sendtochoice - { Fl_Check_Button* o = bypasseff = new Fl_Check_Button(90, 110, 60, 15, "bypass"); - bypasseff->tooltip("if the effect is not used (is bypassed)"); - bypasseff->down_box(FL_DOWN_BOX); - bypasseff->labelsize(11); - bypasseff->callback((Fl_Callback*)cb_bypasseff); - int x=part->Pefxbypass[ninseff];o->value(x); - } // Fl_Check_Button* bypasseff - { Fl_Button* o = new Fl_Button(90, 127, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(120, 127, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - partfx->end(); - } // Fl_Double_Window* partfx - { instrumentkitlist = new Fl_Double_Window(670, 370, "Instrument Kit"); - instrumentkitlist->user_data((void*)(this)); - { Fl_Button* o = new Fl_Button(375, 350, 160, 20, "Close Window"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close2); - } // Fl_Button* o - { Fl_Scroll* o = kitlist = new Fl_Scroll(0, 15, 670, 330); - kitlist->type(2); - kitlist->box(FL_THIN_UP_BOX); - { Fl_Pack* o = new Fl_Pack(0, 20, 670, 320); - for (int i=0;iinit(part,i,master,this);} - o->end(); - } // Fl_Pack* o - if (part->Pkitmode==0) o->deactivate(); - kitlist->end(); - } // Fl_Scroll* kitlist - { Fl_Box* o = new Fl_Box(5, 0, 25, 15, "No."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(55, 0, 25, 15, "M."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(235, 0, 40, 15, "Min.k"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(345, 0, 40, 15, "Max.k"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(405, 0, 50, 15, "ADsynth"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(470, 0, 60, 15, "SUBsynth"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Choice* o = new Fl_Choice(35, 350, 70, 15, "Mode"); - o->down_box(FL_BORDER_BOX); - o->labelsize(11); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Mode1); - o->menu(menu_Mode); - o->value(part->Pkitmode); - } // Fl_Choice* o - { Fl_Check_Button* o = new Fl_Check_Button(285, 350, 70, 15, "Drum mode"); - o->down_box(FL_DOWN_BOX); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Drum); - o->value(part->Pdrummode); - } // Fl_Check_Button* o - { Fl_Box* o = new Fl_Box(620, 0, 30, 15, "FX.r."); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(540, 0, 60, 15, "PADsynth"); - o->labelfont(1); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE)); - } // Fl_Box* o - instrumentkitlist->end(); - } // Fl_Double_Window* instrumentkitlist - { instrumenteditwindow = new Fl_Double_Window(395, 360, "Instrument Edit"); - instrumenteditwindow->user_data((void*)(this)); - { Fl_Group* o = new Fl_Group(0, 220, 395, 110); - o->box(FL_ENGRAVED_FRAME); - { Fl_Group* o = new Fl_Group(205, 245, 100, 80, "PADsynth"); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - { Fl_Button* o = padeditbutton = new Fl_Button(215, 280, 80, 35, "Edit"); - padeditbutton->box(FL_PLASTIC_UP_BOX); - padeditbutton->color((Fl_Color)222); - padeditbutton->selection_color((Fl_Color)220); - padeditbutton->labelfont(1); - padeditbutton->labelsize(13); - padeditbutton->callback((Fl_Callback*)cb_padeditbutton1); - padeditbutton->align(Fl_Align(FL_ALIGN_WRAP)); - if (part->kit[0].Ppadenabled==0) o->deactivate(); - } // Fl_Button* padeditbutton - { Fl_Check_Button* o = padsynenabledcheck = new Fl_Check_Button(215, 255, 80, 20, "Enabled"); - padsynenabledcheck->tooltip("enable/disable PADsynth"); - padsynenabledcheck->box(FL_PLASTIC_UP_BOX); - padsynenabledcheck->down_box(FL_DOWN_BOX); - padsynenabledcheck->color((Fl_Color)222); - padsynenabledcheck->selection_color((Fl_Color)218); - padsynenabledcheck->labelfont(1); - padsynenabledcheck->labelsize(11); - padsynenabledcheck->callback((Fl_Callback*)cb_padsynenabledcheck); - o->value(part->kit[0].Ppadenabled); - } // Fl_Check_Button* padsynenabledcheck - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(5, 245, 100, 80, "ADDsynth"); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - { Fl_Check_Button* o = adsynenabledcheck = new Fl_Check_Button(15, 255, 80, 20, "Enabled"); - adsynenabledcheck->tooltip("enable/disable ADsynth"); - adsynenabledcheck->box(FL_PLASTIC_UP_BOX); - adsynenabledcheck->down_box(FL_DOWN_BOX); - adsynenabledcheck->color((Fl_Color)222); - adsynenabledcheck->selection_color((Fl_Color)218); - adsynenabledcheck->labelfont(1); - adsynenabledcheck->labelsize(11); - adsynenabledcheck->callback((Fl_Callback*)cb_adsynenabledcheck); - o->value(part->kit[0].Padenabled); - } // Fl_Check_Button* adsynenabledcheck - { Fl_Button* o = adeditbutton = new Fl_Button(15, 281, 80, 34, "Edit"); - adeditbutton->box(FL_PLASTIC_UP_BOX); - adeditbutton->color((Fl_Color)222); - adeditbutton->selection_color((Fl_Color)220); - adeditbutton->labelfont(1); - adeditbutton->labelsize(13); - adeditbutton->callback((Fl_Callback*)cb_adeditbutton1); - adeditbutton->align(Fl_Align(FL_ALIGN_WRAP)); - if (part->kit[0].Padenabled==0) o->deactivate(); - } // Fl_Button* adeditbutton - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(105, 245, 100, 80, "SUBsynth"); - o->box(FL_ENGRAVED_FRAME); - o->labelfont(1); - { Fl_Check_Button* o = subsynenabledcheck = new Fl_Check_Button(115, 255, 80, 20, "Enabled"); - subsynenabledcheck->tooltip("enable/disable SUBsynth"); - subsynenabledcheck->box(FL_PLASTIC_UP_BOX); - subsynenabledcheck->down_box(FL_DOWN_BOX); - subsynenabledcheck->color((Fl_Color)222); - subsynenabledcheck->selection_color((Fl_Color)218); - subsynenabledcheck->labelfont(1); - subsynenabledcheck->labelsize(11); - subsynenabledcheck->callback((Fl_Callback*)cb_subsynenabledcheck); - o->value(part->kit[0].Psubenabled); - } // Fl_Check_Button* subsynenabledcheck - { Fl_Button* o = subeditbutton = new Fl_Button(115, 280, 80, 35, "Edit"); - subeditbutton->box(FL_PLASTIC_UP_BOX); - subeditbutton->color((Fl_Color)222); - subeditbutton->selection_color((Fl_Color)220); - subeditbutton->labelfont(1); - subeditbutton->labelsize(13); - subeditbutton->callback((Fl_Callback*)cb_subeditbutton1); - subeditbutton->align(Fl_Align(FL_ALIGN_WRAP)); - if (part->kit[0].Psubenabled==0) o->deactivate(); - } // Fl_Button* subeditbutton - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(310, 245, 80, 35, "Kit Edit"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)238); - o->selection_color((Fl_Color)220); - o->labelfont(1); - o->callback((Fl_Callback*)cb_Kit); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(310, 290, 80, 35, "Effects"); - o->box(FL_PLASTIC_UP_BOX); - o->color((Fl_Color)230); - o->labelfont(1); - o->labelsize(13); - o->callback((Fl_Callback*)cb_Effects); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(0, 5, 395, 215); - o->box(FL_ENGRAVED_FRAME); - { Fl_Input* o = new Fl_Input(5, 60, 385, 50, "Author and Copyright"); - o->type(4); - o->color((Fl_Color)26); - o->labelsize(10); - o->callback((Fl_Callback*)cb_Author); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->maximum_size(MAX_INFO_TEXT_SIZE); - o->value((char *) &part->info.Pauthor); - } // Fl_Input* o - { Fl_Input* o = new Fl_Input(5, 125, 385, 90, "Comments"); - o->type(4); - o->color((Fl_Color)26); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Comments); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->maximum_size(MAX_INFO_TEXT_SIZE); - o->value((char *) &part->info.Pcomments); - } // Fl_Input* o - { Fl_Choice* o = new Fl_Choice(5, 25, 155, 20, "Type:"); - o->down_box(FL_BORDER_BOX); - o->labelfont(1); - o->labelsize(11); - o->textsize(10); - o->callback((Fl_Callback*)cb_Type); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->menu(menu_Type); - o->value(part->info.Ptype); - } // Fl_Choice* o - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(150, 335, 95, 25, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close3); - } // Fl_Button* o - instrumenteditwindow->end(); - } // Fl_Double_Window* instrumenteditwindow - return instrumenteditwindow; -} - -PartUI::PartUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - part=NULL; - adnoteui=NULL; - subnoteui=NULL; - padnoteui=NULL; - lastkititem=-1; -} - -void PartUI::init(Part *part_,Master *master_,int npart_,BankUI *bankui_) { - bankui=bankui_; - part=part_; - npart=npart_; - master=master_; - ninseff=0; - - make_window(); - partgroup->position(this->parent()->x()+2,this->parent()->y()+2); - partgroup->show(); - end(); - - - //if (config.ui.showinstrumentinfo!=0) instrumenteditwindow->show(); - - int klimits[]={1,2,3,4,5,6,7,8,9,10,15,20,30,50,100,0}; - - keylimitlist->add("OFF"); - int k=0; - int val=-1; - char tmp[10]; - while (klimits[k]!=0){ - sprintf(tmp,"%d",klimits[k]); - keylimitlist->add(tmp); - if (val==-1){ - if (klimits[k]>part->Pkeylimit) val=k; - }; - k++; - }; - - if (val==-1) val=k; - keylimitlist->value(val); -} - -void PartUI::showparameters(int kititem,int engine) { - if (engine==-1){//this is used if I want to clear the engine from the part - if (kititem==lastkititem) kititem=-1; - else kititem=lastkititem; - }; - - if (kititem!=lastkititem){ - if (adnoteui!=NULL) delete (adnoteui); - if (subnoteui!=NULL) delete (subnoteui); - if (padnoteui!=NULL) delete (padnoteui); - adnoteui=NULL;subnoteui=NULL;padnoteui=NULL; - lastkititem=kititem; - - if (kititem>=NUM_KIT_ITEMS) return;//bad kit item - if (kititem<0) return; - - if (part->kit[kititem].adpars!=NULL) - adnoteui=new ADnoteUI(part->kit[kititem].adpars,master); - - if (part->kit[kititem].subpars!=NULL) - subnoteui=new SUBnoteUI(part->kit[kititem].subpars); - - if (part->kit[kititem].padpars!=NULL) - padnoteui=new PADnoteUI(part->kit[kititem].padpars,master); - - }; - - - - if ((engine==0)&&(adnoteui!=NULL)) adnoteui->ADnoteGlobalParameters->show(); - if ((engine==1)&&(subnoteui!=NULL)) subnoteui->SUBparameters->show(); - if ((engine==2)&&(adnoteui!=NULL)) padnoteui->padnotewindow->show(); -} - -PartUI::~PartUI() { - if (adnoteui!=NULL) delete (adnoteui); - if (subnoteui!=NULL) delete (subnoteui); - if (padnoteui!=NULL) delete (padnoteui); - - partgroup->hide(); - //delete(partgroup); - - ctlwindow->hide(); - delete(ctlwindow); - - partfx->hide(); - delete(partfx); - - instrumentkitlist->hide(); - delete(instrumentkitlist); - - instrumenteditwindow->hide(); - delete(instrumenteditwindow); -} diff --git a/plugins/zynaddsubfx/src/UI/PartUI.fl b/plugins/zynaddsubfx/src/UI/PartUI.fl deleted file mode 100644 index fc8dcd5e8..000000000 --- a/plugins/zynaddsubfx/src/UI/PartUI.fl +++ /dev/null @@ -1,1125 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EffUI.h"} {public -} - -decl {\#include "BankUI.h"} {public -} - -decl {\#include "ADnoteUI.h"} {public -} - -decl {\#include "SUBnoteUI.h"} {public -} - -decl {\#include "PADnoteUI.h"} {public -} - -decl {\#include "../Misc/Config.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Part.h"} {public -} - -class PartSysEffSend {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window syseffsend { - private xywh {584 83 90 35} type Double hide - class Fl_Group - } { - Fl_Dial {} { - label 01 - callback {master->setPsysefxvol(npart,neff,(int) o->value());} - xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1 - code0 {o->size(25,25);} - code1 {o->value(master->Psysefxvol[neff][npart]);} - code2 {char tmp[10];snprintf(tmp,10,"%d",neff+1);o->copy_label(tmp);} - class WidgetPDial - } - } - } - Function {PartSysEffSend(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {master=NULL; -neff=0; -npart=0;} {} - } - Function {init(Master *master_,int npart_,int neff_)} {} { - code {npart=npart_; -neff=neff_; -master=master_; -make_window(); -syseffsend->show(); -end();} {} - } - Function {~PartSysEffSend()} {} { - code {syseffsend->hide(); -//delete(syseffsend);} {} - } - decl {Master *master;} {} - decl {int neff;} {} - decl {int npart;} {} -} - -class PartUI_ {} { - Function {showparameters(int kititem,int engine)} {return_type virtual - } {} -} - -class PartKitItem {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window partkititem { - private xywh {113 271 670 30} type Double hide - class Fl_Group - } { - Fl_Group partkititemgroup { - private xywh {55 0 605 20} box FLAT_BOX - code0 {if (part->kit[n].Penabled==0) o->deactivate();} - } { - Fl_Counter minkcounter { - callback {part->kit[n].Pminkey=(int)o->value();} - xywh {225 0 55 15} type Simple minimum 0 maximum 128 step 1 - code0 {o->value(part->kit[n].Pminkey);} - } - Fl_Button {} { - label m - callback {if (part->lastnote>=0) minkcounter->value(part->lastnote); -minkcounter->do_callback(); -maxkcounter->do_callback();} - tooltip {set the minimum key to the last pressed key} xywh {285 3 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label M - callback {if (part->lastnote>=0) maxkcounter->value(part->lastnote); -maxkcounter->do_callback(); -minkcounter->do_callback();} - tooltip {set the maximum key to the last pressed key} xywh {315 3 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label R - callback {minkcounter->value(0); -minkcounter->do_callback(); -maxkcounter->value(127); -maxkcounter->do_callback();} - tooltip {reset the minimum key to 0 and maximum key to 127} xywh {300 3 15 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button adeditbutton { - label edit - callback {partui->showparameters(n,0);} - xywh {420 0 40 15} box THIN_UP_BOX labelsize 11 - code0 {if (part->kit[n].Padenabled==0) o->deactivate();} - code1 {if (n==0) o->hide();} - } - Fl_Button subeditbutton { - label edit - callback {partui->showparameters(n,1);} - xywh {490 0 40 15} box THIN_UP_BOX labelsize 11 - code0 {if (part->kit[n].Psubenabled==0) o->deactivate();} - code1 {if (n==0) o->hide();} - } - Fl_Check_Button mutedcheck { - callback {part->kit[n].Pmuted=(int)o->value();} - private xywh {60 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Pmuted);} - } - Fl_Counter maxkcounter { - callback {part->kit[n].Pmaxkey=(int)o->value();} - xywh {335 0 55 15} type Simple minimum 0 maximum 128 step 1 - code0 {o->value(part->kit[n].Pmaxkey);} - } - Fl_Button labelbutton { - label {Bass Drum} - callback {const char *tmp=fl_input("Kit item name:",(const char *)part->kit[n].Pname); -if (tmp!=NULL) snprintf((char *)part->kit[n].Pname,PART_MAX_NAME_LEN,"%s",tmp);} - xywh {90 0 130 15} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 10 align 20 - code0 {o->label((char *)part->kit[n].Pname);} - } - Fl_Check_Button adcheck { - callback {part->kit[n].Padenabled=(int)o->value(); -if (part->kit[n].Padenabled!=0) adeditbutton->activate(); - else adeditbutton->deactivate();} - private xywh {400 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Padenabled);} - code1 {if (n==0) o->hide();} - } - Fl_Check_Button subcheck { - callback {part->kit[n].Psubenabled=(int)o->value(); -if (part->kit[n].Psubenabled!=0) subeditbutton->activate(); - else subeditbutton->deactivate();} - private xywh {470 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Psubenabled);} - code1 {if (n==0) o->hide();} - } - Fl_Choice sendtoeffect { - callback {if (o->value()!=0) part->kit[n].Psendtoparteffect=(int)o->value()-1; - else part->kit[n].Psendtoparteffect=127;} open - xywh {615 0 45 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("OFF");char nrstr[10]; for(int i=0;iadd(nrstr);};} - code1 {o->value(part->kit[n].Psendtoparteffect+1);if (part->kit[n].Psendtoparteffect==127) o->value(0);} - } {} - Fl_Button padeditbutton { - label edit - callback {partui->showparameters(n,2);} - xywh {560 0 40 15} box THIN_UP_BOX labelsize 11 - code0 {if (part->kit[n].Ppadenabled==0) o->deactivate();} - code1 {if (n==0) o->hide();} - } - Fl_Check_Button padcheck { - callback {part->kit[n].Ppadenabled=(int)o->value(); -if (part->kit[n].Ppadenabled!=0) padeditbutton->activate(); - else padeditbutton->deactivate();} - private xywh {540 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Ppadenabled);} - code1 {if (n==0) o->hide();} - } - } - Fl_Check_Button enabledcheck { - label 01 - callback {int answer=1; -if (o->value()==0) answer=fl_choice("Delete the item?","No","Yes",NULL); -if (answer!=0){ -pthread_mutex_lock(&master->mutex); - part->setkititemstatus(n,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if (o->value()==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); -o->redraw(); -partui->showparameters(n,-1);//use to delete the ui, if it is not to item 0 -} else o->value(1);} - private xywh {30 0 20 15} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 4 - code0 {snprintf(label,10,"%d",n+1);o->label(label);} - code1 {o->value(part->kit[n].Penabled);} - code2 {if (n==0) o->deactivate();} - } - } - } - Function {PartKitItem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0; -part=NULL;} {} - } - Function {refresh()} {} { - code {enabledcheck->value(part->kit[n].Penabled); -if (part->kit[n].Penabled==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); - -mutedcheck->value(part->kit[n].Pmuted); -labelbutton->label((char *)part->kit[n].Pname); -minkcounter->value(part->kit[n].Pminkey); -maxkcounter->value(part->kit[n].Pmaxkey); -adcheck->value(part->kit[n].Padenabled); -adcheck->do_callback(); -subcheck->value(part->kit[n].Psubenabled); -subcheck->do_callback(); - -sendtoeffect->value(part->kit[n].Psendtoparteffect+1); -if (part->kit[n].Psendtoparteffect==127) sendtoeffect->value(0); - -this->redraw();} { - callback {int answer=1; -if (o->value()==0) answer=fl_choice("Delete the item?","No","Yes",NULL); -if (answer!=0){ -pthread_mutex_lock(&master->mutex); - part->setkititemstatus(n,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if (o->value()==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); -o->redraw(); -partui->showparameters(n,-1);//use to delete the ui, if it is not to item 0 -} else o->value(1);} - } - } - Function {init(Part *part_,int n_,Master *master_,PartUI_ *partui_)} {} { - code {part=part_; -n=n_; -partui=partui_; -master=master_; -make_window(); -//partkititem->show(); -end();} {} - } - Function {~PartKitItem()} {} { - code {partkititem->hide(); -//delete(partkititem);} {} - } - decl {Part *part;} {} - decl {int n;} {} - decl {Master *master;} {} - decl {char label[10];} {} - decl {PartUI_ *partui;} {} -} - -class PartUI {: {public Fl_Group,PartUI_} -} { - Function {make_window()} {private - } { - Fl_Window partgroup { - private xywh {424 178 385 180} type Double hide - class Fl_Group - } { - Fl_Group partgroupui { - xywh {0 0 385 180} - code0 {if (part->Penabled==0) o->deactivate();} - } { - Fl_Dial {} { - label Pan - callback {part->setPpanning((int) o->value());} - xywh {50 40 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(part->Ppanning);} - class WidgetPDial - } - Fl_Counter {} { - label KeyShift - callback {part->Pkeyshift=(int) o->value()+64;} - xywh {195 45 90 20} labelsize 11 align 1 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(part->Pkeyshift-64);} - } - Fl_Scroll {} {open - xywh {166 91 125 60} box ENGRAVED_FRAME labelfont 1 labelsize 10 align 21 - } { - Fl_Pack {} {open - xywh {171 96 115 35} type HORIZONTAL - code0 {o->spacing(5);} - code1 {for (int i=0;iinit(master,npart,i);}} - } {} - } - Fl_Button {} { - label {Grand Piano} - callback {int event=Fl::event_button(); -if (event==FL_RIGHT_MOUSE){ - const char *tmp=fl_input("Instrument name:",(const char *)part->Pname); - if (tmp!=NULL) snprintf((char *)part->Pname,PART_MAX_NAME_LEN,"%s",tmp); -} else { - if (event==FL_LEFT_MOUSE) bankui->show(); - else instrumenteditwindow->show(); -};} - tooltip {left mousebutton - to choose/save/.. from/to bank or right mousebutton to change the name or middle button to change the instrument information} xywh {195 5 185 20} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 11 align 84 - code0 {o->label((char *)part->Pname);} - } - Fl_Box {} { - label {To Sys.Efx.} - xywh {166 81 95 10} labelfont 1 labelsize 10 - } - Fl_Check_Button {} { - label NoteOn - callback {part->Pnoteon=(int) o->value();} - tooltip {set if the part receives NoteOn messages} xywh {10 155 65 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(part->Pnoteon);} - } - Fl_Counter minkcounter { - label {Min.k} - callback {part->Pminkey=(int) o->value(); -if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Minimum key (that the part receives NoteOn messages)} xywh {295 125 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(part->Pminkey);} - } - Fl_Counter maxkcounter { - label {Max.k} - callback {part->Pmaxkey=(int) o->value(); - -if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Maximum key (that the part receives NoteOn messages)} xywh {340 125 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(part->Pmaxkey);} - } - Fl_Dial {} { - label Volume - callback {part->setPvolume((int) o->value());} - tooltip {Part Volume} xywh {10 35 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(part->Pvolume);} - class WidgetPDial - } - Fl_Dial {} { - label {Vel.Ofs.} - callback {part->Pveloffs=(int) o->value();} - tooltip {Velocity Offset} xywh {135 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(part->Pveloffs);} - class WidgetPDial - } - Fl_Dial {} { - label {Vel.Sns.} - callback {part->Pvelsns=(int) o->value();} - tooltip {Velocity Sensing Function} xywh {95 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(part->Pvelsns);} - class WidgetPDial - } - Fl_Button {} { - label Controllers - callback {ctlwindow->show();} - xywh {295 90 85 30} box PLASTIC_UP_BOX labelfont 1 labelsize 11 - } - Fl_Check_Button {} { - label Portamento - callback {part->ctl.portamento.portamento=(int) o->value();} - tooltip {Enable/Disable the portamento} xywh {95 155 88 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(part->ctl.portamento.portamento);} - } - Fl_Button {} { - label {Edit instrument} - callback {instrumenteditwindow->show();} - xywh {15 90 130 30} box PLASTIC_UP_BOX color 230 labelfont 1 labelsize 13 - } - Fl_Button {} { - label m - callback {if (part->lastnote>=0) minkcounter->value(part->lastnote); -minkcounter->do_callback(); -maxkcounter->do_callback();} - tooltip {set the minimum key to the last pressed key} xywh {315 155 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label M - callback {if (part->lastnote>=0) maxkcounter->value(part->lastnote); -maxkcounter->do_callback(); -minkcounter->do_callback();} - tooltip {set the maximum key to the last pressed key} xywh {345 155 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label R - callback {minkcounter->value(0); -minkcounter->do_callback(); -maxkcounter->value(127); -maxkcounter->do_callback();} - tooltip {reset the minimum key to 0 and maximum key to 127} xywh {330 155 15 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Choice {} { - label {MIDI Chn.Rcv.} - callback {part->Prcvchn=(int) o->value();} open - tooltip {receive from Midi channel} xywh {310 45 70 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drms10");};} - code1 {o->value(part->Prcvchn);} - } {} - Fl_Choice keylimitlist { - label KLmt - callback {int val=0; -val=atoi(o->text()); -part->setkeylimit(val);} open - tooltip {Key Limit} xywh {215 155 50 20} down_box BORDER_BOX labelsize 10 align 8 textfont 1 textsize 10 - } {} - Fl_Choice {} { - label {Mode :} - callback {if ((int) o->value()==0){ /* Poly (implies no legato) */ - part->Ppolymode=1; - part->Plegatomode=0; -} else { - if ((int) o->value()==1){ /* Mono (implies no legato) */ - part->Ppolymode=0; - part->Plegatomode=0; - } else { - if ((int) o->value()==2){ /* Legato (implies mono) */ - part->Ppolymode=0; - part->Plegatomode=1; - }; - }; -};} open - tooltip {Poly, Mono or Legato mode} xywh {80 130 64 18} down_box BORDER_BOX labelfont 1 labelsize 11 textfont 1 textsize 10 - code0 {o->add("Poly"); o->add("Mono"); o->add("Legato");} - code1 {if (part->Ppolymode!=0) o->value(0); else o->value(1);} - code2 {if (part->Ppolymode==0 && part->Plegatomode!=0) o->value(2);} - } {} - } - Fl_Check_Button {} { - label Enabled - callback {pthread_mutex_lock(&master->mutex); -master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); -if (part->Penabled==0) partgroupui->deactivate(); - else partgroupui->activate();} - xywh {90 5 75 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(part->Penabled);} - } - } - Fl_Window ctlwindow { - label Controllers - private xywh {542 212 500 130} type Double hide - } { - Fl_Check_Button {} { - label Expr - callback {part->ctl.expression.receive=(int) o->value();} - tooltip {Expression enable} xywh {155 55 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.expression.receive);} - } - Fl_Dial {} { - label PanDpth - callback {part->ctl.panning.depth=(int) o->value();} - tooltip {Panning Depth} xywh {10 55 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.panning.depth);} - class WidgetPDial - } - Fl_Dial {} { - label FltCut - callback {part->ctl.filtercutoff.depth=(int) o->value();} - tooltip {Filter Cutoff depth} xywh {90 55 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.filtercutoff.depth);} - class WidgetPDial - } - Fl_Dial {} { - label FltQ - callback {part->ctl.filterq.depth=(int) o->value();} - tooltip {Filter Q depth} xywh {50 55 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.filterq.depth);} - class WidgetPDial - } - Fl_Dial {} { - label BwDpth - callback {part->ctl.bandwidth.depth=(int) o->value();} - tooltip {BandWidth depth} xywh {125 10 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.bandwidth.depth);} - class WidgetPDial - } - Fl_Dial {} { - label ModWh - callback {part->ctl.modwheel.depth=(int) o->value();} - tooltip {Modulation Wheel depth} xywh {50 10 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.modwheel.depth);} - class WidgetPDial - } - Fl_Counter {} { - label {PWheelB.Rng (cents)} - callback {part->ctl.pitchwheel.bendrange=(int) o->value();} - tooltip {Pitch Wheel Bend Range (cents)} xywh {165 15 110 20} labelsize 10 align 1 minimum -6400 maximum 6400 step 1 - code0 {o->value(part->ctl.pitchwheel.bendrange);} - code1 {o->lstep(100);} - } - Fl_Check_Button {} { - label FMamp - callback {part->ctl.fmamp.receive=(int) o->value();} - tooltip {FM amplitude enable} xywh {205 55 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.fmamp.receive);} - } - Fl_Check_Button {} { - label Vol - callback {part->ctl.volume.receive=(int) o->value();} - tooltip {Volume enable} xywh {155 80 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.volume.receive);} - } - Fl_Check_Button {} { - label Sustain - callback {part->ctl.sustain.receive=(int) o->value(); -if (part->ctl.sustain.receive==0) { - part->RelaseSustainedKeys(); - part->ctl.setsustain(0); -};} - tooltip {Sustain pedal enable} xywh {205 80 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.sustain.receive);} - } - Fl_Button {} { - label Close - callback {ctlwindow->hide();} - xywh {330 105 95 20} box THIN_UP_BOX - } - Fl_Button {} { - label {Reset all controllers} - callback {part->SetController(C_resetallcontrollers,0);} - xywh {5 105 210 20} box THIN_UP_BOX - } - Fl_Group {} { - label Portamento - xywh {280 15 160 90} box ENGRAVED_FRAME labelfont 1 labelsize 10 - } { - Fl_Check_Button {} { - label Rcv - callback {part->ctl.portamento.receive=(int) o->value();} - tooltip {Receive Portamento Controllers} xywh {285 20 40 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.portamento.receive);} - } - Fl_Dial {} { - label time - callback {part->ctl.portamento.time=(int) o->value();} - tooltip {Portamento time} xywh {285 60 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.time);} - class WidgetPDial - } - Fl_Counter {} { - label thresh - callback {part->ctl.portamento.pitchthresh=(int) o->value();} - tooltip {Minimum or max. difference of the notes in order to do the portamento (x 100 cents)} xywh {340 20 50 20} type Simple labelsize 10 minimum 0 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.pitchthresh);} - } - Fl_Check_Button {} { - label {th.type} - callback {part->ctl.portamento.pitchthreshtype=(int) o->value();} - tooltip {Threshold type (min/max)} xywh {365 70 15 15} down_box DOWN_BOX labelsize 10 align 2 - code0 {o->value(part->ctl.portamento.pitchthreshtype);} - } - Fl_Box {} { - label {x100 cnt.} - xywh {340 50 55 15} labelsize 10 align 16 - } - Fl_Dial {} { - label {t.dn/up} - callback {int x=(int) o->value(); - -part->ctl.portamento.updowntimestretch=x;} - tooltip {Portamento time stretch (up/down)} xywh {315 60 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.updowntimestretch);} - class WidgetPDial - } - Fl_Dial propta { - label {Prp.Rate} - callback {part->ctl.portamento.propRate=(int) o->value();} - tooltip {Distance required to double change from nonpropotinal portamento time} xywh {405 20 25 25} labelsize 9 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.propRate);} - class WidgetPDial - } - Fl_Dial proptb { - label {Prp.Dpth} - callback {part->ctl.portamento.propDepth=(int) o->value();} - tooltip {The difference from nonproportinal portamento} xywh {405 60 25 25} labelsize 9 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.propDepth);} - class WidgetPDial - } - Fl_Check_Button {} { - label {Proprt.} - callback {part->ctl.portamento.proportional=(int) o->value(); -if(o->value()){propta->activate();proptb->activate();} -else {propta->deactivate();proptb->deactivate();}} - tooltip {Enable Proportinal Portamento (over fixed Portamento)} xywh {285 40 50 15} box THIN_UP_BOX down_box DOWN_BOX labelsize 9 - code0 {o->value(part->ctl.portamento.proportional);} - code1 {if(o->value()){propta->activate();proptb->activate();}} - code2 {else {propta->deactivate();proptb->deactivate();}} - } - } - Fl_Group {} { - label Resonance - xywh {440 15 50 90} box ENGRAVED_BOX labelfont 1 labelsize 10 - } { - Fl_Dial {} { - label BWdpth - callback {part->ctl.resonancebandwidth.depth=(int) o->value();} - tooltip {BandWidth controller depth} xywh {450 60 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.resonancebandwidth.depth);} - class WidgetPDial - } - Fl_Dial {} { - label CFdpth - callback {part->ctl.resonancecenter.depth=(int) o->value();} - tooltip {Center Frequency controller Depth} xywh {450 20 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.resonancecenter.depth);} - class WidgetPDial - } - } - Fl_Check_Button {} { - label {Exp MWh} - callback {part->ctl.modwheel.exponential=(int) o->value();} - tooltip {Exponential modulation wheel} xywh {10 15 40 25} down_box DOWN_BOX labelsize 10 align 148 - code0 {o->value(part->ctl.modwheel.exponential);} - } - Fl_Check_Button {} { - label {Exp BW} - callback {part->ctl.bandwidth.exponential=(int) o->value();} - tooltip {Exponential BandWidth Controller} xywh {85 15 35 25} down_box DOWN_BOX labelsize 10 align 148 - code0 {o->value(part->ctl.bandwidth.exponential);} - } - } - Fl_Window partfx { - label {Part's Insert Effects} - private xywh {121 424 390 145} type Double hide - } { - Fl_Counter inseffnocounter { - label {FX No.} - callback {ninseff=(int) o->value()-1; -insefftype->value(part->partefx[ninseff]->geteffect()); -//insefftype->do_callback(); -inseffectui->refresh(part->partefx[ninseff]); -int x=part->Pefxroute[ninseff]; -if (x==127) x=1; -bypasseff->value(part->Pefxbypass[ninseff]); - -sendtochoice->value(x);} - xywh {5 110 80 20} type Simple labelfont 1 align 6 minimum 1 maximum 127 step 1 textfont 1 - code0 {o->bounds(1,NUM_PART_EFX);} - code1 {o->value(ninseff+1);} - } - Fl_Choice insefftype { - label EffType - callback {pthread_mutex_lock(part->mutex); -part->partefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(part->mutex); -inseffectui->refresh(part->partefx[ninseff]);} - xywh {155 110 70 15} down_box BORDER_BOX labelsize 10 align 6 - code0 {o->value(part->partefx[ninseff]->geteffect());} - } { - MenuItem {} { - label {No Effect} - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group inseffectuigroup { - xywh {5 5 380 100} box FLAT_BOX color 48 - } { - Fl_Group inseffectui { - xywh {5 5 380 95} - code0 {o->init(part->partefx[ninseff]);} - class EffUI - } {} - } - Fl_Button {} { - label Close - callback {partfx->hide();} - xywh {325 115 60 20} box THIN_UP_BOX - } - Fl_Choice sendtochoice { - label {Send To.} - callback {int x=(int) o->value(); -part->Pefxroute[ninseff]=x; -if (x==2) part->partefx[ninseff]->setdryonly(true); - else part->partefx[ninseff]->setdryonly(false);} - xywh {235 110 80 15} down_box BORDER_BOX labelsize 10 align 6 - code0 {int x=part->Pefxroute[ninseff]; if (x==127) x=1;} - code1 {o->value(x);} - } { - MenuItem {} { - label {Next Effect} - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Part Out} - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Dry Out} - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - } - Fl_Check_Button bypasseff { - label bypass - callback {part->Pefxbypass[ninseff]=(((int)o->value())!=0);} - tooltip {if the effect is not used (is bypassed)} xywh {90 110 60 15} down_box DOWN_BOX labelsize 11 - code0 {int x=part->Pefxbypass[ninseff];o->value(x);} - } - Fl_Button {} { - label C - callback {presetsui->copy(part->partefx[ninseff]);} - xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(part->partefx[ninseff],inseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - Fl_Window instrumentkitlist { - label {Instrument Kit} - xywh {113 324 670 370} type Double hide - } { - Fl_Button {} { - label {Close Window} - callback {instrumentkitlist->hide();} - xywh {375 350 160 20} box THIN_UP_BOX - } - Fl_Scroll kitlist { - xywh {0 15 670 330} type VERTICAL box THIN_UP_BOX - code0 {if (part->Pkitmode==0) o->deactivate();} - } { - Fl_Pack {} { - xywh {0 20 670 320} - code0 {for (int i=0;iinit(part,i,master,this);}} - } {} - } - Fl_Box {} { - label {No.} - xywh {5 0 25 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label {M.} - xywh {55 0 25 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label {Min.k} - xywh {235 0 40 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label {Max.k} - xywh {345 0 40 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label ADsynth - xywh {405 0 50 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label SUBsynth - xywh {470 0 60 15} labelfont 1 labelsize 11 align 18 - } - Fl_Choice {} { - label Mode - callback {part->Pkitmode=(int) o->value(); -if (part->Pkitmode==0) { - kitlist->deactivate(); - } else { - kitlist->activate(); -};} - xywh {35 350 70 15} down_box BORDER_BOX labelsize 11 textfont 1 textsize 11 - code0 {o->value(part->Pkitmode);} - } { - MenuItem {} { - label OFF - xywh {0 0 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label MULTI - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label SINGLE - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - } - Fl_Check_Button {} { - label {Drum mode} - callback {part->Pdrummode=(int) o->value();} - xywh {285 350 70 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(part->Pdrummode);} - } - Fl_Box {} { - label {FX.r.} - xywh {620 0 30 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label PADsynth - xywh {540 0 60 15} labelfont 1 labelsize 11 align 18 - } - } - Fl_Window instrumenteditwindow { - label {Instrument Edit} selected - xywh {182 214 395 360} type Double hide - } { - Fl_Group {} { - xywh {0 220 395 110} box ENGRAVED_FRAME - } { - Fl_Group {} { - label PADsynth - xywh {205 245 100 80} box ENGRAVED_FRAME labelfont 1 - } { - Fl_Button padeditbutton { - label Edit - callback {showparameters(0,2);} - xywh {215 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 13 align 128 - code0 {if (part->kit[0].Ppadenabled==0) o->deactivate();} - } - Fl_Check_Button padsynenabledcheck { - label Enabled - callback {int x=(int) o->value(); -part->kit[0].Ppadenabled=x; -if (x==0) padeditbutton->deactivate(); - else padeditbutton->activate();} - tooltip {enable/disable PADsynth} xywh {215 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 11 - code1 {o->value(part->kit[0].Ppadenabled);} - } - } - Fl_Group {} { - label ADDsynth - xywh {5 245 100 80} box ENGRAVED_FRAME labelfont 1 - } { - Fl_Check_Button adsynenabledcheck { - label Enabled - callback {int x=(int) o->value(); -part->kit[0].Padenabled=x; -if (x==0) adeditbutton->deactivate(); - else adeditbutton->activate();} - tooltip {enable/disable ADsynth} xywh {15 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 11 - code1 {o->value(part->kit[0].Padenabled);} - } - Fl_Button adeditbutton { - label Edit - callback {showparameters(0,0);} - xywh {15 281 80 34} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 13 align 128 - code0 {if (part->kit[0].Padenabled==0) o->deactivate();} - } - } - Fl_Group {} { - label SUBsynth - xywh {105 245 100 80} box ENGRAVED_FRAME labelfont 1 - } { - Fl_Check_Button subsynenabledcheck { - label Enabled - callback {int x=(int) o->value(); -part->kit[0].Psubenabled=x; -if (x==0) subeditbutton->deactivate(); - else subeditbutton->activate();} - tooltip {enable/disable SUBsynth} xywh {115 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 11 - code1 {o->value(part->kit[0].Psubenabled);} - } - Fl_Button subeditbutton { - label Edit - callback {showparameters(0,1);} - xywh {115 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 13 align 128 - code0 {if (part->kit[0].Psubenabled==0) o->deactivate();} - } - } - Fl_Button {} { - label {Kit Edit} - callback {instrumentkitlist->show();} - xywh {310 245 80 35} box PLASTIC_UP_BOX color 238 selection_color 220 labelfont 1 align 128 - } - Fl_Button {} { - label Effects - callback {partfx->show();} - xywh {310 290 80 35} box PLASTIC_UP_BOX color 230 labelfont 1 labelsize 13 - } - } - Fl_Group {} { - xywh {0 5 395 215} box ENGRAVED_FRAME - } { - Fl_Input {} { - label {Author and Copyright} - callback {snprintf((char *)part->info.Pauthor,MAX_INFO_TEXT_SIZE,"%s",o->value());} - xywh {5 60 385 50} type Multiline color 26 labelsize 10 align 5 - code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} - code1 {o->value((char *) &part->info.Pauthor);} - } - Fl_Input {} { - label Comments - callback {snprintf((char *)part->info.Pcomments,MAX_INFO_TEXT_SIZE,"%s",o->value());} - xywh {5 125 385 90} type Multiline color 26 labelsize 11 align 5 - code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} - code1 {o->value((char *) &part->info.Pcomments);} - } - Fl_Choice {} { - label {Type:} - callback {part->info.Ptype=o->value();} - xywh {5 25 155 20} down_box BORDER_BOX labelfont 1 labelsize 11 align 5 textsize 10 - code0 {o->value(part->info.Ptype);} - } { - MenuItem {} { - label {--------------------------} - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Piano - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Chromatic Percussion} - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Organ - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Guitar - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Bass - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Solo Strings} - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Ensemble - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Brass - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Reed - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Pipe - xywh {100 100 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Synth Lead} - xywh {110 110 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Synth Pad} - xywh {120 120 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Synth Effects} - xywh {130 130 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Ethnic - xywh {140 140 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Percussive - xywh {150 150 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Sound Effects} - xywh {160 160 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Button {} { - label Close - callback {instrumenteditwindow->hide();} - xywh {150 335 95 25} box THIN_UP_BOX - } - } - } - Function {PartUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {part=NULL; -adnoteui=NULL; -subnoteui=NULL; -padnoteui=NULL; -lastkititem=-1;} {} - } - Function {init(Part *part_,Master *master_,int npart_,BankUI *bankui_)} {} { - code {bankui=bankui_; -part=part_; -npart=npart_; -master=master_; -ninseff=0; - -make_window(); -partgroup->position(this->parent()->x()+2,this->parent()->y()+2); -partgroup->show(); -end(); - - -//if (config.ui.showinstrumentinfo!=0) instrumenteditwindow->show(); - -int klimits[]={1,2,3,4,5,6,7,8,9,10,15,20,30,50,100,0}; - -keylimitlist->add("OFF"); -int k=0; -int val=-1; -char tmp[10]; -while (klimits[k]!=0){ - sprintf(tmp,"%d",klimits[k]); - keylimitlist->add(tmp); - if (val==-1){ - if (klimits[k]>part->Pkeylimit) val=k; - }; - k++; -}; - -if (val==-1) val=k; -keylimitlist->value(val);} {} - } - Function {showparameters(int kititem,int engine)} {} { - code {if (engine==-1){//this is used if I want to clear the engine from the part - if (kititem==lastkititem) kititem=-1; - else kititem=lastkititem; -}; - -if (kititem!=lastkititem){ - if (adnoteui!=NULL) delete (adnoteui); - if (subnoteui!=NULL) delete (subnoteui); - if (padnoteui!=NULL) delete (padnoteui); - adnoteui=NULL;subnoteui=NULL;padnoteui=NULL; - lastkititem=kititem; - - if (kititem>=NUM_KIT_ITEMS) return;//bad kit item - if (kititem<0) return; - - if (part->kit[kititem].adpars!=NULL) - adnoteui=new ADnoteUI(part->kit[kititem].adpars,master); - - if (part->kit[kititem].subpars!=NULL) - subnoteui=new SUBnoteUI(part->kit[kititem].subpars); - - if (part->kit[kititem].padpars!=NULL) - padnoteui=new PADnoteUI(part->kit[kititem].padpars,master); - -}; - - - -if ((engine==0)&&(adnoteui!=NULL)) adnoteui->ADnoteGlobalParameters->show(); -if ((engine==1)&&(subnoteui!=NULL)) subnoteui->SUBparameters->show(); -if ((engine==2)&&(adnoteui!=NULL)) padnoteui->padnotewindow->show();} {} - } - Function {~PartUI()} {} { - code {if (adnoteui!=NULL) delete (adnoteui); -if (subnoteui!=NULL) delete (subnoteui); -if (padnoteui!=NULL) delete (padnoteui); - -partgroup->hide(); -//delete(partgroup); - -ctlwindow->hide(); -delete(ctlwindow); - -partfx->hide(); -delete(partfx); - -instrumentkitlist->hide(); -delete(instrumentkitlist); - -instrumenteditwindow->hide(); -delete(instrumenteditwindow);} {} - } - decl {Part *part;} {} - decl {Master *master;} {} - decl {BankUI *bankui;} {} - decl {ADnoteUI *adnoteui;} {} - decl {SUBnoteUI *subnoteui;} {} - decl {PADnoteUI *padnoteui;} {} - decl {PartSysEffSend *psyef[NUM_SYS_EFX];} {} - decl {int npart;} {} - decl {int ninseff;} {} - decl {int lastkititem;} {} - decl {PartKitItem *partkititem[NUM_KIT_ITEMS];} {} -} diff --git a/plugins/zynaddsubfx/src/UI/PartUI.h b/plugins/zynaddsubfx/src/UI/PartUI.h deleted file mode 100644 index 6e3f1ada9..000000000 --- a/plugins/zynaddsubfx/src/UI/PartUI.h +++ /dev/null @@ -1,338 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef PartUI_h -#define PartUI_h -#include -#include -#include -#include -#include "WidgetPDial.h" -#include "EffUI.h" -#include "BankUI.h" -#include "ADnoteUI.h" -#include "SUBnoteUI.h" -#include "PADnoteUI.h" -#include "../Misc/Config.h" -#include "../Misc/Master.h" -#include "../Misc/Part.h" - -class PartSysEffSend : public Fl_Group { - Fl_Group* make_window(); - Fl_Group *syseffsend; - void cb_01_i(WidgetPDial*, void*); - static void cb_01(WidgetPDial*, void*); -public: - PartSysEffSend(int x,int y, int w, int h, const char *label=0); - void init(Master *master_,int npart_,int neff_); - ~PartSysEffSend(); -private: - Master *master; - int neff; - int npart; -}; - -class PartUI_ { -public: - virtual void showparameters(int kititem,int engine); -}; -#include -#include -#include -#include -#include - -class PartKitItem : public Fl_Group { - Fl_Group* make_window(); - Fl_Group *partkititem; - Fl_Group *partkititemgroup; -public: - Fl_Counter *minkcounter; -private: - void cb_minkcounter_i(Fl_Counter*, void*); - static void cb_minkcounter(Fl_Counter*, void*); - void cb_m_i(Fl_Button*, void*); - static void cb_m(Fl_Button*, void*); - void cb_M_i(Fl_Button*, void*); - static void cb_M(Fl_Button*, void*); - void cb_R_i(Fl_Button*, void*); - static void cb_R(Fl_Button*, void*); -public: - Fl_Button *adeditbutton; -private: - void cb_adeditbutton_i(Fl_Button*, void*); - static void cb_adeditbutton(Fl_Button*, void*); -public: - Fl_Button *subeditbutton; -private: - void cb_subeditbutton_i(Fl_Button*, void*); - static void cb_subeditbutton(Fl_Button*, void*); - Fl_Check_Button *mutedcheck; - void cb_mutedcheck_i(Fl_Check_Button*, void*); - static void cb_mutedcheck(Fl_Check_Button*, void*); -public: - Fl_Counter *maxkcounter; -private: - void cb_maxkcounter_i(Fl_Counter*, void*); - static void cb_maxkcounter(Fl_Counter*, void*); -public: - Fl_Button *labelbutton; -private: - void cb_labelbutton_i(Fl_Button*, void*); - static void cb_labelbutton(Fl_Button*, void*); - Fl_Check_Button *adcheck; - void cb_adcheck_i(Fl_Check_Button*, void*); - static void cb_adcheck(Fl_Check_Button*, void*); - Fl_Check_Button *subcheck; - void cb_subcheck_i(Fl_Check_Button*, void*); - static void cb_subcheck(Fl_Check_Button*, void*); -public: - Fl_Choice *sendtoeffect; -private: - void cb_sendtoeffect_i(Fl_Choice*, void*); - static void cb_sendtoeffect(Fl_Choice*, void*); -public: - Fl_Button *padeditbutton; -private: - void cb_padeditbutton_i(Fl_Button*, void*); - static void cb_padeditbutton(Fl_Button*, void*); - Fl_Check_Button *padcheck; - void cb_padcheck_i(Fl_Check_Button*, void*); - static void cb_padcheck(Fl_Check_Button*, void*); - Fl_Check_Button *enabledcheck; - void cb_enabledcheck_i(Fl_Check_Button*, void*); - static void cb_enabledcheck(Fl_Check_Button*, void*); -public: - PartKitItem(int x,int y, int w, int h, const char *label=0); - void refresh(); - void init(Part *part_,int n_,Master *master_,PartUI_ *partui_); - ~PartKitItem(); -private: - Part *part; - int n; - Master *master; - char label[10]; - PartUI_ *partui; -}; -#include -#include -#include -#include -#include - -class PartUI : public Fl_Group,PartUI_ { - Fl_Group* make_window(); - Fl_Group *partgroup; -public: - Fl_Group *partgroupui; -private: - void cb_Pan_i(WidgetPDial*, void*); - static void cb_Pan(WidgetPDial*, void*); - void cb_KeyShift_i(Fl_Counter*, void*); - static void cb_KeyShift(Fl_Counter*, void*); - void cb_Grand_i(Fl_Button*, void*); - static void cb_Grand(Fl_Button*, void*); - void cb_NoteOn_i(Fl_Check_Button*, void*); - static void cb_NoteOn(Fl_Check_Button*, void*); -public: - Fl_Counter *minkcounter; -private: - void cb_minkcounter1_i(Fl_Counter*, void*); - static void cb_minkcounter1(Fl_Counter*, void*); -public: - Fl_Counter *maxkcounter; -private: - void cb_maxkcounter1_i(Fl_Counter*, void*); - static void cb_maxkcounter1(Fl_Counter*, void*); - void cb_Volume_i(WidgetPDial*, void*); - static void cb_Volume(WidgetPDial*, void*); - void cb_Vel_i(WidgetPDial*, void*); - static void cb_Vel(WidgetPDial*, void*); - void cb_Vel1_i(WidgetPDial*, void*); - static void cb_Vel1(WidgetPDial*, void*); - void cb_Controllers_i(Fl_Button*, void*); - static void cb_Controllers(Fl_Button*, void*); - void cb_Portamento_i(Fl_Check_Button*, void*); - static void cb_Portamento(Fl_Check_Button*, void*); - void cb_Edit_i(Fl_Button*, void*); - static void cb_Edit(Fl_Button*, void*); - void cb_m1_i(Fl_Button*, void*); - static void cb_m1(Fl_Button*, void*); - void cb_M1_i(Fl_Button*, void*); - static void cb_M1(Fl_Button*, void*); - void cb_R1_i(Fl_Button*, void*); - static void cb_R1(Fl_Button*, void*); - void cb_MIDI_i(Fl_Choice*, void*); - static void cb_MIDI(Fl_Choice*, void*); -public: - Fl_Choice *keylimitlist; -private: - void cb_keylimitlist_i(Fl_Choice*, void*); - static void cb_keylimitlist(Fl_Choice*, void*); - void cb_Mode_i(Fl_Choice*, void*); - static void cb_Mode(Fl_Choice*, void*); - void cb_Enabled_i(Fl_Check_Button*, void*); - static void cb_Enabled(Fl_Check_Button*, void*); - Fl_Double_Window *ctlwindow; - void cb_Expr_i(Fl_Check_Button*, void*); - static void cb_Expr(Fl_Check_Button*, void*); - void cb_PanDpth_i(WidgetPDial*, void*); - static void cb_PanDpth(WidgetPDial*, void*); - void cb_FltCut_i(WidgetPDial*, void*); - static void cb_FltCut(WidgetPDial*, void*); - void cb_FltQ_i(WidgetPDial*, void*); - static void cb_FltQ(WidgetPDial*, void*); - void cb_BwDpth_i(WidgetPDial*, void*); - static void cb_BwDpth(WidgetPDial*, void*); - void cb_ModWh_i(WidgetPDial*, void*); - static void cb_ModWh(WidgetPDial*, void*); - void cb_PWheelB_i(Fl_Counter*, void*); - static void cb_PWheelB(Fl_Counter*, void*); - void cb_FMamp_i(Fl_Check_Button*, void*); - static void cb_FMamp(Fl_Check_Button*, void*); - void cb_Vol_i(Fl_Check_Button*, void*); - static void cb_Vol(Fl_Check_Button*, void*); - void cb_Sustain_i(Fl_Check_Button*, void*); - static void cb_Sustain(Fl_Check_Button*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_Reset_i(Fl_Button*, void*); - static void cb_Reset(Fl_Button*, void*); - void cb_Rcv_i(Fl_Check_Button*, void*); - static void cb_Rcv(Fl_Check_Button*, void*); - void cb_time_i(WidgetPDial*, void*); - static void cb_time(WidgetPDial*, void*); - void cb_thresh_i(Fl_Counter*, void*); - static void cb_thresh(Fl_Counter*, void*); - void cb_th_i(Fl_Check_Button*, void*); - static void cb_th(Fl_Check_Button*, void*); - void cb_t_i(WidgetPDial*, void*); - static void cb_t(WidgetPDial*, void*); -public: - WidgetPDial *propta; -private: - void cb_propta_i(WidgetPDial*, void*); - static void cb_propta(WidgetPDial*, void*); -public: - WidgetPDial *proptb; -private: - void cb_proptb_i(WidgetPDial*, void*); - static void cb_proptb(WidgetPDial*, void*); - void cb_Proprt_i(Fl_Check_Button*, void*); - static void cb_Proprt(Fl_Check_Button*, void*); - void cb_BWdpth_i(WidgetPDial*, void*); - static void cb_BWdpth(WidgetPDial*, void*); - void cb_CFdpth_i(WidgetPDial*, void*); - static void cb_CFdpth(WidgetPDial*, void*); - void cb_Exp_i(Fl_Check_Button*, void*); - static void cb_Exp(Fl_Check_Button*, void*); - void cb_Exp1_i(Fl_Check_Button*, void*); - static void cb_Exp1(Fl_Check_Button*, void*); - Fl_Double_Window *partfx; -public: - Fl_Counter *inseffnocounter; -private: - void cb_inseffnocounter_i(Fl_Counter*, void*); - static void cb_inseffnocounter(Fl_Counter*, void*); -public: - Fl_Choice *insefftype; -private: - void cb_insefftype_i(Fl_Choice*, void*); - static void cb_insefftype(Fl_Choice*, void*); - static Fl_Menu_Item menu_insefftype[]; -public: - Fl_Group *inseffectuigroup; - EffUI *inseffectui; -private: - void cb_Close1_i(Fl_Button*, void*); - static void cb_Close1(Fl_Button*, void*); -public: - Fl_Choice *sendtochoice; -private: - void cb_sendtochoice_i(Fl_Choice*, void*); - static void cb_sendtochoice(Fl_Choice*, void*); - static Fl_Menu_Item menu_sendtochoice[]; -public: - Fl_Check_Button *bypasseff; -private: - void cb_bypasseff_i(Fl_Check_Button*, void*); - static void cb_bypasseff(Fl_Check_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Double_Window *instrumentkitlist; -private: - void cb_Close2_i(Fl_Button*, void*); - static void cb_Close2(Fl_Button*, void*); -public: - Fl_Scroll *kitlist; -private: - void cb_Mode1_i(Fl_Choice*, void*); - static void cb_Mode1(Fl_Choice*, void*); - static Fl_Menu_Item menu_Mode[]; - void cb_Drum_i(Fl_Check_Button*, void*); - static void cb_Drum(Fl_Check_Button*, void*); -public: - Fl_Double_Window *instrumenteditwindow; - Fl_Button *padeditbutton; -private: - void cb_padeditbutton1_i(Fl_Button*, void*); - static void cb_padeditbutton1(Fl_Button*, void*); -public: - Fl_Check_Button *padsynenabledcheck; -private: - void cb_padsynenabledcheck_i(Fl_Check_Button*, void*); - static void cb_padsynenabledcheck(Fl_Check_Button*, void*); -public: - Fl_Check_Button *adsynenabledcheck; -private: - void cb_adsynenabledcheck_i(Fl_Check_Button*, void*); - static void cb_adsynenabledcheck(Fl_Check_Button*, void*); -public: - Fl_Button *adeditbutton; -private: - void cb_adeditbutton1_i(Fl_Button*, void*); - static void cb_adeditbutton1(Fl_Button*, void*); -public: - Fl_Check_Button *subsynenabledcheck; -private: - void cb_subsynenabledcheck_i(Fl_Check_Button*, void*); - static void cb_subsynenabledcheck(Fl_Check_Button*, void*); -public: - Fl_Button *subeditbutton; -private: - void cb_subeditbutton1_i(Fl_Button*, void*); - static void cb_subeditbutton1(Fl_Button*, void*); - void cb_Kit_i(Fl_Button*, void*); - static void cb_Kit(Fl_Button*, void*); - void cb_Effects_i(Fl_Button*, void*); - static void cb_Effects(Fl_Button*, void*); - void cb_Author_i(Fl_Input*, void*); - static void cb_Author(Fl_Input*, void*); - void cb_Comments_i(Fl_Input*, void*); - static void cb_Comments(Fl_Input*, void*); - void cb_Type_i(Fl_Choice*, void*); - static void cb_Type(Fl_Choice*, void*); - static Fl_Menu_Item menu_Type[]; - void cb_Close3_i(Fl_Button*, void*); - static void cb_Close3(Fl_Button*, void*); -public: - PartUI(int x,int y, int w, int h, const char *label=0); - void init(Part *part_,Master *master_,int npart_,BankUI *bankui_); - void showparameters(int kititem,int engine); - ~PartUI(); -private: - Part *part; - Master *master; - BankUI *bankui; - ADnoteUI *adnoteui; - SUBnoteUI *subnoteui; - PADnoteUI *padnoteui; - PartSysEffSend *psyef[NUM_SYS_EFX]; - int npart; - int ninseff; - int lastkititem; - PartKitItem *partkititem[NUM_KIT_ITEMS]; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/PresetsUI.cc b/plugins/zynaddsubfx/src/UI/PresetsUI.cc deleted file mode 100644 index 56be5f4a1..000000000 --- a/plugins/zynaddsubfx/src/UI/PresetsUI.cc +++ /dev/null @@ -1,274 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "PresetsUI.h" -#include "../Params/PresetsArray.h" - -void PresetsUI_::refresh() { - ; -} - -PresetsUI_::~PresetsUI_() { - ; -} - -void PresetsUI::cb_copybrowse_i(Fl_Browser* o, void*) { - int val=o->value(); -if (val!=0){ - presetname->cut(0,presetname->maximum_size()); - presetname->insert(o->text(val)); -}; -} -void PresetsUI::cb_copybrowse(Fl_Browser* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_copybrowse_i(o,v); -} - -void PresetsUI::cb_copypbutton_i(Fl_Button*, void*) { - const char *tmp=presetname->value(); -if (tmp!=NULL) { - if (strlen(tmp)>0){ - p->copy(tmp); - copywin->hide(); - }; -}; -} -void PresetsUI::cb_copypbutton(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_copypbutton_i(o,v); -} - -void PresetsUI::cb_copybutton_i(Fl_Button*, void*) { - p->copy(NULL); -copywin->hide(); -} -void PresetsUI::cb_copybutton(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_copybutton_i(o,v); -} - -void PresetsUI::cb_Cancel_i(Fl_Button*, void*) { - copywin->hide(); -} -void PresetsUI::cb_Cancel(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_Cancel_i(o,v); -} - -void PresetsUI::cb_presetname_i(Fl_Input* o, void*) { - const char *tmp=o->value(); -if (tmp==NULL) tmp=""; -if (strlen(tmp)>0) { - copybutton->deactivate(); - copypbutton->activate(); -} else { - copybutton->activate(); - copypbutton->deactivate(); -}; -} -void PresetsUI::cb_presetname(Fl_Input* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_presetname_i(o,v); -} - -void PresetsUI::cb_pastebrowse_i(Fl_Browser* o, void*) { - if (o->value()==0) { - pastepbutton->deactivate(); - deletepbutton->deactivate(); -}else{ - pastepbutton->activate(); - deletepbutton->activate(); -}; -} -void PresetsUI::cb_pastebrowse(Fl_Browser* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_pastebrowse_i(o,v); -} - -void PresetsUI::cb_pastepbutton_i(Fl_Button*, void*) { - int n=pastebrowse->value(); -if (n!=0) p->paste(n); -pastewin->hide(); -pui->refresh(); -} -void PresetsUI::cb_pastepbutton(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_pastepbutton_i(o,v); -} - -void PresetsUI::cb_pastebutton_i(Fl_Button*, void*) { - p->paste(0); -pastewin->hide(); -pui->refresh(); -} -void PresetsUI::cb_pastebutton(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_pastebutton_i(o,v); -} - -void PresetsUI::cb_Cancel1_i(Fl_Button*, void*) { - pastewin->hide(); -} -void PresetsUI::cb_Cancel1(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_Cancel1_i(o,v); -} - -void PresetsUI::cb_deletepbutton_i(Fl_Button*, void*) { - int n=pastebrowse->value(); -if (n!=0) p->deletepreset(n); -rescan(); -} -void PresetsUI::cb_deletepbutton(Fl_Button* o, void* v) { - ((PresetsUI*)(o->parent()->user_data()))->cb_deletepbutton_i(o,v); -} - -PresetsUI::PresetsUI() { - p=NULL; - make_window(); -} - -PresetsUI::~PresetsUI() { - copywin->hide();delete(copywin); - pastewin->hide();delete(pastewin); -} - -Fl_Double_Window* PresetsUI::make_window() { - { copywin = new Fl_Double_Window(265, 430, "Copy to Clipboard/Preset"); - copywin->box(FL_PLASTIC_THIN_UP_BOX); - copywin->color((Fl_Color)238); - copywin->user_data((void*)(this)); - { copybrowse = new Fl_Browser(10, 25, 245, 320); - copybrowse->type(1); - copybrowse->callback((Fl_Callback*)cb_copybrowse); - } // Fl_Browser* copybrowse - { copypbutton = new Fl_Button(145, 355, 110, 20, "Copy to Preset"); - copypbutton->box(FL_THIN_UP_BOX); - copypbutton->callback((Fl_Callback*)cb_copypbutton); - } // Fl_Button* copypbutton - { copybutton = new Fl_Button(25, 385, 90, 35, "Copy to Clipboard"); - copybutton->box(FL_THIN_UP_BOX); - copybutton->callback((Fl_Callback*)cb_copybutton); - copybutton->align(Fl_Align(192)); - } // Fl_Button* copybutton - { Fl_Button* o = new Fl_Button(160, 385, 80, 35, "Cancel"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Cancel); - o->align(Fl_Align(192)); - } // Fl_Button* o - { Fl_Box* o = new Fl_Box(10, 5, 40, 15, "Type:"); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { copytypetext = new Fl_Box(50, 5, 205, 15); - copytypetext->box(FL_FLAT_BOX); - copytypetext->color((Fl_Color)238); - copytypetext->labelfont(1); - copytypetext->labelsize(11); - copytypetext->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - } // Fl_Box* copytypetext - { presetname = new Fl_Input(10, 355, 130, 20); - presetname->callback((Fl_Callback*)cb_presetname); - presetname->when(FL_WHEN_CHANGED); - } // Fl_Input* presetname - copywin->set_modal(); - copywin->end(); - } // Fl_Double_Window* copywin - { pastewin = new Fl_Double_Window(265, 430, "Paste from Clipboard/Preset"); - pastewin->box(FL_PLASTIC_THIN_UP_BOX); - pastewin->color((Fl_Color)238); - pastewin->user_data((void*)(this)); - { pastebrowse = new Fl_Browser(10, 25, 245, 320); - pastebrowse->type(2); - pastebrowse->callback((Fl_Callback*)cb_pastebrowse); - } // Fl_Browser* pastebrowse - { pastepbutton = new Fl_Button(10, 355, 160, 20, "Paste from Preset"); - pastepbutton->box(FL_THIN_UP_BOX); - pastepbutton->callback((Fl_Callback*)cb_pastepbutton); - } // Fl_Button* pastepbutton - { pastebutton = new Fl_Button(25, 385, 90, 35, "Paste from Clipboard"); - pastebutton->box(FL_THIN_UP_BOX); - pastebutton->callback((Fl_Callback*)cb_pastebutton); - pastebutton->align(Fl_Align(192)); - } // Fl_Button* pastebutton - { Fl_Button* o = new Fl_Button(160, 385, 80, 35, "Cancel"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Cancel1); - o->align(Fl_Align(192)); - } // Fl_Button* o - { pastetypetext = new Fl_Box(55, 5, 200, 15); - pastetypetext->box(FL_FLAT_BOX); - pastetypetext->color((Fl_Color)238); - pastetypetext->labelfont(1); - pastetypetext->labelsize(11); - pastetypetext->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - } // Fl_Box* pastetypetext - { Fl_Box* o = new Fl_Box(15, 5, 40, 15, "Type:"); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { deletepbutton = new Fl_Button(180, 355, 75, 20, "Delete"); - deletepbutton->box(FL_THIN_UP_BOX); - deletepbutton->callback((Fl_Callback*)cb_deletepbutton); - } // Fl_Button* deletepbutton - pastewin->set_modal(); - pastewin->end(); - } // Fl_Double_Window* pastewin - return pastewin; -} - -void PresetsUI::copy(Presets *p) { - copybutton->activate(); - copypbutton->deactivate(); - - - this->p=p; - this->pui=NULL; - bool but=(Fl::event_button()!=FL_LEFT_MOUSE); - presetname->cut(0,presetname->maximum_size()); - - if (but) p->copy(NULL); - else { - rescan(); - copytypetext->label(&p->type[1]); - copywin->show(); - }; -} - -void PresetsUI::paste(Presets *p,PresetsUI_ *pui) { - this->p=p; - this->pui=pui; - bool but=(Fl::event_button()!=FL_LEFT_MOUSE); - pastepbutton->deactivate(); - deletepbutton->deactivate(); - - if (but) { - p->paste(0); - pui->refresh(); - } else { - rescan(); - pastetypetext->label(&p->type[1]); - if (p->checkclipboardtype()) pastebutton->activate(); - else pastebutton->deactivate(); - pastewin->show(); - }; -} - -void PresetsUI::copy(Presets *p,int n) { - PresetsArray *pre = dynamic_cast(p); - if(pre) - pre->setelement(n); - copy(p); -} - -void PresetsUI::paste(Presets *p,PresetsUI_ *pui,int n) { - PresetsArray *pre = dynamic_cast(p); - if(pre) - pre->setelement(n); - paste(p,pui); -} - -void PresetsUI::rescan() { - copybrowse->clear(); - pastebrowse->clear(); - p->rescanforpresets(); - - for (unsigned int i=0;iadd(name.c_str()); - pastebrowse->add(name.c_str()); - }; -} -PresetsUI *presetsui; diff --git a/plugins/zynaddsubfx/src/UI/PresetsUI.fl b/plugins/zynaddsubfx/src/UI/PresetsUI.fl deleted file mode 100644 index adf8da050..000000000 --- a/plugins/zynaddsubfx/src/UI/PresetsUI.fl +++ /dev/null @@ -1,208 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/PresetsArray.h"} {} - -decl {\#include "../Params/Presets.h"} {public -} - -class PresetsUI_ {} { - Function {refresh()} {open return_type {virtual void} - } {code{;}} - Function {~PresetsUI_()} {open return_type virtual - } {code{;}} -} - -class PresetsUI {} { - Function {PresetsUI()} {} { - code {p=NULL; -make_window();} {} - } - Function {~PresetsUI()} {} { - code {copywin->hide();delete(copywin); -pastewin->hide();delete(pastewin);} {} - } - Function {make_window()} {} { - Fl_Window copywin { - label {Copy to Clipboard/Preset} - xywh {190 173 265 430} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal - } { - Fl_Browser copybrowse { - callback {int val=o->value(); -if (val!=0){ - presetname->cut(0,presetname->maximum_size()); - presetname->insert(o->text(val)); -};} - xywh {10 25 245 320} type Select - } - Fl_Button copypbutton { - label {Copy to Preset} - callback {const char *tmp=presetname->value(); -if (tmp!=NULL) { - if (strlen(tmp)>0){ - p->copy(tmp); - copywin->hide(); - }; -};} - xywh {145 355 110 20} box THIN_UP_BOX - } - Fl_Button copybutton { - label {Copy to Clipboard} - callback {p->copy(NULL); -copywin->hide();} - xywh {25 385 90 35} box THIN_UP_BOX align 192 - } - Fl_Button {} { - label Cancel - callback {copywin->hide();} - xywh {160 385 80 35} box THIN_UP_BOX align 192 - } - Fl_Box {} { - label {Type:} - xywh {10 5 40 15} labelsize 11 align 20 - } - Fl_Box copytypetext { - xywh {50 5 205 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20 - } - Fl_Input presetname { - callback {const char *tmp=o->value(); -if (tmp==NULL) tmp=""; -if (strlen(tmp)>0) { - copybutton->deactivate(); - copypbutton->activate(); -} else { - copybutton->activate(); - copypbutton->deactivate(); -};} - xywh {10 355 130 20} when 1 - } - } - Fl_Window pastewin { - label {Paste from Clipboard/Preset} - xywh {463 173 265 430} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal - } { - Fl_Browser pastebrowse { - callback {if (o->value()==0) { - pastepbutton->deactivate(); - deletepbutton->deactivate(); -}else{ - pastepbutton->activate(); - deletepbutton->activate(); -};} - xywh {10 25 245 320} type Hold - } - Fl_Button pastepbutton { - label {Paste from Preset} - callback {int n=pastebrowse->value(); -if (n!=0) p->paste(n); -pastewin->hide(); -pui->refresh();} - xywh {10 355 160 20} box THIN_UP_BOX - } - Fl_Button pastebutton { - label {Paste from Clipboard} - callback {p->paste(0); -pastewin->hide(); -pui->refresh();} - xywh {25 385 90 35} box THIN_UP_BOX align 192 - } - Fl_Button {} { - label Cancel - callback {pastewin->hide();} - xywh {160 385 80 35} box THIN_UP_BOX align 192 - } - Fl_Box pastetypetext { - xywh {55 5 200 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20 - } - Fl_Box {} { - label {Type:} - xywh {15 5 40 15} labelsize 11 align 20 - } - Fl_Button deletepbutton { - label Delete - callback {int n=pastebrowse->value(); -if (n!=0) p->deletepreset(n); -rescan();} - xywh {180 355 75 20} box THIN_UP_BOX - } - } - } - Function {copy(Presets *p)} {} { - code {copybutton->activate(); -copypbutton->deactivate(); - - -this->p=p; -this->pui=NULL; -bool but=(Fl::event_button()!=FL_LEFT_MOUSE); -presetname->cut(0,presetname->maximum_size()); - -if (but) p->copy(NULL); - else { - rescan(); - copytypetext->label(&p->type[1]); - copywin->show(); - };} {} - } - Function {paste(Presets *p,PresetsUI_ *pui)} {} { - code {this->p=p; -this->pui=pui; -bool but=(Fl::event_button()!=FL_LEFT_MOUSE); -pastepbutton->deactivate(); -deletepbutton->deactivate(); - -if (but) { - p->paste(0); - pui->refresh(); -} else { - rescan(); - pastetypetext->label(&p->type[1]); - if (p->checkclipboardtype()) pastebutton->activate(); - else pastebutton->deactivate(); - pastewin->show(); - };} {} - } - Function {copy(Presets *p,int n)} {} { - code {PresetsArray *pre = dynamic_cast(p); -if(pre) - pre->setelement(n); -copy(p);} {} - } - Function {paste(Presets *p,PresetsUI_ *pui,int n)} {} { - code {PresetsArray *pre = dynamic_cast(p); -if(pre) - pre->setelement(n); -paste(p,pui);} {} - } - Function {rescan()} {} { - code {copybrowse->clear(); -pastebrowse->clear(); -p->rescanforpresets(); - -for (int i=0;iadd(name.c_str()); - pastebrowse->add(name.c_str()); -};} {selected - } - } - decl {Presets *p;} {public - } - decl {PresetsUI_ *pui;} {public - } -} - -decl {PresetsUI *presetsui;} {public -} diff --git a/plugins/zynaddsubfx/src/UI/PresetsUI.h b/plugins/zynaddsubfx/src/UI/PresetsUI.h deleted file mode 100644 index 4adf0f1c0..000000000 --- a/plugins/zynaddsubfx/src/UI/PresetsUI.h +++ /dev/null @@ -1,84 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef PresetsUI_h -#define PresetsUI_h -#include -#include -#include -#include -#include "../Params/Presets.h" - -class PresetsUI_ { -public: - virtual void refresh(); - virtual ~PresetsUI_(); -}; -#include -#include -#include -#include -#include - -class PresetsUI { -public: - PresetsUI(); - ~PresetsUI(); - Fl_Double_Window* make_window(); - Fl_Double_Window *copywin; - Fl_Browser *copybrowse; -private: - void cb_copybrowse_i(Fl_Browser*, void*); - static void cb_copybrowse(Fl_Browser*, void*); -public: - Fl_Button *copypbutton; -private: - void cb_copypbutton_i(Fl_Button*, void*); - static void cb_copypbutton(Fl_Button*, void*); -public: - Fl_Button *copybutton; -private: - void cb_copybutton_i(Fl_Button*, void*); - static void cb_copybutton(Fl_Button*, void*); - void cb_Cancel_i(Fl_Button*, void*); - static void cb_Cancel(Fl_Button*, void*); -public: - Fl_Box *copytypetext; - Fl_Input *presetname; -private: - void cb_presetname_i(Fl_Input*, void*); - static void cb_presetname(Fl_Input*, void*); -public: - Fl_Double_Window *pastewin; - Fl_Browser *pastebrowse; -private: - void cb_pastebrowse_i(Fl_Browser*, void*); - static void cb_pastebrowse(Fl_Browser*, void*); -public: - Fl_Button *pastepbutton; -private: - void cb_pastepbutton_i(Fl_Button*, void*); - static void cb_pastepbutton(Fl_Button*, void*); -public: - Fl_Button *pastebutton; -private: - void cb_pastebutton_i(Fl_Button*, void*); - static void cb_pastebutton(Fl_Button*, void*); - void cb_Cancel1_i(Fl_Button*, void*); - static void cb_Cancel1(Fl_Button*, void*); -public: - Fl_Box *pastetypetext; - Fl_Button *deletepbutton; -private: - void cb_deletepbutton_i(Fl_Button*, void*); - static void cb_deletepbutton(Fl_Button*, void*); -public: - void copy(Presets *p); - void paste(Presets *p,PresetsUI_ *pui); - void copy(Presets *p,int n); - void paste(Presets *p,PresetsUI_ *pui,int n); - void rescan(); - Presets *p; - PresetsUI_ *pui; -}; -extern PresetsUI *presetsui; -#endif diff --git a/plugins/zynaddsubfx/src/UI/ResonanceUI.cc b/plugins/zynaddsubfx/src/UI/ResonanceUI.cc deleted file mode 100644 index 3481134d9..000000000 --- a/plugins/zynaddsubfx/src/UI/ResonanceUI.cc +++ /dev/null @@ -1,553 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "ResonanceUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later -#include -#include -#include -#include - -ResonanceGraph::ResonanceGraph(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - respar=NULL; - cbwidget=NULL; - applybutton=NULL; -} - -void ResonanceGraph::init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_) { - respar=respar_; - khzvalue=khzvalue_; - dbvalue=dbvalue_; - oldx=-1; - khzval=-1; -} - -void ResonanceGraph::draw_freq_line(REALTYPE freq,int type) { - REALTYPE freqx=respar->getfreqpos(freq); - switch(type){ - case 0:fl_line_style(FL_SOLID);break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; - }; - - - if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h()); -} - -void ResonanceGraph::draw() { - int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; - REALTYPE freqx; - - fl_color(FL_BLACK); - fl_rectf(ox,oy,lx,ly); - - - //draw the lines - fl_color(FL_GRAY); - - fl_line_style(FL_SOLID); - fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - - freqx=respar->getfreqpos(1000.0); - if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - - for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; - }; - - draw_freq_line(10000.0,0); - draw_freq_line(20000.0,1); - - fl_line_style(FL_DOT); - int GY=10;if (lyPrespoints[0]/128.0*ly); - for (i=1;iPrespoints[i]/128.0*ly); - fl_line(ox+ix-1,oy+ly-oiy,ox+ix,oy+ly-iy); - oiy=iy; - }; -} - -int ResonanceGraph::handle(int event) { - int x_=Fl::event_x()-x(); - int y_=Fl::event_y()-y(); - if ( (x_>=0)&&(x_=0)&&(y_value(respar->getfreqx(x_*1.0/w())/1000.0); - dbvalue->value((1.0-y_*2.0/h())*respar->PmaxdB); - }; - - if ((event==FL_PUSH)||(event==FL_DRAG)){ - int leftbutton=1; - if (Fl::event_button()==FL_RIGHT_MOUSE) leftbutton=0; - if (x_<0) x_=0;if (y_<0) y_=0; - if (x_>=w()) x_=w();if (y_>=h()-1) y_=h()-1; - - if ((oldx<0)||(oldx==x_)){ - int sn=(int)(x_*1.0/w()*N_RES_POINTS); - int sp=127-(int)(y_*1.0/h()*127); - if (leftbutton!=0) respar->setpoint(sn,sp); - else respar->setpoint(sn,64); - } else { - int x1=oldx; - int x2=x_; - int y1=oldy; - int y2=y_; - if (oldx>x_){ - x1=x_;y1=y_; - x2=oldx;y2=oldy; - }; - for (int i=0;isetpoint(sn,sp); - else respar->setpoint(sn,64); - }; - }; - - oldx=x_;oldy=y_; - redraw(); - }; - - if (event==FL_RELEASE) { - oldx=-1; - if (cbwidget!=NULL) { - cbwidget->do_callback(); - if (applybutton!=NULL) { - applybutton->color(FL_RED); - applybutton->redraw(); - - }; - }; - }; - - return(1); -} - -void ResonanceGraph::setcbwidget(Fl_Widget *cbwidget,Fl_Widget *applybutton) { - this->cbwidget=cbwidget; - this->applybutton=applybutton; -} - -void ResonanceUI::cb_Close_i(Fl_Button*, void*) { - resonancewindow->hide(); -} -void ResonanceUI::cb_Close(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void ResonanceUI::cb_Zero_i(Fl_Button*, void*) { - for (int i=0;isetpoint(i,64); -resonancewindow->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_Zero(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_Zero_i(o,v); -} - -void ResonanceUI::cb_Smooth_i(Fl_Button*, void*) { - respar->smooth(); -resonancewindow->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_Smooth(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_Smooth_i(o,v); -} - -void ResonanceUI::cb_enabled_i(Fl_Check_Button* o, void*) { - respar->Penabled=(int) o->value(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_enabled(Fl_Check_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_enabled_i(o,v); -} - -void ResonanceUI::cb_maxdb_i(Fl_Roller* o, void*) { - maxdbvo->value(o->value()); -respar->PmaxdB=(int) o->value(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_maxdb(Fl_Roller* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_maxdb_i(o,v); -} - -void ResonanceUI::cb_maxdbvo_i(Fl_Value_Output* o, void*) { - o->value(respar->PmaxdB); -} -void ResonanceUI::cb_maxdbvo(Fl_Value_Output* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_maxdbvo_i(o,v); -} - -void ResonanceUI::cb_centerfreqvo_i(Fl_Value_Output* o, void*) { - o->value(respar->getcenterfreq()/1000.0); -} -void ResonanceUI::cb_centerfreqvo(Fl_Value_Output* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_centerfreqvo_i(o,v); -} - -void ResonanceUI::cb_octavesfreqvo_i(Fl_Value_Output* o, void*) { - o->value(respar->getoctavesfreq()); -} -void ResonanceUI::cb_octavesfreqvo(Fl_Value_Output* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_octavesfreqvo_i(o,v); -} - -void ResonanceUI::cb_RND2_i(Fl_Button*, void*) { - respar->randomize(1); -resonancewindow->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_RND2(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_RND2_i(o,v); -} - -void ResonanceUI::cb_RND1_i(Fl_Button*, void*) { - respar->randomize(0); -resonancewindow->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_RND1(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_RND1_i(o,v); -} - -void ResonanceUI::cb_RND3_i(Fl_Button*, void*) { - respar->randomize(2); -resonancewindow->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_RND3(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_RND3_i(o,v); -} - -void ResonanceUI::cb_p1st_i(Fl_Check_Button* o, void*) { - respar->Pprotectthefundamental=(int) o->value(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_p1st(Fl_Check_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_p1st_i(o,v); -} - -void ResonanceUI::cb_InterpP_i(Fl_Button*, void*) { - int type; -if (Fl::event_button()==FL_LEFT_MOUSE) type=0; - else type=1; -respar->interpolatepeaks(type); -resonancewindow->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_InterpP(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_InterpP_i(o,v); -} - -void ResonanceUI::cb_centerfreq_i(WidgetPDial* o, void*) { - respar->Pcenterfreq=(int)o->value(); -centerfreqvo->do_callback(); -rg->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_centerfreq(WidgetPDial* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_centerfreq_i(o,v); -} - -void ResonanceUI::cb_octavesfreq_i(WidgetPDial* o, void*) { - respar->Poctavesfreq=(int)o->value(); -octavesfreqvo->do_callback(); -rg->redraw(); -redrawPADnoteApply(); -} -void ResonanceUI::cb_octavesfreq(WidgetPDial* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_octavesfreq_i(o,v); -} - -void ResonanceUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(respar); -} -void ResonanceUI::cb_C(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void ResonanceUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(respar,this); -} -void ResonanceUI::cb_P(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -void ResonanceUI::cb_applybutton_i(Fl_Button*, void*) { - applybutton->color(FL_GRAY); -applybutton->redraw(); -if (cbapplywidget!=NULL) { - cbapplywidget->do_callback(); - cbapplywidget->color(FL_GRAY); - cbapplywidget->redraw(); -}; -} -void ResonanceUI::cb_applybutton(Fl_Button* o, void* v) { - ((ResonanceUI*)(o->parent()->user_data()))->cb_applybutton_i(o,v); -} - -Fl_Double_Window* ResonanceUI::make_window() { - { resonancewindow = new Fl_Double_Window(780, 305, "Resonance"); - resonancewindow->user_data((void*)(this)); - { khzvalue = new Fl_Value_Output(415, 264, 45, 18, "kHz"); - khzvalue->labelsize(12); - khzvalue->minimum(0.001); - khzvalue->maximum(48); - khzvalue->step(0.01); - khzvalue->textfont(1); - khzvalue->textsize(12); - khzvalue->align(Fl_Align(FL_ALIGN_RIGHT)); - //this widget must be before the calling widgets - } // Fl_Value_Output* khzvalue - { dbvalue = new Fl_Value_Output(415, 282, 45, 18, "dB"); - dbvalue->labelsize(12); - dbvalue->minimum(-150); - dbvalue->maximum(150); - dbvalue->step(0.1); - dbvalue->textfont(1); - dbvalue->textsize(12); - dbvalue->align(Fl_Align(FL_ALIGN_RIGHT)); - //this widget must be before the calling widgets - } // Fl_Value_Output* dbvalue - { Fl_Group* o = new Fl_Group(6, 5, 768, 256); - o->box(FL_BORDER_BOX); - rg=new ResonanceGraph(o->x(),o->y(),o->w(),o->h(),""); - rg->init(respar,khzvalue,dbvalue); - rg->show(); - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(690, 283, 84, 17, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(491, 264, 66, 15, "Zero"); - o->tooltip("Clear the resonance function"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(12); - o->callback((Fl_Callback*)cb_Zero); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(491, 282, 66, 18, "Smooth"); - o->tooltip("Smooth the resonance function"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(12); - o->callback((Fl_Callback*)cb_Smooth); - } // Fl_Button* o - { Fl_Check_Button* o = enabled = new Fl_Check_Button(6, 270, 78, 27, "Enable"); - enabled->box(FL_THIN_UP_BOX); - enabled->down_box(FL_DOWN_BOX); - enabled->callback((Fl_Callback*)cb_enabled); - o->value(respar->Penabled); - } // Fl_Check_Button* enabled - { maxdb = new Fl_Roller(90, 282, 84, 15); - maxdb->type(1); - maxdb->minimum(1); - maxdb->maximum(90); - maxdb->step(1); - maxdb->value(30); - maxdb->callback((Fl_Callback*)cb_maxdb); - } // Fl_Roller* maxdb - { Fl_Value_Output* o = maxdbvo = new Fl_Value_Output(126, 264, 24, 18, "Max."); - maxdbvo->tooltip("The Maximum amplitude (dB)"); - maxdbvo->labelsize(12); - maxdbvo->minimum(1); - maxdbvo->maximum(127); - maxdbvo->step(1); - maxdbvo->value(30); - maxdbvo->textfont(1); - maxdbvo->textsize(12); - maxdbvo->callback((Fl_Callback*)cb_maxdbvo); - o->value(respar->PmaxdB); - } // Fl_Value_Output* maxdbvo - { new Fl_Box(150, 264, 24, 18, "dB"); - } // Fl_Box* o - { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(210, 264, 33, 18, "C.f."); - centerfreqvo->tooltip("Center Frequency (kHz)"); - centerfreqvo->labelsize(12); - centerfreqvo->minimum(1); - centerfreqvo->maximum(10); - centerfreqvo->step(0.01); - centerfreqvo->value(1); - centerfreqvo->textfont(1); - centerfreqvo->textsize(12); - centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo); - centerfreqvo->when(3); - o->value(respar->getcenterfreq()/1000.0); - } // Fl_Value_Output* centerfreqvo - { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(210, 282, 33, 18, "Oct."); - octavesfreqvo->tooltip("No. of octaves"); - octavesfreqvo->labelsize(12); - octavesfreqvo->minimum(1); - octavesfreqvo->maximum(127); - octavesfreqvo->step(1); - octavesfreqvo->value(30); - octavesfreqvo->textfont(1); - octavesfreqvo->textsize(12); - octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo); - octavesfreqvo->when(3); - o->value(respar->getoctavesfreq()); - } // Fl_Value_Output* octavesfreqvo - { Fl_Button* o = new Fl_Button(566, 276, 42, 12, "RND2"); - o->tooltip("Randomize the resonance function"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_RND2); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(566, 264, 42, 12, "RND1"); - o->tooltip("Randomize the resonance function"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_RND1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(566, 288, 42, 12, "RND3"); - o->tooltip("Randomize the resonance function"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_RND3); - } // Fl_Button* o - { Fl_Check_Button* o = p1st = new Fl_Check_Button(365, 285, 45, 15, "P.1st"); - p1st->tooltip("Protect the fundamental frequency (do not damp the first harmonic)"); - p1st->down_box(FL_DOWN_BOX); - p1st->labelsize(10); - p1st->callback((Fl_Callback*)cb_p1st); - o->value(respar->Pprotectthefundamental); - } // Fl_Check_Button* p1st - { Fl_Button* o = new Fl_Button(365, 265, 46, 15, "InterpP"); - o->tooltip("Interpolate the peaks"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(10); - o->callback((Fl_Callback*)cb_InterpP); - } // Fl_Button* o - { WidgetPDial* o = centerfreq = new WidgetPDial(245, 265, 30, 30, "C.f."); - centerfreq->box(FL_ROUND_UP_BOX); - centerfreq->color(FL_BACKGROUND_COLOR); - centerfreq->selection_color(FL_INACTIVE_COLOR); - centerfreq->labeltype(FL_NORMAL_LABEL); - centerfreq->labelfont(0); - centerfreq->labelsize(10); - centerfreq->labelcolor(FL_FOREGROUND_COLOR); - centerfreq->maximum(127); - centerfreq->step(1); - centerfreq->callback((Fl_Callback*)cb_centerfreq); - centerfreq->align(Fl_Align(FL_ALIGN_BOTTOM)); - centerfreq->when(FL_WHEN_CHANGED); - o->value(respar->Pcenterfreq); - } // WidgetPDial* centerfreq - { WidgetPDial* o = octavesfreq = new WidgetPDial(280, 265, 30, 30, "Oct."); - octavesfreq->box(FL_ROUND_UP_BOX); - octavesfreq->color(FL_BACKGROUND_COLOR); - octavesfreq->selection_color(FL_INACTIVE_COLOR); - octavesfreq->labeltype(FL_NORMAL_LABEL); - octavesfreq->labelfont(0); - octavesfreq->labelsize(10); - octavesfreq->labelcolor(FL_FOREGROUND_COLOR); - octavesfreq->maximum(127); - octavesfreq->step(1); - octavesfreq->callback((Fl_Callback*)cb_octavesfreq); - octavesfreq->align(Fl_Align(FL_ALIGN_BOTTOM)); - octavesfreq->when(FL_WHEN_CHANGED); - o->value(respar->Poctavesfreq); - } // WidgetPDial* octavesfreq - { Fl_Button* o = new Fl_Button(625, 275, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(655, 275, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - { applybutton = new Fl_Button(690, 265, 85, 15, "Apply"); - applybutton->box(FL_THIN_UP_BOX); - applybutton->labelfont(1); - applybutton->labelsize(11); - applybutton->callback((Fl_Callback*)cb_applybutton); - } // Fl_Button* applybutton - resonancewindow->end(); - } // Fl_Double_Window* resonancewindow - return resonancewindow; -} - -ResonanceUI::ResonanceUI(Resonance *respar_) { - respar=respar_; - cbwidget=NULL; - cbapplywidget=NULL; - make_window(); - applybutton->hide(); -} - -ResonanceUI::~ResonanceUI() { - resonancewindow->hide(); -} - -void ResonanceUI::redrawPADnoteApply() { - if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); - }; -} - -void ResonanceUI::setcbwidget(Fl_Widget *cbwidget,Fl_Widget *cbapplywidget) { - this->cbwidget=cbwidget; - this->cbapplywidget=cbapplywidget; - rg->setcbwidget(cbwidget,applybutton); - applybutton->show(); -} - -void ResonanceUI::refresh() { - redrawPADnoteApply(); - - enabled->value(respar->Penabled); - - maxdb->value(respar->PmaxdB); - maxdbvo->value(respar->PmaxdB); - - centerfreqvo->value(respar->getcenterfreq()/1000.0); - octavesfreqvo->value(respar->getoctavesfreq()); - - centerfreq->value(respar->Pcenterfreq); - octavesfreq->value(respar->Poctavesfreq); - - p1st->value(respar->Pprotectthefundamental); - - rg->redraw(); -} diff --git a/plugins/zynaddsubfx/src/UI/ResonanceUI.fl b/plugins/zynaddsubfx/src/UI/ResonanceUI.fl deleted file mode 100644 index 3c06c5215..000000000 --- a/plugins/zynaddsubfx/src/UI/ResonanceUI.fl +++ /dev/null @@ -1,392 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "../Synth/Resonance.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class ResonanceGraph {: {public Fl_Box} -} { - Function {ResonanceGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {respar=NULL; -cbwidget=NULL; -applybutton=NULL;} {} - } - Function {init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_)} {} { - code {respar=respar_; -khzvalue=khzvalue_; -dbvalue=dbvalue_; -oldx=-1; -khzval=-1;} {} - } - Function {draw_freq_line(REALTYPE freq,int type)} {} { - code {REALTYPE freqx=respar->getfreqpos(freq); -switch(type){ - case 0:fl_line_style(FL_SOLID);break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; -}; - - -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h());} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; -REALTYPE freqx; - -fl_color(FL_BLACK); -fl_rectf(ox,oy,lx,ly); - - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -freqx=respar->getfreqpos(1000.0); -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - -for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; -}; - -draw_freq_line(10000.0,0); -draw_freq_line(20000.0,1); - -fl_line_style(FL_DOT); -int GY=10;if (lyPrespoints[0]/128.0*ly); -for (i=1;iPrespoints[i]/128.0*ly); - fl_line(ox+ix-1,oy+ly-oiy,ox+ix,oy+ly-iy); - oiy=iy; -};} {} - } - Function {handle(int event)} {return_type int - } { - code {int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); -if ( (x_>=0)&&(x_=0)&&(y_value(respar->getfreqx(x_*1.0/w())/1000.0); - dbvalue->value((1.0-y_*2.0/h())*respar->PmaxdB); -}; - -if ((event==FL_PUSH)||(event==FL_DRAG)){ - int leftbutton=1; - if (Fl::event_button()==FL_RIGHT_MOUSE) leftbutton=0; - if (x_<0) x_=0;if (y_<0) y_=0; - if (x_>=w()) x_=w();if (y_>=h()-1) y_=h()-1; - - if ((oldx<0)||(oldx==x_)){ - int sn=(int)(x_*1.0/w()*N_RES_POINTS); - int sp=127-(int)(y_*1.0/h()*127); - if (leftbutton!=0) respar->setpoint(sn,sp); - else respar->setpoint(sn,64); - } else { - int x1=oldx; - int x2=x_; - int y1=oldy; - int y2=y_; - if (oldx>x_){ - x1=x_;y1=y_; - x2=oldx;y2=oldy; - }; - for (int i=0;isetpoint(sn,sp); - else respar->setpoint(sn,64); - }; - }; - - oldx=x_;oldy=y_; - redraw(); -}; - -if (event==FL_RELEASE) { - oldx=-1; - if (cbwidget!=NULL) { - cbwidget->do_callback(); - if (applybutton!=NULL) { - applybutton->color(FL_RED); - applybutton->redraw(); - - }; - }; -}; - -return(1);} {} - } - Function {setcbwidget(Fl_Widget *cbwidget,Fl_Widget *applybutton)} {} { - code {this->cbwidget=cbwidget; -this->applybutton=applybutton;} {} - } - decl {Fl_Value_Output *khzvalue;} {} - decl {Fl_Value_Output *dbvalue;} {} - decl {Resonance *respar;} {} - decl {int oldx,oldy;} {} - decl {REALTYPE khzval;} {public - } - decl {Fl_Widget *cbwidget,*applybutton;} {} -} - -class ResonanceUI {open : PresetsUI_ -} { - Function {make_window()} {open - } { - Fl_Window resonancewindow { - label Resonance selected - xywh {120 70 780 305} type Double hide - } { - Fl_Value_Output khzvalue { - label kHz - xywh {415 264 45 18} labelsize 12 align 8 minimum 0.001 maximum 48 step 0.01 textfont 1 textsize 12 - code0 {//this widget must be before the calling widgets} - } - Fl_Value_Output dbvalue { - label dB - xywh {415 282 45 18} labelsize 12 align 8 minimum -150 maximum 150 step 0.1 textfont 1 textsize 12 - code0 {//this widget must be before the calling widgets} - } - Fl_Group {} { - xywh {6 5 768 256} box BORDER_BOX - code0 {rg=new ResonanceGraph(o->x(),o->y(),o->w(),o->h(),"");} - code1 {rg->init(respar,khzvalue,dbvalue);} - code2 {rg->show();} - } {} - Fl_Button {} { - label Close - callback {resonancewindow->hide();} - xywh {690 283 84 17} box THIN_UP_BOX - } - Fl_Button {} { - label Zero - callback {for (int i=0;isetpoint(i,64); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Clear the resonance function} xywh {491 264 66 15} box THIN_UP_BOX labelfont 1 labelsize 12 - } - Fl_Button {} { - label Smooth - callback {respar->smooth(); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Smooth the resonance function} xywh {491 282 66 18} box THIN_UP_BOX labelfont 1 labelsize 12 - } - Fl_Check_Button enabled { - label Enable - callback {respar->Penabled=(int) o->value(); -redrawPADnoteApply();} - xywh {6 270 78 27} box THIN_UP_BOX down_box DOWN_BOX - code0 {o->value(respar->Penabled);} - } - Fl_Roller maxdb { - callback {maxdbvo->value(o->value()); -respar->PmaxdB=(int) o->value(); -redrawPADnoteApply();} - xywh {90 282 84 15} type Horizontal minimum 1 maximum 90 step 1 value 30 - } - Fl_Value_Output maxdbvo { - label {Max.} - callback {o->value(respar->PmaxdB);} - tooltip {The Maximum amplitude (dB)} xywh {126 264 24 18} labelsize 12 minimum 1 maximum 127 step 1 value 30 textfont 1 textsize 12 - code0 {o->value(respar->PmaxdB);} - } - Fl_Box {} { - label dB - xywh {150 264 24 18} - } - Fl_Value_Output centerfreqvo { - label {C.f.} - callback {o->value(respar->getcenterfreq()/1000.0);} - tooltip {Center Frequency (kHz)} xywh {210 264 33 18} labelsize 12 when 3 minimum 1 maximum 10 step 0.01 value 1 textfont 1 textsize 12 - code0 {o->value(respar->getcenterfreq()/1000.0);} - } - Fl_Value_Output octavesfreqvo { - label {Oct.} - callback {o->value(respar->getoctavesfreq());} - tooltip {No. of octaves} xywh {210 282 33 18} labelsize 12 when 3 minimum 1 maximum 127 step 1 value 30 textfont 1 textsize 12 - code0 {o->value(respar->getoctavesfreq());} - } - Fl_Button {} { - label RND2 - callback {respar->randomize(1); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {566 276 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button {} { - label RND1 - callback {respar->randomize(0); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {566 264 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button {} { - label RND3 - callback {respar->randomize(2); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {566 288 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Check_Button p1st { - label {P.1st} - callback {respar->Pprotectthefundamental=(int) o->value(); -redrawPADnoteApply();} - tooltip {Protect the fundamental frequency (do not damp the first harmonic)} xywh {365 285 45 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(respar->Pprotectthefundamental);} - } - Fl_Button {} { - label InterpP - callback {int type; -if (Fl::event_button()==FL_LEFT_MOUSE) type=0; - else type=1; -respar->interpolatepeaks(type); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Interpolate the peaks} xywh {365 265 46 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Dial centerfreq { - label {C.f.} - callback {respar->Pcenterfreq=(int)o->value(); -centerfreqvo->do_callback(); -rg->redraw(); -redrawPADnoteApply();} - xywh {245 265 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(respar->Pcenterfreq);} - class WidgetPDial - } - Fl_Dial octavesfreq { - label {Oct.} - callback {respar->Poctavesfreq=(int)o->value(); -octavesfreqvo->do_callback(); -rg->redraw(); -redrawPADnoteApply();} - xywh {280 265 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(respar->Poctavesfreq);} - class WidgetPDial - } - Fl_Button {} { - label C - callback {presetsui->copy(respar);} - xywh {625 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(respar,this);} - xywh {655 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button applybutton { - label Apply - callback {applybutton->color(FL_GRAY); -applybutton->redraw(); -if (cbapplywidget!=NULL) { - cbapplywidget->do_callback(); - cbapplywidget->color(FL_GRAY); - cbapplywidget->redraw(); -};} - xywh {690 265 85 15} box THIN_UP_BOX labelfont 1 labelsize 11 - } - } - } - Function {ResonanceUI(Resonance *respar_)} {} { - code {respar=respar_; -cbwidget=NULL; -cbapplywidget=NULL; -make_window(); -applybutton->hide();} {} - } - Function {~ResonanceUI()} {} { - code {resonancewindow->hide();} {} - } - Function {redrawPADnoteApply()} {} { - code {if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} {} - } - Function {setcbwidget(Fl_Widget *cbwidget,Fl_Widget *cbapplywidget)} {} { - code {this->cbwidget=cbwidget; -this->cbapplywidget=cbapplywidget; -rg->setcbwidget(cbwidget,applybutton); -applybutton->show();} {} - } - Function {refresh()} {} { - code {redrawPADnoteApply(); - -enabled->value(respar->Penabled); - -maxdb->value(respar->PmaxdB); -maxdbvo->value(respar->PmaxdB); - -centerfreqvo->value(respar->getcenterfreq()/1000.0); -octavesfreqvo->value(respar->getoctavesfreq()); - -centerfreq->value(respar->Pcenterfreq); -octavesfreq->value(respar->Poctavesfreq); - -p1st->value(respar->Pprotectthefundamental); - -rg->redraw();} {} - } - decl {Resonance *respar;} {public - } - decl {ResonanceGraph *rg;} {} - decl {Fl_Widget *cbwidget,*cbapplywidget;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/ResonanceUI.h b/plugins/zynaddsubfx/src/UI/ResonanceUI.h deleted file mode 100644 index b95475992..000000000 --- a/plugins/zynaddsubfx/src/UI/ResonanceUI.h +++ /dev/null @@ -1,120 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef ResonanceUI_h -#define ResonanceUI_h -#include -#include -#include -#include -#include "../Synth/Resonance.h" -#include "WidgetPDial.h" -#include "PresetsUI.h" - -class ResonanceGraph : public Fl_Box { -public: - ResonanceGraph(int x,int y, int w, int h, const char *label=0); - void init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_); - void draw_freq_line(REALTYPE freq,int type); - void draw(); - int handle(int event); - void setcbwidget(Fl_Widget *cbwidget,Fl_Widget *applybutton); -private: - Fl_Value_Output *khzvalue; - Fl_Value_Output *dbvalue; - Resonance *respar; - int oldx,oldy; -public: - REALTYPE khzval; -private: - Fl_Widget *cbwidget,*applybutton; -}; -#include -#include -#include -#include -#include -#include -#include - -class ResonanceUI : PresetsUI_ { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *resonancewindow; - Fl_Value_Output *khzvalue; - Fl_Value_Output *dbvalue; -private: - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_Zero_i(Fl_Button*, void*); - static void cb_Zero(Fl_Button*, void*); - void cb_Smooth_i(Fl_Button*, void*); - static void cb_Smooth(Fl_Button*, void*); -public: - Fl_Check_Button *enabled; -private: - void cb_enabled_i(Fl_Check_Button*, void*); - static void cb_enabled(Fl_Check_Button*, void*); -public: - Fl_Roller *maxdb; -private: - void cb_maxdb_i(Fl_Roller*, void*); - static void cb_maxdb(Fl_Roller*, void*); -public: - Fl_Value_Output *maxdbvo; -private: - void cb_maxdbvo_i(Fl_Value_Output*, void*); - static void cb_maxdbvo(Fl_Value_Output*, void*); -public: - Fl_Value_Output *centerfreqvo; -private: - void cb_centerfreqvo_i(Fl_Value_Output*, void*); - static void cb_centerfreqvo(Fl_Value_Output*, void*); -public: - Fl_Value_Output *octavesfreqvo; -private: - void cb_octavesfreqvo_i(Fl_Value_Output*, void*); - static void cb_octavesfreqvo(Fl_Value_Output*, void*); - void cb_RND2_i(Fl_Button*, void*); - static void cb_RND2(Fl_Button*, void*); - void cb_RND1_i(Fl_Button*, void*); - static void cb_RND1(Fl_Button*, void*); - void cb_RND3_i(Fl_Button*, void*); - static void cb_RND3(Fl_Button*, void*); -public: - Fl_Check_Button *p1st; -private: - void cb_p1st_i(Fl_Check_Button*, void*); - static void cb_p1st(Fl_Check_Button*, void*); - void cb_InterpP_i(Fl_Button*, void*); - static void cb_InterpP(Fl_Button*, void*); -public: - WidgetPDial *centerfreq; -private: - void cb_centerfreq_i(WidgetPDial*, void*); - static void cb_centerfreq(WidgetPDial*, void*); -public: - WidgetPDial *octavesfreq; -private: - void cb_octavesfreq_i(WidgetPDial*, void*); - static void cb_octavesfreq(WidgetPDial*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - Fl_Button *applybutton; -private: - void cb_applybutton_i(Fl_Button*, void*); - static void cb_applybutton(Fl_Button*, void*); -public: - ResonanceUI(Resonance *respar_); - ~ResonanceUI(); - void redrawPADnoteApply(); - void setcbwidget(Fl_Widget *cbwidget,Fl_Widget *cbapplywidget); - void refresh(); - Resonance *respar; -private: - ResonanceGraph *rg; - Fl_Widget *cbwidget,*cbapplywidget; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/SUBnoteUI.cc b/plugins/zynaddsubfx/src/UI/SUBnoteUI.cc deleted file mode 100644 index 9314333c5..000000000 --- a/plugins/zynaddsubfx/src/UI/SUBnoteUI.cc +++ /dev/null @@ -1,735 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "SUBnoteUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void SUBnoteharmonic::cb_mag_i(Fl_Slider* o, void*) { - int x=0; -if (Fl::event_button1()) x=127-(int)o->value(); - else o->value(127-x); -pars->Phmag[n]=x; -if (pars->Phmag[n]==0) o->selection_color(0); - else o->selection_color(222); -} -void SUBnoteharmonic::cb_mag(Fl_Slider* o, void* v) { - ((SUBnoteharmonic*)(o->parent()->user_data()))->cb_mag_i(o,v); -} - -void SUBnoteharmonic::cb_bw_i(Fl_Slider* o, void*) { - int x=64; -if (Fl::event_button1()) x=127-(int)o->value(); - else o->value(x); -pars->Phrelbw[n]=x; -} -void SUBnoteharmonic::cb_bw(Fl_Slider* o, void* v) { - ((SUBnoteharmonic*)(o->parent()->user_data()))->cb_bw_i(o,v); -} - -Fl_Group* SUBnoteharmonic::make_window() { - { harmonic = new Fl_Group(0, 0, 90, 225); - harmonic->box(FL_FLAT_BOX); - harmonic->color(FL_BACKGROUND_COLOR); - harmonic->selection_color(FL_BACKGROUND_COLOR); - harmonic->labeltype(FL_NO_LABEL); - harmonic->labelfont(0); - harmonic->labelsize(14); - harmonic->labelcolor(FL_FOREGROUND_COLOR); - harmonic->user_data((void*)(this)); - harmonic->align(Fl_Align(FL_ALIGN_TOP)); - harmonic->when(FL_WHEN_RELEASE); - { Fl_Slider* o = mag = new Fl_Slider(0, 15, 10, 115); - mag->tooltip("harmonic\'s magnitude"); - mag->type(4); - mag->box(FL_FLAT_BOX); - mag->selection_color((Fl_Color)222); - mag->maximum(127); - mag->step(1); - mag->value(127); - mag->callback((Fl_Callback*)cb_mag); - o->value(127-pars->Phmag[n]); - if (pars->Phmag[n]==0) o->selection_color(0); - } // Fl_Slider* mag - { Fl_Slider* o = bw = new Fl_Slider(0, 135, 10, 75); - bw->tooltip("harmonic\'s bandwidth"); - bw->type(4); - bw->box(FL_FLAT_BOX); - bw->selection_color((Fl_Color)222); - bw->maximum(127); - bw->step(1); - bw->value(64); - bw->callback((Fl_Callback*)cb_bw); - o->value(127-pars->Phrelbw[n]); - } // Fl_Slider* bw - { Fl_Box* o = new Fl_Box(10, 170, 5, 5); - o->box(FL_FLAT_BOX); - o->color(FL_DARK2); - if (n+1==MAX_SUB_HARMONICS) o->hide(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(0, 210, 10, 15, "01"); - o->labelfont(1); - o->labelsize(9); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(0, 0, 10, 15, "01"); - o->labelfont(1); - o->labelsize(9); - o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); - char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); - } // Fl_Box* o - harmonic->end(); - } // Fl_Group* harmonic - return harmonic; -} - -SUBnoteharmonic::SUBnoteharmonic(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { - n=0; -} - -void SUBnoteharmonic::init(SUBnoteParameters *pars_,int n_) { - pars=pars_; - n=n_; - make_window(); - harmonic->show(); - end(); -} - -void SUBnoteharmonic::refresh() { - mag->value(127-pars->Phmag[n]); - if (pars->Phmag[n]==0) mag->selection_color(0); - bw->value(127-pars->Phrelbw[n]); -} - -SUBnoteharmonic::~SUBnoteharmonic() { - harmonic->hide(); - hide(); - //delete(harmonic); -} - -void SUBnoteUI::cb_Close_i(Fl_Button*, void*) { - SUBparameters->hide(); -} -void SUBnoteUI::cb_Close(Fl_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void SUBnoteUI::cb_vol_i(Fl_Value_Slider* o, void*) { - pars->PVolume=(int)o->value(); -} -void SUBnoteUI::cb_vol(Fl_Value_Slider* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_vol_i(o,v); -} - -void SUBnoteUI::cb_vsns_i(Fl_Value_Slider* o, void*) { - pars->PAmpVelocityScaleFunction=(int) o->value(); -} -void SUBnoteUI::cb_vsns(Fl_Value_Slider* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_vsns_i(o,v); -} - -void SUBnoteUI::cb_pan_i(WidgetPDial* o, void*) { - pars->PPanning=(int) o->value(); -} -void SUBnoteUI::cb_pan(WidgetPDial* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_pan_i(o,v); -} - -void SUBnoteUI::cb_filterstages_i(Fl_Counter* o, void*) { - pars->Pnumstages=(int) o->value(); -} -void SUBnoteUI::cb_filterstages(Fl_Counter* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_filterstages_i(o,v); -} - -void SUBnoteUI::cb_magtype_i(Fl_Choice* o, void*) { - pars->Phmagtype=(int) o->value(); -} -void SUBnoteUI::cb_magtype(Fl_Choice* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_magtype_i(o,v); -} - -Fl_Menu_Item SUBnoteUI::menu_magtype[] = { - {"Linear", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-40dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-60dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-80dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"-100dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void SUBnoteUI::cb_start_i(Fl_Choice* o, void*) { - pars->Pstart=(int) o->value(); -} -void SUBnoteUI::cb_start(Fl_Choice* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_start_i(o,v); -} - -Fl_Menu_Item SUBnoteUI::menu_start[] = { - {"Zero", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"RND", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {"Max.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void SUBnoteUI::cb_freqee_i(Fl_Check_Button* o, void*) { - pars->PFreqEnvelopeEnabled=o->value(); -if (o->value()==0) freqenvelopegroup->deactivate(); - else freqenvelopegroup->activate(); -o->show(); -freqsettingsui->redraw(); -} -void SUBnoteUI::cb_freqee(Fl_Check_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_freqee_i(o,v); -} - -void SUBnoteUI::cb_octave_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=16; -pars->PCoarseDetune = k*1024+ - pars->PCoarseDetune%1024; -} -void SUBnoteUI::cb_octave(Fl_Counter* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_octave_i(o,v); -} - -void SUBnoteUI::cb_coarsedet_i(Fl_Counter* o, void*) { - int k=(int) o->value(); -if (k<0) k+=1024; -pars->PCoarseDetune = k+ - (pars->PCoarseDetune/1024)*1024; -} -void SUBnoteUI::cb_coarsedet(Fl_Counter* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_coarsedet_i(o,v); -} - -void SUBnoteUI::cb_detune_i(Fl_Slider* o, void*) { - pars->PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback(); -} -void SUBnoteUI::cb_detune(Fl_Slider* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detune_i(o,v); -} - -void SUBnoteUI::cb_detunevalueoutput_i(Fl_Value_Output* o, void*) { - o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); -} -void SUBnoteUI::cb_detunevalueoutput(Fl_Value_Output* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detunevalueoutput_i(o,v); -} - -void SUBnoteUI::cb_hz440_i(Fl_Check_Button* o, void*) { - int x=(int) o->value(); -pars->Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate(); -} -void SUBnoteUI::cb_hz440(Fl_Check_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_hz440_i(o,v); -} - -void SUBnoteUI::cb_fixedfreqetdial_i(WidgetPDial* o, void*) { - pars->PfixedfreqET=(int) o->value(); -} -void SUBnoteUI::cb_fixedfreqetdial(WidgetPDial* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_fixedfreqetdial_i(o,v); -} - -void SUBnoteUI::cb_detunetype_i(Fl_Choice* o, void*) { - pars->PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback(); -} -void SUBnoteUI::cb_detunetype(Fl_Choice* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detunetype_i(o,v); -} - -void SUBnoteUI::cb_stereo_i(Fl_Check_Button* o, void*) { - pars->Pstereo=(int) o->value(); -} -void SUBnoteUI::cb_stereo(Fl_Check_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->user_data()))->cb_stereo_i(o,v); -} - -void SUBnoteUI::cb_Clear_i(Fl_Button*, void*) { - for (int i=0;imag->value(127); - pars->Phmag[i]=0; - h[i]->bw->value(64); - pars->Phrelbw[i]=64; -}; -pars->Phmag[0]=127; -h[0]->mag->value(0); -SUBparameters->redraw(); -} -void SUBnoteUI::cb_Clear(Fl_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->user_data()))->cb_Clear_i(o,v); -} - -void SUBnoteUI::cb_bwee_i(Fl_Check_Button* o, void*) { - pars->PBandWidthEnvelopeEnabled=o->value(); -if (o->value()==0) bandwidthenvelopegroup->deactivate(); - else bandwidthenvelopegroup->activate(); -o->show(); -bandwidthsettingsui->redraw(); -} -void SUBnoteUI::cb_bwee(Fl_Check_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bwee_i(o,v); -} - -void SUBnoteUI::cb_bandwidth_i(Fl_Value_Slider* o, void*) { - pars->Pbandwidth=(int) o->value(); -} -void SUBnoteUI::cb_bandwidth(Fl_Value_Slider* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bandwidth_i(o,v); -} - -void SUBnoteUI::cb_bwidthscale_i(Fl_Value_Slider* o, void*) { - pars->Pbwscale=(int) o->value()+64; -} -void SUBnoteUI::cb_bwidthscale(Fl_Value_Slider* o, void* v) { - ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bwidthscale_i(o,v); -} - -void SUBnoteUI::cb_filtere_i(Fl_Check_Button* o, void*) { - pars->PGlobalFilterEnabled=o->value(); -if (o->value()==0) globalfiltergroup->deactivate(); - else globalfiltergroup->activate(); -o->show(); -globalfiltergroup->redraw(); -} -void SUBnoteUI::cb_filtere(Fl_Check_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->user_data()))->cb_filtere_i(o,v); -} - -void SUBnoteUI::cb_C_i(Fl_Button*, void*) { - presetsui->copy(pars); -} -void SUBnoteUI::cb_C(Fl_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->user_data()))->cb_C_i(o,v); -} - -void SUBnoteUI::cb_P_i(Fl_Button*, void*) { - presetsui->paste(pars,this); -} -void SUBnoteUI::cb_P(Fl_Button* o, void* v) { - ((SUBnoteUI*)(o->parent()->user_data()))->cb_P_i(o,v); -} - -Fl_Double_Window* SUBnoteUI::make_window() { - { SUBparameters = new Fl_Double_Window(735, 390, "SUBsynth Parameters"); - SUBparameters->user_data((void*)(this)); - { Fl_Scroll* o = new Fl_Scroll(5, 140, 435, 245); - o->type(1); - o->box(FL_THIN_UP_BOX); - { Fl_Pack* o = harmonics = new Fl_Pack(10, 145, 425, 235); - harmonics->type(1); - for (int i=0;ih(),"");h[i]->init(pars,i);} - harmonics->end(); - } // Fl_Pack* harmonics - o->end(); - } // Fl_Scroll* o - { Fl_Button* o = new Fl_Button(625, 365, 105, 20, "Close"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Group* o = new Fl_Group(5, 5, 215, 135, "AMPLITUDE"); - o->box(FL_THIN_UP_FRAME); - o->labeltype(FL_EMBOSSED_LABEL); - o->labelfont(1); - o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { Fl_Value_Slider* o = vol = new Fl_Value_Slider(10, 25, 140, 15, "Vol"); - vol->tooltip("Volume"); - vol->type(5); - vol->box(FL_FLAT_BOX); - vol->labelsize(11); - vol->maximum(127); - vol->step(1); - vol->callback((Fl_Callback*)cb_vol); - vol->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->PVolume); - } // Fl_Value_Slider* vol - { Fl_Value_Slider* o = vsns = new Fl_Value_Slider(10, 45, 140, 15, "V.Sns"); - vsns->tooltip("Velocity Sensing Function (rightmost to disable)"); - vsns->type(5); - vsns->box(FL_FLAT_BOX); - vsns->labelsize(11); - vsns->maximum(127); - vsns->step(1); - vsns->callback((Fl_Callback*)cb_vsns); - vsns->align(Fl_Align(FL_ALIGN_RIGHT)); - o->value(pars->PAmpVelocityScaleFunction); - } // Fl_Value_Slider* vsns - { WidgetPDial* o = pan = new WidgetPDial(185, 20, 30, 30, "Pan"); - pan->tooltip("Panning (leftmost is Random)"); - pan->box(FL_ROUND_UP_BOX); - pan->color(FL_BACKGROUND_COLOR); - pan->selection_color(FL_INACTIVE_COLOR); - pan->labeltype(FL_NORMAL_LABEL); - pan->labelfont(0); - pan->labelsize(10); - pan->labelcolor(FL_FOREGROUND_COLOR); - pan->maximum(127); - pan->step(1); - pan->callback((Fl_Callback*)cb_pan); - pan->align(Fl_Align(FL_ALIGN_BOTTOM)); - pan->when(FL_WHEN_CHANGED); - o->value(pars->PPanning); - } // WidgetPDial* pan - { EnvelopeUI* o = ampenv = new EnvelopeUI(10, 65, 205, 70, "SUBsynth - Amplitude Envelope"); - ampenv->box(FL_FLAT_BOX); - ampenv->color((Fl_Color)51); - ampenv->selection_color(FL_BACKGROUND_COLOR); - ampenv->labeltype(FL_NORMAL_LABEL); - ampenv->labelfont(0); - ampenv->labelsize(14); - ampenv->labelcolor(FL_FOREGROUND_COLOR); - ampenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - ampenv->when(FL_WHEN_RELEASE); - o->init(pars->AmpEnvelope); - ampenv->end(); - } // EnvelopeUI* ampenv - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(495, 325, 235, 35); - o->box(FL_THIN_UP_FRAME); - { Fl_Counter* o = filterstages = new Fl_Counter(515, 340, 45, 15, "Filter Stages"); - filterstages->tooltip("How many times the noise is filtered"); - filterstages->type(1); - filterstages->labelfont(1); - filterstages->labelsize(10); - filterstages->minimum(1); - filterstages->maximum(5); - filterstages->step(1); - filterstages->textsize(10); - filterstages->callback((Fl_Callback*)cb_filterstages); - filterstages->align(Fl_Align(FL_ALIGN_TOP)); - o->value(pars->Pnumstages); - } // Fl_Counter* filterstages - { Fl_Choice* o = magtype = new Fl_Choice(585, 340, 65, 15, "Mag.Type"); - magtype->down_box(FL_BORDER_BOX); - magtype->labelfont(1); - magtype->labelsize(10); - magtype->textsize(11); - magtype->callback((Fl_Callback*)cb_magtype); - magtype->align(Fl_Align(FL_ALIGN_TOP)); - magtype->menu(menu_magtype); - o->value(pars->Phmagtype); - } // Fl_Choice* magtype - { Fl_Choice* o = start = new Fl_Choice(670, 340, 50, 15, "Start"); - start->down_box(FL_BORDER_BOX); - start->labelfont(1); - start->labelsize(10); - start->textsize(11); - start->callback((Fl_Callback*)cb_start); - start->align(Fl_Align(FL_ALIGN_TOP)); - start->menu(menu_start); - o->value(pars->Pstart); - } // Fl_Choice* start - o->end(); - } // Fl_Group* o - { freqsettingsui = new Fl_Group(440, 5, 290, 135, "FREQUENCY"); - freqsettingsui->box(FL_THIN_UP_FRAME); - freqsettingsui->labeltype(FL_EMBOSSED_LABEL); - freqsettingsui->labelfont(1); - freqsettingsui->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = freqenvelopegroup = new EnvelopeUI(445, 65, 205, 70, "SUBsynth - Frequency Envelope"); - freqenvelopegroup->box(FL_FLAT_BOX); - freqenvelopegroup->color((Fl_Color)51); - freqenvelopegroup->selection_color(FL_BACKGROUND_COLOR); - freqenvelopegroup->labeltype(FL_NORMAL_LABEL); - freqenvelopegroup->labelfont(0); - freqenvelopegroup->labelsize(14); - freqenvelopegroup->labelcolor(FL_FOREGROUND_COLOR); - freqenvelopegroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - freqenvelopegroup->when(FL_WHEN_RELEASE); - o->init(pars->FreqEnvelope); - if (pars->PFreqEnvelopeEnabled==0) o->deactivate(); - freqenvelopegroup->end(); - } // EnvelopeUI* freqenvelopegroup - { Fl_Check_Button* o = freqee = new Fl_Check_Button(445, 68, 55, 15, "Enabled"); - freqee->down_box(FL_DOWN_BOX); - freqee->labelfont(1); - freqee->labelsize(10); - freqee->callback((Fl_Callback*)cb_freqee); - o->value(pars->PFreqEnvelopeEnabled); - } // Fl_Check_Button* freqee - { Fl_Counter* o = octave = new Fl_Counter(670, 50, 45, 15, "Octave"); - octave->tooltip("Octave"); - octave->type(1); - octave->labelsize(10); - octave->minimum(-8); - octave->maximum(7); - octave->step(1); - octave->textfont(1); - octave->textsize(11); - octave->callback((Fl_Callback*)cb_octave); - octave->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; - o->value(k); - } // Fl_Counter* octave - { Fl_Counter* o = coarsedet = new Fl_Counter(655, 115, 60, 20, "Coarse Det."); - coarsedet->tooltip("Coarse Detune"); - coarsedet->labelsize(10); - coarsedet->minimum(-64); - coarsedet->maximum(63); - coarsedet->step(1); - coarsedet->textfont(1); - coarsedet->textsize(11); - coarsedet->callback((Fl_Callback*)cb_coarsedet); - coarsedet->align(Fl_Align(FL_ALIGN_TOP)); - int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; - o->value(k); - o->lstep(10); - } // Fl_Counter* coarsedet - { Fl_Slider* o = detune = new Fl_Slider(495, 25, 230, 15); - detune->tooltip("Fine Detune (cents)"); - detune->type(5); - detune->box(FL_FLAT_BOX); - detune->minimum(-8192); - detune->maximum(8191); - detune->step(1); - detune->callback((Fl_Callback*)cb_detune); - o->value(pars->PDetune-8192); - } // Fl_Slider* detune - { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(448, 25, 45, 15, "Detune"); - detunevalueoutput->labelsize(10); - detunevalueoutput->minimum(-5000); - detunevalueoutput->maximum(5000); - detunevalueoutput->step(0.01); - detunevalueoutput->textfont(1); - detunevalueoutput->textsize(10); - detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput); - detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); - } // Fl_Value_Output* detunevalueoutput - { Fl_Check_Button* o = hz440 = new Fl_Check_Button(555, 45, 50, 15, "440Hz"); - hz440->tooltip("set the base frequency to 440Hz"); - hz440->down_box(FL_DOWN_BOX); - hz440->labelfont(1); - hz440->labelsize(10); - hz440->callback((Fl_Callback*)cb_hz440); - o->value(pars->Pfixedfreq); - } // Fl_Check_Button* hz440 - { WidgetPDial* o = fixedfreqetdial = new WidgetPDial(610, 45, 15, 15, "Eq.T."); - fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\ -cy)"); - fixedfreqetdial->box(FL_ROUND_UP_BOX); - fixedfreqetdial->color(FL_BACKGROUND_COLOR); - fixedfreqetdial->selection_color(FL_INACTIVE_COLOR); - fixedfreqetdial->labeltype(FL_NORMAL_LABEL); - fixedfreqetdial->labelfont(0); - fixedfreqetdial->labelsize(10); - fixedfreqetdial->labelcolor(FL_FOREGROUND_COLOR); - fixedfreqetdial->maximum(127); - fixedfreqetdial->step(1); - fixedfreqetdial->callback((Fl_Callback*)cb_fixedfreqetdial); - fixedfreqetdial->align(Fl_Align(FL_ALIGN_RIGHT)); - fixedfreqetdial->when(FL_WHEN_CHANGED); - o->value(pars->PfixedfreqET); - if (pars->Pfixedfreq==0) o->deactivate(); - } // WidgetPDial* fixedfreqetdial - { Fl_Choice* o = detunetype = new Fl_Choice(655, 85, 70, 15, "Detune Type"); - detunetype->down_box(FL_BORDER_BOX); - detunetype->labelsize(10); - detunetype->textfont(1); - detunetype->textsize(10); - detunetype->callback((Fl_Callback*)cb_detunetype); - detunetype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); - o->value(pars->PDetuneType-1); - } // Fl_Choice* detunetype - freqsettingsui->end(); - } // Fl_Group* freqsettingsui - { Fl_Check_Button* o = stereo = new Fl_Check_Button(440, 325, 55, 35, "Stereo"); - stereo->box(FL_THIN_UP_BOX); - stereo->down_box(FL_DOWN_BOX); - stereo->labelfont(1); - stereo->labelsize(10); - stereo->callback((Fl_Callback*)cb_stereo); - o->value(pars->Pstereo); - } // Fl_Check_Button* stereo - { Fl_Button* o = new Fl_Button(445, 365, 70, 20, "Clear"); - o->tooltip("Clear the harmonics"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Clear); - } // Fl_Button* o - { bandwidthsettingsui = new Fl_Group(220, 5, 220, 135, "BANDWIDTH"); - bandwidthsettingsui->box(FL_THIN_UP_FRAME); - bandwidthsettingsui->labeltype(FL_EMBOSSED_LABEL); - bandwidthsettingsui->labelfont(1); - bandwidthsettingsui->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = bandwidthenvelopegroup = new EnvelopeUI(225, 65, 205, 70, "SUBsynth - BandWidth Envelope"); - bandwidthenvelopegroup->box(FL_FLAT_BOX); - bandwidthenvelopegroup->color((Fl_Color)51); - bandwidthenvelopegroup->selection_color(FL_BACKGROUND_COLOR); - bandwidthenvelopegroup->labeltype(FL_NORMAL_LABEL); - bandwidthenvelopegroup->labelfont(0); - bandwidthenvelopegroup->labelsize(14); - bandwidthenvelopegroup->labelcolor(FL_FOREGROUND_COLOR); - bandwidthenvelopegroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - bandwidthenvelopegroup->when(FL_WHEN_RELEASE); - o->init(pars->BandWidthEnvelope); - if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate(); - bandwidthenvelopegroup->end(); - } // EnvelopeUI* bandwidthenvelopegroup - { Fl_Check_Button* o = bwee = new Fl_Check_Button(225, 67, 55, 15, "Enabled"); - bwee->down_box(FL_DOWN_BOX); - bwee->labelfont(1); - bwee->labelsize(10); - bwee->callback((Fl_Callback*)cb_bwee); - o->value(pars->PBandWidthEnvelopeEnabled); - } // Fl_Check_Button* bwee - { Fl_Value_Slider* o = bandwidth = new Fl_Value_Slider(225, 40, 115, 15, "Band Width"); - bandwidth->type(5); - bandwidth->box(FL_FLAT_BOX); - bandwidth->labelsize(10); - bandwidth->maximum(127); - bandwidth->step(1); - bandwidth->callback((Fl_Callback*)cb_bandwidth); - bandwidth->align(Fl_Align(FL_ALIGN_TOP)); - o->value(pars->Pbandwidth); - } // Fl_Value_Slider* bandwidth - { Fl_Value_Slider* o = bwidthscale = new Fl_Value_Slider(345, 40, 90, 15, "B.Width Scale"); - bwidthscale->tooltip("How much I increase the BandWidth according to lower/higher harmonics"); - bwidthscale->type(5); - bwidthscale->box(FL_FLAT_BOX); - bwidthscale->labelsize(10); - bwidthscale->minimum(-64); - bwidthscale->maximum(63); - bwidthscale->step(1); - bwidthscale->callback((Fl_Callback*)cb_bwidthscale); - bwidthscale->align(Fl_Align(FL_ALIGN_TOP)); - o->value(pars->Pbwscale-64); - } // Fl_Value_Slider* bwidthscale - bandwidthsettingsui->end(); - } // Fl_Group* bandwidthsettingsui - { Fl_Group* o = globalfiltergroup = new Fl_Group(440, 140, 290, 185, "FILTER"); - globalfiltergroup->box(FL_THIN_UP_FRAME); - globalfiltergroup->labeltype(FL_EMBOSSED_LABEL); - globalfiltergroup->labelfont(1); - globalfiltergroup->labelsize(13); - globalfiltergroup->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); - { EnvelopeUI* o = filterenv = new EnvelopeUI(445, 250, 275, 70, "SUBsynth - Filter Envelope"); - filterenv->box(FL_FLAT_BOX); - filterenv->color((Fl_Color)51); - filterenv->selection_color(FL_BACKGROUND_COLOR); - filterenv->labeltype(FL_NORMAL_LABEL); - filterenv->labelfont(0); - filterenv->labelsize(14); - filterenv->labelcolor(FL_FOREGROUND_COLOR); - filterenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterenv->when(FL_WHEN_RELEASE); - o->init(pars->GlobalFilterEnvelope); - filterenv->end(); - } // EnvelopeUI* filterenv - { FilterUI* o = filterui = new FilterUI(445, 170, 275, 75, "SUBsynthl - Filter"); - filterui->box(FL_FLAT_BOX); - filterui->color(FL_LIGHT1); - filterui->selection_color(FL_BACKGROUND_COLOR); - filterui->labeltype(FL_NORMAL_LABEL); - filterui->labelfont(0); - filterui->labelsize(14); - filterui->labelcolor(FL_FOREGROUND_COLOR); - filterui->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); - filterui->when(FL_WHEN_RELEASE); - o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction); - filterui->end(); - } // FilterUI* filterui - if (pars->PGlobalFilterEnabled==0) o->deactivate(); - globalfiltergroup->end(); - } // Fl_Group* globalfiltergroup - { Fl_Check_Button* o = filtere = new Fl_Check_Button(445, 145, 85, 20, "Enabled"); - filtere->down_box(FL_DOWN_BOX); - filtere->labelfont(1); - filtere->labelsize(11); - filtere->callback((Fl_Callback*)cb_filtere); - o->value(pars->PGlobalFilterEnabled); - } // Fl_Check_Button* filtere - { Fl_Button* o = new Fl_Button(540, 370, 25, 15, "C"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_C); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(570, 370, 25, 15, "P"); - o->box(FL_THIN_UP_BOX); - o->color((Fl_Color)179); - o->labelfont(1); - o->labelsize(11); - o->labelcolor(FL_BACKGROUND2_COLOR); - o->callback((Fl_Callback*)cb_P); - } // Fl_Button* o - SUBparameters->end(); - } // Fl_Double_Window* SUBparameters - return SUBparameters; -} - -void SUBnoteUI::refresh() { - for (int i=0;irefresh(); - vol->value(pars->PVolume); - vsns->value(pars->PAmpVelocityScaleFunction); - pan->value(pars->PPanning); - - - bandwidth->value(pars->Pbandwidth); - bwidthscale->value(pars->Pbwscale-64); - bwee->value(pars->PBandWidthEnvelopeEnabled); - if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate(); - else bandwidthenvelopegroup->activate(); - bwee->show(); - bandwidthsettingsui->redraw(); - - detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); - freqee->value(pars->PFreqEnvelopeEnabled); - if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate(); - else freqenvelopegroup->activate(); - freqee->show(); - freqsettingsui->redraw(); - - detune->value(pars->PDetune-8192); - hz440->value(pars->Pfixedfreq); - - fixedfreqetdial->value(pars->PfixedfreqET); - - int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; - octave->value(k); - - detunetype->value(pars->PDetuneType-1); - - k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; - coarsedet->value(k); - - filtere->value(pars->PGlobalFilterEnabled); - if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate(); - else globalfiltergroup->activate(); - filtere->show(); - globalfiltergroup->redraw(); - - stereo->value(pars->Pstereo); - filterstages->value(pars->Pnumstages); - magtype->value(pars->Phmagtype); - start->value(pars->Pstart); - - ampenv->refresh(); - bandwidthenvelopegroup->refresh(); - freqenvelopegroup->refresh(); - filterui->refresh(); - filterenv->refresh(); -} - -SUBnoteUI::SUBnoteUI(SUBnoteParameters *parameters) { - pars=parameters; - make_window(); -} - -SUBnoteUI::~SUBnoteUI() { - //for (int i=0;ihide(); - delete(SUBparameters); -} diff --git a/plugins/zynaddsubfx/src/UI/SUBnoteUI.fl b/plugins/zynaddsubfx/src/UI/SUBnoteUI.fl deleted file mode 100644 index ef50a0bb9..000000000 --- a/plugins/zynaddsubfx/src/UI/SUBnoteUI.fl +++ /dev/null @@ -1,449 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0105 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Params/SUBnoteParameters.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class SUBnoteharmonic {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window harmonic { - xywh {329 403 90 225} type Double hide - class Fl_Group - } { - Fl_Slider mag { - callback {int x=0; -if (Fl::event_button1()) x=127-(int)o->value(); - else o->value(127-x); -pars->Phmag[n]=x; -if (pars->Phmag[n]==0) o->selection_color(0); - else o->selection_color(222);} - tooltip {harmonic's magnitude} xywh {0 15 10 115} type {Vert Knob} box FLAT_BOX selection_color 222 labelcolor 0 maximum 127 step 1 value 127 - code0 {o->value(127-pars->Phmag[n]);} - code1 {if (pars->Phmag[n]==0) o->selection_color(0);} - } - Fl_Slider bw { - callback {int x=64; -if (Fl::event_button1()) x=127-(int)o->value(); - else o->value(x); -pars->Phrelbw[n]=x;} - tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(127-pars->Phrelbw[n]);} - } - Fl_Box {} { - xywh {10 170 5 5} box FLAT_BOX color 45 - code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();} - } - Fl_Box {} { - label 01 - xywh {0 210 10 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - Fl_Box {} { - label 01 - xywh {0 0 10 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - } - } - Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0;} {} - } - Function {init(SUBnoteParameters *pars_,int n_)} {} { - code {pars=pars_; -n=n_; -make_window(); -harmonic->show(); -end();} {} - } - Function {refresh()} {} { - code {mag->value(127-pars->Phmag[n]); -if (pars->Phmag[n]==0) mag->selection_color(0); -bw->value(127-pars->Phrelbw[n]);} {selected - } - } - Function {~SUBnoteharmonic()} {} { - code {harmonic->hide(); -hide(); -//delete(harmonic);} {} - } - decl {SUBnoteParameters *pars;} {} - decl {int n;} {} -} - -class SUBnoteUI {: {public PresetsUI_} -} { - Function {make_window()} {} { - Fl_Window SUBparameters { - label {SUBsynth Parameters} - xywh {26 214 735 390} type Double hide - } { - Fl_Scroll {} { - xywh {5 140 435 245} type HORIZONTAL box THIN_UP_BOX - } { - Fl_Pack harmonics {open - xywh {10 145 425 235} type HORIZONTAL - code0 {for (int i=0;ih(),"");h[i]->init(pars,i);}} - } {} - } - Fl_Button {} { - label Close - callback {SUBparameters->hide();} - xywh {625 365 105 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Group {} { - label AMPLITUDE - xywh {5 5 215 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Value_Slider vol { - label Vol - callback {pars->PVolume=(int)o->value();} - tooltip Volume xywh {10 25 140 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PVolume);} - } - Fl_Value_Slider vsns { - label {V.Sns} - callback {pars->PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PAmpVelocityScaleFunction);} - } - Fl_Dial pan { - label Pan - callback {pars->PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->PPanning);} - class WidgetPDial - } - Fl_Group ampenv { - label {SUBsynth - Amplitude Envelope} open - xywh {10 65 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->AmpEnvelope);} - class EnvelopeUI - } {} - } - Fl_Group {} { - xywh {495 325 235 35} box THIN_UP_FRAME - } { - Fl_Counter filterstages { - label {Filter Stages} - callback {pars->Pnumstages=(int) o->value();} - tooltip {How many times the noise is filtered} xywh {515 340 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10 - code0 {o->value(pars->Pnumstages);} - } - Fl_Choice magtype { - label {Mag.Type} - callback {pars->Phmagtype=(int) o->value();} - xywh {585 340 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 - code0 {o->value(pars->Phmagtype);} - } { - menuitem {} { - label Linear - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label {-40dB} - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label {-60dB} - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label {-80dB} - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label {-100dB} - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice start { - label Start - callback {pars->Pstart=(int) o->value();} open - xywh {670 340 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 - code0 {o->value(pars->Pstart);} - } { - menuitem {} { - label Zero - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label RND - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - menuitem {} { - label {Max.} - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Group freqsettingsui { - label FREQUENCY - xywh {440 5 290 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Group freqenvelopegroup { - label {SUBsynth - Frequency Envelope} open - xywh {445 65 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->FreqEnvelope);} - code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button freqee { - label Enabled - callback {pars->PFreqEnvelopeEnabled=o->value(); -if (o->value()==0) freqenvelopegroup->deactivate(); - else freqenvelopegroup->activate(); -o->show(); -freqsettingsui->redraw();} - xywh {445 68 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->PFreqEnvelopeEnabled);} - } - Fl_Counter octave { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->PCoarseDetune = k*1024+ - pars->PCoarseDetune%1024;} - tooltip Octave xywh {670 50 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter coarsedet { - label {Coarse Det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->PCoarseDetune = k+ - (pars->PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {655 115 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Slider detune { - callback {pars->PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {495 25 230 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - xywh {448 25 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - } - Fl_Check_Button hz440 { - label 440Hz - callback {int x=(int) o->value(); -pars->Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate();} - tooltip {set the base frequency to 440Hz} xywh {555 45 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->Pfixedfreq);} - } - Fl_Dial fixedfreqetdial { - label {Eq.T.} - callback {pars->PfixedfreqET=(int) o->value();} - tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 45 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 - code0 {o->value(pars->PfixedfreqET);} - code1 {if (pars->Pfixedfreq==0) o->deactivate();} - class WidgetPDial - } - Fl_Choice detunetype { - label {Detune Type} - callback {pars->PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback();} open - xywh {655 85 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->PDetuneType-1);} - } {} - } - Fl_Check_Button stereo { - label Stereo - callback {pars->Pstereo=(int) o->value();} - xywh {440 325 55 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->Pstereo);} - } - Fl_Button {} { - label Clear - callback {for (int i=0;imag->value(127); - pars->Phmag[i]=0; - h[i]->bw->value(64); - pars->Phrelbw[i]=64; -}; -pars->Phmag[0]=127; -h[0]->mag->value(0); -SUBparameters->redraw();} - tooltip {Clear the harmonics} xywh {445 365 70 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Group bandwidthsettingsui { - label BANDWIDTH - xywh {220 5 220 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Group bandwidthenvelopegroup { - label {SUBsynth - BandWidth Envelope} open - xywh {225 65 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->BandWidthEnvelope);} - code1 {if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button bwee { - label Enabled - callback {pars->PBandWidthEnvelopeEnabled=o->value(); -if (o->value()==0) bandwidthenvelopegroup->deactivate(); - else bandwidthenvelopegroup->activate(); -o->show(); -bandwidthsettingsui->redraw();} - xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->PBandWidthEnvelopeEnabled);} - } - Fl_Value_Slider bandwidth { - label {Band Width} - callback {pars->Pbandwidth=(int) o->value();} - xywh {225 40 115 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Pbandwidth);} - } - Fl_Value_Slider bwidthscale { - label {B.Width Scale} - callback {pars->Pbwscale=(int) o->value()+64;} - tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1 - code0 {o->value(pars->Pbwscale-64);} - } - } - Fl_Group globalfiltergroup { - label FILTER - xywh {440 140 290 185} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();} - } { - Fl_Group filterenv { - label {SUBsynth - Filter Envelope} open - xywh {445 250 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalFilterEnvelope);} - class EnvelopeUI - } {} - Fl_Group filterui { - label {SUBsynthl - Filter} open - xywh {445 170 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);} - class FilterUI - } {} - } - Fl_Check_Button filtere { - label Enabled - callback {pars->PGlobalFilterEnabled=o->value(); -if (o->value()==0) globalfiltergroup->deactivate(); - else globalfiltergroup->activate(); -o->show(); -globalfiltergroup->redraw();} - xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->PGlobalFilterEnabled);} - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 - } - } - } - Function {refresh()} {} { - code {for (int i=0;irefresh(); -vol->value(pars->PVolume); -vsns->value(pars->PAmpVelocityScaleFunction); -pan->value(pars->PPanning); - - -bandwidth->value(pars->Pbandwidth); -bwidthscale->value(pars->Pbwscale-64); -bwee->value(pars->PBandWidthEnvelopeEnabled); -if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate(); - else bandwidthenvelopegroup->activate(); -bwee->show(); -bandwidthsettingsui->redraw(); - -detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); -freqee->value(pars->PFreqEnvelopeEnabled); -if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate(); - else freqenvelopegroup->activate(); -freqee->show(); -freqsettingsui->redraw(); - -detune->value(pars->PDetune-8192); -hz440->value(pars->Pfixedfreq); - -fixedfreqetdial->value(pars->PfixedfreqET); - -int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; -octave->value(k); - -detunetype->value(pars->PDetuneType-1); - -k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; -coarsedet->value(k); - -filtere->value(pars->PGlobalFilterEnabled); -if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate(); - else globalfiltergroup->activate(); -filtere->show(); -globalfiltergroup->redraw(); - -stereo->value(pars->Pstereo); -filterstages->value(pars->Pnumstages); -magtype->value(pars->Phmagtype); -start->value(pars->Pstart); - -ampenv->refresh(); -bandwidthenvelopegroup->refresh(); -freqenvelopegroup->refresh(); -filterui->refresh(); -filterenv->refresh();} {} - } - Function {SUBnoteUI(SUBnoteParameters *parameters)} {} { - code {pars=parameters; -make_window();} {} - } - Function {~SUBnoteUI()} {} { - code {//for (int i=0;ihide(); -delete(SUBparameters);} {} - } - decl {SUBnoteParameters *pars;} {} - decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {} -} diff --git a/plugins/zynaddsubfx/src/UI/SUBnoteUI.h b/plugins/zynaddsubfx/src/UI/SUBnoteUI.h deleted file mode 100644 index 569e69d3a..000000000 --- a/plugins/zynaddsubfx/src/UI/SUBnoteUI.h +++ /dev/null @@ -1,179 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef SUBnoteUI_h -#define SUBnoteUI_h -#include -#include -#include -#include -#include "../globals.h" -#include "WidgetPDial.h" -#include "EnvelopeUI.h" -#include "FilterUI.h" -#include "../Misc/Util.h" -#include "../Params/SUBnoteParameters.h" -#include "PresetsUI.h" -#include -#include - -class SUBnoteharmonic : public Fl_Group { - Fl_Group* make_window(); -public: - Fl_Group *harmonic; - Fl_Slider *mag; -private: - void cb_mag_i(Fl_Slider*, void*); - static void cb_mag(Fl_Slider*, void*); -public: - Fl_Slider *bw; -private: - void cb_bw_i(Fl_Slider*, void*); - static void cb_bw(Fl_Slider*, void*); -public: - SUBnoteharmonic(int x,int y, int w, int h, const char *label=0); - void init(SUBnoteParameters *pars_,int n_); - void refresh(); - ~SUBnoteharmonic(); -private: - SUBnoteParameters *pars; - int n; -}; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class SUBnoteUI : public PresetsUI_ { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *SUBparameters; - Fl_Pack *harmonics; -private: - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); -public: - Fl_Value_Slider *vol; -private: - void cb_vol_i(Fl_Value_Slider*, void*); - static void cb_vol(Fl_Value_Slider*, void*); -public: - Fl_Value_Slider *vsns; -private: - void cb_vsns_i(Fl_Value_Slider*, void*); - static void cb_vsns(Fl_Value_Slider*, void*); -public: - WidgetPDial *pan; -private: - void cb_pan_i(WidgetPDial*, void*); - static void cb_pan(WidgetPDial*, void*); -public: - EnvelopeUI *ampenv; - Fl_Counter *filterstages; -private: - void cb_filterstages_i(Fl_Counter*, void*); - static void cb_filterstages(Fl_Counter*, void*); -public: - Fl_Choice *magtype; -private: - void cb_magtype_i(Fl_Choice*, void*); - static void cb_magtype(Fl_Choice*, void*); - static Fl_Menu_Item menu_magtype[]; -public: - Fl_Choice *start; -private: - void cb_start_i(Fl_Choice*, void*); - static void cb_start(Fl_Choice*, void*); - static Fl_Menu_Item menu_start[]; -public: - Fl_Group *freqsettingsui; - EnvelopeUI *freqenvelopegroup; - Fl_Check_Button *freqee; -private: - void cb_freqee_i(Fl_Check_Button*, void*); - static void cb_freqee(Fl_Check_Button*, void*); -public: - Fl_Counter *octave; -private: - void cb_octave_i(Fl_Counter*, void*); - static void cb_octave(Fl_Counter*, void*); -public: - Fl_Counter *coarsedet; -private: - void cb_coarsedet_i(Fl_Counter*, void*); - static void cb_coarsedet(Fl_Counter*, void*); -public: - Fl_Slider *detune; -private: - void cb_detune_i(Fl_Slider*, void*); - static void cb_detune(Fl_Slider*, void*); -public: - Fl_Value_Output *detunevalueoutput; -private: - void cb_detunevalueoutput_i(Fl_Value_Output*, void*); - static void cb_detunevalueoutput(Fl_Value_Output*, void*); -public: - Fl_Check_Button *hz440; -private: - void cb_hz440_i(Fl_Check_Button*, void*); - static void cb_hz440(Fl_Check_Button*, void*); -public: - WidgetPDial *fixedfreqetdial; -private: - void cb_fixedfreqetdial_i(WidgetPDial*, void*); - static void cb_fixedfreqetdial(WidgetPDial*, void*); -public: - Fl_Choice *detunetype; -private: - void cb_detunetype_i(Fl_Choice*, void*); - static void cb_detunetype(Fl_Choice*, void*); -public: - Fl_Check_Button *stereo; -private: - void cb_stereo_i(Fl_Check_Button*, void*); - static void cb_stereo(Fl_Check_Button*, void*); - void cb_Clear_i(Fl_Button*, void*); - static void cb_Clear(Fl_Button*, void*); -public: - Fl_Group *bandwidthsettingsui; - EnvelopeUI *bandwidthenvelopegroup; - Fl_Check_Button *bwee; -private: - void cb_bwee_i(Fl_Check_Button*, void*); - static void cb_bwee(Fl_Check_Button*, void*); -public: - Fl_Value_Slider *bandwidth; -private: - void cb_bandwidth_i(Fl_Value_Slider*, void*); - static void cb_bandwidth(Fl_Value_Slider*, void*); -public: - Fl_Value_Slider *bwidthscale; -private: - void cb_bwidthscale_i(Fl_Value_Slider*, void*); - static void cb_bwidthscale(Fl_Value_Slider*, void*); -public: - Fl_Group *globalfiltergroup; - EnvelopeUI *filterenv; - FilterUI *filterui; - Fl_Check_Button *filtere; -private: - void cb_filtere_i(Fl_Check_Button*, void*); - static void cb_filtere(Fl_Check_Button*, void*); - void cb_C_i(Fl_Button*, void*); - static void cb_C(Fl_Button*, void*); - void cb_P_i(Fl_Button*, void*); - static void cb_P(Fl_Button*, void*); -public: - void refresh(); - SUBnoteUI(SUBnoteParameters *parameters); - ~SUBnoteUI(); -private: - SUBnoteParameters *pars; - SUBnoteharmonic *h[MAX_SUB_HARMONICS]; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/SeqUI.cc b/plugins/zynaddsubfx/src/UI/SeqUI.cc deleted file mode 100644 index d48fd4de6..000000000 --- a/plugins/zynaddsubfx/src/UI/SeqUI.cc +++ /dev/null @@ -1,98 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "SeqUI.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -void SeqUI::cb_playbutton_i(Fl_Button* o, void*) { - o->deactivate(); -stopbutton_play->activate(); - -master->seq.startplay(); -} -void SeqUI::cb_playbutton(Fl_Button* o, void* v) { - ((SeqUI*)(o->parent()->parent()->user_data()))->cb_playbutton_i(o,v); -} - -void SeqUI::cb_stopbutton_play_i(Fl_Button* o, void*) { - o->deactivate(); -playbutton->activate(); - -master->seq.stopplay(); -} -void SeqUI::cb_stopbutton_play(Fl_Button* o, void* v) { - ((SeqUI*)(o->parent()->parent()->user_data()))->cb_stopbutton_play_i(o,v); -} - -void SeqUI::cb_Open_i(Fl_Button*, void*) { - master->seq.importmidifile("test.mid"); -} -void SeqUI::cb_Open(Fl_Button* o, void* v) { - ((SeqUI*)(o->parent()->user_data()))->cb_Open_i(o,v); -} - -void SeqUI::cb_Play_i(Fl_Value_Slider* o, void*) { - master->seq.setplayspeed((int) o->value()); -} -void SeqUI::cb_Play(Fl_Value_Slider* o, void* v) { - ((SeqUI*)(o->parent()->user_data()))->cb_Play_i(o,v); -} - -Fl_Double_Window* SeqUI::make_window() { - { seqwin = new Fl_Double_Window(280, 265, "Sequencer - ZynAddSubFX"); - seqwin->user_data((void*)(this)); - { Fl_Group* o = new Fl_Group(120, 20, 100, 65, "Player"); - o->box(FL_ENGRAVED_BOX); - o->labelfont(1); - { playbutton = new Fl_Button(130, 30, 30, 30, "Play"); - playbutton->tooltip("Start Playing"); - playbutton->box(FL_DIAMOND_UP_BOX); - playbutton->color((Fl_Color)79); - playbutton->labelfont(1); - playbutton->labelsize(13); - playbutton->callback((Fl_Callback*)cb_playbutton); - playbutton->align(Fl_Align(FL_ALIGN_BOTTOM)); - } // Fl_Button* playbutton - { stopbutton_play = new Fl_Button(175, 29, 30, 31, "Stop"); - stopbutton_play->tooltip("Stop Playing"); - stopbutton_play->box(FL_THIN_UP_BOX); - stopbutton_play->color((Fl_Color)4); - stopbutton_play->labelfont(1); - stopbutton_play->labelsize(13); - stopbutton_play->callback((Fl_Callback*)cb_stopbutton_play); - stopbutton_play->align(Fl_Align(FL_ALIGN_BOTTOM)); - stopbutton_play->deactivate(); - } // Fl_Button* stopbutton_play - o->end(); - } // Fl_Group* o - { Fl_Button* o = new Fl_Button(20, 25, 75, 55, "Open test.mid"); - o->callback((Fl_Callback*)cb_Open); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Button* o - { Fl_Value_Slider* o = new Fl_Value_Slider(15, 105, 190, 20, "Play speed"); - o->type(5); - o->minimum(-128); - o->maximum(128); - o->step(1); - o->callback((Fl_Callback*)cb_Play); - o->value(master->seq.playspeed); - } // Fl_Value_Slider* o - { Fl_Box* o = new Fl_Box(25, 155, 225, 90, "This is not finished"); - o->labelfont(1); - o->labelsize(22); - o->align(Fl_Align(FL_ALIGN_WRAP)); - } // Fl_Box* o - seqwin->end(); - } // Fl_Double_Window* seqwin - return seqwin; -} - -SeqUI::SeqUI(Master *master_) { - master=master_; - - make_window(); -} - -void SeqUI::show() { - seqwin->show(); -} diff --git a/plugins/zynaddsubfx/src/UI/SeqUI.fl b/plugins/zynaddsubfx/src/UI/SeqUI.fl deleted file mode 100644 index 343719c65..000000000 --- a/plugins/zynaddsubfx/src/UI/SeqUI.fl +++ /dev/null @@ -1,73 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0105 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -class SeqUI {} { - Function {make_window()} {} { - Fl_Window seqwin { - label {Sequencer - ZynAddSubFX} - xywh {104 235 280 265} type Double hide - } { - Fl_Group {} { - label Player - xywh {120 20 100 65} box ENGRAVED_BOX labelfont 1 - } { - Fl_Button playbutton { - label Play - callback {o->deactivate(); -stopbutton_play->activate(); - -master->seq.startplay();} - tooltip {Start Playing} xywh {130 30 30 30} box DIAMOND_UP_BOX color 79 labelfont 1 labelsize 13 align 2 - } - Fl_Button stopbutton_play { - label Stop - callback {o->deactivate(); -playbutton->activate(); - -master->seq.stopplay();} - tooltip {Stop Playing} xywh {175 29 30 31} box THIN_UP_BOX color 4 labelfont 1 labelsize 13 align 2 deactivate - } - } - Fl_Button {} { - label {Open test.mid} - callback {master->seq.importmidifile("test.mid");} - xywh {20 25 75 55} align 128 - } - Fl_Value_Slider {} { - label {Play speed} - callback {master->seq.setplayspeed((int) o->value());} - xywh {15 105 190 20} type {Horz Knob} minimum -128 maximum 128 step 1 - code0 {o->value(master->seq.playspeed);} - } - Fl_Box {} { - label {This is not finished} selected - xywh {25 155 225 90} labelfont 1 labelsize 22 align 128 - } - } - } - Function {SeqUI(Master *master_)} {open - } { - code {master=master_; - -make_window();} {} - } - decl {Master *master} {} - Function {show()} {open - } { - code {seqwin->show();} {} - } -} diff --git a/plugins/zynaddsubfx/src/UI/SeqUI.h b/plugins/zynaddsubfx/src/UI/SeqUI.h deleted file mode 100644 index 0cdad0544..000000000 --- a/plugins/zynaddsubfx/src/UI/SeqUI.h +++ /dev/null @@ -1,39 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef SeqUI_h -#define SeqUI_h -#include -#include "../globals.h" -#include "../Misc/Master.h" -#include "WidgetPDial.h" -#include -#include -#include -#include -#include - -class SeqUI { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *seqwin; - Fl_Button *playbutton; -private: - void cb_playbutton_i(Fl_Button*, void*); - static void cb_playbutton(Fl_Button*, void*); -public: - Fl_Button *stopbutton_play; -private: - void cb_stopbutton_play_i(Fl_Button*, void*); - static void cb_stopbutton_play(Fl_Button*, void*); - void cb_Open_i(Fl_Button*, void*); - static void cb_Open(Fl_Button*, void*); - void cb_Play_i(Fl_Value_Slider*, void*); - static void cb_Play(Fl_Value_Slider*, void*); -public: - SeqUI(Master *master_); -private: - Master *master; -public: - void show(); -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/VirKeyboard.cc b/plugins/zynaddsubfx/src/UI/VirKeyboard.cc deleted file mode 100644 index 8e6d2eee8..000000000 --- a/plugins/zynaddsubfx/src/UI/VirKeyboard.cc +++ /dev/null @@ -1,499 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "VirKeyboard.h" -//Copyright (c) 2002-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later -static const int keyspos[12]={0,-1,1,-2,2,3,-4,4,-5,5,-6,6}; -static const int keysoct1qwerty[]={'q','2','w','3','e','r','5','t','6','y','7','u','i','9','o','0','p','[','=',']','\\',FL_Enter,0}; -static const int keysoct2qwerty[]={'z','s','x','d','c','v','g','b','h','n','j','m',',','l','.',';','/',0}; -static const int keysoct1dw[]={'\'','2',',','3','.','p','5','y','6','f','7','g','c','9','r','0','l','/',']','=','\\',FL_Enter,0}; -static const int keysoct2dw[]={';','o','q','e','j','k','i','x','d','b','h','m','w','n','v','s','z',0}; -static const int keysoct1qwertz[]={'q','2','w','3','e','r','5','t','6','z','7','u','i','9','o','0','p',252,'\'','+','\\',FL_Enter,0}; -static const int keysoct2qwertz[]={'y','s','x','d','c','v','g','b','h','n','j','m',',','l','.',246,'-',0}; -static const int keysoct1az[]={'a',233,'z','\"','e','r','(','t','-','y',232,'u','i',231,'o',224,'p',65106,'=','$',0}; -static const int keysoct2az[]={'w','s','x','d','c','v','g','b','h','n','j',',',';','l',':','m','!',0}; - -VirKeys::VirKeys(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { - master=NULL; -} - -void VirKeys::init(Master *master_) { - master=master_; - for (int i=0;i=0){//white keys - if (pressed[i]==0) fl_color(250,240,230); - else fl_color(FL_BLUE); - fl_rectf(ox+(kv+7*noct)*SIZE_WHITE+3,oy+ly*3/5+2, - SIZE_WHITE-4,ly*2/5-3); - } else {//black keys - kv=keyspos[(i+1)%12]; - if (pressed[i]==0) fl_color(FL_BLACK); - else fl_color(FL_BLUE); - fl_rectf(ox+(kv+7*noct)*SIZE_WHITE-SIZE_BLACK/2+2,oy+2, - SIZE_BLACK-3,ly*3/5-5); - }; - }; -} - -int VirKeys::handle(int event) { - int i; - int ly=h(); - int x_=Fl::event_x()-x(); - int y_=Fl::event_y()-y(); - if ( (x_<0)&&(x_>w()) && (y_<0)&&(y_>h())){ - return(0); - }; - - - if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ - int kpos=-1; - - if (y_>ly*3/5){//white keys - int pos=x_/SIZE_WHITE; - if (pos<0) return(1); - for (i=0;i<12;i++) { - if (pos%7==keyspos[i]) { - kpos=pos/7*12+i; - break; - }; - }; - } else {//black keys - int pos=(x_+SIZE_WHITE/2)/SIZE_WHITE; - if (pos<0) return(1); - for (i=1;i<12;i++) { - if (pos%7==-keyspos[i]) { - kpos=pos/7*12+i; - break; - }; - }; - }; - - if ((kpos!=-1)&&((event==FL_PUSH)||(event==FL_DRAG))&& - (Fl::event_shift()==0)) { - presskey(kpos,1,1); - }; - - if ((event==FL_PUSH)&&(Fl::event_shift()!=0)) { - if (pressed[kpos]==0) presskey(kpos,0,1); - else relasekey(kpos,1); - }; - if ((event==FL_RELEASE)&&(Fl::event_shift()==0)) - relaseallkeys(1); - take_focus(); - }; - - - const int *keysoct1=keysoct1qwerty; - const int *keysoct2=keysoct2qwerty; - - if (config.cfg.VirKeybLayout==2) { - keysoct1=keysoct1dw; - keysoct2=keysoct2dw; - }else if (config.cfg.VirKeybLayout==3) { - keysoct1=keysoct1qwertz; - keysoct2=keysoct2qwertz; - }else if (config.cfg.VirKeybLayout==4) { - keysoct1=keysoct1az; - keysoct2=keysoct2az; - }; - - if ((event==FL_KEYDOWN)||(event==FL_KEYUP)){ - int key=Fl::event_key(); - int kpos=-1; - for (i=0;keysoct1[i]!=0;i++) if (key==keysoct1[i]) kpos=i+12*keyoct1; - for (i=0;keysoct2[i]!=0;i++) if (key==keysoct2[i]) kpos=i+12*keyoct2; - - - - - if (kpos==-1) return(0); - if ((event==FL_KEYUP) && (Fl::event_key(key)==0) && (Fl::get_key(key)!=0)) return(0); - if (event==FL_KEYDOWN) presskey(kpos,0,2); - else relasekey(kpos,2); - }; - - return(1); -} - -void VirKeys::presskey(int nk,int exclusive,int type) { - //Exclusive means that multiple keys can be pressed at once - //when the user uses the shift key - if (nk>=N_OCT*12) return; - if ((nk<0)&&(exclusive==0)) { - relaseallkeys(type); - return; - }; - if (nk<0) return; - if (pressed[nk]!=0) return;//the key is already pressed - - if (exclusive!=0) relaseallkeys(type); - pressed[nk]=type; - - damage(1); - float vel=midivel; - if (rndvelocity!=0){ - vel=midivel*(127.0-rndvelocity)/127.0+RND*rndvelocity; - }; - - pthread_mutex_lock(&master->mutex); - master->NoteOn(midich,nk+midioct*12,(int)vel); - pthread_mutex_unlock(&master->mutex); -} - -void VirKeys::relasekey(int nk,int type) { - if ((nk<0)||(nk>=N_OCT*12)) return; - if (pressed[nk]==0) return;//the key is not pressed - if ((type!=0)&&(pressed[nk]!=type)) return; - - pressed[nk]=0; - - - damage(1); - - pthread_mutex_lock(&master->mutex); - master->NoteOff(midich,nk+12*midioct); - pthread_mutex_unlock(&master->mutex); -} - -void VirKeys::relaseallkeys(int type) { - for (int i=0;ihide(); -} -void VirKeyboard::cb_virkeyboardwindow(Fl_Double_Window* o, void* v) { - ((VirKeyboard*)(o->user_data()))->cb_virkeyboardwindow_i(o,v); -} - -void VirKeyboard::cb_qwer_i(Fl_Counter* o, void*) { - relaseallkeys(); -virkeys->keyoct1=(int) o->value(); -virkeys->take_focus(); -} -void VirKeyboard::cb_qwer(Fl_Counter* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_qwer_i(o,v); -} - -void VirKeyboard::cb_zxcv_i(Fl_Counter* o, void*) { - relaseallkeys(); -virkeys->keyoct2=(int) o->value(); -virkeys->take_focus(); -} -void VirKeyboard::cb_zxcv(Fl_Counter* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_zxcv_i(o,v); -} - -void VirKeyboard::cb_Vel_i(Fl_Value_Slider* o, void*) { - virkeys->midivel=(int) o->value(); -virkeys->take_focus(); -} -void VirKeyboard::cb_Vel(Fl_Value_Slider* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_Vel_i(o,v); -} - -void VirKeyboard::cb_Oct_i(Fl_Counter* o, void*) { - relaseallkeys(); -virkeys->midioct=(int) o->value(); -virkeys->take_focus(); -} -void VirKeyboard::cb_Oct(Fl_Counter* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_Oct_i(o,v); -} - -void VirKeyboard::cb_Close_i(Fl_Button*, void*) { - relaseallkeys(); -virkeyboardwindow->hide(); -} -void VirKeyboard::cb_Close(Fl_Button* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -void VirKeyboard::cb_Cval_i(Fl_Value_Slider* o, void*) { - int ctl=midictl; - -pthread_mutex_lock(&master->mutex); - master->SetController(virkeys->midich,ctl,(int) o->value()); -pthread_mutex_unlock(&master->mutex); -virkeys->take_focus(); -} -void VirKeyboard::cb_Cval(Fl_Value_Slider* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_Cval_i(o,v); -} - -void VirKeyboard::cb_Controller_i(Fl_Choice* o, void*) { - switch((int) o->value()+1){ - case 1: midictl=C_modwheel; break; - case 2: midictl=C_volume; break; - case 3: midictl=C_panning; break; - case 4: midictl=C_expression; break; - case 5: midictl=C_sustain; break; - case 6: midictl=C_portamento; break; - case 7: midictl=C_filterq; break; - case 8: midictl=C_filtercutoff; break; - case 9: midictl=C_bandwidth; break; - case 10: midictl=C_fmamp; break; - case 11: midictl=C_resonance_center; break; - case 12: midictl=C_resonance_bandwidth; break; - default: midictl=C_NULL; break; - -}; - - - -virkeys->take_focus(); -} -void VirKeyboard::cb_Controller(Fl_Choice* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_Controller_i(o,v); -} - -Fl_Menu_Item VirKeyboard::menu_Controller[] = { - {"01: Mod.Wheel", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"07: Volume", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"10: Panning", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"11: Expression", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"64: Sustain", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"65: Portamento", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"71: Filter Q", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"74: Filter Freq.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"75: Bandwidth", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"76: FM Gain", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"77: Res. c. freq", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {"78: Res. bw.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -void VirKeyboard::cb_pitchwheelroller_i(Fl_Roller* o, void*) { - pthread_mutex_lock(&master->mutex); - master->SetController(virkeys->midich,C_pitchwheel,-(int) o->value()); -pthread_mutex_unlock(&master->mutex); -virkeys->take_focus(); -} -void VirKeyboard::cb_pitchwheelroller(Fl_Roller* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_pitchwheelroller_i(o,v); -} - -void VirKeyboard::cb_R_i(Fl_Button*, void*) { - pitchwheelroller->value(0); -pitchwheelroller->do_callback(); -} -void VirKeyboard::cb_R(Fl_Button* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_R_i(o,v); -} - -void VirKeyboard::cb_Vrnd_i(WidgetPDial* o, void*) { - virkeys->rndvelocity=(int) o->value(); -} -void VirKeyboard::cb_Vrnd(WidgetPDial* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_Vrnd_i(o,v); -} - -void VirKeyboard::cb_partrcv_i(Fl_Choice* o, void*) { - relaseallkeys(); -virkeys->midich=(int) o->value(); -virkeys->take_focus(); -} -void VirKeyboard::cb_partrcv(Fl_Choice* o, void* v) { - ((VirKeyboard*)(o->parent()->user_data()))->cb_partrcv_i(o,v); -} - -Fl_Double_Window* VirKeyboard::make_window() { - { virkeyboardwindow = new Fl_Double_Window(650, 130, "Virtual Keyboard - ZynAddSubFX"); - virkeyboardwindow->callback((Fl_Callback*)cb_virkeyboardwindow, (void*)(this)); - { VirKeys* o = virkeys = new VirKeys(10, 10, 590, 80, "Keyboard"); - virkeys->box(FL_FLAT_BOX); - virkeys->color((Fl_Color)17); - virkeys->selection_color(FL_BACKGROUND_COLOR); - virkeys->labeltype(FL_NORMAL_LABEL); - virkeys->labelfont(0); - virkeys->labelsize(14); - virkeys->labelcolor(FL_FOREGROUND_COLOR); - virkeys->align(Fl_Align(FL_ALIGN_CENTER)); - virkeys->when(FL_WHEN_RELEASE); - o->init(master); - } // VirKeys* virkeys - { Fl_Counter* o = new Fl_Counter(380, 95, 45, 15, "\"qwer..\" Oct"); - o->tooltip("keys \"q2w3er5t6y...\" octave"); - o->type(1); - o->labelsize(10); - o->minimum(0); - o->maximum(5); - o->step(1); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_qwer); - o->align(Fl_Align(FL_ALIGN_LEFT)); - o->when(FL_WHEN_RELEASE_ALWAYS); - o->value(virkeys->keyoct1); - } // Fl_Counter* o - { Fl_Counter* o = new Fl_Counter(380, 110, 45, 15, "\"zxcv..\" Oct"); - o->tooltip("keys \"zsxdcvgbh...\" octave"); - o->type(1); - o->labelsize(10); - o->minimum(0); - o->maximum(5); - o->step(1); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_zxcv); - o->align(Fl_Align(FL_ALIGN_LEFT)); - o->when(FL_WHEN_RELEASE_ALWAYS); - o->value(virkeys->keyoct2); - } // Fl_Counter* o - { Fl_Value_Slider* o = new Fl_Value_Slider(95, 105, 100, 15, "Vel"); - o->tooltip("Velocity"); - o->type(5); - o->box(FL_FLAT_BOX); - o->labelsize(10); - o->minimum(1); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vel); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->value(virkeys->midivel); - } // Fl_Value_Slider* o - { Fl_Counter* o = new Fl_Counter(255, 100, 55, 20, "Oct."); - o->tooltip("Midi Octave"); - o->type(1); - o->labelsize(11); - o->minimum(0); - o->maximum(5); - o->step(1); - o->textfont(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Oct); - o->align(Fl_Align(FL_ALIGN_LEFT)); - o->when(FL_WHEN_RELEASE_ALWAYS); - o->value(virkeys->midioct); - } // Fl_Counter* o - { Fl_Button* o = new Fl_Button(545, 105, 55, 20, "Close"); - o->box(FL_THIN_UP_BOX); - o->callback((Fl_Callback*)cb_Close); - } // Fl_Button* o - { Fl_Value_Slider* o = new Fl_Value_Slider(605, 10, 15, 115, "Cval"); - o->tooltip("Controller value"); - o->type(2); - o->box(FL_ENGRAVED_BOX); - o->selection_color((Fl_Color)229); - o->labelsize(8); - o->minimum(127); - o->maximum(0); - o->step(1); - o->value(64); - o->textsize(7); - o->callback((Fl_Callback*)cb_Cval); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Slider* o - { Fl_Choice* o = new Fl_Choice(435, 105, 100, 15, "Controller"); - o->down_box(FL_BORDER_BOX); - o->labelsize(10); - o->textfont(1); - o->textsize(10); - o->callback((Fl_Callback*)cb_Controller); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE_ALWAYS); - o->menu(menu_Controller); - midictl=C_filtercutoff;o->value(7); - } // Fl_Choice* o - { pitchwheelroller = new Fl_Roller(625, 10, 20, 95, "Pwh"); - pitchwheelroller->tooltip("Pitch Wheel"); - pitchwheelroller->box(FL_PLASTIC_UP_BOX); - pitchwheelroller->labelsize(8); - pitchwheelroller->minimum(-8192); - pitchwheelroller->maximum(8192); - pitchwheelroller->step(64); - pitchwheelroller->callback((Fl_Callback*)cb_pitchwheelroller); - pitchwheelroller->align(Fl_Align(FL_ALIGN_TOP)); - pitchwheelroller->when(3); - } // Fl_Roller* pitchwheelroller - { Fl_Button* o = new Fl_Button(625, 110, 20, 15, "R"); - o->tooltip("Reset Pitch Bend"); - o->box(FL_THIN_UP_BOX); - o->labelfont(1); - o->callback((Fl_Callback*)cb_R); - } // Fl_Button* o - { WidgetPDial* o = new WidgetPDial(205, 105, 20, 20, "Vrnd"); - o->tooltip("Velocity Randomness"); - o->box(FL_ROUND_UP_BOX); - o->color(FL_BACKGROUND_COLOR); - o->selection_color(FL_INACTIVE_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(10); - o->labelcolor(FL_FOREGROUND_COLOR); - o->maximum(127); - o->step(1); - o->callback((Fl_Callback*)cb_Vrnd); - o->align(Fl_Align(129)); - o->when(FL_WHEN_CHANGED); - o->value(virkeys->rndvelocity); - } // WidgetPDial* o - { Fl_Choice* o = partrcv = new Fl_Choice(20, 105, 65, 20, "MIDI Ch."); - partrcv->tooltip("Send to Midi Channel"); - partrcv->down_box(FL_BORDER_BOX); - partrcv->labelsize(10); - partrcv->textfont(1); - partrcv->textsize(10); - partrcv->callback((Fl_Callback*)cb_partrcv); - partrcv->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drum10");}; - o->value(virkeys->midich); - } // Fl_Choice* partrcv - virkeyboardwindow->end(); - } // Fl_Double_Window* virkeyboardwindow - return virkeyboardwindow; -} - -VirKeyboard::VirKeyboard(Master *master_) { - master=master_; - midictl=75; - make_window(); -} - -VirKeyboard::~VirKeyboard() { - delete virkeyboardwindow; -} - -void VirKeyboard::show() { - virkeyboardwindow->show(); -} - -void VirKeyboard::relaseallkeys() { - virkeys->relaseallkeys(0); -} diff --git a/plugins/zynaddsubfx/src/UI/VirKeyboard.fl b/plugins/zynaddsubfx/src/UI/VirKeyboard.fl deleted file mode 100644 index a0b4c721c..000000000 --- a/plugins/zynaddsubfx/src/UI/VirKeyboard.fl +++ /dev/null @@ -1,424 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Input/MidiIn.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {const int keyspos[12]={0,-1,1,-2,2,3,-4,4,-5,5,-6,6};} {} - -decl {const int keysoct1qwerty[]={'q','2','w','3','e','r','5','t','6','y','7','u','i','9','o','0','p','[','=',']','\\\\',FL_Enter,0};} {} - -decl {const int keysoct2qwerty[]={'z','s','x','d','c','v','g','b','h','n','j','m',',','l','.',';','/',0};} {} - -decl {const int keysoct1dw[]={'\\'','2',',','3','.','p','5','y','6','f','7','g','c','9','r','0','l','/',']','=','\\\\',FL_Enter,0};} {} - -decl {const int keysoct2dw[]={';','o','q','e','j','k','i','x','d','b','h','m','w','n','v','s','z',0};} {} - -decl {const int keysoct1qwertz[]={'q','2','w','3','e','r','5','t','6','z','7','u','i','9','o','0','p',252,'\\'','+','\\\\',FL_Enter,0};} {} - -decl {const int keysoct2qwertz[]={'y','s','x','d','c','v','g','b','h','n','j','m',',','l','.',246,'-',0};} {} - -decl {const int keysoct1az[]={'a',233,'z','\\"','e','r','(','t','-','y',232,'u','i',231,'o',224,'p',65106,'=','$',0};} {} - -decl {const int keysoct2az[]={'w','s','x','d','c','v','g','b','h','n','j',',',';','l',':','m','!',0};} {} - -class VirKeys {: {public Fl_Box} -} { - decl {static const int N_OCT=6;} {} - decl {static const int SIZE_WHITE=14;} {} - decl {static const int SIZE_BLACK=8;} {} - Function {VirKeys(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {master=NULL;} {} - } - Function {init(Master *master_)} {} { - code {master=master_; -for (int i=0;i=0){//white keys - if (pressed[i]==0) fl_color(250,240,230); - else fl_color(FL_BLUE); - fl_rectf(ox+(kv+7*noct)*SIZE_WHITE+3,oy+ly*3/5+2, - SIZE_WHITE-4,ly*2/5-3); - } else {//black keys - kv=keyspos[(i+1)%12]; - if (pressed[i]==0) fl_color(FL_BLACK); - else fl_color(FL_BLUE); - fl_rectf(ox+(kv+7*noct)*SIZE_WHITE-SIZE_BLACK/2+2,oy+2, - SIZE_BLACK-3,ly*3/5-5); - }; -};} {} - } - Function {handle(int event)} {return_type int - } { - code {int i; -int ly=h(); -int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); -if ( (x_<0)&&(x_>w()) && (y_<0)&&(y_>h())){ - return(0); -}; - - -if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ - int kpos=-1; - - if (y_>ly*3/5){//white keys - int pos=x_/SIZE_WHITE; - if (pos<0) return(1); - for (i=0;i<12;i++) { - if (pos%7==keyspos[i]) { - kpos=pos/7*12+i; - break; - }; - }; - } else {//black keys - int pos=(x_+SIZE_WHITE/2)/SIZE_WHITE; - if (pos<0) return(1); - for (i=1;i<12;i++) { - if (pos%7==-keyspos[i]) { - kpos=pos/7*12+i; - break; - }; - }; - }; - - if ((kpos!=-1)&&((event==FL_PUSH)||(event==FL_DRAG))&& - (Fl::event_shift()==0)) { - presskey(kpos,1,1); - }; - - if ((event==FL_PUSH)&&(Fl::event_shift()!=0)) { - if (pressed[kpos]==0) presskey(kpos,0,1); - else relasekey(kpos,1); - }; - if ((event==FL_RELEASE)&&(Fl::event_shift()==0)) - relaseallkeys(1); - take_focus(); -}; - - -const int *keysoct1=keysoct1qwerty; -const int *keysoct2=keysoct2qwerty; - -if (config.cfg.VirKeybLayout==2) { - keysoct1=keysoct1dw; - keysoct2=keysoct2dw; -}else if (config.cfg.VirKeybLayout==3) { - keysoct1=keysoct1qwertz; - keysoct2=keysoct2qwertz; -}else if (config.cfg.VirKeybLayout==4) { - keysoct1=keysoct1az; - keysoct2=keysoct2az; -}; - -if ((event==FL_KEYDOWN)||(event==FL_KEYUP)){ - int key=Fl::event_key(); - int kpos=-1; - for (i=0;keysoct1[i]!=0;i++) if (key==keysoct1[i]) kpos=i+12*keyoct1; - for (i=0;keysoct2[i]!=0;i++) if (key==keysoct2[i]) kpos=i+12*keyoct2; - - - - - if (kpos==-1) return(0); - if ((event==FL_KEYUP) && (Fl::event_key(key)==0) && (Fl::get_key(key)!=0)) return(0); - if (event==FL_KEYDOWN) presskey(kpos,0,2); - else relasekey(kpos,2); -}; - -return(1);} {} - } - Function {presskey(int nk,int exclusive,int type)} {} { - code {//Exclusive means that multiple keys can be pressed at once -//when the user uses the shift key -if (nk>=N_OCT*12) return; -if ((nk<0)&&(exclusive==0)) { - relaseallkeys(type); - return; -}; -if (nk<0) return; -if (pressed[nk]!=0) return;//the key is already pressed - -if (exclusive!=0) relaseallkeys(type); -pressed[nk]=type; - -damage(1); -float vel=midivel; -if (rndvelocity!=0){ - vel=midivel*(127.0-rndvelocity)/127.0+RND*rndvelocity; -}; - -pthread_mutex_lock(&master->mutex); - master->NoteOn(midich,nk+midioct*12,(int)vel); -pthread_mutex_unlock(&master->mutex);} {} - } - Function {relasekey(int nk,int type)} {} { - code {if ((nk<0)||(nk>=N_OCT*12)) return; -if (pressed[nk]==0) return;//the key is not pressed -if ((type!=0)&&(pressed[nk]!=type)) return; - -pressed[nk]=0; - - -damage(1); - -pthread_mutex_lock(&master->mutex); - master->NoteOff(midich,nk+12*midioct); -pthread_mutex_unlock(&master->mutex);} {} - } - Function {relaseallkeys(int type)} {} { - code {for (int i=0;ihide();} - xywh {95 563 650 130} type Double hide - } { - Fl_Box virkeys { - label Keyboard - xywh {10 10 590 80} box FLAT_BOX color 17 - code0 {o->init(master);} - class VirKeys - } - Fl_Counter {} { - label {"qwer.." Oct} - callback {relaseallkeys(); -virkeys->keyoct1=(int) o->value(); -virkeys->take_focus();} - tooltip {keys "q2w3er5t6y..." octave} xywh {380 95 45 15} type Simple labelsize 10 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 10 - code0 {o->value(virkeys->keyoct1);} - } - Fl_Counter {} { - label {"zxcv.." Oct} - callback {relaseallkeys(); -virkeys->keyoct2=(int) o->value(); -virkeys->take_focus();} - tooltip {keys "zsxdcvgbh..." octave} xywh {380 110 45 15} type Simple labelsize 10 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 10 - code0 {o->value(virkeys->keyoct2);} - } - Fl_Value_Slider {} { - label Vel - callback {virkeys->midivel=(int) o->value(); -virkeys->take_focus();} - tooltip Velocity xywh {95 105 100 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum 1 maximum 127 step 1 - code0 {o->value(virkeys->midivel);} - } - Fl_Counter {} { - label {Oct.} - callback {relaseallkeys(); -virkeys->midioct=(int) o->value(); -virkeys->take_focus();} - tooltip {Midi Octave} xywh {255 100 55 20} type Simple labelsize 11 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 11 - code0 {o->value(virkeys->midioct);} - } - Fl_Button {} { - label Close - callback {relaseallkeys(); -virkeyboardwindow->hide();} - xywh {545 105 55 20} box THIN_UP_BOX - } - Fl_Value_Slider {} { - label Cval - callback {int ctl=midictl; - -pthread_mutex_lock(&master->mutex); - master->SetController(virkeys->midich,ctl,(int) o->value()); -pthread_mutex_unlock(&master->mutex); -virkeys->take_focus();} - tooltip {Controller value} xywh {605 10 15 115} type {Vert Fill} box ENGRAVED_BOX selection_color 229 labelsize 8 align 5 minimum 127 maximum 0 step 1 value 64 textsize 7 - } - Fl_Choice {} { - label Controller - callback {switch((int) o->value()+1){ - case 1: midictl=C_modwheel; break; - case 2: midictl=C_volume; break; - case 3: midictl=C_panning; break; - case 4: midictl=C_expression; break; - case 5: midictl=C_sustain; break; - case 6: midictl=C_portamento; break; - case 7: midictl=C_filterq; break; - case 8: midictl=C_filtercutoff; break; - case 9: midictl=C_bandwidth; break; - case 10: midictl=C_fmamp; break; - case 11: midictl=C_resonance_center; break; - case 12: midictl=C_resonance_bandwidth; break; - default: midictl=C_NULL; break; - -}; - - - -virkeys->take_focus();} - xywh {435 105 100 15} down_box BORDER_BOX labelsize 10 align 5 when 6 textfont 1 textsize 10 - code0 {midictl=C_filtercutoff;o->value(7);} - } { - MenuItem {} { - label {01: Mod.Wheel} - xywh {0 0 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {07: Volume} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {10: Panning} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {11: Expression} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {64: Sustain} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {65: Portamento} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {71: Filter Q} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {74: Filter Freq.} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {75: Bandwidth} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {76: FM Gain} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {77: Res. c. freq} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {78: Res. bw.} - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Roller pitchwheelroller { - label Pwh - callback {pthread_mutex_lock(&master->mutex); - master->SetController(virkeys->midich,C_pitchwheel,-(int) o->value()); -pthread_mutex_unlock(&master->mutex); -virkeys->take_focus();} - tooltip {Pitch Wheel} xywh {625 10 20 95} box PLASTIC_UP_BOX labelsize 8 align 1 when 3 minimum -8192 maximum 8192 step 64 - } - Fl_Button {} { - label R - callback {pitchwheelroller->value(0); -pitchwheelroller->do_callback();} - tooltip {Reset Pitch Bend} xywh {625 110 20 15} box THIN_UP_BOX labelfont 1 - } - Fl_Dial {} { - label Vrnd - callback {virkeys->rndvelocity=(int) o->value();} - tooltip {Velocity Randomness} xywh {205 105 20 20} box ROUND_UP_BOX labelsize 10 align 129 maximum 127 step 1 - code0 {o->value(virkeys->rndvelocity);} - class WidgetPDial - } - Fl_Choice partrcv { - label {MIDI Ch.} - callback {relaseallkeys(); -virkeys->midich=(int) o->value(); -virkeys->take_focus();} open - tooltip {Send to Midi Channel} xywh {20 105 65 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drum10");};} - code1 {o->value(virkeys->midich);} - } {} - } - } - Function {VirKeyboard(Master *master_)} {} { - code {master=master_; -midictl=75; -make_window();} {} - } - Function {~VirKeyboard()} {} { - code {delete virkeyboardwindow;} {selected - } - } - Function {show()} {} { - code {virkeyboardwindow->show();} {} - } - Function {relaseallkeys()} {} { - code {virkeys->relaseallkeys(0);} {} - } - decl {Master *master;} {} - decl {int midictl;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/VirKeyboard.h b/plugins/zynaddsubfx/src/UI/VirKeyboard.h deleted file mode 100644 index 7d7e7b95e..000000000 --- a/plugins/zynaddsubfx/src/UI/VirKeyboard.h +++ /dev/null @@ -1,90 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef VirKeyboard_h -#define VirKeyboard_h -#include -#include -#include -#include -#include "../globals.h" -#include "../Misc/Master.h" -#include "../Input/MidiIn.h" -#include "WidgetPDial.h" - -class VirKeys : public Fl_Box { - static const int N_OCT=6; - static const int SIZE_WHITE=14; - static const int SIZE_BLACK=8; -public: - VirKeys(int x,int y, int w, int h, const char *label=0); - void init(Master *master_); - void draw(); - int handle(int event); - void presskey(int nk,int exclusive,int type); - void relasekey(int nk,int type); - void relaseallkeys(int type); -private: - Master *master; - int pressed[N_OCT*12+1]; -public: - unsigned char midich; - unsigned char midivel; - char midioct,keyoct1,keyoct2; - unsigned char rndvelocity; -}; -#include -#include -#include -#include -#include -#include - -class VirKeyboard { -public: - Fl_Double_Window* make_window(); - Fl_Double_Window *virkeyboardwindow; -private: - void cb_virkeyboardwindow_i(Fl_Double_Window*, void*); - static void cb_virkeyboardwindow(Fl_Double_Window*, void*); -public: - VirKeys *virkeys; -private: - void cb_qwer_i(Fl_Counter*, void*); - static void cb_qwer(Fl_Counter*, void*); - void cb_zxcv_i(Fl_Counter*, void*); - static void cb_zxcv(Fl_Counter*, void*); - void cb_Vel_i(Fl_Value_Slider*, void*); - static void cb_Vel(Fl_Value_Slider*, void*); - void cb_Oct_i(Fl_Counter*, void*); - static void cb_Oct(Fl_Counter*, void*); - void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - void cb_Cval_i(Fl_Value_Slider*, void*); - static void cb_Cval(Fl_Value_Slider*, void*); - void cb_Controller_i(Fl_Choice*, void*); - static void cb_Controller(Fl_Choice*, void*); - static Fl_Menu_Item menu_Controller[]; -public: - Fl_Roller *pitchwheelroller; -private: - void cb_pitchwheelroller_i(Fl_Roller*, void*); - static void cb_pitchwheelroller(Fl_Roller*, void*); - void cb_R_i(Fl_Button*, void*); - static void cb_R(Fl_Button*, void*); - void cb_Vrnd_i(WidgetPDial*, void*); - static void cb_Vrnd(WidgetPDial*, void*); -public: - Fl_Choice *partrcv; -private: - void cb_partrcv_i(Fl_Choice*, void*); - static void cb_partrcv(Fl_Choice*, void*); -public: - VirKeyboard(Master *master_); - ~VirKeyboard(); - void show(); - void relaseallkeys(); -private: - Master *master; - int midictl; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/WidgetPDial.cc b/plugins/zynaddsubfx/src/UI/WidgetPDial.cc deleted file mode 100644 index 05e31b89c..000000000 --- a/plugins/zynaddsubfx/src/UI/WidgetPDial.cc +++ /dev/null @@ -1,215 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#include "WidgetPDial.h" -//Copyright (c) 2003-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -TipWin::TipWin():Fl_Menu_Window(1,1) { - strcpy(tip, "X.XX"); - set_override(); - end(); -} - -void TipWin::draw() { - draw_box(FL_BORDER_BOX, 0, 0, w(), h(), Fl_Color(175)); - fl_color(FL_BLACK); - fl_font(labelfont(), labelsize()); - if(textmode) - fl_draw(text, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP)); - else - fl_draw(tip, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP)); -} - -void TipWin::value(float f) { - sprintf(tip, "%.2f", f); - textmode=false; - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = w(), H = h(); - fl_measure(tip, W, H, 0); - W += 8; - size(W, H); - redraw(); -} - -void TipWin::setText(const char * c) { - strncpy(text, c, max_tooltip_len-1); - text[max_tooltip_len-1] = 0; - textmode=true; - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = w(), H = h(); - fl_measure(text, W, H, 0); - W += 8; - size(W, H); - redraw(); -} - -void TipWin::setTextmode() { - textmode=true; - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = w(), H = h(); - fl_measure(text, W, H, 0); - W += 8; - size(W, H); - redraw(); -} - -WidgetPDial::WidgetPDial(int x,int y, int w, int h, const char *label):Fl_Dial(x,y,w,h,label) { - callback(value_cb, (void*)this); - Fl_Group *save = Fl_Group::current(); - tipwin = new TipWin(); - tipwin->hide(); - Fl_Group::current(save); - oldvalue=0.0; - pos=false; - textset=false; -} - -WidgetPDial::~WidgetPDial() { - delete tipwin; -} - -int WidgetPDial::handle(int event) { - double dragsize,v,min=minimum(),max=maximum(); - int my; - - switch (event){ - case FL_PUSH: - oldvalue=value(); - case FL_DRAG: - if(!pos){ - tipwin->position(Fl::event_x_root(), Fl::event_y_root()+20); - pos=true; - } - tipwin->value(value()); - tipwin->show(); - my=-(Fl::event_y()-y()-h()/2); - - dragsize=200.0; - if (Fl::event_state(FL_BUTTON1)==0) dragsize*=10; - v=oldvalue+my/dragsize*(max-min); - if (vmax) v=max; - - //printf("%d %g %g\n",my,v,oldvalue); - value(v); - value_damage(); - if (this->when()!=0) do_callback(); - return(1); - break; - case FL_ENTER: - if(textset){ - if(!pos){ - tipwin->position(Fl::event_x_root(), Fl::event_y_root()+20); - pos=true; - } - tipwin->setTextmode(); - tipwin->show(); - return(1);} - break; - case FL_HIDE: - case FL_LEAVE: - tipwin->hide(); - pos=false; - break; - case FL_RELEASE: - tipwin->hide(); - pos=false; - if (this->when()==0) do_callback(); - return(1); - break; - }; - return(0); -} - -void WidgetPDial::drawgradient(int cx,int cy,int sx,double m1,double m2) { - for (int i=(int)(m1*sx);i<(int)(m2*sx);i++){ - double tmp=1.0-pow(i*1.0/sx,2.0); - pdialcolor(140+(int) (tmp*90),140+(int)(tmp*90),140+(int) (tmp*100)); - fl_arc(cx+sx/2-i/2,cy+sx/2-i/2,i,i,0,360); - }; -} - -void WidgetPDial::draw() { - int cx=x(),cy=y(),sx=w(),sy=h(); - - - //clears the button face - pdialcolor(190,190,200); - fl_pie(cx-1,cy-1,sx+2,sy+2,0,360); - - //Draws the button face (gradinet) - drawgradient(cx,cy,sx,0.5,1.0); - - double val=(value()-minimum())/(maximum()-minimum()); - - //draws the scale - pdialcolor(220,220,250); - double a1=angle1(),a2=angle2(); - for (int i=0;i<12;i++){ - double a=-i/12.0*360.0-val*(a2-a1)-a1; - fl_pie(cx,cy,sx,sy,a+270-3,a+3+270); - }; - - drawgradient(cx,cy,sx,0.0,0.75); - - //draws the value - double a=-(a2-a1)*val-a1; - - - - - - //draws the max and min points - pdialcolor(0,100,200); - int xp=(int)(cx+sx/2.0+sx/2.0*sin(angle1()/180.0*3.141592)); - int yp=(int)(cy+sy/2.0+sy/2.0*cos(angle1()/180.0*3.141592)); - fl_pie(xp-2,yp-2,4,4,0,360); - - xp=(int)(cx+sx/2.0+sx/2.0*sin(angle2()/180.0*3.141592)); - yp=(int)(cy+sy/2.0+sy/2.0*cos(angle2()/180.0*3.141592)); - fl_pie(xp-2,yp-2,4,4,0,360); - - - - - - fl_push_matrix(); - - fl_translate(cx+sx/2,cy+sy/2); - fl_rotate(a-90.0); - - fl_translate(sx/2,0); - - - fl_begin_polygon(); - pdialcolor(0,0,0); - fl_vertex(-10,-4); - fl_vertex(-10,4); - fl_vertex(0,0); - fl_end_polygon(); - - - fl_pop_matrix(); -} - -void WidgetPDial::pdialcolor(int r,int g,int b) { - if (active_r()) fl_color(r,g,b); - else fl_color(160-(160-r)/3,160-(160-b)/3,160-(160-b)/3); -} - -void WidgetPDial::value_cb2() { - tipwin->value(value()); -} - -void WidgetPDial::value_cb(Fl_Widget*, void*data) { - WidgetPDial *val = (WidgetPDial*)data; - val->value_cb2(); -} - -void WidgetPDial::tooltip(const char * c) { - tipwin->setText(c); - textset=true; -} diff --git a/plugins/zynaddsubfx/src/UI/WidgetPDial.fl b/plugins/zynaddsubfx/src/UI/WidgetPDial.fl deleted file mode 100644 index f68a96ec3..000000000 --- a/plugins/zynaddsubfx/src/UI/WidgetPDial.fl +++ /dev/null @@ -1,253 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2003-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -class TipWin {: {public Fl_Menu_Window} -} { - Function {TipWin():Fl_Menu_Window(1,1)} {} { - code {strcpy(tip, "X.XX"); -set_override(); -end();} {} - } - Function {draw()} {return_type void - } { - code {draw_box(FL_BORDER_BOX, 0, 0, w(), h(), Fl_Color(175)); - fl_color(FL_BLACK); - fl_font(labelfont(), labelsize()); - if(textmode) - fl_draw(text, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP)); - else - fl_draw(tip, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP));} {} - } - Function {value(float f)} {return_type void - } { - code {sprintf(tip, "%.2f", f); -textmode=false; - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = w(), H = h(); - fl_measure(tip, W, H, 0); - W += 8; - size(W, H); - redraw();} {} - } - Function {setText(const char * c)} {return_type void - } { - code {strncpy(text, c, max_tooltip_len-1); -text[max_tooltip_len-1] = 0; -textmode=true; - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = w(), H = h(); - fl_measure(text, W, H, 0); - W += 8; - size(W, H); - redraw();} {} - } - Function {setTextmode()} {return_type void - } { - code {textmode=true; - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = w(), H = h(); - fl_measure(text, W, H, 0); - W += 8; - size(W, H); - redraw();} {} - } - decl {char tip[40];} {} - decl {bool textmode;} {} - decl {enum { max_tooltip_len = 400 };} {selected - } - decl {char text[max_tooltip_len];} {} -} - -class WidgetPDial {: {public Fl_Dial} -} { - Function {WidgetPDial(int x,int y, int w, int h, const char *label=0):Fl_Dial(x,y,w,h,label)} {} { - code {callback(value_cb, (void*)this); -Fl_Group *save = Fl_Group::current(); -tipwin = new TipWin(); -tipwin->hide(); -Fl_Group::current(save); -oldvalue=0.0; -pos=false; -textset=false;} {} - } - Function {~WidgetPDial()} {} { - code {delete tipwin;} {} - } - Function {handle(int event)} {return_type int - } { - code {double dragsize,v,min=minimum(),max=maximum(); -int my; - -switch (event){ -case FL_PUSH: - oldvalue=value(); -case FL_DRAG: - if(!pos){ - tipwin->position(Fl::event_x_root(), Fl::event_y_root()+20); - pos=true; - } - tipwin->value(value()); - tipwin->show(); - my=-(Fl::event_y()-y()-h()/2); - - dragsize=200.0; - if (Fl::event_state(FL_BUTTON1)==0) dragsize*=10; - v=oldvalue+my/dragsize*(max-min); - if (vmax) v=max; - - //printf("%d %g %g\\n",my,v,oldvalue); - value(v); - value_damage(); - if (this->when()!=0) do_callback(); - return(1); - break; -case FL_ENTER: - if(textset){ - if(!pos){ - tipwin->position(Fl::event_x_root(), Fl::event_y_root()+20); - pos=true; - } - tipwin->setTextmode(); - tipwin->show(); - return(1);} - break; -case FL_HIDE: -case FL_LEAVE: - tipwin->hide(); - pos=false; - break; -case FL_RELEASE: - tipwin->hide(); - pos=false; - if (this->when()==0) do_callback(); - return(1); - break; -}; -return(0);} {} - } - Function {drawgradient(int cx,int cy,int sx,double m1,double m2)} {return_type void - } { - code {for (int i=(int)(m1*sx);i<(int)(m2*sx);i++){ - double tmp=1.0-pow(i*1.0/sx,2.0); - pdialcolor(140+(int) (tmp*90),140+(int)(tmp*90),140+(int) (tmp*100)); - fl_arc(cx+sx/2-i/2,cy+sx/2-i/2,i,i,0,360); -};} {} - } - Function {draw()} {} { - code {int cx=x(),cy=y(),sx=w(),sy=h(); - - -//clears the button face -pdialcolor(190,190,200); -fl_pie(cx-1,cy-1,sx+2,sy+2,0,360); - -//Draws the button face (gradinet) -drawgradient(cx,cy,sx,0.5,1.0); - -double val=(value()-minimum())/(maximum()-minimum()); - -//draws the scale -pdialcolor(220,220,250); -double a1=angle1(),a2=angle2(); -for (int i=0;i<12;i++){ - double a=-i/12.0*360.0-val*(a2-a1)-a1; - fl_pie(cx,cy,sx,sy,a+270-3,a+3+270); -}; - -drawgradient(cx,cy,sx,0.0,0.75); - -//draws the value -double a=-(a2-a1)*val-a1; - - - - - -//draws the max and min points -pdialcolor(0,100,200); -int xp=(int)(cx+sx/2.0+sx/2.0*sin(angle1()/180.0*3.141592)); -int yp=(int)(cy+sy/2.0+sy/2.0*cos(angle1()/180.0*3.141592)); -fl_pie(xp-2,yp-2,4,4,0,360); - -xp=(int)(cx+sx/2.0+sx/2.0*sin(angle2()/180.0*3.141592)); -yp=(int)(cy+sy/2.0+sy/2.0*cos(angle2()/180.0*3.141592)); -fl_pie(xp-2,yp-2,4,4,0,360); - - - - - -fl_push_matrix(); - - fl_translate(cx+sx/2,cy+sy/2); - fl_rotate(a-90.0); - - fl_translate(sx/2,0); - - - fl_begin_polygon(); - pdialcolor(0,0,0); - fl_vertex(-10,-4); - fl_vertex(-10,4); - fl_vertex(0,0); - fl_end_polygon(); - - -fl_pop_matrix();} {} - } - Function {pdialcolor(int r,int g,int b)} {} { - code {if (active_r()) fl_color(r,g,b); - else fl_color(160-(160-r)/3,160-(160-b)/3,160-(160-b)/3);} {} - } - Function {value_cb2()} {return_type void - } { - code {tipwin->value(value());} {} - } - Function {value_cb(Fl_Widget*, void*data)} {return_type {static void} - } { - code {WidgetPDial *val = (WidgetPDial*)data; - val->value_cb2();} {} - } - Function {tooltip(const char * c)} {return_type void - } { - code {tipwin->setText(c); -textset=true;} {} - } - decl {bool textset;} {} - decl {bool pos;} {} - decl {double oldvalue;} {} - decl {TipWin *tipwin;} {} -} diff --git a/plugins/zynaddsubfx/src/UI/WidgetPDial.h b/plugins/zynaddsubfx/src/UI/WidgetPDial.h deleted file mode 100644 index e81f17e18..000000000 --- a/plugins/zynaddsubfx/src/UI/WidgetPDial.h +++ /dev/null @@ -1,46 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0300 - -#ifndef WidgetPDial_h -#define WidgetPDial_h -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class TipWin : public Fl_Menu_Window { -public: - TipWin(); - void draw(); - void value(float f); - void setText(const char * c); - void setTextmode(); -private: - char tip[40]; - bool textmode; - enum { max_tooltip_len = 400 }; - char text[max_tooltip_len]; -}; - -class WidgetPDial : public Fl_Dial { -public: - WidgetPDial(int x,int y, int w, int h, const char *label=0); - ~WidgetPDial(); - int handle(int event); - void drawgradient(int cx,int cy,int sx,double m1,double m2); - void draw(); - void pdialcolor(int r,int g,int b); - void value_cb2(); - static void value_cb(Fl_Widget*, void*data); - void tooltip(const char * c); -private: - bool textset; - bool pos; - double oldvalue; - TipWin *tipwin; -}; -#endif diff --git a/plugins/zynaddsubfx/src/UI/filechooser.h b/plugins/zynaddsubfx/src/UI/filechooser.h deleted file mode 100644 index b557db94c..000000000 --- a/plugins/zynaddsubfx/src/UI/filechooser.h +++ /dev/null @@ -1,27 +0,0 @@ -#define fl_file_chooser fixed_file_chooser -#include - -extern std::string __presets_dir; - -static inline char * fixed_file_chooser(const char * message, const char *pattern, const char *fname, int relative = 0) -{ - Fl_File_Chooser* fc = new Fl_File_Chooser( __presets_dir.c_str(), - pattern, - Fl_File_Chooser::SINGLE, - message ); - fc->show(); - while( fc->shown() ) - { - Fl::wait(); - } - - char * r = NULL; - if( fc->count() > 0 ) - { - r = strdup( fc->value() ); - } - delete fc; - - return r; -} - diff --git a/plugins/zynaddsubfx/src/globals.h b/plugins/zynaddsubfx/src/globals.h deleted file mode 100644 index 9f52c3569..000000000 --- a/plugins/zynaddsubfx/src/globals.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - globals.h - it contains program settings and the program capabilities - like number of parts, of effects - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#ifndef GLOBALS_H -#define GLOBALS_H - -//What float type I use for internal sampledata -#define REALTYPE float - -struct FFTFREQS { - REALTYPE *s, *c; //sine and cosine components -}; - -extern void newFFTFREQS(FFTFREQS *f, int size); -extern void deleteFFTFREQS(FFTFREQS *f); - -/**Sampling rate*/ -extern int SAMPLE_RATE; - -/** - * The size of a sound buffer (or the granularity) - * All internal transfer of sound data use buffer of this size - * All parameters are constant during this period of time, exception - * some parameters(like amplitudes) which are linear interpolated. - * If you increase this you'll ecounter big latencies, but if you - * decrease this the CPU requirements gets high. - */ -extern int SOUND_BUFFER_SIZE; - - -/** - * The size of ADnote Oscillator - * Decrease this => poor quality - * Increase this => CPU requirements gets high (only at start of the note) - */ -extern int OSCIL_SIZE; - -/** - * The number of harmonics of additive synth - * This must be smaller than OSCIL_SIZE/2 - */ -#define MAX_AD_HARMONICS 128 - - -/** - * The number of harmonics of substractive - */ -#define MAX_SUB_HARMONICS 64 - - -/* - * The maximum number of samples that are used for 1 PADsynth instrument(or item) - */ -#define PAD_MAX_SAMPLES 64 - - -/* - * Number of parts - */ -#define NUM_MIDI_PARTS 16 - -/* - * Number of Midi channes - */ -#define NUM_MIDI_CHANNELS 16 - -/* - * The number of voices of additive synth for a single note - */ -#define NUM_VOICES 8 - -/* - * The poliphony (notes) - */ -#define POLIPHONY 128 - -/* - * Number of system effects - */ -#define NUM_SYS_EFX 4 - - -/* - * Number of insertion effects - */ -#define NUM_INS_EFX 8 - -/* - * Number of part's insertion effects - */ -#define NUM_PART_EFX 3 - -/* - * Maximum number of the instrument on a part - */ -#define NUM_KIT_ITEMS 16 - - -/* - * How is applied the velocity sensing - */ -#define VELOCITY_MAX_SCALE 8.0 - -/* - * The maximum length of instrument's name - */ -#define PART_MAX_NAME_LEN 30 - -/* - * The maximum number of bands of the equaliser - */ -#define MAX_EQ_BANDS 8 -#if (MAX_EQ_BANDS >= 20) -#error "Too many EQ bands in globals.h" -#endif - - -/* - * Maximum filter stages - */ -#define MAX_FILTER_STAGES 5 - -/* - * Formant filter (FF) limits - */ -#define FF_MAX_VOWELS 6 -#define FF_MAX_FORMANTS 12 -#define FF_MAX_SEQUENCE 8 - -#define LOG_2 0.693147181 -#define PI 3.1415926536 -#define LOG_10 2.302585093 - -/* - * The threshold for the amplitude interpolation used if the amplitude - * is changed (by LFO's or Envelope's). If the change of the amplitude - * is below this, the amplitude is not interpolated - */ -#define AMPLITUDE_INTERPOLATION_THRESHOLD 0.0001 - -/* - * How the amplitude threshold is computed - */ -#define ABOVE_AMPLITUDE_THRESHOLD(a, b) ((2.0 * fabs((b) - (a)) \ - / (fabs((b) + (a) + 0.0000000001))) > \ - AMPLITUDE_INTERPOLATION_THRESHOLD) - -/* - * Interpolate Amplitude - */ -#define INTERPOLATE_AMPLITUDE(a, b, x, size) ((a) \ - + ((b) \ - - (a)) * (REALTYPE)(x) \ - / (REALTYPE) (size)) - - -/* - * dB - */ -#define dB2rap(dB) ((exp((dB) * LOG_10 / 20.0))) -#define rap2dB(rap) ((20 * log(rap) / LOG_10)) - -/* - * The random generator (0.0..1.0) - */ -#define RND (rand() / (RAND_MAX + 1.0)) - -#define ZERO(data, size) {char *data_ = (char *) data; for(int i = 0; \ - i < size; \ - i++) \ - data_[i] = 0;} -#define ZERO_REALTYPE(data, size) {REALTYPE *data_ = (REALTYPE *) data; \ - for(int i = 0; \ - i < size; \ - i++) \ - data_[i] = 0.0;} - -enum ONOFFTYPE { - OFF = 0, ON = 1 -}; - -enum MidiControllers { - C_NULL = 0, C_pitchwheel = 1000, C_expression = 11, C_panning = 10, - C_filtercutoff = 74, C_filterq = 71, C_bandwidth = 75, C_modwheel = 1, - C_fmamp = 76, - C_volume = 7, C_sustain = 64, C_allnotesoff = 123, C_allsoundsoff = 120, - C_resetallcontrollers = 121, - C_portamento = 65, C_resonance_center = 77, C_resonance_bandwidth = 78, - - C_dataentryhi = 0x06, C_dataentrylo = 0x26, C_nrpnhi = 99, C_nrpnlo = 98 -}; - -enum LegatoMsg { - LM_Norm, LM_FadeIn, LM_FadeOut, LM_CatchUp, LM_ToNorm -}; - -//is like i=(int)(floor(f)) -#ifdef ASM_F2I_YES -#define F2I(f, \ - i) __asm__ __volatile__ ("fistpl %0" : "=m" (i) : "t" (f \ - - 0.49999999) \ - : "st"); -#else -#define F2I(f, i) (i) = ((f > 0) ? ((int)(f)) : ((int)(f - 1.0))); -#endif - - - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#endif - diff --git a/plugins/zynaddsubfx/zynaddsubfx b/plugins/zynaddsubfx/zynaddsubfx new file mode 160000 index 000000000..2ffc12005 --- /dev/null +++ b/plugins/zynaddsubfx/zynaddsubfx @@ -0,0 +1 @@ +Subproject commit 2ffc12005865855add8fa7f3129e563e34215c06 diff --git a/plugins/zynaddsubfx/zynaddsubfx.rc.in b/plugins/zynaddsubfx/zynaddsubfx.rc.in index ebc0c32ad..3cb13470c 100644 --- a/plugins/zynaddsubfx/zynaddsubfx.rc.in +++ b/plugins/zynaddsubfx/zynaddsubfx.rc.in @@ -1,4 +1,4 @@ -zynaddsubfx_icon ICON zynaddsubfx_icon.ico +zynaddsubfx_icon ICON zynaddsubfx/zynaddsubfx.ico #include VS_VERSION_INFO VERSIONINFO diff --git a/plugins/zynaddsubfx/zynaddsubfx_icon.ico b/plugins/zynaddsubfx/zynaddsubfx_icon.ico deleted file mode 100644 index 80f0519d3..000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx_icon.ico and /dev/null differ diff --git a/src/core/midi/MidiPort.cpp b/src/core/midi/MidiPort.cpp index 3c5bd495f..c5f8e5afa 100644 --- a/src/core/midi/MidiPort.cpp +++ b/src/core/midi/MidiPort.cpp @@ -48,7 +48,7 @@ MidiPort::MidiPort( const QString& name, m_outputControllerModel( 0, 0, MidiControllerCount, this, tr( "Output controller" ) ), m_fixedInputVelocityModel( -1, -1, MidiMaxVelocity, this, tr( "Fixed input velocity" ) ), m_fixedOutputVelocityModel( -1, -1, MidiMaxVelocity, this, tr( "Fixed output velocity" ) ), - m_fixedOutputNoteModel( -1, -1, MidiMaxNote, this, tr( "Fixed output note" ) ), + m_fixedOutputNoteModel( -1, -1, MidiMaxKey, this, tr( "Fixed output note" ) ), m_outputProgramModel( 1, 1, MidiProgramCount, this, tr( "Output MIDI program" ) ), m_baseVelocityModel( MidiMaxVelocity/2, 1, MidiMaxVelocity, this, tr( "Base velocity" ) ), m_readableModel( false, this, tr( "Receive MIDI-events" ) ),