Fix indentation to match everything else.
This commit is contained in:
@@ -15,10 +15,10 @@ REGISTER_SOUND_DRIVER_CLASS2( Pulse, PulseAudio );
|
||||
|
||||
/* Constructor */
|
||||
RageSoundDriver_PulseAudio::RageSoundDriver_PulseAudio()
|
||||
: RageSoundDriver(),
|
||||
m_LastPosition(0), m_SampleRate(0), m_Error(NULL),
|
||||
m_Sem("Pulseaudio Synchronization Semaphore"),
|
||||
m_PulseMainLoop(NULL), m_PulseCtx(NULL), m_PulseStream(NULL)
|
||||
: RageSoundDriver(),
|
||||
m_LastPosition(0), m_SampleRate(0), m_Error(NULL),
|
||||
m_Sem("Pulseaudio Synchronization Semaphore"),
|
||||
m_PulseMainLoop(NULL), m_PulseCtx(NULL), m_PulseStream(NULL)
|
||||
{
|
||||
m_SampleRate = PREFSMAN->m_iSoundPreferredSampleRate;
|
||||
if( m_SampleRate == 0 )
|
||||
@@ -31,6 +31,7 @@ RageSoundDriver_PulseAudio::~RageSoundDriver_PulseAudio()
|
||||
pa_context_unref(m_PulseCtx);
|
||||
pa_threaded_mainloop_stop(m_PulseMainLoop);
|
||||
pa_threaded_mainloop_free(m_PulseMainLoop);
|
||||
|
||||
if(m_Error != NULL)
|
||||
{
|
||||
free(m_Error);
|
||||
@@ -54,11 +55,14 @@ RString RageSoundDriver_PulseAudio::Init()
|
||||
pa_proplist_sets(plist, PA_PROP_APPLICATION_NAME, PACKAGE_NAME);
|
||||
pa_proplist_sets(plist, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION);
|
||||
pa_proplist_sets(plist, PA_PROP_MEDIA_ROLE, "game");
|
||||
|
||||
LOG->Trace("Pulse: pa_context_new_with_proplist()...");
|
||||
|
||||
m_PulseCtx = pa_context_new_with_proplist(
|
||||
pa_threaded_mainloop_get_api(m_PulseMainLoop),
|
||||
"StepMania", plist);
|
||||
pa_proplist_free(plist);
|
||||
|
||||
if(m_PulseCtx == NULL)
|
||||
{
|
||||
return "pa_context_new_with_proplist() failed!";
|
||||
@@ -77,8 +81,8 @@ RString RageSoundDriver_PulseAudio::Init()
|
||||
pa_context_set_state_callback(m_PulseCtx, StaticCtxStateCb, this);
|
||||
|
||||
LOG->Trace("Pulse: pa_context_connect()...");
|
||||
error = pa_context_connect(m_PulseCtx, NULL,
|
||||
(pa_context_flags_t)0, NULL);
|
||||
error = pa_context_connect(m_PulseCtx, NULL, (pa_context_flags_t)0, NULL);
|
||||
|
||||
if(error < 0)
|
||||
{
|
||||
return ssprintf("pa_contect_connect(): %s",
|
||||
@@ -89,8 +93,7 @@ RString RageSoundDriver_PulseAudio::Init()
|
||||
error = pa_threaded_mainloop_start(m_PulseMainLoop);
|
||||
if(error < 0)
|
||||
{
|
||||
return ssprintf("pa_threaded_mainloop_start() returned %i",
|
||||
error);
|
||||
return ssprintf("pa_threaded_mainloop_start() returned %i", error);
|
||||
}
|
||||
|
||||
/* Create the decode thread, this will be needed for Mix(), that we
|
||||
@@ -150,8 +153,7 @@ void RageSoundDriver_PulseAudio::m_InitStream(void)
|
||||
m_PulseStream = pa_stream_new(m_PulseCtx, "Stepmania Audio", &ss, &map);
|
||||
if(m_PulseStream == NULL)
|
||||
{
|
||||
if(asprintf(&m_Error, "pa_stream_new(): %s",
|
||||
pa_strerror(pa_context_errno(m_PulseCtx))) == -1)
|
||||
if(asprintf(&m_Error, "pa_stream_new(): %s", pa_strerror(pa_context_errno(m_PulseCtx))) == -1)
|
||||
{
|
||||
m_Error = NULL;
|
||||
}
|
||||
@@ -162,6 +164,7 @@ void RageSoundDriver_PulseAudio::m_InitStream(void)
|
||||
/* set the write callback, it will be called when the sound server
|
||||
* needs data */
|
||||
pa_stream_set_write_callback(m_PulseStream, StaticStreamWriteCb, this);
|
||||
|
||||
/* set the state callback, it will be called the the stream state will
|
||||
* change */
|
||||
pa_stream_set_state_callback(m_PulseStream, StaticStreamStateCb, this);
|
||||
@@ -217,8 +220,7 @@ void RageSoundDriver_PulseAudio::m_InitStream(void)
|
||||
attr.prebuf = (uint32_t)-1;
|
||||
|
||||
/* log the used target buffer length */
|
||||
LOG->Trace("Pulse: using target buffer length of %i bytes",
|
||||
attr.tlength);
|
||||
LOG->Trace("Pulse: using target buffer length of %i bytes", attr.tlength);
|
||||
|
||||
/* connect the stream for playback */
|
||||
LOG->Trace("Pulse: pa_stream_connect_playback()...");
|
||||
@@ -257,9 +259,7 @@ void RageSoundDriver_PulseAudio::CtxStateCb(pa_context *c)
|
||||
break;
|
||||
case PA_CONTEXT_TERMINATED:
|
||||
case PA_CONTEXT_FAILED:
|
||||
if(asprintf(&m_Error, "context connection failed: %s",
|
||||
pa_strerror(pa_context_errno(m_PulseCtx)))
|
||||
== -1)
|
||||
if(asprintf(&m_Error, "context connection failed: %s", pa_strerror(pa_context_errno(m_PulseCtx))) == -1)
|
||||
{
|
||||
m_Error = NULL;
|
||||
}
|
||||
@@ -285,8 +285,7 @@ void RageSoundDriver_PulseAudio::StreamStateCb(pa_stream *s)
|
||||
case PA_STREAM_TERMINATED:
|
||||
case PA_STREAM_FAILED:
|
||||
if(asprintf(&m_Error, "stream connection failed: %s",
|
||||
pa_strerror(pa_context_errno(m_PulseCtx)))
|
||||
== -1)
|
||||
pa_strerror(pa_context_errno(m_PulseCtx))) == -1)
|
||||
{
|
||||
}
|
||||
m_Sem.Post();
|
||||
@@ -321,7 +320,6 @@ void RageSoundDriver_PulseAudio::StreamWriteCb(pa_stream *s, size_t length)
|
||||
|
||||
/* Static wrappers, because pulseaudio is a C API, it uses callbacks.
|
||||
* So we have to write wrappers that will call our objects callbacks. */
|
||||
|
||||
void RageSoundDriver_PulseAudio::StaticCtxStateCb(pa_context *c, void *user)
|
||||
{
|
||||
RageSoundDriver_PulseAudio *obj = (RageSoundDriver_PulseAudio*)user;
|
||||
@@ -332,8 +330,7 @@ void RageSoundDriver_PulseAudio::StaticStreamStateCb(pa_stream *s, void *user)
|
||||
RageSoundDriver_PulseAudio *obj = (RageSoundDriver_PulseAudio*)user;
|
||||
obj->StreamStateCb(s);
|
||||
}
|
||||
void RageSoundDriver_PulseAudio::StaticStreamWriteCb(pa_stream *s,
|
||||
size_t length, void *user)
|
||||
void RageSoundDriver_PulseAudio::StaticStreamWriteCb(pa_stream *s, size_t length, void *user)
|
||||
{
|
||||
RageSoundDriver_PulseAudio *obj = (RageSoundDriver_PulseAudio*)user;
|
||||
obj->StreamWriteCb(s, length);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "RageSoundDriver.h"
|
||||
#include <pulse/pulseaudio.h>
|
||||
|
||||
class RageSoundDriver_PulseAudio: public RageSoundDriver
|
||||
class RageSoundDriver_PulseAudio : public RageSoundDriver
|
||||
{
|
||||
public:
|
||||
RageSoundDriver_PulseAudio();
|
||||
@@ -36,8 +36,7 @@ public:
|
||||
|
||||
static void StaticCtxStateCb(pa_context *c, void *user);
|
||||
static void StaticStreamStateCb(pa_stream *s, void *user);
|
||||
static void StaticStreamWriteCb(pa_stream *s,
|
||||
size_t length, void *user);
|
||||
static void StaticStreamWriteCb(pa_stream *s, size_t length, void *user);
|
||||
};
|
||||
|
||||
#endif /* RAGE_SOUND_PULSEAUDIO_H */
|
||||
|
||||
Reference in New Issue
Block a user