Ejemplo n.º 1
0
#include "node.h"
#include "VuoLayer.h"

VuoModuleMetadata({
					 "title" : "Copy Layer",
					 "keywords" : [ "duplicate", "array", "instance", "instantiate", "populate" ],
					 "version" : "1.0.0",
					 "node": {
						 "isInterface" : false
					 }
				 });

void nodeEvent
(
	VuoInputData(VuoLayer) layer,
	VuoInputData(VuoList_VuoTransform2d) transforms,
	VuoOutputData(VuoList_VuoLayer) copies
)
{
	*copies = VuoListCreate_VuoLayer();
	unsigned long transform_length = VuoListGetCount_VuoTransform2d(transforms);

	for(int i = 0; i < transform_length; i++)
	{
		VuoLayer o;
		o.sceneObject = layer.sceneObject;
		o.sceneObject.transform = VuoTransform_makeFrom2d(VuoListGetValueAtIndex_VuoTransform2d(transforms, i+1));

		VuoListAppendValue_VuoLayer(*copies, o);
	}
	int index;
	float value;
} sortable_pointValue;


static int compare (const void * a, const void * b)
{
	sortable_pointValue *x = (sortable_pointValue*)a;
	sortable_pointValue *y = (sortable_pointValue*)b;

	return (x->value - y->value);
}

