[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [pygame] Timing...
> Unless I'm missing something, I don't know why threading would help.
> In this case, things will be even worse than calling per frame, because
> you're spinning
> 100% of whatever the CPU can muster for this thread, virtually grinding
> game to a halt.
- No.. that is not how threads work. The CPU will divide it's power to your
Well, I do know how threads work :)
(Blame me and friends for writing the win3.1 multimedia apis - though
I didn't get to design most of them...)
- sound thread and the main thread (if your thread loop is working with a
- delay of say 20ms or so you will hardly notice speed changes in your main
Yup, I agree, that's why I mentioned using a sleep w/your threads in my
> Adding a time.sleep(ms_wait) would be an option to give the game some
> ticks - but in any case you
> still need to wait for get_busy to return false, at which time it's too
> for a sample to appear again in time. (Even a done event would suffer the
> same problem,
> but at least take no CPU during the play.)
-It would be perfect if you'd know the time of your samples.. but I guess
-knowing that you will either have to check for it ending all of the time
-(thus taking up all processing power) or accept a small delay. If you could
-find out the time for your sample tho you could start the next one after an
When I said "sample" I meant literally one sample point, i.e., one ADC
I think you're use is a wave segment. My mistake for not being more clear.
> I suppose I'm too picky comming from a speech background - if you're
> just doing sound f/x or you're willing to have the thing sound like most
> telephony IVR
> systems, these schemes should be okay if you have enough CPU to spare.
-I'm not familiar with speech in pygame (nor in any other app actually)..
-I also wouldn't ever want to time my sounds in a ms range.. Usually it is
-more than enough to play one sound after the other with a small delay.. but
-if you can't work w/ that restriction I gotta admit I won't be a lot of
That's the thing - I'm not trying to time the sounds at all - I just
want it to come out all in one piece...
> Why don't you simply use threading for this?
> Some more risky brain code (building on pete's code):
-Please avoid using that code from my last mail.. it was totally pointless
-as it missed the loop in def update. Of course you will have to keep the
-thread alive by looping the get_busy call.
No prob - You're braver than me - I don't even try posting code off the cuff
(unless it's really late :) )
I'll probably do soemthing like this anyway, unless it turns out to be a
Raiser, Frank aka CrashChaos
IRC: 126.96.36.199:6667 #United-Programmers
pygame mailing list
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
pygame mailing list