respect autoplay; add play_playlist() for manual start
DynamicSoundPlayerCore.ready() always called play() if a playlist had songs, ignoring the inherited AudioStreamPlayer.autoplay property. Now early-returns when autoplay is false. Adds play_playlist() (exposed on all three continuous wrappers) so users with autoplay=false have a non-fade way to start playback. fade_in() now uses the same _start_playback() helper. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
36350ab8d5
commit
e8224e3913
@@ -72,15 +72,16 @@ When the node enters the tree in the editor, `stream` is auto-assigned an `Audio
|
||||
|
||||
| Method | Description |
|
||||
| --- | --- |
|
||||
| `play_playlist()` | Starts (or resumes) the playlist. Use this when `autoplay` is `false` and you want to start playback programmatically. |
|
||||
| `pause()` | Pauses playback. No-op if not playing or already paused. |
|
||||
| `resume()` | Resumes playback after a pause. |
|
||||
| `is_song_playing() -> bool` | True iff a song's layers are active and not paused. Distinct from `is_playing()`, which stays true between songs because the polyphonic playback session itself is still live. |
|
||||
| `fade_in(duration: float)` | Starts playback (if needed), unpauses, and ramps volume from silent to `volume_db` over `duration` seconds. |
|
||||
| `fade_in(duration: float)` | Starts playback (if needed), unpauses, and ramps volume from silent to `volume_db` over `duration` seconds. Works regardless of `autoplay`. |
|
||||
| `fade_out(duration: float)` | Ramps volume from current level to silent over `duration` seconds, then stops the polyphonic session. A subsequent `fade_in` reinitialises. |
|
||||
|
||||
#### Behaviour
|
||||
|
||||
- **Autoplay.** On `_ready`, plays the front song of the playlist.
|
||||
- **Autoplay.** On `_ready`, plays the front song of the playlist *only if `autoplay` is true* (the inherited `AudioStreamPlayer.autoplay` property; default `true`). Set `autoplay = false` to defer playback to a `play_playlist()` or `fade_in()` call.
|
||||
- **Advancement.** When a song's `Intensity1` length elapses, the player pops it from the queue and plays the next. With `Loop = true`, the popped song is re-appended to the back.
|
||||
- **Volume.** `volume_db` is honoured; the fade adjustment is layered on top internally, so manual volume changes during a fade still work correctly.
|
||||
- **Editor.** All scripts are `@tool`, but `_ready` and `_process` early-return in the editor so audio doesn't play in the inspector.
|
||||
|
||||
Reference in New Issue
Block a user