Vuo  2.0.2
Instance Methods | Class Methods | Properties | List of all members
VuoRunnerCocoa Class Reference

Description

Compiles, runs, and controls a Vuo composition.

This is an abstract base class which provides common methods for VuoImageFilter and VuoImageGenerator.

See also
VuoRunner (a similar API, in C++)

Definition at line 42 of file VuoRunnerCocoa.h.

Instance Methods

(NSArray *) - inputPorts
 Returns an array listing the names of the composition's published input ports, excluding those used by protocols. More...
 
(NSArray *) - outputPorts
 Returns an array listing the names of the composition's published output ports, excluding those used by protocols. More...
 
(NSDictionary *) - detailsForPort:
 Returns a dictionary with information about the specified portName. More...
 
(id) - propertyListFromInputValues
 Returns a property list with the current values of the composition's (non-protocol) published input ports. More...
 
(BOOL) - setInputValuesWithPropertyList:
 Sets the values of the composition's published input ports using a property list. More...
 
(BOOL) - setInputValues:
 Sets the value of one or more published input ports. More...
 
(BOOL) - setInputJSON:
 Sets the value of one or more published input ports using json_object * values wrapped in NSValue. More...
 
(id) - valueForOutputPort:
 Returns the value of the specified published output port. More...
 
(GLuint) - glTextureWithTarget:forOutputPort:outputPixelsWide:pixelsHigh:
 Returns the image in the specified published output port, keeping it in GPU VRAM as an OpenGL texture. More...
 
(GLuint) - glTextureFromProvider:forOutputPort:outputPixelsWide:pixelsHigh:ioSurface:
 Retrieves the image in the specified published output port, keeping it in GPU VRAM as an OpenGL texture. More...
 

Class Methods

(void) + setGlobalRootContext:
 Specifies an OpenGL context to be used as the base for all of Vuo's shared GL contexts. More...
 
(void) + prepareForFastBuild
 Prepares the cache that enables compositions to build faster. More...
 
(id) + cocoaObjectWithVuoValue:ofType:
 Given the specified vuoValue (serialized as JSON), returns a Cocoa object. More...
 
(json_object *) + vuoValueWithCocoaObject:
 Given the specified Cocoa object, returns a Vuo value (serialized as JSON). More...
 
(NSImage *) + nsImageWithVuoImage:
 Converts the provided VuoImage to an NSImage. More...
 

Properties

NSString * compositionName
 The composition's user-defined title. More...
 
NSString * compositionDescription
 The composition's user-defined description. More...
 
NSString * compositionCopyright
 The composition's user-defined copyright text. More...
 

Method Documentation

◆ cocoaObjectWithVuoValue:ofType:

+ (id) cocoaObjectWithVuoValue: (json_object *)  vuoValue
ofType: (string)  type 

Given the specified vuoValue (serialized as JSON), returns a Cocoa object.

See also
valueForOututPort:

Provided by category VuoRunnerCocoa(Conversion).

Definition at line 40 of file VuoRunnerCocoa+Conversion.mm.

◆ detailsForPort:

- (NSDictionary *) detailsForPort: (NSString *)  portName

Returns a dictionary with information about the specified portName.

Keys include:

  • title — value is an NSString with the port's display name
  • type — value is an NSString with the port's type (e.g., VuoText)
  • default — value is a Cocoa object (see valueForOutputPort:) with the port's default value
  • menuItems — value is an NSArray where each element is one of the following:
    • an NSDictionary with 2 keys: value (NSString or NSNumber: identifier) and name (NSString: display name)
    • the NSString --- — a menu separator line
    • any other NSString — a non-selectable menu label, for labeling multiple sections within the menu
  • suggestedMin — value is a Cocoa object (see valueForOutputPort:) with the port's suggested minimum value
  • suggestedMax — value is a Cocoa object (see valueForOutputPort:) with the port's suggested maximum value
  • suggestedStep — value is a Cocoa object (see valueForOutputPort:) with the port's suggested step (the amount the value changes with each click of a spinbox)

If menuItems contains any values, the host application should display a select widget. Otherwise, the host application should use type to determine the kind of widget to display. Host applications are encouraged to provide widgets for the following specific types:

Definition at line 337 of file VuoRunnerCocoa.mm.

◆ glTextureFromProvider:forOutputPort:outputPixelsWide:pixelsHigh:ioSurface:

- (GLuint) glTextureFromProvider: (GLuint(^)(NSUInteger pixelsWide, NSUInteger pixelsHigh))  provider
forOutputPort: (NSString *)  portName
outputPixelsWide: (NSUInteger *)  outputPixelsWide
pixelsHigh: (NSUInteger *)  outputPixelsHigh
ioSurface: (IOSurfaceRef *)  outputIOSurface 

Retrieves the image in the specified published output port, keeping it in GPU VRAM as an OpenGL texture.

Returns 0 if the composition is stopped, if no port with that name exists, if the port does not have type VuoImage, or if the image could not be converted. Otherwise, returns the host-owned OpenGL texture name whose GL_TEXTURE_RECTANGLE_ARB target has been populated.

Parameters
providerA block that returns an OpenGL texture name with the requested width and height. The host app must not call glTexImage2D() on the texture, since this makes the texture incompatible with the IOSurface backing.
portNameThe name of an output port.
[out]outputPixelsWideUpon return, this contains the width of the output texture.
[out]outputPixelsHighUpon return, this contains the height of the output texture.
[out]outputIOSurfaceUpon return, this contains the IOSurface backing the output texture. When the host app is finished with the output texture, it must signal and release the IOSurface:
VuoIoSurfacePool_signal(outputIOSurface);
CFRelease(outputIOSurface);

Definition at line 696 of file VuoRunnerCocoa.mm.

