Implement IUnitInfo::getProgramPitchName

This commit is contained in:
Robbert van der Helm
2020-12-26 23:20:13 +01:00
parent e414c58a7a
commit d34b399ba0
6 changed files with 91 additions and 5 deletions
+23
View File
@@ -492,6 +492,17 @@ bool Vst3Logger::log_request(bool is_host_vst,
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaUnitInfo::GetProgramPitchName& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id
<< ": IUnitInfo::getProgramPitchName(listId = "
<< request.list_id
<< ", programIndex = " << request.program_index
<< ", midiPitch = " << request.midi_pitch << ", &name)";
});
}
bool Vst3Logger::log_request(
bool is_host_vst,
const YaAudioProcessor::SetBusArrangements& request) {
@@ -938,6 +949,18 @@ void Vst3Logger::log_response(
});
}
void Vst3Logger::log_response(
bool is_host_vst,
const YaUnitInfo::GetProgramPitchNameResponse& response) {
log_response_base(is_host_vst, [&](auto& message) {
message << response.result.string();
if (response.result == Steinberg::kResultOk) {
message << ", \"" << VST3::StringConvert::convert(response.name)
<< "\"";
}
});
}
void Vst3Logger::log_response(
bool is_host_vst,
const YaAudioProcessor::GetBusArrangementResponse& response) {
+3
View File
@@ -115,6 +115,7 @@ class Vst3Logger {
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramName&);
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramInfo&);
bool log_request(bool is_host_vst, const YaUnitInfo::HasProgramPitchNames&);
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramPitchName&);
bool log_request(bool is_host_vst,
const YaAudioProcessor::SetBusArrangements&);
@@ -175,6 +176,8 @@ class Vst3Logger {
const YaUnitInfo::GetProgramNameResponse&);
void log_response(bool is_host_vst,
const YaUnitInfo::GetProgramInfoResponse&);
void log_response(bool is_host_vst,
const YaUnitInfo::GetProgramPitchNameResponse&);
void log_response(bool is_host_vst,
const YaAudioProcessor::GetBusArrangementResponse&);
+2 -1
View File
@@ -106,7 +106,8 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
YaUnitInfo::GetProgramListInfo,
YaUnitInfo::GetProgramName,
YaUnitInfo::GetProgramInfo,
YaUnitInfo::HasProgramPitchNames>;
YaUnitInfo::HasProgramPitchNames,
YaUnitInfo::GetProgramPitchName>;
template <typename S>
void serialize(S& s, ControlRequest& payload) {
@@ -212,7 +212,7 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
Steinberg::Vst::String128 name /*out*/) override = 0;
/**
* The response code and returned name for a call to
* The response code and returned value for a call to
* `IUnitInfo::getPrograminfo(list_id, program_index, attribute_name,
* &attribute_value)`.
*/
@@ -279,6 +279,46 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
virtual tresult PLUGIN_API
hasProgramPitchNames(Steinberg::Vst::ProgramListID listId,
int32 programIndex) override = 0;
/**
* The response code and returned name for a call to
* `IUnitInfo::getProgramPitchName(list_id, program_index, midi_pitch,
* &name)`.
*/
struct GetProgramPitchNameResponse {
UniversalTResult result;
std::u16string name;
template <typename S>
void serialize(S& s) {
s.object(result);
s.text2b(name, std::extent_v<Steinberg::Vst::String128>);
}
};
/**
* Message to pass through a call to
* `IUnitInfo::getProgramPitchName(list_id, program_index, midi_pitch,
* &name)` to the Wine plugin host.
*/
struct GetProgramPitchName {
using Response = GetProgramPitchNameResponse;
native_size_t instance_id;
Steinberg::Vst::ProgramListID list_id;
int32 program_index;
int16 midi_pitch;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.value4b(list_id);
s.value4b(program_index);
s.value2b(midi_pitch);
}
};
virtual tresult PLUGIN_API
getProgramPitchName(Steinberg::Vst::ProgramListID listId,
int32 programIndex,