From f8220785a652ccff66fd46ebc440ac8071288511 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sat, 9 Apr 2011 21:25:50 +0000 Subject: minor fixes --- muse2/ChangeLog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'muse2/ChangeLog') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 60efd357..ebbed9ff 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,4 +1,7 @@ -1.04.2011: +09.04.2011: + - No more sleep icon when cancelling a quit operation (rj) + - added Ctrl+Shift+LeftMouseButton to add entire rows to selection in all canvas editors (rj) +01.04.2011: - Fixed custom LADSPA DSSI GUI support. Tested OK with FLAM. Thanks to Luis Garrido for help. (Tim) 31.03.2011: * Feature: Support for custom LADSPA DSSI GUIs, such as those generated by FLAM. (p4.0.19 Tim) -- cgit v1.2.3 From c023bdc9ab1cdc422ab35ea8b984899ee2f4219d Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sun, 10 Apr 2011 23:46:23 +0000 Subject: Please see ChangeLog --- muse2/ChangeLog | 11 ++ muse2/muse/arranger/tlist.cpp | 67 +++++-- muse2/muse/audio.cpp | 4 + muse2/muse/audio.h | 2 + muse2/muse/audiotrack.cpp | 52 +++++- muse2/muse/driver/dummyaudio.cpp | 66 ++++++- muse2/muse/dssihost.cpp | 309 ++++++++++++++++++++++--------- muse2/muse/dssihost.h | 19 +- muse2/muse/globaldefs.h | 8 +- muse2/muse/instruments/minstrument.h | 3 + muse2/muse/midiport.cpp | 18 ++ muse2/muse/midiport.h | 2 + muse2/muse/mixer/astrip.cpp | 38 ++-- muse2/muse/mixer/rack.cpp | 1 + muse2/muse/osc.cpp | 4 + muse2/muse/plugin.cpp | 60 +++++- muse2/muse/plugin.h | 51 +++-- muse2/muse/remote/pyapi.cpp | 1 + muse2/muse/seqmsg.cpp | 14 ++ muse2/muse/song.cpp | 2 + muse2/muse/synth.cpp | 51 ++++- muse2/muse/synth.h | 35 +++- muse2/muse/ticksynth.cpp | 8 +- muse2/muse/vst.cpp | 8 +- muse2/muse/vst.h | 13 +- muse2/muse/widgets/genset.cpp | 12 +- muse2/muse/widgets/gensetbase.ui | 36 +--- muse2/synti/deicsonze/deicsonze.cpp | 12 +- muse2/synti/deicsonze/deicsonze.h | 13 +- muse2/synti/fluid/fluid.cpp | 4 +- muse2/synti/fluid/fluid.h | 9 +- muse2/synti/fluidsynth/fluidsynti.cpp | 8 +- muse2/synti/fluidsynth/fluidsynti.h | 9 +- muse2/synti/libsynti/mess.cpp | 21 ++- muse2/synti/libsynti/mess.h | 5 + muse2/synti/organ/organ.cpp | 16 +- muse2/synti/organ/organ.h | 13 +- muse2/synti/s1/s1.cpp | 13 +- muse2/synti/simpledrums/simpledrums.cpp | 18 +- muse2/synti/simpledrums/simpledrums.h | 9 +- muse2/synti/simpledrums2/simpledrums.cpp | 18 +- muse2/synti/simpledrums2/simpledrums.h | 9 +- muse2/synti/vam/vam.cpp | 29 +-- 43 files changed, 811 insertions(+), 290 deletions(-) (limited to 'muse2/ChangeLog') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index ebbed9ff..d42c3127 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,14 @@ +10.04.2011: + * Added: Expanded all routing choices: Synth to Wave track, Wave track to Wave track etc. (Tim) + * Added: DSSI synths can now show generic LADSPA GUI as well as native. (Tim p4.0.20) + WIP: Controllers not finished + maybe need a chooser for which ones (of possibly 1000's) are shown. + I reserved an Audio track controller index of 9 for them. If we ever decide to increase the number + of rack plugins, that gives us room for 8 maximum, for now. (But increasing the maximum number + of controllers would mean altering the list structure, requiring a bump-up of file version.) + - Dummy audio: Fixed lockups, or crash at line: "while (drvPtr->cmdQueue.size())" in dummy loop. (Tim) + Replaced loop code with with muse_qt4_evolution's (usleep-based instead of timer). + TODO: Try subtracting process time from sleep time for more accuracy. + TODO: Use a better sleep routine - usleep may be have terrible resolution in some cases. 09.04.2011: - No more sleep icon when cancelling a quit operation (rj) - added Ctrl+Shift+LeftMouseButton to add entire rows to selection in all canvas editors (rj) diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index b13f2ab0..b907b555 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -602,28 +602,48 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) SynthI* synth = (SynthI*)t; QMenu* p = new QMenu; - QAction* act = p->addAction(tr("Show Gui")); - act->setCheckable(true); + //QAction* act = p->addAction(tr("Show Gui")); + QAction* gact = p->addAction(tr("show gui")); + //act->setCheckable(true); + gact->setCheckable(true); //printf("synth hasgui %d, gui visible %d\n",synth->hasGui(), synth->guiVisible()); - act->setEnabled(synth->hasGui()); - act->setChecked(synth->guiVisible()); + //act->setEnabled(synth->hasGui()); + //act->setChecked(synth->guiVisible()); + gact->setEnabled(synth->hasGui()); + gact->setChecked(synth->guiVisible()); + + QAction* nact = p->addAction(tr("show native gui")); + //act->setCheckable(true); + nact->setCheckable(true); + //printf("synth hasgui %d, gui visible %d\n",synth->hasGui(), synth->guiVisible()); + //act->setEnabled(synth->hasGui()); + //act->setChecked(synth->guiVisible()); + nact->setEnabled(synth->hasNativeGui()); + nact->setChecked(synth->nativeGuiVisible()); // If it has a gui but we don't have OSC, disable the action. #ifndef OSC_SUPPORT #ifdef DSSI_SUPPORT if(dynamic_cast(synth->sif())) { - act->setChecked(false); - act->setEnabled(false); + //act->setChecked(false); + //act->setEnabled(false); + nact->setChecked(false); + nact->setEnabled(false); } #endif #endif QAction* ract = p->exec(mapToGlobal(QPoint(x, y)), 0); - if (ract == act) { + //if (ract == act) { + if (ract == gact) { bool show = !synth->guiVisible(); audio->msgShowInstrumentGui(synth, show); } + else if (ract == nact) { + bool show = !synth->nativeGuiVisible(); + audio->msgShowInstrumentNativeGui(synth, show); + } delete p; return; } @@ -635,29 +655,46 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) MidiPort* port = &midiPorts[oPort]; QMenu* p = new QMenu; - QAction* act = p->addAction(tr("Show Gui")); - act->setCheckable(true); + //QAction* act = p->addAction(tr("Show Gui")); + QAction* gact = p->addAction(tr("show gui")); + //act->setCheckable(true); + gact->setCheckable(true); //printf("synth hasgui %d, gui visible %d\n",port->hasGui(), port->guiVisible()); - act->setEnabled(port->hasGui()); - act->setChecked(port->guiVisible()); - + //act->setEnabled(port->hasGui()); + //act->setChecked(port->guiVisible()); + gact->setEnabled(port->hasGui()); + gact->setChecked(port->guiVisible()); + + QAction* nact = p->addAction(tr("show native gui")); + nact->setCheckable(true); + //printf("synth hasgui %d, gui visible %d\n",synth->hasGui(), synth->guiVisible()); + nact->setEnabled(port->hasNativeGui()); + nact->setChecked(port->nativeGuiVisible()); + // If it has a gui but we don't have OSC, disable the action. #ifndef OSC_SUPPORT #ifdef DSSI_SUPPORT MidiDevice* dev = port->device(); if(dev && dev->isSynti() && (dynamic_cast(((SynthI*)dev)->sif()))) { - act->setChecked(false); - act->setEnabled(false); + //act->setChecked(false); + //act->setEnabled(false); + nact->setChecked(false); + nact->setEnabled(false); } #endif #endif QAction* ract = p->exec(mapToGlobal(QPoint(x, y)), 0); - if (ract == act) { + //if (ract == act) { + if (ract == gact) { bool show = !port->guiVisible(); audio->msgShowInstrumentGui(port->instrument(), show); } + else if (ract == nact) { + bool show = !port->nativeGuiVisible(); + audio->msgShowInstrumentNativeGui(port->instrument(), show); + } delete p; } diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index f541a10c..a4b04436 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -65,6 +65,7 @@ const char* seqMsgList[] = { "SEQM_SET_AUX", "SEQM_UPDATE_SOLO_STATES", "MIDI_SHOW_INSTR_GUI", + "MIDI_SHOW_INSTR_NATIVE_GUI", "AUDIO_RECORD", "AUDIO_ROUTEADD", "AUDIO_ROUTEREMOVE", "AUDIO_REMOVEROUTES", "AUDIO_VOL", "AUDIO_PAN", @@ -736,6 +737,9 @@ void Audio::processMsg(AudioMsg* msg) case MIDI_SHOW_INSTR_GUI: midiSeq->msgUpdatePollFd(); break; + case MIDI_SHOW_INSTR_NATIVE_GUI: // p4.0.20 + midiSeq->msgUpdatePollFd(); + break; case SEQM_ADD_TEMPO: case SEQM_REMOVE_TEMPO: case SEQM_SET_GLOBAL_TEMPO: diff --git a/muse2/muse/audio.h b/muse2/muse/audio.h index ba188f8a..58f399e3 100644 --- a/muse2/muse/audio.h +++ b/muse2/muse/audio.h @@ -58,6 +58,7 @@ enum { SEQM_SET_AUX, SEQM_UPDATE_SOLO_STATES, MIDI_SHOW_INSTR_GUI, + MIDI_SHOW_INSTR_NATIVE_GUI, AUDIO_RECORD, AUDIO_ROUTEADD, AUDIO_ROUTEREMOVE, AUDIO_REMOVEROUTES, AUDIO_VOL, AUDIO_PAN, @@ -218,6 +219,7 @@ class Audio { void msgAddSig(int tick, int z, int n, bool doUndoFlag = true); void msgRemoveSig(int tick, int z, int n, bool doUndoFlag = true); void msgShowInstrumentGui(MidiInstrument*, bool); + void msgShowInstrumentNativeGui(MidiInstrument*, bool); void msgPanic(); void sendMsg(AudioMsg*); bool sendMessage(AudioMsg* m, bool doUndo); diff --git a/muse2/muse/audiotrack.cpp b/muse2/muse/audiotrack.cpp index 28020caf..98e74331 100644 --- a/muse2/muse/audiotrack.cpp +++ b/muse2/muse/audiotrack.cpp @@ -12,6 +12,7 @@ #include +#include "globaldefs.h" #include "track.h" #include "event.h" #include "song.h" @@ -20,6 +21,8 @@ #include "xml.h" #include "plugin.h" #include "audiodev.h" +#include "synth.h" +#include "dssihost.h" bool AudioAux::_isVisible=true; bool AudioInput::_isVisible=true; @@ -983,7 +986,8 @@ bool AudioTrack::readProperties(Xml& xml, const QString& tag) // controls would all be set to zero. // But we will allow for the (unintended, useless) possibility of a controller // with no matching plugin control. - PluginI* p = 0; + //PluginI* p = 0; + PluginIBase* p = 0; bool ctlfound = false; int m = l->id() & AC_PLUGIN_CTL_ID_MASK; int n = (l->id() >> AC_PLUGIN_CTL_BASE_POW) - 1; @@ -993,6 +997,25 @@ bool AudioTrack::readProperties(Xml& xml, const QString& tag) if(p && m < p->parameters()) ctlfound = true; } + // Support a special block for dssi synth ladspa controllers. p4.0.20 + else if(n == MAX_PLUGINS && type() == AUDIO_SOFTSYNTH) + { + SynthI* synti = dynamic_cast < SynthI* > (this); + if(synti) + { + SynthIF* sif = synti->sif(); + if(sif) + { + DssiSynthIF* dsif = dynamic_cast < DssiSynthIF* > (sif); + if(dsif) + { + p = dsif; + if(p && m < p->parameters()) + ctlfound = true; + } + } + } + } iCtrlList icl = _controller.find(l->id()); if (icl == _controller.end()) @@ -1128,7 +1151,7 @@ void AudioTrack::mapRackPluginsToControllers() } } - // The loop is a safe way to delete while iterating 'non-linear' lists. + // FIXME: The loop is a safe way to delete while iterating lists. bool loop; do { @@ -1142,7 +1165,28 @@ void AudioTrack::mapRackPluginsToControllers() continue; int param = id & AC_PLUGIN_CTL_ID_MASK; int idx = (id >> AC_PLUGIN_CTL_BASE_POW) - 1; - PluginI* p = (*_efxPipe)[idx]; + //PluginI* p = (*_efxPipe)[idx]; + + // p4.0.20 + PluginIBase* p = 0; + if(idx >= 0 && idx < PipelineDepth) + p = (*_efxPipe)[idx]; + // Support a special block for dssi synth ladspa controllers. + else if(idx == MAX_PLUGINS && type() == AUDIO_SOFTSYNTH) + { + SynthI* synti = dynamic_cast < SynthI* > (this); + if(synti) + { + SynthIF* sif = synti->sif(); + if(sif) + { + DssiSynthIF* dsif = dynamic_cast < DssiSynthIF* > (sif); + if(dsif) + p = dsif; + } + } + } + // If there's no plugin at that rack position, or the param is out of range of // the number of controls in the plugin, then it's a stray controller. Delete it. // Future: Leave room for possible bypass controller at AC_PLUGIN_CTL_ID_MASK -1. @@ -1159,7 +1203,7 @@ void AudioTrack::mapRackPluginsToControllers() while (loop); - // Although this tested OK, and is the 'official' way to erase while iterating, + // FIXME: Although this tested OK, and is the 'official' way to erase while iterating, // I don't trust it. I'm weary of this method. The technique didn't work // in Audio::msgRemoveTracks(), see comments there. /* diff --git a/muse2/muse/driver/dummyaudio.cpp b/muse2/muse/driver/dummyaudio.cpp index dfa7a86b..597ecf2b 100644 --- a/muse2/muse/driver/dummyaudio.cpp +++ b/muse2/muse/driver/dummyaudio.cpp @@ -57,6 +57,7 @@ class DummyAudioDevice : public AudioDevice { int _framePos; int playPos; bool realtimeFlag; + bool seekflag; DummyAudioDevice(); virtual ~DummyAudioDevice() @@ -117,8 +118,7 @@ class DummyAudioDevice : public AudioDevice { virtual int getState() { // if(DEBUG_DUMMY) // printf("DummyAudioDevice::getState %d\n", state); - - return state; } + return state; } virtual unsigned getCurFrame() { if(DEBUG_DUMMY) printf("DummyAudioDevice::getCurFrame %d\n", _framePos); @@ -133,10 +133,14 @@ class DummyAudioDevice : public AudioDevice { virtual void startTransport() { if(DEBUG_DUMMY) printf("DummyAudioDevice::startTransport playPos=%d\n", playPos); +#if 0 Msg trcmd; trcmd.cmd = trStart; trcmd.arg = playPos; cmdQueue.push_front(trcmd); +#else + state = Audio::PLAY; +#endif /* state = Audio::START_PLAY; audio->sync(state, playPos); state = Audio::PLAY;*/ @@ -152,20 +156,33 @@ class DummyAudioDevice : public AudioDevice { { if(DEBUG_DUMMY) printf("DummyAudioDevice::seekTransport frame=%d topos=%d\n",playPos, p.frame()); +#if 0 Msg trcmd; trcmd.cmd = trSeek; trcmd.arg = p.frame(); cmdQueue.push_front(trcmd); playPos = p.frame(); +#else + seekflag = true; + //pos = n; + playPos = p.frame(); +#endif + } virtual void seekTransport(unsigned pos) { if(DEBUG_DUMMY) printf("DummyAudioDevice::seekTransport frame=%d topos=%d\n",playPos,pos); +#if 0 Msg trcmd; trcmd.cmd = trSeek; trcmd.arg = pos; cmdQueue.push_front(trcmd); playPos = pos; +#else + seekflag = true; + //pos = n; + playPos = pos; +#endif /* Audio::State tempState = state; state = Audio::START_PLAY; @@ -187,7 +204,9 @@ DummyAudioDevice::DummyAudioDevice() dummyThread = 0; realtimeFlag = false; + seekflag = false; state = Audio::STOP; + //startTime = curTime(); _framePos = 0; playPos = 0; cmdQueue.clear(); @@ -259,6 +278,7 @@ static void* dummyLoop(void* ptr) sampleRate = config.dummyAudioSampleRate; //segmentSize = dummyFrames; segmentSize = config.dummyAudioBufSize; +#if 0 //unsigned int tickRate = sampleRate / dummyFrames; unsigned int tickRate = sampleRate / segmentSize; @@ -289,13 +309,15 @@ static void* dummyLoop(void* ptr) sampleRate = tickRate * segmentSize; timer.startTimer(); +#endif DummyAudioDevice *drvPtr = (DummyAudioDevice *)ptr; - pollfd myPollFd; + ///pollfd myPollFd; + + ///myPollFd.fd = fd; + ///myPollFd.events = POLLIN; - myPollFd.fd = fd; - myPollFd.events = POLLIN; /* doSetuid(); @@ -360,6 +382,7 @@ static void* dummyLoop(void* ptr) undoSetuid(); #endif +#if 0 /* unsigned long tick = 0;*/ // prevent compiler warning: unused variable for (;;) { int _pollWait = 10; // ms @@ -408,7 +431,38 @@ static void* dummyLoop(void* ptr) drvPtr->playPos+=increment; } } - timer.stopTimer(); +#else + // Adapted from muse_qt4_evolution. p4.0.20 + for(;;) + { + //if(audioState == AUDIO_RUNNING) + if(audio->isRunning()) + //audio->process(segmentSize, drvPtr->state); + audio->process(segmentSize); + //else if (audioState == AUDIO_START1) + // audioState = AUDIO_START2; + //usleep(dummyFrames*1000000/AL::sampleRate); + usleep(segmentSize*1000000/sampleRate); + //if(dummyAudio->seekflag) + if(drvPtr->seekflag) + { + //audio->sync(Audio::STOP, dummyAudio->pos); + //audio->sync(drvPtr->state, drvPtr->playPos); + audio->sync(Audio::STOP, drvPtr->playPos); + + //dummyAudio->seekflag = false; + drvPtr->seekflag = false; + } + + //if(dummyAudio->state == Audio::PLAY) + // dummyAudio->pos += dummyFrames; + drvPtr->_framePos += segmentSize; + if(drvPtr->state == Audio::PLAY) + drvPtr->playPos += segmentSize; + } +#endif + + ///timer.stopTimer(); pthread_exit(0); } diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index ca867bd4..aa18025d 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -615,8 +615,9 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) _controlInPorts = 0; _controlOutPorts = 0; - pIdx.clear(); - opIdx.clear(); + ///pIdx.clear(); + ///opIdx.clear(); + iIdx.clear(); oIdx.clear(); rpIdx.clear(); @@ -662,7 +663,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) { rpIdx.push_back(_controlInPorts); ++_controlInPorts; - pIdx.push_back(k); + ///pIdx.push_back(k); // Set to false at first. //synti->_guiUpdateControls.push_back(false); } @@ -670,7 +671,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) { rpIdx.push_back((unsigned long)-1); ++_controlOutPorts; - opIdx.push_back(k); + ///opIdx.push_back(k); } } } @@ -718,7 +719,8 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) // guiVisible //--------------------------------------------------------- -bool DssiSynthIF::guiVisible() const +//bool DssiSynthIF::guiVisible() const +bool DssiSynthIF::nativeGuiVisible() const { //return _guiVisible; #ifdef OSC_SUPPORT @@ -727,11 +729,19 @@ bool DssiSynthIF::guiVisible() const return false; } +bool DssiSynthIF::guiVisible() const + { + //return _guiVisible; + //return false; + return _gui && _gui->isVisible(); + } + //--------------------------------------------------------- // showGui //--------------------------------------------------------- -void DssiSynthIF::showGui(bool v) +//void DssiSynthIF::showGui(bool v) +void DssiSynthIF::showNativeGui(bool v) { #ifdef OSC_SUPPORT @@ -785,6 +795,26 @@ void DssiSynthIF::showGui(bool v) */ } +//--------------------------------------------------------- +// showGui +//--------------------------------------------------------- + +void DssiSynthIF::showGui(bool v) +{ + //if (_plugin) + { + if (v) { + if (_gui == 0) + makeGui(); + _gui->show(); + } + else { + if (_gui) + _gui->hide(); + } + } +} + //--------------------------------------------------------- // receiveEvent //--------------------------------------------------------- @@ -866,8 +896,10 @@ bool DssiSynthIF::init(DssiSynth* s) synti->_guiUpdateControls.clear(); synti->_guiUpdateProgram = false; +/* for (int k = 0; k < controlPorts; ++k) { int i = synth->pIdx[k]; + controls[k].idx = i; // p4.0.20 //controls[k].val = ladspaDefaultValue(ld, i); ladspaDefaultValue(ld, i, &controls[k].val); @@ -937,85 +969,188 @@ bool DssiSynthIF::init(DssiSynth* s) for (int k = 0; k < controlOutPorts; ++k) { int i = synth->opIdx[k]; + controlsOut[k].idx = i; // p4.0.20 #ifdef DSSI_DEBUG printf("DssiSynthIF::init control output port:%d port idx:%d name:%s\n", k, i, ld->PortNames[i]); #endif - - // p3.3.39 Removed. - /* - - //controls[k].val = ladspaDefaultValue(ld, i); - ladspaDefaultValue(ld, i, &controlsOut[k].val); - - // This code is duplicated in ::getControllerInfo() - // - - int ctlnum = DSSI_NONE; - if(dssi->get_midi_controller_for_port) - ctlnum = dssi->get_midi_controller_for_port(handle, i); - - // No controller number? Try to give it a unique one... - if(ctlnum == DSSI_NONE) - { - // FIXME: Be more careful. Must make sure to pick numbers not already chosen or which WILL BE chosen. - // Simple but flawed solution: Start them at 0x60000 + 0x3000 = 0x63000. Max NRPN number is 0x3fff. - // TODO: CC etc. etc. - ctlnum = CTRL_NRPN14_OFFSET + 0x3000 + k; - } - else - { - int c = ctlnum; - // Can be both CC and NRPN! Prefer CC over NRPN. - if(DSSI_IS_CC(ctlnum)) - { - #ifdef DSSI_DEBUG - printf("DssiSynthIF::init is CC control\n"); - #endif - ctlnum = DSSI_CC_NUMBER(c); - - #ifdef DSSI_DEBUG - if(DSSI_IS_NRPN(ctlnum)) - printf("DssiSynthIF::init is also NRPN control. Using CC.\n"); - #endif - } - else - if(DSSI_IS_NRPN(ctlnum)) - { - #ifdef DSSI_DEBUG - printf("DssiSynthIF::init is NRPN control\n"); - #endif - - ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET; - } - - } + // - Control outs are not handled but still must be connected to something. + ld->connect_port(handle, i, &controlsOut[k].val); + } +*/ + // p4.0.20 + int cip = 0; + int cop = 0; + for (unsigned long k = 0; k < synth->_portCount; ++k) + { + LADSPA_PortDescriptor pd = ld->PortDescriptors[k]; + + #ifdef DSSI_DEBUG + printf("DssiSynth::init ladspa plugin Port:%ld Name:%s descriptor:%x\n", k, ld->PortNames[k], pd); + #endif + + if (LADSPA_IS_PORT_CONTROL(pd)) + { + if (LADSPA_IS_PORT_INPUT(pd)) + { + controls[cip].idx = k; + float val; + ladspaDefaultValue(ld, k, &val); + controls[cip].val = val; + controls[cip].tmpVal = val; + controls[cip].enCtrl = true; + controls[cip].en2Ctrl = true; + + // Set to false at first. + synti->_guiUpdateControls.push_back(false); + + #ifdef DSSI_DEBUG + printf("DssiSynthIF::init control port:%d port idx:%d name:%s\n", cip, k, ld->PortNames[k]); + #endif + + // This code is duplicated in ::getControllerInfo() + // + + int ctlnum = DSSI_NONE; + if(dssi->get_midi_controller_for_port) + ctlnum = dssi->get_midi_controller_for_port(handle, k); + + // No controller number? Try to give it a unique one... + if(ctlnum == DSSI_NONE) + { + // FIXME: Be more careful. Must make sure to pick numbers not already chosen or which WILL BE chosen. + // Simple but flawed solution: Start them at 0x60000 + 0x2000 = 0x62000. Max NRPN number is 0x3fff. + // TODO: Update: Actually we want to try to use CC Controller7 controllers if possible (or a choice) because what if + // the user's controller hardware doesn't support RPN? + // If CC Controller7 is chosen we must make sure to use only non-common numbers. An already limited range + // of 127 now becomes narrower. See the cool document midi-controllers.txt in the DSSI source for a + // nice roundup of numbers and how to choose them and how they relate to synths and DSSI synths etc. ! + ctlnum = CTRL_NRPN14_OFFSET + 0x2000 + cip; + } + else + { + int c = ctlnum; + // Can be both CC and NRPN! Prefer CC over NRPN. + if(DSSI_IS_CC(ctlnum)) + { + #ifdef DSSI_DEBUG + printf("DssiSynthIF::init is CC control\n"); + #endif + ctlnum = DSSI_CC_NUMBER(c); #ifdef DSSI_DEBUG - printf("DssiSynthIF::init inserting to midiCtl2PortMap: ctlnum:%d k:%d\n", ctlnum, k); + if(DSSI_IS_NRPN(ctlnum)) + printf("DssiSynthIF::init is also NRPN control. Using CC.\n"); + #endif + } + else + if(DSSI_IS_NRPN(ctlnum)) + { + #ifdef DSSI_DEBUG + printf("DssiSynthIF::init is NRPN control\n"); #endif - // We have a controller number! Insert it and the DSSI port number into the map. - // p3.3.39 Removed. Doesn't say whether it's in or out! Don't need this for now. - //synth->midiCtl2PortMap.insert(std::pair(ctlnum, k)); - - */ - - // - Control outs are not handled but still must be connected to something. - ld->connect_port(handle, i, &controlsOut[k].val); + ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET; + } + } + + #ifdef DSSI_DEBUG + printf("DssiSynthIF::init inserting to midiCtl2PortMap: ctlnum:%d k:%d\n", ctlnum, cip); + #endif + + // We have a controller number! Insert it and the DSSI port number into both maps. + synth->midiCtl2PortMap.insert(std::pair(ctlnum, cip)); + synth->port2MidiCtlMap.insert(std::pair(cip, ctlnum)); + + // Support a special block for dssi synth ladspa controllers. p4.0.20 + // Put the ID at a special block after plugins (far after). + int id = genACnum(MAX_PLUGINS, cip); + const char* name = ld->PortNames[k]; + float min, max; + ladspaControlRange(ld, k, &min, &max); + CtrlList* cl; + CtrlListList* cll = ((AudioTrack*)synti)->controller(); + iCtrlList icl = cll->find(id); + if (icl == cll->end()) + { + cl = new CtrlList(id); + cll->add(cl); + cl->setCurVal(controls[cip].val); + } + else + { + cl = icl->second; + controls[cip].val = cl->curVal(); + } + cl->setRange(min, max); + cl->setName(QString(name)); + LADSPA_PortRangeHint range = ld->PortRangeHints[k]; + if(LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) + { + cl->setMode(CtrlList::DISCRETE); + cl->setValueType(VAL_BOOL); + } + else + { + cl->setMode(CtrlList::INTERPOLATE); + cl->setValueType(VAL_LINEAR); + } + + ld->connect_port(handle, k, &controls[cip].val); + + ++cip; + } + else if (LADSPA_IS_PORT_OUTPUT(pd)) + { + controlsOut[cop].idx = k; + controls[cop].val = 0.0; + controls[cop].tmpVal = 0.0; + controls[cop].enCtrl = false; + controls[cop].en2Ctrl = false; - // Set the latency to zero. - //controls[controlPorts].val = 0.0; - // Insert a controller for latency and the DSSI port number into the map. - //synth->midiCtl2PortMap.insert(std::pair(CTRL_NRPN14_OFFSET + 0x2000, controlPorts)); - // Connect the port. - //ld->connect_port(handle, controlPorts, &controls[controlPorts].val); - - // Just a test. It works! We can instantiate a ladspa plugin for the synth. But it needs more work... - //plugins.add(&synth->info, LADSPA_Descriptor_Function(NULL), ld, false); + #ifdef DSSI_DEBUG + printf("DssiSynthIF::init control output port:%d port idx:%d name:%s\n", cop, k, ld->PortNames[k]); + #endif + + // Control outs are not handled but still must be connected to something. + ld->connect_port(handle, k, &controlsOut[cop].val); + ++cop; + } + } + } + + + /* + // Add the LADSPA controllers to the audio track controller list. p4.0.20 + //int controller = plugin->parameters(); + int controller = controlPorts; + for (int i = 0; i < controller; ++i) + { + //int id = genACnum(idx, i); + // Put the ID at a special block after plugins (far after). + int id = genACnum(MAX_PLUGINS, i); + const char* name = plugin->paramName(i); + synth->dssi->LADSPA_Plugin->PortNames[controls[i].idx] + float min, max; + plugin->range(i, &min, &max); + CtrlValueType t = plugin->valueType(); + CtrlList* cl = new CtrlList(id); + cl->setRange(min, max); + cl->setName(QString(name)); + cl->setValueType(t); + LADSPA_PortRangeHint range = plugin->range(i); + if(LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) + cl->setMode(CtrlList::DISCRETE); + else + cl->setMode(CtrlList::INTERPOLATE); + cl->setCurVal(plugin->param(i)); + addController(cl); + } + */ + if (ld->activate) ld->activate(handle); @@ -1654,7 +1789,8 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) //int num = ip->first; unsigned long k = ip->second; - unsigned long i = synth->pIdx[k]; + ///unsigned long i = synth->pIdx[k]; + unsigned long i = controls[k].idx; int ctlnum = DSSI_NONE; if(dssi->get_midi_controller_for_port) @@ -2145,8 +2281,8 @@ void DssiSynth::incInstances(int val) handle = 0; dssi = NULL; df = NULL; - pIdx.clear(); - opIdx.clear(); + ///pIdx.clear(); + ///opIdx.clear(); iIdx.clear(); oIdx.clear(); rpIdx.clear(); @@ -2334,8 +2470,9 @@ void DssiSynthIF::guiHeartBeat() { if(synti->_guiUpdateControls[i]) { - unsigned long k = synth->pIdx[i]; - _oscif.oscSendControl(k, controls[i].val); + ///unsigned long k = synth->pIdx[i]; + ///_oscif.oscSendControl(k, controls[i].val); + _oscif.oscSendControl(controls[i].idx, controls[i].val); // Reset. synti->_guiUpdateControls[i] = false; @@ -2376,8 +2513,10 @@ int DssiSynthIF::oscUpdate() unsigned long ports = synth->_controlInPorts; for(unsigned long i = 0; i < ports; ++i) { - unsigned long k = synth->pIdx[i]; - _oscif.oscSendControl(k, controls[i].val); + ///unsigned long k = synth->pIdx[i]; + ///_oscif.oscSendControl(k, controls[i].val); + _oscif.oscSendControl(controls[i].idx, controls[i].val); + // Avoid overloading the GUI if there are lots and lots of ports. if((i+1) % 50 == 0) usleep(300000); @@ -2835,8 +2974,9 @@ int DssiSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* mi //int ctlnum = ip->first; //int k = ip->second; - int i = synth->pIdx[id]; + ///int i = synth->pIdx[id]; //int i = synth->pIdx[k]; + int i = controls[id].idx; //ladspaDefaultValue(ld, i, &controls[id].val); @@ -2964,7 +3104,8 @@ int DssiSynthIF::totalInChannels() const bool DssiSynthIF::on() const { return true; } // Synth is not part of a rack plugin chain. Always on. void DssiSynthIF::setOn(bool /*val*/) { } int DssiSynthIF::pluginID() { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->UniqueID : 0; } -int DssiSynthIF::id() { return 0; } // Synth is not part of a rack plugin chain. Always 0. +//int DssiSynthIF::id() { return 0; } // Synth is not part of a rack plugin chain. Always 0. +int DssiSynthIF::id() { return MAX_PLUGINS; } // Set for special block reserved for dssi synth. p4.0.20 QString DssiSynthIF::pluginLabel() const { return (synth && synth->dssi) ? QString(synth->dssi->LADSPA_Plugin->Label) : QString(); } QString DssiSynthIF::name() const { return synti->name(); } QString DssiSynthIF::lib() const { return synth ? synth->completeBaseName() : QString(); } @@ -2980,9 +3121,9 @@ bool DssiSynthIF::readConfiguration(Xml& /*xml*/, bool /*readPreset*/) { return int DssiSynthIF::parameters() const { return synth ? synth->_controlInPorts : 0; } void DssiSynthIF::setParam(int i, double val) { setParameter(i, val); } double DssiSynthIF::param(int i) const { return getParameter(i); } -const char* DssiSynthIF::paramName(int i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[i] : 0; } +const char* DssiSynthIF::paramName(int i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[controls[i].idx] : 0; } //LADSPA_PortRangeHint DssiSynthIF::range(int i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortRangeHints[i] : 0; } -LADSPA_PortRangeHint DssiSynthIF::range(int i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[i]; } +LADSPA_PortRangeHint DssiSynthIF::range(int i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[controls[i].idx]; } #else //DSSI_SUPPORT diff --git a/muse2/muse/dssihost.h b/muse2/muse/dssihost.h index a8607ce0..a98cfd87 100644 --- a/muse2/muse/dssihost.h +++ b/muse2/muse/dssihost.h @@ -64,8 +64,8 @@ class DssiSynth : public Synth { const DSSI_Descriptor* dssi; DSSI_Descriptor_Function df; unsigned long _portCount, _inports, _outports, _controlInPorts, _controlOutPorts; - std::vector pIdx; // Control input index to port number. - std::vector opIdx; // Control output index to port number. This is sometimes a latency port and...? + //std::vector pIdx; // Control input index to port number. + //std::vector opIdx; // Control output index to port number. This is sometimes a latency port and...? std::vector iIdx; // Audio input index to port number. std::vector oIdx; // Audio output index to port number. std::vector iUsedIdx; // During process, tells whether an audio input port was used by any input routes. @@ -104,7 +104,7 @@ class DssiSynth : public Synth { unsigned long inControls() const { return _controlInPorts; } unsigned long outControls() const { return _controlOutPorts; } - unsigned long inControlPortIdx(unsigned long i) { return pIdx[i]; } + //unsigned long inControlPortIdx(unsigned long i) { return pIdx[i]; } }; //--------------------------------------------------------- @@ -160,10 +160,17 @@ class DssiSynthIF : public SynthIF, public PluginIBase virtual bool initGui(); virtual void guiHeartBeat(); virtual bool guiVisible() const; - virtual void showGui(bool v); - virtual bool hasGui() const { return synth->_hasGui; } - virtual void getGeometry(int*, int*, int*, int*) const {} + virtual void showGui(bool); + //virtual bool hasGui() const { return synth->_hasGui; } + virtual bool hasGui() const { return true; } + virtual bool nativeGuiVisible() const; // p4.0.20 + virtual void showNativeGui(bool); // + //virtual bool hasNativeGui() const { /*return synth->_hasGui; */} // + virtual bool hasNativeGui() const { return !dssi_ui_filename().isEmpty(); } // + virtual void getGeometry(int*x, int*y, int*w, int*h) const { *x=0;*y=0;*w=0;*h=0; } virtual void setGeometry(int, int, int, int) {} + virtual void getNativeGeometry(int*x, int*y, int*w, int*h) const { *x=0;*y=0;*w=0;*h=0; } + virtual void setNativeGeometry(int, int, int, int) {} virtual void preProcessAlways(); diff --git a/muse2/muse/globaldefs.h b/muse2/muse/globaldefs.h index 74c18d7d..92ccf0e0 100644 --- a/muse2/muse/globaldefs.h +++ b/muse2/muse/globaldefs.h @@ -21,9 +21,13 @@ enum AutomationType { }; const int MAX_CHANNELS = 2; // max audio channels -const int MAX_PLUGINS = 4; // plugins in mixer rack +// Absolute max number of plugins in mixer rack (if we ever want to increase PipelineDepth). +// Used to determine the index where special blocks (dssi ladspa controls) appear in the list of controllers. +// The special block(s) must appear AFTER any rack plugins, so we need this variable to help us +// leave some room in case we ever want to increase the number of rack plugins. +const int MAX_PLUGINS = 8; +const int PipelineDepth = 4; // plugins in mixer rack, max up to MAX_PLUGINS -//const int MIDI_PORTS = 32; // max Number of Midi Ports const int MIDI_PORTS = 200; // max Number of Midi Ports #ifndef MIDI_CHANNELS diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h index 0c37701f..a8fb1168 100644 --- a/muse2/muse/instruments/minstrument.h +++ b/muse2/muse/instruments/minstrument.h @@ -111,6 +111,9 @@ class MidiInstrument { virtual bool guiVisible() const { return false; } virtual void showGui(bool) {} virtual bool hasGui() const { return false; } + virtual bool nativeGuiVisible() const { return false; } + virtual void showNativeGui(bool) {} + virtual bool hasNativeGui() const { return false; } virtual void writeToGui(const MidiPlayEvent&) {} virtual void reset(int, MType); diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index 6d04cff2..7c4f73fb 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -100,6 +100,24 @@ bool MidiPort::hasGui() const return _instrument ? _instrument->hasGui() : false; } +//--------------------------------------------------------- +// nativeGuiVisible +//--------------------------------------------------------- + +bool MidiPort::nativeGuiVisible() const + { + return _instrument ? _instrument->nativeGuiVisible() : false; + } + +//--------------------------------------------------------- +// hasNativeGui +//--------------------------------------------------------- + +bool MidiPort::hasNativeGui() const + { + return _instrument ? _instrument->hasNativeGui() : false; + } + //--------------------------------------------------------- // setDevice //--------------------------------------------------------- diff --git a/muse2/muse/midiport.h b/muse2/muse/midiport.h index 46107a8d..916c7337 100644 --- a/muse2/muse/midiport.h +++ b/muse2/muse/midiport.h @@ -66,6 +66,8 @@ class MidiPort { bool guiVisible() const; bool hasGui() const; + bool nativeGuiVisible() const; + bool hasNativeGui() const; int portno() const; bool foundInSongFile() const { return _foundInSongFile; } diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index b5ab3aee..2f1a2262 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -1262,16 +1262,18 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu { case Track::AUDIO_INPUT: - id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput); + //id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput); // Rem p4.0.20 case Track::WAVE: case Track::AUDIO_GROUP: case Track::AUDIO_SOFTSYNTH: + case Track::AUDIO_AUX: // p4.0.20 + id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput); id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput); id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput); id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput); - break; - case Track::AUDIO_AUX: - id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput); + //break; // Rem p4.0.20 + //case Track::AUDIO_AUX: // + //id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput); // break; default: break; @@ -1290,13 +1292,14 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput); break; case Track::WAVE: - id = addInPorts(t, chpup, id, mm, ch, 1, isOutput); - break; + //id = addInPorts(t, chpup, id, mm, ch, 1, isOutput); // Rem p4.0.20 + //break; case Track::AUDIO_SOFTSYNTH: case Track::AUDIO_GROUP: id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput); id = addInPorts(t, chpup, id, mm, ch, 1, isOutput); id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput); + id = addAuxPorts(t, chpup, id, mm, ch, 1, isOutput); // p4.0.20 id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput); break; default: @@ -1344,17 +1347,19 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu switch(t->type()) { case Track::AUDIO_INPUT: - id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput); + //id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput); // Rem p4.0.20 case Track::WAVE: case Track::AUDIO_GROUP: case Track::AUDIO_SOFTSYNTH: + case Track::AUDIO_AUX: // p4.0.20 + id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput); // p4.0.20 id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput); id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput); id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput); break; - case Track::AUDIO_AUX: - id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput); - break; + //case Track::AUDIO_AUX: // Rem p4.0.20 + // id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput); + // break; default: break; } @@ -1371,13 +1376,14 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput); break; case Track::WAVE: - id = addInPorts(t, chpup, id, mm, ch, 2, isOutput); - break; + //id = addInPorts(t, chpup, id, mm, ch, 2, isOutput); // Rem p4.0.20 + //break; case Track::AUDIO_SOFTSYNTH: case Track::AUDIO_GROUP: id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput); id = addInPorts(t, chpup, id, mm, ch, 2, isOutput); id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput); + id = addAuxPorts(t, chpup, id, mm, ch, 2, isOutput); // p4.0.20 id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput); break; default: @@ -1838,12 +1844,17 @@ void AudioStrip::iRoutePressed() gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false); break; case Track::WAVE: + gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, false); // p4.0.20 gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false); + gid = addGroupPorts(t, pup, gid, gRoutingMenuMap, -1, -1, false); // + gid = addAuxPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false); // + gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false); // break; case Track::AUDIO_GROUP: gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, false); gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false); gid = addGroupPorts(t, pup, gid, gRoutingMenuMap, -1, -1, false); + gid = addAuxPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false); // p4.0.20 gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false); break; @@ -1975,11 +1986,12 @@ void AudioStrip::oRoutePressed() break; case Track::AUDIO_INPUT: - gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, true); + //gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, true); // Rem p4.0.20 case Track::WAVE: case Track::AUDIO_GROUP: case Track::AUDIO_AUX: //case Track::AUDIO_SOFTSYNTH: + gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, true); // p4.0.20 gid = addOutPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true); gid = addGroupPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true); gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, true); diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index daebaa30..afb8ae49 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -26,6 +26,7 @@ #include "audio.h" #include "icons.h" #include "gconfig.h" +#include "globaldefs.h" #include "plugin.h" #include "filedialog.h" diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp index 8b125a6c..2b567856 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -105,9 +105,13 @@ static int oscDebugHandler(const char* path, const char* types, lo_arg** argv, int oscMessageHandler(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data) + //int argc, lo_message data, void* user_data) { const char* p = path; + // NOTE: Tried this, always returns 0 sec and 1 fractional. Shame, looks like timestamps are not used. + //lo_timetag lo_tt = lo_message_get_timestamp(data); + #ifdef OSC_DEBUG if(argc) { diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 7866bd39..e1abbb5e 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -38,6 +38,7 @@ #include #include "globals.h" +#include "globaldefs.h" #include "gconfig.h" #include "filedialog.h" #include "slider.h" @@ -578,6 +579,39 @@ void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, floa *max = 1.0; } +/* +//--------------------------------------------------------- +// PluginBase +//--------------------------------------------------------- + +//--------------------------------------------------------- +// range +//--------------------------------------------------------- + +void PluginBase::range(unsigned long i, float* min, float* max) const + { + LADSPA_PortRangeHint range = plugin->PortRangeHints[i]; + LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor; + if (desc & LADSPA_HINT_TOGGLED) { + *min = 0.0; + *max = 1.0; + return; + } + float m = 1.0; + if (desc & LADSPA_HINT_SAMPLE_RATE) + m = float(sampleRate); + + if (desc & LADSPA_HINT_BOUNDED_BELOW) + *min = range.LowerBound * m; + else + *min = 0.0; + if (desc & LADSPA_HINT_BOUNDED_ABOVE) + *max = range.UpperBound * m; + else + *max = 1.0; + } +*/ + //--------------------------------------------------------- // Plugin //--------------------------------------------------------- @@ -859,6 +893,7 @@ int Plugin::incReferences(int val) void Plugin::range(unsigned long i, float* min, float* max) const { + /* LADSPA_PortRangeHint range = plugin->PortRangeHints[i]; LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor; if (desc & LADSPA_HINT_TOGGLED) { @@ -878,6 +913,8 @@ void Plugin::range(unsigned long i, float* min, float* max) const *max = range.UpperBound * m; else *max = 1.0; + */ + ladspaControlRange(plugin, i, min, max); // p4.0.20 } //--------------------------------------------------------- @@ -1464,6 +1501,17 @@ void Pipeline::apply(int ports, unsigned long nframes, float** buffer1) // PluginIBase //--------------------------------------------------------- +PluginIBase::PluginIBase() +{ + _gui = 0; +} + +PluginIBase::~PluginIBase() +{ + if(_gui) + delete _gui; +} + QString PluginIBase::dssi_ui_filename() const { QString libr(lib()); @@ -1548,7 +1596,7 @@ void PluginI::init() controlsOut = 0; controlPorts = 0; controlOutPorts = 0; - _gui = 0; + //_gui = 0; _on = true; initControlValues = false; _showNativeGuiPending = false; @@ -1572,8 +1620,8 @@ PluginI::~PluginI() deactivate(); _plugin->incReferences(-1); } - if (_gui) - delete _gui; + //if (_gui) + // delete _gui; if (controlsOut) delete[] controlsOut; if (controls) @@ -2234,7 +2282,8 @@ bool PluginI::nativeGuiVisible() // makeGui //--------------------------------------------------------- -void PluginI::makeGui() +//void PluginI::makeGui() +void PluginIBase::makeGui() { _gui = new PluginGui(this); } @@ -2242,7 +2291,8 @@ void PluginI::makeGui() //--------------------------------------------------------- // deleteGui //--------------------------------------------------------- -void PluginI::deleteGui() +//void PluginI::deleteGui() +void PluginIBase::deleteGui() { if(_gui) { diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index f138737c..41da1bfb 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -61,6 +61,18 @@ class PluginLoader : public QUiLoader PluginLoader(QObject * parent = 0) : QUiLoader(parent) {} }; +/* +//--------------------------------------------------------- +// PluginBase +//--------------------------------------------------------- + +class PluginBase +{ + protected: + void range(unsigned long i, float*, float*) const; +}; +*/ + //--------------------------------------------------------- // Plugin //--------------------------------------------------------- @@ -243,6 +255,7 @@ struct GuiWidgets { }; class PluginI; +class PluginGui; /* class PluginBase @@ -282,7 +295,14 @@ class PluginBase class PluginIBase { + protected: + PluginGui* _gui; + + void makeGui(); + public: + PluginIBase(); + ~PluginIBase(); virtual bool on() const = 0; virtual void setOn(bool /*val*/) = 0; virtual int pluginID() = 0; @@ -309,6 +329,11 @@ class PluginIBase virtual const char* paramName(int /*i*/) = 0; virtual LADSPA_PortRangeHint range(int /*i*/) = 0; QString dssi_ui_filename() const; + + //virtual void showGui(bool) = 0; // p4.0.20 + //virtual void showNativeGui(bool) = 0; // + PluginGui* gui() const { return _gui; } + void deleteGui(); }; //--------------------------------------------------------- @@ -381,7 +406,7 @@ class PluginI : public PluginIBase { int controlPorts; int controlOutPorts; - PluginGui* _gui; + ///PluginGui* _gui; bool _on; bool initControlValues; QString _name; @@ -397,7 +422,7 @@ class PluginI : public PluginIBase { bool _showNativeGuiPending; void init(); - void makeGui(); + ///void makeGui(); public: PluginI(); @@ -406,8 +431,8 @@ class PluginI : public PluginIBase { Plugin* plugin() const { return _plugin; } bool on() const { return _on; } void setOn(bool val) { _on = val; } - PluginGui* gui() const { return _gui; } - void deleteGui(); + ///PluginGui* gui() const { return _gui; } + ///void deleteGui(); void setTrack(AudioTrack* t) { _track = t; } AudioTrack* track() { return _track; } @@ -471,19 +496,11 @@ class PluginI : public PluginIBase { double defaultValue(unsigned int param) const; const char* paramName(int i) { return _plugin->portName(controls[i].idx); } LADSPA_PortDescriptor portd(int i) const { return _plugin->portd(controls[i].idx); } - void range(int i, float* min, float* max) const { - _plugin->range(controls[i].idx, min, max); - } - bool isAudioIn(int k) { - return (_plugin->portd(k) & AUDIO_IN) == AUDIO_IN; - } - bool isAudioOut(int k) { - return (_plugin->portd(k) & AUDIO_OUT) == AUDIO_OUT; - } + void range(int i, float* min, float* max) const { _plugin->range(controls[i].idx, min, max); } + bool isAudioIn(int k) { return (_plugin->portd(k) & AUDIO_IN) == AUDIO_IN; } + bool isAudioOut(int k) { return (_plugin->portd(k) & AUDIO_OUT) == AUDIO_OUT; } bool inPlaceCapable() const { return _plugin->inPlaceCapable(); } - LADSPA_PortRangeHint range(int i) { - return _plugin->range(controls[i].idx); - } + LADSPA_PortRangeHint range(int i) { return _plugin->range(controls[i].idx); } }; //--------------------------------------------------------- @@ -491,7 +508,7 @@ class PluginI : public PluginIBase { // chain of connected efx inserts //--------------------------------------------------------- -const int PipelineDepth = 4; +//const int PipelineDepth = 4; // Moved to globaldefs.h class Pipeline : public std::vector { float* buffer[MAX_CHANNELS]; diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index 84543b18..29ea34b3 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -12,6 +12,7 @@ #include #include "pyapi.h" +#include "globaldefs.h" #include "song.h" #include "tempo.h" #include "track.h" diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp index d2225190..564cce42 100644 --- a/muse2/muse/seqmsg.cpp +++ b/muse2/muse/seqmsg.cpp @@ -725,6 +725,20 @@ void Audio::msgShowInstrumentGui(MidiInstrument* instr, bool val) sendMessage(&msg, false); } +//--------------------------------------------------------- +// msgShowInstrumentNativeGui +//--------------------------------------------------------- + +void Audio::msgShowInstrumentNativeGui(MidiInstrument* instr, bool val) + { + instr->showNativeGui(val); + AudioMsg msg; + msg.id = MIDI_SHOW_INSTR_NATIVE_GUI; + msg.p1 = instr; + msg.a = val; + sendMessage(&msg, false); + } + //--------------------------------------------------------- // msgAddTrack //--------------------------------------------------------- diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index cf972b8c..dbb193d9 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -3431,6 +3431,8 @@ void Song::removeTrack1(Track* track) SynthI* si = (SynthI*)track; if(si->hasGui()) si->showGui(false); + if(si->hasNativeGui()) // p4.0.20 + si->showNativeGui(false); } break; default: diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp index 13e3baa3..6212340f 100644 --- a/muse2/muse/synth.cpp +++ b/muse2/muse/synth.cpp @@ -61,23 +61,23 @@ const char* MessSynth::version() const } */ -bool MessSynthIF::guiVisible() const +bool MessSynthIF::nativeGuiVisible() const { - return _mess ? _mess->guiVisible() : false; + return _mess ? _mess->nativeGuiVisible() : false; } -void MessSynthIF::showGui(bool v) +void MessSynthIF::showNativeGui(bool v) { - if (v == guiVisible()) + if (v == nativeGuiVisible()) return; if (_mess) - _mess->showGui(v); + _mess->showNativeGui(v); } -bool MessSynthIF::hasGui() const +bool MessSynthIF::hasNativeGui() const { if (_mess) - return _mess->hasGui(); + return _mess->hasNativeGui(); return false; } @@ -107,6 +107,18 @@ void MessSynthIF::setGeometry(int x, int y, int w, int h) _mess->setGeometry(x, y, w, h); } +void MessSynthIF::getNativeGeometry(int* x, int* y, int* w, int* h) const + { + if (_mess) + _mess->getNativeGeometry(x, y, w, h); + } + +void MessSynthIF::setNativeGeometry(int x, int y, int w, int h) + { + if (_mess) + _mess->setNativeGeometry(x, y, w, h); + } + //--------------------------------------------------------- // findSynth // search for synthesizer base class @@ -658,6 +670,17 @@ void SynthI::write(int level, Xml& xml) const getGeometry(&x, &y, &w, &h); if (h || w) xml.qrectTag(level, "geometry", QRect(x, y, w, h)); + //xml.geometryTag(level, "geometry", _gui); + } + + if (hasNativeGui()) { + xml.intTag(level, "nativeGuiVisible", nativeGuiVisible()); + int x, y, w, h; + w = 0; + h = 0; + getNativeGeometry(&x, &y, &w, &h); + if (h || w) + xml.qrectTag(level, "nativeGeometry", QRect(x, y, w, h)); } _stringParamMap.write(level, xml, "stringParam"); @@ -745,7 +768,8 @@ void SynthI::read(Xml& xml) int port = -1; bool startgui = false; - QRect r; + bool startngui = false; + QRect r, nr; for (;;) { Xml::Token token = xml.parse(); @@ -763,6 +787,8 @@ void SynthI::read(Xml& xml) port = xml.parseInt(); else if (tag == "guiVisible") startgui = xml.parseInt(); + else if (tag == "nativeGuiVisible") + startngui = xml.parseInt(); else if (tag == "midistate") readMidiState(xml); else if (tag == "param") { @@ -775,6 +801,8 @@ void SynthI::read(Xml& xml) readProgram(xml, tag); else if (tag == "geometry") r = readGeometry(xml, tag); + else if (tag == "nativeGeometry") + nr = readGeometry(xml, tag); else if (AudioTrack::readProperties(xml, tag)) xml.unknown("softSynth"); break; @@ -795,11 +823,14 @@ void SynthI::read(Xml& xml) // No, initializing OSC without actually showing the gui doesn't work, at least for // dssi-vst plugins - without showing the gui they exit after ten seconds. //initGui(); - showGui(startgui); - setGeometry(r.x(), r.y(), r.width(), r.height()); + showNativeGui(startngui); + setNativeGeometry(nr.x(), nr.y(), nr.width(), nr.height()); mapRackPluginsToControllers(); + showGui(startgui); + setGeometry(r.x(), r.y(), r.width(), r.height()); + // Now that the track has been added to the lists in insertTrack2(), if it's a dssi synth // OSC can find the track and its plugins, and start their native guis if required... showPendingPluginNativeGuis(); diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h index f7d5d193..100d7bd6 100644 --- a/muse2/muse/synth.h +++ b/muse2/muse/synth.h @@ -120,8 +120,19 @@ class SynthIF { virtual bool guiVisible() const = 0; virtual void showGui(bool v) = 0; virtual bool hasGui() const = 0; + //virtual bool guiVisible() const { return false; } + //virtual void showGui(bool v) { }; + //virtual bool hasGui() const { return false; } + virtual bool nativeGuiVisible() const = 0; + virtual void showNativeGui(bool v) = 0; + virtual bool hasNativeGui() const = 0; + //virtual bool nativeGuiVisible() const { return false; } + //virtual void showNativeGui(bool v) { }; + //virtual bool hasNativeGui() const { return false; } virtual void getGeometry(int*, int*, int*, int*) const = 0; virtual void setGeometry(int, int, int, int) = 0; + virtual void getNativeGeometry(int*, int*, int*, int*) const = 0; + virtual void setNativeGeometry(int, int, int, int) = 0; virtual void preProcessAlways() = 0; virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer) = 0; virtual bool putEvent(const MidiPlayEvent& ev) = 0; @@ -233,12 +244,21 @@ class SynthI : public AudioTrack, public MidiDevice, bool guiVisible() const { return _sif->guiVisible(); } void showGui(bool v) { _sif->showGui(v); } bool hasGui() const { return _sif->hasGui(); } + bool nativeGuiVisible() const { return _sif->nativeGuiVisible(); } + void showNativeGui(bool v) { _sif->showNativeGui(v); } + bool hasNativeGui() const { return _sif->hasNativeGui(); } void getGeometry(int* x, int* y, int* w, int* h) const { _sif->getGeometry(x, y, w, h); } void setGeometry(int x, int y, int w, int h) { _sif->setGeometry(x, y, w, h); } + void getNativeGeometry(int* x, int* y, int* w, int* h) const { + _sif->getNativeGeometry(x, y, w, h); + } + void setNativeGeometry(int x, int y, int w, int h) { + _sif->setNativeGeometry(x, y, w, h); + } bool putEvent(const MidiPlayEvent& ev); @@ -267,13 +287,18 @@ class MessSynthIF : public SynthIF { MessSynthIF(SynthI* s) : SynthIF(s) { _mess = 0; } virtual ~MessSynthIF() { } - virtual bool initGui() { return true; }; - virtual void guiHeartBeat() { } - virtual bool guiVisible() const; - virtual void showGui(bool v); - virtual bool hasGui() const; + virtual bool initGui() { return true; } + virtual void guiHeartBeat() { } + virtual bool guiVisible() const { return false; } + virtual void showGui(bool) { }; + virtual bool hasGui() const { return false; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool v); + virtual bool hasNativeGui() const; virtual void getGeometry(int*, int*, int*, int*) const; virtual void setGeometry(int, int, int, int); + virtual void getNativeGeometry(int*, int*, int*, int*) const; + virtual void setNativeGeometry(int, int, int, int); virtual void preProcessAlways(); virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer); virtual bool putEvent(const MidiPlayEvent& ev); diff --git a/muse2/muse/ticksynth.cpp b/muse2/muse/ticksynth.cpp index 69f3bf2d..c5d3a1e7 100644 --- a/muse2/muse/ticksynth.cpp +++ b/muse2/muse/ticksynth.cpp @@ -68,8 +68,14 @@ class MetronomeSynthIF : public SynthIF virtual bool guiVisible() const { return false; } virtual void showGui(bool) {} virtual bool hasGui() const { return false; } - virtual void getGeometry(int*, int*, int*, int*) const {} + virtual bool nativeGuiVisible() const { return false; } + virtual void showNativeGui(bool) { }; + virtual bool hasNativeGui() const { return false; } + + virtual void getGeometry(int*x, int*y, int*w, int*h) const { *x=0;*y=0;*w=0;*h=0; } virtual void setGeometry(int, int, int, int) {} + virtual void getNativeGeometry(int*x, int*y, int*w, int*h) const { *x=0;*y=0;*w=0;*h=0; } + virtual void setNativeGeometry(int, int, int, int) {} virtual void preProcessAlways() { }; virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer); virtual bool putEvent(const MidiPlayEvent& ev); diff --git a/muse2/muse/vst.cpp b/muse2/muse/vst.cpp index b34b71ca..7bcae7f6 100644 --- a/muse2/muse/vst.cpp +++ b/muse2/muse/vst.cpp @@ -361,7 +361,7 @@ void initVST() // guiVisible //--------------------------------------------------------- -bool VstSynthIF::guiVisible() const +bool VstSynthIF::nativeGuiVisible() const { return _guiVisible; } @@ -371,9 +371,9 @@ bool VstSynthIF::guiVisible() const // showGui //--------------------------------------------------------- -void VstSynthIF::showGui(bool v) +void VstSynthIF::showNativeGui(bool v) { - if (v == guiVisible()) + if (v == nativeGuiVisible()) return; if (v) fst_run_editor(_fst); @@ -395,7 +395,7 @@ MidiPlayEvent VstSynthIF::receiveEvent() // hasGui //--------------------------------------------------------- -bool VstSynthIF::hasGui() const +bool VstSynthIF::hasNativeGui() const { return _fst->plugin->flags & effFlagsHasEditor; } diff --git a/muse2/muse/vst.h b/muse2/muse/vst.h index 93012093..d41502e5 100644 --- a/muse2/muse/vst.h +++ b/muse2/muse/vst.h @@ -54,11 +54,16 @@ class VstSynthIF : public SynthIF virtual bool initGui() { return true; }; virtual void guiHeartBeat() { } - virtual bool guiVisible() const; - virtual void showGui(bool v); - virtual bool hasGui() const; - virtual void getGeometry(int*, int*, int*, int*) const {} + virtual bool guiVisible() const { return false; } + virtual void showGui(bool) { } + virtual bool hasGui() const { return false; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool v); + virtual bool hasNativeGui() const; + virtual void getGeometry(int*x, int*y, int*w, int*h) const { *x=0;*y=0;*w=0;*h=0; } virtual void setGeometry(int, int, int, int) {} + virtual void getNativeGeometry(int*x, int*y, int*w, int*h) const { *x=0;*y=0;*w=0;*h=0; } + virtual void setNativeGeometry(int, int, int, int) {} virtual void preProcessAlways() { }; virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer) ; virtual bool putEvent(const MidiPlayEvent& ev); diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 68405f9b..4a0550bb 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -83,7 +83,15 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) //DummyAudioDevice* dad = dynamic_cast(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); - dummyAudioRealRate->setText(QString().setNum(sampleRate)); + //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 + // Just a record of what the gensetbase.ui file contained for dummyAudioRate whats this: + /* + Actual rate used depends on limitations of + timer used. If a high rate timer is available, + short periods can be used with high sample rates. +Period affects midi playback resolution. +Shorter periods are desirable. + */ startSongEntry->setText(config.startSong); startSongGroup->button(config.startMode)->setChecked(true); @@ -188,7 +196,7 @@ void GlobalSettingsConfig::updateSettings() //DummyAudioDevice* dad = dynamic_cast(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); - dummyAudioRealRate->setText(QString().setNum(sampleRate)); + //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 startSongEntry->setText(config.startSong); startSongGroup->button(config.startMode)->setChecked(true); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index cdbaea2c..e452de8b 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -23,7 +23,7 @@ - 2 + 0 @@ -774,7 +774,7 @@ - Preferred sample rate + Sample rate false @@ -783,13 +783,6 @@ - - Actual rate used depends on limitations of - timer used. If a high rate timer is available, - short periods can be used with high sample rates. -Period affects midi playback resolution. -Shorter periods are desirable. - Hz @@ -808,26 +801,6 @@ Shorter periods are desirable. - - - Actual rate used now (dummy or not): - - - false - - - - - - - --- - - - false - - - - Period size (Frames per period): @@ -837,8 +810,11 @@ Shorter periods are desirable. - + + + Shorter periods give better midi playback resolution. + 16 diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp index 78869cf6..62abed5d 100644 --- a/muse2/synti/deicsonze/deicsonze.cpp +++ b/muse2/synti/deicsonze/deicsonze.cpp @@ -263,7 +263,7 @@ float* DeicsOnze::getSinusWaveTable() { //--------------------------------------------------------- // guiVisible //--------------------------------------------------------- -bool DeicsOnze::guiVisible() const +bool DeicsOnze::nativeGuiVisible() const { return _gui->isVisible(); } @@ -271,16 +271,16 @@ bool DeicsOnze::guiVisible() const //--------------------------------------------------------- // showGui //--------------------------------------------------------- -void DeicsOnze::showGui(bool val) +void DeicsOnze::showNativeGui(bool val) { _gui->setVisible(val); } //--------------------------------------------------------- -// getGeometry +// getNativeGeometry //--------------------------------------------------------- -void DeicsOnze::getGeometry(int* x, int* y, int* w, int* h) const { +void DeicsOnze::getNativeGeometry(int* x, int* y, int* w, int* h) const { QPoint pos(_gui->pos()); QSize size(_gui->size()); *x = pos.x(); @@ -299,10 +299,10 @@ void DeicsOnze::setSampleRate(int sr) { } //--------------------------------------------------------- -// setGeometry +// setNativeGeometry //--------------------------------------------------------- -void DeicsOnze::setGeometry(int x, int y, int w, int h) { +void DeicsOnze::setNativeGeometry(int x, int y, int w, int h) { _gui->resize(QSize(w, h)); _gui->move(QPoint(x, y)); } diff --git a/muse2/synti/deicsonze/deicsonze.h b/muse2/synti/deicsonze/deicsonze.h index 94da0865..dc7c533d 100644 --- a/muse2/synti/deicsonze/deicsonze.h +++ b/muse2/synti/deicsonze/deicsonze.h @@ -590,11 +590,14 @@ class DeicsOnze : public Mess { virtual void process(float** buffer, int offset, int n); // GUI interface routines - virtual bool hasGui() const { return true; } - virtual bool guiVisible() const; - virtual void showGui(bool); - virtual void getGeometry(int* x, int* y, int* w, int* h) const; - virtual void setGeometry(int, int, int, int); + //virtual bool hasGui() const { return true; } + //virtual bool guiVisible() const; + //virtual void showGui(bool); + virtual bool hasNativeGui() const { return true; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool); + virtual void getNativeGeometry(int* x, int* y, int* w, int* h) const; + virtual void setNativeGeometry(int, int, int, int); DeicsOnze(); ~DeicsOnze(); diff --git a/muse2/synti/fluid/fluid.cpp b/muse2/synti/fluid/fluid.cpp index d1802354..ad3d06a6 100644 --- a/muse2/synti/fluid/fluid.cpp +++ b/muse2/synti/fluid/fluid.cpp @@ -272,7 +272,7 @@ void ISynth::allNotesOff() // guiVisible //--------------------------------------------------------- -bool ISynth::guiVisible() const +bool ISynth::nativeGuiVisible() const { return gui->isVisible(); } @@ -281,7 +281,7 @@ bool ISynth::guiVisible() const // showGui //--------------------------------------------------------- -void ISynth::showGui(bool flag) +void ISynth::showNativeGui(bool flag) { gui->setVisible(flag); } diff --git a/muse2/synti/fluid/fluid.h b/muse2/synti/fluid/fluid.h index c1669846..e80f1463 100644 --- a/muse2/synti/fluid/fluid.h +++ b/muse2/synti/fluid/fluid.h @@ -64,9 +64,12 @@ class ISynth : public Mess { virtual const MidiPatch* getPatchInfo(int, const MidiPatch *) const; virtual void getInitData(int*, const unsigned char**); - virtual bool guiVisible() const; - virtual void showGui(bool); - virtual bool hasGui() const { return true; } + //virtual bool guiVisible() const; + //virtual void showGui(bool); + //virtual bool hasGui() const { return true; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool); + virtual bool hasNativeGui() const { return true; } public: ISynth(); diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp index 327cde39..aadc92ef 100644 --- a/muse2/synti/fluidsynth/fluidsynti.cpp +++ b/muse2/synti/fluidsynth/fluidsynti.cpp @@ -723,20 +723,20 @@ void FluidSynth::dumpInfo() } //--------------------------------------------------------- -// guiVisible +// nativeGuiVisible //--------------------------------------------------------- -bool FluidSynth::guiVisible() const +bool FluidSynth::nativeGuiVisible() const { return gui->isVisible(); } //--------------------------------------------------------- -// showGui +// showNativeGui //--------------------------------------------------------- -void FluidSynth::showGui(bool val) +void FluidSynth::showNativeGui(bool val) { gui->setVisible(val); } diff --git a/muse2/synti/fluidsynth/fluidsynti.h b/muse2/synti/fluidsynth/fluidsynti.h index 0816475c..a371de9e 100644 --- a/muse2/synti/fluidsynth/fluidsynti.h +++ b/muse2/synti/fluidsynth/fluidsynti.h @@ -115,9 +115,12 @@ public: virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const; virtual bool processEvent(const MidiPlayEvent&); - virtual bool hasGui() const { return true; } - virtual bool guiVisible() const; - virtual void showGui(bool val); + //virtual bool hasGui() const { return true; } + //virtual bool guiVisible() const; + //virtual void showGui(bool val); + virtual bool hasNativeGui() const { return true; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool val); void sendError(const char*); void sendSoundFontData(); diff --git a/muse2/synti/libsynti/mess.cpp b/muse2/synti/libsynti/mess.cpp index 8c23d8ea..aa771056 100644 --- a/muse2/synti/libsynti/mess.cpp +++ b/muse2/synti/libsynti/mess.cpp @@ -53,10 +53,23 @@ Mess::~Mess() void Mess::getGeometry(int* x, int* y, int* w, int* h) const { - x = 0; - y = 0; - w = 0; - h = 0; + *x = 0; + *y = 0; + *w = 0; + *h = 0; + } + +//--------------------------------------------------------- +// getNativeGeometry +// dummy +//--------------------------------------------------------- + +void Mess::getNativeGeometry(int* x, int* y, int* w, int* h) const + { + *x = 0; + *y = 0; + *w = 0; + *h = 0; } //--------------------------------------------------------- diff --git a/muse2/synti/libsynti/mess.h b/muse2/synti/libsynti/mess.h index ea4f425f..bf9ad0de 100644 --- a/muse2/synti/libsynti/mess.h +++ b/muse2/synti/libsynti/mess.h @@ -78,8 +78,13 @@ class Mess { virtual bool hasGui() const { return false; } virtual bool guiVisible() const { return false; } virtual void showGui(bool) {} + virtual bool hasNativeGui() const { return false; } + virtual bool nativeGuiVisible() const { return false; } + virtual void showNativeGui(bool) {} virtual void getGeometry(int* x, int* y, int* w, int* h) const; virtual void setGeometry(int, int, int, int) {} + virtual void getNativeGeometry(int* x, int* y, int* w, int* h) const; + virtual void setNativeGeometry(int, int, int, int) {} }; //--------------------------------------------------------- diff --git a/muse2/synti/organ/organ.cpp b/muse2/synti/organ/organ.cpp index 1aa87742..56fb4db1 100644 --- a/muse2/synti/organ/organ.cpp +++ b/muse2/synti/organ/organ.cpp @@ -636,28 +636,28 @@ int Organ::getControllerInfo(int id, const char** name, int* controller, } //--------------------------------------------------------- -// guiVisible +// nativeGuiVisible //--------------------------------------------------------- -bool Organ::guiVisible() const +bool Organ::nativeGuiVisible() const { return gui->isVisible(); } //--------------------------------------------------------- -// showGui +// showNativeGui //--------------------------------------------------------- -void Organ::showGui(bool val) +void Organ::showNativeGui(bool val) { gui->setVisible(val); } //--------------------------------------------------------- -// getGeometry +// getNativeGeometry //--------------------------------------------------------- -void Organ::getGeometry(int* x, int* y, int* w, int* h) const +void Organ::getNativeGeometry(int* x, int* y, int* w, int* h) const { QPoint pos(gui->pos()); QSize size(gui->size()); @@ -668,10 +668,10 @@ void Organ::getGeometry(int* x, int* y, int* w, int* h) const } //--------------------------------------------------------- -// setGeometry +// setNativeGeometry //--------------------------------------------------------- -void Organ::setGeometry(int x, int y, int w, int h) +void Organ::setNativeGeometry(int x, int y, int w, int h) { gui->resize(QSize(w, h)); gui->move(QPoint(x, y)); diff --git a/muse2/synti/organ/organ.h b/muse2/synti/organ/organ.h index 308646e1..60fee98a 100644 --- a/muse2/synti/organ/organ.h +++ b/muse2/synti/organ/organ.h @@ -182,11 +182,14 @@ class Organ : public Mess { virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const; virtual void getInitData(int*, const unsigned char**) const; - virtual bool guiVisible() const; - virtual void showGui(bool); - virtual bool hasGui() const { return true; } - virtual void getGeometry(int* x, int* y, int* w, int* h) const; - virtual void setGeometry(int x, int y, int w, int h); + //virtual bool guiVisible() const; + //virtual void showGui(bool); + //virtual bool hasGui() const { return true; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool); + virtual bool hasNativeGui() const { return true; } + virtual void getNativeGeometry(int* x, int* y, int* w, int* h) const; + virtual void setNativeGeometry(int x, int y, int w, int h); virtual bool sysex(int, const unsigned char*); static SynthCtrl synthCtrl[]; Organ(int sampleRate); diff --git a/muse2/synti/s1/s1.cpp b/muse2/synti/s1/s1.cpp index 0dca2656..c44676ce 100644 --- a/muse2/synti/s1/s1.cpp +++ b/muse2/synti/s1/s1.cpp @@ -42,9 +42,12 @@ class S1 : public MessMono { virtual void note(int channel, int pitch, int velo); //virtual void processMessages(); virtual void process(float** buffer, int offset, int n); - virtual bool hasGui() const { return true; } - virtual bool guiVisible() const { return _showGui; } - virtual void showGui(bool); + //virtual bool hasGui() const { return true; } + //virtual bool guiVisible() const { return _showGui; } + //virtual void showGui(bool); + virtual bool hasNativeGui() const { return true; } + virtual bool nativeGuiVisible() const { return _showGui; } + virtual void showNativeGui(bool); virtual bool setController(int channel, int ctrl, int val); virtual int getControllerInfo(int id, const char** name, int* ctrl, int* min, int* max, int* initval) const; @@ -76,7 +79,7 @@ S1::S1() : MessMono() param = 0; _showGui=false; - showGui(true); + showNativeGui(true); } //--------------------------------------------------------- @@ -165,7 +168,7 @@ void S1::process(float** buffer, int offset, int n) //--------------------------------------------------------- -void S1::showGui(bool show) +void S1::showNativeGui(bool show) { if (show) QMessageBox::information( NULL, "S1", diff --git a/muse2/synti/simpledrums/simpledrums.cpp b/muse2/synti/simpledrums/simpledrums.cpp index 43f9ccee..22f83bd4 100644 --- a/muse2/synti/simpledrums/simpledrums.cpp +++ b/muse2/synti/simpledrums/simpledrums.cpp @@ -237,14 +237,14 @@ SimpleSynth::~SimpleSynth() } //--------------------------------------------------------- -// guiVisible +// nativeGuiVisible /*! - \fn SimpleSynth::guiVisible + \fn SimpleSynth::nativeGuiVisible \brief Tells if the gui is hidden or shown \return true/false if gui is shown/hidden */ //--------------------------------------------------------- -bool SimpleSynth::guiVisible() const +bool SimpleSynth::nativeGuiVisible() const { SS_TRACE_IN bool v = gui->isVisible(); @@ -253,14 +253,14 @@ bool SimpleSynth::guiVisible() const } //--------------------------------------------------------- -// hasGui +// hasNativeGui /*! - \fn SimpleSynth::hasGui + \fn SimpleSynth::hasNativeGui \brief Tells if the synth has a gui or not \return true if synth has gui, false it synth has no gui */ //--------------------------------------------------------- -bool SimpleSynth::hasGui() const +bool SimpleSynth::hasNativeGui() const { SS_TRACE_IN SS_TRACE_OUT @@ -844,14 +844,14 @@ void SimpleSynth::process(float** out, int offset, int len) } //--------------------------------------------------------- -// showGui +// showNativeGui /*! - \fn SimpleSynth::showGui + \fn SimpleSynth::showNativeGui \brief Displays or hides the gui window \param val true or false = gui shown or hidden */ //--------------------------------------------------------- -void SimpleSynth::showGui(bool val) +void SimpleSynth::showNativeGui(bool val) { SS_TRACE_IN gui->setVisible(val); diff --git a/muse2/synti/simpledrums/simpledrums.h b/muse2/synti/simpledrums/simpledrums.h index 47a71ca6..7f006d73 100644 --- a/muse2/synti/simpledrums/simpledrums.h +++ b/muse2/synti/simpledrums/simpledrums.h @@ -117,8 +117,10 @@ class SimpleSynth : public Mess virtual ~SimpleSynth(); - virtual bool guiVisible() const; - virtual bool hasGui() const; + //virtual bool guiVisible() const; + //virtual bool hasGui() const; + virtual bool nativeGuiVisible() const; + virtual bool hasNativeGui() const; virtual bool playNote(int arg1, int arg2, int arg3); virtual bool processEvent(const MidiPlayEvent& arg1); virtual bool setController(int arg1, int arg2, int arg3); @@ -128,7 +130,8 @@ class SimpleSynth : public Mess virtual int getControllerInfo(int arg1, const char** arg2, int* arg3, int* arg4, int* arg5, int* arg6) const; virtual void processMessages(); virtual void process(float** data, int offset, int len); - virtual void showGui(bool arg1); + //virtual void showGui(bool arg1); + virtual void showNativeGui(bool arg1); virtual void getInitData(int*, const unsigned char**) const; bool init(const char* name); void guiSendSampleLoaded(bool success, int ch, const char* filename); diff --git a/muse2/synti/simpledrums2/simpledrums.cpp b/muse2/synti/simpledrums2/simpledrums.cpp index ecd03d35..f14a0627 100644 --- a/muse2/synti/simpledrums2/simpledrums.cpp +++ b/muse2/synti/simpledrums2/simpledrums.cpp @@ -237,14 +237,14 @@ SimpleSynth::~SimpleSynth() } //--------------------------------------------------------- -// guiVisible +// nativeGuiVisible /*! - \fn SimpleSynth::guiVisible + \fn SimpleSynth::nativeGuiVisible \brief Tells if the gui is hidden or shown \return true/false if gui is shown/hidden */ //--------------------------------------------------------- -bool SimpleSynth::guiVisible() const +bool SimpleSynth::nativeGuiVisible() const { SS_TRACE_IN bool v = gui->isVisible(); @@ -253,14 +253,14 @@ bool SimpleSynth::guiVisible() const } //--------------------------------------------------------- -// hasGui +// hasNativeGui /*! - \fn SimpleSynth::hasGui + \fn SimpleSynth::hasNativeGui \brief Tells if the synth has a gui or not \return true if synth has gui, false it synth has no gui */ //--------------------------------------------------------- -bool SimpleSynth::hasGui() const +bool SimpleSynth::hasNativeGui() const { SS_TRACE_IN SS_TRACE_OUT @@ -808,14 +808,14 @@ void SimpleSynth::process(float** out, int offset, int len) } //--------------------------------------------------------- -// showGui +// showNativeGui /*! - \fn SimpleSynth::showGui + \fn SimpleSynth::showNativeGui \brief Displays or hides the gui window \param val true or false = gui shown or hidden */ //--------------------------------------------------------- -void SimpleSynth::showGui(bool val) +void SimpleSynth::showNativeGui(bool val) { SS_TRACE_IN gui->setVisible(val); diff --git a/muse2/synti/simpledrums2/simpledrums.h b/muse2/synti/simpledrums2/simpledrums.h index 7aab4ed3..58a5945e 100644 --- a/muse2/synti/simpledrums2/simpledrums.h +++ b/muse2/synti/simpledrums2/simpledrums.h @@ -114,8 +114,10 @@ class SimpleSynth : public Mess virtual ~SimpleSynth(); - virtual bool guiVisible() const; - virtual bool hasGui() const; + //virtual bool guiVisible() const; + //virtual bool hasGui() const; + virtual bool nativeGuiVisible() const; + virtual bool hasNativeGui() const; virtual bool playNote(int arg1, int arg2, int arg3); virtual bool processEvent(const MidiPlayEvent& arg1); virtual bool setController(int arg1, int arg2, int arg3); @@ -124,7 +126,8 @@ class SimpleSynth : public Mess virtual const MidiPatch* getPatchInfo(int arg1, const MidiPatch* arg2) const; virtual int getControllerInfo(int arg1, const char** arg2, int* arg3, int* arg4, int* arg5); virtual void process(float** data, int offset, int len); - virtual void showGui(bool arg1); + //virtual void showGui(bool arg1); + virtual void showNativeGui(bool arg1); virtual void getInitData(int*, const unsigned char**); bool init(const char* name); void guiSendSampleLoaded(bool success, int ch, const char* filename); diff --git a/muse2/synti/vam/vam.cpp b/muse2/synti/vam/vam.cpp index 6d9d181c..fd71d9ea 100644 --- a/muse2/synti/vam/vam.cpp +++ b/muse2/synti/vam/vam.cpp @@ -193,11 +193,14 @@ class VAM : public MessMono { public: virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const; virtual void getInitData(int* n, const unsigned char**p) const; - virtual bool guiVisible() const; - virtual void showGui(bool); - virtual bool hasGui() const { return true; } - virtual void getGeometry(int* x, int* y, int* w, int* h) const; - virtual void setGeometry(int x, int y, int w, int h); + //virtual bool guiVisible() const; + //virtual void showGui(bool); + //virtual bool hasGui() const { return true; } + virtual bool nativeGuiVisible() const; + virtual void showNativeGui(bool); + virtual bool hasNativeGui() const { return true; } + virtual void getNativeGeometry(int* x, int* y, int* w, int* h) const; + virtual void setNativeGeometry(int x, int y, int w, int h); virtual void processMessages(); virtual void process(float**, int, int); virtual void note(int channel, int pitch, int velo); @@ -979,28 +982,28 @@ bool VAM::sysex(int n, const unsigned char* data) } //--------------------------------------------------------- -// guiVisible +// nativeGuiVisible //--------------------------------------------------------- -bool VAM::guiVisible() const +bool VAM::nativeGuiVisible() const { return gui->isVisible(); } //--------------------------------------------------------- -// showGui +// showNativeGui //--------------------------------------------------------- -void VAM::showGui(bool val) +void VAM::showNativeGui(bool val) { gui->setVisible(val); } //--------------------------------------------------------- -// getGeometry +// getNativeGeometry //--------------------------------------------------------- -void VAM::getGeometry(int* x, int* y, int* w, int* h) const +void VAM::getNativeGeometry(int* x, int* y, int* w, int* h) const { QPoint pos(gui->pos()); QSize size(gui->size()); @@ -1011,10 +1014,10 @@ void VAM::getGeometry(int* x, int* y, int* w, int* h) const } //--------------------------------------------------------- -// setGeometry +// setNativeGeometry //--------------------------------------------------------- -void VAM::setGeometry(int x, int y, int w, int h) +void VAM::setNativeGeometry(int x, int y, int w, int h) { gui->resize(QSize(w, h)); gui->move(QPoint(x, y)); -- cgit v1.2.3