server playback
This commit is contained in:
@ -81,7 +81,7 @@ class WindowsAudioManager:
|
||||
|
||||
def set_default_input_device(self, device_index):
|
||||
if(device_index is None):
|
||||
return self.get_current_input_device_sample_rate()
|
||||
return 0
|
||||
"""
|
||||
Set the default input audio device.
|
||||
|
||||
@ -95,41 +95,18 @@ class WindowsAudioManager:
|
||||
device_info = sd.query_devices(device_index)
|
||||
return device_info['default_samplerate']
|
||||
|
||||
def get_current_input_device_sample_rate(self):
|
||||
def set_default_output_device(self, device_index):
|
||||
if(device_index is None):
|
||||
return self.get_current_output_device_sample_rate()
|
||||
"""
|
||||
Get the sample rate of the current input device.
|
||||
Set the default output audio device.
|
||||
|
||||
:return: Sample rate of the current input device
|
||||
:param device_index: Index of the audio device
|
||||
:return: Sample rate of the selected device
|
||||
"""
|
||||
device_info = sd.query_devices(self.default_input)
|
||||
return device_info['default_samplerate']
|
||||
|
||||
def get_system_volume(self):
|
||||
"""
|
||||
Get the system master volume.
|
||||
sd.default.device[1] = device_index
|
||||
self.default_output = device_index
|
||||
|
||||
:return: Current system volume (0.0 to 1.0)
|
||||
"""
|
||||
devices = AudioUtilities.GetSpeakers()
|
||||
interface = devices.Activate(
|
||||
IAudioEndpointVolume._iid_,
|
||||
CLSCTX_ALL,
|
||||
None
|
||||
)
|
||||
volume = interface.QueryInterface(IAudioEndpointVolume)
|
||||
return volume.GetMasterVolumeLevelScalar()
|
||||
|
||||
def set_system_volume(self, volume_level):
|
||||
"""
|
||||
Set the system master volume.
|
||||
|
||||
:param volume_level: Volume level (0.0 to 1.0)
|
||||
"""
|
||||
devices = AudioUtilities.GetSpeakers()
|
||||
interface = devices.Activate(
|
||||
IAudioEndpointVolume._iid_,
|
||||
CLSCTX_ALL,
|
||||
None
|
||||
)
|
||||
volume = interface.QueryInterface(IAudioEndpointVolume)
|
||||
volume.SetMasterVolumeLevelScalar(volume_level, None)
|
||||
# Get the sample rate of the selected device
|
||||
device_info = sd.query_devices(device_index)
|
||||
return device_info['default_samplerate']
|
||||
Reference in New Issue
Block a user