void nodeEvent
(
		VuoInputData(VuoList_VuoLeapPointable) pointables,
		VuoInputData(VuoPoint3d, {"default":{"x":0, "y":0, "z":0}}) target,
		VuoOutputData(VuoList_VuoLeapPointable) sortedPointables
)
{
	*sortedPointables = VuoListCreate_VuoLeapPointable();

	int count = VuoListGetCount_VuoLeapPointable(pointables);

	sortable_pointValue pointValues[count];

	for(int i = 0; i < count; i++)
		pointValues[i] = (sortable_pointValue){i, fabs(VuoListGetValue_VuoLeapPointable(pointables, i+1).tipPosition.z - target.z)};

	qsort (pointValues, count, sizeof(sortable_pointValue), compare);
/**
 * @file
 * vuo.type.list.real.point3d.y node implementation.
 *
 * @copyright Copyright © 2012–2015 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					  "title": "Convert Real List to 3D Point List",
					  "description": "Creates a list of 3D points using the input real numbers as the Y coordinate, and 0 as the X and Z coordinates.",
					  "version": "1.0.0"
				 });

void nodeEvent
(
	VuoInputData(VuoList_VuoReal) y,
	VuoOutputData(VuoList_VuoPoint3d) point3d
)
{
	*point3d = VuoListCreate_VuoPoint3d();
	unsigned long count = VuoListGetCount_VuoReal(y);
	for (unsigned long i = 1; i <= count; ++i)
		VuoListAppendValue_VuoPoint3d(*point3d, VuoPoint3d_make(0, VuoListGetValue_VuoReal(y, i), 0));
}
Ejemplo n.º 4
0
 * For more information, see http://vuo.org/license.
 */

#include "node.h"
#include "VuoGlContext.h"
#include <OpenGL/CGLMacro.h>
#include <stdio.h>

VuoModuleMetadata({
					 "title" : "Text Contains",
					 "keywords" : [ "has", "search", "str", "string" ],
					 "version" : "1.0.0",
					 "description": "Returns true if `text` contains `value`, false otherwise.",
					 "node" : {
						  "exampleCompositions" : [ "" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoText) text,
		VuoInputData(VuoText) value,
		VuoOutputData(VuoBoolean) contains
)
{
	if(text == NULL || value == NULL)
		*contains = false;
	else
		*contains = strstr(text, value) != NULL;
}
/**
 * @file
 * vuo.type.list.point3d.real.x node implementation.
 *
 * @copyright Copyright © 2012–2015 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					  "title": "Convert 3D Point List to Real List",
					  "description": "Creates a list of real numbers using the X coordinate of the input list of 3D points.",
					  "version": "1.0.0"
				 });

void nodeEvent
(
	VuoInputData(VuoList_VuoPoint3d) point3d,
	VuoOutputData(VuoList_VuoReal) x
)
{
	*x = VuoListCreate_VuoReal();
	unsigned long count = VuoListGetCount_VuoPoint3d(point3d);
	for (unsigned long i = 1; i <= count; ++i)
		VuoListAppendValue_VuoReal(*x, VuoListGetValue_VuoPoint3d(point3d, i).x);
}
Ejemplo n.º 6
0
#include "node.h"
#include "VuoPoint3d.h"

VuoModuleMetadata({
					 "title" : "Get 3D Object Bounds",
					 "keywords" : [ "box", "aabb", "axis", "collider", "collision", "volume" ],
					 "version" : "1.0.0",
					 "node": {
						 "isInterface" : false,
						 "exampleCompositions" : [ "DisplaySceneWithFloor.vuo" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoSceneObject) object,
		VuoOutputData(VuoPoint3d) center,
		VuoOutputData(VuoReal) width,
		VuoOutputData(VuoReal) height,
		VuoOutputData(VuoReal) depth
)
{
	VuoBox bounds = VuoSceneObject_bounds(object);

	*center = bounds.center;
	*width = bounds.size.x;
	*height = bounds.size.y;
	*depth = bounds.size.z;
}
Ejemplo n.º 7
0
/**
 * @file
 * vuo.layer.make.realSize node implementation.
 *
 * @copyright Copyright © 2012–2014 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"
#include "VuoLayer.h"

VuoModuleMetadata({
					 "title" : "Make Layer",
					 "keywords" : [ "billboard", "sprite", "image", "pixel aligned", "exact", "actual" ],
					 "version" : "1.0.0",
				 });

void nodeEvent
(
		VuoInputData(VuoText) name,
		VuoInputData(VuoImage) image,
		VuoInputData(VuoPoint2d, {"default":{"x":0.0,"y":0.0}, "suggestedStep":{"x":0.1,"y":0.1}}) center,
		VuoInputData(VuoReal, {"default":1.0, "suggestedMin":0.0, "suggestedMax":1.0, "suggestedStep":0.1}) alpha,
		VuoOutputData(VuoLayer) layer
)
{
	*layer = VuoLayer_makeRealSize(name, image, center, alpha);
}
Ejemplo n.º 8
0
	VuoText serverName;
};

static void updateServer(struct nodeInstanceData *context, VuoText newServerName)
{
	VuoRelease(context->serverName);
	context->serverName = newServerName;
	VuoRetain(context->serverName);

	VuoSyphonServer_setName(context->syphonServer, newServerName);
}


struct nodeInstanceData * nodeInstanceInit
(
		VuoInputData(VuoText, "") serverName
)
{
	struct nodeInstanceData *context = (struct nodeInstanceData *)calloc(1,sizeof(struct nodeInstanceData));
	VuoRegister(context, free);

	context->glContext = VuoGlContext_use();

	context->syphonServer = VuoSyphonServer_make(serverName, context->glContext);
	VuoRetain(context->syphonServer);

	return context;
}

void nodeInstanceEvent
(
Ejemplo n.º 9
0
 * For more information, see http://vuo.org/license.
 */

#include "node.h"
#include "VuoSceneObject.h"

VuoModuleMetadata({
					  "title" : "Change All Shaders",
					  "keywords" : [ "swap", "replace", "texture", "material" ],
					  "version" : "2.0.0",
					  "node": {
						  "exampleCompositions" : [ "PaintSceneWithCheckerboard.vuo", "CompareCameras.vuo" ]
					  }
				  });

void nodeEvent
(
	VuoInputData(VuoSceneObject) object,
	VuoInputData(VuoShader) shader,
	VuoOutputData(VuoSceneObject) shadedObject
)
{
	VuoSceneObject copy = VuoSceneObject_copy(object);

	VuoSceneObject_apply(&copy, ^(VuoSceneObject *currentObject, float modelviewMatrix[16]){
							currentObject->shader = shader;
						 });

	*shadedObject = copy;
}
Ejemplo n.º 10
0
{
	struct nodeInstanceData *context = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData));

	context->glContext = VuoGlContext_use();

	context->sceneRenderer = VuoSceneRenderer_make(context->glContext);
	VuoRetain(context->sceneRenderer);

	VuoRegister(context, free);
	return context;
}

void nodeInstanceEvent
(
		VuoInstanceData(struct nodeInstanceData *) context,
		VuoInputData(VuoList_VuoLayer) layers,
		VuoInputData(VuoInteger, {"default":1024, "suggestedMin":1, "suggestedMax":4096, "suggestedStep":256}) width,
		VuoInputData(VuoInteger, {"default":768, "suggestedMin":1, "suggestedMax":4096, "suggestedStep":256}) height,
		VuoOutputData(VuoImage) image,
		VuoOutputData(VuoRenderedLayers) renderedLayers
)
{
	VuoSceneObject rootSceneObject = VuoLayer_makeGroup(layers, VuoTransform2d_makeIdentity()).sceneObject;

	VuoSceneRenderer_setRootSceneObject((*context)->sceneRenderer, rootSceneObject);
	VuoSceneRenderer_regenerateProjectionMatrix((*context)->sceneRenderer, width, height);
	VuoSceneRenderer_renderToImage((*context)->sceneRenderer, image, NULL);

	*renderedLayers = VuoRenderedLayers_make(rootSceneObject, width, height);
}
Ejemplo n.º 11
0
 * @file
 * vuo.logic.areAnyTrue node implementation.
 *
 * @copyright Copyright © 2012–2015 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					 "title" : "Are Any True",
					 "keywords" : [ "boolean", "condition", "test", "check", "gate", "or", "||", "0", "1", "false" ],
					 "version" : "2.0.0",
					 "node": {
						  "exampleCompositions" : [ ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoList_VuoBoolean) values,
		VuoOutputData(VuoBoolean) anyTrue
)
{
	*anyTrue = false;
	unsigned long termsCount = VuoListGetCount_VuoBoolean(values);
	for (unsigned long i = 1; i <= termsCount; ++i)
		*anyTrue = *anyTrue || VuoListGetValue_VuoBoolean(values, i);
}
Ejemplo n.º 12
0
static void receivedController(void *ctx, VuoMidiController controller)
{
	struct nodeInstanceData *context = (struct nodeInstanceData *)ctx;

	for (int i = 0; i < 8; ++i)
		if (controller.controllerNumber == 81+i)
			VuoSmoothInertia_setTarget(context->faderSmooth[i], context->mostRecentTime, (VuoReal)controller.value/127. * (context->fader[i].maximumValue - context->fader[i].minimumValue) + context->fader[i].minimumValue);
}

static void resetFader(VuoMidiOut outputManager, char controller, VuoRealRegulation fader)
{
	VuoMidiOut_sendController(outputManager, VuoMidiController_make(1, controller, (fader.defaultValue-fader.minimumValue)/(fader.maximumValue-fader.minimumValue) * 127.));
}

struct nodeInstanceData *nodeInstanceInit(
		VuoInputData(VuoRealRegulation) fader1,
		VuoInputData(VuoRealRegulation) fader2,
		VuoInputData(VuoRealRegulation) fader3,
		VuoInputData(VuoRealRegulation) fader4,
		VuoInputData(VuoRealRegulation) fader5,
		VuoInputData(VuoRealRegulation) fader6,
		VuoInputData(VuoRealRegulation) fader7,
		VuoInputData(VuoRealRegulation) fader8
)
{
	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);
Ejemplo n.º 13
0
#include "VuoLeapHand.h"
#include "VuoLeapPointable.h"
#include "VuoList_VuoLeapPointable.h"

VuoModuleMetadata({
					  "title" : "Get Hand Values",
					  "keywords" : [ "controller", "motion", "hand", "palm" ],
					  "version" : "2.0.0",
					  "node": {
						  "exampleCompositions" : [ "DisplayLeapHand.vuo", "ShowHandStatus.vuo", "HoldEgg.vuo", "HighlightExtendedFingers.vuo", "TwirlImageWithLeap.vuo" ]
					  }
				  });

void nodeEvent
(
		VuoInputData(VuoLeapHand) hand,
		VuoOutputData(VuoInteger, {"name":"ID"}) id,
		VuoOutputData(VuoTransform) transform,
		VuoOutputData(VuoPoint3d) palmVelocity,
		VuoOutputData(VuoPoint3d) wristPosition,
		VuoOutputData(VuoReal) sphereRadius,
		VuoOutputData(VuoPoint3d) sphereCenter,
		VuoOutputData(VuoReal) pinchAmount,
		VuoOutputData(VuoReal) grabAmount,
		VuoOutputData(VuoBoolean) isLeftHand,
		VuoOutputData(VuoReal) timeVisible,
		VuoOutputData(VuoReal) confidence,
		VuoOutputData(VuoList_VuoLeapPointable) fingers
)
{
	*id = hand.id;
Ejemplo n.º 14
0
					  "title" : "Changed",
					  "keywords" : [ "pulse", "watcher" ],
					  "version" : "1.0.1",
					  "genericTypes" : {
						  "VuoGenericType1" : {
							  "compatibleTypes" : [ "VuoBoolean", "VuoInteger", "VuoReal" ]
						  }
					  },
					  "node": {
						  "exampleCompositions" : [ ]
					  }
				  });