◆ glTextureWithTarget:forOutputPort:outputPixelsWide:pixelsHigh:

- (GLuint) glTextureWithTarget: (GLuint)  target
forOutputPort: (NSString *)  portName
outputPixelsWide: (NSUInteger *)  outputPixelsWide
pixelsHigh: (NSUInteger *)  outputPixelsHigh 

Returns the image in the specified published output port, keeping it in GPU VRAM as an OpenGL texture.

target must be either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB.

Returns 0 if no port with that name exists, or if the port does not have type VuoImage.

The caller is responsible for deleting the texture when it is finished using it.

Definition at line 644 of file VuoRunnerCocoa.mm.

◆ inputPorts

- (NSArray *) inputPorts

Returns an array listing the names of the composition's published input ports, excluding those used by protocols.

Definition at line 278 of file VuoRunnerCocoa.mm.

◆ nsImageWithVuoImage:

+ (NSImage *) nsImageWithVuoImage: (VuoImage vi

Converts the provided VuoImage to an NSImage.

Provided by category VuoRunnerCocoa(Conversion).

Definition at line 437 of file VuoRunnerCocoa+Conversion.mm.

◆ outputPorts

- (NSArray *) outputPorts

Returns an array listing the names of the composition's published output ports, excluding those used by protocols.

Definition at line 295 of file VuoRunnerCocoa.mm.

◆ prepareForFastBuild

+ (void) prepareForFastBuild

Prepares the cache that enables compositions to build faster.

The cache is prepared automatically when the first VuoRunnerCocoa is created. Optionally, this method can be called beforehand to avoid any delays when creating the first VuoRunnerCocoa.

See also
VuoCompiler::prepareForFastBuild()

Definition at line 95 of file VuoRunnerCocoa.mm.

◆ propertyListFromInputValues

- (id) propertyListFromInputValues

Returns a property list with the current values of the composition's (non-protocol) published input ports.

Definition at line 434 of file VuoRunnerCocoa.mm.

◆ setGlobalRootContext:

+ (void) setGlobalRootContext: (CGLContextObj)  context

Specifies an OpenGL context to be used as the base for all of Vuo's shared GL contexts.

The CGLContext must be unlocked when calling this function, but after that you may lock it at any time (Vuo doesn't require it to be locked or unlocked).

Must be called before any Vuo composition is loaded.

This function may be called from any thread.

Definition at line 82 of file VuoRunnerCocoa.mm.

◆ setInputJSON:

- (BOOL) setInputJSON: (NSDictionary *)  namesAndJSON

Sets the value of one or more published input ports using json_object * values wrapped in NSValue.

Returns NO if any of the port names do not exist.

The json_object remains owned by the caller (this method doesn't change its reference count).

Definition at line 555 of file VuoRunnerCocoa.mm.

◆ setInputValues:

- (BOOL) setInputValues: (NSDictionary *)  namesAndValues

Sets the value of one or more published input ports.

Returns NO if any of the port names do not exist, or if any of the values could not be converted.

This method accepts the following object types:

  • NSNumber, CFNumberRef
  • NSString, CFStringRef
  • NSColor, CIColor
  • NSImage, NSBitmapImageRep, CGImageRef, CVPixelBufferRef, CVOpenGLTextureRef
  • NSPoint or CGPoint wrapped in NSValue (VuoPoint2d)
  • SCNVector3 or double[3] wrapped in NSData or CFDataRef (VuoPoint3d)
  • NSArray or CFArrayRef containing a list of one of the above types

Definition at line 510 of file VuoRunnerCocoa.mm.

◆ setInputValuesWithPropertyList:

- (BOOL) setInputValuesWithPropertyList: (id)  propertyList

Sets the values of the composition's published input ports using a property list.

Returns NO if restoration of any of the port values failed. (However, in the event of failure, it will try to keep going and set other port values.)

Definition at line 459 of file VuoRunnerCocoa.mm.

◆ valueForOutputPort:

- (id) valueForOutputPort: (NSString *)  portName

Returns the value of the specified published output port.

Returns nil if no port with that name exists, or if the value could not be converted.

This method may return any of the following object types:

  • NSNumber (VuoBoolean, VuoInteger, VuoReal)
  • NSString (VuoText and keyed types such as VuoCurve)
  • NSColor
  • NSImage
  • NSPoint wrapped in NSValue (VuoPoint2d)
  • double[3] wrapped in NSData (VuoPoint3d)
  • NSArray containing any of the above types
See also
- glTextureWithTarget:forOutputPort:outputPixelsWide:pixelsHigh: for a more efficient way to retrieve image values.

Definition at line 622 of file VuoRunnerCocoa.mm.

◆ vuoValueWithCocoaObject:

+ (json_object *) vuoValueWithCocoaObject: (id)  value

Given the specified Cocoa object, returns a Vuo value (serialized as JSON).

See also
setValue:forInputPort:

Provided by category VuoRunnerCocoa(Conversion).

Definition at line 242 of file VuoRunnerCocoa+Conversion.mm.

Property Documentation

◆ compositionCopyright

- (NSString*) compositionCopyright
readatomicassign

The composition's user-defined copyright text.

This is the @copyright line of the composition's Doxygen header.

Definition at line 63 of file VuoRunnerCocoa.h.

◆ compositionDescription

- (NSString*) compositionDescription
readatomicassign

The composition's user-defined description.

The composition description consists of the lines after the first line of the composition's Doxygen header.

Definition at line 56 of file VuoRunnerCocoa.h.

◆ compositionName

- (NSString*) compositionName
readatomicassign

The composition's user-defined title.

This is the @brief line of the composition's Doxygen header.

Definition at line 49 of file VuoRunnerCocoa.h.


The documentation for this class was generated from the following files: