Skip to content

Commit

Permalink
Fix breakage on Julia v0.4 related to ccall
Browse files Browse the repository at this point in the history
The ccall function implementation was changed. It is stricter now. Use "&nothing" to indicate a NULL pointer.
  • Loading branch information
danielcasimirosonos committed Mar 8, 2015
1 parent 44bf337 commit 7ed82cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/wavplay-audioqueue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function AudioQueueEnqueueBuffer(aq, bufPtr, data)
const result = ccall((:AudioQueueEnqueueBuffer, AudioToolbox),
OSStatus,
(AudioQueueRef, AudioQueueBufferRef, UInt32, Ptr{Void}),
aq, bufPtr, 0, 0)
aq, bufPtr, 0, &nothing)
if result != 0
error("AudioQueueEnqueueBuffer failed with $result")
end
Expand Down Expand Up @@ -259,7 +259,7 @@ function AudioQueueNewOutput(format::AudioStreamBasicDescription, userData::Audi
(Ptr{AudioQueueData}, AudioQueueRef, AudioQueueBufferRef))
const result =
ccall((:AudioQueueNewOutput, AudioToolbox), OSStatus,
(Ptr{AudioStreamBasicDescription}, Ptr{Void}, Ptr{Void}, CFRunLoopRef, CFStringRef, UInt32, Ptr{AudioQueueRef}),
(Ptr{AudioStreamBasicDescription}, Ptr{Void}, Ptr{AudioQueueData}, CFRunLoopRef, CFStringRef, UInt32, Ptr{AudioQueueRef}),
&format, cCallbackProc, &userData, runLoop, runLoopMode, 0, newAudioQueue)
if result != 0
error("AudioQueueNewOutput failed with $result")
Expand Down Expand Up @@ -288,8 +288,10 @@ end
# referenced to the sample frame timeline of the associated audio device. May be NULL.
# @result An OSStatus result code.
function AudioQueueStart(aq)
# The second parameter of AudioQueueStart is "AudioTimeStamp," but I don't know how
# to pass a "NULL" AudioTimeStamp pointer.
const result = ccall((:AudioQueueStart, AudioToolbox), OSStatus,
(AudioQueueRef, Ptr{AudioTimeStamp}), aq, 0)
(AudioQueueRef, Ptr{Void}), aq, &nothing)

This comment has been minimized.

Copy link
@stevengj

stevengj Mar 11, 2015

This doesn't seem right to me. If you want to pass a null pointer, shouldn't you pass C_NULL?

This comment has been minimized.

Copy link
@dancasimiro

dancasimiro Mar 12, 2015

Owner

Yes, I think that passing C_NULL works better. It is fixed in bead96b.

if result != 0
error("AudioQueueStart failed with $result")
end
Expand Down

0 comments on commit 7ed82cb

Please sign in to comment.