FreeCalypso > hg > fc-magnetite
diff src/g23m-aci/aci/ati_audio.c @ 563:d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 06 Jan 2019 23:37:13 +0000 |
parents | 8473cabf491d |
children | ade27cd84b97 |
line wrap: on
line diff
--- a/src/g23m-aci/aci/ati_audio.c Sun Jan 06 22:33:33 2019 +0000 +++ b/src/g23m-aci/aci/ati_audio.c Sun Jan 06 23:37:13 2019 +0000 @@ -214,6 +214,8 @@ } #endif +static char melody_E1_name[AUDIO_PATH_NAME_MAX_SIZE]; + /* AT@E1 - play an E1 format melody */ GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId ) { @@ -229,12 +231,33 @@ return_path.addr_id = NULL; return_path.callback_func = audio_callback; - if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK) + if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK) { + strcpy(melody_E1_name, e1_param.melody_name); + return (ATI_CMPL); + } else + return (ATI_FAIL); +} + +/* AT@E1STOP - stop melody started with AT@E1 */ +GLOBAL T_ATI_RSLT atAtE1STOP ( char *cl, UBYTE srcId ) +{ + T_AUDIO_MELODY_E1_STOP_PARAMETER e1stop_param; + T_RV_RETURN return_path; + + if (!melody_E1_name[0]) + return (ATI_FAIL); + strcpy(e1stop_param.melody_name, melody_E1_name); + + return_path.addr_id = NULL; + return_path.callback_func = audio_callback; + if (audio_melody_E1_stop(&e1stop_param, return_path) == AUDIO_OK) return (ATI_CMPL); else return (ATI_FAIL); } +static char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE]; + /* AT@E2 - play an E2 format melody */ GLOBAL T_ATI_RSLT atAtE2 ( char *cl, UBYTE srcId ) { @@ -250,9 +273,10 @@ return_path.addr_id = NULL; return_path.callback_func = audio_callback; - if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK) + if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK) { + strcpy(melody_E2_name, e2_param.melody_E2_name); return (ATI_CMPL); - else + } else return (ATI_FAIL); } @@ -272,6 +296,24 @@ return (ATI_FAIL); } +/* AT@E2STOP - stop melody started with AT@E2 */ +GLOBAL T_ATI_RSLT atAtE2STOP ( char *cl, UBYTE srcId ) +{ + T_AUDIO_MELODY_E2_STOP_PARAMETER e2stop_param; + T_RV_RETURN return_path; + + if (!melody_E2_name[0]) + return (ATI_FAIL); + strcpy(e2stop_param.melody_E2_name, melody_E2_name); + + return_path.addr_id = NULL; + return_path.callback_func = audio_callback; + if (audio_melody_E2_stop(&e2stop_param, return_path) == AUDIO_OK) + return (ATI_CMPL); + else + return (ATI_FAIL); +} + /* AT@TONE - exercise TONES through RiViera Audio Service API */ GLOBAL T_ATI_RSLT atAtTONE ( char *cl, UBYTE srcId ) {