aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/Sound.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/facade/Sound.h')
-rw-r--r--src/crepe/facade/Sound.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/crepe/facade/Sound.h b/src/crepe/facade/Sound.h
index 4c68f32..a84aa8c 100644
--- a/src/crepe/facade/Sound.h
+++ b/src/crepe/facade/Sound.h
@@ -1,21 +1,25 @@
#pragma once
-#include <memory>
#include <soloud/soloud.h>
#include <soloud/soloud_wav.h>
-#include "../api/Asset.h"
+#include "../util/OptionalRef.h"
+#include "../Resource.h"
namespace crepe {
+class SoundContext;
+
/**
* \brief Sound resource facade
*
* This class is a wrapper around a \c SoLoud::Wav instance, which holds a
* single sample. It is part of the sound facade.
*/
-class Sound {
+class Sound : public Resource {
public:
+ Sound(const Asset & src);
+ ~Sound(); // dbg_trace
/**
* \brief Pause this sample
*
@@ -67,15 +71,12 @@ public:
bool get_looping() const { return this->looping; }
public:
- Sound(const char * src);
- Sound(std::unique_ptr<Asset> res);
-
-private:
- void load(std::unique_ptr<Asset> res);
+ void set_context(SoundContext & ctx);
private:
SoLoud::Wav sample;
SoLoud::handle handle;
+ OptionalRef<SoundContext> context;
float volume = 1.0f;
bool looping = false;