05-18-2009 09:08 AM
The Calibration button was made active in this installment. The following changes were made.
The calibration dialog uses the simple dialog pattern, like the configuration dialog. The VI properties are identical to a dialog with one exception — the VI front panel is not shown and closed automatically. This allows us to post an error dialog without showing the main panel in the event the sound card does not initialize properly. Of course, we must programmatically open and close the front panel. Note the clear error before the close front panel method. This ensures the front panel will close. If we need the error in the future, we can move the method off the error wire, surround it with a single frame sequence, and run the error through the sequence without running it through the method. This ensures proper code sequencing.
Calibration requires use of the sound acquisition loop. The dialog itself assumes the loop is not in use and starts and stops it using the usual public methods. The event in the main code which calls the calibration loop handles starting and stopping the loop if it is currently in use. It uses the start and stop code which was already implemented. This shows the flexibility of the event driven task handler.
To test the code, I have been using two test bars and an A440 tuning fork. The test bars are about 1cm thick. One is about 1.5cm wide and 10cm long. The other is about 2cm wide and 20cm long. Both are made of poplar, although any wood will do. Hold the bars about 25% of their total length from each end and rap in the center. If you do not have a handy xylophone or test bars, you can snap your fingers or rap a table top. If you do not have a tuning fork, you can hum into the microphone. Not being an operatic tenor, I have to get into falsetto to hit a 440 A .
As always, comments and suggestions are welcome and encouraged.
Previous Installments