-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add detune property, add pseudo abstract classes
- Loading branch information
Showing
10 changed files
with
112 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <AVFoundation/AVFoundation.h> | ||
|
||
@interface AudioNode : NSObject | ||
|
||
@property (nonatomic, readonly) NSInteger numberOfInputs; | ||
@property (nonatomic, readonly) NSInteger numberOfOutputs; | ||
@property (nonatomic, strong) NSMutableArray<AudioNode *> *connectedNodes; | ||
|
||
- (void)connect:(AudioNode *)node; | ||
- (void)disconnect; | ||
- (void)process; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#import "AudioNode.h" | ||
|
||
@implementation AudioNode | ||
|
||
- (instancetype)init { | ||
if (self = [super init]) { | ||
_connectedNodes = [NSMutableArray array]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)connect:(AudioNode *)node { | ||
if (self.numberOfOutputs > 0) { | ||
[self.connectedNodes addObject:node]; | ||
} | ||
} | ||
|
||
- (void)disconnect { | ||
[self.connectedNodes removeAllObjects]; | ||
} | ||
|
||
- (void)process { | ||
for (AudioNode *node in self.connectedNodes) { | ||
[node process]; | ||
} | ||
} | ||
|
||
@end |
8 changes: 8 additions & 0 deletions
8
ios/nodes/AudioScheduledSourceNode/AudioScheduledSourceNode.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#import "AudioNode.h" | ||
|
||
@interface AudioScheduledSourceNode : AudioNode | ||
|
||
- (void)start; | ||
- (void)stop; | ||
|
||
@end |
20 changes: 20 additions & 0 deletions
20
ios/nodes/AudioScheduledSourceNode/AudioScheduledSourceNode.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#import "AudioScheduledSourceNode.h" | ||
|
||
@implementation AudioScheduledSourceNode | ||
|
||
- (void)start { | ||
NSLog(@"Attempting to call `start` on a base class where it is not implemented. You must override `start` in a subclass."); | ||
@throw [NSException exceptionWithName:NSInternalInconsistencyException | ||
reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] | ||
userInfo:nil]; | ||
} | ||
|
||
- (void)stop { | ||
NSLog(@"Attempting to call `stop` on a base class where it is not implemented. You must override `stop` in a subclass."); | ||
@throw [NSException exceptionWithName:NSInternalInconsistencyException | ||
reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] | ||
userInfo:nil]; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters