@@ -330,22 +330,10 @@ std::unique_ptr<AudioResponseMessage> ServiceAudio::HandleStart(const Operation:
330
330
331
331
std::unique_ptr<AudioResponseMessage> ServiceAudio::HandleSendEvent (std::shared_ptr<Event> evt)
332
332
{
333
- auto input = audioMux.GetRoutingInput ();
334
- input = input ? input : audioMux.GetActiveInput ();
335
-
336
- if (!input) {
337
- return std::make_unique<AudioResponseMessage>(RetCode::OperationNotSet);
338
- }
339
-
340
- if (evt->getType () == EventType::HeadphonesPlugin) {
341
- headphonesInserted = true ;
342
- }
343
- else if (evt->getType () == EventType::HeadphonesUnplug) {
344
- headphonesInserted = false ;
333
+ for (auto &input : audioMux.GetAllInputs ()) {
334
+ input.audio ->SendEvent (evt);
345
335
}
346
-
347
- auto retVal = input.value ()->audio ->SendEvent (evt);
348
- return std::make_unique<AudioEventResponse>(retVal);
336
+ return std::make_unique<AudioEventResponse>(RetCode::Success);
349
337
}
350
338
351
339
std::unique_ptr<AudioResponseMessage> ServiceAudio::HandleStop (const std::vector<audio::PlaybackType> &stopTypes,
@@ -546,7 +534,9 @@ std::string ServiceAudio::getSetting(const Setting &setting,
546
534
targetPlayback = currentPlaybackType;
547
535
}
548
536
else if (setting == Setting::Volume) {
549
- targetProfile = headphonesInserted ? Profile::Type::PlaybackHeadphones : Profile::Type::PlaybackLoudspeaker;
537
+ auto input = audioMux.GetIdleInput ();
538
+ targetProfile = ((*input)->audio ->GetHeadphonesInserted ()) ? Profile::Type::PlaybackHeadphones
539
+ : Profile::Type::PlaybackLoudspeaker;
550
540
targetPlayback = PlaybackType::CallRingtone;
551
541
}
552
542
else {
@@ -581,8 +571,9 @@ void ServiceAudio::setSetting(const Setting &setting,
581
571
updatedPlayback = (*activeInput)->audio ->GetCurrentOperationPlaybackType ();
582
572
}
583
573
else if (setting == audio::Setting::Volume) {
584
- updatedProfile =
585
- headphonesInserted ? Profile::Type::PlaybackHeadphones : Profile::Type::PlaybackLoudspeaker;
574
+ auto input = audioMux.GetIdleInput ();
575
+ updatedProfile = (*input)->audio ->GetHeadphonesInserted () ? Profile::Type::PlaybackHeadphones
576
+ : Profile::Type::PlaybackLoudspeaker;
586
577
updatedPlayback = PlaybackType::CallRingtone;
587
578
valueToSet = std::clamp (utils::getValue<audio::Volume>(value), minVolume, maxVolume);
588
579
}
0 commit comments