net.rim.device.api.system
Class Audio

java.lang.Object
  extended by net.rim.device.api.system.Audio

public final class Audio
extends Object

Provides access to the device's audio system and speaker.

See Also:
AudioListener
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

Field Summary
Category: Signed static int AUDIO_CODEC_VOICENOTE
          Deprecated. No longer supported
Category: Signed static int AUDIO_ERROR_BAD_DATA
          Invalid data was provided
Category: Signed static int AUDIO_ERROR_BAD_STATE
          Playback is already in progress
Category: Signed static int AUDIO_ERROR_FILESYSTEM_FULL
          Filesystem is full
Category: Signed static int AUDIO_ERROR_UNKNOWN
          Unknown error
Category: Signed static int AUDIO_OK
          No error
Category: Signed static int AUDIO_REQUEST_PENDING
          Request pending
 
Method Summary
Category: Signed static void addListener(Application app, AudioListener listener)
          Adds an audio listener to the specified application.
Category: Signed static int getVolume()
          Retrives the current master audio volume.
Category: Signed static boolean hasBuiltInHeadset()
          Determines if the device has a built-in headset.
Category: Signed static boolean isCodecSupported(int codec)
          Determines if this device provides support for the specified codec.
Category: Signed static boolean isHeadsetConnected()
          Determines if the headset is currently connected.
Category: Signed static boolean isRecordingCodecSupported(int codec)
          Determines if this device provides recording support for the specified codec.
Category: Signed static boolean isSupported()
          Determines if the device has audio support.
Category: Signed static int playFile(int audioCodec, int fs, String fileName)
          Deprecated. No longer supported. See javax.microedition.media for an alternative.
Category: Signed static int recordFile(int audioCodec, int fs, String fileName)
          Deprecated. No longer supported. See javax.microedition.media for an alternative.
Category: Signed static void removeListener(Application app, AudioListener listener)
          Removes an audio listener from the specified application.
Category: Signed static boolean setVolume(int volume)
          Sets the desired master audio volume.
Category: Signed static int stopFile(int audioCodec, int fs, String fileName)
          Deprecated. No longer supported. See javax.microedition.media for an alternative.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

AUDIO_CODEC_VOICENOTE

public static final int AUDIO_CODEC_VOICENOTE
Deprecated. No longer supported
Voicenote codec (iDEN only)

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

AUDIO_OK

public static final int AUDIO_OK
No error

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

AUDIO_ERROR_UNKNOWN

public static final int AUDIO_ERROR_UNKNOWN
Unknown error

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

AUDIO_ERROR_BAD_DATA

public static final int AUDIO_ERROR_BAD_DATA
Invalid data was provided

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

AUDIO_ERROR_BAD_STATE

public static final int AUDIO_ERROR_BAD_STATE
Playback is already in progress

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

AUDIO_ERROR_FILESYSTEM_FULL

public static final int AUDIO_ERROR_FILESYSTEM_FULL
Filesystem is full

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

AUDIO_REQUEST_PENDING

public static final int AUDIO_REQUEST_PENDING
Request pending

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2


Method Detail

isSupported

public static boolean isSupported()
Determines if the device has audio support.

Returns:
true if the device has audio support.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

getVolume

public static int getVolume()
Retrives the current master audio volume.

Returns:
Percentage of maximum volume.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

setVolume

public static boolean setVolume(int volume)
Sets the desired master audio volume.

Parameters:
volume - Percentage of maximum volume.
Returns:
False if an error occurred.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

isHeadsetConnected

public static boolean isHeadsetConnected()
Determines if the headset is currently connected.

Returns:
True if the headset is currently connected. Note on some platforms the audio channel must be turned on in order for the device to detect the headset.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

hasBuiltInHeadset

public static boolean hasBuiltInHeadset()
Determines if the device has a built-in headset.

Returns:
True if the device has a built-in headset.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

isCodecSupported

public static boolean isCodecSupported(int codec)
Determines if this device provides support for the specified codec.

Parameters:
codec - The codec to query.
Returns:
True if this device provides support for the specified codec; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

isRecordingCodecSupported

public static boolean isRecordingCodecSupported(int codec)
Determines if this device provides recording support for the specified codec.

Parameters:
codec - The codec to query
Returns:
True if this device supports audio recording for the codec, false otherwise.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0

playFile

public static int playFile(int audioCodec,
                           int fs,
                           String fileName)
Deprecated. No longer supported. See javax.microedition.media for an alternative.

Starts playing an audio file residing in the file system.

When the operation is complete, the AudioFileListener.audioFileOperationComplete(int) method is invoked on the event thread.

If the operation fails, the AudioFileListener.audioFileOperationFailed(int, int) method is invoked on the event thread.

Parameters:
audioCodec - One of the AUDIO_CODEC_ values.
fs - One of the File.FILESYSTEM_ values.
fileName - The name of the file to play from.
Returns:
One of the AUDIO_* values.
Throws:
UnsupportedOperationException - If an unsupported file system is provided.
See Also:
AudioFileListener.audioFileOperationComplete(int), AudioFileListener.audioFileOperationFailed(int, int)
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

recordFile

public static int recordFile(int audioCodec,
                             int fs,
                             String fileName)
Deprecated. No longer supported. See javax.microedition.media for an alternative.

Starts recording an audio file residing in the file system.

If the operation fails, the AudioFileListener.audioFileOperationFailed(int, int) method is invoked on the event thread.

Parameters:
audioCodec - One of the AUDIO_CODEC_ values.
fs - One of the File.FILESYSTEM_ values.
fileName - The name of the file to record to.
Returns:
One of the AUDIO_* values.
Throws:
UnsupportedOperationException - If an unsupported file system is provided.
See Also:
AudioFileListener.audioFileOperationFailed(int, int)
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

stopFile

public static int stopFile(int audioCodec,
                           int fs,
                           String fileName)
Deprecated. No longer supported. See javax.microedition.media for an alternative.

Stops playing/recording an audio file residing in the file system.

When the operation is complete, the AudioFileListener.audioFileOperationComplete(int) method is invoked on the event thread.

If the operation fails, the AudioFileListener.audioFileOperationFailed(int, int) method is invoked on the event thread.

Parameters:
audioCodec - One of the AUDIO_CODEC_ values.
fs - One of the File.FILESYSTEM_ values.
fileName - The name of the file.
Returns:
One of the AUDIO_* values.
Throws:
UnsupportedOperationException - If an unsupported file system is provided.
See Also:
AudioFileListener.audioFileOperationComplete(int), AudioFileListener.audioFileOperationFailed(int, int)
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

addListener

public static void addListener(Application app,
                               AudioListener listener)
Adds an audio listener to the specified application.

Parameters:
app - The application.
listener - Audio listener to register.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

removeListener

public static void removeListener(Application app,
                                  AudioListener listener)
Removes an audio listener from the specified application.

Parameters:
app - The application
listener - Audio listener to de-register.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal