I'm trying to re-implement the PlaySoftMIDI example from the Xcode installation in MacRuby, but am getting parameter errors. Could some kind soul point me in the right direction?

Below is a small example that ends with a parameter error. The call to NewAUGraph appears to work, returning a zero, but the call to AUGraphAddNode returns -50.

framework 'AudioToolbox'
framework 'AudioUnit'
load_bridge_support_file 'bridgesupport/Application.bridgesupport'
load_bridge_support_file 'bridgesupport/AudioToolbox.bridgesupport'
load_bridge_support_file 'bridgesupport/AudioUnit.bridgesupport'

outGraph = Pointer.new_with_type '^{OpaqueAUGraph}'
result = NewAUGraph outGraph  # returns 0
puts result

cd = ComponentDescription.new
cd.componentManufacturer = KAudioUnitManufacturer_Apple
cd.componentType         = KAudioUnitType_MusicDevice
cd.componentSubType      = KAudioUnitSubType_DLSSynth

cd_ptr = Pointer.new_with_type '{ComponentDescription=IIIII}'
cd_ptr.assign cd

synthNode = Pointer.new_with_type 'i'

result = AUGraphAddNode outGraph[0], cd_ptr, synthNode  # returns -50
puts result


I generated the bridge support files with

gen_bridge_metadata -f AudioToolbox -o AudioToolbox.bridgesupport
gen_bridge_metadata -f AudioUnit -o AudioUnit.bridgesupport

The Application.bridgesupport file contains struct and cftype definitions for ComponentDescription. They were generated using a header file since I couldn't figure out how to generate them from the CarbonCore framework directly. Any help would be appreciated.


Thanks,
Ed

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to