_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

music.cpp File Reference
#include <atomic>
#include "stratagus.h"
#include "SDL.h"
#include "sound_server.h"
#include "script.h"

music.cpp - Background music support

#define SoundFrequency   44100
 
static std::atomic_flag MusicFinishedEventQueued = ATOMIC_FLAG_INIT
 flag is set when a MusicFinishedCallback was enqueued in the event loop and should be handled, and unset when the handler has run. More...
 
static volatile bool IsCallbackEnabled = false
 
static void CheckMusicFinished ()
 
static void MusicFinishedCallback ()
 
void InitMusic ()
 Initialize music. More...
 
void CallbackMusicEnable ()
 Turn music stopped callback on. More...
 
void CallbackMusicDisable ()
 Skip the next music stopped callback invocation. More...
 
void CallbackMusicTrigger ()
 Turn music stopped callback on and trigger it immediately. More...
 

Macro Definition Documentation

◆ SoundFrequency

#define SoundFrequency   44100

Function Documentation

◆ CallbackMusicDisable()

void CallbackMusicDisable ( )

Skip the next music stopped callback invocation.

◆ CallbackMusicEnable()

void CallbackMusicEnable ( )

Turn music stopped callback on.

◆ CallbackMusicTrigger()

void CallbackMusicTrigger ( )

Turn music stopped callback on and trigger it immediately.

◆ CheckMusicFinished()

static void CheckMusicFinished ( )
static

Check if music is finished and play the next song

◆ InitMusic()

void InitMusic ( )

Initialize music.

Init music

◆ MusicFinishedCallback()

static void MusicFinishedCallback ( )
static

Callback for when music has finished Note: we are in the sdl audio thread, so dispatch an event to the main event loop

Variable Documentation

◆ IsCallbackEnabled

volatile bool IsCallbackEnabled = false
static

◆ MusicFinishedEventQueued

std::atomic_flag MusicFinishedEventQueued = ATOMIC_FLAG_INIT
static

flag is set when a MusicFinishedCallback was enqueued in the event loop and should be handled, and unset when the handler has run.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.