mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-09 13:37:48 +00:00
Humungous refactor
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#include "boo/audiodev/IAudioVoiceAllocator.hpp"
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
#include "logvisor/logvisor.hpp"
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
static LogVisor::LogModule Log("boo::ALSA");
|
||||
static logvisor::Module Log("boo::ALSA");
|
||||
|
||||
struct ALSAAudioVoice : IAudioVoice
|
||||
{
|
||||
@@ -29,7 +29,7 @@ struct ALSAAudioVoice : IAudioVoice
|
||||
{
|
||||
if (snd_pcm_open(&m_pcm, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_ASYNC) < 0)
|
||||
{
|
||||
Log.report(LogVisor::Error, "unable to allocate ALSA voice");
|
||||
Log.report(logvisor::Error, "unable to allocate ALSA voice");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ struct ALSAAudioVoice : IAudioVoice
|
||||
{
|
||||
snd_pcm_close(m_pcm);
|
||||
m_pcm = nullptr;
|
||||
Log.report(LogVisor::Error, "unable to set ALSA voice params");
|
||||
Log.report(logvisor::Error, "unable to set ALSA voice params");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ struct ALSAAudioVoice : IAudioVoice
|
||||
{
|
||||
snd_pcm_close(m_pcm);
|
||||
m_pcm = nullptr;
|
||||
Log.report(LogVisor::Error, "unable to query ALSA voice chmaps");
|
||||
Log.report(logvisor::Error, "unable to query ALSA voice chmaps");
|
||||
return;
|
||||
}
|
||||
snd_pcm_chmap_t* foundChmap = nullptr;
|
||||
@@ -119,7 +119,7 @@ struct ALSAAudioVoice : IAudioVoice
|
||||
snd_pcm_close(m_pcm);
|
||||
m_pcm = nullptr;
|
||||
snd_pcm_free_chmaps(chmaps);
|
||||
Log.report(LogVisor::Error, "unable to find matching ALSA voice chmap");
|
||||
Log.report(logvisor::Error, "unable to find matching ALSA voice chmap");
|
||||
return;
|
||||
}
|
||||
m_map.m_channelCount = chCount;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "boo/audiodev/IAudioVoiceAllocator.hpp"
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
#include "logvisor/logvisor.hpp"
|
||||
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
static LogVisor::LogModule Log("boo::AQS");
|
||||
static logvisor::Module Log("boo::AQS");
|
||||
|
||||
static AudioChannel AQSChannelToBooChannel(AudioChannelLabel ch)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ struct AQSAudioVoice : IAudioVoice
|
||||
}
|
||||
if (err)
|
||||
{
|
||||
Log.report(LogVisor::Error, "unable to create output audio queue");
|
||||
Log.report(logvisor::Error, "unable to create output audio queue");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ struct AQSAudioVoice : IAudioVoice
|
||||
UInt32 layoutSz = sizeof(layout);
|
||||
if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz))
|
||||
{
|
||||
Log.report(LogVisor::Error, "unable to get channel layout from audio queue");
|
||||
Log.report(logvisor::Error, "unable to get channel layout from audio queue");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ struct AQSAudioVoice : IAudioVoice
|
||||
m_map.m_channels[4] = AudioChannel::FrontCenter;
|
||||
break;
|
||||
default:
|
||||
Log.report(LogVisor::Error, "unknown channel layout %u; using stereo", layout.mChannelLayoutTag);
|
||||
Log.report(logvisor::Error, "unknown channel layout %u; using stereo", layout.mChannelLayoutTag);
|
||||
m_map.m_channelCount = 2;
|
||||
m_map.m_channels[0] = AudioChannel::FrontLeft;
|
||||
m_map.m_channels[1] = AudioChannel::FrontRight;
|
||||
@@ -155,7 +155,7 @@ struct AQSAudioVoice : IAudioVoice
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
if (AudioQueueAllocateBuffer(m_queue, m_bufferFrames * chCount * 2, &m_buffers[i]))
|
||||
{
|
||||
Log.report(LogVisor::Error, "unable to create audio queue buffer");
|
||||
Log.report(logvisor::Error, "unable to create audio queue buffer");
|
||||
AudioQueueDispose(m_queue, false);
|
||||
m_queue = nullptr;
|
||||
return;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "../win/Win32Common.hpp"
|
||||
#include "boo/audiodev/IAudioVoiceAllocator.hpp"
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
#include "logvisor/logvisor.hpp"
|
||||
|
||||
#include <xaudio2.h>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
static LogVisor::LogModule Log("boo::XAudio2");
|
||||
static logvisor::Module Log("boo::XAudio2");
|
||||
|
||||
struct XA2AudioVoice : IAudioVoice
|
||||
{
|
||||
@@ -52,7 +52,7 @@ struct XA2AudioVoice : IAudioVoice
|
||||
|
||||
if FAILED(xa2.CreateSourceVoice(&m_voiceQueue, &desc, 0, XAUDIO2_DEFAULT_FREQ_RATIO, &m_xaCb))
|
||||
{
|
||||
Log.report(LogVisor::Error, "unable to create source voice");
|
||||
Log.report(logvisor::Error, "unable to create source voice");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ struct XA2AudioVoice : IAudioVoice
|
||||
m_map.m_channels[7] = AudioChannel::SideRight;
|
||||
break;
|
||||
default:
|
||||
Log.report(LogVisor::Error, "unknown channel layout %u; using stereo", voxDetails.InputChannels);
|
||||
Log.report(logvisor::Error, "unknown channel layout %u; using stereo", voxDetails.InputChannels);
|
||||
m_map.m_channelCount = 2;
|
||||
m_map.m_channels[0] = AudioChannel::FrontLeft;
|
||||
m_map.m_channels[1] = AudioChannel::FrontRight;
|
||||
@@ -153,18 +153,18 @@ struct XA2AudioVoiceAllocator : IAudioVoiceAllocator
|
||||
{
|
||||
if (FAILED(XAudio2Create(&m_xa2)))
|
||||
{
|
||||
Log.report(LogVisor::Error, "Unable to initialize XAudio2");
|
||||
Log.report(logvisor::Error, "Unable to initialize XAudio2");
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_xa2->CreateMasteringVoice(&m_masterVoice)))
|
||||
{
|
||||
Log.report(LogVisor::Error, "Unable to initialize XAudio2 mastering voice");
|
||||
Log.report(logvisor::Error, "Unable to initialize XAudio2 mastering voice");
|
||||
return;
|
||||
}
|
||||
DWORD channelMask;
|
||||
if (FAILED(m_masterVoice->GetChannelMask(&channelMask)))
|
||||
{
|
||||
Log.report(LogVisor::Error, "Unable to get mastering voice's channel mask");
|
||||
Log.report(logvisor::Error, "Unable to get mastering voice's channel mask");
|
||||
return;
|
||||
}
|
||||
if ((channelMask & (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)) == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT))
|
||||
|
||||
Reference in New Issue
Block a user