2 of 2 people found this helpful
Android Audio framework will apply volume changes on data[Audio samples] itself. Mod is receiving tfa9890_aud_dev_set_sys_volume such commands, only if you have any specific settings for your codec you can apply them. Applying volume settings in your mod i2s driver is not mandatory since, android will take of that.
Though i am not sure, This is what my understanding.
G Lucky, based on the current behaviour, your answer makes sense. Thanks.
I had checked the I2S specs, but I had not found references for volume. I am going to check it again.
I still do not understand why the audio profiles (use cases) reported by Moto Mod to Moto Z are not being respected by Moto Z. By adding logs, I confirmed that the use case for Notification is still being played by Moto Mod, even after it was removed for the supported playback use cases. I am still checking.
1 of 1 people found this helpful
From talking with our experts, Android handles volume settings internally and the audio stream to the Mod is a single stream post mixing. The current "dominant" volume setting (derived from all the active streams) is passed to the Mod. The Mod may adjust their gain or other non-linear processing based on this value, but the stream itself will have adjustments for volume already applied.
As far as audio profiles go, those are not currently used by the Moto Z. However, the Moto Z will report that profile of the current stream, which would allow you to take actions (like reducing volume or muting output). In general, audio will be dual routed to the Moto Z and the Moto Mod under the following conditions:
Moto Mod is a headset, headphones, or line-out.
Ringtone is playing
Notifications ONLY playing (not mixed with Music)
These are the only cases that will use both the Moto Z speaker and Moto Mod speaker simultaneously. Since you're notified of the Mode, you can choose to take action (mute/lower your volume).
Thanks very much for the detailed information.
It is clearer for me now.
I am trying to execute some tests using the speaker sample code and the Audio Personality Card. After following the instructions in Motorola Developer site, the Speaker is working as expected.
However, I was trying to do some changes in the firmware and check the behaviour. To guarantee that my changes were built and MuC is calling them, I added several logs in the stm32_audio_tfa9890.c and in tfa9890.c files.
1) I had noticed that tfa9890_aud_dev_set_sys_volume is called when an audio is being played and I change the Android Audio Volume. As the Mod volume is changed according to Android volume, I understood that this is the function that configures its volume. To confirm that, I had executed the following changes:
a) Firstly, I had hardcoded the sys_volume to -1200 (one of the values returned by Android);
b) Secondly, I had removed the whole code in the function;
Tested... For my surprise, after each of the changes, the Mod Speaker continues playing the audio according to the Android Audio Volume. How?
2) I don't want to have all the use cases being played by the Mod. I would like to play only music by it. By checking the code I found the tfa9890_aud_dev_get_supported_use_cases function in the stm32_audio_tfa9890.c. I thought that this function is called by the Moto Z in order to allow Moto Z to route the audio correcty. I had changed the TFA9890_SUPPORTED_PLAYBACK_USE_CASES to set just the DEV_AUDIO_PLAYBACK_MUSIC_USE_CASE.
Tested... No lucky! The ringtones continue being played by the Moto Mod Speaker
I am not familiar with the I2S. Am I missing something? How the Mod is aware about the volume set in the Moto Z? Why the ringtones continue being played by the Moto Mod even if the Ringtone cases was removed from the supported use cases?