Audio Abstrakcija - WIP
This commit is contained in:
37
include/object/sound.hpp
Normal file
37
include/object/sound.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_mixer/SDL_mixer.h>
|
||||
#include <utils.hpp>
|
||||
#include <audio/audio.hpp>
|
||||
|
||||
namespace Game::Object {
|
||||
enum class Format {
|
||||
WAV,
|
||||
OGG,
|
||||
MP3,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
class Sound {
|
||||
public:
|
||||
Sound() = default;
|
||||
Sound(std::string path, Format format, int volume = 128);
|
||||
Sound(const Sound&);
|
||||
Sound& operator=(const Sound&);
|
||||
Sound(Sound&&);
|
||||
Sound& operator=(Sound&&);
|
||||
~Sound();
|
||||
|
||||
void setVolume(int volume) { mVolume = volume; }
|
||||
int getVolume() const { return mVolume; }
|
||||
|
||||
void play();
|
||||
|
||||
private:
|
||||
Uint8* mAudioBuffer = nullptr;
|
||||
Uint32 mAudioLength = 0;
|
||||
SDL_AudioStream* mAudioStream = nullptr;
|
||||
int mVolume;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user