beautypg.com

ClearOne Writing StreamNet User Manual

Page 67

background image

Audio Driver Example

D-15

All specifications subject to change without notification. All rights reserved. Copyright © 2007 NetStreams

Main +1 512.977-9393 / fax +1 512.977.9398 / Toll Free Technical Support +1 866-353-3496

3600 W. Parmer Lane, Suite 100; Austin, TX 78727 /

www.netstreams.com.

(command.params[1] and ('"'..command.params[1]..'"') or 'nil')

)

if (#command.params > 1) then

debug("warning", "Extended #MENU_SET params received: ", command.params)

end

local strDisplay = (BANDNAME[nBand] or "")..szFreq

command:handlePresetMenuSet(strDisplay, "#TUNE "..szFreq)

-- permanently save presets

presetSaveOverrides()

end

-- function handle_user(command)

-- Cristian Prundeanu

-- 10-18-2006

-- handler for #USER functioncall [functioncall [...]] - Lua-execute one or

more functioncalls and print each result

setDebug("USER", "on")

function handle_user(command)

local f

for i = 1, #command.params do

local strLine = string.format('debug("USER", "statement %d result: ",

%s) ', i, command.params[i])

f = loadstring(strLine)

if (not f) then

f

=

loadstring(command.params[i])-- this enables execution of

assignments and declarations

else

command.params[i] = strLine

end

if (not f) then

debug("USER", "error: could not load string: ",

command.params[i])

end

end

-- loading all statements as one chunk enables local variable/scope usage

f = loadstring(string.format(string.rep('%s ',#command.params),

unpack(command.params)))

if (f) then

f()

end

debug("USER", "execution finished")

end

-- function default_command_handler(command)

-- Cristian Prundeanu

-- 10/23/2006

--

function default_command_handler(command)

debug("error", "Unhandled command received: ", command)