[Openal] Retrieve the total number of seconds of a sound file ?

Daniel PEACOCK dpeacock at creativelabs.com
Thu May 22 11:11:18 PDT 2008





There isn't a way to get this from OpenAL - however it is a fairly easy
computation to do yourself if you know the details about the Buffer (e.g
sample rate, length in bytes, block alignment (== bits per sample
multiplied by the number of channels)).  These all need to be known to pass
the data to OpenAL in the first place.

BlockAlignment = (BitsPerSample * NumChannels) / 8
DurationInSeconds = LengthInBytes / (SampleRate * BlockAlignment)

Dan
Creative Labs, Inc.

Notice
The information in this message is confidential and may be legally
privileged.  It is intended solely for the addressee.  Access to this
message by anyone else is unauthorized.  If you are not the intended
recipient,  any disclosure,  copying or distribution of the message,  or
any action taken by you in reliance on it,  is prohibited and may be
unlawful.  If you have received this message in error,  please delete it
and contact the sender immediately.  Thank you.




                                                                           
             wassim_belhadj                                                
             <wassim_belhadj at t                                             
             opnet.tn>                                                  To 
             Sent by:                  openal at opensource.creative.com      
             openal-bounces at op                                          cc 
             ensource.creative                                             
             .com                                                  Subject 
                                       [Openal] Retrieve the total number  
                                       of seconds of a sound file ?        
             05/22/2008 10:01                                              
             AM                                                            
                                                                           
                                                                           
                                                                           
                                                                           





Dear list

How to get the number of seconds of a sound file with Openal?

I do not want to retrieve the number of seconds when the source is in play
(that I know do) but I want to retrieve the total number of seconds to get
a display like 01:00 / 03:40

what I try to retrieve is 03:40

Thank you in advance

_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal

ForwardSourceID:NT0006111A



More information about the Openal mailing list