Plug-ins, Hosts, Apps,
Hardware, Soundware
Developers
(Brands)
Videos Groups
Whats's in?
Banks & Patches
Download & Upload
Music Search
KVR
   
KVR Forum » DSP and Plug-in Development
Thread Read
Xcode Resources VST
mjdav
KVRer
- profile
- pm
PostPosted: Mon Mar 12, 2012 1:19 am reply with quote
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
^ Joined: 14 Aug 2011  Member: #262660  
hibrasil
KVRist
- profile
- pm
- www
PostPosted: Mon Mar 12, 2012 5:05 am reply with quote
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
^ Joined: 23 Jun 2002  Member: #3139  Location: York, UK
mjdav
KVRer
- profile
- pm
PostPosted: Mon Mar 12, 2012 8:22 am reply with quote
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.


#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
^ Joined: 14 Aug 2011  Member: #262660  
hibrasil
KVRist
- profile
- pm
- www
PostPosted: Tue Mar 13, 2012 12:37 am reply with quote
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

  NSBundle* pBundle = [NSBundle bundleWithIdentifier:ToNSString("com.me.myplugin")];

there is probably an alternative CF* function you can use

oli
^ Joined: 23 Jun 2002  Member: #3139  Location: York, UK
mjdav
KVRer
- profile
- pm
PostPosted: Tue Mar 13, 2012 8:04 am reply with quote
I've managed to locate my resource file and get the path to it


   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.
^ Joined: 14 Aug 2011  Member: #262660  
All times are GMT - 8 Hours

Printable version
Page 1 of 1
Display posts from previous:   
ReplyNew TopicPrevious TopicNext Topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Username: Password:  
KVR Developer Challenge 2012