VuoGenericType1 * nodeInstanceInit
(
	VuoInputData(VuoGenericType1) value
)
{
	VuoGenericType1 *lastValue = (VuoGenericType1 *)malloc(sizeof(VuoGenericType1));
	VuoRegister(lastValue, free);
	*lastValue = value;
	return lastValue;
}

void nodeInstanceEvent
(
		VuoInstanceData(VuoGenericType1 *) lastValue,
		VuoInputData(VuoGenericType1, {"defaults":{"VuoBoolean":false, "VuoInteger":0, "VuoReal":0.0}}) value,
		VuoInputEvent({"eventBlocking":"door","data":"value"}) valueEvent,
		VuoOutputEvent() changed
)
Ejemplo n.º 15
0
	struct nodeInstanceData *context = (struct nodeInstanceData *)calloc(1,sizeof(struct nodeInstanceData));
	VuoRegister(context, free);
	context->isTriggerStopped = true;
	context->dragStartedListener = VuoMouse_make();
	VuoRetain(context->dragStartedListener);
	context->dragMovedToListener = VuoMouse_make();
	VuoRetain(context->dragMovedToListener);
	context->dragEndedListener = VuoMouse_make();
	VuoRetain(context->dragEndedListener);
	return context;
}

void nodeInstanceTriggerStart
(
		VuoInstanceData(struct nodeInstanceData *) context,
		VuoInputData(VuoWindowReference) window,
		VuoInputData(VuoMouseButton) button,
		VuoInputData(VuoModifierKey) modifierKey,
		VuoOutputTrigger(dragStarted, VuoPoint2d),
		VuoOutputTrigger(dragMovedTo, VuoPoint2d),
		VuoOutputTrigger(dragEnded, VuoPoint2d)
)
{
	(*context)->isTriggerStopped = false;
	VuoMouse_startListeningForPresses((*context)->dragStartedListener, dragStarted, button, window, modifierKey);
	VuoMouse_startListeningForDrags((*context)->dragMovedToListener, dragMovedTo, button, window, modifierKey);
	VuoMouse_startListeningForReleases((*context)->dragEndedListener, dragEnded, button, window, modifierKey);
}

