2006-01-20 12:34:02 -03:00
|
|
|
//
|
2006-04-02 11:44:08 -04:00
|
|
|
// BufferChain.m
|
2006-01-20 12:34:02 -03:00
|
|
|
// CogNew
|
|
|
|
//
|
2006-09-04 14:46:18 -04:00
|
|
|
// Created by Vincent Spader on 1/4/06.
|
|
|
|
// Copyright 2006 Vincent Spader. All rights reserved.
|
2006-01-20 12:34:02 -03:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "BufferChain.h"
|
2007-03-01 22:36:52 -03:00
|
|
|
#import "AudioSource.h"
|
2007-02-24 17:36:27 -03:00
|
|
|
#import "CoreAudioUtils.h"
|
2022-02-07 02:49:27 -03:00
|
|
|
#import "OutputNode.h"
|
2006-01-20 12:34:02 -03:00
|
|
|
|
2025-02-13 19:56:18 -03:00
|
|
|
#import "AudioPlayer.h"
|
|
|
|
|
2013-10-11 09:03:55 -03:00
|
|
|
#import "Logging.h"
|
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
@implementation BufferChain
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (id)initWithController:(id)c {
|
2006-01-20 12:34:02 -03:00
|
|
|
self = [super init];
|
2022-02-07 02:49:27 -03:00
|
|
|
if(self) {
|
2007-02-24 17:36:27 -03:00
|
|
|
controller = c;
|
|
|
|
streamURL = nil;
|
|
|
|
userInfo = nil;
|
2022-02-07 02:49:27 -03:00
|
|
|
rgInfo = nil;
|
2007-03-01 22:36:52 -03:00
|
|
|
|
2006-04-12 22:51:22 -04:00
|
|
|
inputNode = nil;
|
2007-10-03 16:23:14 -04:00
|
|
|
converterNode = nil;
|
2025-02-11 05:55:29 -03:00
|
|
|
|
|
|
|
rubberbandNode = nil;
|
2025-02-12 00:43:54 -03:00
|
|
|
fsurroundNode = nil;
|
2025-02-12 04:01:13 -03:00
|
|
|
equalizerNode = nil;
|
2025-02-12 02:17:58 -03:00
|
|
|
hrtfNode = nil;
|
2025-02-13 19:56:18 -03:00
|
|
|
downmixNode = nil;
|
2025-02-13 06:12:53 -03:00
|
|
|
|
|
|
|
visualizationNode = nil;
|
2006-01-20 12:34:02 -03:00
|
|
|
}
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2025-02-16 00:53:34 -03:00
|
|
|
- (BOOL)buildChain {
|
|
|
|
// Cut off output source
|
|
|
|
finalNode = nil;
|
|
|
|
|
|
|
|
// Tear them down in reverse
|
|
|
|
visualizationNode = nil;
|
|
|
|
downmixNode = nil;
|
|
|
|
hrtfNode = nil;
|
|
|
|
equalizerNode = nil;
|
|
|
|
fsurroundNode = nil;
|
|
|
|
rubberbandNode = nil;
|
2022-02-07 02:49:27 -03:00
|
|
|
converterNode = nil;
|
2025-02-16 00:53:34 -03:00
|
|
|
inputNode = nil;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2006-04-12 22:51:22 -04:00
|
|
|
inputNode = [[InputNode alloc] initWithController:self previous:nil];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!inputNode) return NO;
|
2007-10-03 16:23:14 -04:00
|
|
|
converterNode = [[ConverterNode alloc] initWithController:self previous:inputNode];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!converterNode) return NO;
|
2025-02-13 11:35:26 -03:00
|
|
|
rubberbandNode = [[DSPRubberbandNode alloc] initWithController:self previous:converterNode latency:0.1];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!rubberbandNode) return NO;
|
2025-02-12 00:43:54 -03:00
|
|
|
fsurroundNode = [[DSPFSurroundNode alloc] initWithController:self previous:rubberbandNode latency:0.03];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!fsurroundNode) return NO;
|
2025-02-12 04:01:13 -03:00
|
|
|
equalizerNode = [[DSPEqualizerNode alloc] initWithController:self previous:fsurroundNode latency:0.03];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!equalizerNode) return NO;
|
2025-02-12 04:01:13 -03:00
|
|
|
hrtfNode = [[DSPHRTFNode alloc] initWithController:self previous:equalizerNode latency:0.03];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!hrtfNode) return NO;
|
2025-02-13 19:56:18 -03:00
|
|
|
downmixNode = [[DSPDownmixNode alloc] initWithController:self previous:hrtfNode latency:0.03];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!downmixNode) return NO;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2025-02-16 19:19:43 -03:00
|
|
|
// Approximately double the chunk size for Vis at 44100Hz
|
|
|
|
visualizationNode = [[VisualizationNode alloc] initWithController:self previous:downmixNode latency:8192.0 / 44100.0];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(!visualizationNode) return NO;
|
2025-02-13 06:12:53 -03:00
|
|
|
|
|
|
|
finalNode = visualizationNode;
|
2025-02-16 00:53:34 -03:00
|
|
|
|
|
|
|
return YES;
|
2006-01-20 12:34:02 -03:00
|
|
|
}
|
|
|
|
|
2023-10-02 11:04:26 -03:00
|
|
|
- (BOOL)open:(NSURL *)url withOutputFormat:(AudioStreamBasicDescription)outputFormat withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi {
|
2007-03-01 22:36:52 -03:00
|
|
|
[self setStreamURL:url];
|
2022-06-12 22:43:41 -04:00
|
|
|
[self setUserInfo:userInfo];
|
2007-03-01 22:36:52 -03:00
|
|
|
|
2025-02-16 00:53:34 -03:00
|
|
|
if (![self buildChain]) {
|
|
|
|
DLog(@"Couldn't build processing chain...");
|
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2007-03-01 22:36:52 -03:00
|
|
|
id<CogSource> source = [AudioSource audioSourceForURL:url];
|
2013-10-11 09:03:55 -03:00
|
|
|
DLog(@"Opening: %@", url);
|
2022-02-07 02:49:27 -03:00
|
|
|
if(!source || ![source open:url]) {
|
2013-10-11 09:03:55 -03:00
|
|
|
DLog(@"Couldn't open source...");
|
2022-02-07 02:49:27 -03:00
|
|
|
url = [NSURL URLWithString:@"silence://10"];
|
|
|
|
source = [AudioSource audioSourceForURL:url];
|
|
|
|
if(![source open:url])
|
|
|
|
return NO;
|
2007-03-01 22:36:52 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
if(![inputNode openWithSource:source])
|
2006-04-12 22:51:22 -04:00
|
|
|
return NO;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2025-02-16 00:58:03 -03:00
|
|
|
if(![self initConverter:outputFormat])
|
2007-11-24 17:16:27 -03:00
|
|
|
return NO;
|
2025-02-13 19:56:18 -03:00
|
|
|
[self initDownmixer];
|
2007-11-24 17:16:27 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
[self setRGInfo:rgi];
|
2013-10-07 17:03:34 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
// return NO;
|
2007-11-24 17:16:27 -03:00
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2023-10-02 11:04:26 -03:00
|
|
|
- (BOOL)openWithInput:(InputNode *)i withOutputFormat:(AudioStreamBasicDescription)outputFormat withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi {
|
2013-10-11 09:03:55 -03:00
|
|
|
DLog(@"New buffer chain!");
|
2022-06-12 22:43:41 -04:00
|
|
|
[self setUserInfo:userInfo];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(![self buildChain]) {
|
|
|
|
DLog(@"Couldn't build processing chain...");
|
|
|
|
return NO;
|
|
|
|
}
|
2007-10-10 22:08:29 -04:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
if(![inputNode openWithDecoder:[i decoder]])
|
2007-10-10 22:08:29 -04:00
|
|
|
return NO;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2025-02-16 00:58:03 -03:00
|
|
|
if(![self initConverter:outputFormat])
|
2007-10-10 22:08:29 -04:00
|
|
|
return NO;
|
2025-02-13 19:56:18 -03:00
|
|
|
[self initDownmixer];
|
2013-10-11 09:03:55 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
[self setRGInfo:rgi];
|
|
|
|
|
2007-10-10 22:08:29 -04:00
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2021-12-26 07:01:02 -03:00
|
|
|
- (BOOL)openWithDecoder:(id<CogDecoder>)decoder
|
2023-10-02 11:04:26 -03:00
|
|
|
withOutputFormat:(AudioStreamBasicDescription)outputFormat
|
2022-06-12 22:43:41 -04:00
|
|
|
withUserInfo:(id)userInfo
|
2022-02-07 02:49:27 -03:00
|
|
|
withRGInfo:(NSDictionary *)rgi;
|
2021-12-26 07:01:02 -03:00
|
|
|
{
|
2022-02-07 02:49:27 -03:00
|
|
|
DLog(@"New buffer chain!");
|
2022-06-12 22:43:41 -04:00
|
|
|
[self setUserInfo:userInfo];
|
2025-02-16 00:53:34 -03:00
|
|
|
if(![self buildChain]) {
|
|
|
|
DLog(@"Couldn't build processing chain...");
|
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 02:49:27 -03:00
|
|
|
|
|
|
|
if(![inputNode openWithDecoder:decoder])
|
|
|
|
return NO;
|
|
|
|
|
2025-02-16 00:58:03 -03:00
|
|
|
if(![self initConverter:outputFormat])
|
|
|
|
return NO;
|
|
|
|
[self initDownmixer];
|
|
|
|
|
|
|
|
[self setRGInfo:rgi];
|
|
|
|
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)initConverter:(AudioStreamBasicDescription)outputFormat {
|
2022-02-07 02:49:27 -03:00
|
|
|
NSDictionary *properties = [inputNode properties];
|
|
|
|
|
|
|
|
DLog(@"Input Properties: %@", properties);
|
|
|
|
|
2022-02-08 03:02:17 -03:00
|
|
|
AudioStreamBasicDescription inputFormat = [inputNode nodeFormat];
|
|
|
|
uint32_t inputChannelConfig = 0;
|
2022-02-07 05:56:05 -03:00
|
|
|
if([properties valueForKey:@"channelConfig"])
|
2022-02-08 00:18:45 -03:00
|
|
|
inputChannelConfig = [[properties valueForKey:@"channelConfig"] unsignedIntValue];
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2023-10-02 11:04:26 -03:00
|
|
|
outputFormat.mChannelsPerFrame = inputFormat.mChannelsPerFrame;
|
|
|
|
outputFormat.mBytesPerFrame = ((outputFormat.mBitsPerChannel + 7) / 8) * outputFormat.mChannelsPerFrame;
|
|
|
|
outputFormat.mBytesPerPacket = outputFormat.mBytesPerFrame * outputFormat.mFramesPerPacket;
|
|
|
|
|
2025-02-16 00:58:03 -03:00
|
|
|
if(![converterNode setupWithInputFormat:inputFormat withInputConfig:inputChannelConfig outputFormat:outputFormat isLossless:[[properties valueForKey:@"encoding"] isEqualToString:@"lossless"]])
|
2022-02-07 02:49:27 -03:00
|
|
|
return NO;
|
|
|
|
|
|
|
|
return YES;
|
2021-12-26 07:01:02 -03:00
|
|
|
}
|
|
|
|
|
2025-02-13 19:56:18 -03:00
|
|
|
- (void)initDownmixer {
|
|
|
|
AudioPlayer * audioPlayer = controller;
|
|
|
|
OutputNode *outputNode = [audioPlayer output];
|
|
|
|
[downmixNode setOutputFormat:[outputNode deviceFormat] withChannelConfig:[outputNode deviceChannelConfig]];
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)launchThreads {
|
2013-10-11 09:03:55 -03:00
|
|
|
DLog(@"Properties: %@", [inputNode properties]);
|
2007-10-10 22:08:29 -04:00
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
[inputNode launchThread];
|
2007-11-24 17:16:27 -03:00
|
|
|
[converterNode launchThread];
|
2025-02-11 05:55:29 -03:00
|
|
|
[rubberbandNode launchThread];
|
2025-02-12 00:43:54 -03:00
|
|
|
[fsurroundNode launchThread];
|
2025-02-12 04:01:13 -03:00
|
|
|
[equalizerNode launchThread];
|
2025-02-12 02:17:58 -03:00
|
|
|
[hrtfNode launchThread];
|
2025-02-13 19:56:18 -03:00
|
|
|
[downmixNode launchThread];
|
2025-02-13 06:12:53 -03:00
|
|
|
[visualizationNode launchThread];
|
2006-01-20 12:34:02 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)setUserInfo:(id)i {
|
2007-02-24 17:36:27 -03:00
|
|
|
userInfo = i;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (id)userInfo {
|
2007-02-24 17:36:27 -03:00
|
|
|
return userInfo;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)setRGInfo:(NSDictionary *)rgi {
|
|
|
|
rgInfo = rgi;
|
|
|
|
[converterNode setRGInfo:rgi];
|
2013-10-02 06:30:04 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (NSDictionary *)rgInfo {
|
|
|
|
return rgInfo;
|
2013-10-02 06:30:04 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)dealloc {
|
|
|
|
[inputNode setShouldContinue:NO];
|
|
|
|
[[inputNode exitAtTheEndOfTheStream] signal];
|
2025-02-14 00:55:39 -03:00
|
|
|
[[inputNode writeSemaphore] signal];
|
2022-12-10 02:17:45 -03:00
|
|
|
if(![inputNode threadExited])
|
|
|
|
[[inputNode exitAtTheEndOfTheStream] wait]; // wait for decoder to be closed (see InputNode's -(void)process )
|
2013-10-12 17:59:34 -03:00
|
|
|
|
2025-02-13 06:12:53 -03:00
|
|
|
// Must do this here, or else the VisualizationContainer will carry a reference forever
|
|
|
|
[visualizationNode pop];
|
|
|
|
|
2013-10-11 09:03:55 -03:00
|
|
|
DLog(@"Bufferchain dealloc");
|
2006-04-02 11:44:08 -04:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)seek:(double)time {
|
|
|
|
long frame = (long)round(time * [[[inputNode properties] objectForKey:@"sampleRate"] floatValue]);
|
2007-11-24 17:16:27 -03:00
|
|
|
|
2025-02-14 23:50:50 -03:00
|
|
|
AudioPlayer * audioPlayer = controller;
|
|
|
|
OutputNode *outputNode = [audioPlayer output];
|
|
|
|
|
|
|
|
[inputNode setLastVolume:[outputNode volume]];
|
2007-11-24 17:16:27 -03:00
|
|
|
[inputNode seek:frame];
|
2006-04-02 16:03:12 -04:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (BOOL)endOfInputReached {
|
2007-10-10 22:08:29 -04:00
|
|
|
return [controller endOfInputReached:self];
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (BOOL)setTrack:(NSURL *)track {
|
2007-10-10 22:08:29 -04:00
|
|
|
return [inputNode setTrack:track];
|
2006-04-12 22:51:22 -04:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)initialBufferFilled:(id)sender {
|
2013-10-11 09:03:55 -03:00
|
|
|
DLog(@"INITIAL BUFFER FILLED");
|
2007-03-18 20:19:47 -04:00
|
|
|
[controller launchOutputThread];
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (InputNode *)inputNode {
|
2007-10-10 22:08:29 -04:00
|
|
|
return inputNode;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (id)finalNode {
|
2006-01-20 12:34:02 -03:00
|
|
|
return finalNode;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (NSURL *)streamURL {
|
2007-02-24 17:36:27 -03:00
|
|
|
return streamURL;
|
2006-04-12 22:51:22 -04:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)setStreamURL:(NSURL *)url {
|
2007-03-01 22:36:52 -03:00
|
|
|
streamURL = url;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)setShouldContinue:(BOOL)s {
|
2006-01-20 12:34:02 -03:00
|
|
|
[inputNode setShouldContinue:s];
|
2007-10-03 16:23:14 -04:00
|
|
|
[converterNode setShouldContinue:s];
|
2025-02-11 05:55:29 -03:00
|
|
|
[rubberbandNode setShouldContinue:s];
|
2025-02-12 00:43:54 -03:00
|
|
|
[fsurroundNode setShouldContinue:s];
|
2025-02-12 04:01:13 -03:00
|
|
|
[equalizerNode setShouldContinue:s];
|
2025-02-12 02:17:58 -03:00
|
|
|
[hrtfNode setShouldContinue:s];
|
2025-02-13 19:56:18 -03:00
|
|
|
[downmixNode setShouldContinue:s];
|
2025-02-13 06:12:53 -03:00
|
|
|
[visualizationNode setShouldContinue:s];
|
2006-01-20 12:34:02 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (BOOL)isRunning {
|
|
|
|
InputNode *node = [self inputNode];
|
|
|
|
if(nil != node && [node shouldContinue] && ![node endOfStream]) {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
return NO;
|
2013-10-12 17:52:58 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (id)controller {
|
|
|
|
return controller;
|
2013-10-21 02:04:09 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (ConverterNode *)converter {
|
|
|
|
return converterNode;
|
2021-12-26 04:41:45 -03:00
|
|
|
}
|
|
|
|
|
2025-02-11 05:55:29 -03:00
|
|
|
- (DSPRubberbandNode *)rubberband {
|
|
|
|
return rubberbandNode;
|
|
|
|
}
|
|
|
|
|
2025-02-12 00:43:54 -03:00
|
|
|
- (DSPFSurroundNode *)fsurround {
|
|
|
|
return fsurroundNode;
|
|
|
|
}
|
|
|
|
|
2025-02-12 02:17:58 -03:00
|
|
|
- (DSPHRTFNode *)hrtf {
|
|
|
|
return hrtfNode;
|
|
|
|
}
|
|
|
|
|
2025-02-12 04:01:13 -03:00
|
|
|
- (DSPEqualizerNode *)equalizer {
|
|
|
|
return equalizerNode;
|
|
|
|
}
|
|
|
|
|
2025-02-13 19:56:18 -03:00
|
|
|
- (DSPDownmixNode *)downmix {
|
|
|
|
return downmixNode;
|
|
|
|
}
|
|
|
|
|
2025-02-13 06:12:53 -03:00
|
|
|
- (VisualizationNode *)visualization {
|
|
|
|
return visualizationNode;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (AudioStreamBasicDescription)inputFormat {
|
2022-02-08 03:02:17 -03:00
|
|
|
return [inputNode nodeFormat];
|
2021-12-26 04:41:45 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:56:05 -03:00
|
|
|
- (uint32_t)inputConfig {
|
2022-02-08 03:02:17 -03:00
|
|
|
return [inputNode nodeChannelConfig];
|
2022-02-07 05:56:05 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (double)secondsBuffered {
|
|
|
|
double duration = 0.0;
|
|
|
|
Node *node = [self finalNode];
|
|
|
|
while(node) {
|
|
|
|
duration += [node secondsBuffered];
|
|
|
|
node = [node previousNode];
|
|
|
|
}
|
|
|
|
return duration;
|
2022-01-14 04:05:32 -03:00
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)sustainHDCD {
|
|
|
|
OutputNode *outputNode = (OutputNode *)[controller output];
|
|
|
|
[outputNode sustainHDCD];
|
|
|
|
[controller sustainHDCD];
|
2022-01-19 07:08:57 -03:00
|
|
|
}
|
|
|
|
|
2022-02-08 03:44:56 -03:00
|
|
|
- (void)restartPlaybackAtCurrentPosition {
|
|
|
|
[controller restartPlaybackAtCurrentPosition];
|
|
|
|
}
|
|
|
|
|
2022-02-09 00:56:39 -03:00
|
|
|
- (void)pushInfo:(NSDictionary *)info {
|
2022-02-12 12:29:02 -03:00
|
|
|
[controller pushInfo:info toTrack:userInfo];
|
2022-02-09 00:56:39 -03:00
|
|
|
}
|
|
|
|
|
2022-02-10 07:15:48 -03:00
|
|
|
- (void)setError:(BOOL)status {
|
|
|
|
[controller setError:status];
|
|
|
|
}
|
|
|
|
|
2025-02-13 06:12:53 -03:00
|
|
|
- (double)getPostVisLatency {
|
|
|
|
double latency = 0.0;
|
|
|
|
Node *node = finalNode;
|
|
|
|
while(node) {
|
|
|
|
latency += [node secondsBuffered];
|
|
|
|
if(node == visualizationNode) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
node = [node previousNode];
|
|
|
|
}
|
|
|
|
return latency;
|
|
|
|
}
|
|
|
|
|
2025-02-14 23:50:50 -03:00
|
|
|
- (void)setVolume:(double)v {
|
|
|
|
AudioPlayer * audioPlayer = controller;
|
|
|
|
OutputNode *outputNode = [audioPlayer output];
|
|
|
|
[outputNode setVolume:v];
|
|
|
|
}
|
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
@end
|