mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-14 07:36:26 +00:00
Initial AudioQueueServices implementation
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include "boo/audiodev/IAudioVoiceAllocator.hpp"
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
static LogVisor::LogModule Log("boo::ALSA");
|
||||
@@ -129,6 +130,9 @@ struct ALSAAudioVoice : IAudioVoice
|
||||
|
||||
snd_async_add_pcm_handler(&m_handler, m_pcm, snd_async_callback_t(Callback), this);
|
||||
snd_pcm_get_params(m_pcm, &m_bufSize, &m_periodSize);
|
||||
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
m_cb->needsNextBuffer(this, m_periodSize);
|
||||
}
|
||||
|
||||
~ALSAAudioVoice()
|
||||
@@ -144,6 +148,18 @@ struct ALSAAudioVoice : IAudioVoice
|
||||
if (m_pcm)
|
||||
snd_pcm_writei(m_pcm, data, frames);
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
if (m_pcm)
|
||||
snd_pcm_start(m_pcm);
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
if (m_pcm)
|
||||
snd_pcm_drain(m_pcm);
|
||||
}
|
||||
};
|
||||
|
||||
struct ALSAAudioVoiceAllocator : IAudioVoiceAllocator
|
||||
|
||||
Reference in New Issue
Block a user