/* Copyright (c) 2021 Alex Diener This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Alex Diener alex@ludobloom.com */ #include "audiosynth/SynthPropertyController.h" #define stemobject_implementation SynthPropertyController stemobject_vtable_begin(); stemobject_vtable_entry(dispose); stemobject_vtable_entry(copy); stemobject_vtable_entry(isEqual); stemobject_vtable_entry(setInitialValue); stemobject_vtable_entry(remapRange); stemobject_vtable_entry(apply); stemobject_vtable_end(); bool SynthPropertyController_init(SynthPropertyController * self, SynthPropertyIdentifier propertyIdentifier) { call_super(init, self); self->propertyIdentifier = propertyIdentifier; self->mute = false; self->solo = false; return true; } void SynthPropertyController_dispose(SynthPropertyController * self) { call_super_virtual(dispose, self); } SynthPropertyController * SynthPropertyController_copy(SynthPropertyController * self) { stemobject_copy_implementation(initCopy) } void SynthPropertyController_initCopy(SynthPropertyController * self, SynthPropertyController * original) { call_super(init, self); self->propertyIdentifier = original->propertyIdentifier; self->mute = original->mute; self->solo = false; } bool SynthPropertyController_isEqual(SynthPropertyController * self, compat_type(SynthPropertyController *) compareUntyped) { SynthPropertyController * compare = compareUntyped; return StemObject_isExactClass(compare, self->vtable) && self->propertyIdentifier.rootType == compare->propertyIdentifier.rootType && self->propertyIdentifier.propertyIndex == compare->propertyIdentifier.propertyIndex; } void SynthPropertyController_setInitialValue(SynthPropertyController * self, float value) { } void SynthPropertyController_remapRange(SynthPropertyController * self, float fromMin, float fromMax, float toMin, float toMax) { } void SynthPropertyController_apply(SynthPropertyController * self, SamplerObject * samplerObject, SamplerObject_state * state, float time, float timeDelta) { float sample = call_virtual(sample, self, NULL, time, timeDelta, time, timeDelta); call_virtual(setPropertyValue, samplerObject, state, self->propertyIdentifier, sample); }