DEV505 / SOUND LAB / 06
A little work.
Switch tools, order actions, and overlap hammer taps.
Try it in Unity
Section titled “Try it in Unity”In Unity’s Project window, open Assets/DEV505/SoundManager/Samples/06-Workshop/Demo.unity. The supplied scene already has its Sound Manager, event registrations, generated keys, camera, and Audio Listener. Press Play, wait for the demo to be ready, and click the Game view before using the keyboard. If you are setting up a separate scene, follow Your first sound first.
| Control | Action |
|---|---|
| 1 / 2 / 3 | Select Hammer / Handsaw / Drill. |
| Space / work button | Work or take a break. |
| T / One hammer tap | Add a manual hammer tap when available. |
| Work pace slider | Change the working pace. |
Choose Handsaw and start working. Listen to the loop, then press T: a short hammer impact sounds over it. Switch to Drill while working; the previous tool stops before the new one starts. Take a break to stop the tool voices. Select Hammer and work again to hear the automatic strikes at the animation’s contact frames.
The listener is fixed in the scene. The main tool sound follows the workstation’s sound position; manual taps during another tool use a separate hammer sound origin so the impact tail remains in the right place.
Read the graph
Section titled “Read the graph”Sounds.Workshop starts as a silent, waiting play. Keep Alive lets it remain available even with no voice playing. Tool is an Int: 0 = Hammer, 1 = Handsaw, 2 = Drill. Pace is a smoothed Float between 0 and 1.
| Signal | What the graph does |
|---|---|
Work |
Stops the main play’s old tool voices, chooses Tool, starts the chosen loop if needed, and plays a latch click. |
Pause |
Stops its tool voices but leaves the Keep Alive play waiting. |
Strike |
Plays a short hammer impact. |
Sequence means command order
Section titled “Sequence means command order”The Work signal enters a Sequence. Its outputs execute in numbered order during the same graph execution:
- Out 0: send Stop to the saw, drill, and hammer playback nodes in this play.
- Out 1: branch on Tool. Handsaw or Drill starts its loop; Hammer waits for Strike.
- Out 2: play the latch click.
A Sequence does not wait for each recording or fade to finish. It makes the commands happen in order. Use a recording’s Finished output or an explicit Delay when elapsed time matters. This is why the latch can overlap the selected tool even though it is the last command.
Why a second play is needed
Section titled “Why a second play is needed”The demo retains a main Workshop handle. When a manual hammer tap is requested over the saw or drill, it also creates or reuses a second Workshop handle with Tool set to Hammer. Strike goes to that second handle. Both share the demo’s owner for cleanup, but each has its own graph state and sound origin. The event allows two overlapping plays for this reason.
While Hammer is the active working tool, animation contact already sends automatic Strike signals. The manual tap button is disabled during that automatic hammer work or while a tap animation is already happening. It is available while the handsaw or drill works; the extra tap should not stop that loop.
Select, work, and strike in code
Section titled “Select, work, and strike in code”Set the selection before sending Work:
SoundBus.SetParameter(session, SoundParameters.Workshop.Tool, SoundValue.Int(1));SoundBus.SendSignal(session, "Work");Here session is the accepted main Workshop handle. For a hammer tap over that handsaw, send "Strike" to the separate tap handle. The complete recipe creates both handles, supplies initial parameters, and stops both through their owner on disable.
SoundBus.SendSignal(session, "Pause");SoundBus.SendSignal(taps, "Pause");This graph signal named Pause is different from SoundBus.SetPaused: it stops the tool voices and keeps the graph ready for another command. API pause would suspend playback and graph time for later continuation.
What belongs to the demo?
Section titled “What belongs to the demo?”The graph chooses voices and orders their commands. The sample controller chooses tools, animates them, computes the working rhythm, sends Strike at contact, and enables/disables the buttons. Pace affects both graph sound controls and the controller’s animation timing. The complete recipe has no automatic hammer animation; you call Strike at your own contact frame.
Common surprises
Section titled “Common surprises”- Selecting Hammer produces no repeated hits. Work selects it; Strike produces an impact. The full demo’s animation supplies repeated contact signals.
- A tool switch cuts a hammer tail. Work stops the main play’s existing hammer node. Use the separate tap play when overlap is required.
- Sequence seems instantaneous. It orders commands, not clip durations.
- The break leaves a live handle. Keep Alive is intentional; cleanup must still stop that handle when the interaction is disabled.
Event settings, parameters, and signals
Section titled “Event settings, parameters, and signals”These are the saved graph settings. A play can supply different initial parameter values. Float smoothing is measured in units per second; a rate of 0 applies changes immediately.
Sounds.Workshop
- Position
- 3D · 3–16 units (minimum–maximum distance)
- Overlapping plays
- 2 ·
ReplaceOldest - Cooldown
- None
- Owner loss
- Stop
- Keep Alive
- On — can wait silently for signals
| Parameter | Type | Default | Range | Rise / fall rate |
|---|---|---|---|---|
Tool | Int | 0 | 0–2 | Not smoothed |
Pace | Float | 0.5 | 0–1 | 1.5 / 2 |
| Signal | Response in this graph |
|---|---|
Work | Stop the old tool voices, select Tool, and start its work path. |
Pause | Stop tool voices and keep this silent session available. |
Strike | Play a short hammer impact. |
For the meaning of these settings, see Playback settings. The default numbers above come from the Unity graph audit stored with this documentation.
Take it into your own game
Section titled “Take it into your own game”Open the complete integration recipe for the script, Inspector setup, a short test, and cleanup. Use Play context for initial values and placement, and SoundBus for playback controls.
All Workshop Unity captures includes further states and readable graph details, with steps to reproduce each view.