| @@ -477,14 +477,9 @@ public: | |||||
| CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | ||||
| } | } | ||||
| void setProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(pData->prog.count)); | |||||
| if (index < -1) | |||||
| index = -1; | |||||
| else if (index > static_cast<int32_t>(pData->prog.count)) | |||||
| return; | |||||
| CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||||
| const bool doLock(sendGui || sendOsc || sendCallback); | const bool doLock(sendGui || sendOsc || sendCallback); | ||||
| @@ -503,14 +498,9 @@ public: | |||||
| CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | ||||
| } | } | ||||
| void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count)); | |||||
| if (index < -1) | |||||
| index = -1; | |||||
| else if (index > static_cast<int32_t>(pData->midiprog.count)) | |||||
| return; | |||||
| CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||||
| const bool doLock(sendGui || sendOsc || sendCallback); | const bool doLock(sendGui || sendOsc || sendCallback); | ||||
| @@ -331,7 +331,7 @@ public: | |||||
| fDssiDescriptor->set_custom_data(fHandle, chunk.data(), chunk.size()); | fDssiDescriptor->set_custom_data(fHandle, chunk.data(), chunk.size()); | ||||
| } | } | ||||
| void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,); | ||||
| @@ -1349,11 +1349,8 @@ CARLA_BACKEND_END_NAMESPACE | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| CarlaPlugin* CarlaPlugin::newLinuxSampler(const Initializer& init, const char* const format, const bool /*use16Outs*/) | |||||
| CarlaPlugin* CarlaPlugin::newLinuxSampler(const Initializer& init, const char* const format, const bool use16Outs) | |||||
| { | { | ||||
| // TESTING | |||||
| const bool use16Outs = true; | |||||
| carla_debug("LinuxSamplerPlugin::newLinuxSampler({%p, \"%s\", \"%s\", \"%s\"}, %s, %s)", init.engine, init.filename, init.name, init.label, format, bool2str(use16Outs)); | carla_debug("LinuxSamplerPlugin::newLinuxSampler({%p, \"%s\", \"%s\", \"%s\"}, %s, %s)", init.engine, init.filename, init.name, init.label, format, bool2str(use16Outs)); | ||||
| #ifdef WANT_LINUXSAMPLER | #ifdef WANT_LINUXSAMPLER | ||||
| @@ -996,16 +996,11 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| void setProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_ASSERT(fRdfDescriptor != nullptr); | |||||
| CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount)); | |||||
| CARLA_ASSERT(sendGui || sendOsc || sendCallback); // never call this from RT | |||||
| if (index < -1) | |||||
| index = -1; | |||||
| else if (index > static_cast<int32_t>(fRdfDescriptor->PresetCount)) | |||||
| return; | |||||
| CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount),); | |||||
| CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); // never call this from RT | |||||
| if (index >= 0 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount)) | if (index >= 0 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount)) | ||||
| { | { | ||||
| @@ -1025,16 +1020,11 @@ public: | |||||
| CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | ||||
| } | } | ||||
| void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count)); | |||||
| if (index < -1) | |||||
| index = -1; | |||||
| else if (index > static_cast<int32_t>(pData->midiprog.count)) | |||||
| return; | |||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||||
| if (index >= 0 && fExt.programs != nullptr && fExt.programs->select_program != nullptr) | if (index >= 0 && fExt.programs != nullptr && fExt.programs->select_program != nullptr) | ||||
| { | { | ||||
| @@ -596,14 +596,15 @@ public: | |||||
| CarlaPlugin::setCustomData(type, key, value, sendGui); | CarlaPlugin::setCustomData(type, key, value, sendGui); | ||||
| } | } | ||||
| void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | ||||
| // TODO, put into check below | |||||
| if ((pData->hints & PLUGIN_IS_SYNTH) != 0 && (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS)) | if ((pData->hints & PLUGIN_IS_SYNTH) != 0 && (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS)) | ||||
| return; | |||||
| return CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||||
| if (index >= 0) | if (index >= 0) | ||||
| { | { | ||||
| @@ -338,15 +338,10 @@ public: | |||||
| // } | // } | ||||
| } | } | ||||
| void setProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override | |||||
| { | { | ||||
| CARLA_ASSERT(fEffect != nullptr); | |||||
| CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(pData->prog.count)); | |||||
| if (index < -1) | |||||
| index = -1; | |||||
| else if (index > static_cast<int32_t>(pData->prog.count)) | |||||
| return; | |||||
| CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||||
| if (index >= 0) | if (index >= 0) | ||||
| { | { | ||||
| @@ -363,26 +363,56 @@ public: | |||||
| static void outputInfo(const LinuxSampler::InstrumentManager::instrument_info_t* const info, const size_t programs, const char* const basename = nullptr) | static void outputInfo(const LinuxSampler::InstrumentManager::instrument_info_t* const info, const size_t programs, const char* const basename = nullptr) | ||||
| { | { | ||||
| CarlaString name; | |||||
| const char* label; | |||||
| if (info != nullptr) | |||||
| { | |||||
| name = info->InstrumentName.c_str(); | |||||
| label = info->Product.c_str(); | |||||
| } | |||||
| else | |||||
| { | |||||
| name = basename; | |||||
| label = basename; | |||||
| } | |||||
| // 2 channels | |||||
| DISCOVERY_OUT("init", "-----------"); | DISCOVERY_OUT("init", "-----------"); | ||||
| DISCOVERY_OUT("name", (const char*)name); | |||||
| DISCOVERY_OUT("label", label); | |||||
| if (info != nullptr) | if (info != nullptr) | ||||
| { | { | ||||
| DISCOVERY_OUT("name", info->InstrumentName); | |||||
| DISCOVERY_OUT("label", info->Product); | |||||
| DISCOVERY_OUT("maker", info->Artists); | DISCOVERY_OUT("maker", info->Artists); | ||||
| DISCOVERY_OUT("copyright", info->Artists); | DISCOVERY_OUT("copyright", info->Artists); | ||||
| } | } | ||||
| else if (basename != nullptr && basename[0] != '\0') | |||||
| DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
| DISCOVERY_OUT("audio.outs", 2); | |||||
| DISCOVERY_OUT("midi.ins", 1); | |||||
| DISCOVERY_OUT("programs", programs); | |||||
| DISCOVERY_OUT("build", BINARY_NATIVE); | |||||
| DISCOVERY_OUT("end", "------------"); | |||||
| if (name.isEmpty()) | |||||
| return; | |||||
| name += " (16 outputs)"; | |||||
| // 16 channels | |||||
| DISCOVERY_OUT("init", "-----------"); | |||||
| DISCOVERY_OUT("name", (const char*)name); | |||||
| DISCOVERY_OUT("label", label); | |||||
| if (info != nullptr) | |||||
| { | { | ||||
| DISCOVERY_OUT("name", basename); | |||||
| DISCOVERY_OUT("label", basename); | |||||
| DISCOVERY_OUT("maker", info->Artists); | |||||
| DISCOVERY_OUT("copyright", info->Artists); | |||||
| } | } | ||||
| DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | ||||
| DISCOVERY_OUT("audio.outs", 2); | DISCOVERY_OUT("audio.outs", 2); | ||||
| DISCOVERY_OUT("midi.ins", 1); | DISCOVERY_OUT("midi.ins", 1); | ||||
| //DISCOVERY_OUT("parameters.ins", 13); // defined in Carla, TODO | |||||
| //DISCOVERY_OUT("parameters.outs", 1); | |||||
| DISCOVERY_OUT("programs", programs); | DISCOVERY_OUT("programs", programs); | ||||
| DISCOVERY_OUT("build", BINARY_NATIVE); | DISCOVERY_OUT("build", BINARY_NATIVE); | ||||
| DISCOVERY_OUT("end", "------------"); | DISCOVERY_OUT("end", "------------"); | ||||
| @@ -1660,8 +1690,13 @@ void do_fluidsynth_check(const char* const filename, const bool init) | |||||
| delete_fluid_settings(f_settings); | delete_fluid_settings(f_settings); | ||||
| } | } | ||||
| // FIXME | |||||
| CarlaString name(std::strrchr(filename, OS_SEP)+1); | |||||
| CarlaString name; | |||||
| if (const char* const shortname = std::strrchr(filename, OS_SEP)) | |||||
| name = shortname+1; | |||||
| else | |||||
| name = filename; | |||||
| name.truncate(name.rfind('.')); | name.truncate(name.rfind('.')); | ||||
| CarlaString label(name); | CarlaString label(name); | ||||
| @@ -1670,8 +1705,6 @@ void do_fluidsynth_check(const char* const filename, const bool init) | |||||
| DISCOVERY_OUT("init", "-----------"); | DISCOVERY_OUT("init", "-----------"); | ||||
| DISCOVERY_OUT("name", (const char*)name); | DISCOVERY_OUT("name", (const char*)name); | ||||
| DISCOVERY_OUT("label", (const char*)label); | DISCOVERY_OUT("label", (const char*)label); | ||||
| DISCOVERY_OUT("maker", ""); | |||||
| DISCOVERY_OUT("copyright", ""); | |||||
| DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | ||||
| DISCOVERY_OUT("audio.outs", 2); | DISCOVERY_OUT("audio.outs", 2); | ||||
| DISCOVERY_OUT("midi.ins", 1); | DISCOVERY_OUT("midi.ins", 1); | ||||
| @@ -1682,14 +1715,13 @@ void do_fluidsynth_check(const char* const filename, const bool init) | |||||
| DISCOVERY_OUT("end", "------------"); | DISCOVERY_OUT("end", "------------"); | ||||
| // 16 channels | // 16 channels | ||||
| if (name.isNotEmpty()) | |||||
| name += " (16 outputs)"; | |||||
| if (name.isEmpty()) | |||||
| return; | |||||
| name += " (16 outputs)"; | |||||
| DISCOVERY_OUT("init", "-----------"); | DISCOVERY_OUT("init", "-----------"); | ||||
| DISCOVERY_OUT("name", ""); | |||||
| DISCOVERY_OUT("name", (const char*)name); | DISCOVERY_OUT("name", (const char*)name); | ||||
| DISCOVERY_OUT("label", (const char*)label); | DISCOVERY_OUT("label", (const char*)label); | ||||
| DISCOVERY_OUT("copyright", ""); | |||||
| DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | ||||
| DISCOVERY_OUT("audio.outs", 32); | DISCOVERY_OUT("audio.outs", 32); | ||||
| DISCOVERY_OUT("midi.ins", 1); | DISCOVERY_OUT("midi.ins", 1); | ||||