mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Fully implement INoteExpressionCOntroller
This commit is contained in:
@@ -62,62 +62,67 @@ struct WantsConfiguration {
|
||||
* encodes the information we request or the operation we want to perform. A
|
||||
* request of type `ControlRequest(T)` should send back a `T::Response`.
|
||||
*/
|
||||
using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
||||
Vst3PluginProxy::Construct,
|
||||
Vst3PluginProxy::Destruct,
|
||||
Vst3PluginProxy::SetState,
|
||||
Vst3PluginProxy::GetState,
|
||||
YaConnectionPoint::Connect,
|
||||
YaConnectionPoint::Disconnect,
|
||||
YaConnectionPoint::Notify,
|
||||
YaEditController::SetComponentState,
|
||||
YaEditController::GetParameterCount,
|
||||
YaEditController::GetParameterInfo,
|
||||
YaEditController::GetParamStringByValue,
|
||||
YaEditController::GetParamValueByString,
|
||||
YaEditController::NormalizedParamToPlain,
|
||||
YaEditController::PlainParamToNormalized,
|
||||
YaEditController::GetParamNormalized,
|
||||
YaEditController::SetParamNormalized,
|
||||
YaEditController::SetComponentHandler,
|
||||
YaEditController::CreateView,
|
||||
YaEditController2::SetKnobMode,
|
||||
YaEditController2::OpenHelp,
|
||||
YaEditController2::OpenAboutBox,
|
||||
YaPlugView::IsPlatformTypeSupported,
|
||||
YaPlugView::Attached,
|
||||
YaPlugView::Removed,
|
||||
YaPlugView::OnWheel,
|
||||
YaPlugView::OnKeyDown,
|
||||
YaPlugView::OnKeyUp,
|
||||
YaPlugView::GetSize,
|
||||
YaPlugView::OnSize,
|
||||
YaPlugView::OnFocus,
|
||||
YaPlugView::SetFrame,
|
||||
YaPlugView::CanResize,
|
||||
YaPlugView::CheckSizeConstraint,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
YaPluginFactory::SetHostContext,
|
||||
YaProgramListData::ProgramDataSupported,
|
||||
YaProgramListData::GetProgramData,
|
||||
YaProgramListData::SetProgramData,
|
||||
YaUnitData::UnitDataSupported,
|
||||
YaUnitData::GetUnitData,
|
||||
YaUnitData::SetUnitData,
|
||||
YaUnitInfo::GetUnitCount,
|
||||
YaUnitInfo::GetUnitInfo,
|
||||
YaUnitInfo::GetProgramListCount,
|
||||
YaUnitInfo::GetProgramListInfo,
|
||||
YaUnitInfo::GetProgramName,
|
||||
YaUnitInfo::GetProgramInfo,
|
||||
YaUnitInfo::HasProgramPitchNames,
|
||||
YaUnitInfo::GetProgramPitchName,
|
||||
YaUnitInfo::GetSelectedUnit,
|
||||
YaUnitInfo::SelectUnit,
|
||||
YaUnitInfo::GetUnitByBus,
|
||||
YaUnitInfo::SetUnitProgramData>;
|
||||
using ControlRequest =
|
||||
std::variant<Vst3PlugViewProxy::Destruct,
|
||||
Vst3PluginProxy::Construct,
|
||||
Vst3PluginProxy::Destruct,
|
||||
Vst3PluginProxy::SetState,
|
||||
Vst3PluginProxy::GetState,
|
||||
YaConnectionPoint::Connect,
|
||||
YaConnectionPoint::Disconnect,
|
||||
YaConnectionPoint::Notify,
|
||||
YaEditController::SetComponentState,
|
||||
YaEditController::GetParameterCount,
|
||||
YaEditController::GetParameterInfo,
|
||||
YaEditController::GetParamStringByValue,
|
||||
YaEditController::GetParamValueByString,
|
||||
YaEditController::NormalizedParamToPlain,
|
||||
YaEditController::PlainParamToNormalized,
|
||||
YaEditController::GetParamNormalized,
|
||||
YaEditController::SetParamNormalized,
|
||||
YaEditController::SetComponentHandler,
|
||||
YaEditController::CreateView,
|
||||
YaEditController2::SetKnobMode,
|
||||
YaEditController2::OpenHelp,
|
||||
YaEditController2::OpenAboutBox,
|
||||
YaNoteExpressionController::GetNoteExpressionCount,
|
||||
YaNoteExpressionController::GetNoteExpressionInfo,
|
||||
YaNoteExpressionController::GetNoteExpressionStringByValue,
|
||||
YaNoteExpressionController::GetNoteExpressionValueByString,
|
||||
YaPlugView::IsPlatformTypeSupported,
|
||||
YaPlugView::Attached,
|
||||
YaPlugView::Removed,
|
||||
YaPlugView::OnWheel,
|
||||
YaPlugView::OnKeyDown,
|
||||
YaPlugView::OnKeyUp,
|
||||
YaPlugView::GetSize,
|
||||
YaPlugView::OnSize,
|
||||
YaPlugView::OnFocus,
|
||||
YaPlugView::SetFrame,
|
||||
YaPlugView::CanResize,
|
||||
YaPlugView::CheckSizeConstraint,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
YaPluginFactory::SetHostContext,
|
||||
YaProgramListData::ProgramDataSupported,
|
||||
YaProgramListData::GetProgramData,
|
||||
YaProgramListData::SetProgramData,
|
||||
YaUnitData::UnitDataSupported,
|
||||
YaUnitData::GetUnitData,
|
||||
YaUnitData::SetUnitData,
|
||||
YaUnitInfo::GetUnitCount,
|
||||
YaUnitInfo::GetUnitInfo,
|
||||
YaUnitInfo::GetProgramListCount,
|
||||
YaUnitInfo::GetProgramListInfo,
|
||||
YaUnitInfo::GetProgramName,
|
||||
YaUnitInfo::GetProgramInfo,
|
||||
YaUnitInfo::HasProgramPitchNames,
|
||||
YaUnitInfo::GetProgramPitchName,
|
||||
YaUnitInfo::GetSelectedUnit,
|
||||
YaUnitInfo::SelectUnit,
|
||||
YaUnitInfo::GetUnitByBus,
|
||||
YaUnitInfo::SetUnitProgramData>;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, ControlRequest& payload) {
|
||||
|
||||
@@ -117,7 +117,7 @@ class YaNoteExpressionController
|
||||
|
||||
int32 bus_index;
|
||||
int16 channel;
|
||||
int16 note_expression_index;
|
||||
int32 note_expression_index;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
|
||||
@@ -415,10 +415,11 @@ tresult PLUGIN_API Vst3PluginProxyImpl::openAboutBox(TBool onlyCheck) {
|
||||
|
||||
int32 PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionCount(int32 busIndex,
|
||||
int16 channel) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log(
|
||||
"TODO: Implement INoteExpressionCOntroller::getNoteExpressionCount()");
|
||||
return Steinberg::kNotImplemented;
|
||||
return bridge.send_message(
|
||||
YaNoteExpressionController::GetNoteExpressionCount{
|
||||
.instance_id = instance_id(),
|
||||
.bus_index = busIndex,
|
||||
.channel = channel});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionInfo(
|
||||
@@ -426,10 +427,16 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionInfo(
|
||||
int16 channel,
|
||||
int32 noteExpressionIndex,
|
||||
Steinberg::Vst::NoteExpressionTypeInfo& info /*out*/) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log(
|
||||
"TODO: Implement INoteExpressionCOntroller::getNoteExpressionInfo()");
|
||||
return Steinberg::kNotImplemented;
|
||||
const GetNoteExpressionInfoResponse response =
|
||||
bridge.send_message(YaNoteExpressionController::GetNoteExpressionInfo{
|
||||
.instance_id = instance_id(),
|
||||
.bus_index = busIndex,
|
||||
.channel = channel,
|
||||
.note_expression_index = noteExpressionIndex});
|
||||
|
||||
info = response.info;
|
||||
|
||||
return response.result;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionStringByValue(
|
||||
@@ -438,11 +445,18 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionStringByValue(
|
||||
Steinberg::Vst::NoteExpressionTypeID id,
|
||||
Steinberg::Vst::NoteExpressionValue valueNormalized /*in*/,
|
||||
Steinberg::Vst::String128 string /*out*/) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log(
|
||||
"TODO: Implement "
|
||||
"INoteExpressionCOntroller::getNoteExpressionStringByValue()");
|
||||
return Steinberg::kNotImplemented;
|
||||
const GetNoteExpressionStringByValueResponse response = bridge.send_message(
|
||||
YaNoteExpressionController::GetNoteExpressionStringByValue{
|
||||
.instance_id = instance_id(),
|
||||
.bus_index = busIndex,
|
||||
.channel = channel,
|
||||
.id = id,
|
||||
.value_normalized = valueNormalized});
|
||||
|
||||
std::copy(response.string.begin(), response.string.end(), string);
|
||||
string[response.string.size()] = 0;
|
||||
|
||||
return response.result;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionValueByString(
|
||||
@@ -451,11 +465,17 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getNoteExpressionValueByString(
|
||||
Steinberg::Vst::NoteExpressionTypeID id,
|
||||
const Steinberg::Vst::TChar* string /*in*/,
|
||||
Steinberg::Vst::NoteExpressionValue& valueNormalized /*out*/) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log(
|
||||
"TODO: Implement "
|
||||
"INoteExpressionCOntroller::getNoteExpressionValueByString()");
|
||||
return Steinberg::kNotImplemented;
|
||||
const GetNoteExpressionValueByStringResponse response = bridge.send_message(
|
||||
YaNoteExpressionController::GetNoteExpressionValueByString{
|
||||
.instance_id = instance_id(),
|
||||
.bus_index = busIndex,
|
||||
.channel = channel,
|
||||
.id = id,
|
||||
.string = string});
|
||||
|
||||
valueNormalized = response.value_normalized;
|
||||
|
||||
return response.result;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::initialize(FUnknown* context) {
|
||||
|
||||
@@ -370,6 +370,65 @@ void Vst3Bridge::run() {
|
||||
return object_instances[request.instance_id]
|
||||
.edit_controller_2->openAboutBox(request.only_check);
|
||||
},
|
||||
[&](const YaNoteExpressionController::GetNoteExpressionCount&
|
||||
request)
|
||||
-> YaNoteExpressionController::GetNoteExpressionCount::
|
||||
Response {
|
||||
return object_instances[request.instance_id]
|
||||
.note_expression_controller->getNoteExpressionCount(
|
||||
request.bus_index, request.channel);
|
||||
},
|
||||
[&](const YaNoteExpressionController::GetNoteExpressionInfo&
|
||||
request)
|
||||
-> YaNoteExpressionController::GetNoteExpressionInfo::Response {
|
||||
Steinberg::Vst::NoteExpressionTypeInfo info{};
|
||||
const tresult result =
|
||||
object_instances[request.instance_id]
|
||||
.note_expression_controller->getNoteExpressionInfo(
|
||||
request.bus_index, request.channel,
|
||||
request.note_expression_index, info);
|
||||
|
||||
return YaNoteExpressionController::
|
||||
GetNoteExpressionInfoResponse{.result = result,
|
||||
.info = std::move(info)};
|
||||
},
|
||||
[&](const YaNoteExpressionController::
|
||||
GetNoteExpressionStringByValue& request)
|
||||
-> YaNoteExpressionController::GetNoteExpressionStringByValue::
|
||||
Response {
|
||||
Steinberg::Vst::String128 string{0};
|
||||
const tresult result =
|
||||
object_instances[request.instance_id]
|
||||
.note_expression_controller
|
||||
->getNoteExpressionStringByValue(
|
||||
request.bus_index, request.channel,
|
||||
request.id, request.value_normalized,
|
||||
string);
|
||||
|
||||
return YaNoteExpressionController::
|
||||
GetNoteExpressionStringByValueResponse{
|
||||
.result = result,
|
||||
.string = tchar_pointer_to_u16string(string)};
|
||||
},
|
||||
[&](const YaNoteExpressionController::
|
||||
GetNoteExpressionValueByString& request)
|
||||
-> YaNoteExpressionController::GetNoteExpressionValueByString::
|
||||
Response {
|
||||
Steinberg::Vst::NoteExpressionValue value_normalized;
|
||||
const tresult result =
|
||||
object_instances[request.instance_id]
|
||||
.note_expression_controller
|
||||
->getNoteExpressionValueByString(
|
||||
request.bus_index, request.channel,
|
||||
request.id,
|
||||
u16string_to_tchar_pointer(request.string),
|
||||
value_normalized);
|
||||
|
||||
return YaNoteExpressionController::
|
||||
GetNoteExpressionValueByStringResponse{
|
||||
.result = result,
|
||||
.value_normalized = value_normalized};
|
||||
},
|
||||
[&](const YaPlugView::IsPlatformTypeSupported& request)
|
||||
-> YaPlugView::IsPlatformTypeSupported::Response {
|
||||
// The host will of course want to pass an X11 window ID for the
|
||||
@@ -831,7 +890,7 @@ size_t Vst3Bridge::register_object_instance(
|
||||
},
|
||||
[&](const YaComponent::GetControllerClassId& request)
|
||||
-> YaComponent::GetControllerClassId::Response {
|
||||
Steinberg::TUID cid;
|
||||
Steinberg::TUID cid{0};
|
||||
const tresult result =
|
||||
object_instances[request.instance_id]
|
||||
.component->getControllerClassId(cid);
|
||||
|
||||
Reference in New Issue
Block a user