Getting the length in millisecond

Hi …

Am a newbie of sdl_mixer1.2.7,

i wanted to know how to get the length of a sample in millisecond…

Is there any function to get this…

Regards
Lijith

Hi,

El Jueves, 18 de Enero de 2007 11:05, Lijith P escribi?:

i wanted to know how to ?get the length of a sample in millisecond…

Is there any function to get this…

I don’t think so, but you can try:

milliseconds = (wave’s data lenght in bytes) / ( samplerate * channels *
sizeof(sample)) * 1000

Where

  • samplerate would be 22050, 44100, …
  • channels 1 or 2 depending if it is stereo or mono.
  • sizeof(sample) = 1, 2 depending if the sample is 8 or 16 bits long.

HTH

Alberto