initial import, >900commits predate this

This commit is contained in:
2020-09-29 13:47:50 +02:00
commit e74154ccee
352 changed files with 108120 additions and 0 deletions

View File

@ -0,0 +1,44 @@
#include "./sound_service.hpp"
#include <string>
#include <mm/logger.hpp>
#define LOG_CRIT(...) __LOG_CRIT( "Sound", __VA_ARGS__)
#define LOG_ERROR(...) __LOG_ERROR("Sound", __VA_ARGS__)
#define LOG_WARN(...) __LOG_WARN( "Sound", __VA_ARGS__)
#define LOG_INFO(...) __LOG_INFO( "Sound", __VA_ARGS__)
#define LOG_DEBUG(...) __LOG_DEBUG("Sound", __VA_ARGS__)
#define LOG_TRACE(...) __LOG_TRACE("Sound", __VA_ARGS__)
namespace MM::Services {
SoundService::SoundService(void) : engine() {
MM::Logger::initSectionLogger("Sound");
}
SoundService::~SoundService(void) {
}
bool SoundService::enable(Engine&) {
unsigned int flags = SoLoud::Soloud::CLIP_ROUNDOFF;
auto r = engine.init(flags);
if (r != 0) {
LOG_ERROR("SoLoud initialization failed: {}", r);
return false;
}
LOG_INFO("SoLoud v{} backend: {}", engine.getVersion(), engine.getBackendString());
return true;
}
void SoundService::disable(Engine&) {
engine.deinit();
}
void SoundService::printErrorString(SoLoud::result errorCode) {
LOG_ERROR("error string: {}", engine.getErrorString(errorCode));
}
} // MM::Services

View File

@ -0,0 +1,27 @@
#pragma once
#include <soloud.h>
#include <mm/engine.hpp>
namespace MM::Services {
class SoundService : public Service {
public:
SoLoud::Soloud engine;
public:
bool enable(Engine&) override;
void disable(Engine&) override;
const char* name(void) override { return "SoundService"; }
public:
SoundService(void);
~SoundService(void);
void printErrorString(SoLoud::result errorCode);
};
} // MM::Services