cog/Audio/Chain/Node.h

77 lines
1.7 KiB
C
Raw Normal View History

2006-01-20 15:34:02 +00:00
//
// Node.h
2006-01-20 15:34:02 +00:00
// CogNew
//
// Created by Vincent Spader on 1/4/06.
// Copyright 2006 Vincent Spader. All rights reserved.
2006-01-20 15:34:02 +00:00
//
#import "ChunkList.h"
#import <CogAudio/CogSemaphore.h>
#import <Cocoa/Cocoa.h>
2006-01-20 15:34:02 +00:00
#import <os/workgroup.h>
#define BUFFER_SIZE 1024 * 1024
2006-01-20 15:34:02 +00:00
#define CHUNK_SIZE 16 * 1024
@interface Node : NSObject {
ChunkList *buffer;
Semaphore *semaphore;
NSLock *accessLock;
id __weak previousNode;
id __weak controller;
BOOL shouldReset;
BOOL shouldContinue;
BOOL endOfStream; // All data is now in buffer
BOOL initialBufferFilled;
AudioStreamBasicDescription nodeFormat;
uint32_t nodeChannelConfig;
BOOL nodeLossless;
2006-01-20 15:34:02 +00:00
}
- (id _Nullable)initWithController:(id _Nonnull)c previous:(id _Nullable)p;
2006-01-20 15:34:02 +00:00
- (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;
- (BOOL)peekFormat:(AudioStreamBasicDescription *_Nonnull)format channelConfig:(uint32_t *_Nonnull)config;
2006-01-20 15:34:02 +00:00
- (void)process; // Should be overwriten by subclass
- (void)threadEntry:(id _Nullable)arg;
2006-01-20 15:34:02 +00:00
- (void)launchThread;
- (void)setShouldReset:(BOOL)s;
- (BOOL)shouldReset;
- (void)setPreviousNode:(id _Nullable)p;
- (id _Nullable)previousNode;
2006-01-20 15:34:02 +00:00
- (BOOL)shouldContinue;
- (void)setShouldContinue:(BOOL)s;
- (ChunkList *_Nonnull)buffer;
- (void)resetBuffer; // WARNING! DANGER WILL ROBINSON!
2006-01-20 15:34:02 +00:00
- (AudioStreamBasicDescription)nodeFormat;
- (uint32_t)nodeChannelConfig;
- (BOOL)nodeLossless;
- (Semaphore *_Nonnull)semaphore;
2006-01-20 15:34:02 +00:00
//-(void)resetBuffer;
- (BOOL)endOfStream;
- (void)setEndOfStream:(BOOL)e;
2006-01-20 15:34:02 +00:00
- (double)secondsBuffered;
2006-01-20 15:34:02 +00:00
@end