System volume control with Python, QT: PySide.phonon.Phonon.AudioOutputDevice

I would like to access the (r / w) volume control wizard. I am currently using Windows 7.

There are "low-level" options for managing it:   Vista / win7 application volume management interface

The older version also uses the ctypesWindows DLL:   http://mail.python.org/pipermail/python-win32/2006-March/004436.html and, possibly, the work received (required pymedia): http://code.google. com / p / palarm / downloads / detail? name = alarmwaveout.py & can = 2 & q =

For cross-platform, it still doesn't work, so I thought about using a toolbox. QT, pyQT, or PySide come to mind since I wanted to experiment with QT:

 #!/usr/bin/python

 import sys
 from PySide.QtCore import *
 from PySide.QtGui import *

 import PySide.phonon

 app = QApplication(sys.argv)

 devicelist = PySide.phonon.Phonon.BackendCapabilities.availableAudioOutputDevices()
 print "Listing available audio output devices:"
 for device in devicelist:
  print " device:", device
  print "  description:", device.description()
  print "  index:", device.index()
  print "  isValid:", device.isValid()
  print "  name:", device.name()
  print "  property:", device.property( str( device.name() ) )
  print "  propertyNames:", device.propertyNames()
  print

 #~ audiodev = PySide.phonon.Phonon.AudioOutput()
 #~ slider = PySide.phonon.Phonon.VolumeSlider(audiodev)

 slider = PySide.phonon.Phonon.VolumeSlider( None )
 slider.setOrientation( Qt.Vertical )
 slider.show()

 app.exec_()
 sys.exit()

But I don’t understand how to connect VolumeSlider to an audio device (in this case, Master ("Speakers") or by default).

+3
source share

Source: https://habr.com/ru/post/1788475/


All Articles