Skip to content

Commit b68a8b4

Browse files
committed
Match style, convert spaces to tabs
1 parent 51cef50 commit b68a8b4

File tree

2 files changed

+98
-98
lines changed

2 files changed

+98
-98
lines changed

external/ObjectAL/Support/OALAudioFile.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
ExtAudioFileRef fileHandle;
5858

5959
#elif __CC_PLATFORM_ANDROID
60-
FILE *rawFILE;
61-
OggVorbis_File oggFile;
62-
const char *oggPath;
63-
UInt32 sampleRate;
64-
UInt32 channelsPerFrame;
65-
UInt32 bitsPerChannel;
66-
UInt32 bytesPerFrame;
67-
UInt32 framesPerPacket;
68-
UInt32 bytesPerPacket;
60+
FILE *rawFILE;
61+
OggVorbis_File oggFile;
62+
const char *oggPath;
63+
UInt32 sampleRate;
64+
UInt32 channelsPerFrame;
65+
UInt32 bitsPerChannel;
66+
UInt32 bytesPerFrame;
67+
UInt32 framesPerPacket;
68+
UInt32 bytesPerPacket;
6969
#endif
7070

7171
/** The actual number of channels in the audio data if not reducing to mono */

external/ObjectAL/Support/OALAudioFile.m

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -128,37 +128,37 @@ - (id) initWithUrl:(NSURL*) urlIn
128128
}
129129

130130
#elif __CC_PLATFORM_ANDROID
131-
// Open the file
132-
oggPath = [[url path] UTF8String];
133-
rawFILE = fopen(oggPath, "rb");
134-
if (NULL == rawFILE) {
135-
error = !noErr;
136-
goto done;
137-
}
138-
error = ov_open(rawFILE, &oggFile, NULL, 0);
139-
if (0 != error) {
140-
fclose(rawFILE);
141-
rawFILE = NULL;
142-
error = !noErr;
143-
goto done;
144-
}
145-
146-
// Get info
147-
vorbis_info *info = ov_info(&oggFile, -1);
148-
if (info) {
149-
channelsPerFrame = info->channels;
150-
sampleRate = (UInt32)info->rate;
151-
bitsPerChannel = 16;
152-
bytesPerFrame = (channelsPerFrame * bitsPerChannel) / 8;
153-
} else {
154-
fclose(rawFILE);
155-
rawFILE = NULL;
156-
error = !noErr;
157-
goto done;
158-
}
159-
160-
// Get frame count
161-
totalFrames = (SInt64) ov_pcm_total(&oggFile, -1);
131+
// Open the file
132+
oggPath = [[url path] UTF8String];
133+
rawFILE = fopen(oggPath, "rb");
134+
if (NULL == rawFILE) {
135+
error = !noErr;
136+
goto done;
137+
}
138+
error = ov_open(rawFILE, &oggFile, NULL, 0);
139+
if (0 != error) {
140+
fclose(rawFILE);
141+
rawFILE = NULL;
142+
error = !noErr;
143+
goto done;
144+
}
145+
146+
// Get info
147+
vorbis_info *info = ov_info(&oggFile, -1);
148+
if (info) {
149+
channelsPerFrame = info->channels;
150+
sampleRate = (UInt32)info->rate;
151+
bitsPerChannel = 16;
152+
bytesPerFrame = (channelsPerFrame * bitsPerChannel) / 8;
153+
} else {
154+
fclose(rawFILE);
155+
rawFILE = NULL;
156+
error = !noErr;
157+
goto done;
158+
}
159+
160+
// Get frame count
161+
totalFrames = (SInt64) ov_pcm_total(&oggFile, -1);
162162
#endif
163163
done:
164164
if(noErr != error)
@@ -174,18 +174,18 @@ - (id) initWithUrl:(NSURL*) urlIn
174174
- (void) dealloc
175175
{
176176
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
177-
if(nil != fileHandle)
178-
{
179-
REPORT_EXTAUDIO_CALL(ExtAudioFileDispose(fileHandle), @"Error closing file (url = %@)", url);
180-
fileHandle = nil;
181-
}
177+
if(nil != fileHandle)
178+
{
179+
REPORT_EXTAUDIO_CALL(ExtAudioFileDispose(fileHandle), @"Error closing file (url = %@)", url);
180+
fileHandle = nil;
181+
}
182182
#elif __CC_PLATFORM_ANDROID
183-
if (oggPath) {
184-
free((void*)oggPath);
185-
}
186-
if (rawFILE) {
187-
fclose(rawFILE);
188-
}
183+
if (oggPath) {
184+
free((void*)oggPath);
185+
}
186+
if (rawFILE) {
187+
fclose(rawFILE);
188+
}
189189
#endif
190190

191191
as_release(url);
@@ -251,16 +251,16 @@ - (void*) audioDataWithStartFrame:(SInt64) startFrame
251251
@synchronized(self)
252252
{
253253
#if __CC_PLATFORM_IOS || __CC_PLATFORM_MAC
254-
if(nil == fileHandle)
254+
if(nil == fileHandle)
255255
{
256256
OAL_LOG_ERROR(@"Attempted to read from closed file. Returning nil (url = %@)", url);
257257
return nil;
258258
}
259259

260260
OSStatus error;
261261
UInt32 numFramesRead;
262-
AudioBufferList bufferList;
263-
UInt32 bufferOffset = 0;
262+
AudioBufferList bufferList;
263+
UInt32 bufferOffset = 0;
264264

265265

266266
// < 0 means read to the end of the file.
@@ -288,32 +288,32 @@ - (void*) audioDataWithStartFrame:(SInt64) startFrame
288288
goto onFail;
289289
}
290290

291-
292-
bufferList.mNumberBuffers = 1;
293-
bufferList.mBuffers[0].mNumberChannels = streamDescription.mChannelsPerFrame;
294-
for(UInt32 framesToRead = (UInt32) numFrames; framesToRead > 0; framesToRead -= numFramesRead)
295-
{
296-
bufferList.mBuffers[0].mDataByteSize = streamDescription.mBytesPerFrame * framesToRead;
297-
bufferList.mBuffers[0].mData = (char*)streamData + bufferOffset;
298-
299-
numFramesRead = framesToRead;
300-
if(noErr != (error = ExtAudioFileRead(fileHandle, &numFramesRead, &bufferList)))
301-
{
302-
REPORT_EXTAUDIO_CALL(error, @"Could not read audio data in file (url = %@)",
303-
url);
304-
goto onFail;
305-
}
306-
bufferOffset += streamDescription.mBytesPerFrame * numFramesRead;
307-
if(numFramesRead == 0)
308-
{
309-
// Sometimes the stream description was wrong and you hit an EOF prematurely
310-
break;
311-
}
312-
}
291+
292+
bufferList.mNumberBuffers = 1;
293+
bufferList.mBuffers[0].mNumberChannels = streamDescription.mChannelsPerFrame;
294+
for(UInt32 framesToRead = (UInt32) numFrames; framesToRead > 0; framesToRead -= numFramesRead)
295+
{
296+
bufferList.mBuffers[0].mDataByteSize = streamDescription.mBytesPerFrame * framesToRead;
297+
bufferList.mBuffers[0].mData = (char*)streamData + bufferOffset;
298+
299+
numFramesRead = framesToRead;
300+
if(noErr != (error = ExtAudioFileRead(fileHandle, &numFramesRead, &bufferList)))
301+
{
302+
REPORT_EXTAUDIO_CALL(error, @"Could not read audio data in file (url = %@)",
303+
url);
304+
goto onFail;
305+
}
306+
bufferOffset += streamDescription.mBytesPerFrame * numFramesRead;
307+
if(numFramesRead == 0)
308+
{
309+
// Sometimes the stream description was wrong and you hit an EOF prematurely
310+
break;
311+
}
312+
}
313313

314314
if(nil != bufferSize)
315315
{
316-
// Use however many bytes were actually read
316+
// Use however many bytes were actually read
317317
*bufferSize = bufferOffset;
318318
}
319319

@@ -327,7 +327,7 @@ - (void*) audioDataWithStartFrame:(SInt64) startFrame
327327
return nil;
328328
#elif __CC_PLATFORM_ANDROID
329329
UInt32 numFramesRead;
330-
UInt32 bufferOffset = 0;
330+
UInt32 bufferOffset = 0;
331331

332332
// < 0 means read to the end of the file.
333333
if(numFrames < 0)
@@ -355,29 +355,29 @@ - (void*) audioDataWithStartFrame:(SInt64) startFrame
355355
goto onFail;
356356
}
357357

