Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
Bonzomatic
Commits
f9efc7cc
Commit
f9efc7cc
authored
May 18, 2019
by
Cameron Armstrong (Nightfox)
Committed by
Gargaj
May 18, 2019
Browse files
Ask the user for microphone access on startup if required
parent
550ad6fa
Changes
3
Show whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
f9efc7cc
...
@@ -332,7 +332,7 @@ if (APPLE)
...
@@ -332,7 +332,7 @@ if (APPLE)
${
CMAKE_SOURCE_DIR
}
/src/platform_glfw/Renderer.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_glfw/Renderer.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_common/FFT.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_common/FFT.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_x11/MIDI.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_x11/MIDI.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_osx/Misc.
cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_osx/Misc.
mm
${
CMAKE_SOURCE_DIR
}
/src/platform_x11/Timer.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_x11/Timer.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_osx/SetupDialog.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_osx/SetupDialog.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_osx/Clipboard.cpp
${
CMAKE_SOURCE_DIR
}
/src/platform_osx/Clipboard.cpp
...
@@ -423,11 +423,11 @@ if (APPLE)
...
@@ -423,11 +423,11 @@ if (APPLE)
set
(
MACOSX_BUNDLE_BUNDLE_NAME
${
BZC_EXE_NAME
}
)
set
(
MACOSX_BUNDLE_BUNDLE_NAME
${
BZC_EXE_NAME
}
)
set
(
MACOSX_BUNDLE_GUI_IDENTIFIER
"
${
BZC_EXE_NAME
}
"
)
set
(
MACOSX_BUNDLE_GUI_IDENTIFIER
"
${
BZC_EXE_NAME
}
"
)
set
(
MACOSX_BUNDLE_ICON_FILE icon.icns
)
set
(
MACOSX_BUNDLE_ICON_FILE icon.icns
)
set
(
MACOSX_BUNDLE_INFO_STRING
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
,Copyright © 201
8
The Bonzomatic Contributors"
)
set
(
MACOSX_BUNDLE_INFO_STRING
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
,Copyright © 201
9
The Bonzomatic Contributors"
)
set
(
MACOSX_BUNDLE_SHORT_VERSION_STRING
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
)
set
(
MACOSX_BUNDLE_SHORT_VERSION_STRING
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
)
set
(
MACOSX_BUNDLE_LONG_VERSION_STRING
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
)
set
(
MACOSX_BUNDLE_LONG_VERSION_STRING
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
)
set
(
MACOSX_BUNDLE_BUNDLE_VERSION
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
)
set
(
MACOSX_BUNDLE_BUNDLE_VERSION
"
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
)
set
(
MACOSX_BUNDLE_COPYRIGHT
"Copyright © 2014-201
8
The Bonzomatic Contributors. All rights reserved."
)
set
(
MACOSX_BUNDLE_COPYRIGHT
"Copyright © 2014-201
9
The Bonzomatic Contributors. All rights reserved."
)
set_source_files_properties
(
${
BZC_RESOURCES_DATA
}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties
(
${
BZC_RESOURCES_DATA
}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
...
@@ -440,8 +440,9 @@ if (APPLE)
...
@@ -440,8 +440,9 @@ if (APPLE)
find_library
(
OPENGL_FRAMEWORK OpenGL
)
find_library
(
OPENGL_FRAMEWORK OpenGL
)
find_library
(
CARBON_FRAMEWORK Carbon
)
find_library
(
CARBON_FRAMEWORK Carbon
)
find_library
(
COREAUDIO_FRAMEWORK CoreAudio
)
find_library
(
COREAUDIO_FRAMEWORK CoreAudio
)
mark_as_advanced
(
COCOA_FRAMEWORK OPENGL_FRAMEWORK CARBON_FRAMEWORK COREAUDIO_FRAMEWORK
)
find_library
(
AVFOUNDATION_FRAMEWORK AVFoundation
)
set
(
PLATFORM_LIBS
${
COCOA_FRAMEWORK
}
${
OPENGL_FRAMEWORK
}
${
CARBON_FRAMEWORK
}
${
COREAUDIO_FRAMEWORK
}
)
mark_as_advanced
(
COCOA_FRAMEWORK OPENGL_FRAMEWORK CARBON_FRAMEWORK COREAUDIO_FRAMEWORK AVFOUNDATION_FRAMEWORK
)
set
(
PLATFORM_LIBS
${
COCOA_FRAMEWORK
}
${
OPENGL_FRAMEWORK
}
${
CARBON_FRAMEWORK
}
${
COREAUDIO_FRAMEWORK
}
${
AVFOUNDATION_FRAMEWORK
}
)
elseif
(
UNIX
)
elseif
(
UNIX
)
set
(
PLATFORM_LIBS GL
)
set
(
PLATFORM_LIBS GL
)
elseif
(
WIN32
)
elseif
(
WIN32
)
...
...
data/macosx/MacOSXBundleInfo.plist.in
View file @
f9efc7cc
...
@@ -40,5 +40,7 @@
...
@@ -40,5 +40,7 @@
<true/>
<true/>
<key>
LSMinimumSystemVersion
</key>
<key>
LSMinimumSystemVersion
</key>
<string>
10.6.4
</string>
<string>
10.6.4
</string>
<key>
NSMicrophoneUsageDescription
</key>
<string>
Bonzomatic requires microphone access for the FFT textures to work.
</string>
</dict>
</dict>
</plist>
</plist>
\ No newline at end of file
src/platform_osx/Misc.
cpp
→
src/platform_osx/Misc.
mm
View file @
f9efc7cc
...
@@ -7,7 +7,54 @@
...
@@ -7,7 +7,54 @@
#include <unistd.h>
#include <unistd.h>
#include <sys/param.h> // For MAXPATHLEN
#include <sys/param.h> // For MAXPATHLEN
#include "CoreFoundation/CoreFoundation.h"
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface
MiscCocoa
:
NSObject
@end
@implementation
MiscCocoa
+
(
void
)
requestMicrophoneAccess
{
switch
([
AVCaptureDevice
authorizationStatusForMediaType
:
AVMediaTypeAudio
])
{
case
AVAuthorizationStatusAuthorized
:
{
fprintf
(
stdout
,
"Microphone access already granted
\n
"
);
break
;
}
case
AVAuthorizationStatusNotDetermined
:
{
[
AVCaptureDevice
requestAccessForMediaType
:
AVMediaTypeAudio
completionHandler
:
^
(
BOOL
granted
)
{
if
(
granted
)
{
fprintf
(
stdout
,
"Microphone access granted
\n
"
);
}
else
{
fprintf
(
stderr
,
"Microphone access denied. No FFT support.
\n
"
);
}
}];
return
;
}
case
AVAuthorizationStatusDenied
:
{
fprintf
(
stderr
,
"Microphone access previously denied by user. Asking again.
\n
"
);
[
AVCaptureDevice
requestAccessForMediaType
:
AVMediaTypeAudio
completionHandler
:
^
(
BOOL
granted
)
{
if
(
granted
)
{
fprintf
(
stdout
,
"Microphone access granted
\n
"
);
}
else
{
fprintf
(
stderr
,
"Microphone access denied. No FFT support.
\n
"
);
}
}];
return
;
}
case
AVAuthorizationStatusRestricted
:
{
fprintf
(
stderr
,
"The user can't grant microphone access due to restrictions.
\n
"
);
}
}
}
@end
void
Misc
::
PlatformStartup
()
void
Misc
::
PlatformStartup
()
{
{
...
@@ -27,6 +74,11 @@ void Misc::PlatformStartup()
...
@@ -27,6 +74,11 @@ void Misc::PlatformStartup()
CFRelease
(
pathURL
);
CFRelease
(
pathURL
);
chdir
(
appPath
);
chdir
(
appPath
);
// Check if the user has granted microphone access to Bonzomatic. Else request it.
if
(
@available
(
macOS
10.14
,
*
))
{
[
MiscCocoa
requestMicrophoneAccess
];
}
}
}
void
Misc
::
PlatformShutdown
()
void
Misc
::
PlatformShutdown
()
...
...
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