A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
This commit is contained in:
@@ -29,15 +29,15 @@
|
||||
#ifndef AUDIO_DRIVER_XAUDIO2_H
|
||||
#define AUDIO_DRIVER_XAUDIO2_H
|
||||
|
||||
#include "servers/audio_server.h"
|
||||
#include "core/os/thread.h"
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/os/thread.h"
|
||||
#include "servers/audio_server.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <mmreg.h>
|
||||
#include <xaudio2.h>
|
||||
#include <mmsystem.h>
|
||||
#include <windows.h>
|
||||
#include <wrl/client.h>
|
||||
#include <xaudio2.h>
|
||||
|
||||
class AudioDriverXAudio2 : public AudioDriver {
|
||||
|
||||
@@ -48,26 +48,28 @@ class AudioDriverXAudio2 : public AudioDriver {
|
||||
struct XAudio2DriverVoiceCallback : public IXAudio2VoiceCallback {
|
||||
|
||||
HANDLE buffer_end_event;
|
||||
XAudio2DriverVoiceCallback() : buffer_end_event(CreateEvent(NULL, FALSE, FALSE, NULL)) {}
|
||||
void STDMETHODCALLTYPE OnBufferEnd(void* pBufferContext) { /*print_line("buffer ended");*/ SetEvent(buffer_end_event); }
|
||||
XAudio2DriverVoiceCallback()
|
||||
: buffer_end_event(CreateEvent(NULL, FALSE, FALSE, NULL)) {}
|
||||
void STDMETHODCALLTYPE OnBufferEnd(void *pBufferContext) { /*print_line("buffer ended");*/
|
||||
SetEvent(buffer_end_event);
|
||||
}
|
||||
|
||||
//Unused methods are stubs
|
||||
void STDMETHODCALLTYPE OnStreamEnd() {}
|
||||
void STDMETHODCALLTYPE OnVoiceProcessingPassEnd() {}
|
||||
void STDMETHODCALLTYPE OnVoiceProcessingPassStart(UINT32 SamplesRequired) {}
|
||||
void STDMETHODCALLTYPE OnBufferStart(void * pBufferContext) {}
|
||||
void STDMETHODCALLTYPE OnLoopEnd(void * pBufferContext) {}
|
||||
void STDMETHODCALLTYPE OnVoiceError(void * pBufferContext, HRESULT Error) {}
|
||||
|
||||
void STDMETHODCALLTYPE OnBufferStart(void *pBufferContext) {}
|
||||
void STDMETHODCALLTYPE OnLoopEnd(void *pBufferContext) {}
|
||||
void STDMETHODCALLTYPE OnVoiceError(void *pBufferContext, HRESULT Error) {}
|
||||
};
|
||||
|
||||
Thread* thread;
|
||||
Mutex* mutex;
|
||||
Thread *thread;
|
||||
Mutex *mutex;
|
||||
|
||||
int32_t* samples_in;
|
||||
int16_t* samples_out[AUDIO_BUFFERS];
|
||||
int32_t *samples_in;
|
||||
int16_t *samples_out[AUDIO_BUFFERS];
|
||||
|
||||
static void thread_func(void* p_udata);
|
||||
static void thread_func(void *p_udata);
|
||||
int buffer_size;
|
||||
|
||||
unsigned int mix_rate;
|
||||
@@ -83,14 +85,13 @@ class AudioDriverXAudio2 : public AudioDriver {
|
||||
WAVEFORMATEX wave_format;
|
||||
Microsoft::WRL::ComPtr<IXAudio2> xaudio;
|
||||
int current_buffer;
|
||||
IXAudio2MasteringVoice* mastering_voice;
|
||||
IXAudio2MasteringVoice *mastering_voice;
|
||||
XAUDIO2_BUFFER xaudio_buffer[AUDIO_BUFFERS];
|
||||
IXAudio2SourceVoice* source_voice;
|
||||
IXAudio2SourceVoice *source_voice;
|
||||
XAudio2DriverVoiceCallback voice_callback;
|
||||
|
||||
public:
|
||||
|
||||
const char* get_name() const;
|
||||
const char *get_name() const;
|
||||
|
||||
virtual Error init();
|
||||
virtual void start();
|
||||
|
||||
Reference in New Issue
Block a user