public class PulseAudioSystem extends AudioSystem
AudioSystem.DataFlow
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MEDIA_ROLE_EVENT
The PulseAudio logic role of media which represents an event,
notification.
|
static java.lang.String |
MEDIA_ROLE_PHONE
The PulseAudio logic role of media which represents telephony call audio.
|
FEATURE_AGC, FEATURE_DENOISE, FEATURE_ECHO_CANCELLATION, FEATURE_NOTIFY_AND_PLAYBACK_DEVICES, LOCATOR_PROTOCOL_AUDIORECORD, LOCATOR_PROTOCOL_AUDIOSILENCE, LOCATOR_PROTOCOL_JAVASOUND, LOCATOR_PROTOCOL_MACCOREAUDIO, LOCATOR_PROTOCOL_OPENSLES, LOCATOR_PROTOCOL_PORTAUDIO, LOCATOR_PROTOCOL_PULSEAUDIO, LOCATOR_PROTOCOL_WASAPI, PNAME_DENOISE, PNAME_ECHOCANCEL
FEATURE_REINITIALIZE, LOCATOR_PROTOCOL_ANDROIDCAMERA, LOCATOR_PROTOCOL_CIVIL, LOCATOR_PROTOCOL_DIRECTSHOW, LOCATOR_PROTOCOL_IMGSTREAMING, LOCATOR_PROTOCOL_MEDIARECORDER, LOCATOR_PROTOCOL_QUICKTIME, LOCATOR_PROTOCOL_VIDEO4LINUX2, PROP_DEVICES
Constructor and Description |
---|
PulseAudioSystem()
Initializes a new PulseAudioSystem instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
corkStream(long stream,
boolean b)
Pause or resume the playback of a specific PulseAudio stream temporarily.
|
javax.media.Renderer |
createRenderer(boolean playback)
Initializes a new Renderer instance which is to either perform
playback on or sound a notification through a device contributed by this
system.
|
long |
createStream(int sampleRate,
int channels,
java.lang.String mediaName,
java.lang.String mediaRole)
Initializes a new PulseAudio stream which is to input or output audio at
a specific sample rate and with a specific number of channels.
|
protected void |
doInitialize()
Invoked by
DeviceSystem.initialize() to perform the very logic of the
initialization of this DeviceSystem. |
long |
getContext()
Returns the connection context for asynchronous communication with the
PulseAudio server.
|
static PulseAudioSystem |
getPulseAudioSystem()
Returns the one and only instance of PulseAudioSystem known to
the AudioSystem framework.
|
void |
lockMainloop()
Locks the PulseAudio event loop object associated with this
PulseAudioSystem, effectively blocking the PulseAudio event loop
thread from processing events.
|
void |
signalMainloop(boolean waitForAccept)
Signals all threads waiting for a signalling event in
waitMainloop() . |
java.lang.String |
toString()
Returns a human-readable String representation of this
PulseAudioSystem.
|
void |
unlockMainloop()
Unlocks the PulseAudio event look object associated with this
PulseAudioSystem, inverse of
lockMainloop() . |
int |
waitForStreamState(long stream,
int stateToWaitFor)
Waits for a specific PulseAudio stream to get into a specific state,
PA_STREAM_FAILED, or PA_STREAM_TERMINATED.
|
void |
waitMainloop()
Wait for an event to be signalled by the PulseAudio event loop thread
associated with this PulseAudioSystem.
|
createRenderer, getAudioInputStream, getAudioSystem, getAudioSystems, getDevice, getDevices, getFormat, getPropertyName, getSelectedDevice, isAutomaticGainControl, isDenoise, isEchoCancel, postInitialize, postInitializeSpecificDevices, preInitialize, propertyChange, setAutomaticGainControl, setCaptureDevices, setDenoise, setDevice, setEchoCancel, setPlaybackDevices
filterDeviceListByLocatorProtocol, getDeviceSystems, getFeatures, getFormat, getLocatorProtocol, getMediaType, getRendererClassName, initialize, initializeDeviceSystems, initializeDeviceSystems, invokeDeviceSystemInitialize, invokeDeviceSystemInitialize
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
public static final java.lang.String MEDIA_ROLE_EVENT
public static final java.lang.String MEDIA_ROLE_PHONE
public PulseAudioSystem() throws java.lang.Exception
java.lang.Exception
- if anything goes wrong while initializing the new
instancepublic static void corkStream(long stream, boolean b) throws java.io.IOException
stream
- the PulseAudio stream to pause or resume the playback ofb
- true to pause or false to resume the playback
of the specified streamjava.io.IOException
public static PulseAudioSystem getPulseAudioSystem()
public javax.media.Renderer createRenderer(boolean playback)
DeviceSystem.createRenderer()
.
Overrides the implementation provided by AudioSystem because the
PulseAudio Renderer implementation does not follow the
convention of AudioSystem.createRenderer
in class AudioSystem
playback
- true if the new instance is to perform playback
or false if the new instance is to sound a notificationpublic long createStream(int sampleRate, int channels, java.lang.String mediaName, java.lang.String mediaRole) throws java.lang.RuntimeException
sampleRate
- the sample rate at which the new PulseAudio stream is
to input or outputchannels
- the number of channels of the audio to be input or output
by the new PulseAudio streammediaName
- the human-readable name of the new PulseAudio streammediaRole
- the PulseAudio logic role of the new streamjava.lang.RuntimeException
protected void doInitialize() throws java.lang.Exception
DeviceSystem.initialize()
to perform the very logic of the
initialization of this DeviceSystem. This instance has been
prepared for initialization by an earlier call to
DeviceSystem.preInitialize()
and the initialization will be completed with a
subsequent call to DeviceSystem.postInitialize()
.doInitialize
in class DeviceSystem
java.lang.Exception
- if an error occurs during the initialization of this
instance. The initialization of this instance will be completed with a
subsequent call to postInitialize() regardless of any
Exception thrown by doInitialize().public long getContext()
public void lockMainloop()
public void signalMainloop(boolean waitForAccept)
waitMainloop()
.waitForAccept
- true to not return before the signal is
accepted by a pa_threaded_mainloop_accept(); otherwise,
falsepublic java.lang.String toString()
toString
in class DeviceSystem
public void unlockMainloop()
lockMainloop()
.public int waitForStreamState(long stream, int stateToWaitFor)
stream
- the PulseAudio stream to wait forstateToWaitFor
- the PulseAudio state of the specified
stream to wait forpublic void waitMainloop()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.