|
|
(14 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
− | The SAudioSource class deals with the Audio Source component, which allows the object to play sounds in the scene.
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/saudiosource |
− | | + | |
− | ==Properties==
| + | |
− | | + | |
− | {{ScriptFunction|bool|Enabled|{get;set;}|Is the Audio Source component enabled?|5=
| + | |
− | hostObject = Space.Host.ExecutingObject;<br><br>
| + | |
− | function audioOnOff ()<br>
| + | |
− | :hostObject.Audio.Enabled = not hostObject.Audio.Enabled;<br> | + | |
− | :Space.Log(hostObject.Audio.Enabled);<br> | + | |
− | end<br><br>
| + | |
− | hostObject.SubscribeToEvents();<br>
| + | |
− | hostObject.OnMouseDown(audioOnOff);<br>
| + | |
− | ''-- When the host object is clicked, the Audio Source component gets enabled, if it was disabled,'' <br>
| + | |
− | ''-- or disabled, if it was enabled, and its new state is printed to the console.''}}
| + | |
− | | + | |
− | {{ScriptFunction|bool|Loop|{get;set;}|Is looping of the sound clip enabled?|5=
| + | |
− | hostObject = Space.Host.ExecutingObject;<br><br>
| + | |
− | Space.Log(hostObject.Audio.Loop);<br>
| + | |
− | ''-- False by default.''<br><br>
| + | |
− | if not hostObject.Audio.Loop then<br>
| + | |
− | :hostObject.Audio.Loop = true;<br>
| + | |
− | end<br>
| + | |
− | ''-- Now it is looping.''}}
| + | |
− | | + | |
− | {{ScriptFunction|float|DopplerLevel|{get;set;}|The Doppler level for the Audio Source. (See: Doppler Effect)|5=
| + | |
− | hostObject = Space.Host.ExecutingObject;<br><br>
| + | |
− | Space.Log(hostObject.Audio.DopplerLevel);<br>
| + | |
− | ''-- 1 by default''<br>
| + | |
− | hostObject.Audio.DopplerLevel = 5;<br>
| + | |
− | ''-- The highest possible value''}}
| + | |