#import "IAudioCapture.h" //#import "api_generator/common/ruby_helpers.h" #import "ruby/ext/rho/rhoruby.h" #import "api_generator/iphone/CMethodResult.h" #import "api_generator/iphone/CRubyConverter.h" extern VALUE getRuby_AudioCapture_Module(); @interface AudioCapture_RubyValueFactory : NSObject { } - (VALUE) makeRubyValue:(NSObject*)obj; + (AudioCapture_RubyValueFactory*) getSharedInstance; @end static AudioCapture_RubyValueFactory* our_AudioCapture_RubyValueFactory = nil; @implementation AudioCapture_RubyValueFactory - (VALUE) makeRubyValue:(NSObject*)obj { VALUE v = rho_ruby_get_NIL(); if ([obj isKindOfClass:[NSString class]]) { // single objects id NSString* strRes = (NSString*)obj; v = rho_ruby_create_object_with_id( getRuby_AudioCapture_Module(), [strRes UTF8String] ); } else if ([obj isKindOfClass:[NSArray class]]) { // list of IDs v = rho_ruby_create_array(); NSArray* arrRes = (NSArray*)obj; int i; for (i = 0; i < [arrRes count]; i++) { NSString* strItem = (NSString*)[arrRes objectAtIndex:i]; VALUE vItem = rho_ruby_create_object_with_id( getRuby_AudioCapture_Module(), [strItem UTF8String] ); rho_ruby_add_to_array(v, vItem); } } return v; } + (AudioCapture_RubyValueFactory*) getSharedInstance { if (our_AudioCapture_RubyValueFactory == nil) { our_AudioCapture_RubyValueFactory = [[AudioCapture_RubyValueFactory alloc] init]; } return our_AudioCapture_RubyValueFactory; } @end id AudioCapture_makeInstanceByRubyObject(VALUE obj) { const char* szID = rho_ruby_get_object_id( obj ); id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; return [factory getAudioCaptureByID:[NSString stringWithUTF8String:szID]]; } @interface rb_AudioCapture_getSource_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getSource_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getSource_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getSource_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getSource_caller_params* par = [[[rb_AudioCapture_getSource_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getSource_caller : NSObject { } +(rb_AudioCapture_getSource_caller*) getSharedInstance; +(void) getSource:(rb_AudioCapture_getSource_caller_params*)caller_params; +(void) getSource_in_thread:(rb_AudioCapture_getSource_caller_params*)caller_params; +(void) getSource_in_UI_thread:(rb_AudioCapture_getSource_caller_params*)caller_params; @end static rb_AudioCapture_getSource_caller* our_AudioCapture_getSource_caller = nil; @implementation rb_AudioCapture_getSource_caller +(rb_AudioCapture_getSource_caller*) getSharedInstance { if (our_AudioCapture_getSource_caller == nil) { our_AudioCapture_getSource_caller = [[rb_AudioCapture_getSource_caller alloc] init]; } return our_AudioCapture_getSource_caller; } -(void) command_getSource:(rb_AudioCapture_getSource_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getSource:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getSource:(rb_AudioCapture_getSource_caller_params*)caller_params { [[rb_AudioCapture_getSource_caller getSharedInstance] command_getSource:caller_params]; } +(void) getSource_in_thread:(rb_AudioCapture_getSource_caller_params*)caller_params { [[rb_AudioCapture_getSource_caller getSharedInstance] performSelectorInBackground:@selector(command_getSource:) withObject:caller_params]; } +(void) getSource_in_UI_thread:(rb_AudioCapture_getSource_caller_params*)caller_params { [[rb_AudioCapture_getSource_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getSource:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getSource_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::source"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getSource_caller getSource_in_thread:[rb_AudioCapture_getSource_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getSource_caller getSource:[rb_AudioCapture_getSource_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getSource(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getSource_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getSource(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getSource_Obj(argc, argv, item); } @interface rb_AudioCapture_setSource_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_setSource_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_setSource_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_setSource_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_setSource_caller_params* par = [[[rb_AudioCapture_setSource_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_setSource_caller : NSObject { } +(rb_AudioCapture_setSource_caller*) getSharedInstance; +(void) setSource:(rb_AudioCapture_setSource_caller_params*)caller_params; +(void) setSource_in_thread:(rb_AudioCapture_setSource_caller_params*)caller_params; +(void) setSource_in_UI_thread:(rb_AudioCapture_setSource_caller_params*)caller_params; @end static rb_AudioCapture_setSource_caller* our_AudioCapture_setSource_caller = nil; @implementation rb_AudioCapture_setSource_caller +(rb_AudioCapture_setSource_caller*) getSharedInstance { if (our_AudioCapture_setSource_caller == nil) { our_AudioCapture_setSource_caller = [[rb_AudioCapture_setSource_caller alloc] init]; } return our_AudioCapture_setSource_caller; } -(void) command_setSource:(rb_AudioCapture_setSource_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem setSource:(NSString*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) setSource:(rb_AudioCapture_setSource_caller_params*)caller_params { [[rb_AudioCapture_setSource_caller getSharedInstance] command_setSource:caller_params]; } +(void) setSource_in_thread:(rb_AudioCapture_setSource_caller_params*)caller_params { [[rb_AudioCapture_setSource_caller getSharedInstance] performSelectorInBackground:@selector(command_setSource:) withObject:caller_params]; } +(void) setSource_in_UI_thread:(rb_AudioCapture_setSource_caller_params*)caller_params { [[rb_AudioCapture_setSource_caller getSharedInstance] performSelectorOnMainThread:@selector(command_setSource:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_setSource_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::source="]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } params[0]= @"mic"; // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_setSource_caller setSource_in_thread:[rb_AudioCapture_setSource_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_setSource_caller setSource:[rb_AudioCapture_setSource_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_setSource(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_setSource_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_setSource(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_setSource_Obj(argc, argv, item); } @interface rb_AudioCapture_getEncoder_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getEncoder_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getEncoder_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getEncoder_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getEncoder_caller_params* par = [[[rb_AudioCapture_getEncoder_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getEncoder_caller : NSObject { } +(rb_AudioCapture_getEncoder_caller*) getSharedInstance; +(void) getEncoder:(rb_AudioCapture_getEncoder_caller_params*)caller_params; +(void) getEncoder_in_thread:(rb_AudioCapture_getEncoder_caller_params*)caller_params; +(void) getEncoder_in_UI_thread:(rb_AudioCapture_getEncoder_caller_params*)caller_params; @end static rb_AudioCapture_getEncoder_caller* our_AudioCapture_getEncoder_caller = nil; @implementation rb_AudioCapture_getEncoder_caller +(rb_AudioCapture_getEncoder_caller*) getSharedInstance { if (our_AudioCapture_getEncoder_caller == nil) { our_AudioCapture_getEncoder_caller = [[rb_AudioCapture_getEncoder_caller alloc] init]; } return our_AudioCapture_getEncoder_caller; } -(void) command_getEncoder:(rb_AudioCapture_getEncoder_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getEncoder:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getEncoder:(rb_AudioCapture_getEncoder_caller_params*)caller_params { [[rb_AudioCapture_getEncoder_caller getSharedInstance] command_getEncoder:caller_params]; } +(void) getEncoder_in_thread:(rb_AudioCapture_getEncoder_caller_params*)caller_params { [[rb_AudioCapture_getEncoder_caller getSharedInstance] performSelectorInBackground:@selector(command_getEncoder:) withObject:caller_params]; } +(void) getEncoder_in_UI_thread:(rb_AudioCapture_getEncoder_caller_params*)caller_params { [[rb_AudioCapture_getEncoder_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getEncoder:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getEncoder_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::encoder"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getEncoder_caller getEncoder_in_thread:[rb_AudioCapture_getEncoder_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getEncoder_caller getEncoder:[rb_AudioCapture_getEncoder_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getEncoder(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getEncoder_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getEncoder(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getEncoder_Obj(argc, argv, item); } @interface rb_AudioCapture_setEncoder_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_setEncoder_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_setEncoder_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_setEncoder_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_setEncoder_caller_params* par = [[[rb_AudioCapture_setEncoder_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_setEncoder_caller : NSObject { } +(rb_AudioCapture_setEncoder_caller*) getSharedInstance; +(void) setEncoder:(rb_AudioCapture_setEncoder_caller_params*)caller_params; +(void) setEncoder_in_thread:(rb_AudioCapture_setEncoder_caller_params*)caller_params; +(void) setEncoder_in_UI_thread:(rb_AudioCapture_setEncoder_caller_params*)caller_params; @end static rb_AudioCapture_setEncoder_caller* our_AudioCapture_setEncoder_caller = nil; @implementation rb_AudioCapture_setEncoder_caller +(rb_AudioCapture_setEncoder_caller*) getSharedInstance { if (our_AudioCapture_setEncoder_caller == nil) { our_AudioCapture_setEncoder_caller = [[rb_AudioCapture_setEncoder_caller alloc] init]; } return our_AudioCapture_setEncoder_caller; } -(void) command_setEncoder:(rb_AudioCapture_setEncoder_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem setEncoder:(NSString*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) setEncoder:(rb_AudioCapture_setEncoder_caller_params*)caller_params { [[rb_AudioCapture_setEncoder_caller getSharedInstance] command_setEncoder:caller_params]; } +(void) setEncoder_in_thread:(rb_AudioCapture_setEncoder_caller_params*)caller_params { [[rb_AudioCapture_setEncoder_caller getSharedInstance] performSelectorInBackground:@selector(command_setEncoder:) withObject:caller_params]; } +(void) setEncoder_in_UI_thread:(rb_AudioCapture_setEncoder_caller_params*)caller_params { [[rb_AudioCapture_setEncoder_caller getSharedInstance] performSelectorOnMainThread:@selector(command_setEncoder:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_setEncoder_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::encoder="]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_setEncoder_caller setEncoder_in_thread:[rb_AudioCapture_setEncoder_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_setEncoder_caller setEncoder:[rb_AudioCapture_setEncoder_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_setEncoder(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_setEncoder_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_setEncoder(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_setEncoder_Obj(argc, argv, item); } @interface rb_AudioCapture_getMaxDuration_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getMaxDuration_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getMaxDuration_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getMaxDuration_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getMaxDuration_caller_params* par = [[[rb_AudioCapture_getMaxDuration_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getMaxDuration_caller : NSObject { } +(rb_AudioCapture_getMaxDuration_caller*) getSharedInstance; +(void) getMaxDuration:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params; +(void) getMaxDuration_in_thread:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params; +(void) getMaxDuration_in_UI_thread:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params; @end static rb_AudioCapture_getMaxDuration_caller* our_AudioCapture_getMaxDuration_caller = nil; @implementation rb_AudioCapture_getMaxDuration_caller +(rb_AudioCapture_getMaxDuration_caller*) getSharedInstance { if (our_AudioCapture_getMaxDuration_caller == nil) { our_AudioCapture_getMaxDuration_caller = [[rb_AudioCapture_getMaxDuration_caller alloc] init]; } return our_AudioCapture_getMaxDuration_caller; } -(void) command_getMaxDuration:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getMaxDuration:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getMaxDuration:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params { [[rb_AudioCapture_getMaxDuration_caller getSharedInstance] command_getMaxDuration:caller_params]; } +(void) getMaxDuration_in_thread:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params { [[rb_AudioCapture_getMaxDuration_caller getSharedInstance] performSelectorInBackground:@selector(command_getMaxDuration:) withObject:caller_params]; } +(void) getMaxDuration_in_UI_thread:(rb_AudioCapture_getMaxDuration_caller_params*)caller_params { [[rb_AudioCapture_getMaxDuration_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getMaxDuration:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getMaxDuration_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::maxDuration"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getMaxDuration_caller getMaxDuration_in_thread:[rb_AudioCapture_getMaxDuration_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getMaxDuration_caller getMaxDuration:[rb_AudioCapture_getMaxDuration_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getMaxDuration(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getMaxDuration_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getMaxDuration(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getMaxDuration_Obj(argc, argv, item); } @interface rb_AudioCapture_setMaxDuration_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_setMaxDuration_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_setMaxDuration_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_setMaxDuration_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_setMaxDuration_caller_params* par = [[[rb_AudioCapture_setMaxDuration_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_setMaxDuration_caller : NSObject { } +(rb_AudioCapture_setMaxDuration_caller*) getSharedInstance; +(void) setMaxDuration:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params; +(void) setMaxDuration_in_thread:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params; +(void) setMaxDuration_in_UI_thread:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params; @end static rb_AudioCapture_setMaxDuration_caller* our_AudioCapture_setMaxDuration_caller = nil; @implementation rb_AudioCapture_setMaxDuration_caller +(rb_AudioCapture_setMaxDuration_caller*) getSharedInstance { if (our_AudioCapture_setMaxDuration_caller == nil) { our_AudioCapture_setMaxDuration_caller = [[rb_AudioCapture_setMaxDuration_caller alloc] init]; } return our_AudioCapture_setMaxDuration_caller; } -(void) command_setMaxDuration:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem setMaxDuration:(int)[((NSNumber*)[params objectAtIndex:0]) intValue] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) setMaxDuration:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params { [[rb_AudioCapture_setMaxDuration_caller getSharedInstance] command_setMaxDuration:caller_params]; } +(void) setMaxDuration_in_thread:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params { [[rb_AudioCapture_setMaxDuration_caller getSharedInstance] performSelectorInBackground:@selector(command_setMaxDuration:) withObject:caller_params]; } +(void) setMaxDuration_in_UI_thread:(rb_AudioCapture_setMaxDuration_caller_params*)caller_params { [[rb_AudioCapture_setMaxDuration_caller getSharedInstance] performSelectorOnMainThread:@selector(command_setMaxDuration:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_setMaxDuration_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::maxDuration="]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } params[0]= [NSNumber numberWithInt:20000]; // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_setMaxDuration_caller setMaxDuration_in_thread:[rb_AudioCapture_setMaxDuration_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_setMaxDuration_caller setMaxDuration:[rb_AudioCapture_setMaxDuration_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_setMaxDuration(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_setMaxDuration_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_setMaxDuration(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_setMaxDuration_Obj(argc, argv, item); } @interface rb_AudioCapture_getFileName_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getFileName_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getFileName_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getFileName_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getFileName_caller_params* par = [[[rb_AudioCapture_getFileName_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getFileName_caller : NSObject { } +(rb_AudioCapture_getFileName_caller*) getSharedInstance; +(void) getFileName:(rb_AudioCapture_getFileName_caller_params*)caller_params; +(void) getFileName_in_thread:(rb_AudioCapture_getFileName_caller_params*)caller_params; +(void) getFileName_in_UI_thread:(rb_AudioCapture_getFileName_caller_params*)caller_params; @end static rb_AudioCapture_getFileName_caller* our_AudioCapture_getFileName_caller = nil; @implementation rb_AudioCapture_getFileName_caller +(rb_AudioCapture_getFileName_caller*) getSharedInstance { if (our_AudioCapture_getFileName_caller == nil) { our_AudioCapture_getFileName_caller = [[rb_AudioCapture_getFileName_caller alloc] init]; } return our_AudioCapture_getFileName_caller; } -(void) command_getFileName:(rb_AudioCapture_getFileName_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getFileName:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getFileName:(rb_AudioCapture_getFileName_caller_params*)caller_params { [[rb_AudioCapture_getFileName_caller getSharedInstance] command_getFileName:caller_params]; } +(void) getFileName_in_thread:(rb_AudioCapture_getFileName_caller_params*)caller_params { [[rb_AudioCapture_getFileName_caller getSharedInstance] performSelectorInBackground:@selector(command_getFileName:) withObject:caller_params]; } +(void) getFileName_in_UI_thread:(rb_AudioCapture_getFileName_caller_params*)caller_params { [[rb_AudioCapture_getFileName_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getFileName:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getFileName_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::fileName"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getFileName_caller getFileName_in_thread:[rb_AudioCapture_getFileName_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getFileName_caller getFileName:[rb_AudioCapture_getFileName_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getFileName(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getFileName_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getFileName(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getFileName_Obj(argc, argv, item); } @interface rb_AudioCapture_setFileName_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_setFileName_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_setFileName_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_setFileName_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_setFileName_caller_params* par = [[[rb_AudioCapture_setFileName_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_setFileName_caller : NSObject { } +(rb_AudioCapture_setFileName_caller*) getSharedInstance; +(void) setFileName:(rb_AudioCapture_setFileName_caller_params*)caller_params; +(void) setFileName_in_thread:(rb_AudioCapture_setFileName_caller_params*)caller_params; +(void) setFileName_in_UI_thread:(rb_AudioCapture_setFileName_caller_params*)caller_params; @end static rb_AudioCapture_setFileName_caller* our_AudioCapture_setFileName_caller = nil; @implementation rb_AudioCapture_setFileName_caller +(rb_AudioCapture_setFileName_caller*) getSharedInstance { if (our_AudioCapture_setFileName_caller == nil) { our_AudioCapture_setFileName_caller = [[rb_AudioCapture_setFileName_caller alloc] init]; } return our_AudioCapture_setFileName_caller; } -(void) command_setFileName:(rb_AudioCapture_setFileName_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem setFileName:(NSString*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) setFileName:(rb_AudioCapture_setFileName_caller_params*)caller_params { [[rb_AudioCapture_setFileName_caller getSharedInstance] command_setFileName:caller_params]; } +(void) setFileName_in_thread:(rb_AudioCapture_setFileName_caller_params*)caller_params { [[rb_AudioCapture_setFileName_caller getSharedInstance] performSelectorInBackground:@selector(command_setFileName:) withObject:caller_params]; } +(void) setFileName_in_UI_thread:(rb_AudioCapture_setFileName_caller_params*)caller_params { [[rb_AudioCapture_setFileName_caller getSharedInstance] performSelectorOnMainThread:@selector(command_setFileName:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_setFileName_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::fileName="]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_setFileName_caller setFileName_in_thread:[rb_AudioCapture_setFileName_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_setFileName_caller setFileName:[rb_AudioCapture_setFileName_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_setFileName(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_setFileName_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_setFileName(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_setFileName_Obj(argc, argv, item); } @interface rb_AudioCapture_start_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_start_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_start_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_start_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_start_caller_params* par = [[[rb_AudioCapture_start_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_start_caller : NSObject { } +(rb_AudioCapture_start_caller*) getSharedInstance; +(void) start:(rb_AudioCapture_start_caller_params*)caller_params; +(void) start_in_thread:(rb_AudioCapture_start_caller_params*)caller_params; +(void) start_in_UI_thread:(rb_AudioCapture_start_caller_params*)caller_params; @end static rb_AudioCapture_start_caller* our_AudioCapture_start_caller = nil; @implementation rb_AudioCapture_start_caller +(rb_AudioCapture_start_caller*) getSharedInstance { if (our_AudioCapture_start_caller == nil) { our_AudioCapture_start_caller = [[rb_AudioCapture_start_caller alloc] init]; } return our_AudioCapture_start_caller; } -(void) command_start:(rb_AudioCapture_start_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem start:(NSDictionary*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) start:(rb_AudioCapture_start_caller_params*)caller_params { [[rb_AudioCapture_start_caller getSharedInstance] command_start:caller_params]; } +(void) start_in_thread:(rb_AudioCapture_start_caller_params*)caller_params { [[rb_AudioCapture_start_caller getSharedInstance] performSelectorInBackground:@selector(command_start:) withObject:caller_params]; } +(void) start_in_UI_thread:(rb_AudioCapture_start_caller_params*)caller_params { [[rb_AudioCapture_start_caller getSharedInstance] performSelectorOnMainThread:@selector(command_start:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_start_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::start"]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_start_caller start_in_thread:[rb_AudioCapture_start_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_start_caller start:[rb_AudioCapture_start_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_start(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_start_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_start(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_start_Obj(argc, argv, item); } @interface rb_AudioCapture_stop_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_stop_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_stop_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_stop_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_stop_caller_params* par = [[[rb_AudioCapture_stop_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_stop_caller : NSObject { } +(rb_AudioCapture_stop_caller*) getSharedInstance; +(void) stop:(rb_AudioCapture_stop_caller_params*)caller_params; +(void) stop_in_thread:(rb_AudioCapture_stop_caller_params*)caller_params; +(void) stop_in_UI_thread:(rb_AudioCapture_stop_caller_params*)caller_params; @end static rb_AudioCapture_stop_caller* our_AudioCapture_stop_caller = nil; @implementation rb_AudioCapture_stop_caller +(rb_AudioCapture_stop_caller*) getSharedInstance { if (our_AudioCapture_stop_caller == nil) { our_AudioCapture_stop_caller = [[rb_AudioCapture_stop_caller alloc] init]; } return our_AudioCapture_stop_caller; } -(void) command_stop:(rb_AudioCapture_stop_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem stop:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) stop:(rb_AudioCapture_stop_caller_params*)caller_params { [[rb_AudioCapture_stop_caller getSharedInstance] command_stop:caller_params]; } +(void) stop_in_thread:(rb_AudioCapture_stop_caller_params*)caller_params { [[rb_AudioCapture_stop_caller getSharedInstance] performSelectorInBackground:@selector(command_stop:) withObject:caller_params]; } +(void) stop_in_UI_thread:(rb_AudioCapture_stop_caller_params*)caller_params { [[rb_AudioCapture_stop_caller getSharedInstance] performSelectorOnMainThread:@selector(command_stop:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_stop_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::stop"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_stop_caller stop_in_thread:[rb_AudioCapture_stop_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_stop_caller stop_in_thread:[rb_AudioCapture_stop_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; method_return_result = NO; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_stop(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_stop_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_stop(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_stop_Obj(argc, argv, item); } @interface rb_AudioCapture_cancel_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_cancel_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_cancel_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_cancel_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_cancel_caller_params* par = [[[rb_AudioCapture_cancel_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_cancel_caller : NSObject { } +(rb_AudioCapture_cancel_caller*) getSharedInstance; +(void) cancel:(rb_AudioCapture_cancel_caller_params*)caller_params; +(void) cancel_in_thread:(rb_AudioCapture_cancel_caller_params*)caller_params; +(void) cancel_in_UI_thread:(rb_AudioCapture_cancel_caller_params*)caller_params; @end static rb_AudioCapture_cancel_caller* our_AudioCapture_cancel_caller = nil; @implementation rb_AudioCapture_cancel_caller +(rb_AudioCapture_cancel_caller*) getSharedInstance { if (our_AudioCapture_cancel_caller == nil) { our_AudioCapture_cancel_caller = [[rb_AudioCapture_cancel_caller alloc] init]; } return our_AudioCapture_cancel_caller; } -(void) command_cancel:(rb_AudioCapture_cancel_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem cancel:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) cancel:(rb_AudioCapture_cancel_caller_params*)caller_params { [[rb_AudioCapture_cancel_caller getSharedInstance] command_cancel:caller_params]; } +(void) cancel_in_thread:(rb_AudioCapture_cancel_caller_params*)caller_params { [[rb_AudioCapture_cancel_caller getSharedInstance] performSelectorInBackground:@selector(command_cancel:) withObject:caller_params]; } +(void) cancel_in_UI_thread:(rb_AudioCapture_cancel_caller_params*)caller_params { [[rb_AudioCapture_cancel_caller getSharedInstance] performSelectorOnMainThread:@selector(command_cancel:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_cancel_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::cancel"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_cancel_caller cancel_in_thread:[rb_AudioCapture_cancel_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_cancel_caller cancel_in_thread:[rb_AudioCapture_cancel_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; method_return_result = NO; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_cancel(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_cancel_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_cancel(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_cancel_Obj(argc, argv, item); } @interface rb_AudioCapture_getProperty_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getProperty_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getProperty_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getProperty_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getProperty_caller_params* par = [[[rb_AudioCapture_getProperty_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getProperty_caller : NSObject { } +(rb_AudioCapture_getProperty_caller*) getSharedInstance; +(void) getProperty:(rb_AudioCapture_getProperty_caller_params*)caller_params; +(void) getProperty_in_thread:(rb_AudioCapture_getProperty_caller_params*)caller_params; +(void) getProperty_in_UI_thread:(rb_AudioCapture_getProperty_caller_params*)caller_params; @end static rb_AudioCapture_getProperty_caller* our_AudioCapture_getProperty_caller = nil; @implementation rb_AudioCapture_getProperty_caller +(rb_AudioCapture_getProperty_caller*) getSharedInstance { if (our_AudioCapture_getProperty_caller == nil) { our_AudioCapture_getProperty_caller = [[rb_AudioCapture_getProperty_caller alloc] init]; } return our_AudioCapture_getProperty_caller; } -(void) command_getProperty:(rb_AudioCapture_getProperty_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getProperty:(NSString*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getProperty:(rb_AudioCapture_getProperty_caller_params*)caller_params { [[rb_AudioCapture_getProperty_caller getSharedInstance] command_getProperty:caller_params]; } +(void) getProperty_in_thread:(rb_AudioCapture_getProperty_caller_params*)caller_params { [[rb_AudioCapture_getProperty_caller getSharedInstance] performSelectorInBackground:@selector(command_getProperty:) withObject:caller_params]; } +(void) getProperty_in_UI_thread:(rb_AudioCapture_getProperty_caller_params*)caller_params { [[rb_AudioCapture_getProperty_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getProperty:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getProperty_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::getProperty"]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getProperty_caller getProperty_in_thread:[rb_AudioCapture_getProperty_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getProperty_caller getProperty:[rb_AudioCapture_getProperty_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getProperty(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getProperty_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getProperty(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getProperty_Obj(argc, argv, item); } @interface rb_AudioCapture_getProperties_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getProperties_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getProperties_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getProperties_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getProperties_caller_params* par = [[[rb_AudioCapture_getProperties_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getProperties_caller : NSObject { } +(rb_AudioCapture_getProperties_caller*) getSharedInstance; +(void) getProperties:(rb_AudioCapture_getProperties_caller_params*)caller_params; +(void) getProperties_in_thread:(rb_AudioCapture_getProperties_caller_params*)caller_params; +(void) getProperties_in_UI_thread:(rb_AudioCapture_getProperties_caller_params*)caller_params; @end static rb_AudioCapture_getProperties_caller* our_AudioCapture_getProperties_caller = nil; @implementation rb_AudioCapture_getProperties_caller +(rb_AudioCapture_getProperties_caller*) getSharedInstance { if (our_AudioCapture_getProperties_caller == nil) { our_AudioCapture_getProperties_caller = [[rb_AudioCapture_getProperties_caller alloc] init]; } return our_AudioCapture_getProperties_caller; } -(void) command_getProperties:(rb_AudioCapture_getProperties_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getProperties:(NSArray*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getProperties:(rb_AudioCapture_getProperties_caller_params*)caller_params { [[rb_AudioCapture_getProperties_caller getSharedInstance] command_getProperties:caller_params]; } +(void) getProperties_in_thread:(rb_AudioCapture_getProperties_caller_params*)caller_params { [[rb_AudioCapture_getProperties_caller getSharedInstance] performSelectorInBackground:@selector(command_getProperties:) withObject:caller_params]; } +(void) getProperties_in_UI_thread:(rb_AudioCapture_getProperties_caller_params*)caller_params { [[rb_AudioCapture_getProperties_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getProperties:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getProperties_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::getProperties"]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getProperties_caller getProperties_in_thread:[rb_AudioCapture_getProperties_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getProperties_caller getProperties:[rb_AudioCapture_getProperties_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getProperties(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getProperties_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getProperties(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getProperties_Obj(argc, argv, item); } @interface rb_AudioCapture_getAllProperties_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_getAllProperties_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_getAllProperties_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_getAllProperties_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_getAllProperties_caller_params* par = [[[rb_AudioCapture_getAllProperties_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_getAllProperties_caller : NSObject { } +(rb_AudioCapture_getAllProperties_caller*) getSharedInstance; +(void) getAllProperties:(rb_AudioCapture_getAllProperties_caller_params*)caller_params; +(void) getAllProperties_in_thread:(rb_AudioCapture_getAllProperties_caller_params*)caller_params; +(void) getAllProperties_in_UI_thread:(rb_AudioCapture_getAllProperties_caller_params*)caller_params; @end static rb_AudioCapture_getAllProperties_caller* our_AudioCapture_getAllProperties_caller = nil; @implementation rb_AudioCapture_getAllProperties_caller +(rb_AudioCapture_getAllProperties_caller*) getSharedInstance { if (our_AudioCapture_getAllProperties_caller == nil) { our_AudioCapture_getAllProperties_caller = [[rb_AudioCapture_getAllProperties_caller alloc] init]; } return our_AudioCapture_getAllProperties_caller; } -(void) command_getAllProperties:(rb_AudioCapture_getAllProperties_caller_params*)caller_params { id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem getAllProperties:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) getAllProperties:(rb_AudioCapture_getAllProperties_caller_params*)caller_params { [[rb_AudioCapture_getAllProperties_caller getSharedInstance] command_getAllProperties:caller_params]; } +(void) getAllProperties_in_thread:(rb_AudioCapture_getAllProperties_caller_params*)caller_params { [[rb_AudioCapture_getAllProperties_caller getSharedInstance] performSelectorInBackground:@selector(command_getAllProperties:) withObject:caller_params]; } +(void) getAllProperties_in_UI_thread:(rb_AudioCapture_getAllProperties_caller_params*)caller_params { [[rb_AudioCapture_getAllProperties_caller getSharedInstance] performSelectorOnMainThread:@selector(command_getAllProperties:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_getAllProperties_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[0+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::getAllProperties"]; BOOL is_factory_param[] = { NO }; int i; // init for (i = 0; i < (0); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (0); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(0)]; for (i = 0 ; i < (0); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (0+1)) { VALUE callback = argv[0]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (0+2)) { VALUE callback_param = argv[0+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_getAllProperties_caller getAllProperties_in_thread:[rb_AudioCapture_getAllProperties_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_getAllProperties_caller getAllProperties:[rb_AudioCapture_getAllProperties_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_getAllProperties(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_getAllProperties_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_getAllProperties(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_getAllProperties_Obj(argc, argv, item); } @interface rb_AudioCapture_setProperty_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_setProperty_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_setProperty_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_setProperty_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_setProperty_caller_params* par = [[[rb_AudioCapture_setProperty_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_setProperty_caller : NSObject { } +(rb_AudioCapture_setProperty_caller*) getSharedInstance; +(void) setProperty:(rb_AudioCapture_setProperty_caller_params*)caller_params; +(void) setProperty_in_thread:(rb_AudioCapture_setProperty_caller_params*)caller_params; +(void) setProperty_in_UI_thread:(rb_AudioCapture_setProperty_caller_params*)caller_params; @end static rb_AudioCapture_setProperty_caller* our_AudioCapture_setProperty_caller = nil; @implementation rb_AudioCapture_setProperty_caller +(rb_AudioCapture_setProperty_caller*) getSharedInstance { if (our_AudioCapture_setProperty_caller == nil) { our_AudioCapture_setProperty_caller = [[rb_AudioCapture_setProperty_caller alloc] init]; } return our_AudioCapture_setProperty_caller; } -(void) command_setProperty:(rb_AudioCapture_setProperty_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem setProperty:(NSString*)[params objectAtIndex:0] propertyValue:(NSString*)[params objectAtIndex:1] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) setProperty:(rb_AudioCapture_setProperty_caller_params*)caller_params { [[rb_AudioCapture_setProperty_caller getSharedInstance] command_setProperty:caller_params]; } +(void) setProperty_in_thread:(rb_AudioCapture_setProperty_caller_params*)caller_params { [[rb_AudioCapture_setProperty_caller getSharedInstance] performSelectorInBackground:@selector(command_setProperty:) withObject:caller_params]; } +(void) setProperty_in_UI_thread:(rb_AudioCapture_setProperty_caller_params*)caller_params { [[rb_AudioCapture_setProperty_caller getSharedInstance] performSelectorOnMainThread:@selector(command_setProperty:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_setProperty_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[2+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::setProperty"]; BOOL is_factory_param[] = { NO, NO, NO }; int i; // init for (i = 0; i < (2); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (2); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(2)]; for (i = 0 ; i < (2); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (2+1)) { VALUE callback = argv[2]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (2+2)) { VALUE callback_param = argv[2+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_setProperty_caller setProperty_in_thread:[rb_AudioCapture_setProperty_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_setProperty_caller setProperty:[rb_AudioCapture_setProperty_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_setProperty(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_setProperty_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_setProperty(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_setProperty_Obj(argc, argv, item); } @interface rb_AudioCapture_setProperties_caller_params : NSObject @property (nonatomic, copy) NSArray* params; @property (assign) id item; @property (assign) CMethodResult* methodResult; -(void)dealloc; +(rb_AudioCapture_setProperties_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult; @end @implementation rb_AudioCapture_setProperties_caller_params @synthesize params,item,methodResult; -(void)dealloc { [params release]; [super dealloc]; } +(rb_AudioCapture_setProperties_caller_params*) makeParams:(NSArray*)_params _item:(id)_item _methodResult:(CMethodResult*)_methodResult { rb_AudioCapture_setProperties_caller_params* par = [[[rb_AudioCapture_setProperties_caller_params alloc] init] autorelease]; par.params = _params; par.item = _item; par.methodResult = [_methodResult retain]; return [par retain]; } @end @interface rb_AudioCapture_setProperties_caller : NSObject { } +(rb_AudioCapture_setProperties_caller*) getSharedInstance; +(void) setProperties:(rb_AudioCapture_setProperties_caller_params*)caller_params; +(void) setProperties_in_thread:(rb_AudioCapture_setProperties_caller_params*)caller_params; +(void) setProperties_in_UI_thread:(rb_AudioCapture_setProperties_caller_params*)caller_params; @end static rb_AudioCapture_setProperties_caller* our_AudioCapture_setProperties_caller = nil; @implementation rb_AudioCapture_setProperties_caller +(rb_AudioCapture_setProperties_caller*) getSharedInstance { if (our_AudioCapture_setProperties_caller == nil) { our_AudioCapture_setProperties_caller = [[rb_AudioCapture_setProperties_caller alloc] init]; } return our_AudioCapture_setProperties_caller; } -(void) command_setProperties:(rb_AudioCapture_setProperties_caller_params*)caller_params { NSArray* params = caller_params.params; id objItem = caller_params.item; CMethodResult* methodResult = caller_params.methodResult; [objItem setProperties:(NSDictionary*)[params objectAtIndex:0] methodResult:methodResult ]; [caller_params.methodResult release]; [caller_params release]; } +(void) setProperties:(rb_AudioCapture_setProperties_caller_params*)caller_params { [[rb_AudioCapture_setProperties_caller getSharedInstance] command_setProperties:caller_params]; } +(void) setProperties_in_thread:(rb_AudioCapture_setProperties_caller_params*)caller_params { [[rb_AudioCapture_setProperties_caller getSharedInstance] performSelectorInBackground:@selector(command_setProperties:) withObject:caller_params]; } +(void) setProperties_in_UI_thread:(rb_AudioCapture_setProperties_caller_params*)caller_params { [[rb_AudioCapture_setProperties_caller getSharedInstance] performSelectorOnMainThread:@selector(command_setProperties:) withObject:caller_params waitUntilDone:NO]; } @end VALUE rb_AudioCapture_setProperties_Obj(int argc, VALUE *argv, idobjItem) { CMethodResult* methodResult = [[CMethodResult alloc] init]; NSObject* params[1+1]; NSString* callbackURL = nil; unsigned long callbackMethod = 0; NSString* callbackParam = nil; BOOL method_return_result = YES; [methodResult setMethodSignature:@"AudioCapture::setProperties"]; BOOL is_factory_param[] = { NO, NO }; int i; // init for (i = 0; i < (1); i++) { params[i] = [NSNull null]; } // enumerate params for (int i = 0; i < (1); i++) { if (argc > i) { // we have a [i] param ! if (is_factory_param[i]) { params[i] = AudioCapture_makeInstanceByRubyObject(argv[i]); } else { params[i] = [[CRubyConverter convertFromRuby:argv[i]] retain]; } } } NSMutableArray* params_array = [NSMutableArray arrayWithCapacity:(1)]; for (i = 0 ; i < (1); i++) { [params_array addObject:params[i]]; } // check callback if (argc >= (1+1)) { VALUE callback = argv[1]; if (rho_ruby_is_string(callback)) { callbackURL = [((NSString*)[CRubyConverter convertFromRuby:callback]) retain]; } else if (rho_ruby_is_proc(callback) || rho_ruby_is_method(callback)) { callbackMethod = callback; } } // check callback param if (argc >= (1+2)) { VALUE callback_param = argv[1+1]; if (rho_ruby_is_string(callback_param)) { callbackParam = [((NSString*)[CRubyConverter convertFromRuby:callback_param]) retain]; } } if ((callbackURL != nil) || (callbackMethod != 0)) { // we have callback - method should not call setResult if method execute from current thread - only later or in UI or separated threads !!! if (callbackURL != nil) [methodResult setRubyCallback:callbackURL]; if (callbackMethod != 0) [methodResult setRubyCallbackMethod:callbackMethod]; if (callbackParam != nil) { [methodResult setCallbackParam:callbackParam]; } [rb_AudioCapture_setProperties_caller setProperties_in_thread:[rb_AudioCapture_setProperties_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; // FIXME: callback should not be retained, it must be saved outside of this call [methodResult retain]; } else { // we do not have callback [rb_AudioCapture_setProperties_caller setProperties:[rb_AudioCapture_setProperties_caller_params makeParams:params_array _item:objItem _methodResult:methodResult]]; } VALUE resValue = rho_ruby_get_NIL(); if ((callbackURL == nil) && (callbackMethod == 0) && (method_return_result)) { resValue = [methodResult toRuby]; } [methodResult release]; return resValue; } VALUE rb_AudioCapture_setProperties(int argc, VALUE *argv, VALUE obj) { id item = AudioCapture_makeInstanceByRubyObject(obj); return rb_AudioCapture_setProperties_Obj(argc, argv, item); } VALUE rb_s_AudioCapture_def_setProperties(int argc, VALUE *argv) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; id item = [factory getAudioCaptureByID:defID]; return rb_AudioCapture_setProperties_Obj(argc, argv, item); } VALUE rb_AudioCapture_s_default(VALUE klass) { id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; NSString* defID = [singleton getDefaultID]; return rho_ruby_create_object_with_id( klass, [defID UTF8String] ); } VALUE rb_AudioCapture_s_setDefault(VALUE klass, VALUE valObj) { const char* szID = rho_ruby_get_object_id( valObj ); id factory = [AudioCaptureFactorySingleton getAudioCaptureFactoryInstance]; id singleton = [factory getAudioCaptureSingleton]; [singleton setDefaultID:[NSString stringWithUTF8String:szID]]; return rho_ruby_get_NIL(); }