Adding the Vuo.framework to Xcode

how does one go about adding the Vuo.framework to a new Xcode file ? the included sdk example doesn’t actually run its xib document or do anything. so I’m trying to make a new app using the code from the example. I tried adding the framework like normal linking my binary with library from my build phases tab using the path /Library/Developer/Vuo/framework/Vuo.framework

however this doesn’t seem to work. I get an error when trying to import <Vuo/Vuo.h> as it can’t find the framework. I then tried dragging the Vuo.framework from the sdk example folder to my Xcode project and I was then able to import <Vuo/Vuo.h> without any errors but upon running the blank app with just that one import I get this Library not loaded error. image not found.

any help or documentation building or using the Vuo.framework in Xcode would help. I’m used to using Xcode and not so much the terminal. I was able to build the example node using the core image framework via cmake and would like to build nodes using some frameworks and would also like to build some apps using the Vuo.framework in Xcode.

the included sdk example doesn’t actually run its xib document or do anything.

Sorry, in retrospect my answer to your previous question was confusing. VuoPluginApp doesn’t open a window on launch, but it does if you then go to File > Open and choose a Vuo composition that uses the Image Filter protocol.

The API documentation on developing applications that use Vuo provides instructions for adding the Vuo framework to an Xcode project.

thanks Jaymie that example VuoPluginApp runs the xib when opening the example Image filter or Vuo file provided like you said. thanks for providing that link to the documentation. that should get me started, not sure why I didn’t see that. I tried visiting the links inside the sdk read me file but they all give dns errors when trying to load them. so the example works with protocol composition as Image filter. is it possible to use custom published ports in the Image Filter protocol as variables in cocoa ?

This application expects the composition plugin to have the following published ports:

    • Inputs:
    • ‘image’ (Data type: Image)
    • ‘time’ (Data type: Real)
    • Outputs:
    • ‘outputImage’ (Data type: Image)

Yes, you can use additional published ports on an image filter composition in Vuo’s Cocoa API.

As a small example, in VuoPluginApp, change the updateOutputImage method to the following:

- (void)updateOutputImage
{
    // New code — sets the published input called Hue
    static float hue = 0;
    NSDictionary *hueDict = @{@"Hue":[NSNumber numberWithFloat:hue]};
    [imageFilter setInputValues:hueDict];
    hue += 0.01;
    
    // Original code
    NSImage *filteredImage = [imageFilter filterNSImage:sourceImage atTime:time];
    [_outputImageView setImage:filteredImage];
}

Build and run VuoPluginApp, and use it to open the attached composition (ImageFilterTest.vuo).

As you move the slider, VuoPluginApp feeds increasing values into the Hue published input port.

Thanks for pointing out the problem with the links — we’ll fix those. You can find the full API documentation at https://api.vuo.org .

ImageFilterTest.vuo (1.67 KB)

thanks Jaymie is implementing the time a requisite for image filters protocol. this is something I’m supposed to supply outside the Vuo image filter composition ? one wouldn’t be using a refresh display time node with the image filter protocol ? I tried using an image generator protocol using the same Hue input with the VuoImageGenerator class being the input to the image filter example like so inside the updateOutputImage function right under the code you just posted.

    NSURL * url = [NSURL fileURLWithPath:@"/Users/dust/Desktop/ImageGeneratorTest.vuo"];
    VuoImageGenerator *imageGenerator = nil;
    imageGenerator = [[VuoImageGenerator alloc] initWithComposition:url];
    NSImage * igenerate = [imageGenerator generateNSImageWithSuggestedPixelsWide:(NSUInteger)640 pixelsHigh:(NSUInteger)480 atTime:(NSTimeInterval)time];
    [imageGenerator setInputValues:hueDict];
    NSImage *filteredImage = [imageFilter filterNSImage:igenerate atTime:time];

this produces an image from the generator inside the image filter example but i’m sure I broke something as its in the updateOutputImage function. when I move the time slider it won’t update time in both image filter and image generators. i’m sure there is something more that I need to do to render an image generator. I still need to add the frameworks to a blank Xcode app and try to run an image generator as I think that’s what I will use more often than a image filter.

