module Scar::Music

Overview

This module provides simple methods to manage music playback.

It utilizes a stack to enable simple continuation of previous music. This behaviour can be used to e. g. play pause music and continue playing the game music easily after unpausing the game.

Example usage:

Scar::Music.play "music/menu.ogg"
# Game starts
Scar::Music.play "music/overworld.ogg"
# Player returns to menu
Scar::Music.pop_continue

Extended Modules

Defined in:

scar/music.cr

Instance Method Summary

Instance Method Detail

def current #

Returns the song that is currently playing / on top of the song stack


[View source]
def current? #

Returns the song that is currently playing / on top of the song stack, or nil if the song stack is empty


[View source]
def play(asset_name : String) #

Pauses the current song, pushes the new song onto the song stack and starts playing it


[View source]
def pop #

Stops current music and removes it from the stack


[View source]
def pop_continue #

Stops current song, removes it from the stack and continues playing the previous music (if present)


[View source]