Update of /cvsroot/foo/foo/libfoo/FOO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17943 Modified Files: FOOBreakpointFunction.h FOOBufferManager.h FOOContext.h FOOContextPart.h FOOEagerModule.h FOOEagerModuleManager.h FOOGlobal.h FOOGlobalsManager.h FOOModule.h FOOModuleManager.h FOOObjectManager.h FOOOutput.h FOOOutputManager.h FOORegion.h FOOSoundFile.h FOOSoundStream.h FOOSubstrate.h FOOSubstrateManager.h Log Message: archivable kernel objects do conform to <NSCoding> protocol now Index: FOOContextPart.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOContextPart.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOContextPart.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOContextPart.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 43,47 **** ! @interface FOOContextPart : FOOObject { FOOContext *_context; --- 43,47 ---- ! @interface FOOContextPart : FOOObject <NSCoding> { FOOContext *_context; Index: FOOSoundFile.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOSoundFile.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOSoundFile.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOSoundFile.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 71,75 **** ! @interface FOOSoundFile : FOOSubstrate { NSString *_fileName; --- 71,75 ---- ! @interface FOOSoundFile : FOOSubstrate <NSCoding> { NSString *_fileName; Index: FOOGlobalsManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOGlobalsManager.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FOOGlobalsManager.h 4 Aug 2004 06:43:02 -0000 1.3 --- FOOGlobalsManager.h 13 Aug 2004 21:36:50 -0000 1.4 *************** *** 44,48 **** @class FOOLookupTable; ! #define SINXOVERX_POINTS_PER_TAP 500 --- 44,48 ---- @class FOOLookupTable; ! @class FOOContext; #define SINXOVERX_POINTS_PER_TAP 500 *************** *** 71,78 **** + (void) setTrace: (BOOL)val; - // this seems not to be used in foo - // + (void) loadClass: (NSString *)path; - // + (void) unloadLast; - + (void) schemeOutput: (NSString *)string; --- 71,74 ---- *************** *** 93,96 **** --- 89,95 ---- + (void) setDefaultBlockSize: (int)size; + + (BOOL) archiveContext: (FOOContext *)context toFile: (NSString *)path; + + (FOOContext *) unArchiveContextWithFile: (NSString *)path; + @end Index: FOOSubstrateManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOSubstrateManager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOSubstrateManager.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOSubstrateManager.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 41,45 **** ! @interface FOOSubstrateManager : FOOObjectManager { --- 41,45 ---- ! @interface FOOSubstrateManager : FOOObjectManager <NSCoding> { Index: FOOEagerModuleManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOEagerModuleManager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOEagerModuleManager.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOEagerModuleManager.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 41,45 **** ! @interface FOOEagerModuleManager : FOOObjectManager { --- 41,45 ---- ! @interface FOOEagerModuleManager : FOOObjectManager <NSCoding> { Index: FOOBreakpointFunction.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOBreakpointFunction.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOBreakpointFunction.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOBreakpointFunction.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 53,57 **** ! @interface FOOBreakpointFunction : FOOSubstrate { lineseg_t *_segments; --- 53,57 ---- ! @interface FOOBreakpointFunction : FOOSubstrate <NSCoding> { lineseg_t *_segments; Index: FOOOutput.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOOutput.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOOutput.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOOutput.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 45,49 **** ! @interface FOOOutput : FOOContextPart { FOOModule *_input; --- 45,49 ---- ! @interface FOOOutput : FOOContextPart <NSCoding> { FOOModule *_input; *************** *** 52,57 **** - (FOOOutput *) initWithChannel: (int)chan; ! - (FOOOutput *) connect: (FOOModule *) aModule; ! - (FOOOutput *) output: (FOOOutputManager *) outputManager; - (FOOOutput *) assignBuffers; --- 52,57 ---- - (FOOOutput *) initWithChannel: (int)chan; ! - (FOOOutput *) connect: (FOOModule *)aModule; ! - (FOOOutput *) output: (FOOOutputManager *)outputManager; - (FOOOutput *) assignBuffers; Index: FOOBufferManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOBufferManager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOBufferManager.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOBufferManager.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 45,49 **** ! @interface FOOBufferManager : FOOObjectManager { int _bufferSize; --- 45,49 ---- ! @interface FOOBufferManager : FOOObjectManager <NSCoding> { int _bufferSize; Index: FOOGlobal.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOGlobal.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOGlobal.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOGlobal.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 40,49 **** #include <assert.h> #include <math.h> #import <Foundation/NSString.h> #include <FOO/FOOGlobalsManager.h> ! typedef float sample_t; ! #define FOO_ERROR(ret, val) { \ NSString *_buffeR_; \ --- 40,51 ---- #include <assert.h> #include <math.h> + #include <string.h> + #import <Foundation/NSString.h> + #import <Foundation/NSException.h> #include <FOO/FOOGlobalsManager.h> ! /* error printing macro */ #define FOO_ERROR(ret, val) { \ NSString *_buffeR_; \ *************** *** 54,60 **** --- 56,144 ---- if (ret) return val; } + /* convenience stuff */ #define SAMPLERATE ([_context getSamplingRate]) #define SEC_TO_SAM(s) ((int) (rint((s) * SAMPLERATE))) #define SAM_TO_SEC(s) ((s) / SAMPLERATE) + + /* our sample type */ + typedef float sample_t; /* c typedef */ + #define SAMPLE_T @encode(float) /* objc encoded type string */ + + /* helper method to determine sample type with ObjC */ + #define IS_SAMPLE_T(comp_t) \ + ! strcmp(SAMPLE_T, (comp_t)) + + /* archiving data with sample type + * convenience macros for getting the right NSArchiver call */ + + /* REMINDER: whenever adding types here, remember to add them to + * FOOBreakpointFunction as well, since the _segments array of structs + * needs special treatment + */ + + /* keyed archiving */ + #define ENCODE_KEYED_SAMPLE_T(arch_data, arch_key) \ + if (IS_SAMPLE_T(@encode(float))) \ + { \ + [coder encodeFloat: arch_data forKey: arch_key]; \ + } \ + else if (IS_SAMPLE_T(@encode(double))) \ + { \ + [coder encodeDouble: arch_data forKey: arch_key]; \ + } \ + else \ + { \ + [NSException raise: @"FOOUnknownSampleFormatException" \ + format: @"sample_t neither float nor double"]; \ + } + + /* keyed unarchiving */ + #define DECODE_KEYED_SAMPLE_T(arch_data, arch_key) \ + if (IS_SAMPLE_T(@encode(float))) \ + { \ + arch_data = [coder decodeFloatForKey: arch_key]; \ + } \ + else if (IS_SAMPLE_T(@encode(double))) \ + { \ + arch_data = [coder decodeDoubleForKey: arch_key]; \ + } \ + else \ + { \ + [NSException raise: @"FOOUnknownSampleFormatException" \ + format: @"sample_t neither float nor double"]; \ + } + + /* non-keyed archiving */ + #define ENCODE_UNKEYED_SAMPLE_T(arch_data) \ + if (IS_SAMPLE_T(@encode(float))) \ + { \ + [coder encodeValueOfObjCType: @encode(float) at: &arch_data]; \ + } \ + if (IS_SAMPLE_T(@encode(double))) \ + { \ + [coder encodeValueOfObjCType: @encode(double) at: &arch_data]; \ + } \ + else \ + { \ + [NSException raise: @"FOOUnknownSampleFormatException" \ + format: @"sample_t neither float nor double"]; \ + } + + /* non-keyed unarchiving */ + #define DECODE_UNKEYED_SAMPLE_T(arch_data) \ + if (IS_SAMPLE_T(@encode(float))) \ + { \ + [coder decodeValueOfObjCType: @encode(float) at: &arch_data]; \ + } \ + if (IS_SAMPLE_T(@encode(double))) \ + { \ + [coder decodeValueOfObjCType: @encode(double) at: &arch_data]; \ + } \ + else \ + { \ + [NSException raise: @"FOOUnknownSampleFormatException" \ + format: @"sample_t neither float nor double"]; \ + } + #endif /* #ifndef FOO_FOOGLOBAL_H_INCLUDED */ Index: FOOObjectManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOObjectManager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOObjectManager.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOObjectManager.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 44,48 **** ! @interface FOOObjectManager : FOOObject { NSMutableArray* _objects; --- 44,48 ---- ! @interface FOOObjectManager : FOOObject <NSCoding> { NSMutableArray* _objects; Index: FOOSoundStream.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOSoundStream.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOSoundStream.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOSoundStream.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 45,49 **** ! @interface FOOSoundStream : FOOSubstrate { FOOSoundFile *_soundFile; --- 45,49 ---- ! @interface FOOSoundStream : FOOSubstrate <NSCoding> { FOOSoundFile *_soundFile; Index: FOOSubstrate.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOSubstrate.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOSubstrate.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOSubstrate.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 42,46 **** ! @interface FOOSubstrate : FOOContextPart { --- 42,46 ---- ! @interface FOOSubstrate : FOOContextPart <NSCoding> { Index: FOOModuleManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOModuleManager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOModuleManager.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOModuleManager.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 41,45 **** ! @interface FOOModuleManager : FOOObjectManager { --- 41,45 ---- ! @interface FOOModuleManager : FOOObjectManager <NSCoding> { Index: FOOModule.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOModule.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOModule.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOModule.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 76,80 **** ! @interface FOOModule : FOOContextPart { NSMutableArray *_inputs; --- 76,80 ---- ! @interface FOOModule : FOOContextPart <NSCoding> { NSMutableArray *_inputs; Index: FOOContext.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOContext.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOContext.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOContext.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 58,62 **** // extern id getCurrentContext(); // exported by ../objc/context.m ! @interface FOOContext : FOOObject { double _time; --- 58,62 ---- // extern id getCurrentContext(); // exported by ../objc/context.m ! @interface FOOContext : FOOObject <NSCoding> { double _time; Index: FOOOutputManager.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOOutputManager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOOutputManager.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOOutputManager.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 49,53 **** ! @interface FOOOutputManager : FOOObjectManager { FOOContext *_context; --- 49,53 ---- ! @interface FOOOutputManager : FOOObjectManager <NSCoding> { FOOContext *_context; Index: FOOEagerModule.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOOEagerModule.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOOEagerModule.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOOEagerModule.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 40,44 **** #include <FOO/FOOModule.h> ! @interface FOOEagerModule : FOOModule { --- 40,44 ---- #include <FOO/FOOModule.h> ! @interface FOOEagerModule : FOOModule <NSCoding> { Index: FOORegion.h =================================================================== RCS file: /cvsroot/foo/foo/libfoo/FOO/FOORegion.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FOORegion.h 4 Aug 2004 06:15:57 -0000 1.2 --- FOORegion.h 13 Aug 2004 21:36:50 -0000 1.3 *************** *** 42,46 **** ! @interface FOORegion : FOOSubstrate { /* Substrate *substrate; // statically typed */ --- 42,46 ---- ! @interface FOORegion : FOOSubstrate <NSCoding> { /* Substrate *substrate; // statically typed */ |