(Added PanStereo, SpatialBlend, Spatialize, SpatializePostEffects) |
(Added ReverbZoneMix, BypassEffects, BypassListenerEffects, BypassReverbZones) |
||
Line 110: | Line 110: | ||
Space.Log(hostObject.Audio.SpatializePostEffects);<br> | Space.Log(hostObject.Audio.SpatializePostEffects);<br> | ||
''-- prints "True" to the console''}} | ''-- prints "True" to the console''}} | ||
+ | |||
+ | {{ScriptFunction|float|ReverbZoneMix|{get;set;}|The level at which the audio coming from this Audio Source will be mixed into the global reverb of the scene (accomplished with Reverb Zones). |5= | ||
+ | hostObject = Space.Host.ExecutingObject;<br><br> | ||
+ | Space.Log(hostObject.Audio.ReverbZoneMix);<br> | ||
+ | ''-- prints "1" to the console (by default) - normal level of mixing in''<br> | ||
+ | hostObject.Audio.ReverbZoneMix = 0.5;<br> | ||
+ | ''-- Now this audio will be fainter by half in the global reverb.''}} | ||
+ | |||
+ | {{ScriptFunction|bool|BypassEffects|{get;set;}|When true, none of global sound effects (reverbs, filters, etc.) are applied to the audio from this Audio Source. |5= | ||
+ | hostObject = Space.Host.ExecutingObject;<br><br> | ||
+ | Space.Log(hostObject.Audio.BypassEffects);<br> | ||
+ | ''-- prints "False" to the console (by default);''<br> | ||
+ | hostObject.Audio.BypassEffects = true;<br> | ||
+ | ''-- Now the sound is not affected by any global effects.''}} | ||
+ | |||
+ | {{ScriptFunction|bool|BypassListenerEffects|{get;set;}|When true, whichever global effects are set on the Audio Listener will not be applied to the audio from this Audio Source. |5= | ||
+ | hostObject = Space.Host.ExecutingObject;<br><br> | ||
+ | Space.Log(hostObject.Audio.BypassListenerEffects);<br> | ||
+ | ''-- prints "False" to the console (by default);''<br> | ||
+ | hostObject.Audio.BypassListenerEffects = true;<br> | ||
+ | ''-- Now the sound is not affected by any global effects on Audio Listeners.''}} | ||
+ | |||
+ | {{ScriptFunction|bool|BypassReverbZones|{get;set;}|When true, the audio from this Audio Source is not mixed into the global reverb generated through Reverb Zones.. |5= | ||
+ | hostObject = Space.Host.ExecutingObject;<br><br> | ||
+ | Space.Log(hostObject.Audio.BypassReverbZones);<br> | ||
+ | ''-- prints "False" to the console (by default);''<br> | ||
+ | hostObject.Audio.BypassReverbZones = true;<br> | ||
+ | ''-- Now the sound is not mixed into the global reverb.''}} |
The SAudioSource class deals with the Audio Source component, which allows the object to play sounds in the scene.
Is the Audio Source component enabled?
function audioOnOff ()
end
hostObject.SubscribeToEvents();
hostObject.OnMouseDown(audioOnOff);
-- When the host object is clicked, the Audio Source component gets enabled, if it was disabled,
Is looping of the sound clip enabled?
Space.Log(hostObject.Audio.Loop);
-- False by default.
if not hostObject.Audio.Loop then
end
The Doppler level of the Audio Source. (See: Doppler Effect)
Space.Log(hostObject.Audio.DopplerLevel);
-- 1 by default
hostObject.Audio.DopplerLevel = 5;
The Volume level of the Audio Source.
Space.Log(hostObject.Audio.Volume);
-- 1 by default
function audioVolumeDecr ()
end
hostObject.SubscribeToEvents();
hostObject.OnMouseDown(audioVolumeDecr);
The Pitch level for the Audio Source.
Space.Log(hostObject.Audio.Pitch);
-- 1 by default
function audioPitchChange ()
end
hostObject.SubscribeToEvents();
hostObject.OnMouseDown(audioPitchChange);
Playback position in seconds.
Space.Log(hostObject.Audio.Time);
-- 0 by default (the beginning of the sound clip)
hostObject.Audio.Time = 15;
-- jumps to the 0:15 position of the sound clip
hostObject.Audio.Time = 75;
Is the sound clip playing right now?
Space.Log(hostObject.Audio.IsPlaying);
Pans the sound to the left or right. Values range from -1 to 1: 0 is the middle, -1 is full left, 1 is full right.
Space.Log(hostObject.Audio.PanStereo);
-- Prints the current Pan Stereo level (0 by default)
hostObject.Audio.PanStereo = 0.5;
The level of impact 3D effects make on the AudioSource. 0 - no impact (full 2D sound), 1 - maximum impact (full 3D sound).
function spBlendChange ()
end
hostObject.SubscribeToEvents();
hostObject.OnMouseDown(spBlendChange);
-- Spatial Blend is increased by 0.2 every time the object is clicked, until it reaches 1.
Is spatialization enabled?
Space.Log(hostObject.Audio.Spatialize);
-- Prints the current state of spatialization (False by default) to the console
hostObject.Audio.Spatialize = true;
Is spatialization enabled before or after other filters are in action?
-- Because enabling this property makes sense only if spatialization itself is enabled, let's enable it first.
hostObject.Audio.Spatialize = true;
if hostObject.Audio.Spatialize then
end
Space.Log(hostObject.Audio.SpatializePostEffects);
The level at which the audio coming from this Audio Source will be mixed into the global reverb of the scene (accomplished with Reverb Zones).
Space.Log(hostObject.Audio.ReverbZoneMix);
-- prints "1" to the console (by default) - normal level of mixing in
hostObject.Audio.ReverbZoneMix = 0.5;
When true, none of global sound effects (reverbs, filters, etc.) are applied to the audio from this Audio Source.
Space.Log(hostObject.Audio.BypassEffects);
-- prints "False" to the console (by default);
hostObject.Audio.BypassEffects = true;
When true, whichever global effects are set on the Audio Listener will not be applied to the audio from this Audio Source.
Space.Log(hostObject.Audio.BypassListenerEffects);
-- prints "False" to the console (by default);
hostObject.Audio.BypassListenerEffects = true;
When true, the audio from this Audio Source is not mixed into the global reverb generated through Reverb Zones..
Space.Log(hostObject.Audio.BypassReverbZones);
-- prints "False" to the console (by default);
hostObject.Audio.BypassReverbZones = true;