Files
aego/modules/audio/res/docs/api.ru.md
sanspie f22242e5aa
ci / release (push) Successful in 5m5s
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci / checks (push) Successful in 4m41s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 7m14s
Stage 11g2–11g3: registry texts, CLI and the site in Russian (D348)
The remaining editor strings and undo step names; component, field, enum, setting, diagnostic and Script API texts under schema.*, enum.*, setting.*, diag.* and api.*; the launcher, the in-game Settings View with a Language setting, the CLI and aego schema show --lang. Every documentation page has a .ru.md translation; the site has a full Russian tree with hreflang, a language switch and ru/llms.txt; aego docs check --lang ru. New doc.tutorial and doc.recipe icons. Fix: an animator restored by a rewind prepares its controller before the replayed step.
2026-10-25 15:31:22 +03:00

70 lines
2.4 KiB
Markdown

---
id: aego/audio
summary: Играет клипы, звуковые события и музыку и задаёт громкость шин на сеанс.
---
Звук — это представление: он никогда не меняет состояние игры, а перемотка и повтор идут без звука. Ждите игровую логику таймером, а не `Sound`. Движок поставляет четыре клипа для тестов и набросков: `audio.Builtin("Beep")`, `Click`, `Hum` и `Melody`; последние два повторяются без шва. Пример играет гул и музыку, затем плавно гасит оба. См. [Звук](ref:audio).
## Пример
```aes run
package demo
import (
"aego/audio"
"aego/log"
)
script Chime {
var tone audio.Sound
var frames int
func Ready() {
tone = audio.PlayWith(audio.Builtin("Hum"), audio.PlayOptions{Volume: 0.5, Pitch: 1.5, Loop: true})
audio.Music(audio.Builtin("Melody"), 0.5)
audio.SetBusVolume(audio.Bus.Music, 0.6)
log.Info("the hum plays: " + string(tone.Playing()))
}
func Update(dt float) {
frames++
if frames == 60 {
tone.StopFade(0.2)
audio.StopMusic(0.5)
log.Info("the hum fades out: " + string(!tone.Playing()))
}
}
}
```
---
id: aego/data
summary: Типы ассетов данных, которые скрипты читают через AssetRef и TableRef.
---
Тип данных, зарегистрированный модулем или проектом, появляется здесь как структура. Поле скрипта `AssetRef<T>` хранит запись, `TableRef<T>` — таблицу; поля читаются через ссылку. Типы данных модулей несут имя модуля, например `AudioEvent`, поэтому не сталкиваются с собственными типами игры. См. [Ассеты данных](ref:data).
## Пример
```aes run
package demo
import (
"aego/audio"
"aego/log"
)
script Jumper {
@export var Jump AssetRef<AudioEvent>
func Ready() {
if Jump == nil {
log.Info("no jump event set")
return
}
log.Info("jump volume " + string(Jump.Volume))
audio.PlayEvent(Jump)
}
}
```