The interfaces for the call playback volume control.

cusax-fix
Damian Minkov 16 years ago
parent 16d134e38a
commit 0092783633

@ -119,6 +119,11 @@ public class MediaServiceImpl
*/
private static Map<MediaFormat, Byte> dynamicPayloadTypePreferences;
/**
* The volume control of the media service playback.
*/
private static VolumeControl volumeControl;
/**
* Create a <tt>MediaStream</tt> which will use a specific
* <tt>MediaDevice</tt> for capture and playback of media. The new instance
@ -530,6 +535,17 @@ public ZrtpControl createZrtpControl()
return new ZrtpControlImpl();
}
/**
* Returns the control that handles current playback levels.
*
* @return the volume playback control.
*/
public VolumeControl getVolumeControl()
{
// returns the uninitialized value as still not implemented
return volumeControl;
}
/**
* Get available screens.
*

@ -138,6 +138,12 @@ public MediaStream createMediaStream(StreamConnector connector,
*/
public ZrtpControl createZrtpControl();
/**
* Returns the control that handles current playback levels.
* @return the volume playback control.
*/
public VolumeControl getVolumeControl();
/**
* Get available <tt>ScreenDevice</tt>s.
*

@ -0,0 +1,71 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.neomedia;
import net.java.sip.communicator.service.neomedia.event.*;
/**
* Controls the playback volume in media service.
*
* @author Damian Minkov
*/
public interface VolumeControl
{
public final static String PLAYBACK_VOLUME_LEVEL_PROPERTY_NAME
= "net.java.sip.communicator.service.media.PLAYBACK_VOLUME_LEVEL";
/**
* Current volume value.
* @return the current volume level.
*/
public float getVolume();
/**
* Returns the minimum allowed volume value.
* @return the minimum allowed volume value.
*/
public float getMinValue();
/**
* Returns the maximum allowed volume value.
* @return the maximum allowed volume value.
*/
public float getMaxValue();
/**
* Changes volume level.
* @param value the new level to set.
* @return the actual level which was set.
*/
public float setVolume(float value);
/**
* Mutes current sound playback.
* @param mute mutes/unmutes playback.
*/
public void setMute(boolean mute);
/**
* Get mute state of sound playback.
* @return mute state of sound playback.
*/
public boolean getMute();
/**
* Adds a <tt>VolumeChangeListener</tt> to be informed for any change
* in the volume levels.
*
* @param listener volume change listener.
*/
public void addVolumeChangeListener(VolumeChangeListener listener);
/**
* Removes a <tt>VolumeChangeListener</tt>.
* @param listener the volume change listener to be removed.
*/
public void removeVolumeChangeListener(VolumeChangeListener listener);
}

@ -0,0 +1,73 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.neomedia.event;
import net.java.sip.communicator.service.neomedia.*;
import java.util.*;
/**
* Represents the event fired when playback volume value has changed.
*
* @author Damian Minkov
*/
public class VolumeChangeEvent
extends EventObject
{
/**
* Current level of volume.
*/
private float level;
/**
* Is volume muted.
*/
private boolean mute;
/**
* Constructs a VolumeChangeEvent with current values.
*
* @param source Volume control from which the change comes.
* @param level volume level.
* @param mute is muted.
* @throws IllegalArgumentException if source is null.
*/
public VolumeChangeEvent(VolumeControl source, float level, boolean mute)
{
super(source);
this.level = level;
this.mute = mute;
}
/**
* The source control which has changed the volume.
* @return the volume control.
*/
public VolumeControl getSourceVolumeControl()
{
return (VolumeControl)getSource();
}
/**
* Current volume level.
* @return current volume level.
*/
public float getLevel()
{
return level;
}
/**
* Is current volume muted.
* @return is current volume muted.
*/
public boolean getMute()
{
return mute;
}
}

@ -0,0 +1,22 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.neomedia.event;
/**
* <tt>VolumeChangeListener</tt> used to notify for changes in the
* playback volume.
*
* @author Damian Minkov
*/
public interface VolumeChangeListener
{
/**
* Event fired when volume has changed.
* @param volumeChangeEvent the volume change event.
*/
public void volumeChange(VolumeChangeEvent volumeChangeEvent);
}
Loading…
Cancel
Save