refactor: fix comments
Applying code guidelines. No side effects.
This commit is contained in:
parent
19a86d55a5
commit
43d89f0258
|
@ -46,14 +46,10 @@ extern double desa2(circ_buffer_t *b, size_t i)
|
||||||
result = 0.5 * acos(n/d);
|
result = 0.5 * acos(n/d);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ISNAN(result)){
|
if (ISNAN(result)) result = 0.0;
|
||||||
result = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -65,14 +65,12 @@ extern void compute_table(void)
|
||||||
|
|
||||||
acos_table_file = fopen(ACOS_TABLE_FILENAME, "w");
|
acos_table_file = fopen(ACOS_TABLE_FILENAME, "w");
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < (1 << 25); i++) {
|
for (i = 0; i < (1 << 25); i++) {
|
||||||
f = acosf(float_from_index(i));
|
f = acosf(float_from_index(i));
|
||||||
ret = fwrite(&f, sizeof(f), 1, acos_table_file);
|
ret = fwrite(&f, sizeof(f), 1, acos_table_file);
|
||||||
assert(ret != 0);
|
assert(ret != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ret = fclose(acos_table_file);
|
ret = fclose(acos_table_file);
|
||||||
assert(ret != EOF);
|
assert(ret != EOF);
|
||||||
}
|
}
|
||||||
|
@ -136,5 +134,3 @@ static float float_from_index(uint32_t d)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -128,10 +128,10 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw
|
||||||
static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_session_t *fs_session);
|
static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_session_t *fs_session);
|
||||||
|
|
||||||
|
|
||||||
/*! \brief The avmd session data initialization function
|
/*! \brief The avmd session data initialization function.
|
||||||
* @author Eric des Courtis
|
* @author Eric des Courtis
|
||||||
* @param avmd_session A reference to a avmd session
|
* @param avmd_session A reference to a avmd session.
|
||||||
* @param fs_session A reference to a FreeSWITCH session
|
* @param fs_session A reference to a FreeSWITCH session.
|
||||||
*/
|
*/
|
||||||
static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_session_t *fs_session)
|
static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_session_t *fs_session)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_se
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief The callback function that is called when new audio data becomes available
|
/*! \brief The callback function that is called when new audio data becomes available.
|
||||||
*
|
*
|
||||||
* @author Eric des Courtis
|
* @author Eric des Courtis
|
||||||
* @param bug A reference to the media bug.
|
* @param bug A reference to the media bug.
|
||||||
|
@ -203,7 +203,7 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw
|
||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief FreeSWITCH module loading function
|
/*! \brief FreeSWITCH module loading function.
|
||||||
*
|
*
|
||||||
* @author Eric des Courtis
|
* @author Eric des Courtis
|
||||||
* @return Load success or failure.
|
* @return Load success or failure.
|
||||||
|
@ -255,7 +255,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief FreeSWITCH application handler function.
|
/*! \brief FreeSWITCH application handler function.
|
||||||
* This handles calls made from applications such as LUA and the dialplan
|
* This handles calls made from applications such as LUA and the dialplan.
|
||||||
*
|
*
|
||||||
* @author Eric des Courtis
|
* @author Eric des Courtis
|
||||||
* @return Success or failure of the function.
|
* @return Success or failure of the function.
|
||||||
|
@ -321,7 +321,7 @@ SWITCH_STANDARD_APP(avmd_start_function)
|
||||||
switch_channel_set_private(channel, "_avmd_", bug);
|
switch_channel_set_private(channel, "_avmd_", bug);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Called when the module shuts down
|
/*! \brief Called when the module shuts down.
|
||||||
*
|
*
|
||||||
* @author Eric des Courtis
|
* @author Eric des Courtis
|
||||||
* @return The success or failure of the function.
|
* @return The success or failure of the function.
|
||||||
|
@ -476,10 +476,10 @@ end:
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Process one frame of data with avmd algorithm
|
/*! \brief Process one frame of data with avmd algorithm.
|
||||||
* @author Eric des Courtis
|
* @author Eric des Courtis
|
||||||
* @param session An avmd session
|
* @param session An avmd session.
|
||||||
* @param frame A audio frame
|
* @param frame An audio frame.
|
||||||
*/
|
*/
|
||||||
static void avmd_process(avmd_session_t *session, switch_frame_t *frame)
|
static void avmd_process(avmd_session_t *session, switch_frame_t *frame)
|
||||||
{
|
{
|
||||||
|
@ -506,9 +506,7 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame)
|
||||||
b = &session->b;
|
b = &session->b;
|
||||||
|
|
||||||
/*! If beep has already been detected skip the CPU heavy stuff */
|
/*! If beep has already been detected skip the CPU heavy stuff */
|
||||||
if(session->state.beep_state == BEEP_DETECTED){
|
if (session->state.beep_state == BEEP_DETECTED) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Precompute values used heavily in the inner loop */
|
/*! Precompute values used heavily in the inner loop */
|
||||||
sine_len_i = SINE_LEN(session->rate);
|
sine_len_i = SINE_LEN(session->rate);
|
||||||
|
@ -550,17 +548,13 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame)
|
||||||
|
|
||||||
/*! Throw an event to FreeSWITCH */
|
/*! Throw an event to FreeSWITCH */
|
||||||
status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, AVMD_EVENT_BEEP);
|
status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, AVMD_EVENT_BEEP);
|
||||||
if(status != SWITCH_STATUS_SUCCESS) {
|
if (status != SWITCH_STATUS_SUCCESS) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "stop");
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "stop");
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session->session));
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session->session));
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "avmd");
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "avmd");
|
||||||
|
|
||||||
if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) {
|
if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_session_queue_event(session->session, &event);
|
switch_core_session_queue_event(session->session, &event);
|
||||||
switch_event_fire(&event_copy);
|
switch_event_fire(&event_copy);
|
||||||
|
|
Loading…
Reference in New Issue