[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Quite remarkable! (Lua as a waveform visualisator)
- From: Asko Kauppi <asko.kauppi@...>
- Date: Mon, 4 Apr 2005 02:07:53 +0300
I eventually did it only the "userdata int array" way, as suggested on
the list, and the results are quite remarkable:
[iMac:~/TestBox/Sources/luax-perforce] asko% ./luax
out_darwin/luax_gui -w -l kernel -v Apps/sdl_mixer/sdlwav.lua
Lua 5.1 (work4) Copyright (C) 1994-2004 Tecgraf, PUC-Rio
USES 'lib.sdl2' (global):
USES 'lib.sdl_mixer' (global):
Opened audio at 44100 Hz 16 bit stereo, 512 samples buffered
[iMac:~/TestBox/Sources/luax-perforce] asko% Apps/sdl_mixer/sdlwav
Opened audio at 44100 Hz 16 bit stereo, 512 bytes audio buffer
The application is an SDL mixer demo that plays a tune and
simultaneously shows its waveform on the screen. The 43->13 fps change
is hardly noticable to the eye, certainly much less than I expected
(the C code is tight, and the mixed sound data is passed as 2048 bytes
per callback). Well done, Lua!! :)
+ conceptually "the right thing"
- performance must be lowest?
Have you tested it? If performance is low, you can try to reuse a table
(instead of creating a new one for each call).
b) ... (lots of integer values):
+ fast to send, fast to receive
- is there a limit to the number of args one can get? is 10000 too
Far too many.