The audiodsp interface is used to control sound hardware, if equipped.
struct player_audiodsp_data : The dsp interface reads the audio stream from /dev/dsp (which is assumed to be associated with a sound card connected to a microphone) and performs some analysis on it. Five frequency/amplitude pairs are then returned as data; the format is:
struct player_audiodsp_cmd : The audiodsp interface accepts commands to produce fixed-frequency tones or binary phase shift keyed(BPSK) chirps through /dev/dsp (which is assumed to be associated with a sound card to which a speaker is attached); the format is:
The packet subtype. Set to PLAYER_AUDIODSP_PLAY_TONE to play a single frequency; bitString and bitStringLen do not need to be set. Set to PLAYER_AUDIODSP_PLAY_CHIRP to play a BPSKeyed chirp; bitString should contain the binary string to encode, and bitStringLen set to the length of the bitString. Set to PLAYER_AUDIODSP_REPLAY to replay the last sound. *
Frequency to play (Hz)
Amplitude to play (dB?)
Duration to play (msec)
|unsigned char bitString[PLAYER_MAX_DEVICE_STRING_LEN];|
BitString to encode in sine wave
Length of the bit string
The audiodsp configuration can be queried using the PLAYER_AUDIODSP_GET_CONFIG request and modified using the PLAYER_AUDIODSP_SET_CONFIG request.
The sample format is defined in sys/soundcard.h, and defines the byte size and endian format for each sample.
The sample rate defines the Hertz at which to sample.
Mono or stereo sampling is defined in the channels parameter where 1==mono and 2==stereo.
struct player_audiodsp_config : Request/reply packet for getting and setting the audio configuration.
The packet subtype. Set this to PLAYER_AUDIODSP_SET_CONFIG to set the audiodsp configuration; or set to PLAYER_AUDIODSP_GET_CONFIG to get the audiodsp configuration.
Format with which to sample
Sample rate in Hertz
Number of channels to use. 1=mono, 2=stereo