What is KVR Audio? | Submit News | Advertise | Developer Account

Options (Affects News & Product results only):

OS:
Format:
Include:
Quick Search KVR

"Quick Search" KVR Audio's Product Database, News Items, Developer Listings, Forum Topics and videos here. For advanced Product Database searching please use the full product search. For the forum you can use the phpBB forum search.

To utilize the power of Google you can use the integrated Google Site Search.

Products 0

Developers 0

News 0

Forum 0

Videos 0

Search  

Xcode Resources VST

DSP, Plug-in and Host development discussion.

Moderator: Moderators (Main)

mjdav
KVRer
 
29 posts since 14 Aug, 2011

Postby mjdav; Mon Mar 12, 2012 1:19 am Xcode Resources VST

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
hibrasil
KVRian
 
587 posts since 23 Jun, 2002, from York, UK

Postby hibrasil; Mon Mar 12, 2012 5:05 am

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
pMix | Endless Series V3 Shepard Tone Plugin | WDL-OL Plugin dev framework
Available for consultancy/tuition via Skype (help with IPlug/JUCE/MaxMSP)
mjdav
KVRer
 
29 posts since 14 Aug, 2011

Postby mjdav; Mon Mar 12, 2012 8:22 am

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
hibrasil
KVRian
 
587 posts since 23 Jun, 2002, from York, UK

Postby hibrasil; Tue Mar 13, 2012 12:37 am

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
pMix | Endless Series V3 Shepard Tone Plugin | WDL-OL Plugin dev framework
Available for consultancy/tuition via Skype (help with IPlug/JUCE/MaxMSP)
mjdav
KVRer
 
29 posts since 14 Aug, 2011

Postby mjdav; Tue Mar 13, 2012 8:04 am

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.

Moderator: Moderators (Main)

Return to DSP and Plug-in Development