-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAudioFileInfoPatch.m
52 lines (42 loc) · 1.07 KB
/
AudioFileInfoPatch.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#import "AudioFileInfoPatch.h"
@implementation AudioFileInfoPatch : QCPatch
+ (QCPatchExecutionMode)executionModeWithIdentifier:(id)fp8
{
return kQCPatchExecutionModeProcessor;
}
+ (BOOL)allowsSubpatchesWithIdentifier:(id)fp8
{
return NO;
}
+ (QCPatchTimeMode)timeModeWithIdentifier:(id)fp8
{
return kQCPatchTimeModeNone;
}
- (id)initWithIdentifier:(id)fp8
{
if(self=[super initWithIdentifier:fp8])
{
[[self userInfo] setObject: @"Kineme Audio File Info" forKey: @"name"];
}
return self;
}
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
if( [inputPath wasUpdated] )
{
NSString *path = KIExpandPath(self,[inputPath stringValue]);
NSSound *s = [[NSSound alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] byReference:YES];
if(!s)
{
NSLog(NSLocalizedString(@"didn't load", @""));
[outputFileLoaded setBooleanValue:NO];
[outputDuration setDoubleValue:0.0];
return YES;
}
[outputFileLoaded setBooleanValue:YES];
[outputDuration setDoubleValue:[s duration]];
[s release];
}
return YES;
}
@end