2006-01-20 12:34:02 -03:00
|
|
|
//
|
2006-04-02 11:44:08 -04:00
|
|
|
// Node.h
|
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
|
|
|
//
|
|
|
|
|
2022-02-06 08:08:34 -03:00
|
|
|
#import "ChunkList.h"
|
2006-01-20 12:34:02 -03:00
|
|
|
#import "Semaphore.h"
|
2022-02-07 02:49:27 -03:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2006-01-20 12:34:02 -03:00
|
|
|
|
2007-03-04 13:00:26 -03:00
|
|
|
#define BUFFER_SIZE 1024 * 1024
|
2006-01-20 12:34:02 -03:00
|
|
|
#define CHUNK_SIZE 16 * 1024
|
|
|
|
|
|
|
|
@interface Node : NSObject {
|
2022-02-06 08:08:34 -03:00
|
|
|
ChunkList *buffer;
|
2022-02-07 02:49:27 -03:00
|
|
|
Semaphore *semaphore;
|
|
|
|
|
|
|
|
NSRecursiveLock *accessLock;
|
|
|
|
|
2016-05-05 17:05:39 -03:00
|
|
|
id __weak previousNode;
|
|
|
|
id __weak controller;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
2007-10-03 16:23:14 -04:00
|
|
|
BOOL shouldReset;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
|
|
|
BOOL shouldContinue;
|
|
|
|
BOOL endOfStream; // All data is now in buffer
|
2007-03-18 20:19:47 -04:00
|
|
|
BOOL initialBufferFilled;
|
2022-02-07 02:49:27 -03:00
|
|
|
|
|
|
|
AudioStreamBasicDescription nodeFormat;
|
|
|
|
BOOL nodeLossless;
|
2006-01-20 12:34:02 -03:00
|
|
|
}
|
2007-02-24 17:36:27 -03:00
|
|
|
- (id)initWithController:(id)c previous:(id)p;
|
2006-01-20 12:34:02 -03:00
|
|
|
|
2022-02-06 08:08:34 -03:00
|
|
|
- (void)writeData:(const void *)ptr amount:(size_t)a;
|
|
|
|
- (AudioChunk *)readChunk:(size_t)maxFrames;
|
2006-01-20 12:34:02 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)process; // Should be overwriten by subclass
|
2006-01-20 12:34:02 -03:00
|
|
|
- (void)threadEntry:(id)arg;
|
|
|
|
|
|
|
|
- (void)launchThread;
|
|
|
|
|
2007-10-03 16:23:14 -04:00
|
|
|
- (void)setShouldReset:(BOOL)s;
|
|
|
|
- (BOOL)shouldReset;
|
|
|
|
|
2008-02-15 23:46:19 -03:00
|
|
|
- (void)setPreviousNode:(id)p;
|
2006-01-20 12:34:02 -03:00
|
|
|
- (id)previousNode;
|
|
|
|
|
|
|
|
- (BOOL)shouldContinue;
|
|
|
|
- (void)setShouldContinue:(BOOL)s;
|
|
|
|
|
2022-02-06 08:08:34 -03:00
|
|
|
- (ChunkList *)buffer;
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)resetBuffer; // WARNING! DANGER WILL ROBINSON!
|
2006-01-20 12:34:02 -03:00
|
|
|
|
2022-02-06 08:08:34 -03:00
|
|
|
- (AudioStreamBasicDescription)nodeFormat;
|
|
|
|
- (BOOL)nodeLossless;
|
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
- (Semaphore *)semaphore;
|
|
|
|
|
2016-06-30 01:10:29 -04:00
|
|
|
//-(void)resetBuffer;
|
2007-10-03 16:23:14 -04:00
|
|
|
|
2006-04-02 11:44:08 -04:00
|
|
|
- (BOOL)endOfStream;
|
|
|
|
- (void)setEndOfStream:(BOOL)e;
|
2006-01-20 12:34:02 -03:00
|
|
|
|
2022-01-14 04:05:32 -03:00
|
|
|
- (double)secondsBuffered;
|
|
|
|
|
2006-01-20 12:34:02 -03:00
|
|
|
@end
|