OpenTTD: src/music_gui.cpp File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Data Structures | Functions | Variables
music_gui.cpp File Reference

GUI for the music playback. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "base_media_base.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 "core/random_func.hpp"`
`#include "error.h"`
`#include "core/geometry_func.hpp"`
`#include "string_func.h"`
`#include "settings_type.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 | MusicTrackSelectionWindow
struct | MusicWindow

## Functions
static const char * | GetSongName (int index)
| Get the name of the song.
static int | GetTrackNumber (int index)
| Get the track number of the song.
| assert_compile (lengthof(_settings_client.music.custom_1)==NUM_SONGS_PLAYLIST+1)
| assert_compile (lengthof(_settings_client.music.custom_2)==NUM_SONGS_PLAYLIST+1)
void | ValidatePlaylist (byte *playlist, byte *last)
| Validate a playlist.
void | InitializeMusic ()
| Initialize the playlists.
static void | SkipToPrevSong ()
static void | SkipToNextSong ()
static void | MusicVolumeChanged (byte new_vol)
static void | DoPlaySong ()
static void | DoStopMusic ()
static void | SelectSongToPlay ()
static void | StopMusic ()
static void | PlayPlaylistSong ()
void | ResetMusic ()
void | MusicLoop ()
static void | SelectPlaylist (byte list)
static void | ShowMusicTrackSelection ()
void | ShowMusicWindow ()

## Variables
static byte | _music_wnd_cursong = 1
| The currently played song.
static bool | _song_is_active = false
| Whether a song is currently played.
static byte | _cur_playlist [NUM_SONGS_PLAYLIST+1]
| Indices of the songs in the current playlist.
static byte | _playlist_all [NUM_SONGS_AVAILABLE+1]
| Indices of all songs.
static byte | _playlist_old_style [NUM_SONGS_CLASS+1]
| Indices of all old style songs.
static byte | _playlist_new_style [NUM_SONGS_CLASS+1]
| Indices of all new style songs.
static byte | _playlist_ezy_street [NUM_SONGS_CLASS+1]
| Indices of all ezy street songs.
static byte *const | _playlists []
| The different playlists that can be played.
static const NWidgetPart | _nested_music_track_selection_widgets []
static WindowDesc | _music_track_selection_desc (WDP_AUTO,"music_track", 0, 0, WC_MUSIC_TRACK_SELECTION, WC_NONE, 0, _nested_music_track_selection_widgets, lengthof(_nested_music_track_selection_widgets))
static const NWidgetPart | _nested_music_window_widgets []
static WindowDesc | _music_window_desc (WDP_AUTO,"music", 0, 0, WC_MUSIC_WINDOW, WC_NONE, 0, _nested_music_window_widgets, lengthof(_nested_music_window_widgets))

## Detailed Description

GUI for the music playback.

Definition in file music_gui.cpp.

## Function Documentation

static const char* GetSongName | ( | int | index | ) |
| static

Get the name of the song.

Parameters

  index | of the song.

Returns
  the name of the song.

Definition at line 39 of file music_gui.cpp.

References BaseMedia< MusicSet >::GetUsedSet(), and MusicSet::song_name.

Referenced by MusicTrackSelectionWindow::DrawWidget(), MusicWindow::DrawWidget(), InitializeMusic(), MusicTrackSelectionWindow::UpdateWidgetSize(), MusicWindow::UpdateWidgetSize(), and ValidatePlaylist().

static int GetTrackNumber | ( | int | index | ) |
| static

Get the track number of the song.

Parameters

  index | of the song.

Returns
  the track number of the song.

Definition at line 49 of file music_gui.cpp.

References BaseMedia< MusicSet >::GetUsedSet().

Referenced by MusicTrackSelectionWindow::DrawWidget(), MusicWindow::DrawWidget(), MusicTrackSelectionWindow::OnClick(), and MusicTrackSelectionWindow::UpdateWidgetSize().

void ValidatePlaylist | ( | byte * | playlist,
|  | byte * | last
| ) |  |

Validate a playlist.

Parameters

  playlist | The playlist to validate.
  last | The last location in the list.

Definition at line 89 of file music_gui.cpp.

References GetSongName(), NUM_SONGS_AVAILABLE, and StrEmpty().

Referenced by InitializeMusic().

## Variable Documentation

byte* const _playlists[]
| static

Initial value:
{
_playlist_all,
_playlist_old_style,
_playlist_new_style,
_playlist_ezy_street,
_settings_client.music.custom_1,
_settings_client.music.custom_2,
}

The different playlists that can be played.

Definition at line 75 of file music_gui.cpp.