On 23 November 2013 09:07, Stéphane Ducasse <stephane.duca...@inria.fr>wrote:
> I really think that NativeBoost MUST HAVE a decent documentation. > i agree. i need to invest into it. > It is a central part of Pharo and Igor you should do something about it. > If I would know I would have written a chapter on it but I cannot because > I DO NOT KNOW. > > Stef > > > > > On 21 November 2013 22:40, Sean P. DeNigris <s...@clipperadams.com> wrote: > >> I'm wrapping the FMOD cross-platform audio library. The code is MIT and >> lives >> at http://smalltalkhub.com/#!/~SeanDeNigris/FMOD >> >> ======== >> Problem #1: >> ======== >> >> I'm calling into the FMOD library with: >> primStoreIsPlaying: channelHandle in: isPlayingHandle >> <primitive: #primitiveNativeCall module: #NativeBoostPlugin> >> >> "FMOD_RESULT FMOD_Channel_IsPlaying( >> FMOD_CHANNEL *channel, >> bool *isplaying);" >> >> ^ self nbCall: #(FMOD_RESULT >> FMOD_Channel_IsPlaying(NBExternalAddress >> channel, NBExternalAddress isPlayingHandle)). >> >> I call the above with: >> isPlaying >> | isPlaying | >> isPlaying := NBExternalAddress new. >> self primStoreIsPlaying: channel in: isPlaying. >> ^ isPlaying value > 0. >> >> isPlaying is always 0. The method works directly from C with: >> int isPlaying = 1; >> while (isPlaying) { >> FMOD_Channel_IsPlaying(channel, &isPlaying); >> } >> >> I also tried changing the callout signature to "... bool* >> isPlayingHandle)" >> and passing "isPlaying := true." instead of using the NBExternalAddress >> stuff. >> >> err.. again, you must pass an address where value will be stored, > > ^ self nbCall: #(FMOD_RESULT FMOD_Channel_IsPlaying( >> >> NBExternalAddress channel, NBExternalAddress * isPlayingHandle)). > > otherwise you passing NULL pointer, and i quite surprised it not segfaults > when you call it like that (looks like they have a check in the library ) > > you can also use NBExternalTypeValue for that: > > boolValueClass := NBExternalTypeValue ofType: 'bool'. "sure thing, > creating anonymous class for each call is overkill, this should be done > once, somewhere else" > > boolValue := boolValueClass new. > > self callTheThingWith: boolValue. > > boolValue value ifTrue: [... blah] > > (and this will work, assuming you have bool* in signature for this > argument). > > I have a few more questions, but this is the most pressing as it's holding >> up any further development. >> >> Thanks! >> >> >> >> ----- >> Cheers, >> Sean >> -- >> View this message in context: >> http://forum.world.st/NativeBoost-Questions-while-wrapping-FMOD-tp4724116.html >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. >> >> > > > -- > Best regards, > Igor Stasenko. > > > -- Best regards, Igor Stasenko.