- }
-
- public boolean getMute() throws VLCException {
- return _getMute();
- }
-
- public void setMute( boolean value ) throws VLCException {
- _setMute( value );
-
- }
-
- public void toggleMute() throws VLCException {
- _toggleMute();
- }
-
- public int getVolume() throws VLCException {
- return _getVolume();
- }
-
- public void setVolume(int volume) throws VLCException {
- _setVolume( volume );
-
- }
-
+ }
+
+ public boolean getMute() throws VLCException {
+ return _getMute();
+ }
+
+ public void setMute(boolean value) throws VLCException {
+ _setMute(value);
+
+ }
+
+ public void toggleMute() throws VLCException {
+ _toggleMute();
+ }
+
+ public int getVolume() throws VLCException {
+ return _getVolume();
+ }
+
+ public void setVolume(int volume) throws VLCException {
+ _setVolume(volume);
+ }
+
+ public boolean addVolumeListener(VolumeListener listener) {
+ HashSet listeners = (HashSet) objListeners.get(this);
+ return listeners.add(listener);
+ }
+
+ public boolean removeVolumeListener(VolumeListener listener) {
+ HashSet listeners = (HashSet) objListeners.get(this);
+ return listeners.remove(listener);
+ }
+
+ // this method is invoked natively
+ private static void wakeupListeners() {
+ Set audioObjects = objListeners.keySet();
+ Iterator audioObjectsIterator = audioObjects.iterator();
+
+ while (audioObjectsIterator.hasNext()) {
+ Audio audioObject = (Audio) audioObjectsIterator.next();
+ HashSet listeners = (HashSet) objListeners.get(audioObject);
+
+ Iterator listenerIterator = listeners.iterator();
+ while (listenerIterator.hasNext()) {
+ VolumeListener listener = (VolumeListener) listenerIterator.next();
+ listener.volumeChanged();
+ }
+ }
+ }
+