From 4f2e54561260eb8382953d5723d5d111353a22c9 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Tue, 10 May 2011 21:23:00 +0000 Subject: Added general settings audio item: Minimum control process period Added Yamaha Mo6 instrument file by Geoff King --- muse2/ChangeLog | 5 + muse2/muse/conf.cpp | 3 + muse2/muse/dssihost.cpp | 27 +- muse2/muse/gconfig.cpp | 3 +- muse2/muse/gconfig.h | 1 + muse2/muse/plugin.cpp | 21 +- muse2/muse/widgets/genset.cpp | 19 + muse2/muse/widgets/gensetbase.ui | 147 +++- muse2/muse/widgets/musewidgetsplug.cpp | 4 + muse2/share/instruments/yam_mo6_v3.idf | 1290 ++++++++++++++++++++++++++++++++ 10 files changed, 1500 insertions(+), 20 deletions(-) create mode 100644 muse2/share/instruments/yam_mo6_v3.idf diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 291bcd6f..a091bf49 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,8 @@ +10.05.2011: + - Added general settings audio item: Minimum control process period 1-2048, default 64. Test OK. (Tim) + Adjusts minimum allowable number of samples in a LADSPA or DSSI run, ie control 'smoothness'. + Still TODO: AudioTrack controllers contribution. + - Added Yamaha Mo6 instrument file by Geoff King gsking1 A T gmail D O T com. (Tim) 08.05.2011: - Draw event canvas notes if they extend past part end. (Tim) - Added checkbox to select if songinfo should be displayed on song start (rj) diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index c79c3928..2f391445 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -923,6 +923,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) config.dummyAudioSampleRate = xml.parseInt(); else if (tag == "dummyAudioBufSize") config.dummyAudioBufSize = xml.parseInt(); + else if (tag == "minControlProcessPeriod") + config.minControlProcessPeriod = xml.parseUInt(); else if (tag == "guiRefresh") config.guiRefresh = xml.parseInt(); else if (tag == "userInstrumentsDir") @@ -1182,6 +1184,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const xml.intTag(level, "vstInPlace", config.vstInPlace); xml.intTag(level, "dummyAudioBufSize", config.dummyAudioBufSize); xml.intTag(level, "dummyAudioSampleRate", config.dummyAudioSampleRate); + xml.uintTag(level, "minControlProcessPeriod", config.minControlProcessPeriod); xml.intTag(level, "guiRefresh", config.guiRefresh); xml.strTag(level, "userInstrumentsDir", config.userInstrumentsDir); diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index cbb908e6..49a63643 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -2342,6 +2342,9 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns unsigned long sample = 0; int loopcount = 0; // REMOVE Tim. + // To remember the last retrieved value of each AudioTrack controller. + //float prev_ctrl_values[synth->_controlInPorts]; + // NOTE Tested: Variable run-lengths worked superbly for LADSPA and DSSI synths. But DSSI-VST definitely // does NOT like changing sample run length. It crashes the plugin and Wine (but MusE keeps running!). // Furthermore, it resizes the shared memory (mmap, remap) upon each run length DIFFERENT from the last. @@ -2372,11 +2375,15 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns if(fixedsize > n) fixedsize = n; + unsigned long min_per = config.minControlProcessPeriod; + if(min_per > n) + min_per = n; + // Process automation control values now. // TODO: This needs to be respect frame resolution. Put this inside the sample loop below. - for(unsigned long k = 0; k < synth->_controlInPorts; ++k) + if(automation && synti && synti->automationType() != AUTO_OFF && id() != -1) { - if(automation && synti && synti->automationType() != AUTO_OFF && id() != -1) + for(unsigned long k = 0; k < synth->_controlInPorts; ++k) { if(controls[k].enCtrl && controls[k].en2Ctrl ) controls[k].val = synti->pluginCtrlVal(genACnum(id(), k)); @@ -2393,7 +2400,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns unsigned long index = 0; unsigned long evframe; // Get all control ring buffer items valid for this time period... - //for(int m = 0; m < cbsz; ++m) + //for(int m = 0; m < cbsz; ++m) // Doesn't like this. Why? while(!_controlFifo.isEmpty()) { //ControlValue v = _controlFifo.get(); @@ -2424,7 +2431,9 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns if(evframe >= n //|| (found && v.frame != frame) //|| (!usefixedrate && found && !v.unique && v.frame != frame) - || (found && !v.unique && evframe != frame) + //|| (found && !v.unique && evframe != frame) + // Not enough requested samples to satisfy minimum setting? Keep going. + || (found && !v.unique && (evframe - sample >= min_per)) // dssi-vst needs them serialized and accounted for, no matter what. This works with fixed rate // because nsamp is constant. But with packets, we need to guarantee at least one-frame spacing. // Although we likely won't be using packets with dssi-vst, so it's OK for now. @@ -2443,6 +2452,16 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns controls[v.idx].val = v.value; } + // Process automation control values now. + //if(automation && synti && synti->automationType() != AUTO_OFF && id() != -1) + //{ + // for(unsigned long k = 0; k < synth->_controlInPorts; ++k) + // { + // if(controls[k].enCtrl && controls[k].en2Ctrl ) + // controls[k].val = synti->pluginCtrlVal(genACnum(id(), k)); + // } + //} + //if(found) if(found && !usefixedrate) //nsamp = frame - sample + 1; diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index ee6123ef..4d22ad4c 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -167,6 +167,7 @@ GlobalConfigValues config = { 512, // Dummy audio buffer size QString("./"), // projectBaseFolder true, // projectStoreInFolder - true // useProjectSaveDialog + true, // useProjectSaveDialog + 64 // minControlProcessPeriod }; diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index 6fb1bb17..cd236b36 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -142,6 +142,7 @@ struct GlobalConfigValues { QString projectBaseFolder; bool projectStoreInFolder; bool useProjectSaveDialog; + unsigned long minControlProcessPeriod; }; extern GlobalConfigValues config; diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 76ebeb1b..215a7844 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -2560,6 +2560,9 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** // } //} + // Grab the control ring buffer size now. + //const int cbsz = _controlFifo.getSize(); + //unsigned endPos = pos + n; //unsigned long frameOffset = audio->getFrameOffset(); unsigned long syncFrame = audio->curSyncFrame(); @@ -2581,12 +2584,16 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** // so that users can select a small audio period but a larger control period. if(fixedsize > n) fixedsize = n; + + unsigned long min_per = config.minControlProcessPeriod; + if(min_per > n) + min_per = n; // Process automation control values now. // TODO: This needs to be respect frame resolution. Put this inside the sample loop below. - for(unsigned long k = 0; k < controlPorts; ++k) + if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) { - if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) + for(unsigned long k = 0; k < controlPorts; ++k) { if(controls[k].enCtrl && controls[k].en2Ctrl ) controls[k].tmpVal = _track->pluginCtrlVal(genACnum(_id, k)); @@ -2603,7 +2610,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** unsigned long index = 0; unsigned long evframe; // Get all control ring buffer items valid for this time period... - //for(int m = 0; m < cbsz; ++m) + //for(int m = 0; m < cbsz; ++m) // Doesn't like this. Why? while(!_controlFifo.isEmpty()) { //ControlValue v = _controlFifo.get(); @@ -2632,7 +2639,9 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** if(evframe >= n //|| (found && v.frame != frame) //|| (!usefixedrate && found && !v.unique && v.frame != frame) - || (found && !v.unique && evframe != frame) + //|| (found && !v.unique && evframe != frame) + // Not enough requested samples to satisfy minimum setting? Keep going. + || (found && !v.unique && (evframe - sample >= min_per)) // Protection. Observed this condition (dummy audio so far). Why? Supposed to be linear timestamps. //|| (found && evframe < frame) // dssi-vst needs them serialized and accounted for, no matter what. This works with fixed rate @@ -2700,7 +2709,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** //printf("PluginI::apply ports:%lu n:%lu frame:%lu sample:%lu nsamp:%lu syncFrame:%lu loopcount:%d\n", // ports, n, frame, sample, nsamp, syncFrame, loopcount); // REMOVE Tim. - // TODO: TESTING: Don't allow zero-length runs. This could/should be checked in the control loop instead. + // Don't allow zero-length runs. This could/should be checked in the control loop instead. // Note this means it is still possible to get stuck in the top loop (at least for a while). if(nsamp == 0) continue; @@ -2712,7 +2721,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** //fprintf(stderr, "PluginI::apply handle %d\n", i); _plugin->apply(handle[i], nsamp); } - + sample += nsamp; loopcount++; // REMOVE Tim. } diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 4a0550bb..edf3cfda 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -28,6 +28,9 @@ static int divisions[] = { static int dummyAudioBufSizes[] = { 16, 32, 64, 128, 256, 512, 1024, 2048 }; +static unsigned long minControlProcessPeriods[] = { + 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 + }; //--------------------------------------------------------- // GlobalSettingsConfig @@ -66,6 +69,13 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) } } + for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { + if (minControlProcessPeriods[i] == config.minControlProcessPeriod) { + minControlProcessPeriodComboBox->setCurrentIndex(i); + break; + } + } + userInstrumentsPath->setText(config.userInstrumentsDir); selectInstrumentsDirButton->setIcon(*openIcon); defaultInstrumentsDirButton->setIcon(*undoIcon); @@ -185,6 +195,13 @@ void GlobalSettingsConfig::updateSettings() } } + for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { + if (minControlProcessPeriods[i] == config.minControlProcessPeriod) { + minControlProcessPeriodComboBox->setCurrentIndex(i); + break; + } + } + guiRefreshSelect->setValue(config.guiRefresh); minSliderSelect->setValue(int(config.minSlider)); minMeterSelect->setValue(config.minMeter); @@ -279,6 +296,8 @@ void GlobalSettingsConfig::apply() int das = dummyAudioSize->currentIndex(); config.dummyAudioBufSize = dummyAudioBufSizes[das]; config.dummyAudioSampleRate = dummyAudioRate->value(); + int mcp = minControlProcessPeriodComboBox->currentIndex(); + config.minControlProcessPeriod = minControlProcessPeriods[mcp]; int div = midiDivisionSelect->currentIndex(); config.division = divisions[div]; diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index a48dd3f0..ca4b97f8 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -6,8 +6,8 @@ 0 0 - 522 - 528 + 526 + 506 @@ -550,11 +550,20 @@ Mixer - + 11 + + 2 + + + 11 + + + 2 + - 6 + 2 @@ -617,8 +626,7 @@ - Use Jack freewheel mode if possible. -(Speeds up bounce operations). + Try to use Jack Freewheel false @@ -634,6 +642,13 @@ + + Speeds bounce operations + + + Use Jack Freewheel mode if possible. +This dramatically speeds bounce operations. + @@ -669,8 +684,7 @@ - Enable in-place processing for VST plugins. -(Requires restart.) + VST in-place false @@ -679,14 +693,105 @@ + + Enable VST in-place processing (restart required) + - Turn this off if VST Ladspa effect rack plugins do not work or feedback loudly, even if they are supposed to be in-place capable. + Enable VST in-place processing. Turn this off if + VST Ladspa effect rack plugins do not work or + feedback loudly, even if they are supposed to + be in-place capable. Setting requires a restart. + + + + Minimum control period + + + + + + + Minimum audio controller process period (samples). + + + + Minimum audio controller process period (samples). +Adjusts responsiveness of audio controls and + controller graphs. Set a low value for fast, smooth + control. If it causes performance problems, set a + higher value. + + + 15 + + + + 1 + + + + + 2 + + + + + 4 + + + + + 8 + + + + + 16 + + + + + 32 + + + + + 64 + + + + + 128 + + + + + 256 + + + + + 512 + + + + + 1024 + + + + + 2048 + + + + @@ -696,6 +801,15 @@ External Waveditor + + 2 + + + 2 + + + 2 + @@ -771,6 +885,21 @@ Dummy Audio Driver (settings require restart) + + 11 + + + 2 + + + 11 + + + 2 + + + 2 + diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index 4b61cf2a..8cb0b57e 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -193,6 +193,10 @@ GlobalConfigValues config = { false, // vstInPlace Enable VST in-place processing 44100, // Dummy audio preferred sample rate 512 // Dummy audio buffer size + QString("./"), // projectBaseFolder + true, // projectStoreInFolder + true, // useProjectSaveDialog + 64 // minControlProcessPeriod }; //--------------------------------------------------------- diff --git a/muse2/share/instruments/yam_mo6_v3.idf b/muse2/share/instruments/yam_mo6_v3.idf new file mode 100644 index 00000000..da3ad8c7 --- /dev/null +++ b/muse2/share/instruments/yam_mo6_v3.idf @@ -0,0 +1,1290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3