diff options
-rw-r--r-- | muse2/ChangeLog | 9 | ||||
-rw-r--r-- | muse2/muse/audio.cpp | 69 | ||||
-rw-r--r-- | muse2/muse/controlfifo.h | 4 | ||||
-rw-r--r-- | muse2/muse/ctrl.h | 2 | ||||
-rw-r--r-- | muse2/muse/dssihost.cpp | 82 | ||||
-rw-r--r-- | muse2/muse/dssihost.h | 26 | ||||
-rw-r--r-- | muse2/muse/mididev.cpp | 180 | ||||
-rw-r--r-- | muse2/muse/mididev.h | 4 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/midiseq.cpp | 177 | ||||
-rw-r--r-- | muse2/muse/plugin.cpp | 158 | ||||
-rw-r--r-- | muse2/muse/plugin.h | 94 |
12 files changed, 525 insertions, 285 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index c949d36d..026e8060 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,12 @@ +28.04.2011: + - More separation of Alsa and Jack midi processing. Possible fix for crash report by Geoff B. (p4.0.22 Tim) + Added MidiDevice::handleStop(), ::handleSeek(). Split processing among MidiSeq::processStop, ::processSeek + and Audio::stopRolling, ::seek. Also some sustain resetting code and midi sync code was moved into + these two new MidiDevice methods. + TODO: There is more separation to be done. Hopefully it makes MusE more stable and timing-proper. + - Small fix to scoredit in color_image(). Use bytesPerLine() * height() for older Qt. Test OK. (Tim) + - Fix to Robert's DssiSynthIF::paramOut(). Call getParameterOut(). (Tim) + - Changed all plugin and dssi module's 'unsigned' usage to 'unsigned long' for more consistency. (Tim) 27.04.2011: - added first version feedback parameters for plugins (rj) - merged score edit branch into trunk (flo) diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index a4b04436..975054b0 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -800,9 +800,19 @@ void Audio::seek(const Pos& p) frameOffset = syncFrame - _pos.frame(); curTickPos = _pos.tick(); - midiSeq->msgSeek(); // handle stuck notes and set - // controller for new position + // p4.0.22 + // Tell midi thread to tell ALSA devices to handle seek. + midiSeq->msgSeek(); + // We are in the audio thread. Directly seek Jack midi devices. + for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + { + MidiDevice* md = *i; + if(md->deviceType() == MidiDevice::JACK_MIDI) + md->handleSeek(); + } + // Moved into MidiDevice::handleSeek + #if 0 // p3.3.31 // Don't send if external sync is on. The master, and our sync routing system will take care of that. if(!extSyncFlag.value()) @@ -845,6 +855,7 @@ void Audio::seek(const Pos& p) mp->sendContinue(); } } + #endif /* if(genMCSync) @@ -1133,37 +1144,50 @@ void Audio::startRolling() //--------------------------------------------------------- void Audio::stopRolling() - { - // Added by Tim. p3.3.20 +{ //if(debugMsg) // printf("Audio::stopRolling state %s\n", audioStates[state]); state = STOP; - midiSeq->msgStop(); + + //playStateExt = false; // not playing // Moved here from MidiSeq::processStop() p4.0.22 + + // p4.0.22 + // Tell midi thread to clear ALSA device notes and stop stuck notes. + midiSeq->msgStop(); + // We are in the audio thread. Directly clear Jack midi device notes and stop stuck notes. + for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + { + MidiDevice* md = *id; + if(md->deviceType() == MidiDevice::JACK_MIDI) + md->handleStop(); + } -#if 1 //TODO + // Moved into MidiDevice::handleStop() // p4.0.22 + #if 0 //TODO //--------------------------------------------------- // reset sustain //--------------------------------------------------- - // clear sustain - for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; - for (int ch = 0; ch < MIDI_CHANNELS; ++ch) { - if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) { - if(mp->device()!=NULL) { - //printf("send clear sustain!!!!!!!! port %d ch %d\n", i,ch); - MidiPlayEvent ev(0, i, ch, ME_CONTROLLER, CTRL_SUSTAIN, 0); - // may cause problems, called from audio thread - mp->device()->putEvent(ev); - } - } - } - } - -#endif + // clear sustain + for (int i = 0; i < MIDI_PORTS; ++i) { + MidiPort* mp = &midiPorts[i]; + for (int ch = 0; ch < MIDI_CHANNELS; ++ch) { + if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) { + if(mp->device()!=NULL) { + //printf("send clear sustain!!!!!!!! port %d ch %d\n", i,ch); + MidiPlayEvent ev(0, i, ch, ME_CONTROLLER, CTRL_SUSTAIN, 0); + // may cause problems, called from audio thread + mp->device()->putEvent(ev); + } + } + } + } + #endif + // Moved into MidiDevice::handleStop() // p4.0.22 + #if 0 // p3.3.31 // Don't send if external sync is on. The master, and our sync routing system will take care of that. if(!extSyncFlag.value()) @@ -1260,6 +1284,7 @@ void Audio::stopRolling() } } } + #endif /* for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) diff --git a/muse2/muse/controlfifo.h b/muse2/muse/controlfifo.h index a0b6bfd0..d209ea91 100644 --- a/muse2/muse/controlfifo.h +++ b/muse2/muse/controlfifo.h @@ -33,9 +33,9 @@ struct ControlEvent // (possibly rounded) frame and index as the previous item. This is mainly for // dssi-vst guis, they require acknowledgment of every message. bool unique; - unsigned idx; + unsigned long idx; float value; - unsigned frame; + unsigned long frame; }; //--------------------------------------------------------- diff --git a/muse2/muse/ctrl.h b/muse2/muse/ctrl.h index 955fd01f..34a31211 100644 --- a/muse2/muse/ctrl.h +++ b/muse2/muse/ctrl.h @@ -24,7 +24,7 @@ const int AC_MUTE = 2; #define AC_PLUGIN_CTL_ID_MASK 0xFFF //inline int genACnum(int plugin, int ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } -inline unsigned genACnum(unsigned plugin, unsigned ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } +inline unsigned long genACnum(unsigned long plugin, unsigned long ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } class Xml; diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index 0bf97bd4..adfda659 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -641,7 +641,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) LADSPA_PortDescriptor pd = descr->PortDescriptors[k]; #ifdef DSSI_DEBUG - printf("DssiSynth::createSIF ladspa plugin Port:%ld Name:%s descriptor:%x\n", k, descr->PortNames[k], pd); + printf("DssiSynth::createSIF ladspa plugin Port:%lu Name:%s descriptor:%x\n", k, descr->PortNames[k], pd); #endif if (LADSPA_IS_PORT_AUDIO(pd)) @@ -992,7 +992,7 @@ bool DssiSynthIF::init(DssiSynth* s) 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); + printf("DssiSynth::init ladspa plugin Port:%lu Name:%s descriptor:%x\n", k, ld->PortNames[k], pd); #endif if (LADSPA_IS_PORT_CONTROL(pd)) @@ -1357,7 +1357,7 @@ float DssiSynthIF::getParameter(unsigned long n) const { if(n >= synth->_controlInPorts) { - printf("DssiSynthIF::getParameter param number %ld out of range of ports:%ld\n", n, synth->_controlInPorts); + printf("DssiSynthIF::getParameter param number %lu out of range of ports:%lu\n", n, synth->_controlInPorts); return 0.0; } @@ -1374,7 +1374,7 @@ float DssiSynthIF::getParameterOut(unsigned long n) const { if(n >= synth->_controlOutPorts) { - printf("DssiSynthIF::getParameter param number %ld out of range of ports:%ld\n", n, synth->_controlOutPorts); + printf("DssiSynthIF::getParameterOut param number %lu out of range of ports:%lu\n", n, synth->_controlOutPorts); return 0.0; } @@ -1392,7 +1392,7 @@ void DssiSynthIF::setParameter(unsigned long n, float v) { if(n >= synth->_controlInPorts) { - printf("DssiSynthIF::setParameter param number %ld out of range of ports:%ld\n", n, synth->_controlInPorts); + printf("DssiSynthIF::setParameter param number %lu out of range of ports:%lu\n", n, synth->_controlInPorts); return; } @@ -1410,7 +1410,7 @@ void DssiSynthIF::setParameter(unsigned long n, float v) ce.frame = audio->timestamp(); if(_controlFifo.put(ce)) { - fprintf(stderr, "DssiSynthIF::setParameter: fifo overflow: in control number:%ld\n", n); + fprintf(stderr, "DssiSynthIF::setParameter: fifo overflow: in control number:%lu\n", n); } // Notify that changes are to be sent upon heartbeat. @@ -1858,7 +1858,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) else { #ifdef DSSI_DEBUG - printf("DssiSynthIF::processEvent plugin requests DSSI-style ctlnum:%x(h) %d(d) be mapped to control port:%ld...\n", ctlnum, ctlnum, i); + printf("DssiSynthIF::processEvent plugin requests DSSI-style ctlnum:%x(h) %d(d) be mapped to control port:%lu...\n", ctlnum, ctlnum, i); #endif int c = ctlnum; @@ -1893,7 +1893,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) #ifdef DSSI_DEBUG //fprintf(stderr, "DssiSynthIF::processEvent No midi controller for control port:%d port:%d dataA:%d Converting val from:%d to ladspa:%f\n", i, k, a, b, val); - fprintf(stderr, "DssiSynthIF::processEvent control port:%ld port:%ld dataA:%d Converting val from:%d to ladspa:%f\n", i, k, a, b, val); + fprintf(stderr, "DssiSynthIF::processEvent control port:%lu port:%lu dataA:%d Converting val from:%d to ladspa:%f\n", i, k, a, b, val); #endif // Set the ladspa port value. @@ -1970,7 +1970,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) { const unsigned long n = dlen / sizeof(float); if(n != synth->_controlInPorts) - printf("DssiSynthIF::processEvent Warning: PARAMSAVE number of floats:%ld != number of controls:%ld\n", n, synth->_controlInPorts); + printf("DssiSynthIF::processEvent Warning: PARAMSAVE number of floats:%lu != number of controls:%lu\n", n, synth->_controlInPorts); // Point to location after "PARAMSAVE", version major and minor, bank and progam. float* const fp = (float*)(e.data() + 9 + 2 + 2 * sizeof(unsigned long)); @@ -2160,7 +2160,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns OscControlValue v = cfifo->get(); #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::getData OscControlFifo event input control number:%ld value:%f\n", k, v.value); + fprintf(stderr, "DssiSynthIF::getData OscControlFifo event input control number:%lu value:%f\n", k, v.value); #endif // Set the ladspa control port value. @@ -2315,7 +2315,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns //nevents = 0; - unsigned endPos = pos + n; + unsigned long endPos = pos + n; int frameOffset = audio->getFrameOffset(); // All ports must be connected to something! @@ -2336,7 +2336,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns const DSSI_Descriptor* dssi = synth->dssi; const LADSPA_Descriptor* descr = dssi->LADSPA_Plugin; - unsigned sample = 0; + unsigned long sample = 0; int loopcount = 0; // REMOVE Tim. // NOTE Tested: Variable run-lengths worked superbly for LADSPA and DSSI synths. But DSSI-VST definitely @@ -2360,8 +2360,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns // TODO Make this number a global setting. // Note for dssi-vst this MUST equal audio period. It doesn't like broken-up runs (it stutters), // even with fixed sizes. Could be a Wine + Jack thing, wanting a full Jack buffer's length. - //unsigned fixedsize = 2048; - unsigned fixedsize = n; + //unsigned long fixedsize = 2048; + unsigned long fixedsize = n; // For now, the fixed size is clamped to the audio buffer size. // TODO: We could later add slower processing over several cycles - @@ -2371,12 +2371,12 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns while(sample < n) { - //unsigned nsamp = n; - //unsigned nsamp = n - sample; - unsigned nsamp = usefixedrate ? fixedsize : n - sample; + //unsigned long nsamp = n; + //unsigned long nsamp = n - sample; + unsigned long nsamp = usefixedrate ? fixedsize : n - sample; bool found = false; - unsigned frame = 0; - unsigned index = 0; + unsigned long frame = 0; + unsigned long index = 0; // Get all control ring buffer items valid for this time period... //for(int m = 0; m < cbsz; ++m) while(!_controlFifo.isEmpty()) @@ -2479,7 +2479,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns if (ft >= int(sample + nsamp)) { //printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", i->time(), pos, frameOffset, ft, segmentSize); - printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d sample:%d nsamp:%d\n", i->time(), pos, frameOffset, ft, sample, nsamp); + printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d sample:%lu nsamp:%lu\n", i->time(), pos, frameOffset, ft, sample, nsamp); ///if (ft > (int)segmentSize) //ft = segmentSize - 1; ft = sample + nsamp - 1; @@ -2518,7 +2518,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns if (ft >= int(sample + nsamp)) { //printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", e.time(), pos, frameOffset, ft, segmentSize); - printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d sample:%d nsamp:%d\n", e.time(), pos, frameOffset, ft, sample, nsamp); + printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d sample:%lu nsamp:%lu\n", e.time(), pos, frameOffset, ft, sample, nsamp); ///if (ft > (int)segmentSize) //ft = segmentSize - 1; ft = sample + nsamp - 1; @@ -2982,7 +2982,7 @@ int DssiSynthIF::oscControl(unsigned long port, float value) //LADSPA_Data value = argv[1]->f; #ifdef DSSI_DEBUG - printf("DssiSynthIF::oscControl received oscControl port:%ld val:%f\n", port, value); + printf("DssiSynthIF::oscControl received oscControl port:%lu val:%f\n", port, value); #endif //int controlPorts = synth->_controlInPorts; @@ -2992,7 +2992,7 @@ int DssiSynthIF::oscControl(unsigned long port, float value) if(port >= synth->rpIdx.size()) { //fprintf(stderr, "DssiSynthIF::oscControl: port number:%d is out of range of number of ports:%d\n", port, controlPorts); - fprintf(stderr, "DssiSynthIF::oscControl: port number:%ld is out of range of index list size:%zd\n", port, synth->rpIdx.size()); + fprintf(stderr, "DssiSynthIF::oscControl: port number:%lu is out of range of index list size:%zd\n", port, synth->rpIdx.size()); return 0; } @@ -3001,7 +3001,7 @@ int DssiSynthIF::oscControl(unsigned long port, float value) if((int)cport == -1) { - fprintf(stderr, "DssiSynthIF::oscControl: port number:%ld is not a control input\n", port); + fprintf(stderr, "DssiSynthIF::oscControl: port number:%lu is not a control input\n", port); return 0; } @@ -3039,7 +3039,7 @@ int DssiSynthIF::oscControl(unsigned long port, float value) cv.frame = audio->timestamp(); if(cfifo->put(cv)) { - fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%ld\n", cport); + fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%lu\n", cport); } } */ @@ -3054,7 +3054,7 @@ int DssiSynthIF::oscControl(unsigned long port, float value) ce.frame = audio->timestamp(); if(_controlFifo.put(ce)) { - fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%ld\n", cport); + fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%lu\n", cport); } @@ -3365,7 +3365,7 @@ int DssiSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* mi ///int i = synth->pIdx[id]; //int i = synth->pIdx[k]; //int i = controls[id].idx; - unsigned i = controls[id].idx; // p4.0.21 + unsigned long i = controls[id].idx; // p4.0.21 //ladspaDefaultValue(ld, i, &controls[id].val); @@ -3493,7 +3493,7 @@ 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; } -unsigned DssiSynthIF::pluginID() { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->UniqueID : 0; } +unsigned long 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 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(); } @@ -3505,9 +3505,9 @@ AudioTrack* DssiSynthIF::track() { return (AudioTrac //void DssiSynthIF::enableController(int i, bool v) { controls[i].enCtrl = v; } //bool DssiSynthIF::controllerEnabled(int i) const { return controls[i].enCtrl; } //bool DssiSynthIF::controllerEnabled2(int i) const { return controls[i].en2Ctrl; } -void DssiSynthIF::enableController(unsigned i, bool v) { controls[i].enCtrl = v; } -bool DssiSynthIF::controllerEnabled(unsigned i) const { return controls[i].enCtrl; } -bool DssiSynthIF::controllerEnabled2(unsigned i) const { return controls[i].en2Ctrl; } +void DssiSynthIF::enableController(unsigned long i, bool v) { controls[i].enCtrl = v; } +bool DssiSynthIF::controllerEnabled(unsigned long i) const { return controls[i].enCtrl; } +bool DssiSynthIF::controllerEnabled2(unsigned long i) const { return controls[i].en2Ctrl; } void DssiSynthIF::updateControllers() { } void DssiSynthIF::writeConfiguration(int /*level*/, Xml& /*xml*/) { } bool DssiSynthIF::readConfiguration(Xml& /*xml*/, bool /*readPreset*/) { return false; } @@ -3518,16 +3518,16 @@ bool DssiSynthIF::readConfiguration(Xml& /*xml*/, bool /*readPreset*/) { return //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[controls[i].idx]; } -unsigned DssiSynthIF::parameters() const { return synth ? synth->_controlInPorts : 0; } -unsigned DssiSynthIF::parametersOut() const { return synth ? synth->_controlOutPorts : 0; } -void DssiSynthIF::setParam(unsigned i, float val) { setParameter(i, val); } -float DssiSynthIF::param(unsigned i) const { return getParameter(i); } -float DssiSynthIF::paramOut(unsigned i) const { return getParameter(i); } -const char* DssiSynthIF::paramName(unsigned i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[controls[i].idx] : 0; } -const char* DssiSynthIF::paramOutName(unsigned i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[controlsOut[i].idx] : 0; } -//LADSPA_PortRangeHint DssiSynthIF::range(unsigned i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortRangeHints[i] : 0; } -LADSPA_PortRangeHint DssiSynthIF::range(unsigned i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[controls[i].idx]; } -LADSPA_PortRangeHint DssiSynthIF::rangeOut(unsigned i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[controlsOut[i].idx]; } +unsigned long DssiSynthIF::parameters() const { return synth ? synth->_controlInPorts : 0; } +unsigned long DssiSynthIF::parametersOut() const { return synth ? synth->_controlOutPorts : 0; } +void DssiSynthIF::setParam(unsigned long i, float val) { setParameter(i, val); } +float DssiSynthIF::param(unsigned long i) const { return getParameter(i); } +float DssiSynthIF::paramOut(unsigned long i) const { return getParameterOut(i); } +const char* DssiSynthIF::paramName(unsigned long i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[controls[i].idx] : 0; } +const char* DssiSynthIF::paramOutName(unsigned long i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[controlsOut[i].idx] : 0; } +//LADSPA_PortRangeHint DssiSynthIF::range(unsigned long i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortRangeHints[i] : 0; } +LADSPA_PortRangeHint DssiSynthIF::range(unsigned long i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[controls[i].idx]; } +LADSPA_PortRangeHint DssiSynthIF::rangeOut(unsigned long i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[controlsOut[i].idx]; } #else //DSSI_SUPPORT diff --git a/muse2/muse/dssihost.h b/muse2/muse/dssihost.h index 2405b1cc..096c84c7 100644 --- a/muse2/muse/dssihost.h +++ b/muse2/muse/dssihost.h @@ -240,7 +240,7 @@ class DssiSynthIF : public SynthIF, public PluginIBase bool on() const; void setOn(bool /*val*/); //int pluginID(); - unsigned pluginID(); // p4.0.21 + unsigned long pluginID(); // p4.0.21 int id(); QString pluginLabel() const; QString name() const; @@ -251,9 +251,9 @@ class DssiSynthIF : public SynthIF, public PluginIBase //void enableController(int /*i*/, bool v = true); //bool controllerEnabled(int /*i*/) const; //bool controllerEnabled2(int /*i*/) const; - void enableController(unsigned /*i*/, bool v = true); // p4.0.21 - bool controllerEnabled(unsigned /*i*/) const; - bool controllerEnabled2(unsigned /*i*/) const; + void enableController(unsigned long /*i*/, bool v = true); // p4.0.21 + bool controllerEnabled(unsigned long /*i*/) const; + bool controllerEnabled2(unsigned long /*i*/) const; void updateControllers(); void writeConfiguration(int /*level*/, Xml& /*xml*/); bool readConfiguration(Xml& /*xml*/, bool readPreset=false); @@ -263,15 +263,15 @@ class DssiSynthIF : public SynthIF, public PluginIBase //double param(int /*i*/) const; //const char* paramName(int /*i*/); //LADSPA_PortRangeHint range(int /*i*/); - unsigned parameters() const; // p4.0.21 - unsigned parametersOut() const; - void setParam(unsigned /*i*/, float /*val*/); - float param(unsigned /*i*/) const; - float paramOut(unsigned /*i*/) const; - const char* paramName(unsigned /*i*/); - const char* paramOutName(unsigned /*i*/); - LADSPA_PortRangeHint range(unsigned /*i*/); - LADSPA_PortRangeHint rangeOut(unsigned /*i*/); + unsigned long parameters() const; // p4.0.21 + unsigned long parametersOut() const; + void setParam(unsigned long /*i*/, float /*val*/); + float param(unsigned long /*i*/) const; + float paramOut(unsigned long /*i*/) const; + const char* paramName(unsigned long /*i*/); + const char* paramOutName(unsigned long /*i*/); + LADSPA_PortRangeHint range(unsigned long /*i*/); + LADSPA_PortRangeHint rangeOut(unsigned long /*i*/); friend class DssiSynth; }; diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp index 10be79ef..b5445b71 100644 --- a/muse2/muse/mididev.cpp +++ b/muse2/muse/mididev.cpp @@ -19,11 +19,14 @@ #include "midiport.h" #include "mididev.h" #include "config.h" +#include "gconfig.h" #include "globals.h" #include "audio.h" #include "midiseq.h" -//#include "sync.h" +#include "sync.h" #include "midiitransform.h" +#include "part.h" +//#include "mpevent.h" #ifdef MIDI_DRIVER_MIDI_SERIAL extern void initMidiSerial(); @@ -572,3 +575,178 @@ bool MidiDevice::putEvent(const MidiPlayEvent& ev) } return putMidiEvent(ev); } + +//--------------------------------------------------------- +// handleStop +//--------------------------------------------------------- + +void MidiDevice::handleStop() +{ + // If the device is not in use by a port, don't bother it. + if(_port == -1) + return; + + //--------------------------------------------------- + // Clear all notes and handle stuck notes + //--------------------------------------------------- + + _playEvents.clear(); + for(iMPEvent i = _stuckNotes.begin(); i != _stuckNotes.end(); ++i) + { + MidiPlayEvent ev = *i; + ev.setTime(0); + _playEvents.add(ev); + } + _stuckNotes.clear(); + //setNextPlayEvent(_playEvents.begin()); + + + //--------------------------------------------------- + // reset sustain + //--------------------------------------------------- + + MidiPort* mp = &midiPorts[_port]; + for(int ch = 0; ch < MIDI_CHANNELS; ++ch) + { + if(mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) + { + //printf("send clear sustain!!!!!!!! port %d ch %d\n", i,ch); + MidiPlayEvent ev(0, _port, ch, ME_CONTROLLER, CTRL_SUSTAIN, 0); + putEvent(ev); + } + } + + //--------------------------------------------------- + // send midi stop + //--------------------------------------------------- + + // Don't send if external sync is on. The master, and our sync routing system will take care of that. p3.3.31 + if(!extSyncFlag.value()) + { + // Shall we check open flags? + //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1)) + //if(!(dev->openFlags() & 1)) + // return; + + MidiSyncInfo& si = mp->syncInfo(); + if(si.MMCOut()) + mp->sendMMCStop(); + + if(si.MRTOut()) + { + // Send STOP + mp->sendStop(); + + // p3.3.31 + // Added check of option send continue not start. + // Hmm, is this required? Seems to make other devices unhappy. + // (Could try now that this is in MidiDevice. p4.0.22 ) + /* + if(!si.sendContNotStart()) + mp->sendSongpos(audio->tickPos() * 4 / config.division); + */ + } + } +} + +//--------------------------------------------------------- +// handleSeek +//--------------------------------------------------------- + +void MidiDevice::handleSeek() +{ + // If the device is not in use by a port, don't bother it. + if(_port == -1) + return; + + //--------------------------------------------------- + // If playing, clear all notes and handle stuck notes + //--------------------------------------------------- + + if(audio->isPlaying()) + { + _playEvents.clear(); + for(iMPEvent i = _stuckNotes.begin(); i != _stuckNotes.end(); ++i) + { + MidiPlayEvent ev = *i; + ev.setTime(0); + _playEvents.add(ev); + } + _stuckNotes.clear(); + } + //else + // Removed p4.0.15 Device now leaves beginning pointing at next event, + // immediately after playing some notes. + // NOTE: This removal needs testing. I'm not sure about this. + //_playEvents.erase(_playEvents.begin(), _nextPlayEvent); + + MidiPort* mp = &midiPorts[_port]; + MidiCtrlValListList* cll = mp->controller(); + int pos = audio->tickPos(); + + //--------------------------------------------------- + // Send new contoller values + //--------------------------------------------------- + + for(iMidiCtrlValList ivl = cll->begin(); ivl != cll->end(); ++ivl) + { + MidiCtrlValList* vl = ivl->second; + //int val = vl->value(pos); + //if (val != CTRL_VAL_UNKNOWN) { + // int channel = ivl->first >> 24; + // el->add(MidiPlayEvent(0, port, channel, ME_CONTROLLER, vl->num(), val)); + // } + iMidiCtrlVal imcv = vl->iValue(pos); + if(imcv != vl->end()) + { + Part* p = imcv->second.part; + unsigned t = (unsigned)imcv->first; + // Do not add values that are outside of the part. + if(p && t >= p->tick() && t < (p->tick() + p->lenTick()) ) + _playEvents.add(MidiPlayEvent(0, _port, ivl->first >> 24, ME_CONTROLLER, vl->num(), imcv->second.val)); + } + } + //_nextPlayEvent = (_playEvents.begin()); // Removed p4.0.15 + + //--------------------------------------------------- + // Send STOP and "set song position pointer" + //--------------------------------------------------- + + // Don't send if external sync is on. The master, and our sync routing system will take care of that. p3.3.31 + if(!extSyncFlag.value()) + { + if(mp->syncInfo().MRTOut()) + { + // Shall we check for device write open flag to see if it's ok to send?... + // This means obey what the user has chosen for read/write in the midi port config dialog, + // which already takes into account whether the device is writable or not. + //if(!(rwFlags() & 0x1) || !(openFlags() & 1)) + //if(!(openFlags() & 1)) + // continue; + + //int port = midiPort(); + + // By checking for no port here (-1), (and out of bounds), it means + // the device must be assigned to a port for these MMC commands to be sent. + // Without this check, interesting sync things can be done by the user without ever + // assigning any devices to ports ! + //if(port < 0 || port > MIDI_PORTS) + //if(port < -1 || port > MIDI_PORTS) + // continue; + + int beat = (pos * 4) / config.division; + + //bool isPlaying = false; + //if(state == PLAY) + // isPlaying = true; + bool isPlaying = audio->isPlaying(); // Check this it includes LOOP1 and LOOP2 besides PLAY. p4.0.22 + + mp->sendStop(); + mp->sendSongpos(beat); + if(isPlaying) + mp->sendContinue(); + } + } +} + + diff --git a/muse2/muse/mididev.h b/muse2/muse/mididev.h index 275bd014..7de016b1 100644 --- a/muse2/muse/mididev.h +++ b/muse2/muse/mididev.h @@ -120,6 +120,10 @@ class MidiDevice { // Since it waits, it should not be used in RT or other time-sensitive threads. p4.0.15 bool putEventWithRetry(const MidiPlayEvent&, int /*tries*/ = 2, long /*delayUs*/ = 50000); // 2 tries, 50 mS by default. + // p4.0.22 + virtual void handleStop(); + virtual void handleSeek(); + // For Jack-based devices - called in Jack audio process callback virtual void collectMidiEvents() {} virtual void processMidi() {} diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index cbe9c20a..71439600 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -367,7 +367,7 @@ bool ScoreEdit::set_name(QString newname, bool emit_signal, bool emergency_name) { if (emergency_name) { - while (set_name(create_random_string(), emit_signal, false) == false); + while (set_name(create_random_string(), emit_signal, false) == false) ; return true; } else @@ -773,7 +773,8 @@ QString IntToQStr(int i) void color_image(QImage& img, const QColor& color) { uchar* ptr=img.bits(); - int bytes=img.byteCount(); + //int bytes=img.byteCount(); + int bytes=img.bytesPerLine() * img.height(); // By Tim. For older Qt versions. Tested OK on Qt4.5. int r,g,b; color.getRgb(&r,&g,&b); diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp index 5e42d547..aaf3f7dd 100644 --- a/muse2/muse/midiseq.cpp +++ b/muse2/muse/midiseq.cpp @@ -131,91 +131,114 @@ void MidiSeq::processMsg(const ThreadMsg* m) //--------------------------------------------------------- void MidiSeq::processStop() - { - // p3.3.28 - playStateExt = false; // not playing - - // - // stop stuck notes - // - for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) { - MidiDevice* md = *id; - if (md->midiPort() == -1) - continue; - MPEventList* pel = md->playEvents(); - MPEventList* sel = md->stuckNotes(); - pel->clear(); - for (iMPEvent i = sel->begin(); i != sel->end(); ++i) { - MidiPlayEvent ev = *i; - ev.setTime(0); - pel->add(ev); - } - sel->clear(); - //md->setNextPlayEvent(pel->begin()); // Removed p4.0.15 - } - } +{ + // p3.3.28 + // TODO Try to move this into Audio::stopRolling(). p4.0.22 + playStateExt = false; // not playing + + // + // clear Alsa midi device notes and stop stuck notes + // Jack midi devices are handled in Audio::stopRolling() + // + for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + { + MidiDevice* md = *id; + if(md->deviceType() == MidiDevice::JACK_MIDI) // p4.0.22 + continue; + md->handleStop(); // p4.0.22 + /* + if (md->midiPort() == -1) + continue; + MPEventList* pel = md->playEvents(); + MPEventList* sel = md->stuckNotes(); + pel->clear(); + for(iMPEvent i = sel->begin(); i != sel->end(); ++i) + { + MidiPlayEvent ev = *i; + ev.setTime(0); + pel->add(ev); + } + sel->clear(); + //md->setNextPlayEvent(pel->begin()); // Removed p4.0.15 + */ + } +} //--------------------------------------------------------- // processSeek //--------------------------------------------------------- void MidiSeq::processSeek() +{ + int pos = audio->tickPos(); + + // TODO Try to move this into audio::seek(). p4.0.22 + if (pos == 0 && !song->record()) + audio->initDevices(); + + //--------------------------------------------------- + // set all controller + //--------------------------------------------------- + + for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + { + MidiDevice* md = *i; + // + // Jack midi devices are handled in Audio::seek() + // + if(md->deviceType() == MidiDevice::JACK_MIDI) // p4.0.22 + continue; + md->handleSeek(); // p4.0.22 + /* + int port = md->midiPort(); + if (port == -1) + continue; + MidiPort* mp = &midiPorts[port]; + MidiCtrlValListList* cll = mp->controller(); + + MPEventList* el = md->playEvents(); + + if (audio->isPlaying()) + { + // stop all notes + el->clear(); + MPEventList* sel = dev->stuckNotes(); + for (iMPEvent i = sel->begin(); i != sel->end(); ++i) { - int pos = audio->tickPos(); - if (pos == 0 && !song->record()) - audio->initDevices(); - - //--------------------------------------------------- - // set all controller - //--------------------------------------------------- - - for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) { - MidiDevice* dev = *i; - int port = dev->midiPort(); - if (port == -1) - continue; - MidiPort* mp = &midiPorts[port]; - MidiCtrlValListList* cll = mp->controller(); - - MPEventList* el = dev->playEvents(); - - if (audio->isPlaying()) { - // stop all notes - el->clear(); - MPEventList* sel = dev->stuckNotes(); - for (iMPEvent i = sel->begin(); i != sel->end(); ++i) { - MidiPlayEvent ev = *i; - ev.setTime(0); - el->add(ev); - } - sel->clear(); - } - //else - // Removed p4.0.15 Device now leaves beginning pointing at next event, - // immediately after playing some notes. - // NOTE: This removal needs testing. I'm not sure about this. - // el->erase(el->begin(), dev->nextPlayEvent()); - - for (iMidiCtrlValList ivl = cll->begin(); ivl != cll->end(); ++ivl) { - MidiCtrlValList* vl = ivl->second; - //int val = vl->value(pos); - //if (val != CTRL_VAL_UNKNOWN) { - // int channel = ivl->first >> 24; - // el->add(MidiPlayEvent(0, port, channel, ME_CONTROLLER, vl->num(), val)); - // } - iMidiCtrlVal imcv = vl->iValue(pos); - if(imcv != vl->end()) - { - Part* p = imcv->second.part; - unsigned t = (unsigned)imcv->first; - // Do not add values that are outside of the part. - if(p && t >= p->tick() && t < (p->tick() + p->lenTick()) ) - el->add(MidiPlayEvent(0, port, ivl->first >> 24, ME_CONTROLLER, vl->num(), imcv->second.val)); - } - } - //dev->setNextPlayEvent(el->begin()); // Removed p4.0.15 - } + MidiPlayEvent ev = *i; + ev.setTime(0); + el->add(ev); + } + sel->clear(); + } + //else + // Removed p4.0.15 Device now leaves beginning pointing at next event, + // immediately after playing some notes. + // NOTE: This removal needs testing. I'm not sure about this. + //el->erase(el->begin(), dev->nextPlayEvent()); + + for (iMidiCtrlValList ivl = cll->begin(); ivl != cll->end(); ++ivl) + { + MidiCtrlValList* vl = ivl->second; + //int val = vl->value(pos); + //if (val != CTRL_VAL_UNKNOWN) { + // int channel = ivl->first >> 24; + // el->add(MidiPlayEvent(0, port, channel, ME_CONTROLLER, vl->num(), val)); + // } + iMidiCtrlVal imcv = vl->iValue(pos); + if(imcv != vl->end()) + { + Part* p = imcv->second.part; + unsigned t = (unsigned)imcv->first; + // Do not add values that are outside of the part. + if(p && t >= p->tick() && t < (p->tick() + p->lenTick()) ) + el->add(MidiPlayEvent(0, port, ivl->first >> 24, ME_CONTROLLER, vl->num(), imcv->second.val)); } + } + //dev->setNextPlayEvent(el->begin()); // Removed p4.0.15 + */ + } +} //--------------------------------------------------------- // MidiSeq diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index fa446d2b..78ade353 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -87,7 +87,7 @@ QStringList PluginDialog::sortItems = QStringList(); //--------------------------------------------------------- //bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def) -bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned port, int ctlnum, int* min, int* max, int* def) +bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int* min, int* max, int* def) { LADSPA_PortRangeHint range = plugin->PortRangeHints[port]; LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor; @@ -104,7 +104,7 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned port, in MidiController::ControllerType t = midiControllerType(ctlnum); #ifdef PLUGIN_DEBUGIN - printf("ladspa2MidiControlValues: ctlnum:%d ladspa port:%d has default?:%d default:%f\n", ctlnum, port, hasdef, fdef); + printf("ladspa2MidiControlValues: ctlnum:%d ladspa port:%lu has default?:%d default:%f\n", ctlnum, port, hasdef, fdef); #endif if(desc & LADSPA_HINT_TOGGLED) @@ -278,7 +278,7 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned port, in //--------------------------------------------------------- //float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val) -float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned port, int ctlnum, int val) +float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int val) { LADSPA_PortRangeHint range = plugin->PortRangeHints[port]; LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor; @@ -296,7 +296,7 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned port, int ctlnu MidiController::ControllerType t = midiControllerType(ctlnum); #ifdef PLUGIN_DEBUGIN - printf("midi2LadspaValue: ctlnum:%d ladspa port:%d val:%d\n", ctlnum, port, val); + printf("midi2LadspaValue: ctlnum:%d ladspa port:%lu val:%d\n", ctlnum, port, val); #endif float m = 1.0; @@ -453,7 +453,7 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned port, int ctlnu //--------------------------------------------------------- //MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, int port, int ctlnum) -MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned port, int ctlnum) +MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum) { int min, max, def; @@ -473,7 +473,7 @@ MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned //float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k) //bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, int port, float* val) -bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned port, float* val) +bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, float* val) { if(port < plugin->PortCount) { @@ -573,7 +573,7 @@ bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned port, float* v //--------------------------------------------------------- //void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, float* max) -void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned port, float* min, float* max) +void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, float* min, float* max) { LADSPA_PortRangeHint range = plugin->PortRangeHints[port]; LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor; @@ -777,7 +777,7 @@ int Plugin::incReferences(int val) { const DSSI_Descriptor* descr; //for(int i = 0;; ++i) - for(unsigned i = 0;; ++i) // p4.0.21 + for(unsigned long i = 0;; ++i) // p4.0.21 { descr = dssi(i); if(descr == NULL) @@ -809,7 +809,7 @@ int Plugin::incReferences(int val) { const LADSPA_Descriptor* descr; //for(int i = 0;; ++i) - for(unsigned i = 0;; ++i) // p4.0.21 + for(unsigned long i = 0;; ++i) // p4.0.21 { descr = ladspadf(i); if(descr == NULL) @@ -1021,7 +1021,7 @@ static void loadPluginLib(QFileInfo* fi) { const DSSI_Descriptor* descr; //for (int i = 0;; ++i) - for (unsigned i = 0;; ++i) // p4.0.21 + for (unsigned long i = 0;; ++i) // p4.0.21 { descr = dssi(i); if (descr == 0) @@ -1074,7 +1074,7 @@ static void loadPluginLib(QFileInfo* fi) const LADSPA_Descriptor* descr; //for (int i = 0;; ++i) - for (unsigned i = 0;; ++i) // p4.0.21 + for (unsigned long i = 0;; ++i) // p4.0.21 { descr = ladspa(i); if (descr == NULL) @@ -1486,7 +1486,7 @@ bool Pipeline::nativeGuiVisible(int idx) //--------------------------------------------------------- //void Pipeline::apply(int ports, unsigned long nframes, float** buffer1) -void Pipeline::apply(unsigned ports, unsigned nframes, float** buffer1) +void Pipeline::apply(unsigned long ports, unsigned long nframes, float** buffer1) { // prepare a second set of buffers in case a plugin is not // capable of inPlace processing @@ -1498,7 +1498,7 @@ void Pipeline::apply(unsigned ports, unsigned nframes, float** buffer1) // buffer2[i] = data + i * nframes; // p3.3.41 - //fprintf(stderr, "Pipeline::apply data: nframes:%ld %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]); + //fprintf(stderr, "Pipeline::apply data: nframes:%lu %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]); bool swap = false; @@ -1533,14 +1533,14 @@ void Pipeline::apply(unsigned ports, unsigned nframes, float** buffer1) if (swap) { //for (int i = 0; i < ports; ++i) - for (unsigned i = 0; i < ports; ++i) // p4.0.21 + for (unsigned long i = 0; i < ports; ++i) // p4.0.21 //memcpy(buffer1[i], buffer2[i], sizeof(float) * nframes); //memcpy(buffer1[i], buffer[i], sizeof(float) * nframes); AL::dsp->cpy(buffer1[i], buffer[i], nframes); } // p3.3.41 - //fprintf(stderr, "Pipeline::apply after data: nframes:%ld %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]); + //fprintf(stderr, "Pipeline::apply after data: nframes:%lu %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]); } @@ -1696,7 +1696,7 @@ void PluginI::updateControllers() return; //for(int i = 0; i < controlPorts; ++i) - for(unsigned i = 0; i < controlPorts; ++i) + for(unsigned long i = 0; i < controlPorts; ++i) //audio->msgSetPluginCtrlVal(this, genACnum(_id, i), controls[i].val); // p3.3.43 //audio->msgSetPluginCtrlVal(_track, genACnum(_id, i), controls[i].val); @@ -1807,7 +1807,7 @@ void PluginI::setChannels(int c) // setParam //--------------------------------------------------------- -void PluginI::setParam(unsigned i, float val) +void PluginI::setParam(unsigned long i, float val) { //controls[i].tmpVal = val; @@ -1815,7 +1815,7 @@ void PluginI::setParam(unsigned i, float val) if(i >= _plugin->_controlInPorts) //if(i >= controlPorts) { - printf("PluginI::setParameter param number %u out of range of ports:%ld\n", i, _plugin->_controlInPorts); + printf("PluginI::setParameter param number %lu out of range of ports:%lu\n", i, _plugin->_controlInPorts); return; } ControlEvent ce; @@ -1828,7 +1828,7 @@ void PluginI::setParam(unsigned i, float val) ce.frame = audio->timestamp(); if(_controlFifo.put(ce)) { - fprintf(stderr, "PluginI::setParameter: fifo overflow: in control number:%u\n", i); + fprintf(stderr, "PluginI::setParameter: fifo overflow: in control number:%lu\n", i); } // Notify that changes are to be sent upon heartbeat. @@ -1842,7 +1842,7 @@ void PluginI::setParam(unsigned i, float val) //--------------------------------------------------------- //double PluginI::defaultValue(unsigned int param) const -float PluginI::defaultValue(unsigned param) const +float PluginI::defaultValue(unsigned long param) const { if(param >= controlPorts) return 0.0; @@ -2025,10 +2025,10 @@ bool PluginI::initPluginInstance(Plugin* plug, int c) //--------------------------------------------------------- //void PluginI::connect(int ports, float** src, float** dst) -void PluginI::connect(unsigned ports, unsigned offset, float** src, float** dst) +void PluginI::connect(unsigned long ports, unsigned long offset, float** src, float** dst) { //int port = 0; - unsigned port = 0; // p4.0.21 + unsigned long port = 0; // p4.0.21 for (int i = 0; i < instances; ++i) { for (unsigned long k = 0; k < _plugin->ports(); ++k) { if (isAudioIn(k)) { @@ -2076,7 +2076,7 @@ void PluginI::activate() _plugin->activate(handle[i]); if (initControlValues) { //for (int i = 0; i < controlPorts; ++i) { - for (unsigned i = 0; i < controlPorts; ++i) { + for (unsigned long i = 0; i < controlPorts; ++i) { controls[i].val = controls[i].tmpVal; } } @@ -2085,7 +2085,7 @@ void PluginI::activate() // get initial control values from plugin // //for (int i = 0; i < controlPorts; ++i) { - for (unsigned i = 0; i < controlPorts; ++i) { + for (unsigned long i = 0; i < controlPorts; ++i) { controls[i].tmpVal = controls[i].val; } } @@ -2100,7 +2100,7 @@ void PluginI::activate() bool PluginI::setControl(const QString& s, float val) { //for (int i = 0; i < controlPorts; ++i) { - for (unsigned i = 0; i < controlPorts; ++i) { + for (unsigned long i = 0; i < controlPorts; ++i) { if (_plugin->portName(controls[i].idx) == s) { //controls[i].val = controls[i].tmpVal = val; setParam(i, val); // p4.0.21 @@ -2126,8 +2126,8 @@ void PluginI::writeConfiguration(int level, Xml& xml) //for (int i = 0; i < controlPorts; ++i) { //int idx = controls[i].idx; - for (unsigned i = 0; i < controlPorts; ++i) { // p4.0.21 - unsigned idx = controls[i].idx; // + for (unsigned long i = 0; i < controlPorts; ++i) { // p4.0.21 + unsigned long idx = controls[i].idx; // QString s("control name=\"%1\" val=\"%2\" /"); //xml.tag(level, s.arg(_plugin->portName(idx)).arg(controls[i].tmpVal).toLatin1().constData()); xml.tag(level, s.arg(Xml::xmlString(_plugin->portName(idx)).toLatin1().constData()).arg(controls[i].tmpVal).toLatin1().constData()); @@ -2413,7 +2413,7 @@ void PluginIBase::deleteGui() void PluginI::enableAllControllers(bool v) { //for(int i = 0; i < controlPorts; ++i) - for(unsigned i = 0; i < controlPorts; ++i) + for(unsigned long i = 0; i < controlPorts; ++i) controls[i].enCtrl = v; } @@ -2424,7 +2424,7 @@ void PluginI::enableAllControllers(bool v) void PluginI::enable2AllControllers(bool v) { //for(int i = 0; i < controlPorts; ++i) - for(unsigned i = 0; i < controlPorts; ++i) + for(unsigned long i = 0; i < controlPorts; ++i) controls[i].en2Ctrl = v; } @@ -2434,7 +2434,7 @@ void PluginI::enable2AllControllers(bool v) /* //void PluginI::apply(int n) -void PluginI::apply(unsigned n) +void PluginI::apply(unsigned long n) { // Process control value changes. //if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) @@ -2467,7 +2467,7 @@ void PluginI::apply(unsigned n) OscControlValue v = cfifo->get(); #ifdef PLUGIN_DEBUGIN - fprintf(stderr, "PluginI::apply OscControlFifo event input control number:%ld value:%f\n", k, v.value); + fprintf(stderr, "PluginI::apply OscControlFifo event input control number:%lu value:%f\n", k, v.value); #endif // Set the ladspa control port value. @@ -2525,7 +2525,7 @@ void PluginI::apply(unsigned n) #if 1 // p4.0.21 -void PluginI::apply(unsigned n, unsigned ports, float** bufIn, float** bufOut) +void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** bufOut) { // Process control value changes. //if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) @@ -2538,9 +2538,9 @@ void PluginI::apply(unsigned n, unsigned ports, float** bufIn, float** bufOut) //} //unsigned endPos = pos + n; - int frameOffset = audio->getFrameOffset(); + unsigned long frameOffset = audio->getFrameOffset(); - unsigned sample = 0; + unsigned long sample = 0; int loopcount = 0; // REMOVE Tim. // Must make this detectable for dssi vst effects. @@ -2550,7 +2550,7 @@ void PluginI::apply(unsigned n, unsigned ports, float** bufIn, float** bufOut) // Note for dssi-vst this MUST equal audio period. It doesn't like broken-up runs (it stutters), // even with fixed sizes. Could be a Wine + Jack thing, wanting a full Jack buffer's length. //unsigned fixedsize = 2048; - unsigned fixedsize = n; + unsigned long fixedsize = n; // For now, the fixed size is clamped to the audio buffer size. // TODO: We could later add slower processing over several cycles - @@ -2571,19 +2571,19 @@ void PluginI::apply(unsigned n, unsigned ports, float** bufIn, float** bufOut) while(sample < n) { - //unsigned nsamp = n; - //unsigned nsamp = n - sample; - unsigned nsamp = usefixedrate ? fixedsize : n - sample; + //unsigned long nsamp = n; + //unsigned long nsamp = n - sample; + unsigned long nsamp = usefixedrate ? fixedsize : n - sample; bool found = false; - unsigned frame = 0; - unsigned index = 0; + unsigned long frame = 0; + unsigned long index = 0; // Get all control ring buffer items valid for this time period... //for(int m = 0; m < cbsz; ++m) while(!_controlFifo.isEmpty()) { //ControlValue v = _controlFifo.get(); ControlEvent v = _controlFifo.peek(); - //printf("PluginI::apply control idx:%d frame:%d val:%f\n", v.idx, v.frame, v.value); // REMOVE Tim. + //printf("PluginI::apply control idx:%lu frame:%lu val:%f\n", v.idx, v.frame, v.value); // REMOVE Tim. // Process only items in this time period. Make sure to process all // subsequent items which have the same frame. //if(v.frame >= (endPos + frameOffset) || (found && v.frame != frame)) @@ -2650,7 +2650,7 @@ void PluginI::apply(unsigned n, unsigned ports, float** bufIn, float** bufOut) if(sample + nsamp >= n) // Safety check. nsamp = n - sample; - //printf("PluginI::apply ports:%d n:%d frame:%d sample:%d nsamp:%d fOffset:%d loopcount:%d\n", + //printf("PluginI::apply ports:%lu n:%lu frame:%lu sample:%lu nsamp:%lu fOffset:%lu loopcount:%d\n", // ports, n, frame, sample, nsamp, frameOffset, loopcount); // REMOVE Tim. // TODO: TESTING: Don't allow zero-length runs. This could/should be checked in the control loop instead. @@ -2804,11 +2804,11 @@ int PluginI::oscUpdate() // Send current control values. //unsigned long ports = controlPorts; //for(int i = 0; i < controlPorts; ++i) - for(unsigned i = 0; i < controlPorts; ++i) + for(unsigned long i = 0; i < controlPorts; ++i) { //unsigned long k = synth->pIdx(i); //_oscIF.oscSendControl(k, controls[i]); - //printf("PluginI::oscUpdate() sending control:%d val:%f\n", i, controls[i].val); + //printf("PluginI::oscUpdate() sending control:%lu val:%f\n", i, 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) @@ -2829,7 +2829,7 @@ int PluginI::oscControl(unsigned long port, float value) //LADSPA_Data value = argv[1]->f; #ifdef PLUGIN_DEBUGIN - printf("PluginI::oscControl received oscControl port:%ld val:%f\n", port, value); + printf("PluginI::oscControl received oscControl port:%lu val:%f\n", port, value); #endif //int controlPorts = synth->_controller; @@ -2838,7 +2838,7 @@ int PluginI::oscControl(unsigned long port, float value) //if(port < 0 || port >= _plugin->rpIdx.size()) if(port >= _plugin->rpIdx.size()) { - fprintf(stderr, "PluginI::oscControl: port number:%ld is out of range of index list size:%d\n", port, _plugin->rpIdx.size()); + fprintf(stderr, "PluginI::oscControl: port number:%lu is out of range of index list size:%zd\n", port, _plugin->rpIdx.size()); return 0; } @@ -2848,7 +2848,7 @@ int PluginI::oscControl(unsigned long port, float value) if((int)cport == -1) { - fprintf(stderr, "PluginI::oscControl: port number:%ld is not a control input\n", port); + fprintf(stderr, "PluginI::oscControl: port number:%lu is not a control input\n", port); return 0; } @@ -2880,7 +2880,7 @@ int PluginI::oscControl(unsigned long port, float value) cv.frame = audio->timestamp(); if(cfifo->put(cv)) { - fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%ld\n", cport); + fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%lu\n", cport); } } */ @@ -2895,7 +2895,7 @@ int PluginI::oscControl(unsigned long port, float value) ce.frame = audio->timestamp(); if(_controlFifo.put(ce)) { - fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%ld\n", cport); + fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%lu\n", cport); } @@ -2908,7 +2908,7 @@ int PluginI::oscControl(unsigned long port, float value) if(_track && _id != -1) { //int id = genACnum(_id, cport); - unsigned id = genACnum(_id, cport); + unsigned long id = genACnum(_id, cport); AutomationType at = _track->automationType(); // TODO: Taken from our native gui control handlers. @@ -3161,10 +3161,10 @@ void PluginDialog::fillPlugs(int nbr) //int ao = i->outports(); //int ci = i->controlInPorts(); //int co = i->controlOutPorts(); - unsigned ai = i->inports(); // p4.0.21 - unsigned ao = i->outports(); - unsigned ci = i->controlInPorts(); - unsigned co = i->controlOutPorts(); + unsigned long ai = i->inports(); // p4.0.21 + unsigned long ao = i->outports(); + unsigned long ci = i->controlInPorts(); + unsigned long co = i->controlOutPorts(); bool addFlag = false; switch (nbr) { case SEL_SM: // stereo & mono @@ -3213,10 +3213,10 @@ void PluginDialog::fillPlugs(const QString &sortValue) //int ao = i->outports(); //int ci = i->controlInPorts(); //int co = i->controlOutPorts(); - unsigned ai = i->inports(); // p4.0.21 - unsigned ao = i->outports(); - unsigned ci = i->controlInPorts(); - unsigned co = i->controlOutPorts(); + unsigned long ai = i->inports(); // p4.0.21 + unsigned long ao = i->outports(); + unsigned long ci = i->controlInPorts(); + unsigned long co = i->controlOutPorts(); bool addFlag = false; @@ -3334,8 +3334,8 @@ PluginGui::PluginGui(PluginIBase* p) //sscanf(name, "P%d", ¶meter); //if (parameter == -1) // continue; - unsigned parameter; // p4.0.21 - int rv = sscanf(name, "P%u", ¶meter); + unsigned long parameter; // p4.0.21 + int rv = sscanf(name, "P%lu", ¶meter); if(rv != 1) continue; ++nobj; @@ -3365,8 +3365,8 @@ PluginGui::PluginGui(PluginIBase* p) //sscanf(name, "P%d", ¶meter); //if (parameter == -1) // continue; - unsigned parameter; // p4.0.21 - int rv = sscanf(name, "P%u", ¶meter); + unsigned long parameter; // p4.0.21 + int rv = sscanf(name, "P%lu", ¶meter); if(rv != 1) continue; @@ -3383,7 +3383,7 @@ PluginGui::PluginGui(PluginIBase* p) ((Slider*)obj)->setId(nobj); ((Slider*)obj)->setCursorHoming(true); //for(int i = 0; i < nobj; i++) - for(unsigned i = 0; i < nobj; i++) // p4.0.21 + for(unsigned long i = 0; i < nobj; i++) // p4.0.21 { if(gw[i].type == GuiWidgets::DOUBLE_LABEL && gw[i].param == parameter) ((DoubleLabel*)gw[i].widget)->setSlider((Slider*)obj); @@ -3397,7 +3397,7 @@ PluginGui::PluginGui(PluginIBase* p) gw[nobj].type = GuiWidgets::DOUBLE_LABEL; ((DoubleLabel*)obj)->setId(nobj); //for(int i = 0; i < nobj; i++) - for(unsigned i = 0; i < nobj; i++) + for(unsigned long i = 0; i < nobj; i++) { if(gw[i].type == GuiWidgets::SLIDER && gw[i].param == parameter) { @@ -3438,7 +3438,7 @@ PluginGui::PluginGui(PluginIBase* p) mw->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); //int n = plugin->parameters(); - unsigned n = plugin->parameters(); // p4.0.21 + unsigned long n = plugin->parameters(); // p4.0.21 params = new GuiParam[n]; //int style = Slider::BgTrough | Slider::BgSlot; @@ -3446,7 +3446,7 @@ PluginGui::PluginGui(PluginIBase* p) int h = fm.height() + 4; //for (int i = 0; i < n; ++i) { - for (unsigned i = 0; i < n; ++i) { // p4.0.21 + for (unsigned long i = 0; i < n; ++i) { // p4.0.21 QLabel* label = 0; LADSPA_PortRangeHint range = plugin->range(i); double lower = 0.0; // default values @@ -3950,7 +3950,7 @@ void PluginGui::updateValues() { if (params) { //for (int i = 0; i < plugin->parameters(); ++i) { - for (unsigned i = 0; i < plugin->parameters(); ++i) { // p4.0.21 + for (unsigned long i = 0; i < plugin->parameters(); ++i) { // p4.0.21 GuiParam* gp = ¶ms[i]; if (gp->type == GuiParam::GUI_SLIDER) { double lv = plugin->param(i); @@ -3972,12 +3972,12 @@ void PluginGui::updateValues() } else if (gw) { //for (int i = 0; i < nobj; ++i) { - for (unsigned i = 0; i < nobj; ++i) { // p4.0.21 + for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21 QWidget* widget = gw[i].widget; int type = gw[i].type; //int param = gw[i].param; //double val = plugin->param(param); - unsigned param = gw[i].param; // p4.0.21 + unsigned long param = gw[i].param; // p4.0.21 float val = plugin->param(param); switch(type) { case GuiWidgets::SLIDER: @@ -4009,7 +4009,7 @@ void PluginGui::updateControls() // update outputs if (paramsOut) { - for (int i = 0; i < plugin->parametersOut(); ++i) { + for (unsigned long i = 0; i < plugin->parametersOut(); ++i) { GuiParam* gp = ¶msOut[i]; if (gp->type == GuiParam::GUI_METER) { double lv = plugin->paramOut(i); @@ -4036,7 +4036,7 @@ void PluginGui::updateControls() return; if (params) { //for (int i = 0; i < plugin->parameters(); ++i) { - for (unsigned i = 0; i < plugin->parameters(); ++i) { // p4.0.21 + for (unsigned long i = 0; i < plugin->parameters(); ++i) { // p4.0.21 GuiParam* gp = ¶ms[i]; if (gp->type == GuiParam::GUI_SLIDER) { if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) ) @@ -4083,11 +4083,11 @@ void PluginGui::updateControls() } else if (gw) { //for (int i = 0; i < nobj; ++i) { - for (unsigned i = 0; i < nobj; ++i) { // p4.0.21 + for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21 QWidget* widget = gw[i].widget; int type = gw[i].type; //int param = gw[i].param; - unsigned param = gw[i].param; // p4.0.21 + unsigned long param = gw[i].param; // p4.0.21 switch(type) { case GuiWidgets::SLIDER: if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) @@ -4158,7 +4158,7 @@ void PluginGui::guiParamChanged(int idx) { QWidget* w = gw[idx].widget; //int param = gw[idx].param; - unsigned param = gw[idx].param; // p4.0.21 + unsigned long param = gw[idx].param; // p4.0.21 int type = gw[idx].type; AutomationType at = AUTO_OFF; @@ -4186,7 +4186,7 @@ void PluginGui::guiParamChanged(int idx) } //for (int i = 0; i < nobj; ++i) { - for (unsigned i = 0; i < nobj; ++i) { // p4.0.21 + for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21 QWidget* widget = gw[i].widget; if (widget == w || param != gw[i].param) continue; @@ -4244,7 +4244,7 @@ void PluginGui::guiParamChanged(int idx) void PluginGui::guiParamPressed(int idx) { //int param = gw[idx].param; - unsigned param = gw[idx].param; // p4.0.21 + unsigned long param = gw[idx].param; // p4.0.21 AutomationType at = AUTO_OFF; AudioTrack* track = plugin->track(); @@ -4285,7 +4285,7 @@ void PluginGui::guiParamPressed(int idx) void PluginGui::guiParamReleased(int idx) { //int param = gw[idx].param; - unsigned param = gw[idx].param; // p4.0.21 + unsigned long param = gw[idx].param; // p4.0.21 int type = gw[idx].type; AutomationType at = AUTO_OFF; @@ -4331,7 +4331,7 @@ void PluginGui::guiParamReleased(int idx) void PluginGui::guiSliderPressed(int idx) { //int param = gw[idx].param; - unsigned param = gw[idx].param; // p4.0.21 + unsigned long param = gw[idx].param; // p4.0.21 QWidget *w = gw[idx].widget; AutomationType at = AUTO_OFF; @@ -4362,7 +4362,7 @@ void PluginGui::guiSliderPressed(int idx) // Needed so that paging a slider updates a label or other buddy control. //for (int i = 0; i < nobj; ++i) { - for (unsigned i = 0; i < nobj; ++i) { // p4.0.21 + for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21 QWidget* widget = gw[i].widget; if (widget == w || param != gw[i].param) continue; diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index e2457eae..30cc5912 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -146,12 +146,12 @@ class Plugin { plugin->cleanup(handle); } //void connectPort(LADSPA_Handle handle, int port, float* value) { - void connectPort(LADSPA_Handle handle, unsigned port, float* value) { // p4.0.21 + void connectPort(LADSPA_Handle handle, unsigned long port, float* value) { // p4.0.21 if(plugin) plugin->connect_port(handle, port, value); } //void apply(LADSPA_Handle handle, int n) { - void apply(LADSPA_Handle handle, unsigned n) { // p4.0.21 + void apply(LADSPA_Handle handle, unsigned long n) { // p4.0.21 if(plugin) plugin->run(handle, n); } @@ -229,7 +229,7 @@ class PluginList : public std::list<Plugin> { struct Port { //int idx; - unsigned idx; + unsigned long idx; float val; float tmpVal; @@ -263,7 +263,7 @@ struct GuiWidgets { QWidget* widget; int type; //int param; - unsigned param; // p4.0.21 + unsigned long param; // p4.0.21 }; class PluginI; @@ -319,7 +319,7 @@ class PluginIBase virtual bool on() const = 0; virtual void setOn(bool /*val*/) = 0; //virtual int pluginID() = 0; - virtual unsigned pluginID() = 0; // p4.0.21 + virtual unsigned long pluginID() = 0; // p4.0.21 virtual int id() = 0; virtual QString pluginLabel() const = 0; virtual QString name() const = 0; @@ -332,9 +332,9 @@ class PluginIBase //virtual void enableController(int /*i*/, bool /*v*/ = true) = 0; //virtual bool controllerEnabled(int /*i*/) const = 0; //virtual bool controllerEnabled2(int /*i*/) const = 0; - virtual void enableController(unsigned /*i*/, bool /*v*/ = true) = 0; // p4.0.21 - virtual bool controllerEnabled(unsigned /*i*/) const = 0; - virtual bool controllerEnabled2(unsigned /*i*/) const = 0; + virtual void enableController(unsigned long /*i*/, bool /*v*/ = true) = 0; // p4.0.21 + virtual bool controllerEnabled(unsigned long /*i*/) const = 0; + virtual bool controllerEnabled2(unsigned long /*i*/) const = 0; virtual void updateControllers() = 0; virtual void writeConfiguration(int /*level*/, Xml& /*xml*/) = 0; @@ -345,15 +345,15 @@ class PluginIBase //virtual double param(int /*i*/) const = 0; //virtual const char* paramName(int /*i*/) = 0; //virtual LADSPA_PortRangeHint range(int /*i*/) = 0; - virtual unsigned parameters() const = 0; // p4.0.21 - virtual unsigned parametersOut() const = 0; - virtual void setParam(unsigned /*i*/, float /*val*/) = 0; - virtual float param(unsigned /*i*/) const = 0; - virtual float paramOut(unsigned /*i*/) const = 0; - virtual const char* paramName(unsigned /*i*/) = 0; - virtual const char* paramOutName(unsigned /*i*/) = 0; - virtual LADSPA_PortRangeHint range(unsigned /*i*/) = 0; - virtual LADSPA_PortRangeHint rangeOut(unsigned /*i*/) = 0; + virtual unsigned long parameters() const = 0; // p4.0.21 + virtual unsigned long parametersOut() const = 0; + virtual void setParam(unsigned long /*i*/, float /*val*/) = 0; + virtual float param(unsigned long /*i*/) const = 0; + virtual float paramOut(unsigned long /*i*/) const = 0; + virtual const char* paramName(unsigned long /*i*/) = 0; + virtual const char* paramOutName(unsigned long /*i*/) = 0; + virtual LADSPA_PortRangeHint range(unsigned long /*i*/) = 0; + virtual LADSPA_PortRangeHint rangeOut(unsigned long /*i*/) = 0; QString dssi_ui_filename() const; //virtual void showGui(bool) = 0; // p4.0.20 @@ -375,7 +375,7 @@ class PluginGui : public QMainWindow { GuiParam* params; GuiParam* paramsOut; //int nobj; - unsigned nobj; // number of widgets in gw // p4.0.21 + unsigned long nobj; // number of widgets in gw // p4.0.21 GuiWidgets* gw; QAction* onOff; @@ -435,8 +435,8 @@ class PluginI : public PluginIBase { //int controlPorts; //int controlOutPorts; - unsigned controlPorts; // p4.0.21 - unsigned controlOutPorts; // + unsigned long controlPorts; // p4.0.21 + unsigned long controlOutPorts; // ///PluginGui* _gui; bool _on; @@ -469,7 +469,7 @@ class PluginI : public PluginIBase { void setTrack(AudioTrack* t) { _track = t; } AudioTrack* track() { return _track; } //int pluginID() { return _plugin->id(); } - unsigned pluginID() { return _plugin->id(); } // p4.0.21 + unsigned long pluginID() { return _plugin->id(); } // p4.0.21 void setID(int i); int id() { return _id; } void updateControllers(); @@ -480,17 +480,17 @@ class PluginI : public PluginIBase { //void apply(int n); //void connect(unsigned ports, float** src, float** dst); //void apply(unsigned n); - void connect(unsigned ports, unsigned offset, float** src, float** dst); // p4.0.21 - void apply(unsigned n, unsigned ports, float** bufIn, float** bufOut); // + void connect(unsigned long ports, unsigned long offset, float** src, float** dst); // p4.0.21 + void apply(unsigned long n, unsigned long ports, float** bufIn, float** bufOut); // //void enableController(int i, bool v = true) { controls[i].enCtrl = v; } //bool controllerEnabled(int i) const { return controls[i].enCtrl; } //void enable2Controller(int i, bool v = true) { controls[i].en2Ctrl = v; } //bool controllerEnabled2(int i) const { return controls[i].en2Ctrl; } - void enableController(unsigned i, bool v = true) { controls[i].enCtrl = v; } // p4.0.21 - bool controllerEnabled(unsigned i) const { return controls[i].enCtrl; } - void enable2Controller(unsigned i, bool v = true) { controls[i].en2Ctrl = v; } - bool controllerEnabled2(unsigned i) const { return controls[i].en2Ctrl; } + void enableController(unsigned long i, bool v = true) { controls[i].enCtrl = v; } // p4.0.21 + bool controllerEnabled(unsigned long i) const { return controls[i].enCtrl; } + void enable2Controller(unsigned long i, bool v = true) { controls[i].en2Ctrl = v; } + bool controllerEnabled2(unsigned long i) const { return controls[i].en2Ctrl; } void enableAllControllers(bool v = true); void enable2AllControllers(bool v = true); @@ -544,21 +544,21 @@ class PluginI : public PluginIBase { //bool isAudioOut(int k) { return (_plugin->portd(k) & AUDIO_OUT) == AUDIO_OUT; } //LADSPA_PortRangeHint range(int i) { return _plugin->range(controls[i].idx); } // p4.0.21 - unsigned parameters() const { return controlPorts; } - unsigned parametersOut() const { return controlOutPorts; } + unsigned long parameters() const { return controlPorts; } + unsigned long parametersOut() const { return controlOutPorts; } //void setParam(unsigned i, float val) { controls[i].tmpVal = val; } - void setParam(unsigned i, float val); - float param(unsigned i) const { return controls[i].val; } - float paramOut(unsigned i) const { return controlsOut[i].val; } - float defaultValue(unsigned param) const; - const char* paramName(unsigned i) { return _plugin->portName(controls[i].idx); } - const char* paramOutName(unsigned i) { return _plugin->portName(controlsOut[i].idx); } - LADSPA_PortDescriptor portd(unsigned i) const { return _plugin->portd(controls[i].idx); } - void range(unsigned i, float* min, float* max) const { _plugin->range(controls[i].idx, min, max); } - bool isAudioIn(unsigned k) { return (_plugin->portd(k) & AUDIO_IN) == AUDIO_IN; } - bool isAudioOut(unsigned k) { return (_plugin->portd(k) & AUDIO_OUT) == AUDIO_OUT; } - LADSPA_PortRangeHint range(unsigned i) { return _plugin->range(controls[i].idx); } - LADSPA_PortRangeHint rangeOut(unsigned i) { return _plugin->range(controlsOut[i].idx); } + void setParam(unsigned long i, float val); + float param(unsigned long i) const { return controls[i].val; } + float paramOut(unsigned long i) const { return controlsOut[i].val; } + float defaultValue(unsigned long param) const; + const char* paramName(unsigned long i) { return _plugin->portName(controls[i].idx); } + const char* paramOutName(unsigned long i) { return _plugin->portName(controlsOut[i].idx); } + LADSPA_PortDescriptor portd(unsigned long i) const { return _plugin->portd(controls[i].idx); } + void range(unsigned long i, float* min, float* max) const { _plugin->range(controls[i].idx, min, max); } + bool isAudioIn(unsigned long k) { return (_plugin->portd(k) & AUDIO_IN) == AUDIO_IN; } + bool isAudioOut(unsigned long k) { return (_plugin->portd(k) & AUDIO_OUT) == AUDIO_OUT; } + LADSPA_PortRangeHint range(unsigned long i) { return _plugin->range(controls[i].idx); } + LADSPA_PortRangeHint rangeOut(unsigned long i) { return _plugin->range(controlsOut[i].idx); } bool inPlaceCapable() const { return _plugin->inPlaceCapable(); } }; @@ -593,7 +593,7 @@ class Pipeline : public std::vector<PluginI*> { bool guiVisible(int); bool nativeGuiVisible(int); //void apply(int ports, unsigned long nframes, float** buffer); - void apply(unsigned ports, unsigned nframes, float** buffer); // p4.0.21 + void apply(unsigned long ports, unsigned long nframes, float** buffer); // p4.0.21 void move(int idx, bool up); bool empty(int idx) const; void setChannels(int); @@ -646,11 +646,11 @@ extern PluginList plugins; //extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def); //extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val); // p4.0.21 -extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned port, float* val); -extern void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned port, float* min, float* max); -extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned port, int ctlnum, int* min, int* max, int* def); -extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned port, int ctlnum, int val); -//extern MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned port, int ctlnum); +extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, float* val); +extern void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, float* min, float* max); +extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int* min, int* max, int* def); +extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int val); +//extern MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum); #endif |