Skip to content

Commit

Permalink
converting param values and bus names from utf8 instead of ASCII, too
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Kaluza committed Sep 26, 2024
1 parent 0a057dc commit 3de9651
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wrapasvst3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ tresult PLUGIN_API ClapAsVst3::getParamStringByValue(Vst::ParamID id, Vst::Param
if (param->isMidi)
{
auto r = std::to_string((int)val);

// usually we try to avoid UString assignment, but here it is okay.
UString wrapper(&string[0], str16BufferSize(Steinberg::Vst::String128));

wrapper.assign(r.c_str(), (Steinberg::int32)(r.size() + 1));
Expand All @@ -397,9 +399,8 @@ tresult PLUGIN_API ClapAsVst3::getParamStringByValue(Vst::ParamID id, Vst::Param

if (this->_plugin->_ext._params->value_to_text(_plugin->_plugin, param->id, val, outbuf, 127))
{
UString wrapper(&string[0], str16BufferSize(Steinberg::Vst::String128));
utf8_to_utf16l(outbuf, (uint16_t*) &string[0], str16BufferSize(Steinberg::Vst::String128));

wrapper.assign(outbuf, sizeof(outbuf));
return kResultOk;
}
return super::getParamStringByValue(id, valueNormalized, string);
Expand Down Expand Up @@ -1586,8 +1587,7 @@ tresult ClapAsVst3::getBusInfo(Vst::MediaType type, Vst::BusDirection dir, int32
bus.busType = (info.flags & CLAP_AUDIO_PORT_IS_MAIN) ? Vst::kMain : Vst::kAux;
bus.flags = Vst::BusInfo::kDefaultActive;

UString wrapper(&bus.name[0], str16BufferSize(Steinberg::Vst::String128));
wrapper.assign(info.name, (Steinberg::int32)CLAP_NAME_SIZE);
utf8_to_utf16l(info.name, (uint16_t*)&bus.name[0], str16BufferSize(Steinberg::Vst::String128));

return kResultOk;
}
Expand Down

0 comments on commit 3de9651

Please sign in to comment.