#endif //GIOVA48
#define SAMPLERATE_GSMOPEN 8000
-#ifndef NO_ALSA
-#define GSMOPEN_ALSA
-#endif // NO_ALSA
#include <switch.h>
#include <switch_version.h>
#ifndef WIN32
#endif //WIN32
//#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"
#ifndef WIN32
struct timeval ringtime;
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;
int audio_play_reset_period;
int gsmopen_serial_call_AT(private_t *tech_pvt, char *dstr);
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);
int gsmopen_sound_boost(void *data, int samples_num, double boost);
//sent = frame->datalen;
//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);
sent = tech_pvt->serialPort_serial_audio->Write((char *) frame->data, (int) (frame->datalen));
const char *at_indicator_callsetupoutgoing_string = "CIEV: 6;2";
const char *at_indicator_callsetupremoteringing_string = "CIEV: 6;3";
//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_after_preinit_pause = "500000";
const char *at_initial_pause = "500000";
const char *at_has_clcc = "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 *alsa_play_is_mono = "1";
- const char *alsa_capture_is_mono = "1";
const char *capture_boost = "0";
const char *playback_boost = "0";
const char *no_sound = "0";
at_indicator_callsetupremoteringing_string = val;
//} else if (!strcasecmp(var, "sms_receiving_program")) {
//sms_receiving_program = val;
- } else if (!strcasecmp(var, "alsacname")) {
- alsacname = val;
- } else if (!strcasecmp(var, "alsapname")) {
- alsapname = val;
} else if (!strcasecmp(var, "portaudiocindex")) {
portaudiocindex = val;
} else if (!strcasecmp(var, "portaudiopindex")) {
at_has_clcc = val;
} else if (!strcasecmp(var, "at_has_ecam")) {
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")) {
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")) {
capture_boost = val;
} else if (!strcasecmp(var, "playback_boost")) {
ERRORA("interface param 'at_has_ecam' MUST be a number, now at_has_ecam='%s'\n", GSMOPEN_P_LOG, at_has_ecam);
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)) {
ERRORA("interface param 'gsmopen_sound_rate' MUST be a number, now gsmopen_sound_rate='%s'\n", GSMOPEN_P_LOG, gsmopen_sound_rate);
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)) {
ERRORA("interface param 'capture_boost' MUST be a number, now capture_boost='%s'\n", GSMOPEN_P_LOG, capture_boost);
continue;