Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Compile Failure for macOS, iOS and modern Xcode #69

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
submodules: 'recursive'
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.1'
xcode-version: '14'
- name: Build
run: |
gem install --verbose xcpretty
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/celt-0.7.0-build/Base.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0

SKIP_INSTALL = YES

OTHER_CFLAGS = -x c++
//OTHER_CFLAGS = -x c++

HEADER_SEARCH_PATHS = .
ALWAYS_SEARCH_USER_PATHS = NO
Expand Down
4 changes: 2 additions & 2 deletions src/MKMacAudioDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ static OSStatus inputCallback(void *udata, AudioUnitRenderActionFlags *flags, co
actual read bytes count. We need to write it back otherwise
we'll reallocate the buffer even if not needed.
*/
UInt32 dataByteSize = dev->_buflist.mBuffers->mDataByteSize;
UInt32 dataByteSize = dev->_recordBufList.mBuffers->mDataByteSize;
err = AudioUnitRender(dev->_recordAudioUnit, flags, ts, busnum, nframes, &dev->_recordBufList);
if (err != noErr) {
NSLog(@"MKMacAudioDevice: AudioUnitRender failed. err = %ld", (unsigned long)err);
return err;
}
dev->_buflist.mBuffers->mDataByteSize = dataByteSize;
dev->_recordBufList.mBuffers->mDataByteSize = dataByteSize;

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
short *buf = (short *) dev->_recordBufList.mBuffers->mData;
Expand Down
14 changes: 13 additions & 1 deletion src/MKVoiceProcessingDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
#import <AudioUnit/AudioUnit.h>
#import <AudioUnit/AUComponent.h>
#import <AudioToolbox/AudioToolbox.h>
#import <UIKit/UIKit.h>
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
#define IS_UIDEVICE_AVAILABLE 1
#elif TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_MACCATALYST
#define IS_UIDEVICE_AVAILABLE 1
#else
#define IS_UIDEVICE_AVAILABLE 0
#endif

#if IS_UIDEVICE_AVAILABLE
#import <UIKit/UIKit.h>
#endif

@interface MKVoiceProcessingDevice () {
@public
Expand All @@ -24,6 +34,7 @@ @interface MKVoiceProcessingDevice () {
}
@end

#if IS_UIDEVICE_AVAILABLE
// DeviceIsRunningiOS7OrGreater returns YES if
// the iOS device is on iOS 7 or greater.
static BOOL DeviceIsRunningiOS7OrGreater() {
Expand All @@ -38,6 +49,7 @@ static BOOL DeviceIsRunningiOS7OrGreater() {
}
return iOS7OrGreater;
}
#endif

static OSStatus inputCallback(void *udata, AudioUnitRenderActionFlags *flags, const AudioTimeStamp *ts,
UInt32 busnum, UInt32 nframes, AudioBufferList *buflist) {
Expand Down