07-22-2015 08:39 AM
Hi,
Is it possible to have a program that will record separate audio files every time the user presses stop and save? Would the solution for this be a state machine...? How could I update the Sound File Open and Output Configure VI's if they are outside the while loop? I am guessing that I could implement this by putting the state machine within another while loop?
Anton
07-22-2015 08:48 AM - edited 07-22-2015 08:48 AM
Assuming that you only want to record a single file at a time...
State machine with 4 states - idle, start, read and stop. When you press the start button you go from idle to start and start the sound acquisition. Then you stay in the read case - reading the samples and writing to the file (possibly using producer/consumer architecture with a queue) until the user presses the stop button where you go into the stop case to stop acquiring the sound data and go back to the idle case.
You could use an event structure to process the button presses.
07-22-2015 09:11 AM
Would the Configuration and Sound File Open VI's be within the state machine or outside of it?
07-22-2015 09:22 AM
I would put them inside - either in a seperate initialise case (for loading configuration) or in your start case (for configuring/starting a new sound file).
07-22-2015 10:07 AM
I have tried this out and I am running into an error where I get "Error 42 occurred at Sound File Write Open" and then it is stuck in this error. I have to hit the stop execution button to get out of this cycle. Is this an error cause by one of the values I am passing to the shift registers.
I have attached my sample vi and there are some notes in there.
Thanks for your help