ImageGeneratorTest.vuo (2.25 KB)

As a quick test (but not recommended for an actual application), try this:

- (void)updateOutputImage
{
    NSURL * url = [NSURL fileURLWithPath:@"/Users/dust/Desktop/ImageGeneratorTest.vuo"];
    VuoImageGenerator *imageGenerator = nil;
    imageGenerator = [[VuoImageGenerator alloc] initWithComposition:url];
    NSImage * igenerate = [imageGenerator generateNSImageWithSuggestedPixelsWide:(NSUInteger)640 pixelsHigh:(NSUInteger)480 atTime:(NSTimeInterval)time];
    [_outputImageView setImage:igenerate];
}

When you click at different points on the time slider, you should see the displayed image update.

However, if you try to slide the slider instead of doing single clicks, you’ll see why I don’t recommend this. The method takes like a second to execute, which is obviously way too slow for real-time graphics updates.

The slow part is [[VuoImageGenerator alloc] initWithComposition:url], which you should call once upon loading the composition (e.g. in - readFromURL:ofType:error:), not every time you generate an image. This method compiles and links the composition.

is implementing the time a requisite for image filters protocol. this is something I’m supposed to supply outside the Vuo image filter composition ? one wouldn’t be using a refresh display time node with the image filter protocol ?

Correct. More info about protocols here.

okay that’s what I was thinking Jaymie one wouldn’t want to initialize the VuoImageGenerator inside the update image function. moving the initialization outside of the update image function makes the time slider work as expected. also using [imageGenerator setInputValues:hueDict]; from your first filter example works just the same for generator as it did with a filter.

the example app works fine but i’m still having problems using the Vuo.framework inside a blank Xcode app. I get some warning to do with code signing. If I deselect “Code Sign On Copy” from the build phases copy to frameworks folder I am able to run the framework without code sign errors.

I tried to build a test image generator like the above code and on initial allocation Im getting a warning it won’t load the image generator from my desktop because I don’t have permission. it loaded fine from the example app ? so I moved the Vuo generator file to my application bundle and this seemed to get me a little closer but my app still hangs on initializing the image generator from file.

i’m getting a little closer to being able to use the vuo.framework inside my own app.

I tried to build a test image generator like the above code and on initial allocation Im getting a warning it won’t load the image generator from my desktop because I don’t have permission. it loaded fine from the example app ?

so I moved the Vuo generator file to my application bundle and this seemed to get me a little closer but my app still hangs on initializing the image generator from file.

Both of those problems are related to app sandboxing. In order to use Vuo.framework in a macOS app, you have to disable sandboxing. (I’ve made a note that we should add this to the API documentation.)

(To be clear, apps exported from Vuo, as well as other apps that use VuoRunner.framework, will work inside a sandbox, but apps that use the full Vuo.framework need to disable sandboxing. Turning off the sandbox makes your app ineligible for the Apple App Store, but apps containing the full Vuo.framework were ineligible anyway since the framework contains a compiler.)

If I deselect “Code Sign On Copy” from the build phases copy to frameworks folder I am able to run the framework without code sign errors.

Thanks for pointing that out. In Vuo 2.4.1 we updated the documentation for using the Vuo framework in an Xcode project with that and other changes for Xcode 13.

thanks Jaymie I will give that a try. If I remember correctly turning off sandboxing shouldn’t be that difficult. it would be just setting my entitlements to no or something like that. I will try with this new framework following the new directions.

Im not on Xcode 13 yet, I have been putting off upgrading so I don’t lose some of my audio plugins . Every time I upgrade my audio plugins stop working. However I did make a support ticket and asked the developer of my plugins if its safe to upgrade and he assures me its safe to upgrade so I might go for it here shortly.

In order to use Vuo.framework in a macOS app, you have to disable sandboxing. (I’ve made a note that we should add this to the API documentation.)

Added to Developing Applications that Use Vuo in Vuo 2.4.2.