Multiple Phonon audioOutput instances don't work properly on linux?

I'm working on a soundboard program. The window is populated with multiple instances of the below SoundPlayer class. When running my program the volume sliders don't affect their own player. The last initiated player's volume slider controls the volume for the entire program. I've printed out all the instances of the audioObjects, volumeSliders, etc, and none of them are shared between players. I had each player print out it's volume, and using the correct volume sliders does change the volume (audioOutput.volume()), but with no audible effect. Using the last initated volume slider the audioOutput volume for the other players doesn't change the volume value but yet there is an audible effect. I'm at a loss since this works perfectly fine on multiple Windows machines but not on ubuntu 12.04. After seeking help elsewhere and running this on multiple machines I'm beginning to think it's a PySide/Phonon problem with linux?

EDIT: Seems the problem lies more with audioOutput. I connected some buttons to .setVolume() and manually adjusted the volume and it bugged out the same as before. Only the last initiated player's volume actually affects the audible sound, and do so for every player.

SoundPlayer class: (Some of the ui setting up was trimmed for brevity. Key parts include createAttr()/loadAttr() where the audioOutputs and MediaObjects are created, and setupUi() where the volume sliders are created.)

class SoundPlayer():
  def __init__(self, MainWindow, position, instance, attributes):
    self.instance = instance
    self.mainWindow = MainWindow
    self.pos = position
    self.setupUi(self.pos)
    if attributes == '':
      self.createAttr()
      self.attributes = [self.name, self.filename]
    else:
      self.attributes = attributes
      self.loadAttr()
    self.buttons()
    self.directory = QDesktopServices.storageLocation(QDesktopServices.MusicLocation)

  def updateDevice(self, device):
    self.audio.setOutputDevice(device)
    Phonon.createPath(self.media, self.audio)

  def loadAttr(self):
    self.name = self.attributes[0]
    self.filename = self.attributes[1]
    self.media = Phonon.MediaObject(self.instance)
    self.audio = Phonon.AudioOutput(Phonon.MusicCategory, self.instance)
    self.source = Phonon.MediaSource(self.filename)
    Phonon.createPath(self.media, self.audio)
    self.label.setText(self.name)
    self.updateUi()

  def createAttr(self):
    self.filename = ''
    self.name = 'None'
    self.media = Phonon.MediaObject(self.instance)
    self.audio = Phonon.AudioOutput(Phonon.MusicCategory, self.instance)
    self.source = Phonon.MediaSource(self.filename)
    Phonon.createPath(self.media, self.audio)
    self.media.stateChanged.connect(lambda x,y: self.changed(x,y))
    self.label.setText(self.name)
    self.updateUi()

  def saveAttr(self):
    self.attributes = [self.name, self.filename]

  def buttons(self):
    self.playButton.clicked.connect(self.onplaybutton())
    self.resetButton.clicked.connect(self.onresetbutton())
    self.stopButton.clicked.connect(self.onstopbutton())
    self.optionButton.clicked.connect(self.optionDialog())

  def onplaybutton(self):
    state = self.media.state()
    if state != Phonon.State.PausedState and state != Phonon.State.PlayingState:
      self.playButton.setIcon(QtGui.QIcon(":pause.png"))
      self.media.setCurrentSource(self.source)
      self.media.play()
    elif state == Phonon.State.PlayingState:
      self.playButton.setIcon(QtGui.QIcon(":play.png"))
      self.media.pause()
    elif state == Phonon.State.PausedState:
      self.playButton.setIcon(QtGui.QIcon(":pause.png"))
      time = self.media.currentTime()
      self.media.play()
      self.media.seek(time)

  def onresetbutton(self):
    self.media.setCurrentSource(self.source)
    self.media.play()
    self.playButton.setIcon(QtGui.QIcon(":pause.png"))

  def onstopbutton(self):
    self.media.stop()
    self.playButton.setIcon(QtGui.QIcon(":play.png"))

  def updateUi(self):
    self.seek = Phonon.SeekSlider(self.media, self.widget)
    self.seek.resize(111, 21)
    self.seek.show()
    self.volume = Phonon.VolumeSlider(self.audio, self.volumeWidget)
    self.volume.resize(111, 21)
    self.volume.show()
    self.playButton.setIcon(QtGui.QIcon(":play.png"))
    self.media.stateChanged.connect(lambda x,y: self.changed(x,y))

Answers


Most probably not your fault: https://bugs.kde.org/show_bug.cgi?id=321288


Need Your Help

Failure to write NSString to file on iPad

objective-c nsstring ipad

I'm using a text file to save the changes made by a user on a list (the reason that I'm doing this is so that I can upload the text file to a PC later on, and from there insert it into an Excel

How can I do 64-bit hex/decimal arithmetic AND output a full number in HEX as string in Perl?

perl math 64-bit printf

I need to do some arithmetic with large hexadecimal numbers below, but when I try to output I'm getting overflow error messages "Hexadecimal number > 0xffffffff non-portable", messages about not po...