wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.33k stars 516 forks source link

wx.Sound Demo - Bug might not exist anymore...? #1078

Open Metallicow opened 6 years ago

Metallicow commented 6 years ago

Operating system: Win7 wxPython version & source: wxPython 4.0.4a1.dev4042+af7f52b6 msw (phoenix) wxWidgets 3.0.5 Python version & source: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)] on win32

Description of the problem: Working on getting some more of the demos in https://github.com/Metallicow/wxPython-Sample-Apps-and-Demos updated and whatnot to xwx phoenix 4.0.x. Came across wx.Sound and found loop option and need to clean cruft out.

@RobinD42 Is this bug still in phoenix? What bug? Is there a reference to this anywhere in history?! Otherwise remove line... Also... I think the 'except NotImplementedError as exc:' stuff can be removed. Maybe my memory is foggy... but what was NotImplemented?

    def OnButton2(self, event):
        try:
            if True:
                sound = wx.adv.Sound(gDataDir + os.sep + 'plan.wav')
            else:
                # Sounds can also be loaded from a buffer object.
                data = open(gDataDir + os.sep + 'plan.wav', 'rb').read()
                sound = wx.SoundFromData(data)

            self.log.WriteText("before Play...\n")
            sound.Play(wx.adv.SOUND_ASYNC)
            self.sound = sound  # save a reference (This shoudln't be needed, but there seems to be a bug...)
            ## wx.YieldIfNeeded()
            self.log.WriteText("...after Play\n")
        except NotImplementedError as exc:
            wx.MessageBox(str(exc), "Exception Message")

    def OnButton3(self, event):
        try:
            sound = wx.adv.Sound(gDataDir + os.sep + 'plan.wav')
            self.log.WriteText("before Play...\n")
            # Loop must be played asynchronously.
            sound.Play(wx.adv.SOUND_ASYNC | wx.adv.SOUND_LOOP)
            self.log.WriteText("...after Play\n")
        except NotImplementedError as exc:
            wx.MessageBox(str(exc), "Exception Message")
Metallicow commented 6 years ago

'xwx' by the way is my term for classic/phoenix compatible code