@@ -173,6 +173,8 @@ void RackGraph::setBufferSize(const uint32_t bufferSize) noexcept | |||
if (audio.outBuf[0] != nullptr) { delete[] audio.outBuf[0]; audio.outBuf[0] = nullptr; } | |||
if (audio.outBuf[1] != nullptr) { delete[] audio.outBuf[1]; audio.outBuf[1] = nullptr; } | |||
CARLA_SAFE_ASSERT_RETURN(bufferSize > 0,); | |||
try { | |||
audio.inBufTmp[0] = new float[bufferSize]; | |||
audio.inBufTmp[1] = new float[bufferSize]; | |||
@@ -586,6 +586,9 @@ public: | |||
carla_zeroChar(fTmpBuf, STR_MAX+1); | |||
pData->bufferSize = pHost->get_buffer_size(pHost->handle); | |||
pData->sampleRate = pHost->get_sample_rate(pHost->handle); | |||
// set-up engine | |||
if (kIsPatchbay) | |||
{ | |||
@@ -715,6 +718,14 @@ protected: | |||
if (pData->bufferSize == newBufferSize) | |||
return; | |||
{ | |||
const CarlaMutexLocker cml(fUiServer.getWriteLock()); | |||
fUiServer.writeAndFixMsg("buffer-size"); | |||
std::sprintf(fTmpBuf, "%i\n", newBufferSize); | |||
fUiServer.writeMsg(fTmpBuf); | |||
} | |||
pData->bufferSize = newBufferSize; | |||
CarlaEngine::bufferSizeChanged(newBufferSize); | |||
} | |||
@@ -724,6 +735,15 @@ protected: | |||
if (carla_compareFloats(pData->sampleRate, newSampleRate)) | |||
return; | |||
{ | |||
const CarlaMutexLocker cml(fUiServer.getWriteLock()); | |||
const ScopedLocale csl; | |||
fUiServer.writeAndFixMsg("sample-rate"); | |||
std::sprintf(fTmpBuf, "%f\n", newSampleRate); | |||
fUiServer.writeMsg(fTmpBuf); | |||
} | |||
pData->sampleRate = newSampleRate; | |||
CarlaEngine::sampleRateChanged(newSampleRate); | |||
} | |||
@@ -953,18 +973,28 @@ protected: | |||
const CarlaMutexLocker cml(fUiServer.getWriteLock()); | |||
fUiServer.writeAndFixMsg("carla-complete-license"); | |||
fUiServer.writeAndFixMsg("complete-license"); | |||
fUiServer.writeAndFixMsg(carla_get_complete_license_text()); | |||
fUiServer.writeAndFixMsg("carla-juce-version"); | |||
fUiServer.writeAndFixMsg("juce-version"); | |||
fUiServer.writeAndFixMsg(carla_get_juce_version()); | |||
fUiServer.writeAndFixMsg("carla-file-exts"); | |||
fUiServer.writeAndFixMsg("file-exts"); | |||
fUiServer.writeAndFixMsg(carla_get_supported_file_extensions()); | |||
fUiServer.writeAndFixMsg("carla-max-plugin-number"); | |||
fUiServer.writeAndFixMsg("max-plugin-number"); | |||
std::sprintf(fTmpBuf, "%i\n", pData->maxPluginNumber); | |||
fUiServer.writeMsg(fTmpBuf); | |||
fUiServer.writeAndFixMsg("buffer-size"); | |||
std::sprintf(fTmpBuf, "%i\n", pData->bufferSize); | |||
fUiServer.writeMsg(fTmpBuf); | |||
const ScopedLocale csl; | |||
fUiServer.writeAndFixMsg("sample-rate"); | |||
std::sprintf(fTmpBuf, "%f\n", pData->sampleRate); | |||
fUiServer.writeMsg(fTmpBuf); | |||
} | |||
void uiServerOptions() | |||
@@ -1389,6 +1419,7 @@ protected: | |||
uiServerInfo(); | |||
uiServerOptions(); | |||
uiServerCallback(ENGINE_CALLBACK_ENGINE_STARTED, 0, pData->options.processMode, pData->options.transportMode, 0.0f, "Plugin"); | |||
fUiServer.show(); | |||
@@ -2896,8 +2896,6 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
self.fSupportedFileExts = "" | |||
self.fMaxPluginNumber = 0 | |||
self.fLastError = "" | |||
self.fOscUrlTCP = "" | |||
self.fOscUrlUDP = "" | |||
# plugin info | |||
self.fPluginsInfo = [] | |||
@@ -2913,7 +2911,6 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
} | |||
# some other vars | |||
self.fHostName = "" | |||
self.fBufferSize = 0 | |||
self.fSampleRate = 0.0 | |||
@@ -2950,7 +2947,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
return "Plugin" | |||
def get_engine_driver_device_names(self, index): | |||
return [self.fHostName] | |||
return [] | |||
def get_engine_driver_device_info(self, index, name): | |||
return PyEngineDriverDeviceInfo | |||
@@ -3194,10 +3191,10 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
return self.fLastError | |||
def get_host_osc_url_tcp(self): | |||
return self.fOscUrlTCP | |||
return "" | |||
def get_host_osc_url_udp(self): | |||
return self.fOscUrlUDP | |||
return "" | |||
# -------------------------------------------------------------------------------------------------------- | |||
@@ -401,6 +401,10 @@ class HostWindow(QMainWindow): | |||
self.ui.tabWidget.setCurrentIndex(0) | |||
self.fixCanvasPreviewSize() | |||
# Plugin needs to have timers always running so it receives messages | |||
if self.host.isPlugin: | |||
self.startTimers() | |||
QTimer.singleShot(0, self.slot_engineStart) | |||
# -------------------------------------------------------------------------------------------------------- | |||
@@ -37,7 +37,6 @@ class PluginHost(CarlaHostPlugin): | |||
self.fExternalUI = None | |||
self.fIsRunning = True | |||
self.fSampleRate = float(sys.argv[1]) if len(sys.argv) > 1 else 44100.0 | |||
# ------------------------------------------------------------------- | |||
@@ -308,22 +307,30 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
name = self.readlineblock().replace("\r", "\n") | |||
self.host._set_midiProgramData(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name}) | |||
elif msg == "carla-complete-license": | |||
elif msg == "complete-license": | |||
license = self.readlineblock().replace("\r", "\n") | |||
self.host.fCompleteLicenseText = license | |||
elif msg == "carla-juce-version": | |||
elif msg == "juce-version": | |||
version = self.readlineblock().replace("\r", "\n") | |||
self.host.fJuceVersion = version | |||
elif msg == "carla-file-exts": | |||
elif msg == "file-exts": | |||
exts = self.readlineblock().replace("\r", "\n") | |||
self.host.fSupportedFileExts = exts | |||
elif msg == "carla-max-plugin-number": | |||
elif msg == "max-plugin-number": | |||
maxnum = int(self.readlineblock()) | |||
self.host.fMaxPluginNumber = maxnum | |||
elif msg == "buffer-size": | |||
bufsize = int(self.readlineblock()) | |||
self.host.fBufferSize = bufsize | |||
elif msg == "sample-rate": | |||
srate = float(self.readlineblock()) | |||
self.host.fSampleRate = srate | |||
elif msg == "error": | |||
error = self.readlineblock().replace("\r", "\n") | |||
engineCallback(self.host, ENGINE_CALLBACK_ERROR, 0, 0, 0, 0.0, error) | |||
@@ -449,11 +456,6 @@ if __name__ == '__main__': | |||
else: | |||
gui = CarlaMiniW(host) | |||
# ------------------------------------------------------------- | |||
# simulate an engire started callback FIXME | |||
engineCallback(host, ENGINE_CALLBACK_ENGINE_STARTED, 0, host.processMode, ENGINE_TRANSPORT_MODE_PLUGIN, 0.0, "Plugin") | |||
# ------------------------------------------------------------- | |||
# App-Loop | |||