Add Audio gain set.

Change-Id: Id42678038875e9b0c1f89efbb609d7046e5527fb
diff --git a/mbtk/mbtk_lib/src/mbtk_audio_alsa.c b/mbtk/mbtk_lib/src/mbtk_audio_alsa.c
index 3e54453..45ce873 100755
--- a/mbtk/mbtk_lib/src/mbtk_audio_alsa.c
+++ b/mbtk/mbtk_lib/src/mbtk_audio_alsa.c
@@ -81,6 +81,8 @@
 
 static struct mopen_audio_t *internal_hdl = NULL;
 
+static int dsp_rx_gain = 0xFF;
+static int dsp_tx_gain = 0xFF;
 
 int mbtk_wav_pcm16Le_check(int fd)
 {
@@ -257,6 +259,14 @@
             printf("%s: error reading!\n", __FUNCTION__);
             break;
         }
+
+        if(dsp_tx_gain == 0xFF) {
+            if(!mbtk_dsp_gain_get(&dsp_rx_gain, &dsp_tx_gain)) {
+                vcm_config_dspgain(CONFIG_DSPGAIN_TX, dsp_tx_gain);
+                dsp_rx_gain = 0xFF;
+            }
+        }
+
         if ((bufsize > 0) && (NULL != _usrData->_cb))
         {
             _usrData->_cb(2, data, bufsize);
@@ -586,7 +596,7 @@
 //    {
 //        bufsize = len;
 //    }
-    
+
     while (pcxt->state != AUDIO_STOP)
     {
 
@@ -595,7 +605,7 @@
 
         if(read_size > len)
         {
-         //    printf(">[%d]\n", read_size); 
+         //    printf(">[%d]\n", read_size);
             break;
         }
 
@@ -621,12 +631,12 @@
 
         if(read_size == len)
         {
-         //    printf("=[%d]", read_size); 
+         //    printf("=[%d]", read_size);
             break;
         }
 
     }
-    
+
     if(pcxt->state != AUDIO_STOP)
     {
         mbtk_audio_set_status(dev_hdl, AUDIO_OPEN);
@@ -669,14 +679,14 @@
 
     mbtk_audio_set_status(dev_hdl, AUDIO_RUNNING);
     int all_size = 0;
-    
+
     while (pcxt->state != AUDIO_STOP)
     {
         res = read(file_fd, data, bufsize);
       //   printf("%s:read : %d bytes\n", __FUNCTION__, res);
         if(res == 0 || res < 0)
         {
-             printf("read:[%d]", res); 
+             printf("read:[%d]", res);
             break;
         }
 
@@ -709,6 +719,13 @@
             audio_play_cb(pcxt, AUD_PLAYER_LESSDATA);
             break;
         }
+
+        if(dsp_rx_gain == 0xFF) {
+            if(!mbtk_dsp_gain_get(&dsp_rx_gain, &dsp_tx_gain)) {
+                vcm_config_dspgain(CONFIG_DSPGAIN_RX, dsp_rx_gain);
+                dsp_tx_gain = 0xFF;
+            }
+        }
     }
     if (audio_play_cb)
         audio_play_cb(pcxt, AUD_PLAYER_FINISHED);