work on Audio
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef AUDIO_H
|
||||
#define AUDIO_H
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
|
||||
@@ -10,10 +12,38 @@ namespace Archimedes {
|
||||
|
||||
public:
|
||||
|
||||
Audio() {}
|
||||
Audio() {
|
||||
if(!SDL_Init(SDL_INIT_AUDIO)) {
|
||||
|
||||
~Audio() {}
|
||||
std::abort();
|
||||
}
|
||||
|
||||
pDevices = SDL_GetAudioPlaybackDevices(&pDeviceCount);
|
||||
rDevices = SDL_GetAudioPlaybackDevices(&rDeviceCount);
|
||||
}
|
||||
|
||||
~Audio() {
|
||||
|
||||
for(SDL_AudioStream* s : streams) {
|
||||
DestroyAudioStream(s);
|
||||
}
|
||||
|
||||
SDL_QuitSubsystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
SDL_AudioDeviceID* pDevices;
|
||||
|
||||
int pDeviceCount = 0;
|
||||
|
||||
SDL_AudioDeviceID* rDevices;
|
||||
|
||||
int rDeviceCount = 0;
|
||||
|
||||
std::vector<SDL_AudioStream*> streams;
|
||||
std::vector<SDL_AudioSpec> specs;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user