FreeCalypso > hg > fc-magnetite
diff src/aci2/aci/ati_audio.c @ 240:9034c3a7267e
Voice memo recording and playback test AT commands implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 22 Mar 2017 07:07:15 +0000 |
parents | e0b9c21d7908 |
children | bec9198fc306 |
line wrap: on
line diff
--- a/src/aci2/aci/ati_audio.c Wed Mar 22 04:51:29 2017 +0000 +++ b/src/aci2/aci/ati_audio.c Wed Mar 22 07:07:15 2017 +0000 @@ -187,4 +187,87 @@ return (ATI_FAIL); } +/* AT@VMP - play back a voice memo recording */ +GLOBAL T_ATI_RSLT atAtVMP ( char *cl, UBYTE srcId ) +{ + T_AUDIO_VM_PLAY_PARAMETER play_param; + T_RV_RETURN return_path; + + play_param.memo_name[0] = 0; + cl = parse(cl, "s", (LONG)(sizeof(play_param.memo_name) - 1), + play_param.memo_name); + if (!play_param.memo_name[0]) + return (ATI_FAIL); + + return_path.addr_id = NULL; + return_path.callback_func = audio_callback; + if (audio_vm_play_start(&play_param, return_path) == AUDIO_OK) + return (ATI_CMPL); + else + return (ATI_FAIL); +} + +/* AT@VMPS - stop VM play started with AT@VMP */ +GLOBAL T_ATI_RSLT atAtVMPS ( char *cl, UBYTE srcId ) +{ + T_RV_RETURN return_path; + + return_path.addr_id = NULL; + return_path.callback_func = audio_callback; + if (audio_vm_play_stop(return_path) == AUDIO_OK) + return (ATI_CMPL); + else + return (ATI_FAIL); +} + +static const T_AUDIO_TONES_PARAMETER recorder_warning_tone = { + 0, 500, 1400, -5, + 0, 500, 0, 0, + 0, 500, 0, 0, + 500, 500, 15000, TONE_INFINITE +}; + +/* AT@VMR - record a voice memo */ +GLOBAL T_ATI_RSLT atAtVMR ( char *cl, UBYTE srcId ) +{ + T_AUDIO_VM_RECORD_PARAMETER record_param; + int duration = 0, compression = 0; + LONG mic_gain = 0x100, network_gain = 0x100; + T_RV_RETURN return_path; + + record_param.memo_name[0] = 0; + cl = parse(cl, "sddyy", (LONG)(sizeof(record_param.memo_name) - 1), + record_param.memo_name, &duration, &compression, + &mic_gain, &network_gain); + if (!record_param.memo_name[0] || !duration) + return (ATI_FAIL); + record_param.memo_duration = duration; + record_param.compression_mode = compression; + record_param.microphone_gain = mic_gain; + record_param.network_gain = network_gain; + + return_path.addr_id = NULL; + return_path.callback_func = audio_callback; + if (audio_vm_record_start(&record_param, + (T_AUDIO_TONES_PARAMETER *) + &recorder_warning_tone, + return_path) == AUDIO_OK) + return (ATI_CMPL); + else + return (ATI_FAIL); +} + +/* AT@VMRS - stop VM recording started with AT@VMR */ +GLOBAL T_ATI_RSLT atAtVMRS ( char *cl, UBYTE srcId ) +{ + T_RV_RETURN return_path; + + return_path.addr_id = NULL; + return_path.callback_func = audio_callback; + if (audio_vm_record_stop(return_path) == AUDIO_OK) + return (ATI_CMPL); + else + return (ATI_FAIL); +} + #endif /* ATI_AUDIO_C */