With CarPlay communication plugin R18.1, I followed these steps to integrate Enhance siri, the music sound was output from carplay and there is no option for output to Car.
============================================
Enhanced Siri
Declare supported audioFormats for the AuxIn and AuxOut streams
Since the AuxIn and AuxOut streams for Siri do not have to be both active at the same time, the accessory must claim audio formats support
for AuxIn Audio and AuxOut audio independently. The audio formats for each stream can differ from each other (48KHz for AuxOut and 16KHz
for AuxIn). The new audio types represent these new streams - AuxIn/speechRecognition & AuxOut/speechRecognition.
Check if connected device supports the feature
AirPlayReceiverSessionHasFeatureEnhancedSiri()
Claim support in the Setup Response message if device supports the feature
Add kAirPlayKeyAccessoryEnabledFeature_EnhancedSiri key through the AirPlayReceiverServer delegate AirPlayReceiverServerCopyProperty_f
function for the kAirPlayKey_AccessoryEnabledFeatures key.
Helper function: CFArrayAppendValue()
Add Enhanced Siri parameters dictionary in the INFO message
Add dictionary through the AirPlayReceiverServer delegate AirPlayReceiverServerCopyProperty_f
function for the kAirPlayKey_EnhancedSiriInfo key.
kAirPlayKey_EnhancedSiriInfo dictionary parameters:
Voice activation of Siri - kAirPlayKey_EnhancedSiriVoice
Current language of voice model - kAirPlayKey_VoiceModelCurrentLanguage
Supported languages of voice model - kAirPlayKey_VoiceModelSupportedLanguages
Enhanced Button activation of Siri - kAirPlayKey_EnhancedSiriButton
Supported zone(s) if any - kAirPlayKey_SupportedSiriTriggerZones
Update AudioStream
Get state of the AuxIn state by providing an implementation of AudioStreamUpdateState() - Off, local buffering, or streaming to device.
Decouple input streams from output streams. AuxIn is an independent input stream only. The property kAudioStreamProperty_Direction will
provide the necessary information if the stream is input, output or input & output.
Provide a handler for the AirPlayReceiverSessionDelegate setEnhancedSiriParams_f
This will provide additional information:
Activation type
Setting the language of the voice model
Invoke the Communication Plugin to start buffering
Once the activation type has been specified, the accessory can request the plugin to start buffering using
AirPlayReceiverSessionAuxInStart().
Use the new APIs to trigger Siri:
AirPlayReceiverSessionRequestSiriActionWithLatency()
AirPlayReceiverSessionRequestSiriVoiceActivationWithLatency()
AirPlayReceiverSessionRequestSiriVoiceActivationWithSample()
Button presses and voice activations should use this new APIs which adds a timestamp of the activation. These APIs allow
a choice of a latency or a sample for button and voice activations.
If there is a delay between the user pressing the button to notifying the device on the button press, this latency value
should represent this time.
If the accessory can determine which zone activated, it can provide the zone with the request.
Invoke the Communication Plugin to stop buffering
You may need to invoke the plugin to stop buffering (AirPlayReceiverSessionAuxInStop()) if exclusive access to the microphone is necessary.
Such instances may include but not limited to:
Native voice recognition session
Telephony
Another stream function which uses the microphone starts
modesChanged notification can be used to determine if a resource is being used
Note, if the session ends, the plugin will automatically stop buffering