realbasic-nug
[Top] [All Lists]

Getting song duration and using Sound class for playing the sound

To: realbasic-nug at lists dot realsoftware dot com
Subject: Getting song duration and using Sound class for playing the sound
From: Emile Schwarz <emile dot a dot schwarz at wanadoo dot fr>
Date: Fri, 31 Dec 2004 09:56:34 +0100
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Hi,

here is my first (*) New Year gift (fresh from the testing department).

REALbasic 5.5.4 for Mac OS X (not tested on Windows, hardware not available at writing time)
Mac OS X 10.3.7


You already saw (read ?) my post about the Sound Class not working under Windows XP yesterday. So I continue to work on that subject and come earlier this morning (around 10) to the part I call "report the music file length in hour:minutes:seconds".

Unfortunately, the Sound Class do not have that property - yet ? - and so a work-around have to be found. At first, I was searching a place to get the m4a file description - without success, thanks - and then, take some times to figure out the place in the file where this information is stored. Takes too long. Stopped here.

Now, I was thinking about allowing the sound editing and found the... EditableMovie Class ... and ... what a surprise, there is a 'Duration' property.

Here I go:


  Dim sEM As EditableMovie

  // <code removed>

  // Opens the file as an EditableMovie
  sEM = aSoundFileFI.OpenEditableMovie

  // Get the file length
  sTotalTime.TotalSeconds = sEM.Duration

  // Close the EditableMovie
  sEM = Nil // Release the memory allocated to sEM

  // Display the total time
  STFull.Caption = sTotalTime.LongTime

  // <code removed>

Clear, clean, without surprise and it works.


HTH,

Emile


* When I am at this, read my second message for "How to display the ellapsing time" (when the sound is playing)...


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>
  • Getting song duration and using Sound class for playing the sound, Emile Schwarz <=