PDA

View Full Version : DirectSound audio buffer playing duration?


Dias
12-31-2006, 05:48 AM
Hi :)
Is there a way to set the playing duration of a DirectSound Buffer within the API or do i have to use threads/timers to keep track of when to stop playing myself?

(I am using C# and MDX)

Thanks in advance.

va!n
12-31-2006, 07:43 AM
Hello.. i am new here... Following basic should work and show you how to calculate the playtime. hope its help you.

lSizeInBytes.l / lBitrate.l = lLengthInSeconds.l

3,882,423 bytes = 31,059,384 bits
128 kbit/s = 131,072 bits/s

31,059,384 / 131,072 = 237 seconds.

Dias
12-31-2006, 07:58 AM
Hi, and thanks for you reply.
I dont think i was clear enough though.
What i mean is that i already know the length of the clip and any position within it as it plays.

What i wonder is if there is any support in DirectSound to just play a partion of the sound. I know you can set a starting position within the buffer, but i havent found where/how to set an ending position, which means it always plays to the end of the buffer.