[gambit-list] Troubles wrapping libao and libvorbisfile with C-interface

Wy nn wwwwyyyynnnn at gmail.com
Wed May 20 14:41:51 EDT 2015


Marshall,

Passing around byte vectors you probably want to do as u8vector
scheme-object:s. I would guess right now you have a translation problem
between the C and Scheme world of your buffer data pointer, and maybe that
whole thing is messed up so it's surprising your program doesn't crash.
foreign-address is your friend also.



2015-05-20 23:53 GMT+05:30 Marshall Mason <marshallmason2 at gmail.com>:

> Hello,
> I'm new to Gambit, and to help me learn it, I'm trying to interface with
> some C libraries, libao and libvorbisfile. It should play a simple Ogg
> Vorbis sound file. It compiles and runs without error, but no sound is
> played. I'm wondering if someone can help me with it. Here is the code:
> http://pastie.org/10199051
>
> I've narrowed the culprit to the named let toward the bottom, called
> read-some. If, instead of this, I just implemented the whole loop in C, it
> works. Here is the code that works:
> http://pastie.org/10199086
>
> Although this works, I'd like to understand why it doesn't work the first
> way. My suspicion is that this has something to do with the character array
> that holds the decoded buffer, called *pcmout*. I've tried using a
> nonnull-char-string, but this created errors, so I created a
> make-char-array function, to ensure that the string was the proper size.
> The manual was unclear about how to do that.
>
> Anyone want to take a stab at this? Here's the version of Gambit I'm using:
>
> v4.7.4 20150228031125 x86_64-unknown-linux-gnu "./configure
> '--enable-single-host' '--enable-c-opt' '--enable-gcc-opts'"
>
> Thanks,
> Marshall
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150521/c23871a2/attachment.htm>


More information about the Gambit-list mailing list