Make sound card support (Alsa) optional
This commit is contained in:
parent
5c9964ff19
commit
e7016f9f02
|
@ -8,3 +8,8 @@ libmncc_a_SOURCES = \
|
||||||
mncc_sock.c \
|
mncc_sock.c \
|
||||||
testton.c \
|
testton.c \
|
||||||
cause.c
|
cause.c
|
||||||
|
|
||||||
|
if HAVE_ALSA
|
||||||
|
AM_CPPFLAGS += -DHAVE_ALSA
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include "mncc_console.h"
|
#include "mncc_console.h"
|
||||||
#include "cause.h"
|
#include "cause.h"
|
||||||
#include "../libmobile/call.h"
|
#include "../libmobile/call.h"
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
#include "../libsound/sound.h"
|
#include "../libsound/sound.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int new_callref = 0; /* toward mobile */
|
static int new_callref = 0; /* toward mobile */
|
||||||
|
|
||||||
|
@ -289,11 +291,12 @@ error:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int console_open_audio(int latspl)
|
int console_open_audio(int __attribute__((unused)) latspl)
|
||||||
{
|
{
|
||||||
if (!console.audiodev[0])
|
if (!console.audiodev[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
/* open sound device for call control */
|
/* open sound device for call control */
|
||||||
/* use factor 1.4 of speech level for complete range of sound card */
|
/* use factor 1.4 of speech level for complete range of sound card */
|
||||||
console.sound = sound_open(console.audiodev, NULL, NULL, 1, 0.0, console.samplerate, latspl, 1.4, 4000.0);
|
console.sound = sound_open(console.audiodev, NULL, NULL, 1, 0.0, console.samplerate, latspl, 1.4, 4000.0);
|
||||||
|
@ -301,6 +304,10 @@ int console_open_audio(int latspl)
|
||||||
PDEBUG(DSENDER, DEBUG_ERROR, "No sound device!\n");
|
PDEBUG(DSENDER, DEBUG_ERROR, "No sound device!\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PDEBUG(DSENDER, DEBUG_ERROR, "No sound card support compiled in!\n");
|
||||||
|
return -ENOTSUP;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -310,14 +317,20 @@ int console_start_audio(void)
|
||||||
if (!console.audiodev[0])
|
if (!console.audiodev[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
return sound_start(console.sound);
|
return sound_start(console.sound);
|
||||||
|
#else
|
||||||
|
return -EINVAL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void console_cleanup(void)
|
void console_cleanup(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
/* close sound devoice */
|
/* close sound devoice */
|
||||||
if (console.sound)
|
if (console.sound)
|
||||||
sound_close(console.sound);
|
sound_close(console.sound);
|
||||||
|
#endif
|
||||||
|
|
||||||
jitter_destroy(&console.dejitter);
|
jitter_destroy(&console.dejitter);
|
||||||
}
|
}
|
||||||
|
@ -428,6 +441,7 @@ void process_console(int c)
|
||||||
if (!console.sound)
|
if (!console.sound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
/* handle audio, if sound device is used */
|
/* handle audio, if sound device is used */
|
||||||
sample_t samples[console.latspl + 10], *samples_list[1];
|
sample_t samples[console.latspl + 10], *samples_list[1];
|
||||||
uint8_t *power_list[1];
|
uint8_t *power_list[1];
|
||||||
|
@ -487,5 +501,6 @@ void process_console(int c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ libmobile_a_SOURCES = \
|
||||||
call.c \
|
call.c \
|
||||||
main_mobile.c
|
main_mobile.c
|
||||||
|
|
||||||
|
if HAVE_ALSA
|
||||||
|
AM_CPPFLAGS += -DHAVE_ALSA
|
||||||
|
endif
|
||||||
|
|
||||||
if HAVE_SDR
|
if HAVE_SDR
|
||||||
AM_CPPFLAGS += -DHAVE_SDR
|
AM_CPPFLAGS += -DHAVE_SDR
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -115,12 +115,18 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
sender->audio_open = sound_open;
|
sender->audio_open = sound_open;
|
||||||
sender->audio_start = sound_start;
|
sender->audio_start = sound_start;
|
||||||
sender->audio_close = sound_close;
|
sender->audio_close = sound_close;
|
||||||
sender->audio_read = sound_read;
|
sender->audio_read = sound_read;
|
||||||
sender->audio_write = sound_write;
|
sender->audio_write = sound_write;
|
||||||
sender->audio_get_tosend = sound_get_tosend;
|
sender->audio_get_tosend = sound_get_tosend;
|
||||||
|
#else
|
||||||
|
PDEBUG(DSENDER, DEBUG_ERROR, "No sound card support compiled in!\n");
|
||||||
|
rc = -ENOTSUP;
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
#include "../libsound/sound.h"
|
#include "../libsound/sound.h"
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SDR
|
#ifdef HAVE_SDR
|
||||||
#include "../libsdr/sdr.h"
|
#include "../libsdr/sdr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
enum paging_signal;
|
||||||
|
|
||||||
int sdr_start(void *inst);
|
int sdr_start(void *inst);
|
||||||
void *sdr_open(const char *audiodev, double *tx_frequency, double *rx_frequency, int channels, double paging_frequency, int samplerate, int latspl, double bandwidth, double sample_deviation);
|
void *sdr_open(const char *audiodev, double *tx_frequency, double *rx_frequency, int channels, double paging_frequency, int samplerate, int latspl, double bandwidth, double sample_deviation);
|
||||||
void sdr_close(void *inst);
|
void sdr_close(void *inst);
|
||||||
|
|
|
@ -4,3 +4,5 @@ noinst_LIBRARIES = libsound.a
|
||||||
|
|
||||||
libsound_a_SOURCES = \
|
libsound_a_SOURCES = \
|
||||||
sound_alsa.c
|
sound_alsa.c
|
||||||
|
|
||||||
|
AM_CPPFLAGS += -DHAVE_ALSA
|
||||||
|
|
Loading…
Reference in New Issue