OpenTTD Source: src/music.cpp File Reference

OpenTTD Source 15.0-beta1

Macros | Functions | Variables
music.cpp File Reference

The songs that OpenTTD knows. More...

`#include "stdafx.h"`
`#include "string_func.h"`
`#include "base_media_func.h"`
`#include "random_access_file_type.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Macros
#define | SET_TYPE "music"
| The type of set we're replacing.

## Functions
std::optional< std::string > | GetMusicCatEntryName (const std::string &filename, size_t entrynum)
| Read the name of a music CAT file entry.
std::optional< std::vector< uint8_t > > | GetMusicCatEntryData (const std::string &filename, size_t entrynum)
| Read the full data of a music CAT file entry.

## Variables
static const char *const | _music_file_names []
| Names corresponding to the music set's files.

## Detailed Description

The songs that OpenTTD knows.

Definition in file music.cpp.

## Macro Definition Documentation

## ◆ SET_TYPE

#define SET_TYPE "music"

The type of set we're replacing.

Definition at line 15 of file music.cpp.

## Function Documentation

## ◆ GetMusicCatEntryData()

std::optional< std::vector< uint8_t > > GetMusicCatEntryData | ( | const std::string & | filename,
|  | size_t | entrynum
| ) |  |

Read the full data of a music CAT file entry.

Parameters

  filename | Name of CAT file to read from.
  entrynum | Index of entry to read

Returns
  Data of CAT file entry.

Definition at line 52 of file music.cpp.

References BASESET_DIR, FioCheckFileExists(), RandomAccessFile::ReadBlock(), RandomAccessFile::ReadByte(), RandomAccessFile::ReadDword(), RandomAccessFile::SeekTo(), and RandomAccessFile::SkipBytes().

Referenced by MidiFile::GetSMFFile().

## ◆ GetMusicCatEntryName()

std::optional< std::string > GetMusicCatEntryName | ( | const std::string & | filename,
|  | size_t | entrynum
| ) |  |

Read the name of a music CAT file entry.

Parameters

  filename | Name of CAT file to read from
  entrynum | Index of entry whose name to read

Returns
  Name of CAT file entry if it could be read.

Definition at line 28 of file music.cpp.

References BASESET_DIR, FioCheckFileExists(), RandomAccessFile::ReadBlock(), RandomAccessFile::ReadByte(), RandomAccessFile::ReadDword(), RandomAccessFile::SeekTo(), and StrMakeValid().

## Variable Documentation

## ◆ _music_file_names

const char* const _music_file_names[]
| static

Initial value:
= {
"theme",
"old_0", "old_1", "old_2", "old_3", "old_4", "old_5", "old_6", "old_7", "old_8", "old_9",
"new_0", "new_1", "new_2", "new_3", "new_4", "new_5", "new_6", "new_7", "new_8", "new_9",
"ezy_0", "ezy_1", "ezy_2", "ezy_3", "ezy_4", "ezy_5", "ezy_6", "ezy_7", "ezy_8", "ezy_9",
}

Names corresponding to the music set's files.

Definition at line 75 of file music.cpp.