le_audio_PlaySamples


#1

Hello Guys,

I was trying to use le_audio_PlaySamples(), but get that error.

Sep 5 18:16:29 | leuco_play[32147]/leuco_playComponent T=main | leuco_playComponent.c
PlaySamplesThread() 130 | Im here
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c DoConnectService() 398 | ======= Starting another client for ‘leuco_play.leuco_playComponent.le_audio’ service ========
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_SetSamplePcmChannelNumber() 4155 | Sending message to server and waiting for response : 8 bytes sent
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_SetSamplePcmSamplingRate() 4286 | Sending message to server and waiting for response : 8 bytes sent
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_SetSamplePcmSamplingResolution() 4417 | Sending message to server and waiting for response : 8 bytes sent
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_GetSamplePcmChannelNumber() 4220 | Sending message to server and waiting for response : 4 bytes sent
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_GetSamplePcmSamplingRate() 4351 | Sending message to server and waiting for response : 4 bytes sent
Sep 5 18:16:29 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_GetSamplePcmSamplingResolution() 4482 | Sending message to server and waiting for response : 4 bytes sent
Sep 5 18:16:29 | leuco_play[32147]/leuco_playComponent T=main | leuco_playComponent.c PlaySamplesThread() 154 | Are you ok?
Sep 5 18:16:30 | leuco_play[32147]/framework T=main | le_audio_client.c le_audio_PlaySamples() 3695 | Sending message to server and waiting for response : 4 bytes sent
Sep 5 18:16:30 | leuco_play[32147]/framework T=main | LE_FILENAME unixSocket_SendMsg() 430 | Sending fd 8.
Sep 5 18:16:30 | audioDaemon[462]/audio T=main | le_media.c le_media_PlaySamples() 1764 | Invalid interface
Sep 5 18:16:30 | leuco_play[32147]/leuco_playComponent T=main | leuco_playComponent.c PlaySamplesThread() 156 | Assert Failed: 'le_audio_PlaySamples(PCMOutRef, my_pipe[0]) == LE_OK’
Sep 5 18:16:30 | supervisor[407]/supervisor T=main | proc.c proc_SigChildHandler() 1942 | Process ‘leuco_play’ (PID: 32147) has exited with exit code 1.
Sep 5 18:16:30 | supervisor[407]/supervisor T=main | proc.c GetFaultAction() 1744 | No fault action specified for process ‘leuco_play’. Assuming ‘ignore’.
Sep 5 18:16:30 | supervisor[407]/supervisor T=main | app.c app_SigChildHandler() 3221 | Process ‘leuco_play’ in app ‘leuco_play’ faulted: Ignored.
Sep 5 18:16:30 | _appStopClient[32167]/framework T=main | LE_FILENAME CreateSocket() 550 | Socket opened as standard i/o file descriptor 2!
Sep 5 18:16:30 | supervisor[407]/supervisor T=main | apps.c DeactivateAppContainer() 340 | Application ‘leuco_play’ has stopped.
}

My code is:

 static void* PlaySamplesThread(void* contextPtr){
   
 int my_pipe[2];
 int pos=0;
 uint32_t ChannelsCount;
 uint32_t SampleRate;
 uint32_t BitsPerSample;

 LE_INFO("%s",__FUNCTION__);
 ChannelsCount=0;
 SampleRate=8000;
 BitsPerSample=8;

 LE_ERROR("Im here");

 le_audio_ConnectService();
 my_pipe[0]=-1;
 my_pipe[1]=-1;

     if (pipe(my_pipe) == -1)
     {
         LE_ERROR("Failed to create the pipe");
         return NULL;
     }


     LE_ASSERT(le_audio_SetSamplePcmChannelNumber(PCMOutRef, ChannelsCount) == LE_OK);
     LE_ASSERT(le_audio_SetSamplePcmSamplingRate(PCMOutRef, SampleRate) == LE_OK);
     LE_ASSERT(le_audio_SetSamplePcmSamplingResolution(PCMOutRef, BitsPerSample) == LE_OK);

     LE_ASSERT(le_audio_GetSamplePcmChannelNumber(PCMOutRef, &ChannelsCount) == LE_OK);
     LE_ASSERT(ChannelsCount == ChannelsCount);
     LE_ASSERT(le_audio_GetSamplePcmSamplingRate(PCMOutRef, &SampleRate) == LE_OK);
     LE_ASSERT(SampleRate == SampleRate);
     LE_ASSERT(le_audio_GetSamplePcmSamplingResolution(PCMOutRef, &BitsPerSample) == LE_OK);
     LE_ASSERT(BitsPerSample == BitsPerSample);

     LE_INFO("Are you ok?");
     sleep(1);
     LE_ASSERT(le_audio_PlaySamples(PCMOutRef, my_pipe[0]) == LE_OK); //Error is here
     LE_INFO("Start playing samples..."); 


 while (1)
 {
     int32_t wroteLen = write( my_pipe[1], &SENO_425[pos], sizeof(SENO_425[pos]));

     if (wroteLen <= 0)
     {
         LE_ERROR("write error %d", wroteLen);
         return NULL;
     }
     if (pos>=SENO_425_LEN){
    	 pos=0;
     }else{
    	 pos++;
     }
     LE_INFO("%s - Loop\n",__FUNCTION__);
 }

 return NULL;
}

Can someone help me?


#2

Hiya,

A couple things to check:

  1. Are you using the same version of your development environment as is installed on your device? It’s really important that the development framework matches the target framework.
    Check on your target by using the command legato version and look into your dev environment.
  2. On your target, make sure the service audioService is running (use app status and check that the status is [running]

And an observation … having a while(1) loop in your legato code is BAD!. You are better off using a timer or some other method to unroll the while(1) loop.

ciao, Dave


#3

Hi @davidc
Can you see my other post

Regards