- expose AudioManager::setAudioInput() to inject custom input device

Lets a host inject e.g. NullInputDevice before start() so the default
platform microphone is not constructed, avoiding the RECORD_AUDIO
permission on Android while leaving the real speaker output in place.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 07:20:47 +03:00
parent fd4f664164
commit 7cb3b4334f
2 changed files with 11 additions and 0 deletions
+6
View File
@@ -167,6 +167,12 @@ void AudioManager::stop(int usageId)
} }
} }
void AudioManager::setAudioInput(Audio::PInputDevice input)
{
LOCK_MANAGER;
mAudioInput = std::move(input);
}
void AudioManager::startPlayFile(int usageId, const std::string& path, AudioTarget target, LoopMode lm, int timelimit) void AudioManager::startPlayFile(int usageId, const std::string& path, AudioTarget target, LoopMode lm, int timelimit)
{ {
// Check if file exists // Check if file exists
+5
View File
@@ -53,6 +53,11 @@ public:
void start(int usageId); void start(int usageId);
void stop(int usageId); void stop(int usageId);
// Inject a custom input device. Must be called before start(): when set,
// start() skips construction of the default platform microphone. Pass an
// empty pointer to clear the override.
void setAudioInput(Audio::PInputDevice input);
enum AudioTarget enum AudioTarget
{ {
atNull, atNull,