Skip to content

Commit

Permalink
clang-e-lang-dinge-lang-ding-dong
Browse files Browse the repository at this point in the history
  • Loading branch information
defiantnerd committed Feb 25, 2024
1 parent 23b629b commit e9eb6a3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
30 changes: 15 additions & 15 deletions src/detail/vst3/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,21 +320,21 @@ void ProcessAdapter::process(Steinberg::Vst::ProcessData& data)
n.midi.data[2] = 0;
break;
case Vst::ControllerNumbers::kPitchBend:
{
auto val = (uint16_t)param->asClapValue(value);
n.midi.data[0] = 0xE0 | param->channel; // $Ec
n.midi.data[1] = (val & 0x7F); // LSB
n.midi.data[2] = (val >> 7) & 0x7F; // MSB
}
break;
case Vst::ControllerNumbers::kCtrlProgramChange:
{
auto val = (uint16_t)param->asClapValue(value);
n.midi.data[0] = 0xC0 | param->channel; // $Cc
n.midi.data[1] = (val & 0x7F); // only one byte
n.midi.data[2] = 0;
}
break;
{
auto val = (uint16_t)param->asClapValue(value);
n.midi.data[0] = 0xE0 | param->channel; // $Ec
n.midi.data[1] = (val & 0x7F); // LSB
n.midi.data[2] = (val >> 7) & 0x7F; // MSB
}
break;
case Vst::ControllerNumbers::kCtrlProgramChange:
{
auto val = (uint16_t)param->asClapValue(value);
n.midi.data[0] = 0xC0 | param->channel; // $Cc
n.midi.data[1] = (val & 0x7F); // only one byte
n.midi.data[2] = 0;
}
break;
default:
n.midi.data[0] = 0xB0 | param->channel;
n.midi.data[1] = param->controller;
Expand Down
13 changes: 6 additions & 7 deletions src/wrapasvst3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,12 @@ tresult PLUGIN_API ClapAsVst3::getParamStringByValue(Vst::ParamID id, Vst::Param

if (param->getInfo().flags & Vst::ParameterInfo::kIsProgramChange)
{
UString wrapper(&string[0], str16BufferSize(Steinberg::Vst::String128));
UString wrapper(&string[0], str16BufferSize(Steinberg::Vst::String128));

wrapper.assign("Program", 8);
return kResultOk;

}

char outbuf[128];
memset(outbuf, 0, sizeof(outbuf));
if (this->_plugin->_ext._params->value_to_text(_plugin->_plugin, param->id, val, outbuf, 127))
Expand Down Expand Up @@ -644,7 +643,7 @@ void ClapAsVst3::setupParameters(const clap_plugin_t* plugin, const clap_plugin_
Vst::UnitInfo midiUnitInfo;

midiUnitInfo.id = (decltype(midiUnitInfo.id))units.size();
midiUnitInfo.parentUnitId = 0; // parented in the root unit
midiUnitInfo.parentUnitId = 0; // parented in the root unit
midiUnitInfo.programListId = Vst::kNoProgramListId;

auto name = fmt::format("MIDI Channel {}", channel + 1);
Expand Down Expand Up @@ -685,17 +684,17 @@ void ClapAsVst3::setupParameters(const clap_plugin_t* plugin, const clap_plugin_
auto programlist = new Steinberg::Vst::ProgramList(STR16("Program Changes"), x, midiUnitInfo.id);
for (int pc = 0; pc < 128; ++pc)
{
auto programname = fmt::format("Program {}", pc+1);
auto programname = fmt::format("Program {}", pc + 1);

programlist->addProgram(VST3::StringConvert::convert(programname).c_str());
}
}
this->addProgramList(programlist);

auto newUnit = new Vst::Unit(midiUnitInfo);

addUnit(newUnit);

// the programlist ID is actually the parameter ID
// the programlist ID is actually the parameter ID
newUnit->setProgramListID(x);

//_IMidiMappingIDs[channel][Vst::ControllerNumbers::kCtrlProgramChange] = x++;
Expand Down
8 changes: 4 additions & 4 deletions src/wrapasvst3.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect,

//---IUnitInfo--------------------------------------------------------------------------

tresult PLUGIN_API getUnitByBus(Vst::MediaType /*type*/, Vst::BusDirection /*dir*/, int32 /*busIndex*/,
tresult PLUGIN_API getUnitByBus(Vst::MediaType /*type*/, Vst::BusDirection /*dir*/, int32 /*busIndex*/,
int32 /*channel*/, Vst::UnitID& /*unitId*/ /*out*/) SMTG_OVERRIDE;

#if 0
Expand All @@ -177,7 +177,7 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect,
selectedUnit = unitId;
return kResultTrue;
}
#endif
#endif

//---Interface--------------------------------------------------------------------------
OBJ_METHODS(ClapAsVst3, SingleComponentEffect)
Expand All @@ -196,7 +196,7 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect,
//{
// DEF_INTERFACE(IExampleSomething)
//}

DEF_INTERFACE(INoteExpressionController)
// tresult PLUGIN_API queryInterface(const TUID iid, void** obj) override;
END_DEFINE_INTERFACES(SingleComponentEffect)
Expand Down Expand Up @@ -344,5 +344,5 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect,
#else
clap_supported_note_expressions::AS_VST3_NOTE_EXPRESSION_PRESSURE;
#endif
std::vector<Vst::UnitID> _MIDIUnits;
std::vector<Vst::UnitID> _MIDIUnits;
};

0 comments on commit e9eb6a3

Please sign in to comment.