void nodeInstanceTriggerUpdate
(
/**
 * @file
 * vuo.type.list.real.integer node implementation.
 *
 * @copyright Copyright © 2012–2015 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					  "title": "Convert Real List to Integer List",
					  "description": "Outputs a list containing integer approximations of the input list's real numbers.  Real numbers are rounded to the nearest integer.",
					  "version": "1.0.0"
				 });

void nodeEvent
(
	VuoInputData(VuoList_VuoReal) reals,
	VuoOutputData(VuoList_VuoInteger) integers
)
{
	*integers = VuoListCreate_VuoInteger();
	unsigned long count = VuoListGetCount_VuoReal(reals);
	for (unsigned long i = 1; i <= count; ++i)
		VuoListAppendValue_VuoInteger(*integers, lround(VuoListGetValue_VuoReal(reals, i)));
}
Ejemplo n.º 17
0
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					 "title" : "Select Latest (2)",
					 "keywords" : [ "coalesce", "join", "combine", "recent", "current",
						"switch", "multiplexer", "if", "else", "case", "route", "condition", "control flow" ],
					 "version" : "1.0.0",
					 "node": {
						  "exampleCompositions" : [ "ShowArrowPresses.vuo" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoGenericType1) option1,
		VuoInputEvent({"eventBlocking":"none","data":"option1"}) option1Event,
		VuoInputData(VuoGenericType1) option2,
		VuoInputEvent({"eventBlocking":"none","data":"option2"}) option2Event,
		VuoOutputData(VuoGenericType1) latest
)
{
	if (option2Event && ! option1Event)
		*latest = option2;
	else
		*latest = option1;
}
Ejemplo n.º 18
0
};

struct nodeInstanceData * nodeInstanceInit()
{
    struct nodeInstanceData *context = (struct nodeInstanceData *)calloc(1,sizeof(struct nodeInstanceData));
    context->isTriggerStopped = true;
    VuoRegister(context, free);
    context->movedListener = VuoMouse_make();
    VuoRetain(context->movedListener);
    return context;
}

void nodeInstanceTriggerStart
(
    VuoInstanceData(struct nodeInstanceData *) context,
    VuoInputData(VuoWindowReference) window,
    VuoInputData(VuoModifierKey) modifierKey,
    VuoOutputTrigger(movedTo, VuoPoint2d)
)
{
    (*context)->isTriggerStopped = false;
    VuoMouse_startListeningForMoves((*context)->movedListener, movedTo, window, modifierKey);
}

void nodeInstanceTriggerUpdate
(
    VuoInstanceData(struct nodeInstanceData *) context,
    VuoInputData(VuoWindowReference) window,
    VuoInputData(VuoModifierKey) modifierKey,
    VuoOutputTrigger(movedTo, VuoPoint2d)
)
Ejemplo n.º 19
0
static void receivedController(void *ctx, VuoMidiController controller)
{
	struct nodeInstanceData *context = (struct nodeInstanceData *)ctx;

	for (int i = 0; i < 2; ++i)
		if (controller.controllerNumber == 93+i)
			VuoSmoothInertia_setTarget(context->controllerSmooth[i], context->mostRecentTime, (VuoReal)controller.value/127. * (context->controller[i].maximumValue - context->controller[i].minimumValue) + context->controller[i].minimumValue);
}

static void resetController(VuoMidiOut outputManager, char cc, VuoRealRegulation controller)
{
	VuoMidiOut_sendController(outputManager, VuoMidiController_make(1, cc, (controller.defaultValue-controller.minimumValue)/(controller.maximumValue-controller.minimumValue) * 127.));
}

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);
Ejemplo n.º 20
0
					 "title" : "Receive OSC Messages",
					 "keywords" : [ "controller", "synthesizer", "sequencer", "music", "instrument", "device" ],
					 "version" : "1.0.0",
					 "dependencies" : [
						 "VuoOsc"
					 ],
					 "node": {
						 "isInterface" : true,
						 "exampleCompositions": [ "ReceiveOsc.vuo" ]
					 }
				 });


VuoOscIn nodeInstanceInit
(
		VuoInputData(VuoInteger) udpPort
)
{
	VuoOscIn oi = VuoOscIn_make(udpPort);
	VuoRetain(oi);
	return oi;
}

void nodeInstanceTriggerStart
(
		VuoInstanceData(VuoOscIn) context,
		VuoOutputTrigger(receivedMessage, VuoOscMessage)
)
{
	VuoOscIn_enableTriggers(*context, receivedMessage);
}
Ejemplo n.º 21
0
 * For more information, see http://vuo.org/license.
 */

#include "node.h"
#include "VuoLayer.h"

VuoModuleMetadata({
					 "title" : "Make Linear Gradient Layer",
					 "keywords" : [ "backdrop", "background", "billboard", "sprite", "image", "rectangle", "square" ],
					 "version" : "1.1.0",
					 "node": {
						  "exampleCompositions" : [ "CompareLayerGradients.vuo" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoText) name,
		VuoInputData(VuoList_VuoColor, {"default":[{"r":1,"g":1,"b":1,"a":1}, {"r":0,"g":0,"b":0,"a":1}]}) colors,
		VuoInputData(VuoPoint2d, {"default":{"x":-1, "y":1}, "suggestedStep":{"x":0.1,"y":0.1}}) gradientStart,
		VuoInputData(VuoPoint2d, {"default":{"x":1, "y":-1}, "suggestedStep":{"x":0.1,"y":0.1}}) gradientEnd,
		VuoInputData(VuoPoint2d, {"default":{"x":0.0,"y":0.0}, "suggestedStep":{"x":0.1,"y":0.1}}) layerCenter,
		VuoInputData(VuoReal, {"default":0.0, "suggestedMin":0.0, "suggestedMax":360.0, "suggestedStep":15.0}) layerRotation,
		VuoInputData(VuoReal, {"default":2.0, "suggestedMin":0.0, "suggestedStep":0.1}) layerWidth,
		VuoInputData(VuoReal, {"default":2.0, "suggestedMin":0.0, "suggestedStep":0.1}) layerHeight,
		VuoOutputData(VuoLayer) layer
)
{
	*layer = VuoLayer_makeLinearGradient(name, colors, gradientStart, gradientEnd, layerCenter, layerRotation, layerWidth, layerHeight);
}
Ejemplo n.º 22
0
						  "exampleCompositions" : [ "StoreMousePosition.vuo" ]
					 }
				 });

