OpenTTD Source 20260711-master-g3fb3006dff
music_gui.cpp File Reference

GUI for the music playback. More...

#include "stdafx.h"
#include "openttd.h"
#include "base_media_base.h"
#include "base_media_music.h"
#include "music/music_driver.hpp"
#include "window_gui.h"
#include "strings_func.h"
#include "window_func.h"
#include "sound_func.h"
#include "gfx_func.h"
#include "zoom_func.h"
#include "core/random_func.hpp"
#include "error.h"
#include "core/geometry_func.hpp"
#include "string_func.h"
#include "settings_type.h"
#include "settings_gui.h"
#include "dropdown_func.h"
#include "dropdown_type.h"
#include "slider_func.h"
#include "mixer.h"
#include "widgets/music_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  MusicSystem
struct  MusicSystem::PlaylistEntry
struct  MusicTrackSelectionWindow
struct  MusicWindow

Functions

void MusicLoop ()
 Check music playback status and start/stop/song-finished.
void ChangeMusicSet (int index)
 Change the configured music set and reset playback.
void InitializeMusic ()
 Prepare the music system for use.
static bool IsCustomPlaylist (PlaylistChoice playlist)
 Test if a PlaylistChoice is a custom playlist.
static void ShowMusicTrackSelection ()
void ShowMusicWindow ()

Variables

MusicSystem _music
static constexpr std::initializer_list< NWidgetPart_nested_music_track_selection_widgets
static WindowDesc _music_track_selection_desc (WindowPosition::Automatic, {}, 0, 0, WindowClass::MusicTrackSelection, WindowClass::None, {}, _nested_music_track_selection_widgets)
 Window definition for the music track selection window.
static constexpr std::initializer_list< NWidgetPart_nested_music_window_widgets
static WindowDesc _music_window_desc (WindowPosition::Automatic, "music", 0, 0, WindowClass::Music, WindowClass::None, {}, _nested_music_window_widgets)
 Window definition for the music window.

Detailed Description

GUI for the music playback.

Definition in file music_gui.cpp.

Function Documentation

◆ ChangeMusicSet()

void ChangeMusicSet ( int index)

Change the configured music set and reset playback.

Parameters
indexIndex of music set to switch to

Definition at line 463 of file music_gui.cpp.

References _music, BaseMedia< MusicSet >::GetIndexOfUsedSet(), and BaseMedia< MusicSet >::GetSet().

Referenced by GameOptionsWindow::OnDropdownSelect(), and MusicTrackSelectionWindow::OnDropdownSelect().

◆ InitializeMusic()

void InitializeMusic ( )

Prepare the music system for use.

Called from InitializeGame

Definition at line 473 of file music_gui.cpp.

References _music.

◆ IsCustomPlaylist()

bool IsCustomPlaylist ( PlaylistChoice playlist)
static

Test if a PlaylistChoice is a custom playlist.

Parameters
playlistThe playlist choice to test.
Returns
true iff the playlist choice is a custom playlist.

Definition at line 483 of file music_gui.cpp.

References Custom1, and Custom2.

Referenced by MusicTrackSelectionWindow::OnInvalidateData().

◆ MusicLoop()

void MusicLoop ( )

Check music playback status and start/stop/song-finished.

Called from main loop.

Definition at line 454 of file music_gui.cpp.

References _music.

Referenced by LoadIntroGame().

◆ ShowMusicTrackSelection()

void ShowMusicTrackSelection ( )
static

Definition at line 679 of file music_gui.cpp.

◆ ShowMusicWindow()

void ShowMusicWindow ( )

Definition at line 939 of file music_gui.cpp.

Variable Documentation

◆ _music

MusicSystem _music

Definition at line 88 of file music_gui.cpp.

◆ _nested_music_track_selection_widgets

std::initializer_list<NWidgetPart> _nested_music_track_selection_widgets
staticconstexpr

Definition at line 634 of file music_gui.cpp.

◆ _nested_music_window_widgets

std::initializer_list<NWidgetPart> _nested_music_window_widgets
staticconstexpr

Definition at line 871 of file music_gui.cpp.