hi:

has anybody worked with the GetSoundLevel Xtra of Geoff Smith?

i am trying to use the xtra to get realtime sound to affect the blend of a
sprite. i have got it to work to a point--but need to know how to add a
delay in the code to make the reaction of the sprite somewhat gradual. i
have tried tweaking the code with my embarassing lingo skills, but it does
not seem to work. 

i am pasting the code here... i know it is somewhat long, and apologize
for it.

any help would be much appreciated.

---
-- there are a number of elements in this code that i do 
-- not quite understand and worry about knocking off something
-- that will kill the program! i have taken out as much as i could

global currentColour , currentLocH , dotSprite
global chartSprite , minDotH , maxDotH , minDotV , theMonitor, divider



on startMovie
  
  global theMonitor
  
  --  if the platform contains "Macintosh" then
  openxlib "GetSoundInLevelXtra.ppc"
  
  set divider to 1
  
  put mMessageList( xtra "GetSoundInLevel" )  
  
  set theMonitor to new( xtra "GetSoundInLevel")
  
  if objectP( theMonitor ) then
    put GetChannelCount( theMonitor ) into field "Channels"
  end if
  put "" into field "data"
  put theMonitor
  set dotSprite to 5
  puppetSprite dotSprite , true
end


on stopMovie
  set theMonitor to 0
  closexlib
end

on checkStereoLevel
  global leftLevel, rightLevel
  set leftLevel  = GetLeftLevel( theMonitor )
  set rightLevel = GetRightLevel( theMonitor )
end


on checkLevel
  return GetLevel( theMonitor )
end


on Update
  global leftLevel, rightLevel
  set newLevel to (checkLevel()/divider)
  put newLevel into field "data"
  
  
  sprite(5).blendlevel =  newLevel 
  
  -- this is the point where the sprite reacts to the sound volume
  
  put newlevel
  checkStereoLevel()
  
  
end



----



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to