Xcode Resources VST

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I'm not sure if this is a straightforward problem or not, but...

I am building a VST where the plugin is dependant on a few .raw files containing audio samples.
When I build this plugin, it works fine as these files are on my computer, however if I take this to another computer the plugin doesn't function properly as these files aren't there.

I know the resources folder in Xcode if used for GUI bitmaps. Can this be done with with .raw files? Is it just a simple case of dragging them into my resources folder?

Basically, I need the files to be part of the VST so that when I take it to another computer only the .vst is required.
Not sure how to go about doing this?

Thanks,
Matthew

Post

yes, that should work, but it might be easier to write a little program to serialize the raw file and stick the data in an array a text file [edit] that you compile with your plugin

oli

Post

Thanks Hibrasil,

I've got a file testFile.raw in resources but when I open it using fopen, it says it couldn't be found
I've used this to get the CWD, but not sure where to go from here.

Code: Select all

#ifdef __APPLE__    
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
	
	char path[PATH_MAX];
	if(!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8*)path, PATH_MAX)) {
		printf("CWD Error");
	}
	
	CFRelease(resourcesURL);
	chdir(path);
	printf("\nCWD = %s\n", path);
#endif
Any ideas?
Thanks,
Matthew

Post

looks to me like you are looking inside the main bundle, which would be the host's app bundle not the plugin's.

in objective-c you can do something like

Code: Select all

  NSBundle* pBundle = [NSBundle bundleWithIdentifier:ToNSString("com.me.myplugin")];
there is probably an alternative CF* function you can use

oli

Post

I've managed to locate my resource file and get the path to it

Code: Select all

	FSRef file2Read;
	CFBundleRef requestedBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.__MyCompanyName__.myPlugIn"));
	CFURLRef testPath = CFBundleCopyResourceURL(requestedBundle, CFSTR("audioSamples.raw"), NULL, NULL);
	
	Boolean openedSuccessfully = CFURLGetFSRef(testPath, &file2Read);
	
	if(testPath !=NULL && openedSuccessfully)
		printf("Yes!");
	if(testPath == NULL && !openedSuccessfully)
		printf("No!");
I get a "Yes!" printed to my console window.

I have now decided to approach a different route, this was too over the top for what I'm doing.

Post Reply

Return to “DSP and Plugin Development”