MusicKit  0.0.0
SndEnvelope.h
00001 
00002 //
00003 //  SndEnvelope.h
00004 //  SndKit
00005 //
00006 //  Created by stephen brandon on Mon Jun 23 2001. <stephen@brandonitconsulting.co.uk>
00007 //  Copyright (c) 2001, The MusicKit Project.  All rights reserved.
00008 //
00009 //  Permission is granted to use and modify this code for commercial and 
00010 //  non-commercial purposes so long as the author attribution and copyright
00011 //  messages remain intact and accompany all relevant code.
00012 //
00014 
00015 #ifndef __SNDENVELOPE_H__
00016 #define __SNDENVELOPE_H__
00017 
00018 #import <Foundation/Foundation.h>
00019 #import "SndBreakpoint.h"
00020 
00021 #define BP_NOT_FOUND (-1)
00022 
00067 @protocol SndEnveloping
00068 
00069 //- (double)lookupYForXAsymptotic:(double)xVal;
00070 
00081 - (float)lookupYForX:(double)xVal;
00082 
00091 - (int) breakpointIndexBeforeOrEqualToX:(double)xVal;
00092 
00099 - (int) breakpointIndexAfterX:(double)xVal;
00100 
00109 - (double) lookupXForBreakpoint:(int)bp;
00110 
00119 - (float) lookupYForBreakpoint:(int)bp;
00120 
00129 - (int) lookupFlagsForBreakpoint: (int) bp;
00130 
00135 - (int) breakpointCount;
00136 
00147 - (int) insertXValue: (double) xVal yValue: (float) yVal flags: (int) flags;
00148 
00164 - (int) insertXValue: (double) xVal yValue: (float) yVal flags: (int) flags atBreakpoint: (int) bp;
00165 
00171 - (BOOL) removeBreakpoint: (int) bp;
00172 
00179 - (BOOL) removeBreakpointsBefore: (int) aBreakpoint;
00180 
00187 - (BOOL) removeBreakpointsAfter: (int) aBreakpoint;
00188 
00201 - (BOOL) replaceXValue: (double) xVal yValue: (float) yVal flags: (int) flags atBreakpoint: (int) bp;
00202 
00203 @end
00204 
00219 @interface SndEnvelope : NSObject <SndEnveloping>
00220 {
00222   NSLock *lock;  
00224   NSMutableArray *breakpoints; 
00225 }
00226 
00234 - (int) breakpointIndexBeforeOrEqualToX:(double)xVal;
00235 
00242 - (int) breakpointIndexAfterX: (double) xVal;
00243 
00250 - (float) lookupYForBreakpoint: (int) bp;
00251 
00261 - (int) insertXValue: (double) xVal yValue: (float) yVal flags: (int) flags;
00262 
00273 - (int) insertXValue: (double) xVal yValue: (float) yVal flags: (int) flags atBreakpoint: (int) bp;
00274 
00281 - (BOOL) removeBreakpoint: (int) aBreakpoint;
00282 
00290 - (BOOL) removeBreakpointsBefore: (int) aBreakpoint;
00291 
00300 - (BOOL) removeBreakpointsAfter: (int) aBreakpoint;
00301 
00311 - (BOOL) replaceXValue: (double) xVal yValue: (float) yVal flags: (int) flags atBreakpoint: (int) bp;
00312 
00313 @end
00314 
00316 
00317 #endif