From 0276f046f675547c5a98760ce01ca7913488106a Mon Sep 17 00:00:00 2001 From: Alastair Moore Date: Fri, 29 Oct 2021 13:23:01 +0100 Subject: [PATCH 1/3] Fix for ismac not being builtin function (anymore?) in R2019b --- m_files/is_os.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m_files/is_os.m b/m_files/is_os.m index 79e48e1..50ba850 100644 --- a/m_files/is_os.m +++ b/m_files/is_os.m @@ -16,13 +16,13 @@ elseif strcmpi(required_os, 'MAC') % Older versions of Matlab don't have 'ismac', so assume % if ismac doesn't exist then it's not a mac! - if exist('ismac', 'builtin') + if exist('ismac') ret_val = ismac; end elseif strcmpi(required_os, 'UNIX') % UNIX should not be true if it's a mac. ret_val = isunix; - if exist('ismac', 'builtin') + if exist('ismac') if ismac ret_val = 0; end From c92376c14a0b35edefd18abbfa41ea37a3bec9dd Mon Sep 17 00:00:00 2001 From: Alastair Moore Date: Fri, 29 Oct 2021 13:24:19 +0100 Subject: [PATCH 2/3] Fixed malformed commentn --- src/pa_dll_playrec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pa_dll_playrec.c b/src/pa_dll_playrec.c index 245e3e5..e9d2f4a 100644 --- a/src/pa_dll_playrec.c +++ b/src/pa_dll_playrec.c @@ -43,8 +43,8 @@ * Multiple states can be set at one time by using single bits for each state * If required more states can be used by adding an additional #define and * an additional element in _stateOpts[] for each state required. - -/* + * + * * BASIC_INIT = The exit function has been registered with mexAtExit. * PortAudio has been succesfully initialised * The state to return to on reset. From f398b6b36b2f7e8afa831cf0b4e652589a385c3b Mon Sep 17 00:00:00 2001 From: Alastair Moore Date: Fri, 29 Oct 2021 14:12:38 +0100 Subject: [PATCH 3/3] Partial fix for updated portaudio (v19.7.0) on macos --- m_files/build_mex.m | 17 ++++++++++++++++- m_files/compile_playrec_func.m | 7 ++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/m_files/build_mex.m b/m_files/build_mex.m index ce8daed..9276e26 100644 --- a/m_files/build_mex.m +++ b/m_files/build_mex.m @@ -140,9 +140,24 @@ mex(build_args{:}); failed = 0; else - failed = mex(build_args{:}); + try + failed = mex(build_args{:}); + catch + if is_os('MAC') + % this is expected because of mex can't cope with linking to framework + fprintf('\n\nmex cannot include the required frameworks on macos\n') + fprintf('Try compiling again with verbose mode turned on.\n') + fprintf('The last command to run probably starts somethinng like...\n') + fprintf('\tusr/bin/xcrun -sdk macosx11.1 clang -Wl,\n') + fprintf('Copy and paste this line onto the terminal and insert the\n') + fprintf('following text just before "mex_dll_core.o"\n') + fprintf('\t-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreFoundation -framework CoreServices\n') + fprintf('Running the modified link command should produce playrec.mexmaci\n\n') + end + end end + function print_flush(varargin) fprintf(varargin{:}); diff --git a/m_files/compile_playrec_func.m b/m_files/compile_playrec_func.m index 08ff31e..d6a9db1 100644 --- a/m_files/compile_playrec_func.m +++ b/m_files/compile_playrec_func.m @@ -50,7 +50,6 @@ 'src/hostapi/wasapi',... 'src/hostapi/wdmks',... 'src/hostapi/wmme',... - 'src/os/mac_osx',... 'src/os/unix',... 'src/os/win',... 'include'}; %just include all possibilities! @@ -76,7 +75,7 @@ %-platform /api specific if is_os('MAC') pa_os_specific_files = [pa_os_specific_files, ... - {'src/os/mac_osx/pa_mac_hostapis.c', ... + {'src/os/unix/pa_unix_hostapis.c', ... 'src/os/unix/pa_unix_util.c'}]; if use_asio pa_api_specific_files = [pa_api_specific_files,... @@ -101,7 +100,9 @@ 'src/hostapi/coreaudio/pa_mac_core_utilities.c',... 'src/hostapi/coreaudio/pa_mac_core_blocking.c'}]; - compiler_flags = [compiler_flags, {'PA_USE_COREAUDIO'}]; + compiler_flags = [compiler_flags, {'PA_USE_COREAUDIO=1',... + '__MACOSX_CORE__'}]; + end if use_jack