Programming Reference:SoundStimulus Class

From BCI2000 Wiki
Jump to: navigation, search

Location

src/shared/modules/application/audio

Synopsis

The SoundStimulus class combines the Stimulus Class interface with the WavePlayer Class, resulting in a stimulus that plays back a sound file when prompted to present itself. When the SoundStimulus object is deleted during playback, playback does not stop but will continue to the end of the file.

Properties

string File (rw)

Path to an audio file to be played back. The SetFile method loads audio data into memory. The path may be absolute, or relative to the current executable.

float Volume (rw)

Playback volume in the range 0.0 to 1.0.

float Pan (rw)

Panning position in the range -1.0 (leftmost) to +1.0 (rightmost).

float PlayingPos (r)

Playback position from start, in milliseconds. Zero if not playing.

bool IsPlaying (r)

True during playback, false otherwise.

enum WavePlayer::Error ErrorState (r)

The result of the preceding operation, represented by one of the members of the Error enumerated type.

Enumerations

enum WavePlayer::Error

  • No Error
  • File Opening Error
the File property was set to a non-existent file, or a file that could not be loaded as an audio file.
  • Feature not supported
a feature provided by one of the properties (such as panning) is not supported by the current implementation.
  • Invalid Parameters
a property is out of range.
  • Inititalization Error
there was an error when initializing an underlying library (such as DirectX Audio under Windows).
  • Generic Error
an error occurred that does not fit into any of the remaining categories.

Methods

Present()

Starts audio playback.

Conceal()

Does nothing.

See also

Programming Reference:Stimulus Class, Programming Reference:AudioStimulus Class, Programming Reference:WavePlayer Class.