next up previous contents
Next: 6.6 audiomixer Up: 6. Device Interfaces Previous: 6.4 audio   Contents

Subsections


6.5 audiodsp

Synopsis

The audiodsp interface is used to control sound hardware, if equipped.

Data



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:

uint16_t freq[5];
Hz

uint16_t amp[5];
Db ?

Command



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:

uint8_t subtype;
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. *

uint16_t frequency;
Frequency to play (Hz)

uint16_t amplitude;
Amplitude to play (dB?)

uint32_t duration;
Duration to play (msec)

unsigned char bitString[PLAYER_MAX_DEVICE_STRING_LEN];
BitString to encode in sine wave

uint16_t bitStringLen;
Length of the bit string

Configuration: get/set audio properties

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.

uint8_t subtype;
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.

int16_t sampleFormat;
Format with which to sample

uint16_t sampleRate;
Sample rate in Hertz

uint8_t channels;
Number of channels to use. 1=mono, 2=stereo


next up previous contents
Next: 6.6 audiomixer Up: 6. Device Interfaces Previous: 6.4 audio   Contents
2004-06-02