Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,16 @@ local playing = event:is_valid() -- Check if instance is still valid
```

When an event finishes and reaches the end of its timeline, it releases itself automatically. For one-shot sounds, you typically don't need to manually release. For looping or long-running events you control manually, call `event:release()` when done.

## Controlling volume and pitch

Every event instance has built-in volume and pitch controls that don't require parameters:

```lua
event:set_volume(0.75) -- Range: 0.0 to 1.0
event:set_pitch(1.2) -- 1.0 = normal, 0.5 = half speed, 2.0 = double speed
```

Volume changes are useful for distance attenuation or mixing. Pitch changes create tape-speed effects and can add variety to repeated sounds.

See `example/example_2.script` for an interactive demo with sliders controlling RPM parameters, volume, and pitch in real-time.
Binary file added example/audio/master/Assets/engine_loop.mp3
Binary file not shown.
Binary file added example/audio/master/Assets/gear_shift.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions example/audio/master/master.fspro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects serializationModel="Studio.02.03.00" />
224 changes: 224 additions & 0 deletions example/controls.gui
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
script: "/example/controls.gui_script"
fonts {
name: "default"
font: "/example/default.font"
}
nodes {
position {
x: 980.0
y: 20.0
}
size {
x: 280.0
y: 350.0
}
color {
x: 0.2
y: 0.2
z: 0.2
}
type: TYPE_BOX
id: "panel_background"
xanchor: XANCHOR_RIGHT
yanchor: YANCHOR_BOTTOM
pivot: PIVOT_SW
inherit_alpha: true
alpha: 0.9
}
nodes {
position {
x: 140.0
y: 320.0
}
size {
x: 260.0
y: 24.0
}
color {
x: 0.5
y: 0.8
}
type: TYPE_TEXT
text: "FMOD Event Controls"
font: "default"
id: "title"
parent: "panel_background"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 260.0
}
size {
x: 240.0
y: 45.0
}
color {
x: 0.3
y: 0.8
z: 0.3
}
type: TYPE_BOX
id: "button_start_instant"
parent: "panel_background"
inherit_alpha: true
}
nodes {
size {
x: 220.0
y: 20.0
}
type: TYPE_TEXT
text: "Start"
font: "default"
id: "text_start_instant"
parent: "button_start_instant"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 195.0
}
size {
x: 240.0
y: 45.0
}
color {
x: 0.8
y: 0.3
z: 0.3
}
type: TYPE_BOX
id: "button_stop_instant"
parent: "panel_background"
inherit_alpha: true
}
nodes {
size {
x: 220.0
y: 20.0
}
type: TYPE_TEXT
text: "Stop (Instant)"
font: "default"
id: "text_stop_instant"
parent: "button_stop_instant"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 130.0
}
size {
x: 240.0
y: 45.0
}
color {
x: 0.8
y: 0.3
z: 0.3
}
type: TYPE_BOX
id: "button_stop_fade"
parent: "panel_background"
inherit_alpha: true
}
nodes {
size {
x: 220.0
y: 20.0
}
type: TYPE_TEXT
text: "Stop"
font: "default"
id: "text_stop_fade"
parent: "button_stop_fade"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 65.0
}
size {
x: 240.0
y: 45.0
}
color {
x: 0.8
y: 0.8
z: 0.3
}
type: TYPE_BOX
id: "button_pause"
parent: "panel_background"
inherit_alpha: true
}
nodes {
size {
x: 220.0
y: 20.0
}
type: TYPE_TEXT
text: "Pause"
font: "default"
id: "text_pause"
parent: "button_pause"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 38.0
}
size {
x: 240.0
y: 2.0
}
color {
x: 0.5
y: 0.5
z: 0.5
}
type: TYPE_BOX
id: "separator"
parent: "panel_background"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 25.0
}
size {
x: 240.0
y: 16.0
}
type: TYPE_TEXT
text: "State: STOPPED"
font: "default"
id: "label_state"
parent: "panel_background"
inherit_alpha: true
}
nodes {
position {
x: 140.0
y: 10.0
}
size {
x: 240.0
y: 16.0
}
type: TYPE_TEXT
text: "Paused: No"
font: "default"
id: "label_paused"
parent: "panel_background"
inherit_alpha: true
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
Loading