mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
migrate from std::filesystem::path to io::path (WIP)
This commit is contained in:
parent
1e22882284
commit
e0314803c0
72 changed files with 1189 additions and 791 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include "io/io.hpp"
|
||||
#include "coders/ogg.hpp"
|
||||
#include "coders/wav.hpp"
|
||||
#include "AL/ALAudio.hpp"
|
||||
|
|
@ -181,11 +182,11 @@ void audio::initialize(bool enabled, AudioSettings& settings) {
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<PCM> audio::load_PCM(const fs::path& file, bool headerOnly) {
|
||||
if (!fs::exists(file)) {
|
||||
throw std::runtime_error("file not found '" + file.u8string() + "'");
|
||||
std::unique_ptr<PCM> audio::load_PCM(const io::path& file, bool headerOnly) {
|
||||
if (!io::exists(file)) {
|
||||
throw std::runtime_error("file not found '" + file.string() + "'");
|
||||
}
|
||||
std::string ext = file.extension().u8string();
|
||||
std::string ext = file.extension();
|
||||
if (ext == ".wav" || ext == ".WAV") {
|
||||
return wav::load_pcm(file, headerOnly);
|
||||
} else if (ext == ".ogg" || ext == ".OGG") {
|
||||
|
|
@ -194,7 +195,7 @@ std::unique_ptr<PCM> audio::load_PCM(const fs::path& file, bool headerOnly) {
|
|||
throw std::runtime_error("unsupported audio format");
|
||||
}
|
||||
|
||||
std::unique_ptr<Sound> audio::load_sound(const fs::path& file, bool keepPCM) {
|
||||
std::unique_ptr<Sound> audio::load_sound(const io::path& file, bool keepPCM) {
|
||||
std::shared_ptr<PCM> pcm(
|
||||
load_PCM(file, !keepPCM && backend->isDummy()).release()
|
||||
);
|
||||
|
|
@ -207,8 +208,8 @@ std::unique_ptr<Sound> audio::create_sound(
|
|||
return backend->createSound(std::move(pcm), keepPCM);
|
||||
}
|
||||
|
||||
std::unique_ptr<PCMStream> audio::open_PCM_stream(const fs::path& file) {
|
||||
std::string ext = file.extension().u8string();
|
||||
std::unique_ptr<PCMStream> audio::open_PCM_stream(const io::path& file) {
|
||||
std::string ext = file.extension();
|
||||
if (ext == ".wav" || ext == ".WAV") {
|
||||
return wav::create_stream(file);
|
||||
} else if (ext == ".ogg" || ext == ".OGG") {
|
||||
|
|
@ -218,7 +219,7 @@ std::unique_ptr<PCMStream> audio::open_PCM_stream(const fs::path& file) {
|
|||
}
|
||||
|
||||
std::unique_ptr<Stream> audio::open_stream(
|
||||
const fs::path& file, bool keepSource
|
||||
const io::path& file, bool keepSource
|
||||
) {
|
||||
if (!keepSource && backend->isDummy()) {
|
||||
auto header = load_PCM(file, true);
|
||||
|
|
@ -338,7 +339,7 @@ speakerid_t audio::play(
|
|||
}
|
||||
|
||||
speakerid_t audio::play_stream(
|
||||
const fs::path& file,
|
||||
const io::path& file,
|
||||
glm::vec3 position,
|
||||
bool relative,
|
||||
float volume,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue