Start/Loop/Stop sounds: Difference between revisions
(3 intermediate revisions by the same user not shown) | |||
Line 31: | Line 31: | ||
== How the prefab works == | == How the prefab works == | ||
When machine_lever is used it triggers speaker_machine_start, playing the sounds in the machine_on soundshader. The lever also triggers OnOffCount, this trigger counts the times it has been triggered itself. Because the “count” property of OnOffCount has been set to 2 it will only fire its target, speaker_machine_stop, the second time it is triggered. | When machine_lever is used it triggers speaker_machine_start, playing the sounds in the machine_on soundshader. The lever also triggers OnOffCount, this trigger counts the times it has been triggered itself. Because the “count” property of OnOffCount has been set to 2 it will only fire its target, speaker_machine_stop, the second time it is triggered. | ||
The second time the lever is used it triggers speaker_machine_start turning it off. OnOffCount triggers speaker_machine_stop. With “repeat” set to 1 OnOffCount will start counting all over again | The second time the lever is used it triggers speaker_machine_start, turning it off. OnOffCount triggers speaker_machine_stop. With “repeat” set to 1 OnOffCount will start counting all over again after it’s triggered the amount of times set with “count”. OnOffCount acts as a reverse trigger so to say. | ||
[[Category:Sound]] |
Latest revision as of 16:43, 24 December 2008
written by Flanders
Introduction
This tutorial explains how to set up a triggering system with three sounds: a starting sound, a looping sound and a stopping sound. This can be used for machines that can be turned on/off or for other sound systems that behave in a similar way. There is more than one way to do this but here we use a simple trigger system with a custom made sound shader.
What to do
You’ll have to find some sounds that fit your machine, here I’ll use these:
sound/machinery/generators/generator_start_01.ogg
sound/machinery/generators/generator_loop_01.ogg
sound/machinery/generators/generator_stop_01.ogg
The start and loop sound can be combined into a soundshader like this:
machine_on { looping leadin sound/machinery/generators/generator_start_01.ogg sound/machinery/generators/generator_loop_01.ogg }
After the first sound is played, the second sound will start looping. Save this soundshader in your Doom 3/darkmod/sound folder as machine_on.sndshd.
Open your map in Darkradiant and import the machine_sounds_system prefab from the prefab/mechanical folder.
For speaker_machine_stop set “s_shader” to sound/machinery/generators/generator_stop_01.ogg. For speaker_machine_start set “s_shader” to machine_on. That’s all there is.
How the prefab works
When machine_lever is used it triggers speaker_machine_start, playing the sounds in the machine_on soundshader. The lever also triggers OnOffCount, this trigger counts the times it has been triggered itself. Because the “count” property of OnOffCount has been set to 2 it will only fire its target, speaker_machine_stop, the second time it is triggered. The second time the lever is used it triggers speaker_machine_start, turning it off. OnOffCount triggers speaker_machine_stop. With “repeat” set to 1 OnOffCount will start counting all over again after it’s triggered the amount of times set with “count”. OnOffCount acts as a reverse trigger so to say.