Mercurial > hg > audiodb
comparison examples/iAudioDB/AppController.m @ 709:362bae792124
* Added custom libraries (with relative lib paths)
* Added custom binaries (with relative lib paths)
* Added .adb extension to create dialogue
author | mas01mj |
---|---|
date | Fri, 18 Jun 2010 11:29:12 +0000 |
parents | 6d3ed50c9d2d |
children | df850498486e |
comparison
equal
deleted
inserted
replaced
708:3dbd97b4ce83 | 709:362bae792124 |
---|---|
59 -(IBAction)createDatabase:(id)sender | 59 -(IBAction)createDatabase:(id)sender |
60 { | 60 { |
61 [self cancelCreate:self]; | 61 [self cancelCreate:self]; |
62 | 62 |
63 NSSavePanel* panel = [NSSavePanel savePanel]; | 63 NSSavePanel* panel = [NSSavePanel savePanel]; |
64 [panel setCanSelectHiddenExtension:YES]; | |
65 [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"adb", nil]]; | |
64 NSInteger response = [panel runModalForDirectory:NSHomeDirectory() file:@""]; | 66 NSInteger response = [panel runModalForDirectory:NSHomeDirectory() file:@""]; |
65 | 67 |
66 [results removeAllObjects]; | 68 [results removeAllObjects]; |
67 [tracksView reloadData]; | 69 [tracksView reloadData]; |
68 | 70 |
91 dim = 12; | 93 dim = 12; |
92 break; | 94 break; |
93 } | 95 } |
94 | 96 |
95 // Calculate the max DB size | 97 // Calculate the max DB size |
96 int vectors = ceil([maxLengthField doubleValue] / (([hopSizeField doubleValue] / 1000) * 44100.0f)); | 98 NSLog(@"Max length: %f", [maxLengthField doubleValue]); |
97 NSLog(@"Vectors: %d", vectors); | 99 NSLog(@"hop size: %f", [hopSizeField doubleValue]); |
100 int vectors = ceil([maxLengthField doubleValue] / (([hopSizeField doubleValue] / 1000.0f))); | |
101 NSLog(@"Max Vectors: %d", vectors); | |
98 int numtracks = [maxTracksField intValue]; | 102 int numtracks = [maxTracksField intValue]; |
99 int datasize = ceil((numtracks * vectors * dim * 8.0f) / 1024.0f / 1024.0f); // In MB | 103 int datasize = ceil((numtracks * vectors * dim * 8.0f) / 1024.0f / 1024.0f); // In MB |
100 | 104 |
101 [self reset]; | 105 [self reset]; |
102 | 106 |
305 NSString* featuresFileName = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:tempFileNameCString length:strlen(tempFileNameCString)]; | 309 NSString* featuresFileName = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:tempFileNameCString length:strlen(tempFileNameCString)]; |
306 free(tempFileNameCString); | 310 free(tempFileNameCString); |
307 | 311 |
308 // Extract features with sonic-annotator | 312 // Extract features with sonic-annotator |
309 NSTask* task = [[NSTask alloc] init]; | 313 NSTask* task = [[NSTask alloc] init]; |
310 | 314 NSLog(@"Resource path: %@", [ [NSBundle mainBundle] resourcePath]); |
315 NSString* pluginPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Vamp"]; | |
311 NSString* extractPath = [ [ NSBundle mainBundle ] pathForAuxiliaryExecutable: @"sonic-annotator" ]; | 316 NSString* extractPath = [ [ NSBundle mainBundle ] pathForAuxiliaryExecutable: @"sonic-annotator" ]; |
317 | |
318 NSLog(@"Plugin path: %@", pluginPath); | |
319 | |
320 NSDictionary *defaultEnvironment = [[NSProcessInfo processInfo] environment]; | |
321 NSMutableDictionary *environment = [[NSMutableDictionary alloc] initWithDictionary:defaultEnvironment]; | |
322 [environment setValue:pluginPath forKey:@"VAMP_PATH"]; | |
323 NSLog(@"Env: %@", environment); | |
312 [task setLaunchPath:extractPath]; | 324 [task setLaunchPath:extractPath]; |
325 [task setEnvironment:environment]; | |
326 | |
313 | 327 |
314 NSArray* args; | 328 NSArray* args; |
315 args = [NSArray arrayWithObjects:@"-t", n3FileName, @"-w", @"rdf", @"-r", @"--rdf-network", @"--rdf-one-file", featuresFileName, @"--rdf-force", filename, nil]; | 329 args = [NSArray arrayWithObjects:@"-t", n3FileName, @"-w", @"rdf", @"-r", @"--rdf-network", @"--rdf-one-file", featuresFileName, @"--rdf-force", filename, nil]; |
316 [task setArguments:args]; | 330 [task setArguments:args]; |
317 [task launch]; | 331 [task launch]; |