beautypg.com

ClearOne Writing StreamNet User Manual

Page 71

background image

Audio Driver Example

D-19

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.

end

-- Now we can run our main code

-- Check to see if the COM port has been overridden by Dealer Setup

if( config == nil ) then

config = {}

end

-- If the COM port doesn't exist, setup the default

if( config.port == nil ) then

config.port = "comm://0;baud=9600;parity=none"

end

-- open the serial port and ready it for writing

serialPort = createStream(config.port)

if(serialPort == nil) then

debug("error", "Unable to open stream \""..config.port.."\"")

return

end

-- setup the stream to call OnAsyncInput whenever a carrige return is

detected

serialPort.startAsyncInput(serialPort, OnAsyncInput, {endString = "\r"})

-- load saved presets and add them to the ones defined in SCRIPT_DATA

presetLoadOverrides()

-- create our timer to call QueryStatus every 5 seconds

createTimer(5000, QueryStatus)