Commit 4f3b4ae1 authored by Jürgen Herrmann's avatar Jürgen Herrmann

added packaging helpers

parent 53ab3a9d
debian/
builds/
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/builds" />
<excludeFolder url="file://$MODULE_DIR$/debian" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
......
0.13
\ No newline at end of file
......@@ -12,6 +12,7 @@ import mmap
import numpy
import os
from PyQt4 import QtGui, QtCore
import re
from scipy import signal
import struct
from time import time
......@@ -297,6 +298,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
os.system(cmd)
os.system("pactl unload-module %s" % self._pulseaudio_moduleindex)
self._pulseaudio_moduleindex = -1
self._modifyDefaultPa(action="remove")
self._isInserted = False
else:
self.pushButtonInsert.setText("Remove")
......@@ -314,6 +316,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
os.system(cmd)
self._checkInserted()
if self._isInserted:
self._modifyDefaultPa(action="insert")
self._setupMmaps()
self._needApply = True
......@@ -366,24 +369,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
10000.0, 0.0, 1.0,
0.0)
else:
params = self._uiParams()
buffer = struct.pack("fffffffffffffffff",
1.0,
float(self.lineEditFrequencyLow.text().split(" ")[0]),
float(self.lineEditGainLow.text().split(" ")[0]),
float(self.lineEditQLow.text()),
float(self.lineEditFrequencyParam1.text().split(" ")[0]),
float(self.lineEditGainParam1.text().split(" ")[0]),
float(self.lineEditQParam1.text()),
float(self.lineEditFrequencyParam2.text().split(" ")[0]),
float(self.lineEditGainParam2.text().split(" ")[0]),
float(self.lineEditQParam2.text()),
float(self.lineEditFrequencyParam3.text().split(" ")[0]),
float(self.lineEditGainParam3.text().split(" ")[0]),
float(self.lineEditQParam3.text()),
float(self.lineEditFrequencyHigh.text().split(" ")[0]),
float(self.lineEditGainHigh.text().split(" ")[0]),
float(self.lineEditQHigh.text()),
(self.sliderGain.value() / 10.0 + MIN_GAIN))
params[0], params[1], params[2],
params[3], params[4], params[5],
params[6], params[7], params[8],
params[9], params[10], params[11],
params[12], params[13], params[14],
params[15])
except ValueError:
buffer = None
raise
......@@ -537,6 +531,60 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self._needApply = True
def _modifyDefaultPa(self, action=None):
""" modify ~/.config/pulse/default.pa """
try:
f = open(os.path.expanduser("~/.config/pulse/default.pa"), "r")
content = f.read()
f.close()
except (OSError, IOError, FileNotFoundError):
dlg = QtGui.QMessageBox()
dlg.critical("FATAL ERROR", "Could not read ~/.config/pulse/default.pa !")
return
try:
f = open(os.path.expanduser("~/.config/pulse/default.pa.backup_by_parameq"), "w")
f.write(content)
f.close()
except (OSError, IOError, FileNotFoundError):
dlg = QtGui.QMessageBox()
dlg.critical("FATAL ERROR", "Could not write ~/.config/pulse/default.pa.backup_by_parameq !")
return
if action == "insert":
masterSinkName = self._pulseaudioMasterSink()
params = self._uiParams()
if content[-1] != "\n":
content += "\n"
if content[-2:] != "\n\n":
content += "\n"
content += "### BEGIN: Parametric equalizer configuration\n"
content += "### Generated from: pulseaudio-parameq\n"
content += "load-module module-ladspa-sink sink_name=%s " % LADSPA_SINK_NAME
content += "master=%s plugin=%s label=%s " % (masterSinkName,
LADSPA_LIBRARY,
LADSPA_LABEL)
content += "control=%0.2f,%0.2f,%0.2f," % (params[0], params[1], params[2])
content += "%0.2f,%0.2f,%0.2f," % (params[3], params[4], params[5])
content += "%0.2f,%0.2f,%0.2f," % (params[6], params[7], params[8])
content += "%0.2f,%0.2f,%0.2f," % (params[9], params[10], params[11])
content += "%0.2f,%0.2f,%0.2f," % (params[12], params[13], params[14])
content += "%0.2f\n" % (params[15])
content += "set-default-sink %s\n" % LADSPA_SINK_NAME
content += "set-sink-volume %s 65536\n" % masterSinkName
content += "set-sink-mute %s 0\n" % masterSinkName
content += "### END: Parametric equalizer configuration\n"
if action == "remove":
pattern = "### BEGIN: Parametric equalizer configuration\n"
pattern += ".*### END: Parametric equalizer configuration\n"
content = re.sub(pattern, "", content, flags=re.DOTALL)
try:
f = open(os.path.expanduser("~/.config/pulse/default.pa"), "w")
f.write(content)
f.close()
except (OSError, IOError, FileNotFoundError):
dlg = QtGui.QMessageBox()
dlg.critical("FATAL ERROR", "Could not write ~/.config/pulse/default.pa.backup_by_parameq !")
def _onDialFrequencyChanged(self, suffix):
""" handle changed frequency dial for given suffix"""
self._dirty()
......@@ -631,7 +679,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def _pulseaudioMasterSink(self):
""" return name of pulseaudio master sink """
ret = os.popen('pacmd stat|grep "Default sink name"').read().replace("\n", "").replace("Default sink name: ", "")
if ret == "Default sink name: %s" % LADSPA_SINK_NAME:
if ret == LADSPA_SINK_NAME:
cmd = r"""pacmd info | grep --color=never -A30 "%s" | grep --color=never -m1 'device.master_device = ' | sed 's/device.master_device = //g' | sed 's/"//g' | sed 's/^[ \t]*//'""" % ret
masterdev = os.popen(cmd).read().replace("\n", "")
else:
......@@ -639,7 +687,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
return masterdev
def _readIniSettings(self):
""" read ini settings """
s = self._settings
......@@ -730,6 +777,26 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self._needRedraw = False
def _uiParams(self):
""" return all 16 ui parameters as floats """
return (float(self.lineEditFrequencyLow.text().split(" ")[0]),
float(self.lineEditGainLow.text().split(" ")[0]),
float(self.lineEditQLow.text()),
float(self.lineEditFrequencyParam1.text().split(" ")[0]),
float(self.lineEditGainParam1.text().split(" ")[0]),
float(self.lineEditQParam1.text()),
float(self.lineEditFrequencyParam2.text().split(" ")[0]),
float(self.lineEditGainParam2.text().split(" ")[0]),
float(self.lineEditQParam2.text()),
float(self.lineEditFrequencyParam3.text().split(" ")[0]),
float(self.lineEditGainParam3.text().split(" ")[0]),
float(self.lineEditQParam3.text()),
float(self.lineEditFrequencyHigh.text().split(" ")[0]),
float(self.lineEditGainHigh.text().split(" ")[0]),
float(self.lineEditQHigh.text()),
(self.sliderGain.value() / 10.0 + MIN_GAIN))
def _valuesToPreset(self):
""" make Preset from current values on UI """
preset = Preset()
......
Package: pulseaudio-parametric-eq
Version: _VERSION_
Section: audio
Priority: optional
Architecture: all
Depends: ladspa-t5-plugins, python3
Maintainer: Jürgen Herrmann (t-5@t-5.eu)
Description: Pulseaudio Parametric Equalizer
A python/qt GUI for managing a fully parametric 3-and equalizer with shelves.
import math
CURRENT_VERSION = "0.1a"
CURRENT_VERSION = "0.13"
DIALSTEPS = 10000
......@@ -56,6 +56,8 @@ GRAPH_HEIGHT = 250
INPUT_SUFFIXES = ("Low", "Param1", "Param2", "Param3", "High")
LADSPA_SINK_NAME = "ladspa_output.t5_3band_parameq_with_shelves"
LADSPA_LABEL = "3band_parameq_with_shelves"
LADSPA_LIBRARY = "t5_3band_parameq_with_shelves"
# Simulated samplerate for drawinf frequency responses
SR = 44100
......
#!/bin/bash
cd ..
VERSION=`cat .previous_version`
echo -n "Version (previous version was $VERSION: "
read VERSION
sudo chown -R jh debian/DEBIAN
cat control.in | sed "s#Version: _VERSION_#Version: ${VERSION}#" > debian/DEBIAN/control
sudo cp -f pulseaudio-parametric-eq debian/usr/bin
sudo cp -f DataClasses/*.py debian/usr/lib/pulseaudio-parametric-eq/DataClasses
sudo cp -f designer_qt4/*.py debian/usr/lib/pulseaudio-parametric-eq/designer_qt4
sudo cp -f helpers/*.py debian/usr/lib/pulseaudio-parametric-eq/helpers
sudo cp -f PAPEq_rc/*.py debian/usr/lib/pulseaudio-parametric-eq/PAPEq_rc
sudo cp -f WindowClasses/*.py debian/usr/lib/pulseaudio-parametric-eq/WindowClasses
sudo cp -f licence.txt debian/usr/lib/pulseaudio-parametric-eq
sudo cp -f pulseaudio_parameq.py debian/usr/lib/pulseaudio-parametric-eq
sudo chown -R root.root debian/
dpkg --build debian && \
mv debian.deb builds/pulseaudio-parametric-eq_${VERSION}_all.deb && \
aptly repo add t-5 builds && \
echo -n "$VERSION" > .previous_version
#!/bin/bash
cd ..
DT=`date +%Y%m%d_%H%M%S `
aptly snapshot create t-5_$DT from repo t-5
aptly publish drop xenial
aptly publish snapshot t-5_$DT
rsync -r --progress /home/jh/.aptly/public/ /home/jh/t-5.eu/debian-repo/
#!/bin/sh
python3 /usr/lib/pulseaudio-parametric-eq/pulseaudio_parameq.py
#!/usr/bin/python3
"""
Pulseaudio Parametric Equalizer GUI
=======
......
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