From 060a3fbd03c4ff8714da28efe6a2b230231d305f Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Sun, 2 Mar 2008 22:00:55 +0000 Subject: dssi plugins: fix LADSPA port count --- muse/CMakeLists.txt | 2 +- muse/ChangeLog | 2 ++ muse/muse/audiotrack.cpp | 8 ++++++-- muse/muse/dssihost.cpp | 38 +++++++++++++++++++++----------------- muse/muse/globaldefs.h | 2 +- muse/muse/synth.cpp | 3 ++- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt index 0c8e1eec..9cfc9e12 100644 --- a/muse/CMakeLists.txt +++ b/muse/CMakeLists.txt @@ -54,7 +54,7 @@ include ( ${PROJECT_SOURCE_DIR}/cmake/TargetDoc.cmake) option ( ENABLE_DSSI "enable Disposable Soft Synth Interface" ON) option ( ENABLE_VST "enable VST/win support" OFF) option ( ENABLE_FLUID "enable fluidsynth softsynth plugins" ON) -option ( ENABLE_ZYNADDSUBFX "enable zyaddsubfx softsynth plugin" ON) +option ( ENABLE_ZYNADDSUBFX "enable zyaddsubfx softsynth plugin" OFF) ## ## Just print a notice if this is OS X diff --git a/muse/ChangeLog b/muse/ChangeLog index 652c5320..867d88f7 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,5 @@ +2.3. (ws) + - dssi plugins: fix count of LADSPA ports 21.02. (fn) - "Ported" simpledrums to Qt4 - it builds, runs, produces sound (and compiler warnings); review is welcome. The GUI is rather large now. diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp index dc637bcd..3fa59e4f 100644 --- a/muse/muse/audiotrack.cpp +++ b/muse/muse/audiotrack.cpp @@ -398,9 +398,13 @@ void AudioTrack::record() void AudioTrack::setChannels(int n) { +printf("setChannels %d\n", n); + if (n > MAX_CHANNELS) { - fprintf(stderr, "AudioTrack::setChannels(%d): too many channels!\n", n); - abort(); + fprintf(stderr, "AudioTrack::setChannels(%d): too many channels(>%d)!\n", + n, MAX_CHANNELS); + n = MAX_CHANNELS; +abort(); } Track::setChannels(n); if (_prePipe) diff --git a/muse/muse/dssihost.cpp b/muse/muse/dssihost.cpp index fa91230b..a367fd8f 100644 --- a/muse/muse/dssihost.cpp +++ b/muse/muse/dssihost.cpp @@ -346,11 +346,9 @@ bool DssiSynthIF::init(DssiSynth* s) const DSSI_Descriptor* dssi = synth->dssi; const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin; handle = ld->instantiate(ld, AL::sampleRate); -#if 0 - if (ld->activate) - ld->activate(handle); -#endif + queryPrograms(); + int controlPorts = synth->_controller; controls = new LadspaPort[controlPorts]; @@ -359,10 +357,10 @@ bool DssiSynthIF::init(DssiSynth* s) controls[k].val = ladspaDefaultValue(ld, i); ld->connect_port(handle, i, &controls[k].val); } -#if 1 + if (ld->activate) ld->activate(handle); -#endif + if (dssi->configure) { char *rv = dssi->configure(handle, DSSI_PROJECT_DIRECTORY_KEY, song->projectPath().toAscii().data()); @@ -576,18 +574,24 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) const LADSPA_Descriptor* d = dssi->LADSPA_Plugin; for (unsigned k = 0; k < d->PortCount; ++k) { LADSPA_PortDescriptor pd = d->PortDescriptors[k]; - static const int CI = LADSPA_PORT_CONTROL | LADSPA_PORT_INPUT; - if ((pd & CI) == CI) { - ++_controller; - pIdx.push_back(k); - } - else if (pd & LADSPA_PORT_INPUT) { - ++_inports; - iIdx.push_back(k); + if (LADSPA_IS_PORT_AUDIO(pd)) { + if (LADSPA_IS_PORT_INPUT(pd)) { + ++_inports; + iIdx.push_back(k); + } + else if (LADSPA_IS_PORT_OUTPUT(pd)) { + ++_outports; + oIdx.push_back(k); + } } - else if (pd & LADSPA_PORT_OUTPUT) { - ++_outports; - oIdx.push_back(k); + else if (LADSPA_IS_PORT_CONTROL(pd)) { + if (LADSPA_IS_PORT_INPUT(pd)) { + ++_controller; + pIdx.push_back(k); + } + else { + // ?? + } } } } diff --git a/muse/muse/globaldefs.h b/muse/muse/globaldefs.h index 72f1f948..4f72bcc3 100644 --- a/muse/muse/globaldefs.h +++ b/muse/muse/globaldefs.h @@ -21,7 +21,7 @@ #ifndef __GLOBALDEFS_H__ #define __GLOBALDEFS_H__ -const int MAX_CHANNELS = 2; // max audio channels +static const int MAX_CHANNELS = 2; // max audio channels // const int MIDI_PORTS = 16; // max Number of Midi Ports #ifndef MIDI_CHANNELS diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp index e9682347..6cd14761 100644 --- a/muse/muse/synth.cpp +++ b/muse/muse/synth.cpp @@ -251,7 +251,8 @@ bool SynthI::initInstance(Synth* s) _sif = s->createSIF(this); setIName(name()); // set instrument name - AudioTrack::setChannels(_sif->channels()); + int n = _sif->channels(); + AudioTrack::setChannels(n); //--------------------------------------------------- // read available controller from synti -- cgit v1.2.3