[MacRuby-devel] [MacRuby] #733: Proc as callback function for CoreAudio(AudioDeviceCreateIOProcID) isn't called

MacRuby ruby-noreply at macosforge.org
Wed Jun 2 08:27:08 PDT 2010


#733: Proc as callback function for CoreAudio(AudioDeviceCreateIOProcID) isn't
called
-----------------------------------+----------------------------------------
 Reporter:  nagachika00@…          |       Owner:  lsansonetti@…        
     Type:  defect                 |      Status:  new                  
 Priority:  blocker                |   Milestone:                       
Component:  MacRuby                |    Keywords:                       
-----------------------------------+----------------------------------------

Comment(by nagachika00@…):

 Replying to [comment:1 martinlagardette@…]:

 Thank you for your inspection the problem. I have two questions.

 >  - MacRuby doesn't know yet how to convert a C function pointer to a
 Ruby Proc. I'll try to see if I can do that.
 Did you mean that MacRuby cannot make callback Proc Object for function
 pointer returned from last argument of AudioDeviceCreateIOProcID()?
 The signature of AudioDeviceCreateIOProcID() is as below.
 {{{
 AudioDeviceCreateIOProcID(
     AudioDeviceID       inDevice,
     AudioDeviceIOProc   inProc,
     void                *inClientData,
     AudioDeviceIOProcID *outIOProcID)
 }}}
 AudioDeviceIOProcID is typedef-ed to AudioDeviceIOProc. I tried to
 experiment in C program to examine relationship between second and forth
 argument of AudioDeviceCreateIOProcID().

 {{{
 $ cat test.m
 --- snip ---
 status = AudioDeviceCreateIOProcID(devID, IOProc, NULL, &procID);
 printf("proc ID = %p\n", (void *)procID);
 printf("IOProc = %p\n", (void*)IOProc);
 --- snip ---
 $ gcc -o test test.m -framework CoreAudio
 $ ./test
 proc ID = 0x100111340
 IOProc = 0x100000ae8
 }}}
 The pointer to function passed to second argument 'IOProc' is differ to
 returned AudioDeviceIOProcID 'procID'. Surely call 'procID' as function
 cause bus error. When I call AudioDeviceStart() with 'procID', CoreAudio
 start to invoke callback function 'IOProc'.
 So I think CoreAudio can call Ruby Proc object via stub callback function
 passed to second argument. Is this my misconception?

 >In any case, even if I fix the two MacRuby's problems, CoreAudio's
 BridgeSupport is not correct and will have to be modified manually for it
 to work.
 If I want to distribute my MacRuby Application, can I include modified
 version of BridgeSupport file with it, and let MacRuby use it instead of
 system's one?

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/733#comment:2>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list