# music_gui.cpp File Reference

GUI for the music playback. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "fileio_func.h"`
`#include "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 "core/math_func.hpp"`
`#include "core/random_func.hpp"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
struct | MusicTrackSelectionWindow
struct | MusicWindow
## Functions
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 | ShowMusicTrackSelection ()
void | ShowMusicWindow ()
## Variables
static byte | _music_wnd_cursong
static bool | _song_is_active
static byte | _cur_playlist [NUM_SONGS_PLAYLIST]
static byte | _playlist_all []
static byte | _playlist_old_style []
static byte | _playlist_new_style []
static byte | _playlist_ezy_street []
static byte *const | _playlists []
static const Widget | _music_track_selection_widgets []
static const WindowDesc | _music_track_selection_desc
static const Widget | _music_window_widgets []
static const WindowDesc | _music_window_desc

## Detailed Description

GUI for the music playback.

Definition in file music_gui.cpp.

## Variable Documentation

const WindowDesc _music_track_selection_desc`[static]`

Initial value:

     {
      104, 131, 432, 218, 432, 218,
      WC_MUSIC_TRACK_SELECTION, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
      _music_track_selection_widgets,
    }

Definition at line 348 of file music_gui.cpp.

const Widget _music_track_selection_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   431,     0,    13, STR_01EB_MUSIC_PROGRAM_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   431,    14,   217, 0x0,                              STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     2,   181,    22,   215, 0x0,                              STR_01FA_CLICK_ON_MUSIC_TRACK_TO},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,   250,   429,    22,   215, 0x0,                              STR_CLICK_ON_TRACK_TO_REMOVE},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,    44,    51, 0x0,                              STR_01F3_SELECT_ALL_TRACKS_PROGRAM},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,    52,    59, 0x0,                              STR_01F4_SELECT_OLD_STYLE_MUSIC},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,    60,    67, 0x0,                              STR_01F5_SELECT_NEW_STYLE_MUSIC},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,    68,    75, 0x0,                              STR_0330_SELECT_EZY_STREET_STYLE},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,    76,    83, 0x0,                              STR_01F6_SELECT_CUSTOM_1_USER_DEFINED},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,    84,    91, 0x0,                              STR_01F7_SELECT_CUSTOM_2_USER_DEFINED},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   186,   245,   108,   115, 0x0,                              STR_01F8_CLEAR_CURRENT_PROGRAM_CUSTOM1},

    {   WIDGETS_END},
    }

Definition at line 329 of file music_gui.cpp.

const WindowDesc _music_window_desc`[static]`

Initial value:

     {
      0, 22, 300, 66, 300, 66,
      WC_MUSIC_WINDOW, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
      _music_window_widgets,
    }

Definition at line 549 of file music_gui.cpp.

const Widget _music_window_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   299,     0,    13, STR_01D2_JAZZ_JUKEBOX, STR_018C_WINDOW_TITLE_DRAG_THIS},
    { WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,     0,    21,    14,    35, SPR_IMG_SKIP_TO_PREV,  STR_01DE_SKIP_TO_PREVIOUS_TRACK},
    { WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,    22,    43,    14,    35, SPR_IMG_SKIP_TO_NEXT,  STR_01DF_SKIP_TO_NEXT_TRACK_IN_SELECTION},
    { WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,    44,    65,    14,    35, SPR_IMG_STOP_MUSIC,    STR_01E0_STOP_PLAYING_MUSIC},
    { WWT_PUSHIMGBTN,   RESIZE_NONE,  COLOUR_GREY,    66,    87,    14,    35, SPR_IMG_PLAY_MUSIC,    STR_01E1_START_PLAYING_MUSIC},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,    88,   299,    14,    35, 0x0,                   STR_01E2_DRAG_SLIDERS_TO_SET_MUSIC},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,   186,   201,    15,    34, 0x0,                   STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   299,    36,    57, 0x0,                   STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,    59,   240,    45,    53, 0x0,                   STR_NULL},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,     6,    55,    42,    49, 0x0,                   STR_01FB_TOGGLE_PROGRAM_SHUFFLE},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   244,   293,    42,    49, 0x0,                   STR_01FC_SHOW_MUSIC_TRACK_SELECTION},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,     0,    49,    58,    65, 0x0,                   STR_01F3_SELECT_ALL_TRACKS_PROGRAM},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,    50,    99,    58,    65, 0x0,                   STR_01F4_SELECT_OLD_STYLE_MUSIC},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   100,   149,    58,    65, 0x0,                   STR_01F5_SELECT_NEW_STYLE_MUSIC},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   150,   199,    58,    65, 0x0,                   STR_0330_SELECT_EZY_STREET_STYLE},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   200,   249,    58,    65, 0x0,                   STR_01F6_SELECT_CUSTOM_1_USER_DEFINED},
    {    WWT_PUSHBTN,   RESIZE_NONE,  COLOUR_GREY,   250,   299,    58,    65, 0x0,                   STR_01F7_SELECT_CUSTOM_2_USER_DEFINED},
    {   WIDGETS_END},
    }

Definition at line 527 of file music_gui.cpp.

byte _playlist_all[]`[static]`

Initial value:

     {
      1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0
    }

Definition at line 27 of file music_gui.cpp.

byte _playlist_ezy_street[]`[static]`

Initial value:

     {
      12, 7, 16, 3, 20, 4, 0
    }

Definition at line 39 of file music_gui.cpp.

byte _playlist_new_style[]`[static]`

Initial value:

     {
      6, 11, 10, 17, 21, 18, 5, 0
    }

Definition at line 35 of file music_gui.cpp.

byte _playlist_old_style[]`[static]`

Initial value:

     {
      1, 8, 2, 9, 14, 15, 19, 13, 0
    }

Definition at line 31 of file music_gui.cpp.

byte* const _playlists[]`[static]`

Initial value:

     {
      _playlist_all,
      _playlist_old_style,
      _playlist_new_style,
      _playlist_ezy_street,
      msf.custom_1,
      msf.custom_2,
    }

Definition at line 43 of file music_gui.cpp.