Updates listener for audio media configuration. This resolves the problem reported by Lyubomir Marinov about audio capture no more visible in audio tab preferences.

cusax-fix
Vincent Lucas 14 years ago
parent afb27d05c3
commit 469ea8c555

@ -261,6 +261,13 @@ public void itemStateChanged(ItemEvent e)
captureCombo,
capturePreview);
}
else
{
audioLevelListenerThread.init(
audioSystem,
captureCombo,
capturePreview);
}
}
/**
@ -1031,18 +1038,18 @@ private class AudioLevelListenerThread
/**
* The audio system used to get and set the sound devices.
*/
private final AudioSystem audioSystem;
private AudioSystem audioSystem;
/**
* The combo box used to select the device the user wants to use.
*/
private final JComboBox comboBox;
private JComboBox comboBox;
/**
* The sound level indicator used to show the effectiveness of the
* capture device.
*/
private final SoundLevelIndicator soundLevelIndicator;
private SoundLevelIndicator soundLevelIndicator;
/**
* The buffer used for reading the capture device.
@ -1085,16 +1092,49 @@ public AudioLevelListenerThread(
final AudioSystem audioSystem,
final JComboBox comboBox,
final SoundLevelIndicator soundLevelIndicator)
{
this.init(audioSystem, comboBox, soundLevelIndicator);
}
/**
* Creates a new listener to combo box and affect changes to the audio
* level indicator.
*
* @param audioSystem The audio system used to get and set the sound
* devices.
* @param comboBox The combo box used to select the device the user
* wants to use.
* @param soundLevelIndicator The sound level indicator used to show the
* effectiveness of the capture device.
*/
public void init(
final AudioSystem audioSystem,
final JComboBox comboBox,
final SoundLevelIndicator soundLevelIndicator)
{
this.audioSystem = audioSystem;
this.comboBox = comboBox;
this.soundLevelIndicator = soundLevelIndicator;
this.runDeviceSession = new Thread(this);
this.runDeviceSession.start();
// When this code is call to reinit the audio level indicator, then
// first remove old listeners for the combo box.
if(this.comboBox != null)
this.comboBox.removeActionListener(this);
this.comboBox = comboBox;
if (comboBox != null)
comboBox.addActionListener(this);
// When this code is call to reinit the audio level indicator, then
// first remove old listeners for the sound level indicator.
if(this.soundLevelIndicator != null)
{
HierarchyListener[] hierarchyListeners
= soundLevelIndicator.getHierarchyListeners();
for(int i=0; i < hierarchyListeners.length; ++i)
{
soundLevelIndicator.removeHierarchyListener(
hierarchyListeners[i]);
}
}
this.soundLevelIndicator = soundLevelIndicator;
soundLevelIndicator.addHierarchyListener(
new HierarchyListener()
{
@ -1115,6 +1155,13 @@ public void run()
}
}
});
// Keeps the same single thread for the whole Jitsi session.
if(this.runDeviceSession == null)
{
this.runDeviceSession = new Thread(this);
this.runDeviceSession.start();
}
}
/**

Loading…
Cancel
Save