reviving the ao luarock

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

reviving the ao luarock

Peter Billam
Greeitngs.  I hope this is the appropriate forum...
Judging from http://thelinx.github.io/lao/
ao is just exactly what I need :-)
so I tried  luarocks install ao  and got
  ao> lua ao_example.lua
  lua: error loading module 'ao' from file
'/usr/local/lib/lua/5.2/ao.so':
     /usr/local/lib/lua/5.2/ao.so: undefined symbol: luaL_register

so presumably it needs something like what I normally use:
  #if LUA_VERSION_NUM >= 502
     luaL_setfuncs(L, prv, 0);    /* 5.2 */
     return 0;
  #else
     luaL_register(L, NULL, prv); /* 5.1 */
     return 0;
  #endif

so I did
  git clone https://github.com/thelinx/lao
and in src/lao.c I tried to replace the
  luaL_register(L, "ao", ao);
line, but couldn't get it compiled because the way lao.c returns the
module is different ... it's probably elementary ...

It's a shame that such a neat little module isn't maintained any more.
I could probably coerce it into my usual way of doing things,
but I'm a bit old to take on more modules. And I'm not sure
that anyone's listening for pull requests on thelinx/lao

Suggestions gratefully received...

Regards,  Peter Billam

http://www.pjb.com.au     [hidden email]     (03) 6278 9410
"Follow the charge, not the particle."  --  Richard Feynman
  from The Theory of Positrons, Physical Review, 1949

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reviving the ao luarock

Daurnimator
On 3 August 2017 at 11:51, Peter Billam <[hidden email]> wrote:

> Greeitngs.  I hope this is the appropriate forum...
> Judging from http://thelinx.github.io/lao/
> ao is just exactly what I need :-)
> so I tried  luarocks install ao  and got
>  ao> lua ao_example.lua
>  lua: error loading module 'ao' from file '/usr/local/lib/lua/5.2/ao.so':
>     /usr/local/lib/lua/5.2/ao.so: undefined symbol: luaL_register
>
> so presumably it needs something like what I normally use:
>  #if LUA_VERSION_NUM >= 502
>     luaL_setfuncs(L, prv, 0);    /* 5.2 */
>     return 0;
>  #else
>     luaL_register(L, NULL, prv); /* 5.1 */
>     return 0;
>  #endif
>
> so I did
>  git clone https://github.com/thelinx/lao
> and in src/lao.c I tried to replace the
>  luaL_register(L, "ao", ao);
> line, but couldn't get it compiled because the way lao.c returns the
> module is different ... it's probably elementary ...
>
> It's a shame that such a neat little module isn't maintained any more.
> I could probably coerce it into my usual way of doing things,
> but I'm a bit old to take on more modules. And I'm not sure
> that anyone's listening for pull requests on thelinx/lao
>
> Suggestions gratefully received...

Looks like luaL_register should be replaced here with luaL_newlib
Examples should then be rewritten to do: local ao = require "ao"

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reviving the ao luarock

Peter Billam
Daurnimator wrote:
> Looks like luaL_register should be replaced here with luaL_newlib
> Examples should then be rewritten to do: local ao = require "ao"

Thanks for that; this compiles just fine:

#if LUA_VERSION_NUM >= 502
     luaL_newlib(L, ao);    /* 5.2 */
#else
     luaL_register(L, "ao", ao);  /* 5.1 */
#endif

Unfortunately, I still can't get the example script to work
well :-( It produces half a second of loud noise,
then half a second of sine-wave with a glitch in the middle.
And attempts to output more than one second segfault.
I'll wrestle with it a bit...

Thanks again,  Peter Billam

http://www.pjb.com.au     [hidden email]     (03) 6278 9410
"Follow the charge, not the particle."  --  Richard Feynman
  from The Theory of Positrons, Physical Review, 1949

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reviving the ao luarock

Daurnimator
On 4 August 2017 at 10:31, Peter Billam <[hidden email]> wrote:

> Daurnimator wrote:
>>
>> Looks like luaL_register should be replaced here with luaL_newlib
>> Examples should then be rewritten to do: local ao = require "ao"
>
>
> Thanks for that; this compiles just fine:
>
> #if LUA_VERSION_NUM >= 502
>     luaL_newlib(L, ao);    /* 5.2 */
> #else
>     luaL_register(L, "ao", ao);  /* 5.1 */
> #endif
>
> Unfortunately, I still can't get the example script to work
> well :-( It produces half a second of loud noise,
> then half a second of sine-wave with a glitch in the middle.
> And attempts to output more than one second segfault.
> I'll wrestle with it a bit...

I had a quick look into it and fixed it: https://github.com/TheLinx/lao/pull/4

Loading...