android fm singleton sound and stereo switching sample code

  • 2020-05-10 18:47:30
  • OfStack

The current design supports automatic switching between monomer sound and stereo sound. Switching can only be carried out under 1 definite condition. The switching condition is related to the signal strength RSSI, signal stability CQI and so on.
Currently, there are two interfaces in the upper layer, stereoMono and setStereoMono.

Check whether the current station is playing in stereo or single sound.

Set the current station to stereo or mono.

One thing to note:
1. When set to monophonic sound, 1 will definitely switch to monophonic sound, and 1 will keep monophonic sound straight, which will not change with the change of the radio environment, unless the upper layer is set to stereo playback again.
2. When set to stereo, the station will automatically determine which station to switch to based on the current station environment, that is, it is environment-related.

For 6628, if you want to change its switching RSSI threshold (6620 cannot be changed) :
Calculation formula:
Stereo to mono switch threshold Adjustment:

Variable name: BlendCtrlRSSI_TH
Address: 0x314F in coefficient memory.
Maximum value of TH: 1024
TH minimum: 0
TH default: 356
Conversion formula: threshold = -((RSSI(dBm))*4*16/6 + 384)
The default value for RSSI is calculated to be -69.375dBm

Modify the code:
mt6628_fm_lib.c mt6628_SetFreq finally add the code
mt6628_write(0xE2, 0x314F);
mt6628_write(0xE3, TH); //TH setting -75dbm(TH = 0x01A0)
mt6628_write(0xE1, 0x0002);

Related articles: