So the testing part of the code is done and working. Yes, there are bugs, and some cases where exceptions are thrown that should be handled, but if you color inside of the lines, everything works. Of course, now I need to be able to record the output, so it’s time for some classes to handle the work of saving results for analysis.
- Creating a TestResult class with the following information
- session number
- test number
- test type (speed or accuracy)
- time to lift
- source position
- cursor position
- angle difference
- speaker volume matrix
- Also, there will be a toString(), toCsvString(), and toXmlString() method for output;
- The TestManager will instance and store TestResults in a container (vector?), which will have the additional fields
- Researcher name
- Subject name
- Sound file
- Total sessions
- Speed tests per session
- Accuracy tests per session
Well that was a good day.
- Spent a good deal of time trying to figure out the best way for the GUI and the Exec to communicate. Originally, I wanted to be able to pass a pointer to the GUI from the exec so that user actions in the GUI could be executed in a more reasonable place. Due to header conflicts, I couldn’t manage to get that to work, so I put together a UI_cmd class that is set in the UI and read in the Exec. That seems to be working pretty well, though I may want to put a queue in there and turn it more into a message bus/event pump. That level of sophistication isn’t needed yet though.
- Integrated the sound library that I wrote. I still have to reference the D3D audio library in the main application which I think is a bit odd, but I think it may be because I’m incorrectly exporting the symbol table from the static library. Again, that’s a refinement for later.
- At this point, the 3D position of my OGL shape and the 3D postion of my continuous sound (2D actually, Y = 0) are running in an infinite circle. It’s pretty cool to hear the audio track to the image. I’m uploading a video of the running system, and although it won’t be in surround, you can hear the flanging effects from the sound moving around the helmet.
I’m busy doing demos and presentations in my day job, so this has been suffering. Nonetheless, here’s the progress for today:
- Added a fine-grained timer callback to the main app
- Added an OpenGL window, set to Ortho2, and with pixel-accurate dimensions
- Connected the timer to the OpenGL, and set the position of what will be the emitter. We won’t see this during the actual test, but it will be good for debugging.
- I need to track mouse clicks and motion in the GL window. That will come tomorrow, and then I’ll work on integrating the audio library. That’s the basics for running the experiments. After that, I’ll work on reading and writing the input and result files.
- Pix for today:
Alright, so I now have my audio library. Next on the agenda is a test program that tests reactions of users to vibroacoustic input. The test needs to present randomized stimuli to users, so that they can be tested for:
- Time to respond with a direction
- Accuracy of direction
- Efficacy of stimuli
Since this is probably going to be within subjects (multiple stimuli) and also between subjects (same tests on multiple users) we’re going to want to be able to present the same sequence, so we’ll need to seed the random number generator so we get the same sequence.
- Start with the default random number generator, but maybe run through a wrapper class in case we need something like a Mersenne Twister.
- Xml file to specify the input and output of the experiment. This library looks reasonable.
- Sounds to use (random distribution of sound use)
- Test type (Accuracy, Speed, or both)
- Attempts per test
- Number of tests (must be even)
- Random seed
- min/max delay between test segments
- output filename
- Test UID
- Free form note field (1024 characters?)
- Accuracy or Reaction time test
- Audio configuration
- Random seed
- Calibration results
- Time(s) to click in response to visual cue
- Time(s) to click in response to audio cue
- For each played sound
- Sequence x of total
- Audio file(s) used (WAV)
- Audio source position (x, y) in screen coordinates from the origin, where the user’s head is
- Audio playback matrix (actual speaker relative volume)
- Time to click after play start
- Duration of sound
- Click position (x, y) in screen coordinates from the origin, where the sound is perceived to have come from
- File navigator for xml file
- Runs a sequence of tests where the user has to click the mouse as quickly as possible in response to the canvas flashing white, and then all(?) speakers in the headpiece playing the calibration sound
- Calibration cues are have a randomly determined timing between X and Y seconds
- Test is disabled until calibration is run. Loading a new xml document effectively resets the system, requiring a new calibration sequence
- Shows a label that says either “Accuracy” or “Speed” based on which test is being run. We could change the background of the display as well?
- The graphics screen shows a circular cursor that resets to the center of the graphics screen at the beginning of each section. Once the audio cue plays, the user can move the mouse away from the center towards the direction of the sound. The circle is clamped in its motion so that the result is always a valid angle, as long as the user moves the cursor far enough away from the center (TBD). Clicking the mouse causes the clock to stop and the cursor to reset.
- If this is not the last test segment, then a random time period between X and Y seconds elapses before the next test is run.
- Once the test completes, the system checks to see if that is the last one. If not, a stochastic choice is made to determine if the next test should be speed or accuracy. By the time all tests have run, the number of speed and accuracy runs will be equal.
- Output file is appended throughout the test (open, write, close? Or read in the DOM, update and write out?)
Started the FLTK wrapper, and probably saved a good deal of time by going back to Erco’s FLTK page and associated videos
- Adding comments and velocity accessors to audio code
- Comments are done
- Checked in project to Subversion repo, then checked out and compiled. All seems to be working fine.
- Cleaning up #includes
- I had been getting the following annoying warning once I started including items like <unordered_map>: 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstring(21): warning C4995: ‘strcat’: name was marked as #pragma deprecated. In the cleanup, I finally got around to testing the need for includes and deleted <strsafe.h>, which seems to be the source of my grief. Yay!
- Ready to make the audio code a library. Monday. Then time to design the experimental interface.
- And now that I think I know what’s going on, a good article shows up…
In the end, this is how you do it:
// create the instance
BasicAudio *ba = new BasicAudio();
// create a sound from a file. In this case a WAV. There can be many of these.
ba->createSound(L"music", L"Wavs\\MusicMono.wav", 0);
// get the instance to the sound and start(), stop(), run() etc.
// change some audio condition
// play the voice on a specified channel or play in 3D
// optional - run periodic checks.