358-
int bitStream = 0;
359-
int chunkSize = 0;
360-
UInt32 bytesToRead = (UInt32) numFrames * bytesPerFrame;
361-
UInt32 bytesRead = 0;
362-
for(bytesRead = 0; bytesRead < bytesToRead; bytesRead += chunkSize)
363-
{
364-
chunkSize = (int) ov_read(&oggFile,
365-
(char*)(streamData + bytesRead),
366-
(int)(streamSizeInBytes - bytesRead),
367-
&bitStream);
368-
if (chunkSize < 0)
369-
{
370-
REPORT_EXTAUDIO_CALL((OSStatus)chunkSize, @"Could not read audio data in file (url = %@)",
371-
url);
372-
goto onFail;
373-
} else if (chunkSize == 0) {
374-
break;
375-
}
376-
}
358+
int bitStream = 0;
359+
int chunkSize = 0;
360+
UInt32 bytesToRead = (UInt32) numFrames * bytesPerFrame;
361+
UInt32 bytesRead = 0;
362+
for(bytesRead = 0; bytesRead < bytesToRead; bytesRead += chunkSize)
363+
{
364+
chunkSize = (int) ov_read(&oggFile,
365+
(char*)(streamData + bytesRead),
366+
(int)(streamSizeInBytes - bytesRead),
367+
&bitStream);
368+
if (chunkSize < 0)
369+
{
370+
REPORT_EXTAUDIO_CALL((OSStatus)chunkSize, @"Could not read audio data in file (url = %@)",
371+
url);
372+
goto onFail;
373+
} else if (chunkSize == 0) {
374+
break;
375+
}
376+
}
377377

378378
if(nil != bufferSize)
379379
{
380-
// Use however many bytes were actually read
380+
// Use however many bytes were actually read
381381
*bufferSize = bytesRead;
382382
}
383383

0 commit comments

Comments
 (0)