Cleaned up project settings to current defaults, except for the macOS deployment version, which is still 10.13. Cleaned up a lot of headers and such to include with angle braces instead of double quotes. Enabled build sandbox in a lot of places. Disabled subproject signing in several places, for libraries and frameworks which will be stripped and signed when they are copied into place in the final build. Also, while trying to solve compilation issues, the visualization controller was reverted to the Objective C implementation, which is probably faster anyway. Stupid Swift/Objective-C language mixing issues. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
94 lines
2.1 KiB
Objective-C
94 lines
2.1 KiB
Objective-C
//
|
|
// Node.h
|
|
// CogNew
|
|
//
|
|
// Created by Vincent Spader on 1/4/06.
|
|
// Copyright 2006 Vincent Spader. All rights reserved.
|
|
//
|
|
|
|
#import <CogAudio/ChunkList.h>
|
|
#import <CogAudio/CogSemaphore.h>
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <os/workgroup.h>
|
|
|
|
#define BUFFER_SIZE 1024 * 1024
|
|
#define CHUNK_SIZE 16 * 1024
|
|
|
|
@interface Node : NSObject {
|
|
ChunkList *buffer;
|
|
Semaphore *writeSemaphore;
|
|
Semaphore *readSemaphore;
|
|
|
|
NSLock *accessLock;
|
|
|
|
id __weak previousNode;
|
|
id __weak controller;
|
|
|
|
BOOL shouldReset;
|
|
|
|
BOOL inWrite;
|
|
BOOL inPeek;
|
|
BOOL inRead;
|
|
BOOL inMerge;
|
|
|
|
BOOL shouldContinue;
|
|
BOOL endOfStream; // All data is now in buffer
|
|
BOOL initialBufferFilled;
|
|
|
|
AudioStreamBasicDescription nodeFormat;
|
|
uint32_t nodeChannelConfig;
|
|
BOOL nodeLossless;
|
|
|
|
double durationPrebuffer;
|
|
}
|
|
- (id _Nullable)initWithController:(id _Nonnull)c previous:(id _Nullable)p;
|
|
|
|
- (void)cleanUp;
|
|
|
|
- (BOOL)paused;
|
|
|
|
- (void)writeData:(const void *_Nonnull)ptr amount:(size_t)a;
|
|
- (void)writeChunk:(AudioChunk *_Nonnull)chunk;
|
|
- (AudioChunk *_Nonnull)readChunk:(size_t)maxFrames;
|
|
- (AudioChunk *_Nonnull)readChunkAsFloat32:(size_t)maxFrames;
|
|
|
|
- (AudioChunk *_Nonnull)readAndMergeChunks:(size_t)maxFrames;
|
|
- (AudioChunk *_Nonnull)readAndMergeChunksAsFloat32:(size_t)maxFrames;
|
|
|
|
- (BOOL)peekFormat:(AudioStreamBasicDescription *_Nonnull)format channelConfig:(uint32_t *_Nonnull)config;
|
|
- (BOOL)peekTimestamp:(double *_Nonnull)timestamp timeRatio:(double *_Nonnull)timeRatio;
|
|
|
|
- (void)process; // Should be overwriten by subclass
|
|
- (void)threadEntry:(id _Nullable)arg;
|
|
|
|
- (void)launchThread;
|
|
|
|
- (void)setShouldReset:(BOOL)s;
|
|
- (BOOL)shouldReset;
|
|
- (void)resetBackwards;
|
|
|
|
- (void)setPreviousNode:(id _Nullable)p;
|
|
- (id _Nullable)previousNode;
|
|
|
|
- (BOOL)shouldContinue;
|
|
- (void)setShouldContinue:(BOOL)s;
|
|
|
|
- (ChunkList *_Nonnull)buffer;
|
|
- (void)resetBuffer; // WARNING! DANGER WILL ROBINSON!
|
|
|
|
- (AudioStreamBasicDescription)nodeFormat;
|
|
- (uint32_t)nodeChannelConfig;
|
|
- (BOOL)nodeLossless;
|
|
|
|
- (Semaphore *_Nonnull)writeSemaphore;
|
|
- (Semaphore *_Nonnull)readSemaphore;
|
|
|
|
//-(void)resetBuffer;
|
|
|
|
- (BOOL)endOfStream;
|
|
- (void)setEndOfStream:(BOOL)e;
|
|
|
|
- (double)secondsBuffered;
|
|
|
|
@end
|