22 #include "vorbis/vorbisfile.h"
25 #define ERR_AUDIO LOG_STREAM(err, log_audio)
26 #define LOG_AUDIO LOG_STREAM(info, log_audio)
45 , title_(node[
"title"])
46 , ms_before_(node[
"ms_before"].to_int())
47 , ms_after_(node[
"ms_after"].to_int())
48 , once_(node[
"play_once"].to_bool())
49 , append_(node[
"append"].to_bool())
50 , immediate_(node[
"immediate"].to_bool())
51 , shuffle_(node[
"shuffle"].to_bool(true))
73 LOG_AUDIO <<
"empty track filename specified for track identification";
80 LOG_AUDIO <<
"could not find track '" <<
id_ <<
"' for track identification";
91 vorbis_comment* comments = ov_comment(&vf, -1);
92 char** user_comments = comments->user_comments;
95 for (
int i=0;
i< comments->comments;
i++) {
96 const std::string comment_string(user_comments[
i]);
97 const std::vector<std::string> comment_list =
utils::split(comment_string,
'=');
99 if (comment_list[0] ==
"TITLE" || comment_list[0] ==
"title") {
105 LOG_AUDIO <<
"No title for music track '" <<
id_ <<
"'";
A config object defines a single node in a WML file, with access to child nodes.
config & add_child(config_key_type key)
std::chrono::milliseconds ms_before_
void write(config &parent_node, bool append) const
std::chrono::milliseconds ms_after_
Definitions for the interface to Wesnoth Markup Language (WML).
Declarations for File-IO.
Standard logging facilities (interface).
utils::optional< 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, if it exists.
Audio output for sound and music.
std::vector< std::string > split(const config_attribute_value &val)
static lg::log_domain log_audio("audio")