@@ -140,47 +140,30 @@ async def main():
140140
141141 # Microphone
142142
143- ## Expected sizes for different record options
144- await test .lua_send (
145- "frame.microphone.record{seconds=0.0125, sample_rate=16000, bit_depth=16}"
146- )
147- await asyncio .sleep (0.1 )
148- await test .lua_equals ("#frame.microphone.read(512)" , "400" )
149-
150- await test .lua_send ("frame.microphone.record{seconds=0.05}" )
151- await asyncio .sleep (0.1 )
152- await test .lua_equals ("#frame.microphone.read(512)" , "400" )
153-
154- await test .lua_send (
155- "frame.microphone.record{seconds=0.05, sample_rate=4000, bit_depth=4}"
156- )
157- await asyncio .sleep (0.1 )
158- await test .lua_equals ("#frame.microphone.read(512)" , "100" )
143+ ## Start and stop mic in different modes
144+ await test .lua_send ("frame.microphone.start{}" )
145+ await test .lua_send ("frame.microphone.stop()" )
159146
160- ## Unexpected parameters
161- await test .lua_error ("frame.microphone.record{seconds=0, sample_rate=16000}" )
162- await test .lua_error ("frame.microphone.record{seconds=-3, sample_rate=16000}" )
163- await test .lua_error ("frame.microphone.record{seconds=5, sample_rate=12000}" )
164- await test .lua_error (
165- "frame.microphone.record{seconds=5, sample_rate=16000, bit_depth=12}"
166- )
147+ await test .lua_send ("frame.microphone.start{sample_rate=16000}" )
148+ await test .lua_send ("frame.microphone.stop()" )
167149
168- ## Restarted recording
169- await test .lua_send (
170- "frame.microphone.record{seconds=0.0125, sample_rate=16000, bit_depth=16}"
171- )
172- await asyncio .sleep (1 )
173- await test .lua_send (
174- "frame.microphone.record{seconds=0.0125, sample_rate=16000, bit_depth=16}"
175- )
176- await asyncio .sleep (0.1 )
177- await test .lua_equals ("#frame.microphone.read(512)" , "400" )
150+ await test .lua_send ("frame.microphone.start{bit_depth=16}" )
151+ await test .lua_send ("frame.microphone.stop()" )
178152
179- ## Continuous readout
180- # TODO
153+ await test . lua_send ( "frame.microphone.start{sample_rate=16000, bit_depth=16}" )
154+ await test . lua_send ( "frame.microphone.stop()" )
181155
182- ## FIFO overflow
183- # TODO
156+ ## Unexpected parameters
157+ await test .lua_error ("frame.microphone.start{sample_rate=24000}" )
158+ await test .lua_error ("frame.microphone.start{bit_depth=32}" )
159+
160+ ## Read some data
161+ await test .lua_send ("frame.microphone.start{}" )
162+ await asyncio .sleep (0.25 )
163+ await test .lua_equals ("#frame.microphone.read(10)" , "10" )
164+ await test .lua_equals ("#frame.microphone.read(256)" , "256" )
165+ await test .lua_error ("frame.microphone.read(11)" )
166+ await test .lua_send ("frame.microphone.stop()" )
184167
185168 # IMU
186169
0 commit comments