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"`

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 const WindowDesc | _music_track_selection_desc (WDP_AUTO, 0, 0, WC_MUSIC_TRACK_SELECTION, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_music_track_selection_widgets, lengthof(_nested_music_track_selection_widgets))
static const NWidgetPart | _nested_music_window_widgets []
static const WindowDesc | _music_window_desc (WDP_AUTO, 0, 0, WC_MUSIC_WINDOW, WC_NONE, WDF_UNCLICK_BUTTONS, _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 37 of file music_gui.cpp.

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

Referenced by MusicWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), InitializeMusic(), MusicWindow::UpdateWidgetSize(), MusicTrackSelectionWindow::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 47 of file music_gui.cpp.

References BaseMedia< MusicSet >::GetUsedSet().

Referenced by MusicWindow::DrawWidget(), MusicTrackSelectionWindow::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 87 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 73 of file music_gui.cpp.