Commit 343b57fe authored by Jürgen Herrmann's avatar Jürgen Herrmann

on insert:

  get and remember current default sink volume
  set remembered volume on new input sink
  set volume to 100% on old default sink
on remove:
  remember current default sink volume
  set remembered volume on new default sink

will be released as 0.39
parent 0e30105d
0.37
\ No newline at end of file
0.38
\ No newline at end of file
2do:
====
on insert:
get and remember current default sink volume
set remembered volume on new input sink
set volume to 100% on old default sink
on remove:
remember current default sink volume
set remembered volume on new default sink
done:
=====
on insert:
get and remember current default sink volume
set remembered volume on new input sink
set volume to 100% on old default sink
choose pulseaudio master sink
on remove:
remember current default sink volume
set remembered volume on new default sink
choose pulseaudio default sink
add proper desktop entry in debian package
react to changes in ladspa-t5-plugins:
......
......@@ -321,12 +321,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self._last_pulseaudio_default_sink = hw_sink
self.pushButtonInsert.setText("Insert")
self._mmaps = []
oldVolume = pulse_get_sink_volume(LADSPA_SINK_NAME)
os.system("pactl set-default-sink %s" % hw_sink)
cmd = """pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /pacmd move-sink-input /g' | sed 's/$/ %s/g'""" % hw_sink
ret = os.popen(cmd).read().strip("\n")
cmd = ret.replace("\n", "; ")
os.system(cmd)
os.system("pactl unload-module %s" % self._pulseaudio_moduleindex)
pulse_set_sink_volume(hw_sink, oldVolume)
self._pulseaudio_moduleindex = -1
self._modifyDefaultPa(action="remove")
self._isInserted = False
......@@ -352,6 +354,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
break
self.pushButtonInsert.setText("Remove")
self._last_pulseaudio_hw_sink = hw_sink
oldVolume = pulse_get_sink_volume(hw_sink)
cmd = "pactl load-module module-ladspa-sink "
cmd += "sink_name=%s " % LADSPA_SINK_NAME
cmd += "sink_master=%s " % hw_sink
......@@ -364,6 +367,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
ret = os.popen(cmd).read().strip("\n")
cmd = ret.replace("\n", "; ")
os.system(cmd)
pulse_set_sink_volume(LADSPA_SINK_NAME, oldVolume)
self._checkInserted()
if self._isInserted:
self._modifyDefaultPa(action="insert", masterSinkName=hw_sink)
......
Package: pulseaudio-parametric-eq
Version: 0.37
Version: 0.38
Section: audio
Priority: optional
Architecture: all
......
import math
import os
CURRENT_VERSION = "0.38"
CURRENT_VERSION = "0.39"
DIALSTEPS = 10000
......
......@@ -43,6 +43,18 @@ def q2dialSteps(q):
return int(round((DIALSTEPS/2) + math.log(q, 10) * (DIALSTEPS/2)))
def pulse_get_default_sink():
""" return default sink name """
global _PULSE
try:
if _PULSE is None:
_PULSE = pulsectl.Pulse(PA_CLIENT_NAME)
return _PULSE.server_info().default_sink_name
except pulsectl.pulsectl.PulseError:
_PULSE = None
return ""
def pulse_get_hw_sinks():
""" return hardware sink names """
global _PULSE
......@@ -57,3 +69,30 @@ def pulse_get_hw_sinks():
except pulsectl.pulsectl.PulseError:
_PULSE = None
return []
def pulse_get_sink_volume(sink_name):
""" return sink volume as float """
global _PULSE
try:
if _PULSE is None:
_PULSE = pulsectl.Pulse(PA_CLIENT_NAME)
for _sinkinfo in _PULSE.sink_list():
if _sinkinfo.name == sink_name:
return _sinkinfo.volume.value_flat
except pulsectl.pulsectl.PulseError:
_PULSE = None
return 0.0
def pulse_set_sink_volume(sink_name, volume):
""" set volume from float """
global _PULSE
try:
if _PULSE is None:
_PULSE = pulsectl.Pulse(PA_CLIENT_NAME)
for _sinkinfo in _PULSE.sink_list():
if _sinkinfo.name == sink_name:
_PULSE.volume_set_all_chans(_sinkinfo, volume)
except pulsectl.pulsectl.PulseError:
_PULSE = None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment