This module manages sound.
BGM and Sound Effect
There are two types of sound in Star Ruby
| Feature | BGM | Sound Effect |
|---|---|---|
| Maximum number of sounds playable simultaneously | 1 | 8 |
| Streaming | ○ | × |
| Play from the middle | ○ | × |
| Loop | ○ | × |
| Panning | × | ○ |
File types Star Ruby supports are as below.
- Ogg Vorbis
- WAV
Constants
MAX_SE_COUNT- The maximum number of SEs which can be played.
Module Methods
Audio.bgm_position-
Get playing position of BGM as an integer
Audio.bgm_volumeAudio.bgm_volume=(volume)-
Set/Get integer value(0 - 255) of volume.
Audio.play_bgm(path, options = {})-
Play file of chosen pathas a BGM. Extension can be omitted.You have to pass. Keys and values below can be selected.Hashas optionsKey Value Default :loopLoop BGM or not false:positionSeek position of playing sound. Uses the value from Audio.bgm_position. 0 :volumeVolume (0 〜 255)。 255 :timeFadein time (millisec)。 0 Playing from the middle of BGM can cause two seconds error maximum.
Audio.play_se(path, options = {})-
Play file of chosen path as a sound effect. Extension can be omitted.
You have to pass. Keys and values below can be selected.Hashas optionsKey Value Default :panningPanning (-255 - 255). 0 :volumeVolume (0 - 255). 255 :timeFadein time(millisec). 0 (before Ver 0.1.0 , range of :panning isは 0 - 255.)
Audio.playing_bgm?-
If the BGM is playing return
trueotherwise returnfalse. Audio.stop_all_ses(options = {})-
Stop all playing sound effecs.
You have to pass. Keys and values below can be selected.Hashas optionsKey Value Default :timeFadeout time(millsec). 0 Audio.playing_se_count-
Returns a number of SEs which are played.
Audio.stop_bgm(options = {})-
Stop BGM
You have to pass. Keys and values below can be selected.Hashas optionsKey Value Default :timefade out (millisec). 0