bool * nodeInstanceInit()
{
	bool *hasNewValueReceivedEvent = (bool *) malloc(sizeof(bool));
	VuoRegister(hasNewValueReceivedEvent, free);
	*hasNewValueReceivedEvent = false;
	return hasNewValueReceivedEvent;
}

void nodeInstanceEvent
(
		VuoInstanceData(bool *) hasNewValueReceivedEvent,
		VuoInputData(VuoList_VuoGenericType1) initialValue,
		VuoInputEvent({"eventBlocking":"wall","data":"initialValue"}) initialValueEvent,
		VuoInputData(VuoList_VuoGenericType1) newValue,
		VuoInputEvent({"eventBlocking":"wall","data":"newValue","hasPortAction":true}) newValueEvent,
		VuoOutputData(VuoList_VuoGenericType1) heldValue
)
{
	if (newValueEvent)
		**hasNewValueReceivedEvent = true;

	*heldValue = (**hasNewValueReceivedEvent ? newValue : initialValue);
}

void nodeInstanceFini(VuoInstanceData(bool *) hasNewValueReceivedEvent)
{
}
Ejemplo n.º 23
0
 * @copyright Copyright © 2012–2015 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					  "title" : "Make Point Mesh",
					  "keywords" : [ ],
					  "version" : "2.1.0",
					  "genericTypes" : {
						  "VuoGenericType1" : {
							  "compatibleTypes" : [ "VuoPoint2d", "VuoPoint3d" ]
						  }
					  },
					  "node": {
						  "exampleCompositions" : [ ]
					  }
				  });

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) positions,
		VuoInputData(VuoReal, {"default":0.01, "suggestedMin":0.0, "suggestedStep":0.001}) pointSize,
		VuoOutputData(VuoMesh) mesh
)
{
	*mesh = VuoMesh_make_VuoGenericType1(positions, VuoMesh_Points, pointSize);
}
Ejemplo n.º 24
0
					  "title" : "Find Minimum",
					  "keywords" : [ "less", "least", "small", "few", "low", "<", "bottom", "lower", "limit", "bound", "range" ],
					  "version" : "2.0.0",
					  "genericTypes" : {
						  "VuoGenericType1" : {
							  "defaultType" : "VuoReal",
							  "compatibleTypes" : [ "VuoInteger", "VuoReal" ]
						  }
					  },
					  "node": {
						  "exampleCompositions" : [ ]
					  }
				  });

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) values,
		VuoOutputData(VuoGenericType1) min
)
{
	unsigned long termsCount = VuoListGetCount_VuoGenericType1(values);

	VuoGenericType1 *termsArray = (VuoGenericType1 *)malloc(termsCount * sizeof(VuoGenericType1));
	for (unsigned long i = 0; i < termsCount; ++i)
		termsArray[i] = VuoListGetValue_VuoGenericType1(values, i+1);

	*min = VuoGenericType1_min(termsArray, termsCount);

	free(termsArray);
}
Ejemplo n.º 25
0
 */

