uk.org.toot.audio.core
Class ChannelFormat

java.lang.Object
  extended by uk.org.toot.audio.core.ChannelFormat

public abstract class ChannelFormat
extends java.lang.Object

ChannelFormat provides information about AudioBuffer channels. You can find out whether a channel index is left, right, center, front, rear or a low frequency extension (LFE) which is sufficient to describe mono, stereo, quad and 5.1, those formats being predefined as MONO, STEREO, QUAD and FIVE_1. You can find out which channel indices are left, right, center, front, rear and LFE. You can get the localised name for a channel index and for the format. You can mix a format with less channels to a format (upmixing). Odd formats like 1.1, 2.1, 3, 3.1 and 4.1 could be provided but are not believed to be significant enough to implement.


Field Summary
static ChannelFormat FIVE_1
          The default 5.1 ChannelFormat
static ChannelFormat MONO
          The Mono ChannelFormat
static ChannelFormat QUAD
          The default Quad ChannelFormat
static ChannelFormat STEREO
          The default Stereo ChannelFormat
 
Constructor Summary
ChannelFormat()
           
 
Method Summary
abstract  int getCenter()
          Return the index of the center channel, if present, otherwise -1
abstract  int getCount()
          Return the number of channels in this format.
abstract  int[] getLeft()
          Return an array of the indices of the left channels, may be empty but not null
abstract  int getLFE()
          Return the index of the LFE channel, if present, otherwise -1
abstract  java.lang.String getName()
          Return the name of this ChannelFormat
abstract  java.lang.String getName(int chan)
          Return the name of the specified channel
abstract  int[] getRight()
          Return an array of the indices of the right channels, may be empty but not null
abstract  boolean isCenter(int chan)
          Return true if chan is the index is of a center channel, false otherwise, undefined if chan is not a valid index
abstract  boolean isFront(int chan)
          Return true if chan is the index is of a front channel, false otherwise, undefined if chan is not a valid index
abstract  boolean isLeft(int chan)
          Return true if chan is the index is of a lefr channel, false otherwise, undefined if chan is not a valid index
abstract  boolean isLFE(int chan)
          Return true if chan is the index is of an LFE channel, false otherwise, undefined if chan is not a valid index
abstract  boolean isRear(int chan)
          Return true if chan is the index is of a rear channel, false otherwise, undefined if chan is not a valid index
abstract  boolean isRight(int chan)
          Return true if chan is the index is of a right channel, false otherwise, undefined if chan is not a valid index
 int mix(AudioBuffer destBuffer, AudioBuffer sourceBuffer, float[] gain)
          Mix a source AudioBuffer into a destination AudioBuffer with specified weights for each channel.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONO

public static final ChannelFormat MONO
The Mono ChannelFormat

Label:
MONO

STEREO

public static final ChannelFormat STEREO
The default Stereo ChannelFormat

Label:
STEREO

QUAD

public static final ChannelFormat QUAD
The default Quad ChannelFormat

Label:
QUAD

FIVE_1

public static final ChannelFormat FIVE_1
The default 5.1 ChannelFormat

Label:
5.1
Constructor Detail

ChannelFormat

public ChannelFormat()
Method Detail

getCount

public abstract int getCount()
Return the number of channels in this format.


getCenter

public abstract int getCenter()
Return the index of the center channel, if present, otherwise -1


getLFE

public abstract int getLFE()
Return the index of the LFE channel, if present, otherwise -1


getLeft

public abstract int[] getLeft()
Return an array of the indices of the left channels, may be empty but not null


getRight

public abstract int[] getRight()
Return an array of the indices of the right channels, may be empty but not null


getName

public abstract java.lang.String getName()
Return the name of this ChannelFormat


isCenter

public abstract boolean isCenter(int chan)
Return true if chan is the index is of a center channel, false otherwise, undefined if chan is not a valid index


isLeft

public abstract boolean isLeft(int chan)
Return true if chan is the index is of a lefr channel, false otherwise, undefined if chan is not a valid index


isRight

public abstract boolean isRight(int chan)
Return true if chan is the index is of a right channel, false otherwise, undefined if chan is not a valid index


isFront

public abstract boolean isFront(int chan)
Return true if chan is the index is of a front channel, false otherwise, undefined if chan is not a valid index


isRear

public abstract boolean isRear(int chan)
Return true if chan is the index is of a rear channel, false otherwise, undefined if chan is not a valid index


isLFE

public abstract boolean isLFE(int chan)
Return true if chan is the index is of an LFE channel, false otherwise, undefined if chan is not a valid index


getName

public abstract java.lang.String getName(int chan)
Return the name of the specified channel

Parameters:
chan - the index of a channel

mix

public int mix(AudioBuffer destBuffer,
               AudioBuffer sourceBuffer,
               float[] gain)
Mix a source AudioBuffer into a destination AudioBuffer with specified weights for each channel. This implementation is valid for MONO, STEREO and QUAD.



Copyright © 2004, 2005, 2006, 2007 Steve Taylor. All Rights Reserved.