static void updateDevice(struct nodeInstanceData *context, VuoMidiOutputDevice newDevice) { VuoMidiOutputDevice_release(context->device); context->device = newDevice; VuoMidiOutputDevice_retain(context->device); VuoRelease(context->midiManager); context->midiManager = VuoMidiOut_make(newDevice); VuoRetain(context->midiManager); }
struct nodeInstanceData *nodeInstanceInit( VuoInputData(VuoRealRegulation) footSwitch, VuoInputData(VuoRealRegulation) footController ) { struct nodeInstanceData *context = (struct nodeInstanceData *)calloc(1,sizeof(struct nodeInstanceData)); VuoRegister(context, free); context->inputDevice = VuoMidiInputDevice_make(-1, VuoText_make("BCF2000")); VuoMidiInputDevice_retain(context->inputDevice); context->inputManager = VuoMidiIn_make(context->inputDevice); VuoRetain(context->inputManager); context->outputDevice = VuoMidiOutputDevice_make(-1, VuoText_make("BCF2000")); VuoMidiOutputDevice_retain(context->outputDevice); context->outputManager = VuoMidiOut_make(context->outputDevice); VuoRetain(context->outputManager); VuoRealRegulation controllers[2] = {footSwitch, footController}; for (int i = 0; i < 2; ++i) { context->controllerSmooth[i] = VuoSmoothInertia_make(controllers[i].defaultValue); VuoRetain(context->controllerSmooth[i]); // Output the initial position during the first time event. context->controllerSmooth[i]->updateNeededAfterSetPosition = true; context->controller[i] = controllers[i]; VuoRealRegulation_retain(context->controller[i]); resetController(context->outputManager, 93+i, controllers[i]); }