#include "node.h"

VuoModuleMetadata({
					 "title" : "Append Lists",
					 "keywords" : [ "concatenate", "combine", "join", "together", "merge" ],
					 "version" : "1.0.0",
					 "node" : {
						  "exampleCompositions" : [ "SpliceSquares.vuo" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) list1,
		VuoInputData(VuoList_VuoGenericType1) list2,
		VuoOutputData(VuoList_VuoGenericType1) combinedList
)
{
	*combinedList = VuoListCreate_VuoGenericType1();

	unsigned long list1Count = VuoListGetCount_VuoGenericType1(list1);
	for (unsigned long i = 1; i <= list1Count; ++i)
		VuoListAppendValue_VuoGenericType1(*combinedList, VuoListGetValue_VuoGenericType1(list1, i));

	unsigned long list2Count = VuoListGetCount_VuoGenericType1(list2);
	for (unsigned long i = 1; i <= list2Count; ++i)
		VuoListAppendValue_VuoGenericType1(*combinedList, VuoListGetValue_VuoGenericType1(list2, i));
}
Ejemplo n.º 26
0
					  "title" : "Find Minimum",
					  "keywords" : [ "less", "least", "small", "few", "low", "<", "bottom", "lower", "limit", "bound", "range" ],
					  "version" : "1.0.0",
					  "genericTypes" : {
						  "VuoGenericType1" : {
							  "defaultType" : "VuoReal",
							  "compatibleTypes" : [ "VuoInteger", "VuoReal" ]
						  }
					  },
					  "node": {
						  "isInterface" : false
					  }
				  });

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) terms,
		VuoOutputData(VuoGenericType1) min
)
{
	unsigned long termsCount = VuoListGetCount_VuoGenericType1(terms);

	VuoGenericType1 *termsArray = (VuoGenericType1 *)malloc(termsCount * sizeof(VuoGenericType1));
	for (unsigned long i = 0; i < termsCount; ++i)
		termsArray[i] = VuoListGetValueAtIndex_VuoGenericType1(terms, i+1);

	*min = VuoGenericType1_min(termsArray, termsCount);

	free(termsArray);
}
						 "exampleCompositions" : [ "ReceiveMidiNotes.vuo" ]
					 },
					 "dependencies" : [
						 "VuoList_VuoMidiNote",
						 "VuoList_VuoNotePriority"
					 ]
				 });

