//------------------------------------------------------------------------ tresult PLUGIN_API AGainSimple::setBusArrangements (SpeakerArrangement* inputs, int32 numIns, SpeakerArrangement* outputs, int32 numOuts) { if (numIns == 1 && numOuts == 1) { if (inputs[0] == SpeakerArr::kMono && outputs[0] == SpeakerArr::kMono) { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { if (bus->getArrangement () != SpeakerArr::kMono) { removeAudioBusses (); addAudioInput (USTRING ("Mono In"), SpeakerArr::kMono); addAudioOutput (USTRING ("Mono Out"), SpeakerArr::kMono); } return kResultOk; } } else { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { if (bus->getArrangement () != SpeakerArr::kStereo) { removeAudioBusses (); addAudioInput (USTRING ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING ("Stereo Out"), SpeakerArr::kStereo); } return kResultOk; } } } return kResultFalse; }
tresult PLUGIN_API IPlugVST3Plugin::setBusArrangements(SpeakerArrangement* inputs, int32 numIns, SpeakerArrangement* outputs, int32 numOuts) { TRACE; // disconnect all io pins, they will be reconnected in process SetInputChannelConnections(0, NInChannels(), false); SetOutputChannelConnections(0, NOutChannels(), false); int32 reqNumInputChannels = SpeakerArr::getChannelCount(inputs[0]); //requested # input channels int32 reqNumOutputChannels = SpeakerArr::getChannelCount(outputs[0]);//requested # output channels // legal io doesn't consider sidechain inputs if (!LegalIO(reqNumInputChannels, reqNumOutputChannels)) { return kResultFalse; } // handle input AudioBus* bus = FCast<AudioBus>(audioInputs.at(0)); // if existing input bus has a different number of channels to the input bus being connected if (bus && SpeakerArr::getChannelCount(bus->getArrangement()) != reqNumInputChannels) { audioInputs.remove(bus); addAudioInput(USTRING("Input"), getSpeakerArrForChans(reqNumInputChannels)); } // handle output bus = FCast<AudioBus>(audioOutputs.at(0)); // if existing output bus has a different number of channels to the output bus being connected if (bus && SpeakerArr::getChannelCount(bus->getArrangement()) != reqNumOutputChannels) { audioOutputs.remove(bus); addAudioOutput(USTRING("Output"), getSpeakerArrForChans(reqNumOutputChannels)); } if (!mScChans && numIns == 1) // No sidechain, every thing OK { return kResultTrue; } if (mScChans && numIns == 2) // numIns = num Input BUSes { int32 reqNumSideChainChannels = SpeakerArr::getChannelCount(inputs[1]); //requested # sidechain input channels bus = FCast<AudioBus>(audioInputs.at(1)); if (bus && SpeakerArr::getChannelCount(bus->getArrangement()) != reqNumSideChainChannels) { audioInputs.remove(bus); addAudioInput(USTRING("Sidechain Input"), getSpeakerArrForChans(reqNumSideChainChannels), kAux, 0); // either mono or stereo } return kResultTrue; } return kResultFalse; }
//------------------------------------------------------------------------ tresult PLUGIN_API AGain::setBusArrangements (SpeakerArrangement* inputs, int32 numIns, SpeakerArrangement* outputs, int32 numOuts) { if (numIns == 1 && numOuts == 1) { // the host wants Mono => Mono (or 1 channel -> 1 channel) if (SpeakerArr::getChannelCount (inputs[0]) == 1 && SpeakerArr::getChannelCount (outputs[0]) == 1) { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { // check if we are Mono => Mono, if not we need to recreate the buses if (bus->getArrangement () != inputs[0]) { removeAudioBusses (); addAudioInput (STR16 ("Mono In"), inputs[0]); addAudioOutput (STR16 ("Mono Out"), inputs[0]); } return kResultOk; } } // the host wants something else than Mono => Mono, in this case we are always Stereo => Stereo else { AudioBus* bus = FCast<AudioBus> (audioInputs.at (0)); if (bus) { tresult result = kResultFalse; // the host wants 2->2 (could be LsRs -> LsRs) if (SpeakerArr::getChannelCount (inputs[0]) == 2 && SpeakerArr::getChannelCount (outputs[0]) == 2) { removeAudioBusses (); addAudioInput (STR16 ("Stereo In"), inputs[0]); addAudioOutput (STR16 ("Stereo Out"), outputs[0]); result = kResultTrue; } // the host want something different than 1->1 or 2->2 : in this case we want stereo else if (bus->getArrangement () != SpeakerArr::kStereo) { removeAudioBusses (); addAudioInput (STR16 ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo); result = kResultFalse; } return result; } } } return kResultFalse; }
//------------------------------------------------------------------------ tresult PLUGIN_API AGain::initialize (FUnknown* context) { //---always initialize the parent------- tresult result = AudioEffect::initialize (context); wp = 0; rp = 0; if(!server) { server = lo_server_thread_new("10001", lo_err_handler); //lo_method tmp = lo_server_thread_add_method(server,"/dummy",NULL,lo_method_handler,this); int res = lo_server_thread_start(server); } // if everything Ok, continue if (result != kResultOk) { return result; } //---create Audio In/Out busses------ // we want a stereo Input and a Stereo Output addAudioInput (STR16 ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo); //---create Event In/Out busses (1 bus with only 1 channel)------ addEventInput (STR16 ("Event In"), 1); return kResultOk; }
//----------------------------------------------------------------------------- tresult PLUGIN_API MultiBandProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); params[0] = 1.00; //Listen: L/M/H/out params[1] = 0.103; //xover1 params[2] = 0.878; //xover2 params[3] = 0.54; //L drive (1) params[4] = 0.00; //M drive params[5] = 0.60; //H drive params[6] = 0.45; //L trim (2) params[7] = 0.50; //M trim params[8] = 0.50; //H trim params[9] = 0.22; //attack (3) params[10] = 0.602; //release (4) params[11] = 0.55; //width params[12] = 0.; //MS swap fb1 = fb2 = fb3 = 0.f; gain1 = gain2 = gain3 = 0.f; recalculate (); } return res; }
//----------------------------------------------------------------------------- tresult PLUGIN_API AmbienceProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); //inits here! params[0] = 0.7; //size params[1] = 0.7; //hf params[2] = 0.9; //mix params[3] = 0.5; //output buf1 = new float[1024]; buf2 = new float[1024]; buf3 = new float[1024]; buf4 = new float[1024]; fil = 0.0f; den = pos = 0; recalculate (); } return res; }
tresult PLUGIN_API Processor::initialize(FUnknown* context) { tresult result = AudioEffect::initialize(context); if (result == kResultTrue) { addAudioInput(STR16("AudioInput"), SpeakerArr::kStereo); addAudioOutput(STR16("AudioOutput"), SpeakerArr::kStereo); } return result; }
//----------------------------------------------------------------------------- tresult PLUGIN_API OverdriveProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); params[0] = 0.0f; params[1] = 0.0f; params[2] = 0.5f; recalculate (); } return res; }
//------------------------------------------------------------------------ tresult PLUGIN_API AGainSimple::initialize (FUnknown* context) { tresult result = SingleComponentEffect::initialize (context); if (result != kResultOk) return result; //---create Audio In/Out buses------ // we want a stereo Input and a Stereo Output addAudioInput (USTRING ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING ("Stereo Out"), SpeakerArr::kStereo); //---create MIDI In/Out buses (1 bus with only 1 channel)------ addEventInput (USTRING ("MIDI In"), 1); //---Create Parameters------------ //---Gain parameter-- GainParameter* gainParam = new GainParameter (ParameterInfo::kCanAutomate, kGainId); parameters.addParameter (gainParam); //---VuMeter parameter--- int32 stepCount = 0; ParamValue defaultVal = 0; int32 flags = ParameterInfo::kIsReadOnly; int32 tag = kVuPPMId; parameters.addParameter (USTRING ("VuPPM"), 0, stepCount, defaultVal, flags, tag); //---Bypass parameter--- stepCount = 1; defaultVal = 0; flags = ParameterInfo::kCanAutomate|ParameterInfo::kIsBypass; tag = kBypassId; parameters.addParameter (USTRING ("Bypass"), 0, stepCount, defaultVal, flags, tag); //---Custom state init------------ UString str (defaultMessageText, 128); str.fromAscii ("Hello World!"); return result; }
//------------------------------------------------------------------------ tresult PLUGIN_API AGain::initialize (FUnknown* context) { //---always initialize the parent------- tresult result = AudioEffect::initialize (context); // if everything Ok, continue if (result != kResultOk) { return result; } //---create Audio In/Out buses------ // we want a stereo Input and a Stereo Output addAudioInput (STR16 ("Stereo In"), SpeakerArr::kStereo); addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo); //---create Event In/Out buses (1 bus with only 1 channel)------ addEventInput (STR16 ("Event In"), 1); return kResultOk; }
//----------------------------------------------------------------------------- tresult PLUGIN_API RingModProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); params[0] = (float)0.0625; //1kHz params[1] = (float)0.0; params[2] = (float)0.0; fPhi = 0.0; twoPi = (float)6.2831853; fprev = 0.f; recalculate (); } return res; }
//----------------------------------------------------------------------------- tresult PLUGIN_API TestToneProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); params[0] = 0.47f; //mode params[1] = 0.71f; //level dB params[2] = 0.50f; //pan dB params[3] = 0.57f; //freq1 B params[4] = 0.50f; //freq2 Hz params[5] = 0.00f; //thru dB params[6] = 0.30f; //sweep ms params[7] = 1.00f; //cal dBFS recalculate (); } return res; }
//----------------------------------------------------------------------------- tresult PLUGIN_API DynamicsProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); params[0] = 0.60; //thresh ///Note : special version for ardislarge params[1] = 0.40; //ratio params[2] = 0.10; //level ///was 0.6 params[3] = 0.18; //attack params[4] = 0.55; //release params[5] = 1.00; //Limiter params[6] = 0.00; //gate thresh params[7] = 0.10; //gate attack params[8] = 0.50; //gate decay params[9] = 1.00; //fx mix recalculate (); } return res; }
//----------------------------------------------------------------------------- tresult PLUGIN_API RezFilterProcessor::initialize (FUnknown* context) { tresult res = BaseProcessor::initialize (context); if (res == kResultTrue) { addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo Out"), SpeakerArr::kStereo); params[0] = 0.33f; //f params[1] = 0.70f; //q params[2] = 0.50f; //a params[3] = 0.85f; //fenv params[4] = 0.00f; //att params[5] = 0.50f; //rel params[6] = 0.70f; //lfo params[7] = 0.40f; //rate params[8] = 0.00f; //trigger params[9] = 0.75f; //max freq recalculate (); } return res; }
tresult PLUGIN_API TripleFProcessor::initialize(FUnknown *context) { tresult initbase = AudioEffect::initialize(context); if(initbase == kResultTrue) { if(removeAllBusses() != kResultTrue) return kResultFalse; addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo); addAudioOutput (USTRING("Stereo out"), SpeakerArr::kStereo); try { m_env = new OpenCLEnvironment(CL_DEVICE_TYPE_GPU); m_compiler = new Compiler(*m_env, path("%FFF%/cl").getPath()); m_compiler->build(); WaveReader<Sample> hReader("h.wav"); UInt channelCount = hReader.getChannelCount(); UInt sampleCount = hReader.getSampleCount(); m_ssize = sampleCount - 1; ComputingData<Sample> cd(sampleCount); DeviceProperties devprops(m_env->getDevice()); Mapper map(cd, devprops, 0); m_x = new mcf::hmcp; m_y = new mcf::hmcp; mcf::multichannel b, a; mcf::create(b, *m_env, CL_MEM_READ_ONLY, channelCount, fff_POW2(map.getLb2N())); mcf::create(a, *m_env, CL_MEM_READ_ONLY, channelCount, fff_POW2(map.getLb2N())); for(UInt ch = 0; ch < channelCount; ++ch) a.host->getRawReal(ch)[0] = (Sample)20.f; mcf::create(m_H, *m_env, CL_MEM_READ_WRITE, channelCount, fff_POW2(map.getLb2N())); hReader.readFile(*(b.host)); TransferFunction<Sample> tra(*m_compiler, *b, *a, *m_H); tra.invokeAndWait(); } catch(...) { initbase = kResultFalse; } } return initbase; }
tresult PLUGIN_API IPlugVST3Plugin::initialize (FUnknown* context) { TRACE; tresult result = SingleComponentEffect::initialize(context); String128 tmpStringBuf; char hostNameCString[128]; FUnknownPtr<IHostApplication>app(context); if (app) { app->getName(tmpStringBuf); Steinberg::UString(tmpStringBuf, 128).toAscii(hostNameCString, 128); SetHost(hostNameCString, 0); // Can't get version in VST3 } if (result == kResultOk) { int maxInputs = getSpeakerArrForChans(NInChannels()-mScChans); if(maxInputs < 0) maxInputs = 0; // add io buses with the maximum i/o to start with if (maxInputs) { Steinberg::UString(tmpStringBuf, 128).fromAscii(GetInputBusLabel(0)->Get(), 128); addAudioInput(tmpStringBuf, maxInputs); } if(!mIsInst) // if effect, just add one output bus with max chan count { Steinberg::UString(tmpStringBuf, 128).fromAscii(GetOutputBusLabel(0)->Get(), 128); addAudioOutput(tmpStringBuf, getSpeakerArrForChans(NOutChannels()) ); } else { for (int i = 0, busIdx = 0; i < NOutChannels(); i+=2, busIdx++) { Steinberg::UString(tmpStringBuf, 128).fromAscii(GetOutputBusLabel(busIdx)->Get(), 128); addAudioOutput(tmpStringBuf, SpeakerArr::kStereo ); } } if (mScChans) { if (mScChans > 2) mScChans = 2; Steinberg::UString(tmpStringBuf, 128).fromAscii(GetInputBusLabel(1)->Get(), 128); addAudioInput(tmpStringBuf, getSpeakerArrForChans(mScChans), kAux, 0); } if(DoesMIDI()) { addEventInput (STR16("MIDI Input"), 1); //addEventOutput(STR16("MIDI Output"), 1); } if (NPresets()) { parameters.addParameter(new Parameter(STR16("Preset"), kPresetParam, STR16(""), 0, NPresets(), ParameterInfo::kIsProgramChange)); } if(!mIsInst) { StringListParameter * bypass = new StringListParameter(STR16("Bypass"), kBypassParam, 0, ParameterInfo::kCanAutomate | ParameterInfo::kIsBypass | ParameterInfo::kIsList); bypass->appendString(STR16("off")); bypass->appendString(STR16("on")); parameters.addParameter(bypass); } for (int i=0; i<NParams(); i++) { IParam *p = GetParam(i); int32 flags = 0; UnitID unitID = kRootUnitId; const char* paramGroupName = p->GetParamGroupForHost(); if (CSTR_NOT_EMPTY(paramGroupName)) { for(int j = 0; j < mParamGroups.GetSize(); j++) { if(strcmp(paramGroupName, mParamGroups.Get(j)) == 0) { unitID = j+1; } } if (unitID == kRootUnitId) // new unit, nothing found, so add it { mParamGroups.Add(paramGroupName); unitID = mParamGroups.GetSize(); } } if (p->GetCanAutomate()) { flags |= ParameterInfo::kCanAutomate; } switch (p->Type()) { case IParam::kTypeDouble: case IParam::kTypeInt: { Parameter* param = new RangeParameter( STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), p->GetMin(), p->GetMax(), p->GetDefault(), 0, // continuous flags, unitID); param->setPrecision (p->GetPrecision()); parameters.addParameter(param); break; } case IParam::kTypeEnum: case IParam::kTypeBool: { StringListParameter* param = new StringListParameter (STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), flags | ParameterInfo::kIsList, unitID); int nDisplayTexts = p->GetNDisplayTexts(); assert(nDisplayTexts); for (int j=0; j<nDisplayTexts; j++) { param->appendString(STR16(p->GetDisplayText(j))); } parameters.addParameter(param); break; } default: break; } } } OnHostIdentified(); RestorePreset(0); return result; }
tresult PLUGIN_API IPlugVST3::setBusArrangements(SpeakerArrangement* inputs, int32 numIns, SpeakerArrangement* outputs, int32 numOuts) { TRACE; //inputs AudioBus* bus = getAudioInput(0); if (bus && bus->getArrangement() != inputs[0]) { if (inputs[0] == SpeakerArr::kMono) { //re-create the busses.. audioInputs.remove(bus); if (mScChans) { bus = getAudioInput(0); if (bus && bus->getArrangement() != inputs[1]) //sidechain SpeakerArr:: must match the input SpeakerArr:: { audioInputs.remove(bus); } } addAudioInput(USTRING ("Mono In"), SpeakerArr::kMono); addAudioInput(USTRING ("Mono Sidechain In"), SpeakerArr::kMono, kAux, 0); //disconnect the unused pins, don't worry about sidechain yet - it will get done at process() SetInputChannelConnections(1, NInChannels(), false); mSideChainIsConnected = false; } } //outputs bus = getAudioOutput(0); if (bus && bus->getArrangement() != outputs[0]) { if (outputs[0] == SpeakerArr::kMono) { audioOutputs.remove(bus); addAudioOutput(USTRING ("Mono Out"), SpeakerArr::kMono); //disconnect the unused pin SetOutputChannelConnections(1, NOutChannels(), false); } } if (mScChans) { if (getAudioInput(0)->getArrangement() == inputs[0] && getAudioOutput(0)->getArrangement() == outputs[0] && getAudioInput(1)->getArrangement() == inputs[1]) return kResultOk; } else { if (getAudioInput(0)->getArrangement() == inputs[0] && getAudioOutput(0)->getArrangement() == outputs[0]) return kResultOk; } return kResultFalse; }
tresult PLUGIN_API IPlugVST3::initialize (FUnknown* context) { TRACE; tresult result = SingleComponentEffect::initialize (context); if (result == kResultOk) { addAudioInput (STR16("Audio Input"), getSpeakerArrForChans(NInChannels()) ); addAudioOutput (STR16("Audio Output"), getSpeakerArrForChans(NOutChannels()) ); if (mScChans == 1) addAudioInput(STR16("Sidechain Input"), SpeakerArr::kMono, kAux, 0); else if (mScChans >= 2) { mScChans = 2; addAudioInput(STR16("Sidechain Input"), SpeakerArr::kStereo, kAux, 0); } if(mDoesMidi) { addEventInput (STR16("MIDI In"), 1); addEventOutput(STR16("MIDI Out"), 1); } for (int i=0;i<NParams();i++) { IParam *p = GetParam(i); int32 flags = 0; if (p->GetCanAutomate()) { flags |= ParameterInfo::kCanAutomate; } switch (p->Type()) { case IParam::kTypeDouble: case IParam::kTypeInt: { Parameter* param = new RangeParameter ( STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), p->GetMin(), p->GetMax(), p->GetDefault(), p->GetStep(), flags); param->setPrecision (p->GetPrecision()); parameters.addParameter (param); break; } case IParam::kTypeEnum: case IParam::kTypeBool: { StringListParameter* param = new StringListParameter (STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), flags | ParameterInfo::kIsList); int nDisplayTexts = p->GetNDisplayTexts(); assert(nDisplayTexts); for (int j=0; j<nDisplayTexts; j++) { param->appendString(STR16(p->GetDisplayText(j))); } parameters.addParameter (param); break; } default: break; } } } return result; }