Looping Sounds

Here's two possibilities:
  1. Import the sound into the cast, not linked. Set the "looped" flag on the sound. Place the sound in sound channel 2. Loop on a frame using "go to frame the frame". The sound will loop, with no hestitation as it loops. The reason you might want to put it into channel 2 is so that you can use channel 1 for feedback sounds, like clicks.

  2. Use sound playfile like this (no need to import the sound into the cast)
    on exitFrame
      if not soundBusy(2) then
        sound playfile 2, soundFolder & "MY_SOUND.AIF"
      end if
      go to frame the frame
    end
    

As long as the frame rate is high enough, there shouldn't be too much of a pause between loops.

Frank Leahy
Digital Comet -- Multimedia Software and Consulting
Internet: fjl@netcom.com
AppleLink: LEAHY.FRANK

Date:    Tue, 27 Sep 1994 07:43:30 EDT
From:    Jean-Robert.Thibault@SBF.ULAVAL.CA
Subject: Re: 8bit Sound

>Is it possible to use lingo to loop an external sound, at predetermined
>loop saved in the sound file?
On a frame... let's say frame 10 you can script the following
on exitFrame
 If soundBusy(2) then
  go the frame
  else
  sound playFile 2, the pathName & "andante"
  -- you see, if the sound is completed, it starts over again.
  -- in addition, you can activate show images and have interactivity.
 end if
end
Never use a pause for that. The Mac soundManager likes to receive events in an active mode. It is the only way to stop such a sound playing. This is also true for QT events. The key issue, substitue all your pause with a "go the frame command".

To stop a sound you can put the following script in the scripting window.

on mouseDown
 sound stop 1
end