mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-02 06:38:04 +00:00
gsmopen: finished cleaning from alsa
This commit is contained in:
parent
40a1fd8ef0
commit
4c7b7c4643
@ -67,9 +67,6 @@
|
|||||||
#endif //GIOVA48
|
#endif //GIOVA48
|
||||||
#define SAMPLERATE_GSMOPEN 8000
|
#define SAMPLERATE_GSMOPEN 8000
|
||||||
|
|
||||||
#ifndef NO_ALSA
|
|
||||||
#define GSMOPEN_ALSA
|
|
||||||
#endif // NO_ALSA
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <switch_version.h>
|
#include <switch_version.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@ -79,11 +76,6 @@
|
|||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
//#include <libteletone.h>
|
//#include <libteletone.h>
|
||||||
|
|
||||||
#ifdef GSMOPEN_ALSA
|
|
||||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
|
||||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
|
||||||
#include <alsa/asoundlib.h>
|
|
||||||
#endif /* GSMOPEN_ALSA */
|
|
||||||
|
|
||||||
//#include "celliax_spandsp.h"
|
//#include "celliax_spandsp.h"
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@ -450,19 +442,6 @@ struct private_object {
|
|||||||
|
|
||||||
struct timeval ringtime;
|
struct timeval ringtime;
|
||||||
ciapa_t *owner;
|
ciapa_t *owner;
|
||||||
#ifdef GSMOPEN_ALSA
|
|
||||||
snd_pcm_t *alsac; /*!< \brief handle of the ALSA capture audio device */
|
|
||||||
snd_pcm_t *alsap; /*!< \brief handle of the ALSA playback audio device */
|
|
||||||
char alsacname[50]; /*!< \brief name of the ALSA capture audio device */
|
|
||||||
char alsapname[50]; /*!< \brief name of the ALSA playback audio device */
|
|
||||||
int alsa_period_size; /*!< \brief ALSA period_size, in byte */
|
|
||||||
int alsa_periods_in_buffer; /*!< \brief how many periods in ALSA buffer, to calculate buffer_size */
|
|
||||||
unsigned long int alsa_buffer_size; /*!< \brief ALSA buffer_size, in byte */
|
|
||||||
int alsawrite_filled;
|
|
||||||
int alsa_capture_is_mono;
|
|
||||||
int alsa_play_is_mono;
|
|
||||||
struct pollfd pfd;
|
|
||||||
#endif // GSMOPEN_ALSA
|
|
||||||
|
|
||||||
time_t audio_play_reset_timestamp;
|
time_t audio_play_reset_timestamp;
|
||||||
int audio_play_reset_period;
|
int audio_play_reset_period;
|
||||||
@ -608,14 +587,6 @@ int gsmopen_serial_call(private_t *tech_pvt, char *dstr);
|
|||||||
int gsmopen_serial_call_AT(private_t *tech_pvt, char *dstr);
|
int gsmopen_serial_call_AT(private_t *tech_pvt, char *dstr);
|
||||||
int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text);
|
int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text);
|
||||||
|
|
||||||
#ifdef GSMOPEN_ALSA
|
|
||||||
int alsa_init(private_t *tech_pvt);
|
|
||||||
int alsa_shutdown(private_t *tech_pvt);
|
|
||||||
snd_pcm_t *alsa_open_dev(private_t *tech_pvt, snd_pcm_stream_t stream);
|
|
||||||
int alsa_write(private_t *tech_pvt, short *data, int datalen);
|
|
||||||
int alsa_read(private_t *tech_pvt, short *data, int datalen);
|
|
||||||
|
|
||||||
#endif /* GSMOPEN_ALSA */
|
|
||||||
|
|
||||||
void gsmopen_store_boost(char *s, double *boost);
|
void gsmopen_store_boost(char *s, double *boost);
|
||||||
int gsmopen_sound_boost(void *data, int samples_num, double boost);
|
int gsmopen_sound_boost(void *data, int samples_num, double boost);
|
||||||
|
@ -878,7 +878,6 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
|||||||
//sent = frame->datalen;
|
//sent = frame->datalen;
|
||||||
|
|
||||||
//ERRORA("PLAY \n", GSMOPEN_P_LOG);
|
//ERRORA("PLAY \n", GSMOPEN_P_LOG);
|
||||||
//snd_pcm_writei(tech_pvt->alsap, (short *) frame->data, (int) (frame->datalen / 2));
|
|
||||||
|
|
||||||
gsmopen_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
|
gsmopen_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
|
||||||
sent = tech_pvt->serialPort_serial_audio->Write((char *) frame->data, (int) (frame->datalen));
|
sent = tech_pvt->serialPort_serial_audio->Write((char *) frame->data, (int) (frame->datalen));
|
||||||
@ -1243,18 +1242,12 @@ static switch_status_t load_config(int reload_type)
|
|||||||
const char *at_indicator_callsetupoutgoing_string = "CIEV: 6;2";
|
const char *at_indicator_callsetupoutgoing_string = "CIEV: 6;2";
|
||||||
const char *at_indicator_callsetupremoteringing_string = "CIEV: 6;3";
|
const char *at_indicator_callsetupremoteringing_string = "CIEV: 6;3";
|
||||||
//const char *sms_receiving_program = "/usr/local/bin/ciapalo";
|
//const char *sms_receiving_program = "/usr/local/bin/ciapalo";
|
||||||
const char *alsacname = "plughw:1";
|
|
||||||
const char *alsapname = "plughw:1";
|
|
||||||
const char *at_early_audio = "0";
|
const char *at_early_audio = "0";
|
||||||
const char *at_after_preinit_pause = "500000";
|
const char *at_after_preinit_pause = "500000";
|
||||||
const char *at_initial_pause = "500000";
|
const char *at_initial_pause = "500000";
|
||||||
const char *at_has_clcc = "0";
|
const char *at_has_clcc = "0";
|
||||||
const char *at_has_ecam = "0";
|
const char *at_has_ecam = "0";
|
||||||
const char *alsa_period_size = "160";
|
|
||||||
const char *alsa_periods_in_buffer = "4";
|
|
||||||
const char *gsmopen_sound_rate = "8000";
|
const char *gsmopen_sound_rate = "8000";
|
||||||
const char *alsa_play_is_mono = "1";
|
|
||||||
const char *alsa_capture_is_mono = "1";
|
|
||||||
const char *capture_boost = "0";
|
const char *capture_boost = "0";
|
||||||
const char *playback_boost = "0";
|
const char *playback_boost = "0";
|
||||||
const char *no_sound = "0";
|
const char *no_sound = "0";
|
||||||
@ -1402,10 +1395,6 @@ static switch_status_t load_config(int reload_type)
|
|||||||
at_indicator_callsetupremoteringing_string = val;
|
at_indicator_callsetupremoteringing_string = val;
|
||||||
//} else if (!strcasecmp(var, "sms_receiving_program")) {
|
//} else if (!strcasecmp(var, "sms_receiving_program")) {
|
||||||
//sms_receiving_program = val;
|
//sms_receiving_program = val;
|
||||||
} else if (!strcasecmp(var, "alsacname")) {
|
|
||||||
alsacname = val;
|
|
||||||
} else if (!strcasecmp(var, "alsapname")) {
|
|
||||||
alsapname = val;
|
|
||||||
} else if (!strcasecmp(var, "portaudiocindex")) {
|
} else if (!strcasecmp(var, "portaudiocindex")) {
|
||||||
portaudiocindex = val;
|
portaudiocindex = val;
|
||||||
} else if (!strcasecmp(var, "portaudiopindex")) {
|
} else if (!strcasecmp(var, "portaudiopindex")) {
|
||||||
@ -1424,16 +1413,8 @@ static switch_status_t load_config(int reload_type)
|
|||||||
at_has_clcc = val;
|
at_has_clcc = val;
|
||||||
} else if (!strcasecmp(var, "at_has_ecam")) {
|
} else if (!strcasecmp(var, "at_has_ecam")) {
|
||||||
at_has_ecam = val;
|
at_has_ecam = val;
|
||||||
} else if (!strcasecmp(var, "alsa_period_size")) {
|
|
||||||
alsa_period_size = val;
|
|
||||||
} else if (!strcasecmp(var, "alsa_periods_in_buffer")) {
|
|
||||||
alsa_periods_in_buffer = val;
|
|
||||||
} else if (!strcasecmp(var, "gsmopen_sound_rate")) {
|
} else if (!strcasecmp(var, "gsmopen_sound_rate")) {
|
||||||
gsmopen_sound_rate = val;
|
gsmopen_sound_rate = val;
|
||||||
} else if (!strcasecmp(var, "alsa_play_is_mono")) {
|
|
||||||
alsa_play_is_mono = val;
|
|
||||||
} else if (!strcasecmp(var, "alsa_capture_is_mono")) {
|
|
||||||
alsa_capture_is_mono = val;
|
|
||||||
} else if (!strcasecmp(var, "capture_boost")) {
|
} else if (!strcasecmp(var, "capture_boost")) {
|
||||||
capture_boost = val;
|
capture_boost = val;
|
||||||
} else if (!strcasecmp(var, "playback_boost")) {
|
} else if (!strcasecmp(var, "playback_boost")) {
|
||||||
@ -1490,27 +1471,10 @@ static switch_status_t load_config(int reload_type)
|
|||||||
ERRORA("interface param 'at_has_ecam' MUST be a number, now at_has_ecam='%s'\n", GSMOPEN_P_LOG, at_has_ecam);
|
ERRORA("interface param 'at_has_ecam' MUST be a number, now at_has_ecam='%s'\n", GSMOPEN_P_LOG, at_has_ecam);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!switch_is_number(alsa_period_size)) {
|
|
||||||
ERRORA("interface param 'alsa_period_size' MUST be a number, now alsa_period_size='%s'\n", GSMOPEN_P_LOG, alsa_period_size);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!switch_is_number(alsa_periods_in_buffer)) {
|
|
||||||
ERRORA("interface param 'alsa_periods_in_buffer' MUST be a number, now alsa_periods_in_buffer='%s'\n", GSMOPEN_P_LOG,
|
|
||||||
alsa_periods_in_buffer);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!switch_is_number(gsmopen_sound_rate)) {
|
if (!switch_is_number(gsmopen_sound_rate)) {
|
||||||
ERRORA("interface param 'gsmopen_sound_rate' MUST be a number, now gsmopen_sound_rate='%s'\n", GSMOPEN_P_LOG, gsmopen_sound_rate);
|
ERRORA("interface param 'gsmopen_sound_rate' MUST be a number, now gsmopen_sound_rate='%s'\n", GSMOPEN_P_LOG, gsmopen_sound_rate);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!switch_is_number(alsa_play_is_mono)) {
|
|
||||||
ERRORA("interface param 'alsa_play_is_mono' MUST be a number, now alsa_play_is_mono='%s'\n", GSMOPEN_P_LOG, alsa_play_is_mono);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!switch_is_number(alsa_capture_is_mono)) {
|
|
||||||
ERRORA("interface param 'alsa_capture_is_mono' MUST be a number, now alsa_capture_is_mono='%s'\n", GSMOPEN_P_LOG, alsa_capture_is_mono);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!switch_is_number(capture_boost)) {
|
if (!switch_is_number(capture_boost)) {
|
||||||
ERRORA("interface param 'capture_boost' MUST be a number, now capture_boost='%s'\n", GSMOPEN_P_LOG, capture_boost);
|
ERRORA("interface param 'capture_boost' MUST be a number, now capture_boost='%s'\n", GSMOPEN_P_LOG, capture_boost);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user