23 #if !defined(_WIN32) && !defined(__APPLE__)
24 #include "vorbis/vorbisfile.h"
28 #define ERR_AUDIO LOG_STREAM(err, log_audio)
29 #define LOG_AUDIO LOG_STREAM(info, log_audio)
48 title_(node[
"title"]),
49 ms_before_(node[
"ms_before"]),
50 ms_after_(node[
"ms_after"]),
51 once_(node[
"play_once"].to_bool()),
52 append_(node[
"append"].to_bool()),
53 immediate_(node[
"immediate"].to_bool()),
54 shuffle_(node[
"shuffle"].to_bool(true))
76 LOG_AUDIO <<
"empty track filename specified for track identification\n";
83 LOG_AUDIO <<
"could not find track '" <<
id_ <<
"' for track identification\n";
88 #if !defined(_WIN32) && !defined(__APPLE__) && !defined(PANDORA)
94 <<
"' for track identification\n";
99 if(ov_open(f, &vf,
nullptr, 0) < 0) {
100 LOG_AUDIO <<
"track does not appear to be an Ogg file '"
101 <<
id_ <<
"', cannot be identified\n";
106 vorbis_comment* comments = ov_comment(&vf, -1);
107 char** user_comments = comments->user_comments;
110 for (
int i=0;
i< comments->comments;
i++) {
112 const std::vector<std::string> comment_list =
utils::split(comment_string,
'=');
114 if (comment_list[0] ==
"TITLE" || comment_list[0] ==
"title") {
120 LOG_AUDIO <<
"No title for music track '" <<
id_ <<
"'\n";
static lg::log_domain log_audio("audio")
std::string get_binary_file_location(const std::string &type, const std::string &filename)
Returns a complete path to the actual file of a given type or an empty string if the file isn't prese...
Audio output for sound and music.
Definitions for the interface to Wesnoth Markup Language (WML).
config & add_child(const std::string &key)
Templates and utility-routines for strings and numbers.
void write(config &parent_node, bool append) const
Declarations for File-IO.
Standard logging facilities (interface).
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string