Refactoring, FFmpeg updates
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "sound.h"
|
||||
|
||||
#include "filesystem_.h"
|
||||
#include "string_.h"
|
||||
#include "xml_.h"
|
||||
|
||||
using namespace anm2ed::resource;
|
||||
@@ -28,8 +27,8 @@ namespace anm2ed::anm2
|
||||
Sound::Sound(const std::string& directory, const std::string& path)
|
||||
{
|
||||
filesystem::WorkingDirectory workingDirectory(directory);
|
||||
this->path = !path.empty() ? std::filesystem::relative(path).string() : this->path.string();
|
||||
this->path = string::backslash_replace_to_lower(this->path);
|
||||
this->path = !path.empty() ? std::filesystem::relative(path) : this->path;
|
||||
this->path = filesystem::path_lower_case_backslash_handle(this->path);
|
||||
audio = Audio(this->path.c_str());
|
||||
}
|
||||
|
||||
@@ -38,8 +37,8 @@ namespace anm2ed::anm2
|
||||
if (!element) return;
|
||||
element->QueryIntAttribute("Id", &id);
|
||||
xml::query_path_attribute(element, "Path", &path);
|
||||
string::backslash_replace_to_lower(this->path);
|
||||
audio = Audio(this->path.c_str());
|
||||
path = filesystem::path_lower_case_backslash_handle(path);
|
||||
audio = Audio(path.c_str());
|
||||
}
|
||||
|
||||
XMLElement* Sound::to_element(XMLDocument& document, int id)
|
||||
@@ -56,4 +55,19 @@ namespace anm2ed::anm2
|
||||
document.InsertEndChild(to_element(document, id));
|
||||
return xml::document_to_string(document);
|
||||
}
|
||||
|
||||
void Sound::reload(const std::string& directory)
|
||||
{
|
||||
*this = Sound(directory, this->path);
|
||||
}
|
||||
|
||||
bool Sound::is_valid()
|
||||
{
|
||||
return audio.is_valid();
|
||||
}
|
||||
|
||||
void Sound::play()
|
||||
{
|
||||
audio.play();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user