summaryrefslogtreecommitdiff
path: root/platform/osx/audio_driver_osx.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /platform/osx/audio_driver_osx.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
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
Diffstat (limited to 'platform/osx/audio_driver_osx.cpp')
-rw-r--r--platform/osx/audio_driver_osx.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index 4ad3a5b8fc..7ef0669656 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.cpp
@@ -43,9 +43,9 @@ Error AudioDriverOSX::init() {
strdesc.mFramesPerPacket = 1;
strdesc.mBitsPerChannel = 16;
strdesc.mBytesPerFrame =
- strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
+ strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
strdesc.mBytesPerPacket =
- strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
+ strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
OSStatus result = noErr;
AURenderCallbackStruct callback;
@@ -57,7 +57,7 @@ Error AudioDriverOSX::init() {
zeromem(&desc, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
- desc.componentSubType = 0; /* !!! FIXME: ? */
+ desc.componentSubType = 0; /* !!! FIXME: ? */
comp = AudioComponentFindNext(NULL, &desc);
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
@@ -66,16 +66,16 @@ Error AudioDriverOSX::init() {
ERR_FAIL_COND_V(comp == NULL, FAILED);
result = AudioUnitSetProperty(audio_unit,
- kAudioUnitProperty_StreamFormat,
- scope, bus, &strdesc, sizeof(strdesc));
+ kAudioUnitProperty_StreamFormat,
+ scope, bus, &strdesc, sizeof(strdesc));
ERR_FAIL_COND_V(result != noErr, FAILED);
zeromem(&callback, sizeof(AURenderCallbackStruct));
callback.inputProc = &AudioDriverOSX::output_callback;
callback.inputProcRefCon = this;
result = AudioUnitSetProperty(audio_unit,
- kAudioUnitProperty_SetRenderCallback,
- scope, bus, &callback, sizeof(callback));
+ kAudioUnitProperty_SetRenderCallback,
+ scope, bus, &callback, sizeof(callback));
ERR_FAIL_COND_V(result != noErr, FAILED);
result = AudioUnitInitialize(audio_unit);
@@ -92,14 +92,13 @@ Error AudioDriverOSX::init() {
};
OSStatus AudioDriverOSX::output_callback(void *inRefCon,
- AudioUnitRenderActionFlags * ioActionFlags,
- const AudioTimeStamp * inTimeStamp,
- UInt32 inBusNumber, UInt32 inNumberFrames,
- AudioBufferList * ioData) {
-
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber, UInt32 inNumberFrames,
+ AudioBufferList *ioData) {
AudioBuffer *abuf;
- AudioDriverOSX* ad = (AudioDriverOSX*)inRefCon;
+ AudioDriverOSX *ad = (AudioDriverOSX *)inRefCon;
bool mix = true;
@@ -109,7 +108,6 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon,
mix = ad->mutex->try_lock() == OK;
};
-
if (!mix) {
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
abuf = &ioData->mBuffers[i];
@@ -124,7 +122,7 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon,
abuf = &ioData->mBuffers[i];
frames_left = inNumberFrames;
- int16_t* out = (int16_t*)abuf->mData;
+ int16_t *out = (int16_t *)abuf->mData;
while (frames_left) {
@@ -133,9 +131,9 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon,
ad->audio_server_process(frames, ad->samples_in);
//ad->unlock();
- for(int i = 0; i < frames * ad->channels; i++) {
+ for (int i = 0; i < frames * ad->channels; i++) {
- out[i] = ad->samples_in[i]>>16;
+ out[i] = ad->samples_in[i] >> 16;
}
frames_left -= frames;
@@ -180,10 +178,10 @@ void AudioDriverOSX::finish() {
AudioDriverOSX::AudioDriverOSX() {
- mutex=Mutex::create();//NULL;
+ mutex = Mutex::create(); //NULL;
};
-AudioDriverOSX::~AudioDriverOSX() {
+AudioDriverOSX::~AudioDriverOSX(){
};