Replaced unique_ptr with Corrade::Containers::Pointer

This commit is contained in:
2025-09-04 22:48:42 +03:00
parent ead1e742d1
commit 29bcf9fbae
2 changed files with 6 additions and 4 deletions

View File

@@ -1,11 +1,12 @@
#ifndef CHARGE_AUDIO_BASE_H #ifndef CHARGE_AUDIO_BASE_H
#define CHARGE_AUDIO_BASE_H #define CHARGE_AUDIO_BASE_H
#include <Corrade/Containers/Containers.h>
#include <Magnum/Magnum.h> #include <Magnum/Magnum.h>
#include <Magnum/Math/Vector.h> #include <Magnum/Math/Vector.h>
#include <memory>
#include <string> #include <string>
namespace ChargeAudio { namespace ChargeAudio {
using namespace Corrade;
namespace { namespace {
#include "miniaudio/miniaudio.h" #include "miniaudio/miniaudio.h"
} }
@@ -30,7 +31,7 @@ private:
class Engine { class Engine {
public: public:
Engine(); Engine();
std::unique_ptr<Sound> CreateSound(std::string filepath); Containers::Pointer<Sound> CreateSound(std::string filepath);
void SetVolume(float value); void SetVolume(float value);
float GetVolume(); float GetVolume();

View File

@@ -1,4 +1,5 @@
#include "ChargeAudio.hpp" #include "ChargeAudio.hpp"
#include <Corrade/Containers/Pointer.h>
#include <Corrade/Utility/Debug.h> #include <Corrade/Utility/Debug.h>
#include <cstddef> #include <cstddef>
@@ -16,8 +17,8 @@ Engine::Engine() {
} }
} }
std::unique_ptr<Sound> Engine::CreateSound(std::string filepath) { Containers::Pointer<Sound> Engine::CreateSound(std::string filepath) {
auto sound = std::unique_ptr<Sound>(new Sound()); auto sound = Containers::Pointer<Sound>(new Sound());
sound->baseEngine = this; sound->baseEngine = this;
maResponse = ma_sound_init_from_file(&maEngine, filepath.c_str(), 0, NULL, maResponse = ma_sound_init_from_file(&maEngine, filepath.c_str(), 0, NULL,