mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	macos: request permission for microphone usage
This commit is contained in:
		
							parent
							
								
									d5a4988f9e
								
							
						
					
					
						commit
						7bbc94d428
					
				
					 3 changed files with 19 additions and 5 deletions
				
			
		|  | @ -15,6 +15,10 @@ | ||||||
| #include "core/settings.h" | #include "core/settings.h" | ||||||
| #include "ui_configure_audio.h" | #include "ui_configure_audio.h" | ||||||
| 
 | 
 | ||||||
|  | #if defined(__APPLE__) | ||||||
|  | #include "citra_qt/usage_authorization.h" | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| constexpr int DEFAULT_INPUT_DEVICE_INDEX = 0; | constexpr int DEFAULT_INPUT_DEVICE_INDEX = 0; | ||||||
| 
 | 
 | ||||||
| ConfigureAudio::ConfigureAudio(QWidget* parent) | ConfigureAudio::ConfigureAudio(QWidget* parent) | ||||||
|  | @ -148,6 +152,11 @@ void ConfigureAudio::UpdateAudioOutputDevices(int sink_index) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfigureAudio::UpdateAudioInputDevices(int index) { | void ConfigureAudio::UpdateAudioInputDevices(int index) { | ||||||
|  | #if defined(__APPLE__) | ||||||
|  |     if (index == 1) { | ||||||
|  |         AppleAuthorization::CheckAuthorizationForMicrophone(); | ||||||
|  |     } | ||||||
|  | #endif | ||||||
|     if (Settings::values.mic_input_device != Frontend::Mic::default_device_name) { |     if (Settings::values.mic_input_device != Frontend::Mic::default_device_name) { | ||||||
|         ui->input_device_combo_box->setCurrentText( |         ui->input_device_combo_box->setCurrentText( | ||||||
|             QString::fromStdString(Settings::values.mic_input_device)); |             QString::fromStdString(Settings::values.mic_input_device)); | ||||||
|  |  | ||||||
|  | @ -7,6 +7,6 @@ | ||||||
| namespace AppleAuthorization { | namespace AppleAuthorization { | ||||||
| 
 | 
 | ||||||
| bool CheckAuthorizationForCamera(); | bool CheckAuthorizationForCamera(); | ||||||
| bool CheckAuthorizationForAudio(); | bool CheckAuthorizationForMicrophone(); | ||||||
| 
 | 
 | ||||||
| } // namespace AppleAuthorization
 | } // namespace AppleAuthorization
 | ||||||
|  |  | ||||||
|  | @ -38,6 +38,8 @@ void CheckAuthorization(AuthMediaType type) { | ||||||
|                                      }]; |                                      }]; | ||||||
|             if (type == AuthMediaType::Camera) { |             if (type == AuthMediaType::Camera) { | ||||||
|                 LOG_INFO(Frontend, "Camera access requested."); |                 LOG_INFO(Frontend, "Camera access requested."); | ||||||
|  |             } else { // AuthMediaType::Microphone | ||||||
|  |                 LOG_INFO(Frontend, "Microphone access requested."); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  | @ -45,10 +47,13 @@ void CheckAuthorization(AuthMediaType type) { | ||||||
|             // The user has previously denied access. |             // The user has previously denied access. | ||||||
|             authorized = false; |             authorized = false; | ||||||
|             if (type == AuthMediaType::Camera) { |             if (type == AuthMediaType::Camera) { | ||||||
|                 LOG_WARNING( |                 LOG_WARNING(Frontend, "Camera access denied. To change this you may modify the " | ||||||
|                     Frontend, |                                       "macOS system permission settings " | ||||||
|                     "Camera access denied. To change this you may modify the macos system settings " |                                       "for Citra at 'System Preferences -> Security & Privacy'"); | ||||||
|                     "for Citra at 'System Preferences -> Security & Privacy -> Camera'"); |             } else { // AuthMediaType::Microphone | ||||||
|  |                 LOG_WARNING(Frontend, "Microphone access denied. To change this you may modify the " | ||||||
|  |                                       "macOS system permission settings " | ||||||
|  |                                       "for Citra at 'System Preferences -> Security & Privacy'"); | ||||||
|             } |             } | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue