[MacRuby] #1173: Impossible to have a pointer to an opaque structure
#1173: Impossible to have a pointer to an opaque structure ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- The following code: {{{ if ARGV.length != 1 puts "Usage: #{$0} /path/to/file" exit end def CheckError(err) return if err == 0 raise "CoreAudio Error" end framework "Foundation" framework "AudioUnit" framework "AudioToolbox" inputFilePath = ARGV[0] url = CFURLCreateFromFileSystemRepresentation(nil, inputFilePath, inputFilePath.bytesize, false) audioFilePtr = Pointer.new("^{OpaqueAudioFileID}") CheckError(AudioFileOpenURL(url, KAudioFileReadPermission, 0, audioFilePtr)) fileFormat = AudioStreamBasicDescription.new propSizePtr = Pointer.new("i") propSizePtr[0] = AudioStreamBasicDescription.size CheckError(AudioFileGetProperty(audioFilePtr[0], KAudioFilePropertyDataFormat, propSizePtr, fileFormat)) }}} results in an error: {{{ /Users/system/playfile.rb:23:in `<main>': unrecognized runtime type `{OpaqueAudioFileID}' (TypeError) }}} Dereferencing {{{audioFilePtr[0]}}} should probably just return a pointer object to an opaque structure. Being able to use {{{Pointer.new("^v")}}} instead of {{{Pointer.new("^{OpaqueAudioFileID}")}}} might be an other way to be able to use AudioFile ids. -- Ticket URL: <http://www.macruby.org/trac/ticket/1173> MacRuby <http://macruby.org/>
#1173: Impossible to have a pointer to an opaque structure ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by mred@…): The code works with the following changes: {{{ --- playFile1.rb 2011-02-28 19:17:19.000000000 -0500 +++ playFile2.rb 2011-02-28 19:17:45.000000000 -0500 @@ -16,10 +16,12 @@ url = CFURLCreateFromFileSystemRepresentation(nil, inputFilePath, inputFilePath.bytesize, false) -audioFilePtr = Pointer.new("^{OpaqueAudioFileID}") +audioFilePtr = Pointer.new AudioFileID.type CheckError(AudioFileOpenURL(url, KAudioFileReadPermission, 0, audioFilePtr)) fileFormat = AudioStreamBasicDescription.new -propSizePtr = Pointer.new("i") +propSizePtr = Pointer.new("I") propSizePtr[0] = AudioStreamBasicDescription.size -CheckError(AudioFileGetProperty(audioFilePtr[0], KAudioFilePropertyDataFormat, propSizePtr, fileFormat)) +fileFormat_ptr = Pointer.new AudioStreamBasicDescription.type +fileFormat_ptr[0] = fileFormat +CheckError(AudioFileGetProperty(audioFilePtr[0],KAudioFilePropertyDataFormat, propSizePtr, fileFormat_ptr)) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1173#comment:1> MacRuby <http://macruby.org/>
#1173: Impossible to have a pointer to an opaque structure ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by leothompson@…): It is good that we are able to receive the <a href="http://goodfinance- blog.com/topics/personal-loans">personal loans</a> and that opens new chances. -- Ticket URL: <http://www.macruby.org/trac/ticket/1173#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby