git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-05-07 22:18:37 +00:00
parent 68cc401372
commit 9318d9b32d

View File

@@ -9,7 +9,7 @@ class TestPanel(wx.Panel):
def __init__(self, parent, log): def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1) wx.Panel.__init__(self, parent, -1)
self.log = log self.log = log
b = wx.Button(self, -1, "Play Sound 1 (sync)", (25, 25)) b = wx.Button(self, -1, "Play Sound 1 (sync)", (25, 25))
self.Bind(wx.EVT_BUTTON, self.OnButton1, b) self.Bind(wx.EVT_BUTTON, self.OnButton1, b)
@@ -32,9 +32,13 @@ class TestPanel(wx.Panel):
def OnButton2(self, evt): def OnButton2(self, evt):
try: try:
#sound = wx.Sound(opj('data/plan.wav')) if True:
data = open(opj('data/plan.wav'), 'rb').read() sound = wx.Sound(opj('data/plan.wav'))
sound = wx.SoundFromData(data) else:
# sounds can also be loaded from a buffer object
data = open(opj('data/plan.wav'), 'rb').read()
sound = wx.SoundFromData(data)
self.log.write("before Play...\n") self.log.write("before Play...\n")
sound.Play(wx.SOUND_ASYNC) sound.Play(wx.SOUND_ASYNC)
wx.YieldIfNeeded() wx.YieldIfNeeded()
@@ -55,7 +59,7 @@ class TestPanel(wx.Panel):
except NotImplementedError, v: except NotImplementedError, v:
wx.MessageBox(str(v), "Exception Message") wx.MessageBox(str(v), "Exception Message")
dlg.Destroy() dlg.Destroy()
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@@ -68,8 +72,8 @@ def runTest(frame, nb, log):
overview = """<html><body> overview = """<html><body>
<h2>Sound</h2> <h2>Sound</h2>
This class represents a short wave file, in Windows WAV format, that can 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 be stored in memory and played. Currently this class is implemented on Windows
and GTK (Linux) only. and GTK (Linux) only.
<p> <p>
This demo offers two examples, both driven by buttons, but obviously the event This demo offers two examples, both driven by buttons, but obviously the event