com.groovemanager.spi.asio
Class ASIOAudioFormat

java.lang.Object
  extended by javax.sound.sampled.AudioFormat
      extended by com.groovemanager.spi.asio.ASIOAudioFormat

final class ASIOAudioFormat
extends AudioFormat

This class maps the ASIOSampleType values to a JavaSound AudioFormat

Author:
Manu Robledo

Nested Class Summary
(package private) static class ASIOAudioFormat.Encoding
           
 
Field Summary
 
Fields inherited from class javax.sound.sampled.AudioFormat
bigEndian, channels, encoding, frameRate, frameSize, sampleRate, sampleSizeInBits
 
Constructor Summary
ASIOAudioFormat(ASIOAudioFormat.Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian)
          Constructs an ASIOAudioFormat with the given parameters.
ASIOAudioFormat(float sampleRate, int type, int channels)
          Constructs a new ASIOAudioFormat of the specified ASIOSampleType, with the given sampleRate and channels
 
Method Summary
static ASIOAudioFormat convertToASIOAudioFormat(AudioFormat format)
           
static ASIOAudioFormat[] convertToASIOAudioFormat(AudioFormat[] format)
           
private static AudioFormat.Encoding getEncoding(int type)
          Get the Encoding out of the given ASIOSampleType
private static boolean getEndianess(int type)
          Get the endianess out of the given ASIOSampleType
private static int getFrameSize(int type, int channels)
          Get the frame size out of the given ASIOSampleType
private static int getSampleSizeInBits(int type)
          Get the sample size out of the given ASIOSampleType
 boolean matches(AudioFormat format)
          Indicates whether this format matches the one specified.
 
Methods inherited from class javax.sound.sampled.AudioFormat
getChannels, getEncoding, getFrameRate, getFrameSize, getProperty, getSampleRate, getSampleSizeInBits, isBigEndian, properties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASIOAudioFormat

ASIOAudioFormat(float sampleRate,
                int type,
                int channels)
Constructs a new ASIOAudioFormat of the specified ASIOSampleType, with the given sampleRate and channels

Parameters:
sampleRate - The sampleRate of the format
type - The ASIOSampleType constant
channels - The number of channels

ASIOAudioFormat

public ASIOAudioFormat(ASIOAudioFormat.Encoding encoding,
                       float sampleRate,
                       int sampleSizeInBits,
                       int channels,
                       int frameSize,
                       float frameRate,
                       boolean bigEndian)
Constructs an ASIOAudioFormat with the given parameters. The encoding specifies the convention used to represent the data. The other parameters are further explained in the class description.

Parameters:
encoding - the audio encoding technique
sampleRate - the number of samples per second
sampleSizeInBits - the number of bits in each sample
channels - the number of channels (1 for mono, 2 for stereo, and so on)
frameSize - the number of bytes in each frame
frameRate - the number of frames per second
bigEndian - indicates whether the data for a single sample is stored in big-endian byte order (false means little-endian)
Method Detail

getEncoding

private static AudioFormat.Encoding getEncoding(int type)
Get the Encoding out of the given ASIOSampleType

Parameters:
type - The ASIOSampleType constant
Returns:
The encoding of the given ASIOSampleType. For Flaot encodings normalized to +/- 1.0 PCM_FLOAT is used as encoding name (either 32 or 64 Bit are supported)

getSampleSizeInBits

private static int getSampleSizeInBits(int type)
Get the sample size out of the given ASIOSampleType

Parameters:
type - The ASIOSampleType constant
Returns:
The sample size in Bits of the given ASIOSampleType

getFrameSize

private static int getFrameSize(int type,
                                int channels)
Get the frame size out of the given ASIOSampleType

Parameters:
type - The ASIOSampleType constant
channels - The number of channels
Returns:
The frame size in Bits of the given ASIOSampleType

getEndianess

private static boolean getEndianess(int type)
Get the endianess out of the given ASIOSampleType

Parameters:
type - The ASIOSampleType constant
Returns:
The endianess of the given ASIOSampleType

matches

public boolean matches(AudioFormat format)
Indicates whether this format matches the one specified. To match, two formats must have the same encoding, the same number of channels, and the same number of bits per sample and bytes per frame. The two formats must also have the same sample rate, unless the specified format has the sample rate value AudioSystem.NOT_SPECIFIED, which any sample rate will match. The frame rates must similarly be equal, unless the specified format has the frame rate value AudioSystem.NOT_SPECIFIED. The byte order (big-endian or little-endian) must match if the sample size is greater than one byte.

Overrides:
matches in class AudioFormat
Parameters:
format - format to test for match
Returns:
true if this format matches the one specified, false otherwise.

convertToASIOAudioFormat

public static ASIOAudioFormat convertToASIOAudioFormat(AudioFormat format)

convertToASIOAudioFormat

public static ASIOAudioFormat[] convertToASIOAudioFormat(AudioFormat[] format)