DSP: Add thread priority control
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>
This commit is contained in:
parent
2b3d622685
commit
9ef21d8185
2 changed files with 12 additions and 0 deletions
|
@ -15,6 +15,8 @@
|
|||
|
||||
- (id _Nullable)initWithController:(id _Nonnull)c previous:(id _Nullable)p latency:(double)latency;
|
||||
|
||||
- (void)threadEntry:(id _Nullable)arg;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* DSPNode_h */
|
||||
|
|
|
@ -37,4 +37,14 @@
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue