one.radio
Class AudioSource

java.lang.Object
  |
  +--one.world.core.Component
        |
        +--one.radio.AudioSource
All Implemented Interfaces:
Serializable

public final class AudioSource
extends Component

Sends AudioMessages to a one.radio channel. Currently, the audio is captured from a microphone.

Imported and Exported Event Handlers

Exported event handlers:

control
Handles AudioSource.ControlEvents, which are used to start, stop, pause, and unpause the audio source. Note that the response to a start event may be a SecurityException, IllegalArgumentException, LineUnavailableException, UnknownResourceException, or LeaseException rather than a started event.

Imported event handlers:

audio
An event handler that accepts AudioMessages and TextMessages. The audio handler is also informed of NoSuchTupleExceptions, LeaseExceptions, and ResourceRevokedExceptions, all of which also result in streaming being stopped.
request
The environment request handler.

Version:
$Revision: 1.27 $
See Also:
AudioSink, Serialized Form

Inner Class Summary
static class AudioSource.ControlEvent
          The audio sink control event.
 
Inner classes inherited from class one.world.core.Component
Component.HandlerReference, Component.Importer
 
Field Summary
static int BUFFER_LENGTH
          The number of bytes to read at a time.
 
Constructor Summary
AudioSource(Environment env, String sender, String channel)
          Create a new instance of AudioSource that streams captured audio.
AudioSource(Environment env, String sender, String channel, String path)
          Create a new instance of AudioSource that streams audio from tuples in an environment.
 
Method Summary
 ComponentDescriptor getDescriptor()
          Get the component descriptor.
protected  void writeObject(ObjectOutputStream out)
          Serialize this audio source.
 
Methods inherited from class one.world.core.Component
declareExported, declareImported, equals, eventHandlers, getDescriptor, getEnvironment, getLinkedHandlers, getLinkedNumber, getTimer, hasEventHandler, hashCode, isFullyLinked, isLinked, isSealed, link, link, run, seal, unbox, undeclare, unlink, wrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_LENGTH

public static final int BUFFER_LENGTH
The number of bytes to read at a time.
Constructor Detail

AudioSource

public AudioSource(Environment env,
                   String sender,
                   String channel)
Create a new instance of AudioSource that streams captured audio.
Parameters:
env - The environment for the new instance.
sender - The sender name to use in the generated messages.
channel - The channel name to use in the generated messages.

AudioSource

public AudioSource(Environment env,
                   String sender,
                   String channel,
                   String path)
Create a new instance of AudioSource that streams audio from tuples in an environment.
Parameters:
env - The environment for the new instance.
sender - The sender name to use in the generated messages.
channel - The channel name to use in the generated messages.
path - The relative path of the environment to play sound tuples from.
Method Detail

getDescriptor

public ComponentDescriptor getDescriptor()
Get the component descriptor.
Overrides:
getDescriptor in class Component
Following copied from class: one.world.core.Component
Returns:
The component descriptor for this component.

writeObject

protected void writeObject(ObjectOutputStream out)
                    throws IOException
Serialize this audio source.


(C) Copyright 2001 UW CSE