def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log
b = wx.Button(self, -1, "Play Sound 1 (sync)", (25, 25))
self.Bind(wx.EVT_BUTTON, self.OnButton1, b)
b = wx.Button(self, -1, "Play Sound 1 (sync)", (25, 25))
self.Bind(wx.EVT_BUTTON, self.OnButton1, b)
- sound = wx.Sound(opj('data/plan.wav'))
+ if True:
+ sound = wx.Sound(opj('data/plan.wav'))
+ else:
+ # sounds can also be loaded from a buffer object
+ data = open(opj('data/plan.wav'), 'rb').read()
+ sound = wx.SoundFromData(data)
+
wx.YieldIfNeeded()
self.log.write("...after Play\n")
except NotImplementedError, v:
wx.YieldIfNeeded()
self.log.write("...after Play\n")
except NotImplementedError, v:
- sound = wx.Sound(dlg.GetPath())
- sound.Play()
+ #sound = wx.Sound(dlg.GetPath(), wx.SOUND_SYNC)
+ #sound.Play()
+
+ # another way to do it.
+ wx.Sound.PlaySound(dlg.GetPath(), wx.SOUND_SYNC)
+
except NotImplementedError, v:
wx.MessageBox(str(v), "Exception Message")
dlg.Destroy()
except NotImplementedError, v:
wx.MessageBox(str(v), "Exception Message")
dlg.Destroy()
-This class represents a short wave file, in Windows WAV format, that can
-be stored in memory and played. Currently this class is implemented on Windows
+This class represents a short wave file, in Windows WAV format, that can
+be stored in memory and played. Currently this class is implemented on Windows