DSP threads, such as the Rubber Band processing, and planned moves of other processing to buffer threads, such as the Equalizer, FreeSurround, HRTF, and Downmixing for output, because they all have small output buffers. Since these buffers drain and fill fast, they should be processed at a high priority. Hopefully, App Store doesn't complain about the use of these APIs. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
50 lines
1,018 B
Objective-C
50 lines
1,018 B
Objective-C
//
|
|
// DSPNode.m
|
|
// CogAudio Framework
|
|
//
|
|
// Created by Christopher Snowhill on 2/10/25.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import "DSPNode.h"
|
|
|
|
@implementation DSPNode
|
|
|
|
- (id _Nullable)initWithController:(id _Nonnull)c previous:(id _Nullable)p latency:(double)latency {
|
|
self = [super init];
|
|
if(self) {
|
|
buffer = [[ChunkList alloc] initWithMaximumDuration:latency];
|
|
|
|
semaphore = [[Semaphore alloc] init];
|
|
|
|
accessLock = [[NSLock alloc] init];
|
|
|
|
initialBufferFilled = NO;
|
|
|
|
controller = c;
|
|
endOfStream = NO;
|
|
shouldContinue = YES;
|
|
|
|
nodeChannelConfig = 0;
|
|
nodeLossless = NO;
|
|
|
|
durationPrebuffer = latency * 0.25;
|
|
|
|
[self setPreviousNode:p];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
// DSP threads buffer for low latency, and therefore should have high priority
|
|
- (void)threadEntry:(id _Nullable)arg {
|
|
@autoreleasepool {
|
|
NSThread *currentThread = [NSThread currentThread];
|
|
[currentThread setThreadPriority:0.75];
|
|
[currentThread setQualityOfService:NSQualityOfServiceUserInitiated];
|
|
[self process];
|
|
}
|
|
}
|
|
|
|
@end
|