Menu

#5 SetEndStreamCallback causing repeatable python crash

open
nobody
None
5
2006-05-19
2006-05-19
futnuh
No

Hi Peter,

First off, thanks *so* much for writing pySonic and
making it available.

The problem: I am getting a repeatable crash with
pySonic when attempting stream callbacks. I originally
thought it was my usage but I've pared it back to the
simplest of examples taken from the tutorial page:
http://www.cs.unc.edu/~parente/tech/tr07.shtml

On my system (pySonic v0.8, python 2.4, FMOD 3.75,
fully patched Windows XP, dual-core P4 3GHz), the
following crashes python every time. With the
time.sleep(0.5) uncommented, crashes no longer occur
(or have become extremely infrequent). With the
time.sleep(0.005) uncommented, 75% of the time it runs,
the remaining quarter of cases crash - ocassionally
with the error shown.

While this looks like a threading problem, I am running
in a single thread. Perhaps though it is something to
do with having a dual-core cpu (though wouldn't this
bug have shown up on earlier multi-processor systems?).

Any help would be much appreciated. I am under
pressure to have this working properly by next week.

------------- test4.py ------------------
import pySonic
import time

# define a callback function
flag = False
def stream_done(source):
global flag
flag = True
print 'stream ended'

# create world and source; prepare audio
w = pySonic.World()
src = pySonic.Source()
src.Sound =
pySonic.FileStream('testsoundmanager-sample02.wav')
src.SetEndStreamCallback(stream_done)

# play until callback
src.Play()
while not flag:
pass
#time.sleep(0.005)
#time.sleep(0.5)

------------------------------------------

$ python test4.py
stream ended
Fatal Python error: This thread state must be current
when releasing

This application has requested the Runtime to terminate
it in an unusual way.
Please contact the application's support team for more
information.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB