# Copyright (c) 2007 Jurgen Scheible # Sound file status printout (based on sound recorder script) import appuifw, e32, audio filename = 'e:\\Python\\sound\\boo.wav' def recording(): global S print "Opening file!" S=audio.Sound.open(filename) status = S.state() print 'State is: %d means: EOpen'%(status) S.record() print "Recording on!" status = S.state() print 'State is: %d means: ERecording'%(status) print 'To end recording, select stop from menu!' def playing(): global S try: S=audio.Sound.open(filename) print "Playing" status = S.state() print 'State is: %d means: EPlaying'%(status) except: print "Record first a sound!" def closing(): global S S.stop() print 'Stopping' status = S.state() print 'State is: %d means: EOpen'%(status) S.close() print 'Closing' status = S.state() print 'State is: %d means: ENotReady'%(status) print "Finished!" def exit_key_handler(): script_lock.signal() appuifw.app.set_exit() script_lock = e32.Ao_lock() appuifw.app.title = u"Sound status" appuifw.app.menu = [(u"play", playing), (u"record", recording), (u"stop", closing)] appuifw.app.exit_key_handler = exit_key_handler script_lock.wait()