From 17cf68a39907c3d147e3021101d5ee36a530ad5a Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 5 Jan 2015 02:23:27 +0000 Subject: [PATCH] More linuxsampler work; Minor UI tweaks --- resources/ui/carla_host.ui | 11 +++- .../plugin/CarlaPluginLinuxSampler.cpp | 52 ++++++++----------- source/carla_skin.py | 4 +- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/resources/ui/carla_host.ui b/resources/ui/carla_host.ui index 2ae7a8b1b..6bcfacc8b 100644 --- a/resources/ui/carla_host.ui +++ b/resources/ui/carla_host.ui @@ -66,7 +66,14 @@ - + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + @@ -137,7 +144,7 @@ 0 0 870 - 17 + 19 diff --git a/source/backend/plugin/CarlaPluginLinuxSampler.cpp b/source/backend/plugin/CarlaPluginLinuxSampler.cpp index 8d3f88d92..e581d2fe8 100644 --- a/source/backend/plugin/CarlaPluginLinuxSampler.cpp +++ b/source/backend/plugin/CarlaPluginLinuxSampler.cpp @@ -46,7 +46,9 @@ using CarlaBackend::CarlaPlugin; // ----------------------------------------------------------------------- // LinuxSampler static values -static const float kVolumeMax = 3.16227766f; // +10 dB +static const float kVolumeMax = 3.16227766f; // +10 dB +static const uint kMaxStreams = 90*2; // default is not *2 +static const uint kMaxVoices = 64*2; // ----------------------------------------------------------------------- // LinuxSampler AudioOutputDevice Plugin @@ -213,8 +215,9 @@ public: { carla_debug("CarlaPluginLinuxSampler::CarlaPluginLinuxSampler(%p, %i, %s, %s)", engine, id, bool2str(isGIG), bool2str(use16Outs)); - sSampler->SetGlobalMaxStreams(300); - sSampler->SetGlobalMaxVoices(300); + // TODO - option for this + sSampler->SetGlobalMaxStreams(LinuxSampler::kMaxStreams); + sSampler->SetGlobalMaxVoices(LinuxSampler::kMaxVoices); carla_zeroStruct(fCurProgs, MAX_MIDI_CHANNELS); carla_zeroStruct(fSamplerChannels, MAX_MIDI_CHANNELS); @@ -374,8 +377,8 @@ public: switch (parameterId) { - case LinuxSamplerStreamCount: - std::strncpy(strBuf, "Stream Count", STR_MAX); + case LinuxSamplerDiskStreamCount: + std::strncpy(strBuf, "Disk Stream Count", STR_MAX); return; case LinuxSamplerVoiceCount: std::strncpy(strBuf, "Voice Count", STR_MAX); @@ -471,6 +474,9 @@ public: CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count,); CARLA_SAFE_ASSERT_RETURN(channel >= 0 && channel < MAX_MIDI_CHANNELS,); + if (fCurProgs[channel] == index) + return; + LinuxSampler::EngineChannel* const engineChannel(fEngineChannels[kIsGIG ? channel : 0]); CARLA_SAFE_ASSERT_RETURN(engineChannel != nullptr,); @@ -627,13 +633,13 @@ public: int j; // ---------------------- - j = LinuxSamplerStreamCount; + j = LinuxSamplerDiskStreamCount; pData->param.data[j].type = PARAMETER_OUTPUT; pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_AUTOMABLE | PARAMETER_IS_INTEGER; pData->param.data[j].index = j; pData->param.data[j].rindex = j; pData->param.ranges[j].min = 0.0f; - pData->param.ranges[j].max = 65355.0f; + pData->param.ranges[j].max = LinuxSampler::kMaxStreams; pData->param.ranges[j].def = 0.0f; pData->param.ranges[j].step = 1.0f; pData->param.ranges[j].stepSmall = 1.0f; @@ -646,7 +652,7 @@ public: pData->param.data[j].index = j; pData->param.data[j].rindex = j; pData->param.ranges[j].min = 0.0f; - pData->param.ranges[j].max = 65355.0f; + pData->param.ranges[j].max = LinuxSampler::kMaxVoices; pData->param.ranges[j].def = 0.0f; pData->param.ranges[j].step = 1.0f; pData->param.ranges[j].stepSmall = 1.0f; @@ -771,8 +777,8 @@ public: for (uint32_t i=0; i < pData->audioOut.count; ++i) FloatVectorOperations::clear(audioOut[i], static_cast(frames)); - fParamBuffers[LinuxSamplerStreamCount] = 0.0f; - fParamBuffers[LinuxSamplerVoiceCount] = 0.0f; + fParamBuffers[LinuxSamplerDiskStreamCount] = 0.0f; + fParamBuffers[LinuxSamplerVoiceCount] = 0.0f; return; } @@ -1036,20 +1042,8 @@ public: // -------------------------------------------------------------------------------------------------------- // Parameter outputs - uint streamCount = 0; - uint voiceCount = 0; - - for (uint i=0; iGetDiskStreamCount(); - voiceCount += engineChannel->GetVoiceCount(); - } - } - - fParamBuffers[LinuxSamplerStreamCount] = streamCount; - fParamBuffers[LinuxSamplerVoiceCount] = voiceCount; + fParamBuffers[LinuxSamplerDiskStreamCount] = fEngineChannels[0]->GetDiskStreamCount(); + fParamBuffers[LinuxSamplerVoiceCount] = fEngineChannels[0]->GetVoiceCount(); } bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset) @@ -1339,9 +1333,9 @@ public: private: enum LinuxSamplerParameters { - LinuxSamplerStreamCount = 0, - LinuxSamplerVoiceCount = 1, - LinuxSamplerParametersMax = 2 + LinuxSamplerDiskStreamCount = 0, + LinuxSamplerVoiceCount = 1, + LinuxSamplerParametersMax = 2 }; const bool kIsGIG; // SFZ if false @@ -1352,8 +1346,8 @@ private: const char* fMaker; const char* fRealName; - int32_t fCurProgs[MAX_MIDI_CHANNELS]; - float fParamBuffers[LinuxSamplerParametersMax]; + uint32_t fCurProgs[MAX_MIDI_CHANNELS]; + float fParamBuffers[LinuxSamplerParametersMax]; SharedResourcePointer sSampler; diff --git a/source/carla_skin.py b/source/carla_skin.py index 08c1ba895..d1711ab1b 100644 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -284,14 +284,14 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): self.peak_in.setColor(DigitalPeakMeter.GREEN) self.peak_in.setChannels(self.fPeaksInputCount) self.peak_in.setOrientation(DigitalPeakMeter.HORIZONTAL) - if self.fPeaksInputCount == 0: + if self.fPeaksInputCount == 0 and not isinstance(self, PluginSlot_Default): self.peak_in.hide() if self.peak_out is not None: self.peak_out.setColor(DigitalPeakMeter.BLUE) self.peak_out.setChannels(self.fPeaksOutputCount) self.peak_out.setOrientation(DigitalPeakMeter.HORIZONTAL) - if self.fPeaksOutputCount == 0: + if self.fPeaksOutputCount == 0 and not isinstance(self, PluginSlot_Default): self.peak_out.hide() for paramIndex, paramWidget in self.fParameterList: