javaclient
Class AudioInterface

java.lang.Object
  extended by javaclient.PlayerDevice
      extended by javaclient.AudioInterface

public class AudioInterface
extends PlayerDevice

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

Version:
Author:
Maxim A. Batalin, Esben H. Ostergaard & Radu Bogdan Rusu

Field Summary
 
Fields inherited from class javaclient.PlayerDevice
device, DIFFERENCE_SYNCH_FACTOR, index, is, os, pc, PLAYER_MAX_REQREP_SIZE, PLAYER_STXX, reserved, size, t_sec, t_usec, ts_sec, ts_usec
 
Constructor Summary
AudioInterface(PlayerClient pc, short indexOfDevice)
          Constructor for AudioInterface.
 
Method Summary
 int[] getFiveHighestAmplitudes()
          Returns the five highest amplitudes.
 int[] getFiveHighestFrequencies()
          Returns the five highest frequencies.
 void produceSound(short freq, short amp, short duration)
          The audio interface accepts commands to produce fixed-frequency tones through /dev/dsp (which is assumed to be associated with a sound card to which a speaker is attached).
 void readData()
          The audio interface reads the audio stream from /dev/audio (which is assumed to be associated with a sound card connected to a microphone) and performs some analysis on it.
 
Methods inherited from class javaclient.PlayerDevice
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleEARMessage, handleNARMessage, handleResponse, readHeader, sendHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioInterface

public AudioInterface(PlayerClient pc,
                      short indexOfDevice)
Constructor for AudioInterface.

Parameters:
pc - a reference to the PlayerClient object
indexOfDevice - the index of the device
Method Detail

readData

public void readData()
The audio interface reads the audio stream from /dev/audio (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.

Overrides:
readData in class PlayerDevice

getFiveHighestFrequencies

public int[] getFiveHighestFrequencies()
Returns the five highest frequencies.

Returns:
an array filled with the highest five frequencies

getFiveHighestAmplitudes

public int[] getFiveHighestAmplitudes()
Returns the five highest amplitudes.

Returns:
an array filled with the highest five amplitudes

produceSound

public void produceSound(short freq,
                         short amp,
                         short duration)
The audio interface accepts commands to produce fixed-frequency tones through /dev/dsp (which is assumed to be associated with a sound card to which a speaker is attached).

Parameters:
freq - frequency to play (Hz?)
amp - amplitude to play (dB?)
duration - duration to play (sec?)