Sound (of Object
)¶
-
class
Sound
¶ Defined in Sound.sc.
The Sound class encapsulates sound functionality. Sound (midi) and audio (digial audio) resources share the same numbering namespace. That means that if you have both, sound 47 should be a midi version of audio 47, and audio 47 should be a digital audio version of sound 47. The appropriate one will play depending on the user’s current configuration (resource.cfg in the game folder).
Example usage:
(instance rainSound of Sound (properties number 567 // Sound resource 567 loop -1 ) ) // Then in script at some point: (rainSound play:)
Properties¶
Inherited from Object
:
Property | Description |
---|---|
name |
Defined in Sound:
Property | Description |
---|---|
nodePtr | |
handle | |
flags | |
number | |
vol | 0 to 127. |
priority | |
loop | -1 for looping. |
signal | |
prevSignal | |
dataInc | |
min | |
sec | |
frame | |
client | |
owner |
Methods¶
-
new
(theOwner)
-
init
()
-
dispose
()
-
play
([theClient]) Plays the sound.
Parameters: theClient (heapPtr) – An optional object that will be cue()’d when the sound has finished playing, or a cue marker is reached.
-
stop
() Stops the sound.
-
pause
([fPause]) Pauses or unpauses the sound.
Parameters: fPause (boolean) – If TRUE or unspecified, the sound is paused. Otherwise it is unpaused.
-
hold
(fHold)
-
release
()
-
fade
([theClient])
-
fade
(toVolume fadeTicker fadeStep stopAfterFade [theClient]) Fades a sound.
Parameters: - theClient (heapPtr) – An optional object that becomes the sound’s client. It will be cue()’d when the fade is done.
- toVolume (number) – The target volume (0 if not provided). Ranges from 0-127.
- fadeTicker (number) – Unknown (25 if not provided).
- fadeStep (number) – The volume increment to fade each game cycle (10 if not provided).
- stopAfterFade (boolean) – TRUE if the sound should stop after fading, otherwise FALSE.
-
mute
(param1 param2)
-
setVol
(theVolume) Sets the sound volume (0 - 127).
-
setPri
(thePri) Sets the sound priority.
-
setLoop
(loopValue) Sets the loop value (-1 to loop endlessly, any other value to play once).
-
snd2
(param1 param2 param3 param4) Sends MIDI data to the audio player.
-
check
()
-
clean
(theOwner)
-
playBed
(theClient)
-
changeState
()