- 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:
@@ -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)
|
||||
{
|
||||
// Check if file exists
|
||||
|
||||
@@ -53,6 +53,11 @@ public:
|
||||
void start(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
|
||||
{
|
||||
atNull,
|
||||
|
||||
Reference in New Issue
Block a user