VuoList_VuoMidiNote nodeInstanceInit()
{
	return VuoListCreate_VuoMidiNote();
}

void nodeInstanceEvent
(
		VuoInputData(VuoMidiNote) note,
		VuoInputEvent({"eventBlocking":"door","data":"note"}) noteEvent,

		VuoInputData(VuoInteger, {"default":1, "suggestedMin":1, "suggestedMax":16}) channel,
		VuoInputEvent({"eventBlocking":"wall", "data":"channel"}) channelEvent,

		VuoInputData(VuoInteger, {"default":0, "suggestedMin":0, "suggestedMax":127}) noteNumberMin,
		VuoInputEvent({"eventBlocking":"wall", "data":"noteNumberMin"}) noteNumberMinEvent,
		VuoInputData(VuoInteger, {"default":127, "suggestedMin":0, "suggestedMax":127}) noteNumberMax,
		VuoInputEvent({"eventBlocking":"wall", "data":"noteNumberMax"}) noteNumberMaxEvent,

		VuoInputData(VuoNotePriority, {"default":"last"}) notePriority,
		VuoInputEvent({"eventBlocking":"wall", "data":"notePriority"}) notePriorityEvent,

		VuoInputEvent() reset,
 */

#include "node.h"
#include <OpenGL/CGLMacro.h>

VuoModuleMetadata({
					 "title" : "Shade with Image",
					 "keywords" : [ "texture", "paint", "draw", "opengl", "glsl", "scenegraph", "graphics",
						 "lighting", "lit", "lighted",
						 "Blinn", "Phong", "Lambert" ],
					 "version" : "3.0.0",
					 "dependencies" : [
						 "VuoGlContext"
					 ],
					 "node" : {
						  "exampleCompositions" : [ ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoImage) image,
		VuoInputData(VuoReal, {"default":1.0,"suggestedMin":0,"suggestedMax":1}) opacity,
		VuoInputData(VuoColor,{"default":{"r":1.,"g":1.,"b":1.,"a":1.}}) highlightColor,
		VuoInputData(VuoReal,{"default":0.9, "suggestedMin":0.0, "suggestedMax":1.0, "suggestedStep":0.1}) shininess,
		VuoOutputData(VuoShader) shader
)
{
	*shader = VuoShader_makeLitImageShader(image, opacity, highlightColor, shininess);
}
Ejemplo n.º 29
0
static void updateDevice(struct nodeInstanceData *context, VuoAudioOutputDevice newDevice)
{
    VuoAudioOutputDevice_release(context->device);
    context->device = newDevice;
    VuoAudioOutputDevice_retain(context->device);

    VuoRelease(context->audioManager);
    context->audioManager = VuoAudioOut_getShared(newDevice);
    VuoRetain(context->audioManager);
}


struct nodeInstanceData * nodeInstanceInit
(
    VuoInputData(VuoAudioOutputDevice) device
)
{
    struct nodeInstanceData *context = (struct nodeInstanceData *)calloc(1,sizeof(struct nodeInstanceData));
    VuoRegister(context, free);
    updateDevice(context, device);
    return context;
}

void nodeInstanceTriggerStart
(
    VuoInstanceData(struct nodeInstanceData *) context,
    VuoOutputTrigger(requestedChannels, VuoReal)
)
{
    VuoAudioOut_addTrigger((*context)->audioManager, requestedChannels);
Ejemplo n.º 30
0
 */

#include "node.h"
#include "VuoLeapFrame.h"
#include "VuoLeapHand.h"
#include "VuoLeapPointable.h"
#include "VuoList_VuoLeapHand.h"
#include "VuoList_VuoLeapPointable.h"

VuoModuleMetadata({
					  "title" : "Get Frame Values",
					  "keywords" : [ "gesture", "controller", "motion", "hand", "palm", "pointable", "finger", "tool" ],
					  "version" : "1.0.0",
					  "node": {
						  "exampleCompositions" : [ "DisplayLeapHand.vuo", "HighlightExtendedFingers.vuo", "TwirlImageWithLeap.vuo" ]
					  }
				 });

void nodeEvent
(
		VuoInputData(VuoLeapFrame) frame,
		VuoOutputData(VuoInteger, {"name":"ID"}) id,
		VuoOutputData(VuoList_VuoLeapHand) hands,
		VuoOutputData(VuoList_VuoLeapPointable) pointables
)
{
	*id = frame.id;
	*hands = frame.hands ? frame.hands : VuoListCreate_VuoLeapHand();
	*pointables = frame.pointables ? frame.pointables : VuoListCreate_VuoLeapPointable();
}