summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-05-10 21:23:00 +0000
committerTim E. Real <termtech@rogers.com>2011-05-10 21:23:00 +0000
commit4f2e54561260eb8382953d5723d5d111353a22c9 (patch)
tree18bd2c00719b20041f485f9e9c5eb0121ba172b0 /muse2/muse
parentc00e79dd68a68ab0ec30034612d3c8826107b8db (diff)
Added general settings audio item: Minimum control process period
Added Yamaha Mo6 instrument file by Geoff King
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/conf.cpp3
-rw-r--r--muse2/muse/dssihost.cpp27
-rw-r--r--muse2/muse/gconfig.cpp3
-rw-r--r--muse2/muse/gconfig.h1
-rw-r--r--muse2/muse/plugin.cpp21
-rw-r--r--muse2/muse/widgets/genset.cpp19
-rw-r--r--muse2/muse/widgets/gensetbase.ui147
-rw-r--r--muse2/muse/widgets/musewidgetsplug.cpp4
8 files changed, 205 insertions, 20 deletions
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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>522</width>
- <height>528</height>
+ <width>526</width>
+ <height>506</height>
</rect>
</property>
<property name="windowTitle">
@@ -550,11 +550,20 @@
<string>Mixer</string>
</property>
<layout class="QGridLayout">
- <property name="margin">
+ <property name="leftMargin">
<number>11</number>
</property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>11</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
<property name="spacing">
- <number>6</number>
+ <number>2</number>
</property>
<item row="0" column="1">
<widget class="QSpinBox" name="minSliderSelect">
@@ -617,8 +626,7 @@
<item row="2" column="0">
<widget class="QLabel" name="freewheelLabel">
<property name="text">
- <string>Use Jack freewheel mode if possible.
-(Speeds up bounce operations).</string>
+ <string>Try to use Jack Freewheel</string>
</property>
<property name="wordWrap">
<bool>false</bool>
@@ -634,6 +642,13 @@
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="freewheelCheckBox">
+ <property name="toolTip">
+ <string>Speeds bounce operations</string>
+ </property>
+ <property name="whatsThis">
+ <string>Use Jack Freewheel mode if possible.
+This dramatically speeds bounce operations.</string>
+ </property>
<property name="text">
<string/>
</property>
@@ -669,8 +684,7 @@
<item row="5" column="0">
<widget class="QLabel" name="vstInPlaceTextLabel">
<property name="text">
- <string>Enable in-place processing for VST plugins.
-(Requires restart.)</string>
+ <string>VST in-place</string>
</property>
<property name="wordWrap">
<bool>false</bool>
@@ -679,14 +693,105 @@
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="vstInPlaceCheckBox">
+ <property name="toolTip">
+ <string>Enable VST in-place processing (restart required)</string>
+ </property>
<property name="whatsThis">
- <string>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.</string>
+ <string>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.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="minControlProcessPeriodLabel">
+ <property name="text">
+ <string>Minimum control period</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QComboBox" name="minControlProcessPeriodComboBox">
+ <property name="toolTip">
+ <string>Minimum audio controller process period (samples).
+</string>
+ </property>
+ <property name="whatsThis">
+ <string>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. </string>
+ </property>
+ <property name="maxVisibleItems">
+ <number>15</number>
+ </property>
+ <item>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>4</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>8</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>16</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>32</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>64</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>128</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>256</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>512</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1024</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2048</string>
+ </property>
+ </item>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -696,6 +801,15 @@
<string>External Waveditor</string>
</property>
<layout class="QGridLayout">
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
<item row="0" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
@@ -771,6 +885,21 @@
<string>Dummy Audio Driver (settings require restart)</string>
</property>
<layout class="QGridLayout">
+ <property name="leftMargin">
+ <number>11</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>11</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
<item row="0" column="0">
<widget class="QLabel" name="dummyAudioRateLabel">
<property name="text">
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
};
//---------------------------------------------------------