Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
3f044fc6
Commit
3f044fc6
authored
Dec 28, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iOS: Add support for configuring the size of the IO buffer.
parent
fdf2a283
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
miniaudio.h
miniaudio.h
+9
-9
No files found.
miniaudio.h
View file @
3f044fc6
...
...
@@ -31272,7 +31272,6 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
-(void)dealloc
{
[self remove_handler];
[super dealloc];
}
-(void)remove_handler
...
...
@@ -31428,8 +31427,6 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
AURenderCallbackStruct callbackInfo;
#if defined(MA_APPLE_DESKTOP)
AudioObjectID deviceObjectID;
#else
UInt32 actualPeriodSizeInFramesSize = sizeof(actualPeriodSizeInFrames);
#endif
/* This API should only be used for a single device type: playback or capture. No full-duplex mode. */
...
...
@@ -31714,13 +31711,16 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
}
#else
/*
I don't know how to configure buffer sizes on iOS so for now we're not allowing it to be configured. Instead we're
just going to set it to the value of kAudioUnitProperty_MaximumFramesPerSlice.
On iOS, the size of the IO buffer needs to be specified in seconds and is a floating point
number. I don't trust any potential truncation errors due to converting from float to integer
so I'm going to explicitly set the actual period size to the next power of 2.
*/
status = ((ma_AudioUnitGetProperty_proc)pContext->coreaudio.AudioUnitGetProperty)(pData->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, &actualPeriodSizeInFrames, &actualPeriodSizeInFramesSize);
if (status != noErr) {
((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit);
return ma_result_from_OSStatus(status);
@autoreleasepool {
AVAudioSession* pAudioSession = [AVAudioSession sharedInstance];
MA_ASSERT(pAudioSession != NULL);
[pAudioSession setPreferredIOBufferDuration:((float)actualPeriodSizeInFrames / pAudioSession.sampleRate) error:nil];
actualPeriodSizeInFrames = ma_next_power_of_2((ma_uint32)(pAudioSession.IOBufferDuration * pAudioSession.sampleRate));
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment