Freeswitch-branches
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- 1655 discussions
Author: anthonyl
Date: Sat Oct 27 13:05:39 2007
New Revision: 6069
Added:
freeswitch/branches/anthonyl/dbus_branch/
- copied from r6068, /freeswitch/trunk/
Log:
a weekend where i'm not 100% busy, i think i'm going to tinker with dbus and freeswitch
1
0
[commit] r6068 - freeswitch/branches/anthonyl/log2file-branch/src/mod/loggers/mod_syslog
by Freeswitch SVN 27 Oct '07
by Freeswitch SVN 27 Oct '07
27 Oct '07
Author: anthonyl
Date: Sat Oct 27 13:01:53 2007
New Revision: 6068
Modified:
freeswitch/branches/anthonyl/log2file-branch/src/mod/loggers/mod_syslog/mod_syslog.c
Log:
more levels managment
Modified: freeswitch/branches/anthonyl/log2file-branch/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/branches/anthonyl/log2file-branch/src/mod/loggers/mod_syslog/mod_syslog.c (original)
+++ freeswitch/branches/anthonyl/log2file-branch/src/mod/loggers/mod_syslog/mod_syslog.c Sat Oct 27 13:01:53 2007
@@ -32,23 +32,33 @@
#include <switch.h>
#include <stdlib.h>
#include <syslog.h>
-
#define DEFAULT_IDENT "freeswitch"
#define DEFAULT_FACILITY "user"
#define DEFAULT_LEVEL "warning"
#define DEFAULT_FORMAT "[message]"
#define MAX_LENGTH 1024
-
static const char modname[] = "mod_syslog";
static switch_status_t load_config(void);
-
+struct level_set {
+ int level;
+ int on;
+}static levels[] = {
+ {SWITCH_LOG_EMERG, 0}, /* 0 */
+ {SWITCH_LOG_ALERT, 0}, /* 1 */
+ {SWITCH_LOG_CRIT, 0}, /* 2 */
+ {SWITCH_LOG_ERROR, 0}, /* 3 */
+ {SWITCH_LOG_WARNING, 0}, /* 4 */
+ {SWITCH_LOG_NOTICE, 0}, /* 5 */
+ {SWITCH_LOG_INFO, 0}, /* 6 */
+ {SWITCH_LOG_DEBUG, 0}, /* 7 */
+ {SWITCH_LOG_CONSOLE, 0}, /* 8 */
+};
static struct {
char *ident;
char *facility;
char *level;
char *format;
} globals;
-
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident)
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_level, globals.level)
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format)
@@ -66,7 +76,6 @@
/*.speech_interface */ NULL,
/*.directory_interface */ NULL
};
-
static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
{
char *message = NULL;
@@ -74,17 +83,15 @@
char date[80] = "";
switch_time_exp_t time;
switch_size_t retsize;
-
+ if (!levels[node->level].on) {
+ return SWITCH_STATUS_SUCCESS;
+ }
message = (char *) malloc(strlen(globals.format) + 2);
-
switch_copy_string(message, globals.format, strlen(globals.format) + 1);
-
message = switch_string_replace(message, "${message}", node->content);
-
if (switch_time_exp_lt(&time, node->timestamp) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
-
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &time);
message = switch_string_replace(message, "${time}", date);
@@ -97,12 +104,44 @@
if (!switch_strlen_zero(message)) {
syslog(LOG_ERR, "%s", message);
}
-
free(message);
-
return SWITCH_STATUS_SUCCESS;
}
-
+static void process_levels(char *p)
+{
+ char *q;
+ if (!p) /* be safe like a trojan! */
+ return;
+ while ((q = strsep(&p, ","))) {
+ if (!strncasecmp(q, "emerg", strlen(q))) {
+ levels[SWITCH_LOG_EMERG].on = 1;
+ } else if (!strncasecmp(q, "alert", strlen(q))) {
+ levels[SWITCH_LOG_ALERT].on = 1;
+ } else if (!strncasecmp(q, "crit", strlen(q))) {
+ levels[SWITCH_LOG_CRIT].on = 1;
+ } else if (!strncasecmp(q, "error", strlen(q))) {
+ levels[SWITCH_LOG_ERROR].on = 1;
+ } else if (!strncasecmp(q, "warn", strlen(q))) {
+ levels[SWITCH_LOG_WARNING].on = 1;
+ } else if (!strncasecmp(q, "notice", strlen(q))) {
+ levels[SWITCH_LOG_NOTICE].on = 1;
+ } else if (!strncasecmp(q, "info", strlen(q))) {
+ levels[SWITCH_LOG_INFO].on = 1;
+ } else if (!strncasecmp(q, "debug", strlen(q))) {
+ levels[SWITCH_LOG_DEBUG].on = 1;
+ } else if (!strncasecmp(q, "console", strlen(q))) {
+ levels[SWITCH_LOG_CONSOLE].on = 1;
+ } else if (!strncasecmp(q, "all", strlen(q))) {
+ int i;
+ printf("all option!\n");
+ for (i=0; i < (sizeof(levels) / sizeof(struct level_set)); i++) {
+ levels[i].on = 1;
+ }
+ }
+
+ }
+ return;
+}
static switch_status_t load_config(void)
{
char *cf = "syslog.conf";
1
0
Author: mikej
Date: Wed Sep 26 11:15:26 2007
New Revision: 5760
Added:
freeswitch/branches/dacha/
Log:
Created folder remotely
1
0
Author: greenlizard
Date: Thu Sep 6 12:57:43 2007
New Revision: 5685
Added:
freeswitch/branches/greenlizard/scripts/contrib/trixter/softphone.pl
- copied unchanged from r5684, /freeswitch/trunk/scripts/contrib/trixter/softphone.pl
freeswitch/branches/greenlizard/scripts/py_modules/
- copied from r5684, /freeswitch/trunk/scripts/py_modules/
freeswitch/branches/greenlizard/scripts/py_modules/__init__.py
- copied unchanged from r5684, /freeswitch/trunk/scripts/py_modules/__init__.py
freeswitch/branches/greenlizard/scripts/py_modules/speechtools.py
- copied unchanged from r5684, /freeswitch/trunk/scripts/py_modules/speechtools.py
freeswitch/branches/greenlizard/scripts/recipewizard.py
- copied unchanged from r5684, /freeswitch/trunk/scripts/recipewizard.py
Modified:
freeswitch/branches/greenlizard/Makefile.am
freeswitch/branches/greenlizard/conf/conference.conf.xml
freeswitch/branches/greenlizard/src/include/switch_caller.h
freeswitch/branches/greenlizard/src/include/switch_core.h
freeswitch/branches/greenlizard/src/include/switch_ivr.h
freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/branches/greenlizard/src/mod/applications/mod_ivrtest/mod_ivrtest.c
freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c
freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c
freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
freeswitch/branches/greenlizard/src/switch_caller.c
freeswitch/branches/greenlizard/src/switch_console.c
freeswitch/branches/greenlizard/src/switch_core_directory.c
freeswitch/branches/greenlizard/src/switch_core_session.c
freeswitch/branches/greenlizard/src/switch_core_speech.c
freeswitch/branches/greenlizard/src/switch_cpp.cpp
freeswitch/branches/greenlizard/src/switch_ivr_bridge.c
freeswitch/branches/greenlizard/src/switch_ivr_menu.c
freeswitch/branches/greenlizard/src/switch_ivr_originate.c
freeswitch/branches/greenlizard/src/switch_ivr_play_say.c
freeswitch/branches/greenlizard/src/switch_odbc.c
freeswitch/branches/greenlizard/src/switch_swig.c
freeswitch/branches/greenlizard/src/switch_xml.c
Log:
merge trunk 5651:5684
Modified: freeswitch/branches/greenlizard/Makefile.am
==============================================================================
--- freeswitch/branches/greenlizard/Makefile.am (original)
+++ freeswitch/branches/greenlizard/Makefile.am Thu Sep 6 12:57:43 2007
@@ -90,7 +90,8 @@
src/include/switch_cpp.h\
libs/libteletone/src/libteletone_detect.h\
libs/libteletone/src/libteletone_generate.h\
-libs/libteletone/src/libteletone.h
+libs/libteletone/src/libteletone.h\
+src/include/switch_odbc.h
CORE_CFLAGS = `$(switch_srcdir)/libs/apr/apr-1-config --cflags --cppflags --includes`
CORE_CFLAGS += `$(switch_srcdir)/libs/apr-util/apu-1-config --includes`
@@ -104,11 +105,6 @@
CORE_LIBS = libs/apr/libapr-1.la libs/apr-util/libaprutil-1.la
CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la
CORE_LIBS += libs/srtp/libsrtp.la $(RESAMPLE_LIB)
-if ADD_ODBC
-libfreeswitch_la_SOURCES += src/switch_odbc.c
-library_include_HEADERS += src/include/switch_odbc.h
-CORE_LIBS += -lodbc
-endif
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(AM_CFLAGS)
@@ -136,6 +132,10 @@
freeswitch_LDADD += -lcurses
endif
+if ADD_ODBC
+libfreeswitch_la_SOURCES += src/switch_odbc.c
+CORE_LIBS += -lodbc
+endif
libs/libedit/Makefile:
Modified: freeswitch/branches/greenlizard/conf/conference.conf.xml
==============================================================================
--- freeswitch/branches/greenlizard/conf/conference.conf.xml (original)
+++ freeswitch/branches/greenlizard/conf/conference.conf.xml Thu Sep 6 12:57:43 2007
@@ -44,9 +44,9 @@
<!-- Name of the caller control group to use for this profile -->
<!-- <param name="caller-controls" value="some name"/> -->
<!-- TTS Engine to use -->
- <!--<param name="tts-engine" value="cepstral"/>-->
+ <param name="tts-engine" value="cepstral"/>
<!-- TTS Voice to use -->
- <!--<param name="tts-voice" value="david"/>-->
+ <param name="tts-voice" value="david"/>
<!-- If TTS is enabled all audio-file params beginning with -->
<!-- 'say:' will be considered text to say with TTS -->
Modified: freeswitch/branches/greenlizard/src/include/switch_caller.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_caller.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_caller.h Thu Sep 6 12:57:43 2007
@@ -99,6 +99,7 @@
struct switch_caller_profile *originatee_caller_profile;
struct switch_channel_timetable *times;
struct switch_caller_extension *caller_extension;
+ switch_memory_pool_t *pool;
struct switch_caller_profile *next;
};
@@ -189,10 +190,16 @@
\param session session associated with the profile (bound by scope)
\param tocopy the existing profile
*/
-
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session, switch_caller_profile_t *tocopy);
/*!
+ \brief Duplicate an existing caller profile object
+ \param pool pool to duplicate with
+ \param tocopy the existing profile
+*/
+SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memory_pool_t *pool, switch_caller_profile_t *tocopy);
+
+/*!
\brief Add headers to an existing event in regards to a specific profile
\param caller_profile the desired profile
\param prefix a prefix string to all of the field names (for uniqueness)
Modified: freeswitch/branches/greenlizard/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_core.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_core.h Thu Sep 6 12:57:43 2007
@@ -1173,13 +1173,17 @@
\param module_name the speech module to use
\param voice_name the desired voice name
\param rate the sampling rate
+ \param interval the sampling interval
\param flags tts flags
\param pool the pool to use (NULL for new pool)
\return SWITCH_STATUS_SUCCESS if the handle is opened
*/
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
char *module_name,
- char *voice_name, unsigned int rate, switch_speech_flag_t *flags, switch_memory_pool_t *pool);
+ char *voice_name,
+ unsigned int rate,
+ unsigned int interval,
+ switch_speech_flag_t *flags, switch_memory_pool_t *pool);
/*!
\brief Feed text to the TTS module
\param sh the speech handle to feed
Modified: freeswitch/branches/greenlizard/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_ivr.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_ivr.h Thu Sep 6 12:57:43 2007
@@ -317,13 +317,12 @@
\param session the session to speak on
\param tts_name the desired tts module
\param voice_name the desired voice
- \param rate the sample rate
\param text the text to speak
\param args arguements to pass for callbacks etc
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
- char *tts_name, char *voice_name, uint32_t rate, char *text, switch_input_args_t *args);
+ char *tts_name, char *voice_name, char *text, switch_input_args_t *args);
/*!
\brief Make an outgoing call
Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c Thu Sep 6 12:57:43 2007
@@ -155,7 +155,7 @@
typedef struct conference_file_node {
switch_file_handle_t fh;
- switch_speech_handle_t sh;
+ switch_speech_handle_t *sh;
node_type_t type;
uint8_t done;
uint8_t async;
@@ -218,6 +218,8 @@
uint32_t count;
int32_t energy_level;
uint8_t min;
+ switch_speech_handle_t lsh;
+ switch_speech_handle_t *sh;
} conference_obj_t;
/* Relationship with another member */
@@ -257,6 +259,8 @@
conference_file_node_t *fnode;
conference_relationship_t *relationships;
switch_ivr_digit_stream_t *digit_stream;
+ switch_speech_handle_t lsh;
+ switch_speech_handle_t *sh;
struct conference_member *next;
};
@@ -606,10 +610,7 @@
cur = fnode;
fnode = fnode->next;
- if (cur->type == NODE_TYPE_SPEECH) {
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- switch_core_speech_close(&cur->sh, &flags);
- } else {
+ if (cur->type != NODE_TYPE_SPEECH) {
switch_core_file_close(&cur->fh);
}
@@ -618,6 +619,12 @@
}
}
+ if (member->sh) {
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ switch_core_speech_close(&member->lsh, &flags);
+ member->sh = NULL;
+ }
+
member->conference = NULL;
if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
@@ -763,7 +770,7 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = conference->rate;
- if (switch_core_speech_read_tts(&conference->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_speech_read_tts(conference->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2;
} else {
file_sample_len = file_data_len = 0;
@@ -896,10 +903,7 @@
conference_file_node_t *fnode;
switch_memory_pool_t *pool;
- if (conference->fnode->type == NODE_TYPE_SPEECH) {
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- switch_core_speech_close(&conference->fnode->sh, &flags);
- } else {
+ if (conference->fnode->type != NODE_TYPE_SPEECH) {
switch_core_file_close(&conference->fnode->fh);
}
@@ -942,10 +946,7 @@
cur = fnode;
fnode = fnode->next;
- if (cur->type == NODE_TYPE_SPEECH) {
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- switch_core_speech_close(&cur->sh, &flags);
- } else {
+ if (cur->type != NODE_TYPE_SPEECH) {
switch_core_file_close(&cur->fh);
}
@@ -991,6 +992,12 @@
switch_ivr_digit_stream_parser_destroy(conference->dtmf_parser);
+ if (conference->sh) {
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ switch_core_speech_close(&conference->lsh, &flags);
+ conference->sh = NULL;
+ }
+
if (conference->pool) {
switch_memory_pool_t *pool = conference->pool;
switch_core_destroy_memory_pool(&pool);
@@ -1657,10 +1664,7 @@
conference_file_node_t *fnode;
switch_memory_pool_t *pool;
- if (member->fnode->type == NODE_TYPE_SPEECH) {
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- switch_core_speech_close(&member->fnode->sh, &flags);
- } else {
+ if (member->fnode->type != NODE_TYPE_SPEECH) {
switch_core_file_close(&member->fnode->fh);
}
@@ -1680,7 +1684,7 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = member->conference->rate;
- if (switch_core_speech_read_tts(&member->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2;
} else {
file_sample_len = file_data_len = 0;
@@ -2238,11 +2242,15 @@
fnode->leadin = leadin;
fnode->pool = pool;
- memset(&fnode->sh, 0, sizeof(fnode->sh));
- if (switch_core_speech_open(&fnode->sh, conference->tts_engine, conference->tts_voice, conference->rate, &flags, fnode->pool) !=
- SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
- return SWITCH_STATUS_FALSE;
+ if (!member->sh) {
+ memset(&member->lsh, 0, sizeof(member->lsh));
+ if (switch_core_speech_open(&member->lsh, conference->tts_engine, conference->tts_voice,
+ conference->rate, conference->interval, &flags, fnode->pool) !=
+ SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+ return SWITCH_STATUS_FALSE;
+ }
+ member->sh = &member->lsh;
}
/* Queue the node */
@@ -2254,10 +2262,24 @@
} else {
member->fnode = fnode;
}
-
+
+ fnode->sh = member->sh;
/* Begin Generation */
switch_sleep(200000);
- switch_core_speech_feed_tts(&fnode->sh, text, &flags);
+
+ if (*text == '#') {
+ char *tmp = (char *)text + 1;
+ char *vp = tmp, voice[128] = "";
+ if ((tmp = strchr(tmp, '#'))) {
+ text = tmp + 1;
+ switch_copy_string(voice, vp, (tmp - vp) + 1);
+ switch_core_speech_text_param_tts(fnode->sh, "voice", voice);
+ }
+ } else {
+ switch_core_speech_text_param_tts(fnode->sh, "voice", conference->tts_voice);
+ }
+
+ switch_core_speech_feed_tts(fnode->sh, text, &flags);
switch_mutex_unlock(member->flag_mutex);
status = SWITCH_STATUS_SUCCESS;
@@ -2309,12 +2331,16 @@
fnode->type = NODE_TYPE_SPEECH;
fnode->leadin = leadin;
-
- memset(&fnode->sh, 0, sizeof(fnode->sh));
- if (switch_core_speech_open(&fnode->sh, conference->tts_engine, conference->tts_voice, conference->rate, &flags, conference->pool) !=
- SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
- return SWITCH_STATUS_FALSE;
+
+ if (!conference->sh) {
+ memset(&conference->lsh, 0, sizeof(conference->lsh));
+ if (switch_core_speech_open(&conference->lsh, conference->tts_engine, conference->tts_voice,
+ conference->rate, conference->interval, &flags, conference->pool) !=
+ SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+ return SWITCH_STATUS_FALSE;
+ }
+ conference->sh = &conference->lsh;
}
fnode->pool = pool;
@@ -2329,9 +2355,22 @@
conference->fnode = fnode;
}
+ fnode->sh = conference->sh;
+ if (*text == '#') {
+ char *tmp = (char *)text + 1;
+ char *vp = tmp, voice[128] = "";
+ if ((tmp = strchr(tmp, '#'))) {
+ text = tmp + 1;
+ switch_copy_string(voice, vp, (tmp - vp) + 1);
+ switch_core_speech_text_param_tts(fnode->sh, "voice", voice);
+ }
+ } else {
+ switch_core_speech_text_param_tts(fnode->sh, "voice", conference->tts_voice);
+ }
+
/* Begin Generation */
switch_sleep(200000);
- switch_core_speech_feed_tts(&fnode->sh, (char *) text, &flags);
+ switch_core_speech_feed_tts(fnode->sh, (char *) text, &flags);
switch_mutex_unlock(conference->mutex);
status = SWITCH_STATUS_SUCCESS;
@@ -3826,7 +3865,7 @@
if (!(conference->tts_engine && conference->tts_voice)) {
status = SWITCH_STATUS_FALSE;
} else {
- status = switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, 0, path + 4, NULL);
+ status = switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, path + 4, NULL);
}
goto done;
}
Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c Thu Sep 6 12:57:43 2007
@@ -346,6 +346,88 @@
}
}
+
+SWITCH_STANDARD_APP(set_profile_var_function)
+{
+ switch_channel_t *channel;
+ switch_caller_profile_t *caller_profile;
+ char *name, *val = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ caller_profile = switch_channel_get_caller_profile(channel);
+
+ if (switch_strlen_zero(data)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
+ } else {
+ name = switch_core_session_strdup(session, data);
+ val = strchr(name, '=');
+
+ if (val) {
+ *val++ = '\0';
+ if (switch_strlen_zero(val)) {
+ val = NULL;
+ }
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET_PROFILE_VAR [%s]=[%s]\n", name, val ? val : "UNDEF");
+
+ if (!strcasecmp(name, "dialplan")) {
+ caller_profile->dialplan = val;
+ }
+ if (!strcasecmp(name, "username")) {
+ caller_profile->username = val;
+ }
+ if (!strcasecmp(name, "caller_id_name")) {
+ caller_profile->caller_id_name = val;
+ }
+ if (!strcasecmp(name, "caller_id_number")) {
+ caller_profile->caller_id_number = val;
+ }
+ if (!strcasecmp(name, "caller_ton")) {
+ caller_profile->caller_ton = (uint8_t)atoi(val);
+ }
+ if (!strcasecmp(name, "caller_numplan")) {
+ caller_profile->caller_numplan = (uint8_t)atoi(val);
+ }
+ if (!strcasecmp(name, "destination_number_ton")) {
+ caller_profile->destination_number_ton = (uint8_t)atoi(val);
+ }
+ if (!strcasecmp(name, "destination_number_numplan")) {
+ caller_profile->destination_number_numplan = (uint8_t)atoi(val);
+ }
+ if (!strcasecmp(name, "ani")) {
+ caller_profile->ani = val;
+ }
+ if (!strcasecmp(name, "aniii")) {
+ caller_profile->aniii = val;
+ }
+ if (!strcasecmp(name, "network_addr")) {
+ caller_profile->network_addr = val;
+ }
+ if (!strcasecmp(name, "rdnis")) {
+ caller_profile->rdnis = val;
+ }
+ if (!strcasecmp(name, "destination_number")) {
+ caller_profile->destination_number = val;
+ }
+ if (!strcasecmp(name, "uuid")) {
+ caller_profile->uuid = val;
+ }
+ if (!strcasecmp(name, "source")) {
+ caller_profile->source = val;
+ }
+ if (!strcasecmp(name, "context")) {
+ caller_profile->context = val;
+ }
+ if (!strcasecmp(name, "chan_name")) {
+ caller_profile->chan_name = val;
+ }
+ }
+}
+
+
SWITCH_STANDARD_APP(export_function)
{
switch_channel_t *channel;
@@ -860,7 +942,7 @@
args.input_callback = on_dtmf;
args.buf = buf;
args.buflen = sizeof(buf);
- switch_ivr_speak_text(session, engine, voice, codec->implementation->samples_per_second, text, &args);
+ switch_ivr_speak_text(session, engine, voice, text, &args);
}
@@ -1141,6 +1223,7 @@
#define SCHED_HANGUP_DESCR "Schedule a hangup in the future"
#define UNSET_LONG_DESC "Unset a channel varaible for the channel calling the application."
#define SET_LONG_DESC "Set a channel varaible for the channel calling the application."
+#define SET_PROFILE_VAR_LONG_DESC "Set a caller profile varaible for the channel calling the application."
#define EXPORT_LONG_DESC "Set and export a channel varaible for the channel calling the application."
#define LOG_LONG_DESC "Logs a channel varaible for the channel calling the application."
#define TRANSFER_LONG_DESC "Immediatly transfer the calling channel to a new extension"
@@ -1171,6 +1254,7 @@
SWITCH_ADD_APP(app_interface, "event", "Fire an event", "Fire an event", event_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "export", "Export a channel varaible across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "set", "Set a channel varaible", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile varaible", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "unset", "Unset a channel varaible", UNSET_LONG_DESC, unset_function, "<varname>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "break", "Break", "Set the break flag.", break_function, "", SAF_SUPPORT_NOMEDIA);
Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_ivrtest/mod_ivrtest.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_ivrtest/mod_ivrtest.c (original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_ivrtest/mod_ivrtest.c Thu Sep 6 12:57:43 2007
@@ -207,7 +207,7 @@
args.input_callback = show_dtmf;
args.buf = buf;
args.buflen = sizeof(buf);
- switch_ivr_speak_text(session, tts_name, voice_name, codec->implementation->samples_per_second, text, &args);
+ switch_ivr_speak_text(session, tts_name, voice_name, text, &args);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Done\n");
}
@@ -405,7 +405,7 @@
}
snprintf(say, sizeof(say), "You Dialed [%s]\n", buf);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, say);
- switch_ivr_speak_text(session, "cepstral", "david", codec->implementation->samples_per_second, say, NULL);
+ switch_ivr_speak_text(session, "cepstral", "david", say, NULL);
}
}
Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c Thu Sep 6 12:57:43 2007
@@ -243,7 +243,7 @@
}
memset(&sh, 0, sizeof(sh));
- if (switch_core_speech_open(&sh, engine, voice, rate, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ if (switch_core_speech_open(&sh, engine, voice, rate, interval, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
return;
}
Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c (original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c Thu Sep 6 12:57:43 2007
@@ -62,14 +62,9 @@
#include "mrcp_recognizer.h"
#include "mrcp_synthesizer.h"
#include "mrcp_generic_header.h"
-#include "mrcp_resource_set.h"
#include <switch.h>
-#define OPENMRCP_WAIT_TIMEOUT 5000
-#define MY_BUF_LEN 1024 * 128
-#define MY_BLOCK_SIZE MY_BUF_LEN
-
SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown);
SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load,
@@ -95,12 +90,9 @@
} openmrcp_session_t;
typedef enum {
- FLAG_HAS_TEXT = (1 << 0),
- FLAG_BARGE = (1 << 1),
- FLAG_READY = (1 << 2),
- FLAG_SPEAK_COMPLETE = (1 << 3),
- FLAG_FEED_STARTED = (1 << 4),
- FLAG_TERMINATING = (1 << 5)
+ FLAG_HAS_MESSAGE = (1 << 0),
+ FLAG_FEED_STARTED = (1 << 1),
+ FLAG_TERMINATING = (1 << 2)
} mrcp_flag_t;
typedef struct {
@@ -220,38 +212,19 @@
return MRCP_STATUS_FAILURE;
}
- if (mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_EVENT) {
+ if (mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE && mrcp_message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ignoring mrcp response\n");
return MRCP_STATUS_SUCCESS;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mrcp msg body: %s\n", mrcp_message->body);
-
- if (mrcp_message->channel_id.resource_id == MRCP_RESOURCE_RECOGNIZER) {
- if (mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
- openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_HAS_TEXT\n");
- switch_set_flag_locked(openmrcp_session, FLAG_HAS_TEXT);
- }
- else if (mrcp_message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
- openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_BARGE\n");
- switch_set_flag_locked(openmrcp_session, FLAG_BARGE);
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ignoring event: %s\n", mrcp_message->start_line.method_name);
- }
- }
- else if(mrcp_message->channel_id.resource_id == MRCP_RESOURCE_SYNTHESIZER) {
- if (mrcp_message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setting FLAG_SPEAK_COMPLETE\n");
- switch_set_flag_locked(openmrcp_session, FLAG_SPEAK_COMPLETE);
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ignoring event: %s\n", mrcp_message->start_line.method_name);
- }
+ if (switch_test_flag(openmrcp_session, FLAG_HAS_MESSAGE)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "already has message\n");
+ return MRCP_STATUS_SUCCESS;
}
-
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_HAS_MESSAGE\n");
+ openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
+ switch_set_flag_locked(openmrcp_session, FLAG_HAS_MESSAGE);
return MRCP_STATUS_SUCCESS;
}
@@ -473,8 +446,8 @@
{
openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
- switch_status_t rv = (switch_test_flag(asr_session, FLAG_HAS_TEXT) || switch_test_flag(asr_session, FLAG_BARGE)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
-
+ switch_status_t rv = (switch_test_flag(asr_session, FLAG_HAS_MESSAGE)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+
return rv;
}
@@ -483,50 +456,61 @@
{
openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
switch_status_t ret = SWITCH_STATUS_SUCCESS;
+ mrcp_message_t *message;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_get_results called\n");
- if (switch_test_flag(asr_session, FLAG_BARGE)) {
- switch_clear_flag_locked(asr_session, FLAG_BARGE);
- ret = SWITCH_STATUS_BREAK;
- }
-
- if (switch_test_flag(asr_session, FLAG_HAS_TEXT)) {
- /*!
- we have to extract the XML but stripping off the <?xml version="1.0"?>
- header. the body looks like:
-
- Completion-Cause:001 no-match
- Content-Type: application/nlsml+xml
- Content-Length: 260
-
- <?xml version="1.0"?>
- <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1@form-level.store">
- <interpretation> <input mode="speech">open a</input>
- </interpretation>
- </result>
- */
-
- if(asr_session->mrcp_message_last_rcvd && asr_session->mrcp_message_last_rcvd->body) {
- char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
- char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
- if (!position) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
- ret = SWITCH_STATUS_FALSE;
+ message = asr_session->mrcp_message_last_rcvd;
+ asr_session->mrcp_message_last_rcvd = NULL;
+ // since we are returning our result here, future calls to check_results
+ // should return False
+ switch_clear_flag_locked(asr_session, FLAG_HAS_MESSAGE);
+
+ if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+ if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS &&
+ message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "error code received [%d]\n", message->start_line.status_code);
+ ret = SWITCH_STATUS_FALSE;
+ }
+ }
+ else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+ if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
+ /*!
+ we have to extract the XML but stripping off the <?xml version="1.0"?>
+ header. the body looks like:
+
+ Completion-Cause:001 no-match
+ Content-Type: application/nlsml+xml
+ Content-Length: 260
+
+ <?xml version="1.0"?>
+ <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1@form-level.store">
+ <interpretation> <input mode="speech">open a</input>
+ </interpretation>
+ </result>
+ */
+
+ if(message->body) {
+ char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
+ char *position = strstr(message->body, marker);
+ if (!position) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", message->body);
+ ret = SWITCH_STATUS_FALSE;
+ }
+ else {
+ position += strlen(marker);
+ *xmlstr = strdup(position);
+ }
}
else {
- position += strlen(marker);
- *xmlstr = strdup(position);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server\n");
+ ret = SWITCH_STATUS_FALSE;
}
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server\n");
- ret = SWITCH_STATUS_FALSE;
- }
- // since we are returning our result here, future calls to check_results
- // should return False
- switch_clear_flag_locked(asr_session, FLAG_HAS_TEXT);
- ret = SWITCH_STATUS_SUCCESS;
+ ret = SWITCH_STATUS_SUCCESS;
+ }
+ else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
+ ret = SWITCH_STATUS_BREAK;
+ }
}
return ret;
}
@@ -658,10 +642,25 @@
media_frame_t media_frame;
audio_source_t *audio_source;
- if (switch_test_flag(tts_session, FLAG_SPEAK_COMPLETE)) {
- /* tell fs we are done */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FLAG_SPEAK_COMPLETE\n");
- return SWITCH_STATUS_BREAK;
+ if (switch_test_flag(tts_session, FLAG_HAS_MESSAGE)) {
+ mrcp_message_t *message = tts_session->mrcp_message_last_rcvd;
+ tts_session->mrcp_message_last_rcvd = NULL;
+ switch_clear_flag_locked(tts_session, FLAG_HAS_MESSAGE);
+
+ if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+ if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS &&
+ message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "error code received [%d]\n", message->start_line.status_code);
+ return SWITCH_STATUS_BREAK;
+ }
+ }
+ else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+ if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
+ /* tell fs we are done */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FLAG_SPEAK_COMPLETE\n");
+ return SWITCH_STATUS_BREAK;
+ }
+ }
}
audio_source = mrcp_client_audio_source_get(tts_session->audio_channel);
@@ -962,5 +961,5 @@
{
/* destroy openmrcp */
openmrcp_destroy();
- return SWITCH_STATUS_UNLOAD;
+ return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c Thu Sep 6 12:57:43 2007
@@ -2650,12 +2650,11 @@
cid_name,
cid_num,
ldl_session_get_ip(dlsession),
- ldl_session_get_value(dlsession,
- "ani"),
- ldl_session_get_value(dlsession,
- "aniii"),
- ldl_session_get_value(dlsession,
- "rdnis"), (char *) modname, context,
+ ldl_session_get_value(dlsession, "ani"),
+ ldl_session_get_value(dlsession, "aniii"),
+ ldl_session_get_value(dlsession, "rdnis"),
+ modname,
+ context,
exten)) != 0) {
char name[128];
snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c Thu Sep 6 12:57:43 2007
@@ -1107,8 +1107,9 @@
iaxevent->ies.calling_ani,
NULL,
NULL,
- (char *) modname,
- iaxevent->ies.called_context, iaxevent->ies.called_number)) != 0) {
+ modname,
+ iaxevent->ies.called_context,
+ iaxevent->ies.called_number)) != 0) {
char name[128];
snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c Thu Sep 6 12:57:43 2007
@@ -1600,8 +1600,8 @@
}
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- NULL,
- dialplan, cid_name, cid_num, NULL, NULL, NULL, NULL, (char *) modname, NULL,
+ NULL, dialplan, cid_name, cid_num,
+ NULL, NULL, NULL, NULL, modname, NULL,
dest)) != 0) {
char name[128];
snprintf(name, sizeof(name), "PortAudio/%s",
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c Thu Sep 6 12:57:43 2007
@@ -1935,7 +1935,10 @@
tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
from_user,
profile->dialplan,
- displayname, from_user, network_ip, NULL, NULL, NULL, MODNAME, context, destination_number);
+ displayname,
+ from_user,
+ network_ip,
+ NULL, NULL, NULL, MODNAME, context, destination_number);
if (tech_pvt->caller_profile) {
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c Thu Sep 6 12:57:43 2007
@@ -505,10 +505,10 @@
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
priv = "name";
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
- priv = "yes";
+ priv = "full";
}
} else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
- priv = "yes";
+ priv = "full";
}
if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
screen = "yes";
@@ -1369,6 +1369,7 @@
case 603:
return SWITCH_CAUSE_CALL_REJECTED;
case 404:
+ return SWITCH_CAUSE_UNALLOCATED;
case 485:
case 604:
return SWITCH_CAUSE_NO_ROUTE_DESTINATION;
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Sep 6 12:57:43 2007
@@ -729,8 +729,9 @@
const char *passwd = NULL;
const char *a1_hash = NULL;
char *sql;
- switch_xml_t domain, xml, user, param, xparams;
-
+ switch_xml_t domain, xml = NULL, user, param, xparams;
+ char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
+
username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
if (authorization->au_params) {
@@ -805,7 +806,6 @@
if (!(xparams = switch_xml_child(user, "params"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", username, realm);
- switch_xml_free(xml);
ret = AUTH_FORBIDDEN;
goto end;
}
@@ -838,8 +838,6 @@
}
}
- switch_xml_free(xml);
-
if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
ret = AUTH_OK;
goto end;
@@ -847,7 +845,6 @@
if (!a1_hash) {
su_md5_t ctx;
- char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1];
char *input;
input = switch_mprintf("%s:%s:%s", username, realm, passwd);
@@ -894,6 +891,9 @@
}
end:
+ if (xml) {
+ switch_xml_free(xml);
+ }
switch_safe_free(input);
switch_safe_free(input2);
switch_safe_free(username);
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c Thu Sep 6 12:57:43 2007
@@ -1059,7 +1059,15 @@
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
NULL,
tech_pvt->profile->dialplan,
- cid_name, cid_num, ip, NULL, NULL, NULL, (char *) modname, NULL, exten)) != 0) {
+ cid_name,
+ cid_num,
+ ip,
+ NULL,
+ NULL,
+ NULL,
+ modname,
+ NULL,
+ exten)) != 0) {
char name[128];
snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Thu Sep 6 12:57:43 2007
@@ -1242,6 +1242,7 @@
char *phrase_name = NULL;
char *phrase_data = NULL;
char *phrase_lang = NULL;
+ char *tmp = NULL;
//char *input_callback = NULL;
void *bp = NULL;
int len = 0;
@@ -1272,7 +1273,10 @@
}
if (argc > 2) {
- phrase_lang = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+ tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+ if (!switch_strlen_zero(tmp)) {
+ phrase_lang = tmp;
+ }
}
if (argc > 3) {
@@ -1502,6 +1506,53 @@
return JS_TRUE;
}
+static void destroy_speech_engine(struct js_session *jss)
+{
+ if (jss->speech) {
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ switch_core_codec_destroy(&jss->speech->codec);
+ switch_core_speech_close(&jss->speech->sh, &flags);
+ jss->speech = NULL;
+ }
+}
+
+
+static switch_status_t init_speech_engine(struct js_session *jss, char *engine, char *voice)
+{
+ switch_codec_t *read_codec;
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ uint32_t rate = 0;
+ int interval = 0;
+
+ read_codec = switch_core_session_get_read_codec(jss->session);
+ rate = read_codec->implementation->samples_per_second;
+ interval = read_codec->implementation->microseconds_per_frame / 1000;
+
+ if (switch_core_codec_init(&jss->speech->codec,
+ "L16",
+ NULL,
+ rate,
+ interval,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ switch_core_session_get_pool(jss->session)) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n", rate, interval);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", rate, interval);
+ return SWITCH_STATUS_FALSE;
+ }
+
+
+ if (switch_core_speech_open(&jss->speech->sh, engine, voice, rate, interval,
+ &flags, switch_core_session_get_pool(jss->session)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
+ switch_core_codec_destroy(&jss->speech->codec);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
@@ -1520,13 +1571,13 @@
METHOD_SANITY_CHECK();
+ *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
channel = switch_core_session_get_channel(jss->session);
assert(channel != NULL);
CHANNEL_SANITY_CHECK();
if (argc < 3) {
- *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
return JS_FALSE;
}
@@ -1534,6 +1585,34 @@
voice_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
text = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+
+ if (switch_strlen_zero(tts_name)) {
+ eval_some_js("~throw new Error(\"Invalid TTS Name\");", cx, obj, rval);
+ return JS_TRUE;
+ }
+
+ if (switch_strlen_zero(text)) {
+ eval_some_js("~throw new Error(\"Invalid Text\");", cx, obj, rval);
+ return JS_TRUE;
+ }
+
+
+ if (jss->speech && strcasecmp(jss->speech->sh.name, tts_name)) {
+ destroy_speech_engine(jss);
+ }
+
+ if (jss->speech) {
+ switch_core_speech_text_param_tts(&jss->speech->sh, "voice", voice_name);
+ } else {
+ jss->speech = switch_core_session_alloc(jss->session, sizeof(*jss->speech));
+ assert(jss->speech != NULL);
+ if (init_speech_engine(jss, tts_name, voice_name) != SWITCH_STATUS_SUCCESS) {
+ eval_some_js("~throw new Error(\"Cannot allocate speech engine!\");", cx, obj, rval);
+ jss->speech = NULL;
+ return JS_TRUE;
+ }
+ }
+
if (argc > 3) {
if ((function = JS_ValueToFunction(cx, argv[3]))) {
memset(&cb_state, 0, sizeof(cb_state));
@@ -1551,9 +1630,6 @@
}
}
- if (!tts_name && text) {
- return JS_FALSE;
- }
codec = switch_core_session_get_read_codec(jss->session);
cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -1561,8 +1637,9 @@
args.input_callback = dtmf_func;
args.buf = bp;
args.buflen = len;
- switch_ivr_speak_text(jss->session, tts_name, voice_name
- && strlen(voice_name) ? voice_name : NULL, codec->implementation->samples_per_second, text, &args);
+
+ switch_core_speech_flush_tts(&jss->speech->sh);
+ switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args);
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;
@@ -2353,9 +2430,8 @@
return JS_FALSE;
}
- caller_profile = switch_caller_profile_new(pool,
- username, dialplan, cid_name, cid_num, network_addr, ani, aniii, rdnis, (char *) modname, context,
- dest);
+ caller_profile = switch_caller_profile_new(pool,username, dialplan, cid_name, cid_num, network_addr,
+ ani, aniii, rdnis, modname, context, dest);
if (switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
@@ -2385,6 +2461,8 @@
if (cx && obj) {
if ((jss = JS_GetPrivate(cx, obj))) {
+ destroy_speech_engine(jss);
+
if (jss->session) {
channel = switch_core_session_get_channel(jss->session);
switch_channel_set_private(channel, "jss", NULL);
Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h Thu Sep 6 12:57:43 2007
@@ -122,6 +122,11 @@
typedef struct sm_module_interface sm_module_interface_t;
typedef switch_status_t (*spidermonkey_init_t) (const sm_module_interface_t ** module_interface);
+struct js_session_speech {
+ switch_speech_handle_t sh;
+ switch_codec_t codec;
+};
+
struct js_session {
switch_core_session_t *session;
JSContext *cx;
@@ -141,6 +146,7 @@
char *rdnis;
char *context;
char *username;
+ struct js_session_speech *speech;
};
JSBool DEFAULT_SET_PROPERTY(JSContext * cx, JSObject *obj, jsval id, jsval *vp)
Modified: freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c Thu Sep 6 12:57:43 2007
@@ -156,7 +156,8 @@
{
switch_channel_t *channel;
int in;
- int x = 0, places[9] = { 0 };
+ uint32_t x = 0;
+ int places[9] = { 0 };
char sbuf[13] = "";
switch_status_t status;
Modified: freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original)
+++ freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Thu Sep 6 12:57:43 2007
@@ -88,7 +88,8 @@
if(!switch_strlen_zero(logdir)) {
if ((path = switch_mprintf("%s/xml_cdr/%s.cdr.xml", logdir, switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
- write(fd, xml_text, (unsigned) strlen(xml_text));
+ int wrote;
+ wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
close(fd);
fd = -1;
} else {
@@ -160,7 +161,8 @@
if ((path = switch_mprintf("%s/%s.cdr.xml", globals.errLogDir, switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
- write(fd, xml_text, (unsigned) strlen(xml_text));
+ int wrote;
+ wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
close(fd);
fd = -1;
} else {
Modified: freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (original)
+++ freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Thu Sep 6 12:57:43 2007
@@ -53,8 +53,8 @@
{
register unsigned int realsize = (unsigned int) (size * nmemb);
struct config_data *config_data = data;
-
- write(config_data->fd, ptr, realsize);
+ int x;
+ x = write(config_data->fd, ptr, realsize);
return realsize;
}
@@ -72,7 +72,7 @@
xml_binding_t *binding = (xml_binding_t *) user_data;
char *file_url;
struct curl_slist *slist = NULL;
- long httpRes;
+ long httpRes = 0;
if (!binding) {
return NULL;
Modified: freeswitch/branches/greenlizard/src/switch_caller.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_caller.c (original)
+++ freeswitch/branches/greenlizard/src/switch_caller.c Thu Sep 6 12:57:43 2007
@@ -63,29 +63,31 @@
profile->context = switch_clean_string(switch_core_strdup(pool, switch_str_nil(context)));
profile->destination_number = switch_clean_string(switch_core_strdup(pool, switch_str_nil(destination_number)));
switch_set_flag(profile, SWITCH_CPF_SCREEN);
+ profile->pool = pool;
}
return profile;
}
-SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session, switch_caller_profile_t *tocopy)
+SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memory_pool_t *pool, switch_caller_profile_t *tocopy)
{
switch_caller_profile_t *profile = NULL;
- if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile_t))) != 0) {
- profile->username = switch_core_session_strdup(session, tocopy->username);
- profile->dialplan = switch_core_session_strdup(session, tocopy->dialplan);
- profile->caller_id_name = switch_core_session_strdup(session, tocopy->caller_id_name);
- profile->ani = switch_core_session_strdup(session, tocopy->ani);
- profile->aniii = switch_core_session_strdup(session, tocopy->aniii);
- profile->caller_id_number = switch_core_session_strdup(session, tocopy->caller_id_number);
- profile->network_addr = switch_core_session_strdup(session, tocopy->network_addr);
- profile->rdnis = switch_core_session_strdup(session, tocopy->rdnis);
- profile->destination_number = switch_core_session_strdup(session, tocopy->destination_number);
- profile->uuid = switch_core_session_strdup(session, tocopy->uuid);
- profile->source = switch_core_session_strdup(session, tocopy->source);
- profile->context = switch_core_session_strdup(session, tocopy->context);
- profile->chan_name = switch_core_session_strdup(session, tocopy->chan_name);
+
+ if ((profile = switch_core_alloc(pool, sizeof(switch_caller_profile_t))) != 0) {
+ profile->username = switch_core_strdup(pool, tocopy->username);
+ profile->dialplan = switch_core_strdup(pool, tocopy->dialplan);
+ profile->caller_id_name = switch_core_strdup(pool, tocopy->caller_id_name);
+ profile->ani = switch_core_strdup(pool, tocopy->ani);
+ profile->aniii = switch_core_strdup(pool, tocopy->aniii);
+ profile->caller_id_number = switch_core_strdup(pool, tocopy->caller_id_number);
+ profile->network_addr = switch_core_strdup(pool, tocopy->network_addr);
+ profile->rdnis = switch_core_strdup(pool, tocopy->rdnis);
+ profile->destination_number = switch_core_strdup(pool, tocopy->destination_number);
+ profile->uuid = switch_core_strdup(pool, tocopy->uuid);
+ profile->source = switch_core_strdup(pool, tocopy->source);
+ profile->context = switch_core_strdup(pool, tocopy->context);
+ profile->chan_name = switch_core_strdup(pool, tocopy->chan_name);
profile->caller_ton = tocopy->caller_ton;
profile->caller_numplan = tocopy->caller_numplan;
profile->ani_ton = tocopy->ani_ton;
@@ -95,11 +97,23 @@
profile->destination_number_ton = tocopy->destination_number_ton;
profile->destination_number_numplan = tocopy->destination_number_numplan;
profile->flags = tocopy->flags;
+ profile->pool = pool;
}
return profile;
}
+
+SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session, switch_caller_profile_t *tocopy)
+{
+ switch_memory_pool_t *pool;
+
+ pool = switch_core_session_get_pool(session);
+
+ return switch_caller_profile_dup(pool, tocopy);
+}
+
+
SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name)
{
if (!strcasecmp(name, "dialplan")) {
@@ -141,6 +155,30 @@
if (!strcasecmp(name, "chan_name")) {
return caller_profile->chan_name;
}
+ if (!strcasecmp(name, "caller_ton")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->caller_ton);
+ }
+ if (!strcasecmp(name, "caller_numplan")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->caller_numplan);
+ }
+ if (!strcasecmp(name, "destination_number_ton")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->destination_number_ton);
+ }
+ if (!strcasecmp(name, "destination_number_numplan")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->destination_number_numplan);
+ }
+ if (!strcasecmp(name, "ani_ton")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->ani_ton);
+ }
+ if (!strcasecmp(name, "ani_numplan")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->ani_numplan);
+ }
+ if (!strcasecmp(name, "rdnis_ton")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->rdnis_ton);
+ }
+ if (!strcasecmp(name, "rdnis_numplan")) {
+ return switch_core_sprintf(caller_profile->pool, "%u", caller_profile->rdnis_numplan);
+ }
return NULL;
}
Modified: freeswitch/branches/greenlizard/src/switch_console.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_console.c (original)
+++ freeswitch/branches/greenlizard/src/switch_console.c Thu Sep 6 12:57:43 2007
@@ -183,7 +183,7 @@
static char prompt_str[512] = "";
char * prompt(EditLine *e) {
- if (switch_strlen_zero(prompt_str)) {
+ if (*prompt_str == '\0') {
gethostname(hostname, sizeof(hostname));
snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
}
Modified: freeswitch/branches/greenlizard/src/switch_core_directory.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_directory.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_directory.c Thu Sep 6 12:57:43 2007
@@ -76,28 +76,3 @@
return dh->directory_interface->directory_close(dh);
}
-SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
- char *module_name,
- char *voice_name, unsigned int rate, switch_speech_flag_t *flags, switch_memory_pool_t *pool)
-{
- switch_status_t status;
-
- if ((sh->speech_interface = switch_loadable_module_get_speech_interface(module_name)) == 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid speech module [%s]!\n", module_name);
- return SWITCH_STATUS_GENERR;
- }
-
- switch_copy_string(sh->engine, module_name, sizeof(sh->engine));
- sh->flags = *flags;
- if (pool) {
- sh->memory_pool = pool;
- } else {
- if ((status = switch_core_new_memory_pool(&sh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
- return status;
- }
- switch_set_flag(sh, SWITCH_SPEECH_FLAG_FREE_POOL);
- }
- sh->rate = rate;
- sh->name = switch_core_strdup(pool, module_name);
- return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
-}
Modified: freeswitch/branches/greenlizard/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_session.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_session.c Thu Sep 6 12:57:43 2007
@@ -201,23 +201,14 @@
ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number");
if (ecaller_id_name || ecaller_id_number) {
- if (!ecaller_id_name) {
- ecaller_id_name = caller_profile->caller_id_name;
+ outgoing_profile = switch_caller_profile_clone(session, caller_profile);
+
+ if (ecaller_id_name) {
+ outgoing_profile->caller_id_name = ecaller_id_name;
}
- if (!ecaller_id_number) {
- ecaller_id_number = caller_profile->caller_id_number;
+ if (ecaller_id_number) {
+ outgoing_profile->caller_id_number = ecaller_id_number;
}
- outgoing_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- caller_profile->username,
- caller_profile->dialplan,
- ecaller_id_name,
- ecaller_id_number,
- caller_profile->network_addr,
- caller_profile->ani,
- caller_profile->aniii,
- caller_profile->rdnis,
- caller_profile->source, caller_profile->context, caller_profile->destination_number);
- outgoing_profile->flags = caller_profile->flags;
}
}
if (!outgoing_profile) {
Modified: freeswitch/branches/greenlizard/src/switch_core_speech.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_speech.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_speech.c Thu Sep 6 12:57:43 2007
@@ -34,6 +34,40 @@
#include <switch.h>
#include "private/switch_core_pvt.h"
+
+SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
+ char *module_name,
+ char *voice_name,
+ unsigned int rate,
+ unsigned int interval,
+ switch_speech_flag_t *flags,
+ switch_memory_pool_t *pool)
+{
+ switch_status_t status;
+
+ if ((sh->speech_interface = switch_loadable_module_get_speech_interface(module_name)) == 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid speech module [%s]!\n", module_name);
+ return SWITCH_STATUS_GENERR;
+ }
+
+ switch_copy_string(sh->engine, module_name, sizeof(sh->engine));
+ sh->flags = *flags;
+ if (pool) {
+ sh->memory_pool = pool;
+ } else {
+ if ((status = switch_core_new_memory_pool(&sh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
+ switch_set_flag(sh, SWITCH_SPEECH_FLAG_FREE_POOL);
+ }
+ sh->rate = rate;
+ sh->name = switch_core_strdup(pool, module_name);
+ sh->samples = switch_bytes_per_frame(rate, interval);
+
+ return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
+}
+
+
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
{
assert(sh != NULL);
Modified: freeswitch/branches/greenlizard/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_cpp.cpp (original)
+++ freeswitch/branches/greenlizard/src/switch_cpp.cpp Thu Sep 6 12:57:43 2007
@@ -123,7 +123,6 @@
int CoreSession::speak(char *text)
{
switch_status_t status;
- switch_codec_t *codec;
sanity_check(-1);
@@ -142,9 +141,9 @@
return SWITCH_STATUS_FALSE;
}
- codec = switch_core_session_get_read_codec(session);
+
begin_allow_threads();
- status = switch_ivr_speak_text(session, tts_name, voice_name, codec->implementation->samples_per_second, text, ap);
+ status = switch_ivr_speak_text(session, tts_name, voice_name, text, ap);
end_allow_threads();
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
Modified: freeswitch/branches/greenlizard/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_ivr_bridge.c (original)
+++ freeswitch/branches/greenlizard/src/switch_ivr_bridge.c Thu Sep 6 12:57:43 2007
@@ -84,12 +84,14 @@
switch_event_t *event;
loop_count++;
- /* if you really want to make sure it's not ready, test it twice because it might be just a break */
- if (!switch_channel_ready(chan_a) && !switch_channel_ready(chan_a)) {
+ if (!switch_channel_ready(chan_a)) {
break;
}
if ((b_state = switch_channel_get_state(chan_b)) >= CS_HANGUP) {
+ if (originator && !ans_a && !ans_b) {
+ switch_channel_hangup(chan_a, switch_channel_get_cause(chan_b));
+ }
break;
}
@@ -163,8 +165,7 @@
continue;
}
}
-
-
+
/* read audio from 1 channel and write it to the other */
status = switch_core_session_read_frame(session_a, &read_frame, -1, stream_id);
Modified: freeswitch/branches/greenlizard/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_ivr_menu.c (original)
+++ freeswitch/branches/greenlizard/src/switch_ivr_menu.c Thu Sep 6 12:57:43 2007
@@ -263,7 +263,7 @@
} else {
if (strlen(sound) > 4 && strncmp(sound, "say:", 4) == 0) {
if (menu->tts_engine && menu->tts_voice) {
- status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, 0, sound + 4, &args);
+ status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, sound + 4, &args);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No TTS engine to play sound\n");
}
@@ -369,7 +369,7 @@
status = switch_ivr_play_file(session, NULL, aptr, NULL);
break;
case SWITCH_IVR_ACTION_SAYTEXT:
- status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, 0, aptr, NULL);
+ status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, aptr, NULL);
break;
case SWITCH_IVR_ACTION_SAYPHRASE:
status = switch_ivr_phrase_macro(session, aptr, "", menu->phrase_lang, NULL);
Modified: freeswitch/branches/greenlizard/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_ivr_originate.c (original)
+++ freeswitch/branches/greenlizard/src/switch_ivr_originate.c Thu Sep 6 12:57:43 2007
@@ -470,34 +470,18 @@
}
caller_caller_profile = caller_profile_override ? caller_profile_override : switch_channel_get_caller_profile(caller_channel);
+ new_profile = switch_caller_profile_clone(session, caller_caller_profile);
+ new_profile->destination_number = chan_data;
- if (!cid_name_override) {
- cid_name_override = caller_caller_profile->caller_id_name;
+ if (cid_name_override) {
+ new_profile->caller_id_name = cid_name_override;
}
- if (!cid_num_override) {
- cid_num_override = caller_caller_profile->caller_id_number;
+ if (cid_num_override) {
+ new_profile->caller_id_number = cid_num_override;
}
- new_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- caller_caller_profile->username,
- caller_caller_profile->dialplan,
- cid_name_override,
- cid_num_override,
- caller_caller_profile->network_addr,
- NULL,
- NULL,
- caller_caller_profile->rdnis,
- caller_caller_profile->source, caller_caller_profile->context, chan_data);
- new_profile->flags = caller_caller_profile->flags;
pool = NULL;
} else {
- if (!cid_name_override) {
- cid_name_override = "FreeSWITCH";
- }
- if (!cid_num_override) {
- cid_num_override = "0000000000";
- }
-
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
status = SWITCH_STATUS_TERM;
@@ -505,22 +489,23 @@
}
if (caller_profile_override) {
- new_profile = switch_caller_profile_new(pool,
- caller_profile_override->username,
- caller_profile_override->dialplan,
- caller_profile_override->caller_id_name,
- caller_profile_override->caller_id_number,
- caller_profile_override->network_addr,
- caller_profile_override->ani,
- caller_profile_override->aniii,
- caller_profile_override->rdnis,
- caller_profile_override->source, caller_profile_override->context, chan_data);
+ new_profile = switch_caller_profile_dup(pool, caller_profile_override);
+ new_profile->destination_number = chan_data;
} else {
+ if (!cid_name_override) {
+ cid_name_override = "FreeSWITCH";
+ }
+ if (!cid_num_override) {
+ cid_num_override = "0000000000";
+ }
+
new_profile = switch_caller_profile_new(pool,
- NULL,
- NULL,
- cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL,
- chan_data);
+ NULL,
+ NULL,
+ cid_name_override,
+ cid_num_override,
+ NULL, NULL, NULL, NULL, __FILE__, NULL,
+ chan_data);
}
}
Modified: freeswitch/branches/greenlizard/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_ivr_play_say.c (original)
+++ freeswitch/branches/greenlizard/src/switch_ivr_play_say.c Thu Sep 6 12:57:43 2007
@@ -250,11 +250,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", chan_lang);
}
} else if (!strcasecmp(func, "speak-text")) {
- switch_codec_t *read_codec;
- if ((read_codec = switch_core_session_get_read_codec(session))) {
-
- status = switch_ivr_speak_text(session, tts_engine, tts_voice, read_codec->implementation->samples_per_second, odata, args);
- }
+ status = switch_ivr_speak_text(session, tts_engine, tts_voice, odata, args);
}
}
}
@@ -1340,11 +1336,11 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
- char *tts_name, char *voice_name, uint32_t rate, char *text, switch_input_args_t *args)
+ char *tts_name, char *voice_name, char *text, switch_input_args_t *args)
{
switch_channel_t *channel;
+ uint32_t rate = 0;
int interval = 0;
- uint32_t len = 0;
switch_frame_t write_frame = { 0 };
switch_timer_t timer;
switch_core_thread_session_t thread_session;
@@ -1366,12 +1362,12 @@
switch_core_session_reset(session);
read_codec = switch_core_session_get_read_codec(session);
- if (rate == 0) {
- rate = read_codec->implementation->samples_per_second;
- }
+ rate = read_codec->implementation->samples_per_second;
+ interval = read_codec->implementation->microseconds_per_frame / 1000;
memset(&sh, 0, sizeof(sh));
- if (switch_core_speech_open(&sh, tts_name, voice_name, (uint32_t) rate, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ if (switch_core_speech_open(&sh, tts_name, voice_name, (uint32_t) rate, interval,
+ &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
switch_core_session_reset(session);
return SWITCH_STATUS_FALSE;
@@ -1380,9 +1376,6 @@
switch_channel_answer(channel);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OPEN TTS %s\n", tts_name);
- interval = read_codec->implementation->microseconds_per_frame / 1000;
- sh.samples = switch_bytes_per_frame(rate, interval);
- len = sh.samples * 2;
codec_name = "L16";
@@ -1409,7 +1402,7 @@
switch_core_session_reset(session);
return SWITCH_STATUS_GENERR;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", len, interval);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", sh.samples * 2, interval);
/* start a thread to absorb incoming audio */
for (stream_id = 0; stream_id < switch_core_session_get_stream_count(session); stream_id++) {
Modified: freeswitch/branches/greenlizard/src/switch_odbc.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_odbc.c (original)
+++ freeswitch/branches/greenlizard/src/switch_odbc.c Thu Sep 6 12:57:43 2007
@@ -415,14 +415,14 @@
SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt)
{
- char buffer[SQL_MAX_MESSAGE_LENGTH + 1];
- char sqlstate[SQL_SQLSTATE_SIZE + 1];
+ char buffer[SQL_MAX_MESSAGE_LENGTH + 1] = "";
+ char sqlstate[SQL_SQLSTATE_SIZE + 1] = "";
SQLINTEGER sqlcode;
SQLSMALLINT length;
char *ret = NULL;
if (SQLError(handle->env, handle->con, stmt, (SQLCHAR *)sqlstate, &sqlcode, (SQLCHAR *)buffer, sizeof(buffer), &length) == SQL_SUCCESS) {
- ret = switch_mprintf("STATE: %s CODE %ld ERROR: %s\n", switch_str_nil(sqlstate), sqlcode, switch_str_nil(buffer));
+ ret = switch_mprintf("STATE: %s CODE %ld ERROR: %s\n", sqlstate, sqlcode, buffer);
};
return ret;
Modified: freeswitch/branches/greenlizard/src/switch_swig.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_swig.c (original)
+++ freeswitch/branches/greenlizard/src/switch_swig.c Thu Sep 6 12:57:43 2007
@@ -260,11 +260,11 @@
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
-int fs_switch_ivr_speak_text(switch_core_session_t *session, char *tts_name, char *voice_name, uint32_t rate, char *text)
+int fs_switch_ivr_speak_text(switch_core_session_t *session, char *tts_name, char *voice_name, char *text)
{
switch_status_t status;
- status = switch_ivr_speak_text(session, tts_name, voice_name, rate, text, NULL);
+ status = switch_ivr_speak_text(session, tts_name, voice_name, text, NULL);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
Modified: freeswitch/branches/greenlizard/src/switch_xml.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_xml.c (original)
+++ freeswitch/branches/greenlizard/src/switch_xml.c Thu Sep 6 12:57:43 2007
@@ -966,16 +966,16 @@
}
}
- if ((cmd = strstr(bp, "<!--#"))) {
- if(write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
- }
+ if ((cmd = strstr(bp, "<!--#"))) {
+ if(write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
+ }
if ((e = strstr(cmd, "-->"))) {
*e = '\0';
- e += 3;
- if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
- }
+ e += 3;
+ if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
+ }
} else {
ml++;
}
@@ -1031,11 +1031,11 @@
continue;
}
-
- if(write(write_fd, bp, (unsigned) cur) != (int) cur) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
- }
-
+
+ if(write(write_fd, bp, (unsigned) cur) != (int) cur) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
+ }
+
}
close(read_fd);
1
0
24 Aug '07
Author: cseket
Date: Fri Aug 24 13:53:53 2007
New Revision: 5663
Added:
freeswitch/branches/cseket/libs/portmixer/
freeswitch/branches/cseket/libs/portmixer/.update
freeswitch/branches/cseket/libs/portmixer/CVS/
freeswitch/branches/cseket/libs/portmixer/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/CVS/Entries.Log
freeswitch/branches/cseket/libs/portmixer/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/CVS/Root
freeswitch/branches/cseket/libs/portmixer/LICENSE.txt
freeswitch/branches/cseket/libs/portmixer/Makefile
freeswitch/branches/cseket/libs/portmixer/Makefile.in
freeswitch/branches/cseket/libs/portmixer/README.txt
freeswitch/branches/cseket/libs/portmixer/configure (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/configure.ac
freeswitch/branches/cseket/libs/portmixer/include/
freeswitch/branches/cseket/libs/portmixer/include/CVS/
freeswitch/branches/cseket/libs/portmixer/include/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/include/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/include/CVS/Root
freeswitch/branches/cseket/libs/portmixer/include/portmixer.h
freeswitch/branches/cseket/libs/portmixer/macproj/
freeswitch/branches/cseket/libs/portmixer/macproj/CVS/
freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Root
freeswitch/branches/cseket/libs/portmixer/portaudio.patch
freeswitch/branches/cseket/libs/portmixer/px_common/
freeswitch/branches/cseket/libs/portmixer/px_common/CVS/
freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_common/portmixer.h (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_mac/
freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/
freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_mac/px_mac.c (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_mac_core/
freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/
freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_mac_core/Makefile
freeswitch/branches/cseket/libs/portmixer/px_mac_core/px_mac_core.c (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_none/
freeswitch/branches/cseket/libs/portmixer/px_none/CVS/
freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_none/Makefile
freeswitch/branches/cseket/libs/portmixer/px_none/px_none.c (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_tests/
freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/
freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_tests/Makefile (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_tests/px_test.c (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/Makefile
freeswitch/branches/cseket/libs/portmixer/px_unix_oss/px_unix_oss.c (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Root
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/Makefile
freeswitch/branches/cseket/libs/portmixer/px_win_wmme/px_win_wmme.c (contents, props changed)
freeswitch/branches/cseket/libs/portmixer/src/
freeswitch/branches/cseket/libs/portmixer/src/CVS/
freeswitch/branches/cseket/libs/portmixer/src/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/src/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/src/CVS/Root
freeswitch/branches/cseket/libs/portmixer/src/px_example_api.c
freeswitch/branches/cseket/libs/portmixer/src/px_linux_alsa.c
freeswitch/branches/cseket/libs/portmixer/src/px_mac_coreaudio.c
freeswitch/branches/cseket/libs/portmixer/src/px_mixer.c
freeswitch/branches/cseket/libs/portmixer/src/px_mixer.h
freeswitch/branches/cseket/libs/portmixer/src/px_unix_oss.c
freeswitch/branches/cseket/libs/portmixer/src/px_win_common.c
freeswitch/branches/cseket/libs/portmixer/src/px_win_common.h
freeswitch/branches/cseket/libs/portmixer/src/px_win_ds.c
freeswitch/branches/cseket/libs/portmixer/src/px_win_wmme.c
freeswitch/branches/cseket/libs/portmixer/winproj/
freeswitch/branches/cseket/libs/portmixer/winproj/CVS/
freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Entries
freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Repository
freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Root
freeswitch/branches/cseket/libs/portmixer/winproj/portmixer.vcproj
Log:
add portmixer for setting voulme in mod_portaudio
Added: freeswitch/branches/cseket/libs/portmixer/.update
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/.update Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+Thu Aug 21 13.01.02 UTC 2007
\ No newline at end of file
Added: freeswitch/branches/cseket/libs/portmixer/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,7 @@
+/LICENSE.txt/1.1.1.1/Mon Dec 2 01:14:03 2002//
+/Makefile.in/1.1/Mon Oct 2 00:27:51 2006//
+/README.txt/1.1/Mon Oct 2 00:27:51 2006//
+/configure/1.3/Sun Jun 3 08:30:36 2007//
+/configure.ac/1.2/Sun Jun 3 08:30:36 2007//
+/portaudio.patch/1.2/Sun Jun 3 08:30:36 2007//
+D
Added: freeswitch/branches/cseket/libs/portmixer/CVS/Entries.Log
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/CVS/Entries.Log Fri Aug 24 13:53:53 2007
@@ -0,0 +1,11 @@
+A D/include////
+A D/macproj////
+A D/px_common////
+A D/px_mac////
+A D/px_mac_core////
+A D/px_none////
+A D/px_tests////
+A D/px_unix_oss////
+A D/px_win_wmme////
+A D/src////
+A D/winproj////
Added: freeswitch/branches/cseket/libs/portmixer/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer
Added: freeswitch/branches/cseket/libs/portmixer/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/LICENSE.txt
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/LICENSE.txt Fri Aug 24 13:53:53 2007
@@ -0,0 +1,75 @@
+Portable header file to contain:
+/*
+ * PortMixer
+ * PortMixer API Header File
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+Implementation files to contain:
+/*
+ * PortMixer
+ * <platform> Implementation
+ *
+ * <copyright message>
+ *
+ * <author>
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
Added: freeswitch/branches/cseket/libs/portmixer/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/Makefile Fri Aug 24 13:53:53 2007
@@ -0,0 +1,42 @@
+### PortMixer library Makefile
+
+OBJECTS = px_mixer.o
+
+LIBRARY = libportmixer.a
+
+CC = gcc
+AR = /usr/bin/ar
+RANLIB = ranlib
+
+DEFS += -DPACKAGE_NAME=\"PortMixer\" -DPACKAGE_TARNAME=\"portmixer\" -DPACKAGE_VERSION=\"2.0\" -DPACKAGE_STRING=\"PortMixer\ 2.0\" -DPACKAGE_BUGREPORT=\"audacity.sourceforge.net\" -DSTDC_HEADERS=1
+CFLAGS += -O2 -I
+CFLAGS += -Iinclude
+
+all : $(LIBRARY)
+
+tests:
+ cd tests && $(MAKE) all
+
+$(LIBRARY): $(OBJECTS)
+ $(AR) ruv $(LIBRARY) $(OBJECTS)
+ $(RANLIB) $(LIBRARY)
+
+%.o : src/%.c
+ $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@
+
+clean :
+ -rm -f $(LIBRARY)
+ -rm -f $(OBJECTS)
+
+distclean: clean
+ -$(RM) -rf config.log config.status autom4te.cache Makefile portmixer-v2
+
+dist:
+ rm -rf portmixer-v2
+ mkdir portmixer-v2
+ cp -pr include src LICENSE.txt README.txt portaudio.patch Makefile.in configure.ac configure portmixer-v2
+ tar -zcf ../portmixer-v2.tar.gz portmixer-v2
+
+strip :
+ strip $(LIBRARY)
+ ranlib $(LIBRARY)
Added: freeswitch/branches/cseket/libs/portmixer/Makefile.in
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/Makefile.in Fri Aug 24 13:53:53 2007
@@ -0,0 +1,42 @@
+### PortMixer library Makefile
+
+OBJECTS = @objects@
+
+LIBRARY = libportmixer.a
+
+CC = @CC@
+AR = @AR@
+RANLIB = @RANLIB@
+
+DEFS += @DEFS@
+CFLAGS += @cflags@
+CFLAGS += @include@
+
+all : $(LIBRARY)
+
+tests:
+ cd tests && $(MAKE) all
+
+$(LIBRARY): $(OBJECTS)
+ $(AR) ruv $(LIBRARY) $(OBJECTS)
+ $(RANLIB) $(LIBRARY)
+
+%.o : src/%.c
+ $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@
+
+clean :
+ -rm -f $(LIBRARY)
+ -rm -f $(OBJECTS)
+
+distclean: clean
+ -$(RM) -rf config.log config.status autom4te.cache Makefile portmixer-v2
+
+dist:
+ rm -rf portmixer-v2
+ mkdir portmixer-v2
+ cp -pr include src LICENSE.txt README.txt portaudio.patch Makefile.in configure.ac configure portmixer-v2
+ tar -zcf ../portmixer-v2.tar.gz portmixer-v2
+
+strip :
+ strip $(LIBRARY)
+ ranlib $(LIBRARY)
Added: freeswitch/branches/cseket/libs/portmixer/README.txt
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/README.txt Fri Aug 24 13:53:53 2007
@@ -0,0 +1,6 @@
+This is where some sort of README should be...but this is all there is for now.
+
+As of October 1st, 2006, Portaudio v2.0 (or v1.9) doesn't have the required support
+to use this version of Portmixer. To add the support, apply the portaudio.patch
+found in this direcotry.
+
Added: freeswitch/branches/cseket/libs/portmixer/configure
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/configure Fri Aug 24 13:53:53 2007
@@ -0,0 +1,4415 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for PortMixer 2.0.
+#
+# Report bugs to <audacity.sourceforge.net>.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='PortMixer'
+PACKAGE_TARNAME='portmixer'
+PACKAGE_VERSION='2.0'
+PACKAGE_STRING='PortMixer 2.0'
+PACKAGE_BUGREPORT='audacity.sourceforge.net'
+
+ac_unique_file="src"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB AR CPP EGREP cflags include objects LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures PortMixer 2.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of PortMixer 2.0:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-debug enable debug compilation
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pa-include specify path to portaudio v2.0 include directory
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <audacity.sourceforge.net>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+PortMixer configure 2.0
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by PortMixer $as_me 2.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_files="$ac_config_files Makefile"
+
+
+#
+# Checks for programs.
+#
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $AR in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_AR="$AR" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_path_AR" && ac_cv_path_AR="no"
+ ;;
+esac
+fi
+AR=$ac_cv_path_AR
+
+if test -n "$AR"; then
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if [ $AR = "no" ] ; then
+ { { echo "$as_me:$LINENO: error: \"Could not find ar - needed to create a library\"" >&5
+echo "$as_me: error: \"Could not find ar - needed to create a library\"" >&2;}
+ { (exit 1); exit 1; }; };
+fi
+
+#
+# Checks for libraries.
+#
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+#
+# Check for debug
+#
+echo "$as_me:$LINENO: checking whether to compile debug version" >&5
+echo $ECHO_N "checking whether to compile debug version... $ECHO_C" >&6
+# Check whether --enable-debug or --disable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval="$enable_debug"
+ cflags="$cflags -g"
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ cflags="$cflags -O2"
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi;
+
+#
+# Check for portaudio path
+#
+
+# Check whether --with-pa-include or --without-pa-include was given.
+if test "${with_pa_include+set}" = set; then
+ withval="$with_pa_include"
+ with_portaudio=$withval
+else
+ with_portaudio=""
+fi;
+
+#
+#
+#
+if [ with_portaudio != "" ] ; then
+ CPPFLAGS="$CPPFLAGS -I$withval"
+ cflags="$cflags -I$withval"
+
+fi
+
+#
+# Make sure the support is there
+#
+have_support=yes
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pa_win_ds.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "PaWinDS_GetStreamInputGUID" >/dev/null 2>&1; then
+ :
+#else
+# have_support=no
+fi
+rm -f conftest*
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pa_linux_alsa.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "PaAlsa_GetStreamInputCard" >/dev/null 2>&1; then
+ :
+#else
+# have_support=no
+fi
+rm -f conftest*
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pa_win_wmme.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "PaWinMME_GetStreamInputHandle" >/dev/null 2>&1; then
+ :
+#else
+# have_support=no
+fi
+rm -f conftest*
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pa_mac_core.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "PaMacCore_GetStreamInputDevice" >/dev/null 2>&1; then
+ :
+#else
+# have_support=no
+fi
+rm -f conftest*
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pa_unix_oss.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "PaOSS_GetStreamInputDevice" >/dev/null 2>&1; then
+ :
+#else
+# have_support=no
+fi
+rm -f conftest*
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <portaudio.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "Pa_GetStreamHostApiType" >/dev/null 2>&1; then
+ :
+#else
+# have_support=no
+fi
+rm -f conftest*
+
+if [ $have_support = "no" ] ; then
+ { { echo "$as_me:$LINENO: error: \"You're version of portaudio does not include required functions\"" >&5
+echo "$as_me: error: \"You're version of portaudio does not include required functions\"" >&2;}
+ { (exit 1); exit 1; }; };
+fi
+
+#
+#
+#
+include=-Iinclude
+
+objects=px_mixer.o
+
+
+#
+# Check which APIs are available
+#
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
+echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking linux/soundcard.h usability" >&5
+echo $ECHO_N "checking linux/soundcard.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <linux/soundcard.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking linux/soundcard.h presence" >&5
+echo $ECHO_N "checking linux/soundcard.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <linux/soundcard.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/soundcard.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/soundcard.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/soundcard.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/soundcard.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## --------------------------------------- ##
+## Report this to audacity.sourceforge.net ##
+## --------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
+echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_linux_soundcard_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6
+
+fi
+if test $ac_cv_header_linux_soundcard_h = yes; then
+ have_oss=yes
+else
+ have_oss=no
+fi
+
+
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking alsa/asoundlib.h usability" >&5
+echo $ECHO_N "checking alsa/asoundlib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <alsa/asoundlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking alsa/asoundlib.h presence" >&5
+echo $ECHO_N "checking alsa/asoundlib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <alsa/asoundlib.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## --------------------------------------- ##
+## Report this to audacity.sourceforge.net ##
+## --------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_alsa_asoundlib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6
+
+fi
+if test $ac_cv_header_alsa_asoundlib_h = yes; then
+ have_alsa=yes
+else
+ have_alsa=no
+fi
+
+
+if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for CoreAudio/CoreAudio.h" >&5
+echo $ECHO_N "checking for CoreAudio/CoreAudio.h... $ECHO_C" >&6
+if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_CoreAudio_CoreAudio_h" >&5
+echo "${ECHO_T}$ac_cv_header_CoreAudio_CoreAudio_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking CoreAudio/CoreAudio.h usability" >&5
+echo $ECHO_N "checking CoreAudio/CoreAudio.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <CoreAudio/CoreAudio.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking CoreAudio/CoreAudio.h presence" >&5
+echo $ECHO_N "checking CoreAudio/CoreAudio.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <CoreAudio/CoreAudio.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: CoreAudio/CoreAudio.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## --------------------------------------- ##
+## Report this to audacity.sourceforge.net ##
+## --------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for CoreAudio/CoreAudio.h" >&5
+echo $ECHO_N "checking for CoreAudio/CoreAudio.h... $ECHO_C" >&6
+if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_CoreAudio_CoreAudio_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_CoreAudio_CoreAudio_h" >&5
+echo "${ECHO_T}$ac_cv_header_CoreAudio_CoreAudio_h" >&6
+
+fi
+if test $ac_cv_header_CoreAudio_CoreAudio_h = yes; then
+ have_coreaudio=yes
+else
+ have_coreaudio=no
+fi
+
+
+
+#
+# Set up to use the identified ones
+#
+{ echo "$as_me:$LINENO: ---------------------------------------" >&5
+echo "$as_me: ---------------------------------------" >&6;};
+if [ $have_oss = "yes" ] ; then
+ { echo "$as_me:$LINENO: Including support for OSS" >&5
+echo "$as_me: Including support for OSS" >&6;};
+ cat >>confdefs.h <<\_ACEOF
+#define PX_USE_UNIX_OSS 1
+_ACEOF
+
+ objects="$objects px_unix_oss.o"
+fi
+
+if [ $have_alsa = "yes" ] ; then
+ { echo "$as_me:$LINENO: Including support for ALSA" >&5
+echo "$as_me: Including support for ALSA" >&6;};
+ cat >>confdefs.h <<\_ACEOF
+#define PX_USE_LINUX_ALSA 1
+_ACEOF
+
+ objects="$objects px_linux_alsa.o"
+fi
+
+if [ $have_coreaudio = "yes" ] ; then
+ { echo "$as_me:$LINENO: Including support for Coreaudio" >&5
+echo "$as_me: Including support for Coreaudio" >&6;};
+ cat >>confdefs.h <<\_ACEOF
+#define PX_USE_MAC_COREAUDIO 1
+_ACEOF
+
+ objects="$objects px_mac_coreaudio.o"
+fi
+{ echo "$as_me:$LINENO: ---------------------------------------" >&5
+echo "$as_me: ---------------------------------------" >&6;};
+
+#
+# Write it all out
+#
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by PortMixer $as_me 2.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf(a)gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+PortMixer config.status 2.0
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@AR@,$AR,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@cflags@,$cflags,;t t
+s,@include@,$include,;t t
+s,@objects@,$objects,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
Added: freeswitch/branches/cseket/libs/portmixer/configure.ac
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/configure.ac Fri Aug 24 13:53:53 2007
@@ -0,0 +1,104 @@
+#
+# PortMixer 2.0
+#
+
+AC_INIT(PortMixer, 2.0, audacity.sourceforge.net, portmixer)
+AC_CONFIG_SRCDIR(src)
+AC_CONFIG_FILES([Makefile])
+
+#
+# Checks for programs.
+#
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PATH_PROG(AR, ar, no)
+if [[ $AR = "no" ]] ; then
+ AC_MSG_ERROR("Could not find ar - needed to create a library");
+fi
+
+#
+# Checks for libraries.
+#
+AC_HEADER_STDC
+
+#
+# Check for debug
+#
+AC_MSG_CHECKING(whether to compile debug version)
+AC_ARG_ENABLE([debug],
+ AC_HELP_STRING([--enable-debug],
+ [enable debug compilation]),
+ [AC_SUBST( cflags, ["$cflags -g"] ) AC_MSG_RESULT(yes)],
+ [AC_SUBST( cflags, ["$cflags -O2"] ) AC_MSG_RESULT(no)])
+
+#
+# Check for portaudio path
+#
+AC_ARG_WITH([pa-include],
+ AC_HELP_STRING([--with-pa-include],
+ [specify path to portaudio v2.0 include directory]),
+ [with_portaudio=$withval],
+ [with_portaudio=""])
+
+#
+#
+#
+if [[ with_portaudio != "" ]] ; then
+ CPPFLAGS="$CPPFLAGS -I$withval"
+ AC_SUBST(cflags, ["$cflags -I$withval"] )
+fi
+
+#
+# Make sure the support is there
+#
+have_support=yes
+AC_EGREP_HEADER([PaWinDS_GetStreamInputGUID], [pa_win_ds.h], , [have_support=no])
+AC_EGREP_HEADER([PaAlsa_GetStreamInputCard], [pa_linux_alsa.h], , [have_support=no])
+AC_EGREP_HEADER([PaWinMME_GetStreamInputHandle], [pa_win_wmme.h], , [have_support=no])
+AC_EGREP_HEADER([PaMacCore_GetStreamInputDevice], [pa_mac_core.h], , [have_support=no])
+AC_EGREP_HEADER([PaOSS_GetStreamInputDevice], [pa_unix_oss.h], , [have_support=no])
+AC_EGREP_HEADER([Pa_GetStreamHostApiType], [portaudio.h], , [have_support=no])
+#if [[ $have_support = "no" ]] ; then
+# AC_MSG_ERROR("You're version of portaudio does not include required functions");
+#fi
+
+#
+#
+#
+AC_SUBST( include, [-Iinclude] )
+AC_SUBST( objects, [px_mixer.o] )
+
+#
+# Check which APIs are available
+#
+AC_CHECK_HEADER(linux/soundcard.h, have_oss=yes, have_oss=no)
+AC_CHECK_HEADER(alsa/asoundlib.h, have_alsa=yes, have_alsa=no)
+AC_CHECK_HEADER(CoreAudio/CoreAudio.h, have_coreaudio=yes, have_coreaudio=no)
+
+#
+# Set up to use the identified ones
+#
+AC_MSG_NOTICE(---------------------------------------);
+if [[ $have_oss = "yes" ]] ; then
+ AC_MSG_NOTICE(Including support for OSS);
+ AC_DEFINE(PX_USE_UNIX_OSS)
+ objects="$objects px_unix_oss.o"
+fi
+
+if [[ $have_alsa = "yes" ]] ; then
+ AC_MSG_NOTICE(Including support for ALSA);
+ AC_DEFINE(PX_USE_LINUX_ALSA)
+ objects="$objects px_linux_alsa.o"
+fi
+
+if [[ $have_coreaudio = "yes" ]] ; then
+ AC_MSG_NOTICE(Including support for Coreaudio);
+ AC_DEFINE(PX_USE_MAC_COREAUDIO)
+ objects="$objects px_mac_coreaudio.o"
+fi
+AC_MSG_NOTICE(---------------------------------------);
+
+#
+# Write it all out
+#
+AC_OUTPUT
Added: freeswitch/branches/cseket/libs/portmixer/include/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/include/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,2 @@
+/portmixer.h/1.2/Wed Jul 11 06:16:15 2007//
+D
Added: freeswitch/branches/cseket/libs/portmixer/include/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/include/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/include
Added: freeswitch/branches/cseket/libs/portmixer/include/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/include/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/include/portmixer.h
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/include/portmixer.h Fri Aug 24 13:53:53 2007
@@ -0,0 +1,139 @@
+#ifndef PORT_MIXER_H
+#define PORT_MIXER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/*
+ * PortMixer
+ * PortMixer API Header File
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "portaudio.h"
+
+typedef void PxMixer;
+
+typedef float PxVolume; /* 0.0 (min) --> 1.0 (max) */
+typedef float PxBalance; /* -1.0 (left) --> 1.0 (right) */
+
+/*
+ Px_OpenMixer() returns a mixer which will work with the given PortAudio
+ audio device. Pass 0 as the index for the first (default) mixer.
+*/
+
+PxMixer *Px_OpenMixer( void *pa_stream, int i );
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer( PxMixer *mixer );
+
+/*
+ Px_GetNumMixers returns the number of mixers which could be
+ used with the given PortAudio device. On most systems, there
+ will be only one mixer for each device; however there may be
+ multiple mixers for each device, or possibly multiple mixers
+ which are independent of any particular PortAudio device.
+*/
+
+int Px_GetNumMixers( PxMixer *mixer );
+const char *Px_GetMixerName( PxMixer *mixer, int i );
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer );
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume );
+
+/*
+ Main output volume
+*/
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer );
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume );
+int Px_SupportsPCMOutputVolume( PxMixer* mixer ) ;
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer );
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i );
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i );
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume );
+
+/*
+ Input source
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer );
+const char *Px_GetInputSourceName( PxMixer *mixer, int i);
+int Px_GetCurrentInputSource( PxMixer *mixer ); /* may return -1 == none */
+void Px_SetCurrentInputSource( PxMixer *mixer, int i );
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer );
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume );
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer );
+PxBalance Px_GetOutputBalance( PxMixer *mixer );
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance );
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer );
+PxVolume Px_GetPlaythrough( PxMixer *mixer );
+void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* PORT_AUDIO_H */
Added: freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+D
Added: freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/macproj
Added: freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/macproj/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/portaudio.patch
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/portaudio.patch Fri Aug 24 13:53:53 2007
@@ -0,0 +1,1239 @@
+#
+# This patch applies to portaudio v19 source as of 2007-jun-01.
+#
+diff -ruN pa/build/msvc/PAStaticWMMEv19.vcproj pam/build/msvc/PAStaticWMMEv19.vcproj
+--- pa/build/msvc/PAStaticWMMEv19.vcproj 1969-12-31 18:00:00.000000000 -0600
++++ pam/build/msvc/PAStaticWMMEv19.vcproj 2007-06-03 06:23:38.000000000 -0500
+@@ -0,0 +1,774 @@
++<?xml version="1.0" encoding="Windows-1252"?>
++<VisualStudioProject
++ ProjectType="Visual C++"
++ Version="8.00"
++ Name="PAStaticWMMEv19"
++ ProjectGUID="{7ABA0F80-94AE-4E82-AB89-2E1258212D59}"
++ RootNamespace="PAStaticWMMEv19"
++ >
++ <Platforms>
++ <Platform
++ Name="Win32"
++ />
++ </Platforms>
++ <ToolFiles>
++ </ToolFiles>
++ <Configurations>
++ <Configuration
++ Name="Release|Win32"
++ OutputDirectory="$(ConfigurationName)"
++ IntermediateDirectory="$(ConfigurationName)"
++ ConfigurationType="4"
++ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
++ UseOfMFC="0"
++ ATLMinimizesCRunTimeLibraryUsage="false"
++ CharacterSet="2"
++ >
++ <Tool
++ Name="VCPreBuildEventTool"
++ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>".\$(ConfigurationName)\config.h"
IF "%ASIOSDK_DIR%" == "" echo #define PA_NO_ASIO >>".\$(ConfigurationName)\config.h"
"
++ />
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ <Tool
++ Name="VCXMLDataGeneratorTool"
++ />
++ <Tool
++ Name="VCWebServiceProxyGeneratorTool"
++ />
++ <Tool
++ Name="VCMIDLTool"
++ />
++ <Tool
++ Name="VCCLCompilerTool"
++ AdditionalOptions="/O2"
++ Optimization="2"
++ InlineFunctionExpansion="1"
++ AdditionalIncludeDirectories="../../include;../../src/common"
++ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
++ StringPooling="true"
++ RuntimeLibrary="0"
++ EnableFunctionLevelLinking="true"
++ UsePrecompiledHeader="0"
++ PrecompiledHeaderFile=".\$(ConfigurationName)/PA19StaticWMME.pch"
++ AssemblerListingLocation=".\$(ConfigurationName)/"
++ ObjectFile=".\$(ConfigurationName)/"
++ ProgramDataBaseFileName=".\$(ConfigurationName)/"
++ WarningLevel="3"
++ SuppressStartupBanner="true"
++ CompileAs="0"
++ DisableSpecificWarnings="4996"
++ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
++ />
++ <Tool
++ Name="VCManagedResourceCompilerTool"
++ />
++ <Tool
++ Name="VCResourceCompilerTool"
++ PreprocessorDefinitions="NDEBUG"
++ Culture="1032"
++ />
++ <Tool
++ Name="VCPreLinkEventTool"
++ />
++ <Tool
++ Name="VCLibrarianTool"
++ OutputFile="$(SolutionDir)\$(ConfigurationName)\pastaticwmmev19.lib"
++ SuppressStartupBanner="true"
++ />
++ <Tool
++ Name="VCALinkTool"
++ />
++ <Tool
++ Name="VCXDCMakeTool"
++ />
++ <Tool
++ Name="VCBscMakeTool"
++ />
++ <Tool
++ Name="VCFxCopTool"
++ />
++ <Tool
++ Name="VCPostBuildEventTool"
++ CommandLine="set CFLAGS=/I "../../include" /I "../../src/common" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /O2 /Ob1 /GF /FD /EHsc /MT /Gy /W3 /c /wd4996 /nologo /Fo".\$(OutDir)/" /Fd".\$(OutDir)/"
set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds.c"
cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

if "%ASIOSDK_DIR%"=="" goto NoASIO

cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\pa_asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\iasiothiscallresolver.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\common\asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\asiodrivers.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\pc\asiolist.cpp"

:NoASIO

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
++ />
++ </Configuration>
++ <Configuration
++ Name="Debug|Win32"
++ OutputDirectory="$(ConfigurationName)"
++ IntermediateDirectory="$(ConfigurationName)"
++ ConfigurationType="4"
++ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
++ UseOfMFC="0"
++ ATLMinimizesCRunTimeLibraryUsage="false"
++ CharacterSet="2"
++ >
++ <Tool
++ Name="VCPreBuildEventTool"
++ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>".\$(ConfigurationName)\config.h"
IF "%ASIOSDK_DIR%" == "" echo #define PA_NO_ASIO >>".\$(ConfigurationName)\config.h"
"
++ />
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ <Tool
++ Name="VCXMLDataGeneratorTool"
++ />
++ <Tool
++ Name="VCWebServiceProxyGeneratorTool"
++ />
++ <Tool
++ Name="VCMIDLTool"
++ />
++ <Tool
++ Name="VCCLCompilerTool"
++ Optimization="0"
++ AdditionalIncludeDirectories="../../include;../../src/common"
++ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
++ BasicRuntimeChecks="3"
++ RuntimeLibrary="1"
++ UsePrecompiledHeader="0"
++ PrecompiledHeaderFile=".\$(ConfigurationName)/PA19StaticWMME.pch"
++ AssemblerListingLocation=".\$(ConfigurationName)/"
++ ObjectFile=".\$(ConfigurationName)/"
++ ProgramDataBaseFileName=".\$(ConfigurationName)/"
++ WarningLevel="3"
++ SuppressStartupBanner="true"
++ DebugInformationFormat="4"
++ CompileAs="0"
++ DisableSpecificWarnings="4996"
++ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
++ />
++ <Tool
++ Name="VCManagedResourceCompilerTool"
++ />
++ <Tool
++ Name="VCResourceCompilerTool"
++ PreprocessorDefinitions="_DEBUG"
++ Culture="1032"
++ />
++ <Tool
++ Name="VCPreLinkEventTool"
++ />
++ <Tool
++ Name="VCLibrarianTool"
++ OutputFile="$(SolutionDir)\$(ConfigurationName)\pastaticwmmev19d.lib"
++ SuppressStartupBanner="true"
++ />
++ <Tool
++ Name="VCALinkTool"
++ />
++ <Tool
++ Name="VCXDCMakeTool"
++ />
++ <Tool
++ Name="VCBscMakeTool"
++ />
++ <Tool
++ Name="VCFxCopTool"
++ />
++ <Tool
++ Name="VCPostBuildEventTool"
++ CommandLine="set CFLAGS= /I "../../include" /I "../../src/common" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /Od /FD /EHsc /RTC1 /MTd /W3 /c /ZI /wd4996 /nologo /Fo".\$(OutDir)/" /Fd".\$(OutDir)/"
set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds.c"
cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

if "%ASIOSDK_DIR%"=="" goto NoASIO

cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\pa_asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\iasiothiscallresolver.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\common\asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\asiodrivers.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\pc\asiolist.cpp"

:NoASIO

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
++ />
++ </Configuration>
++ <Configuration
++ Name="Unicode_Debug|Win32"
++ OutputDirectory="$(ConfigurationName)"
++ IntermediateDirectory="$(ConfigurationName)"
++ ConfigurationType="4"
++ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
++ UseOfMFC="0"
++ ATLMinimizesCRunTimeLibraryUsage="false"
++ CharacterSet="0"
++ >
++ <Tool
++ Name="VCPreBuildEventTool"
++ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>".\$(ConfigurationName)\config.h"
IF "%ASIOSDK_DIR%" == "" echo #define PA_NO_ASIO >>".\$(ConfigurationName)\config.h"
"
++ />
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ <Tool
++ Name="VCXMLDataGeneratorTool"
++ />
++ <Tool
++ Name="VCWebServiceProxyGeneratorTool"
++ />
++ <Tool
++ Name="VCMIDLTool"
++ />
++ <Tool
++ Name="VCCLCompilerTool"
++ Optimization="0"
++ AdditionalIncludeDirectories="../../include;../../src/common"
++ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
++ BasicRuntimeChecks="3"
++ RuntimeLibrary="1"
++ UsePrecompiledHeader="0"
++ PrecompiledHeaderFile=".\$(ConfigurationName)/PA19StaticWMME.pch"
++ AssemblerListingLocation=".\$(ConfigurationName)/"
++ ObjectFile=".\$(ConfigurationName)/"
++ ProgramDataBaseFileName=".\$(ConfigurationName)/"
++ WarningLevel="3"
++ SuppressStartupBanner="true"
++ DebugInformationFormat="4"
++ CompileAs="0"
++ DisableSpecificWarnings="4996"
++ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
++ />
++ <Tool
++ Name="VCManagedResourceCompilerTool"
++ />
++ <Tool
++ Name="VCResourceCompilerTool"
++ PreprocessorDefinitions="_DEBUG"
++ Culture="1032"
++ />
++ <Tool
++ Name="VCPreLinkEventTool"
++ />
++ <Tool
++ Name="VCLibrarianTool"
++ OutputFile="$(SolutionDir)\$(ConfigurationName)\pastaticwmmev19ud.lib"
++ SuppressStartupBanner="true"
++ />
++ <Tool
++ Name="VCALinkTool"
++ />
++ <Tool
++ Name="VCXDCMakeTool"
++ />
++ <Tool
++ Name="VCBscMakeTool"
++ />
++ <Tool
++ Name="VCFxCopTool"
++ />
++ <Tool
++ Name="VCPostBuildEventTool"
++ CommandLine="set CFLAGS= /I "../../include" /I "../../src/common" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /Od /FD /EHsc /RTC1 /MTd /W3 /c /ZI /wd4996 /nologo /Fo".\$(OutDir)/" /Fd".\$(OutDir)/"
set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds.c"
cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

if "%ASIOSDK_DIR%"=="" goto NoASIO

cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\pa_asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\iasiothiscallresolver.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\common\asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\asiodrivers.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\pc\asiolist.cpp"

:NoASIO

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
++ />
++ </Configuration>
++ <Configuration
++ Name="Unicode_Release|Win32"
++ OutputDirectory="$(ConfigurationName)"
++ IntermediateDirectory="$(ConfigurationName)"
++ ConfigurationType="4"
++ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
++ UseOfMFC="0"
++ ATLMinimizesCRunTimeLibraryUsage="false"
++ CharacterSet="0"
++ >
++ <Tool
++ Name="VCPreBuildEventTool"
++ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>".\$(ConfigurationName)\config.h"
IF "%ASIOSDK_DIR%" == "" echo #define PA_NO_ASIO >>".\$(ConfigurationName)\config.h"
"
++ />
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ <Tool
++ Name="VCXMLDataGeneratorTool"
++ />
++ <Tool
++ Name="VCWebServiceProxyGeneratorTool"
++ />
++ <Tool
++ Name="VCMIDLTool"
++ />
++ <Tool
++ Name="VCCLCompilerTool"
++ AdditionalOptions="/O2"
++ Optimization="2"
++ InlineFunctionExpansion="1"
++ AdditionalIncludeDirectories="../../include;../../src/common"
++ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
++ StringPooling="true"
++ RuntimeLibrary="0"
++ EnableFunctionLevelLinking="true"
++ UsePrecompiledHeader="0"
++ PrecompiledHeaderFile=".\$(ConfigurationName)/PA19StaticWMME.pch"
++ AssemblerListingLocation=".\$(ConfigurationName)/"
++ ObjectFile=".\$(ConfigurationName)/"
++ ProgramDataBaseFileName=".\$(ConfigurationName)/"
++ WarningLevel="3"
++ SuppressStartupBanner="true"
++ CompileAs="0"
++ DisableSpecificWarnings="4996"
++ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
++ />
++ <Tool
++ Name="VCManagedResourceCompilerTool"
++ />
++ <Tool
++ Name="VCResourceCompilerTool"
++ PreprocessorDefinitions="NDEBUG"
++ Culture="1032"
++ />
++ <Tool
++ Name="VCPreLinkEventTool"
++ />
++ <Tool
++ Name="VCLibrarianTool"
++ OutputFile="$(SolutionDir)\$(ConfigurationName)\pastaticwmmev19u.lib"
++ SuppressStartupBanner="true"
++ />
++ <Tool
++ Name="VCALinkTool"
++ />
++ <Tool
++ Name="VCXDCMakeTool"
++ />
++ <Tool
++ Name="VCBscMakeTool"
++ />
++ <Tool
++ Name="VCFxCopTool"
++ />
++ <Tool
++ Name="VCPostBuildEventTool"
++ CommandLine="set CFLAGS=/I "../../include" /I "../../src/common" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /O2 /Ob1 /GF /FD /EHsc /MT /Gy /W3 /c /wd4996 /nologo /Fo".\$(OutDir)/" /Fd".\$(OutDir)/"
set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds.c"
cl %CFLAGS% /I "%DXSDK_DIR%include" "..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

if "%ASIOSDK_DIR%"=="" goto NoASIO

cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\pa_asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "..\..\src\hostapi\asio\iasiothiscallresolver.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\common\asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\asiodrivers.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%\host\pc\asiolist.cpp"

:NoASIO

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
++ />
++ </Configuration>
++ </Configurations>
++ <References>
++ </References>
++ <Files>
++ <Filter
++ Name="Source Files"
++ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
++ >
++ <Filter
++ Name="common"
++ >
++ <File
++ RelativePath="..\..\src\common\pa_allocation.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_allocation.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_converters.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_converters.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_cpuload.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_cpuload.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_dither.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_dither.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_endianness.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_front.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_hostapi.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_process.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_process.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_skeleton.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_stream.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_stream.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_trace.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_trace.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_types.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\common\pa_util.h"
++ >
++ </File>
++ </Filter>
++ <Filter
++ Name="hostapi"
++ >
++ <Filter
++ Name="wmme"
++ >
++ <File
++ RelativePath="..\..\src\hostapi\wmme\pa_win_wmme.c"
++ >
++ </File>
++ </Filter>
++ <Filter
++ Name="wdmks"
++ >
++ <File
++ RelativePath="..\..\src\hostapi\wdmks\pa_win_wdmks.c"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ </File>
++ </Filter>
++ <Filter
++ Name="dsound"
++ >
++ <File
++ RelativePath="..\..\src\hostapi\dsound\pa_win_ds.c"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ </File>
++ <File
++ RelativePath="..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ </File>
++ <File
++ RelativePath="..\..\src\hostapi\dsound\pa_win_ds_dynlink.h"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ </File>
++ </Filter>
++ <Filter
++ Name="asio"
++ >
++ <File
++ RelativePath="..\..\src\hostapi\asio\iasiothiscallresolver.cpp"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ </File>
++ <File
++ RelativePath="..\..\src\hostapi\asio\iasiothiscallresolver.h"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ </File>
++ <File
++ RelativePath="..\..\src\hostapi\asio\pa_asio.cpp"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCLCompilerTool"
++ />
++ </FileConfiguration>
++ </File>
++ </Filter>
++ </Filter>
++ <Filter
++ Name="os"
++ >
++ <File
++ RelativePath="..\..\src\os\win\pa_win_hostapis.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\os\win\pa_win_util.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\os\win\pa_x86_plain_converters.c"
++ >
++ </File>
++ <File
++ RelativePath="..\..\src\os\win\pa_x86_plain_converters.h"
++ >
++ </File>
++ </Filter>
++ </Filter>
++ <Filter
++ Name="Public Headers"
++ Filter="h;hpp;hxx;hm;inl"
++ >
++ <File
++ RelativePath="..\..\include\pa_win_ds.h"
++ >
++ <FileConfiguration
++ Name="Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Debug|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ <FileConfiguration
++ Name="Unicode_Release|Win32"
++ ExcludedFromBuild="true"
++ >
++ <Tool
++ Name="VCCustomBuildTool"
++ />
++ </FileConfiguration>
++ </File>
++ <File
++ RelativePath="..\..\include\pa_win_wmme.h"
++ >
++ </File>
++ <File
++ RelativePath="..\..\include\portaudio.h"
++ >
++ </File>
++ </Filter>
++ </Files>
++ <Globals>
++ </Globals>
++</VisualStudioProject>
+diff -ruN pa/include/pa_unix_oss.h pam/include/pa_unix_oss.h
+--- pa/include/pa_unix_oss.h 1969-12-31 18:00:00.000000000 -0600
++++ pam/include/pa_unix_oss.h 2007-06-03 06:41:57.000000000 -0500
+@@ -0,0 +1,104 @@
++#ifndef PA_UNIX_OSS_H
++#define PA_UNIX_OSS_H
++
++/*
++ * $Id: portaudio.patch,v 1.2 2007/06/03 08:30:36 llucius Exp $
++ * PortAudio Portable Real-Time Audio Library
++ * OSS-specific extensions
++ *
++ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files
++ * (the "Software"), to deal in the Software without restriction,
++ * including without limitation the rights to use, copy, modify, merge,
++ * publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so,
++ * subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * Any person wishing to distribute modifications to the Software is
++ * requested to send the modifications to the original developer so that
++ * they can be incorporated into the canonical version.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ *
++ */
++
++/** @file
++ * OSS-specific PortAudio API extension header file.
++ */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++const char *PaOSS_GetStreamInputDevice( PaStream *s );
++
++const char *PaOSS_GetStreamOutputDevice( PaStream *s );
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++#ifndef PA_UNIX_OSS_H
++#define PA_UNIX_OSS_H
++
++/*
++ * $Id: portaudio.patch,v 1.2 2007/06/03 08:30:36 llucius Exp $
++ * PortAudio Portable Real-Time Audio Library
++ * OSS-specific extensions
++ *
++ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files
++ * (the "Software"), to deal in the Software without restriction,
++ * including without limitation the rights to use, copy, modify, merge,
++ * publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so,
++ * subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * Any person wishing to distribute modifications to the Software is
++ * requested to send the modifications to the original developer so that
++ * they can be incorporated into the canonical version.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ *
++ */
++
++/** @file
++ * OSS-specific PortAudio API extension header file.
++ */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++const char *PaOSS_GetStreamInputDevice( PaStream *s );
++
++const char *PaOSS_GetStreamOutputDevice( PaStream *s );
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff -ruN pa/include/pa_win_ds.h pam/include/pa_win_ds.h
+--- pa/include/pa_win_ds.h 1969-12-31 18:00:00.000000000 -0600
++++ pam/include/pa_win_ds.h 2007-06-03 06:41:57.000000000 -0500
+@@ -0,0 +1,138 @@
++#ifndef PA_WIN_DS_H
++#define PA_WIN_DS_H
++/*
++ * $Id: portaudio.patch,v 1.2 2007/06/03 08:30:36 llucius Exp $
++ * PortAudio Portable Real-Time Audio Library
++ * DirectSound specific extensions
++ *
++ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files
++ * (the "Software"), to deal in the Software without restriction,
++ * including without limitation the rights to use, copy, modify, merge,
++ * publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so,
++ * subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * Any person wishing to distribute modifications to the Software is
++ * requested to send the modifications to the original developer so that
++ * they can be incorporated into the canonical version.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ *
++ */
++
++/** @file
++ @brief DirectSound-specific PortAudio API extension header file.
++*/
++
++
++#include "portaudio.h"
++
++#ifdef __cplusplus
++extern "C"
++{
++#endif /* __cplusplus */
++
++
++/** Retrieve the GUID of the input device.
++
++ @param stream The stream to query.
++
++ @return A pointer to the GUID, or NULL if none.
++*/
++LPGUID PaWinDS_GetStreamInputGUID( PaStream* s );
++
++
++/** Retrieve the GUID of the output device.
++
++ @param stream The stream to query.
++
++ @return A pointer to the GUID, or NULL if none.
++*/
++LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s );
++
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
++
++#endif /* PA_WIN_DS_H */
++#ifndef PA_WIN_DS_H
++#define PA_WIN_DS_H
++/*
++ * $Id: portaudio.patch,v 1.2 2007/06/03 08:30:36 llucius Exp $
++ * PortAudio Portable Real-Time Audio Library
++ * DirectSound specific extensions
++ *
++ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files
++ * (the "Software"), to deal in the Software without restriction,
++ * including without limitation the rights to use, copy, modify, merge,
++ * publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so,
++ * subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * Any person wishing to distribute modifications to the Software is
++ * requested to send the modifications to the original developer so that
++ * they can be incorporated into the canonical version.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ *
++ */
++
++/** @file
++ @brief DirectSound-specific PortAudio API extension header file.
++*/
++
++
++#include "portaudio.h"
++
++#ifdef __cplusplus
++extern "C"
++{
++#endif /* __cplusplus */
++
++
++/** Retrieve the GUID of the input device.
++
++ @param stream The stream to query.
++
++ @return A pointer to the GUID, or NULL if none.
++*/
++LPGUID PaWinDS_GetStreamInputGUID( PaStream* s );
++
++
++/** Retrieve the GUID of the output device.
++
++ @param stream The stream to query.
++
++ @return A pointer to the GUID, or NULL if none.
++*/
++LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s );
++
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
++
++#endif /* PA_WIN_DS_H */
+diff -ruN pa/include/portaudio.h pam/include/portaudio.h
+--- pa/include/portaudio.h 2007-06-03 05:55:55.000000000 -0500
++++ pam/include/portaudio.h 2007-06-03 06:41:57.000000000 -0500
+@@ -1106,6 +1106,15 @@
+ signed long Pa_GetStreamWriteAvailable( PaStream* stream );
+
+
++/** Retrieve the host type handling an open stream.
++
++ @return Returns a non-negative value representing the host API type
++ handling an open stream or, a PaErrorCode (which are always negative)
++ if PortAudio is not initialized or an error is encountered.
++*/
++PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream );
++
++
+ /* Miscellaneous utilities */
+
+
+diff -ruN pa/src/common/pa_front.c pam/src/common/pa_front.c
+--- pa/src/common/pa_front.c 2007-06-03 05:56:15.000000000 -0500
++++ pam/src/common/pa_front.c 2007-06-03 06:41:57.000000000 -0500
+@@ -1315,8 +1315,10 @@
+ hostApiInputParametersPtr, hostApiOutputParametersPtr,
+ sampleRate, framesPerBuffer, streamFlags, streamCallback, userData );
+
+- if( result == paNoError )
++ if( result == paNoError ) {
+ AddOpenStream( *stream );
++ PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type;
++ }
+
+
+ #ifdef PA_LOG_API_CALLS
+@@ -1908,6 +1910,32 @@
+ return result;
+ }
+
++PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream )
++{
++ PaError error = PaUtil_ValidateStreamPointer( stream );
++ PaHostApiTypeId result;
++
++#ifdef PA_LOG_API_CALLS
++ PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" );
++ PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
++#endif
++
++ if( error == paNoError )
++ {
++ result = PA_STREAM_REP(stream)->hostApiType;
++ }
++ else
++ {
++ result = (PaHostApiTypeId) error;
++ }
++
++#ifdef PA_LOG_API_CALLS
++ PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" );
++ PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
++#endif
++
++ return result;
++}
+
+ PaError Pa_GetSampleSize( PaSampleFormat format )
+ {
+diff -ruN pa/src/common/pa_stream.c pam/src/common/pa_stream.c
+--- pa/src/common/pa_stream.c 2007-06-03 05:56:15.000000000 -0500
++++ pam/src/common/pa_stream.c 2007-06-03 06:41:57.000000000 -0500
+@@ -93,6 +93,8 @@
+ streamRepresentation->streamInfo.inputLatency = 0.;
+ streamRepresentation->streamInfo.outputLatency = 0.;
+ streamRepresentation->streamInfo.sampleRate = 0.;
++
++ streamRepresentation->hostApiType = 0;
+ }
+
+
+diff -ruN pa/src/common/pa_stream.h pam/src/common/pa_stream.h
+--- pa/src/common/pa_stream.h 2007-06-03 05:56:15.000000000 -0500
++++ pam/src/common/pa_stream.h 2007-06-03 06:41:57.000000000 -0500
+@@ -152,6 +152,7 @@
+ PaStreamFinishedCallback *streamFinishedCallback;
+ void *userData;
+ PaStreamInfo streamInfo;
++ PaHostApiTypeId hostApiType;
+ } PaUtilStreamRepresentation;
+
+
+diff -ruN pa/src/hostapi/coreaudio/pa_mac_core_blocking.c pam/src/hostapi/coreaudio/pa_mac_core_blocking.c
+--- pa/src/hostapi/coreaudio/pa_mac_core_blocking.c 2007-06-03 05:56:06.000000000 -0500
++++ pam/src/hostapi/coreaudio/pa_mac_core_blocking.c 2007-06-03 06:41:57.000000000 -0500
+@@ -66,6 +66,9 @@
+ #ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS
+ # define OSAtomicOr32( a, b ) ( (*(b)) |= (a) )
+ # define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) )
++#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
++# define OSAtomicOr32( a, b ) BitOrAtomic( a, (UInt32 *) b )
++# define OSAtomicAnd32( a, b ) BitAndAtomic( a, (UInt32 *) b )
+ #else
+ # include <libkern/OSAtomic.h>
+ #endif
+diff -ruN pa/src/hostapi/dsound/pa_win_ds.c pam/src/hostapi/dsound/pa_win_ds.c
+--- pa/src/hostapi/dsound/pa_win_ds.c 2007-06-03 05:56:11.000000000 -0500
++++ pam/src/hostapi/dsound/pa_win_ds.c 2007-06-03 06:41:57.000000000 -0500
+@@ -198,6 +198,7 @@
+ /* DirectSound specific data. */
+
+ /* Output */
++ LPGUID pOutputGuid;
+ LPDIRECTSOUND pDirectSound;
+ LPDIRECTSOUNDBUFFER pDirectSoundOutputBuffer;
+ DWORD outputBufferWriteOffsetBytes; /* last write position */
+@@ -213,6 +214,7 @@
+ double dsw_framesWritten;
+ double framesPlayed;
+ /* Input */
++ LPGUID pInputGuid;
+ LPDIRECTSOUNDCAPTURE pDirectSoundCapture;
+ LPDIRECTSOUNDCAPTUREBUFFER pDirectSoundInputBuffer;
+ INT bytesPerInputFrame;
+@@ -1267,8 +1269,8 @@
+ PaWinDsHostApiRepresentation *winDsHostApi = (PaWinDsHostApiRepresentation*)hostApi;
+ PaWinDsStream *stream = 0;
+ int inputChannelCount, outputChannelCount;
+- PaSampleFormat inputSampleFormat, outputSampleFormat;
+- PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat;
++ PaSampleFormat inputSampleFormat = 0, outputSampleFormat = 0;
++ PaSampleFormat hostInputSampleFormat = 0, hostOutputSampleFormat = 0;
+ unsigned long suggestedInputLatencyFrames, suggestedOutputLatencyFrames;
+
+ if( inputParameters )
+@@ -1486,6 +1488,11 @@
+ goto error;
+ }
+
++ stream->pOutputGuid = winDsHostApi->winDsDeviceInfos[outputParameters->device].lpGUID;
++ if( stream->pOutputGuid == NULL )
++ {
++ stream->pOutputGuid = (GUID *) &DSDEVID_DefaultPlayback;
++ }
+
+ hr = paWinDsDSoundEntryPoints.DirectSoundCreate( winDsHostApi->winDsDeviceInfos[outputParameters->device].lpGUID,
+ &stream->pDirectSound, NULL );
+@@ -1532,6 +1539,12 @@
+ goto error;
+ }
+
++ stream->pInputGuid = winDsHostApi->winDsDeviceInfos[inputParameters->device].lpGUID;
++ if( stream->pInputGuid == NULL )
++ {
++ stream->pInputGuid = (GUID *)&DSDEVID_DefaultCapture;
++ }
++
+ hr = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( winDsHostApi->winDsDeviceInfos[inputParameters->device].lpGUID,
+ &stream->pDirectSoundCapture, NULL );
+ if( hr != DS_OK )
+@@ -2193,4 +2206,19 @@
+ }
+
+
++/***********************************************************************************/
++LPGUID PaWinDS_GetStreamInputGUID( PaStream* s )
++{
++ PaWinDsStream *stream = (PaWinDsStream*)s;
+
++ return stream->pInputGuid;
++}
++
++
++/***********************************************************************************/
++LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s )
++{
++ PaWinDsStream *stream = (PaWinDsStream*)s;
++
++ return stream->pOutputGuid;
++}
+diff -ruN pa/src/hostapi/oss/pa_unix_oss.c pam/src/hostapi/oss/pa_unix_oss.c
+--- pa/src/hostapi/oss/pa_unix_oss.c 2007-06-03 05:55:58.000000000 -0500
++++ pam/src/hostapi/oss/pa_unix_oss.c 2007-06-03 06:41:57.000000000 -0500
+@@ -1942,3 +1942,26 @@
+ return (PaOssStreamComponent_BufferSize( stream->playback ) - delay) / PaOssStreamComponent_FrameSize( stream->playback );
+ }
+
++const char *PaOSS_GetStreamInputDevice( PaStream* s )
++{
++ PaOssStream *stream = (PaOssStream*)s;
++
++ if( stream->capture )
++ {
++ return stream->capture->devName;
++ }
++
++ return NULL;
++}
++
++const char *PaOSS_GetStreamOutputDevice( PaStream* s )
++{
++ PaOssStream *stream = (PaOssStream*)s;
++
++ if( stream->playback )
++ {
++ return stream->playback->devName;
++ }
++
++ return NULL;
++}
Added: freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,2 @@
+/portmixer.h/1.2/Tue Jun 15 07:59:34 2004//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_common
Added: freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_common/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_common/portmixer.h
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_common/portmixer.h Fri Aug 24 13:53:53 2007
@@ -0,0 +1,138 @@
+#ifndef PORT_MIXER_H
+#define PORT_MIXER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/*
+ * PortMixer
+ * PortMixer API Header File
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "portaudio.h"
+
+typedef void PxMixer;
+
+typedef float PxVolume; /* 0.0 (min) --> 1.0 (max) */
+typedef float PxBalance; /* -1.0 (left) --> 1.0 (right) */
+
+/*
+ Px_GetNumMixers returns the number of mixers which could be
+ used with the given PortAudio device. On most systems, there
+ will be only one mixer for each device; however there may be
+ multiple mixers for each device, or possibly multiple mixers
+ which are independent of any particular PortAudio device.
+*/
+
+int Px_GetNumMixers( void *pa_stream );
+const char *Px_GetMixerName( void *pa_stream, int i );
+
+/*
+ Px_OpenMixer() returns a mixer which will work with the given PortAudio
+ audio device. Pass 0 as the index for the first (default) mixer.
+*/
+
+PxMixer *Px_OpenMixer( void *pa_stream, int i );
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer);
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer );
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume );
+
+/*
+ Main output volume
+*/
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer );
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume );
+int Px_SupportsPCMOutputVolume( PxMixer* mixer ) ;
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer );
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i );
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i );
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume );
+
+/*
+ Input source
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer );
+const char *Px_GetInputSourceName( PxMixer *mixer, int i);
+int Px_GetCurrentInputSource( PxMixer *mixer ); /* may return -1 == none */
+void Px_SetCurrentInputSource( PxMixer *mixer, int i );
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer );
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume );
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer );
+PxBalance Px_GetOutputBalance( PxMixer *mixer );
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance );
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer );
+PxVolume Px_GetPlaythrough( PxMixer *mixer );
+void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* PORT_AUDIO_H */
Added: freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,2 @@
+/px_mac.c/1.2/Tue Jun 15 07:59:35 2004//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_mac
Added: freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_mac/px_mac.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac/px_mac.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,406 @@
+/*
+ * PortMixer
+ * Mac OS 9 implementation
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "portaudio.h"
+#include "pa_host.h"
+#include "portmixer.h"
+
+#define PA_MAX_NUM_HOST_BUFFERS (16) /* Do not exceed!! */
+
+typedef struct MultiBuffer
+{
+ char *buffers[PA_MAX_NUM_HOST_BUFFERS];
+ int numBuffers;
+ int nextWrite;
+ int nextRead;
+}
+MultiBuffer;
+
+/* Define structure to contain all Macintosh specific data. */
+typedef struct PaHostSoundControl
+{
+ UInt64 pahsc_EntryCount;
+ double pahsc_InverseMicrosPerHostBuffer; /* 1/Microseconds of real-time audio per user buffer. */
+
+ /* Use char instead of Boolean for atomic operation. */
+ volatile char pahsc_IsRecording; /* Recording in progress. Set by foreground. Cleared by background. */
+ volatile char pahsc_StopRecording; /* Signal sent to background. */
+ volatile char pahsc_IfInsideCallback;
+ /* Input */
+ SPB pahsc_InputParams;
+ SICompletionUPP pahsc_InputCompletionProc;
+ MultiBuffer pahsc_InputMultiBuffer;
+ int32 pahsc_BytesPerInputHostBuffer;
+ int32 pahsc_InputRefNum;
+ /* Output */
+ CmpSoundHeader pahsc_SoundHeaders[PA_MAX_NUM_HOST_BUFFERS];
+ int32 pahsc_BytesPerOutputHostBuffer;
+ SndChannelPtr pahsc_Channel;
+ SndCallBackUPP pahsc_OutputCompletionProc;
+ int32 pahsc_NumOutsQueued;
+ int32 pahsc_NumOutsPlayed;
+ PaTimestamp pahsc_NumFramesDone;
+ UInt64 pahsc_WhenFramesDoneIncremented;
+ /* Init Time -------------- */
+ int32 pahsc_NumHostBuffers;
+ int32 pahsc_FramesPerHostBuffer;
+ int32 pahsc_UserBuffersPerHostBuffer;
+ int32 pahsc_MinFramesPerHostBuffer; /* Can vary depending on virtual memory usage. */
+}
+PaHostSoundControl;
+
+typedef struct PxSource
+{
+ char name[256];
+} PxSource;
+
+typedef struct PxInfo
+{
+ SPB *input;
+ int32 inputRefNum;
+ SndChannelPtr output;
+ int32 numSources;
+ PxSource *sources;
+} PxInfo;
+
+int Px_GetNumMixers( void *pa_stream )
+{
+ return 0;
+}
+
+const char *Px_GetMixerName( void *pa_stream, int index )
+{
+ return "Mac Sound Manager";
+}
+
+PxMixer *Px_OpenMixer( void *pa_stream, int index )
+{
+ PxInfo *info;
+ internalPortAudioStream *past;
+ PaHostSoundControl *macInfo;
+ OSErr err;
+ int i, j;
+ Handle h;
+ unsigned char *data;
+
+ info = (PxInfo *)malloc(sizeof(PxInfo));
+ past = (internalPortAudioStream *) pa_stream;
+ macInfo = (PaHostSoundControl *) past->past_DeviceData;
+
+ info->input = &macInfo->pahsc_InputParams;
+ info->inputRefNum = macInfo->pahsc_InputRefNum;
+ info->output = macInfo->pahsc_Channel;
+
+ info->numSources = 0;
+ info->sources = NULL;
+
+ err = SPBGetDeviceInfo (info->inputRefNum, siInputSourceNames, &h);
+ if (err)
+ return (PxMixer *)info;
+
+ HLock(h);
+ HNoPurge(h);
+
+ data = (unsigned char *)*h;
+ info->numSources = ((short *)data)[0];
+ if (info->numSources <= 0 || info->numSources > 50) {
+ HUnlock(h);
+ return (PxMixer *)info;
+ }
+
+ info->sources = (PxSource *)malloc(info->numSources * sizeof(PxSource));
+ data += 2;
+ for(i=0; i<info->numSources; i++) {
+ int len = *data++;
+
+ if (len > 63) {
+ info->numSources = 0;
+ free(info->sources);
+ info->sources = NULL;
+ HUnlock(h);
+ return (PxMixer *)info;
+ }
+
+ for(j=0; j<len; j++)
+ info->sources[i].name[j] = *data++;
+
+ info->sources[i].name[len] = 0;
+ }
+ HUnlock(h);
+
+ return (PxMixer *)info;
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (info->sources)
+ free(info->sources);
+ free(info);
+}
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0.0;
+}
+
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ PCM output volume
+*/
+
+int Px_SupportsPCMOutputVolume( PxMixer* mixer )
+{
+ return 1 ;
+}
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSErr err;
+ long packedVol;
+ SndCommand cmd;
+
+ cmd.cmd = getVolumeCmd;
+ cmd.param1 = 0;
+ cmd.param2 = (long)&packedVol;
+
+ err = SndDoImmediate(info->output, &cmd);
+ if (err)
+ return 0.0;
+
+ return ((packedVol & 0xFFFF) + ((packedVol & 0xFFFF0000) >> 16) / 2.0) / 256.0;
+}
+
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSErr err;
+ long packedVol;
+ SndCommand cmd;
+
+ packedVol = (unsigned long)volume * 256.0;
+ packedVol += (packedVol << 16);
+
+ cmd.cmd = volumeCmd;
+ cmd.param1 = 0;
+ cmd.param2 = packedVol;
+ err = SndDoImmediate(info->output, &cmd);
+}
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0;
+}
+
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return NULL;
+}
+
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return NULL;
+}
+
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ Input sources
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return info->numSources;
+}
+
+const char *Px_GetInputSourceName( PxMixer *mixer, int i)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (i >= 0 && i < info->numSources)
+ return info->sources[i].name;
+ else
+ return "";
+}
+
+int Px_GetCurrentInputSource( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ short selected;
+ OSErr err;
+
+ err = SPBGetDeviceInfo (info->inputRefNum, siInputSource, &selected);
+ if (err)
+ return 0;
+
+ return selected - 1;
+}
+
+void Px_SetCurrentInputSource( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ short selected = i+1;
+ OSErr err;
+
+ err = SPBSetDeviceInfo (info->inputRefNum, siInputSource, &selected);
+}
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ Fixed fixedGain;
+ PxVolume vol;
+ OSErr err;
+
+ if (info->input) {
+ err = SPBGetDeviceInfo(info->inputRefNum, siInputGain, (Ptr)&fixedGain);
+ if (err)
+ return 0.0;
+
+ vol = (fixedGain / 65536.0) - 0.5;
+ return vol;
+ }
+
+ return 0.0;
+}
+
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ Fixed fixedGain;
+ OSErr err;
+
+ if (info->input) {
+ fixedGain = (Fixed)((volume + 0.5) * 65536.0);
+ err = SPBSetDeviceInfo(info->inputRefNum, siInputGain, (Ptr)&fixedGain);
+ }
+}
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxBalance Px_GetOutputBalance( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance )
+{
+}
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return (info->input != NULL);
+}
+
+PxVolume Px_GetPlaythrough( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSErr err;
+ short level;
+
+ err = SPBGetDeviceInfo(info->inputRefNum, siPlayThruOnOff, (Ptr)&level);
+ if (err)
+ return 0.0;
+
+ if (level < 0)
+ level = 0;
+ if (level > 7)
+ level = 7;
+
+ return (PxVolume)(level / 7.0);
+}
+
+void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSErr err;
+ short level = (int)(volume * 7.0 + 0.5);
+
+ err = SPBSetDeviceInfo(info->inputRefNum, siPlayThruOnOff, (Ptr)&level);
+}
Added: freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,3 @@
+/Makefile/1.3/Sat Jun 10 21:39:08 2006//
+/px_mac_core.c/1.8/Sat Aug 26 06:45:54 2006//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_mac_core
Added: freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac_core/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_mac_core/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac_core/Makefile Fri Aug 24 13:53:53 2007
@@ -0,0 +1,25 @@
+# Make PortMixer Library for Mac OS X / CoreAudio
+
+CC = cc
+CFLAGS = -g -I../px_common
+PA = ../../portaudio$(PA_VER)
+
+ifeq ($(PA_VER),-v19)
+CFLAGS += -I$(PA)/include -I$(PA)/src/common -I$(PA)/src/hostapi/coreaudio
+else
+CFLAGS += -I$(PA)/pa_common
+endif
+
+PASRC = px_mac_core.c
+PAINC = ../px_common/portmixer.h
+PAOBJ = px_mac_core.o
+
+portmixer.a: $(PAOBJ)
+ ar ruv portmixer.a $(PAOBJ)
+ ranlib portmixer.a
+
+clean:
+ rm -f portmixer.a *.o
+
+%.o: %.c $(PAINC) Makefile
+ $(CC) -c $(CFLAGS) $< -o $@
Added: freeswitch/branches/cseket/libs/portmixer/px_mac_core/px_mac_core.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_mac_core/px_mac_core.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,528 @@
+/*
+ * PortMixer
+ * Mac OS X / CoreAudio implementation
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioToolbox/AudioConverter.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "portaudio.h"
+#include "portmixer.h"
+
+#if defined(PaStream)
+#define PA_V18
+#include "pa_host.h"
+#else
+#define PA_V19
+#include "pa_mac_core_internal.h"
+#endif
+
+typedef enum PaDeviceMode
+{
+ PA_MODE_OUTPUT_ONLY,
+ PA_MODE_INPUT_ONLY,
+ PA_MODE_IO_ONE_DEVICE,
+ PA_MODE_IO_TWO_DEVICES
+} PaDeviceMode;
+
+typedef struct PaHostInOut_s
+{
+ AudioDeviceID audioDeviceID; /* CoreAudio specific ID */
+ int bytesPerUserNativeBuffer; /* User buffer size in native host format. Depends on numChannels. */
+ AudioConverterRef converter;
+ void *converterBuffer;
+ int numChannels;
+} PaHostInOut;
+
+/**************************************************************
+ * Structure for internal host specific stream data.
+ * This is allocated on a per stream basis.
+ */
+typedef struct PaHostSoundControl
+{
+ PaHostInOut input;
+ PaHostInOut output;
+ AudioDeviceID primaryDeviceID;
+} PaHostSoundControl;
+
+// define value of isInput passed to CoreAudio routines
+#define IS_INPUT (true)
+#define IS_OUTPUT (false)
+
+typedef struct PxInfo
+{
+ AudioDeviceID input;
+ AudioDeviceID output;
+ UInt32 *srcids;
+ char **srcnames;
+ int numsrcs;
+} PxInfo;
+
+static PxInfo *Px_FreeInfo( PxInfo *info )
+{
+ int i;
+
+ if (info) {
+ if (info->srcids) {
+ free(info->srcids);
+ }
+
+ if (info->srcnames) {
+ for (i = 0; i < info->numsrcs; i++) {
+ if (info->srcnames[i]) {
+ free(info->srcnames[i]);
+ }
+ }
+ free(info->srcnames);
+ }
+ free(info);
+ }
+
+ return NULL;
+}
+
+int Px_GetNumMixers( void *pa_stream )
+{
+ return 1;
+}
+
+const char *Px_GetMixerName( void *pa_stream, int index )
+{
+ return "CoreAudio";
+}
+
+PxMixer *Px_OpenMixer( void *pa_stream, int index )
+{
+ PxInfo *info;
+ PaHostSoundControl *macInfo;
+ OSStatus err;
+ UInt32 outSize;
+ UInt32 inID;
+ int i;
+
+ info = (PxInfo *)calloc(1, sizeof(PxInfo));
+ if (!info) {
+ return (PxMixer *)info;
+ }
+
+#if defined(PA_V18)
+ internalPortAudioStream *past;
+
+ past = (internalPortAudioStream *) pa_stream;
+ macInfo = (PaHostSoundControl *) past->past_DeviceData;
+
+ info->input = macInfo->input.audioDeviceID;
+ info->output = macInfo->output.audioDeviceID;
+#endif
+
+#if defined(PA_V19)
+ PaMacCoreStream *pamcs;
+
+ pamcs = (PaMacCoreStream *) pa_stream;
+
+ info->input = pamcs->inputDevice;
+ info->output = pamcs->outputDevice;
+#endif
+
+ if (info->input == kAudioDeviceUnknown) {
+ outSize = sizeof(AudioDeviceID);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
+ &outSize,
+ &info->input);
+ if (err) {
+ return Px_FreeInfo(info);
+ }
+ }
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetPropertyInfo(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSources,
+ &outSize,
+ NULL);
+ if (err) {
+ return Px_FreeInfo(info);
+ }
+
+ info->numsrcs = outSize / sizeof(UInt32);
+ info->srcids = (UInt32 *)malloc(outSize);
+ info->srcnames = (char **)calloc(info->numsrcs, sizeof(char *));
+
+ if (info->srcids == NULL || info->srcnames == NULL) {
+ return Px_FreeInfo(info);
+ }
+
+ err = AudioDeviceGetProperty(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSources,
+ &outSize,
+ info->srcids);
+ if (err) {
+ return Px_FreeInfo(info);
+ }
+
+ for (i = 0; i < info->numsrcs; i++) {
+ AudioValueTranslation trans;
+ CFStringRef name;
+ Boolean ok;
+
+ trans.mInputData = &info->srcids[i];
+ trans.mInputDataSize = sizeof(UInt32);
+ trans.mOutputData = &name;
+ trans.mOutputDataSize = sizeof(CFStringRef);
+
+ outSize = sizeof(AudioValueTranslation);
+ err = AudioDeviceGetProperty(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSourceNameForIDCFString,
+ &outSize,
+ &trans);
+ if (err) {
+ return Px_FreeInfo(info);
+ }
+
+ info->srcnames[i] = malloc(CFStringGetLength(name)+1);
+ if (info->srcnames[i] == NULL) {
+ return Px_FreeInfo(info);
+ }
+
+ ok = CFStringGetCString(name,
+ info->srcnames[i],
+ CFStringGetLength(name)+1,
+ kCFStringEncodingISOLatin1);
+ if (!ok) {
+ return Px_FreeInfo(info);
+ }
+ }
+
+ return (PxMixer *)info;
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ Px_FreeInfo(info);
+}
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0.0;
+}
+
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ PCM output volume
+*/
+
+static PxVolume Px_GetVolume(AudioDeviceID device, Boolean isInput)
+{
+ OSStatus err;
+ UInt32 outSize;
+ Float32 vol, maxvol=0.0;
+ UInt32 mute, anymuted=0;
+ int ch;
+ PxVolume max;
+
+ for(ch=0; ch<=2; ch++) {
+ outSize = sizeof(Float32);
+ err = AudioDeviceGetProperty(device, ch, isInput,
+ kAudioDevicePropertyVolumeScalar,
+ &outSize, &vol);
+ if (!err) {
+ if (vol > maxvol)
+ maxvol = vol;
+ }
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetProperty(device, ch, isInput,
+ kAudioDevicePropertyMute,
+ &outSize, &mute);
+
+ if (!err) {
+ if (mute)
+ anymuted = 1;
+ }
+ }
+
+ if (anymuted)
+ maxvol = 0.0;
+
+ return maxvol;
+}
+
+static void Px_SetVolume(AudioDeviceID device, Boolean isInput,
+ PxVolume volume)
+{
+ Float32 vol = volume;
+ UInt32 mute = 0;
+ int ch;
+ OSStatus err;
+
+ /* Implement a passive attitude towards muting. If they
+ drag the volume above 0.05, unmute it. But if they
+ drag the volume down below that, just set the volume,
+ don't actually mute.
+ */
+
+ for(ch=0; ch<=2; ch++) {
+ err = AudioDeviceSetProperty(device, 0, ch, isInput,
+ kAudioDevicePropertyVolumeScalar,
+ sizeof(Float32), &vol);
+ if (vol > 0.05) {
+ err = AudioDeviceSetProperty(device, 0, ch, isInput,
+ kAudioDevicePropertyMute,
+ sizeof(UInt32), &mute);
+ }
+ }
+}
+
+int Px_SupportsPCMOutputVolume( PxMixer* mixer )
+{
+ return 1 ;
+}
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return Px_GetVolume(info->output, IS_OUTPUT);
+}
+
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ Px_SetVolume(info->output, IS_OUTPUT, volume);
+}
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 1;
+}
+
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i )
+{
+ if (i == 0)
+ return "PCM";
+ else
+ return "";
+}
+
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i )
+{
+ return Px_GetPCMOutputVolume(mixer);
+}
+
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume )
+{
+ Px_SetPCMOutputVolume(mixer, volume);
+}
+
+/*
+ Input sources
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSStatus err;
+ UInt32 outSize;
+
+ return info->numsrcs;
+}
+
+const char *Px_GetInputSourceName( PxMixer *mixer, int i)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (i >= info->numsrcs)
+ return "";
+
+ return info->srcnames[i];
+}
+
+int Px_GetCurrentInputSource( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSStatus err;
+ UInt32 outSize;
+ UInt32 outID = 0;
+ int i;
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetProperty(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSource,
+ &outSize,
+ &outID);
+
+ if (!err) {
+ for (i = 0; i < info->numsrcs; i++) {
+ if (info->srcids[i] == outID) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+}
+
+void Px_SetCurrentInputSource( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSStatus err;
+
+ if (i >= info->numsrcs) {
+ return;
+ }
+
+ err = AudioDeviceSetProperty(info->input,
+ 0,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSource,
+ sizeof(UInt32),
+ &info->srcids[i]);
+
+ return;
+}
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return Px_GetVolume(info->input, IS_INPUT);
+}
+
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ Px_SetVolume(info->input, IS_INPUT, volume);
+}
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxBalance Px_GetOutputBalance( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance )
+{
+}
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer )
+{
+ return 1;
+}
+
+PxVolume Px_GetPlaythrough( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ OSStatus err;
+ UInt32 outSize;
+ UInt32 flag;
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetProperty(info->output, 0, IS_OUTPUT,
+ kAudioDevicePropertyPlayThru,
+ &outSize, &flag);
+ if (err)
+ return 0.0;
+
+ if (flag)
+ return 1.0;
+ else
+ return 0.0;
+}
+
+void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ UInt32 flag = (volume > 0.01);
+ OSStatus err;
+
+ err = AudioDeviceSetProperty(info->output, 0, 0, IS_OUTPUT,
+ kAudioDevicePropertyPlayThru,
+ sizeof(UInt32), &flag);
+}
+
Added: freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,3 @@
+/Makefile/1.1.1.1/Mon Dec 2 01:14:03 2002//
+/px_none.c/1.1.1.1/Mon Dec 2 01:14:03 2002//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_none
Added: freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_none/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_none/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_none/Makefile Fri Aug 24 13:53:53 2007
@@ -0,0 +1,18 @@
+# Make PortMixer Library for Mac OS X / CoreMixer
+
+CC = cc
+
+CFLAGS = -g -I../px_common -I../../portaudio/pa_common
+PASRC = px_none.c
+PAINC = ../px_common/portmixer.h
+PAOBJ = px_none.o
+
+portmixer.a: $(PAOBJ)
+ ar ruv portmixer.a $(PAOBJ)
+ ranlib portmixer.a
+
+clean:
+ rm -f portmixer.a *.o
+
+%.o: %.c $(PAINC) Makefile
+ $(CC) -c $(CFLAGS) $< -o $@
Added: freeswitch/branches/cseket/libs/portmixer/px_none/px_none.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_none/px_none.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,216 @@
+/*
+ * PortMixer
+ * Empty implementation (as a placeholder on platforms where
+ * it hasn't been implemented yet)
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <stdlib.h>
+
+#include "portaudio.h"
+#include "portmixer.h"
+
+typedef struct PxInfo
+{
+ int dummy;
+} PxInfo;
+
+int Px_GetNumMixers( void *pa_stream )
+{
+ return 0;
+}
+
+const char *Px_GetMixerName( void *pa_stream, int index )
+{
+ return NULL;
+}
+
+PxMixer *Px_OpenMixer( void *pa_stream, int index )
+{
+ return NULL;
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer)
+{
+}
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0.0;
+}
+
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ PCM output volume
+*/
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0.0;
+}
+
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0;
+}
+
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return NULL;
+}
+
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return NULL;
+}
+
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ Input sources
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0;
+}
+
+const char *Px_GetInputSourceName( PxMixer *mixer, int i)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return NULL;
+}
+
+int Px_GetCurrentInputSource( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return -1; /* none */
+}
+
+void Px_SetCurrentInputSource( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 0.0;
+}
+
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+}
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxBalance Px_GetOutputBalance( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance )
+{
+}
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxBalance Px_GetPlaythrough( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetPlaythrough( PxMixer *mixer, PxBalance balance )
+{
+}
+
Added: freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,3 @@
+/Makefile/1.2/Sun Mar 9 04:04:53 2003//
+/px_test.c/1.2/Sun Mar 9 04:04:53 2003//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_tests
Added: freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_tests/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_tests/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_tests/Makefile Fri Aug 24 13:53:53 2007
@@ -0,0 +1,16 @@
+all: px_test
+
+CFLAGS = -g -Wall -O -I../../portaudio/pa_common -I../px_common
+
+px_test: px_test.o px_unix_oss.o ../px_common/portmixer.h
+ gcc -g -o px_test px_test.o px_unix_oss.o -lm \
+ -L../../portaudio/pa_unix_oss -lportaudio -lpthread
+
+px_test.o: px_test.c ../px_common/portmixer.h
+ gcc $(CFLAGS) -c px_test.c
+
+
+px_unix_oss.o: ../px_unix_oss/px_unix_oss.c ../px_common/portmixer.h
+ gcc $(CFLAGS) -c ../px_unix_oss/px_unix_oss.c
+
+
Added: freeswitch/branches/cseket/libs/portmixer/px_tests/px_test.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_tests/px_test.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,80 @@
+#include <stdio.h>
+
+#include "portmixer.h"
+#include "portaudio.h"
+
+static int DummyCallbackFunc(void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ PaTimestamp outTime, void *userData)
+{
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ int num_mixers;
+ int i;
+ PaError error;
+ PortAudioStream *stream;
+ int recDeviceNum;
+ int playDeviceNum;
+ int inputChannels = 2;
+
+ recDeviceNum = Pa_GetDefaultInputDeviceID();
+ playDeviceNum = Pa_GetDefaultOutputDeviceID();
+
+ error = Pa_OpenStream(&stream, recDeviceNum, inputChannels, paFloat32, NULL,
+ paNoDevice, 0, paFloat32, NULL,
+ 44101, 512, 1, paClipOff | paDitherOff,
+ DummyCallbackFunc, NULL);
+
+ if (error) {
+ printf("PortAudio error %d: %s\n", error,
+ Pa_GetErrorText(error));
+ return -1;
+ }
+
+ num_mixers = Px_GetNumMixers(stream);
+ printf("Number of mixers: %d\n", num_mixers);
+ for(i=0; i<num_mixers; i++) {
+ PxMixer *mixer;
+ int num;
+ int j;
+
+ printf("Mixer %d: %s\n", i, Px_GetMixerName(stream, i));
+ mixer = Px_OpenMixer(stream, i);
+ if (!mixer) {
+ printf(" Could not open mixer!\n");
+ continue;
+ }
+
+ printf(" Master volume: %.2f\n", Px_GetMasterVolume(mixer));
+ printf(" PCM output volume: %.2f\n", Px_GetPCMOutputVolume(mixer));
+
+ num = Px_GetNumOutputVolumes(mixer);
+ printf(" Num outputs: %d\n", num);
+ for(j=0; j<num; j++) {
+ printf(" Output %d (%s): %.2f\n",
+ j,
+ Px_GetOutputVolumeName(mixer, j),
+ Px_GetOutputVolume(mixer, j));
+ }
+
+ num = Px_GetNumInputSources(mixer);
+ printf(" Num input sources: %d\n", num);
+ for(j=0; j<num; j++) {
+ printf(" Input %d (%s) %s\n",
+ j,
+ Px_GetInputSourceName(mixer, j),
+ (Px_GetCurrentInputSource(mixer)==j?
+ "SELECTED": ""));
+ }
+ printf(" Input volume: %.2f\n", Px_GetInputVolume(mixer));
+
+ Px_CloseMixer(mixer);
+ }
+
+ Pa_CloseStream(stream);
+
+ return 0;
+}
Added: freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,3 @@
+/Makefile/1.1/Mon Dec 2 06:22:32 2002//
+/px_unix_oss.c/1.5/Fri Dec 2 10:23:45 2005//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_unix_oss
Added: freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_unix_oss/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_unix_oss/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_unix_oss/Makefile Fri Aug 24 13:53:53 2007
@@ -0,0 +1,18 @@
+# Make PortMixer Library for Unix / OSS
+
+CC = gcc
+
+CFLAGS = -g -I../px_common -I../../portaudio/pa_common
+PASRC = px_unix_oss.c
+PAINC = ../px_common/portmixer.h
+PAOBJ = px_unix_oss.o
+
+portmixer.a: $(PAOBJ)
+ ar ruv portmixer.a $(PAOBJ)
+ ranlib portmixer.a
+
+clean:
+ rm -f portmixer.a *.o
+
+%.o: %.c $(PAINC) Makefile
+ $(CC) -c $(CFLAGS) $< -o $@
Added: freeswitch/branches/cseket/libs/portmixer/px_unix_oss/px_unix_oss.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_unix_oss/px_unix_oss.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,385 @@
+/*
+ * PortMixer
+ * Unix OSS Implementation
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#if defined(__linux__)
+#include <linux/soundcard.h>
+#elif defined(__FreeBSD__)
+#include <sys/soundcard.h>
+#else
+#include <machine/soundcard.h> /* JH20010905 */
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include "portaudio.h"
+#include "portmixer.h"
+
+typedef struct PxInfo
+{
+ int index;
+ int fd;
+
+ int num_out;
+ int outs[SOUND_MIXER_NRDEVICES];
+ int num_rec;
+ int recs[SOUND_MIXER_NRDEVICES];
+} PxInfo;
+
+char PxDevice[20] = "/dev/mixerX";
+
+int PxNumDevices = 0;
+int PxDevices[10];
+
+int Px_GetNumMixers( void *pa_stream )
+{
+ int i;
+ int fd;
+
+ PxNumDevices = 0;
+
+ for(i=0; i<11; i++) {
+ if (i==0)
+ PxDevice[10] = 0;
+ else
+ PxDevice[10] = '0'+(i-1);
+ fd = open(PxDevice, O_RDWR);
+ if (fd >= 0) {
+ PxDevices[PxNumDevices] = i;
+ PxNumDevices++;
+ close(fd);
+ }
+ }
+
+ return PxNumDevices;
+}
+
+const char *Px_GetMixerName( void *pa_stream, int index )
+{
+ if (PxNumDevices <= 0)
+ Px_GetNumMixers(pa_stream);
+
+ if (index < 0 || index >= PxNumDevices)
+ return NULL;
+
+ if (PxDevices[index]==0)
+ PxDevice[10] = 0;
+ else
+ PxDevice[10] = '0'+(PxDevices[index]-1);
+ return PxDevice;
+}
+
+PxMixer *Px_OpenMixer( void *pa_stream, int index )
+{
+ PxInfo *info;
+ int devmask, recmask, outmask;
+ int i;
+
+ if (PxNumDevices <= 0)
+ Px_GetNumMixers(pa_stream);
+
+ if (index < 0 || index >= PxNumDevices)
+ return NULL;
+
+ info = (PxInfo *)malloc(sizeof(PxInfo));
+ info->index = PxDevice[index];
+
+ if (PxDevices[index]==0)
+ PxDevice[10] = 0;
+ else
+ PxDevice[10] = '0'+(PxDevices[index]-1);
+ info->fd = open(PxDevice, O_RDWR);
+ if (info->fd < 0)
+ goto bad;
+
+ if (ioctl(info->fd, MIXER_READ(SOUND_MIXER_READ_DEVMASK),
+ &devmask) == -1)
+ goto bad;
+ if (ioctl(info->fd, MIXER_READ(SOUND_MIXER_READ_RECMASK),
+ &recmask) == -1)
+ goto bad;
+ outmask = devmask ^ recmask;
+
+ info->num_out = 0;
+ info->num_rec = 0;
+
+ for(i=0; i<SOUND_MIXER_NRDEVICES; i++)
+ if (recmask & (1<<i))
+ info->recs[info->num_rec++] = i;
+ else if (devmask & (1<<i))
+ info->outs[info->num_out++] = i;
+
+ return (PxMixer *)info;
+
+ bad:
+ free(info);
+ return NULL;
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ close(info->fd);
+
+ free(info);
+}
+
+PxVolume GetVolume(int fd, int channel)
+{
+ int vol;
+ int stereo;
+
+ if (ioctl(fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == 0)
+ stereo = ((stereo & (1 << channel)) != 0);
+ else
+ stereo = 0;
+
+ if (ioctl(fd, MIXER_READ(channel), &vol) == -1)
+ return 0.0;
+
+ if (stereo)
+ return ((vol & 0xFF)/200.0) + (((vol>>8) & 0xFF)/200.0);
+ else
+ return (vol & 0xFF)/100.0;
+}
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return GetVolume(info->fd, SOUND_MIXER_VOLUME);
+}
+
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ int vol = (int)((volume * 100.0) + 0.5);
+ vol = (vol | (vol<<8));
+ ioctl(info->fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &vol);
+}
+
+/*
+ PCM output volume
+*/
+
+int Px_SupportsPCMOutputVolume( PxMixer* mixer )
+{
+ return 1 ;
+}
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return GetVolume(info->fd, SOUND_MIXER_PCM);
+}
+
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ int vol = (int)((volume * 100.0) + 0.5);
+ vol = (vol | (vol<<8));
+ ioctl(info->fd, MIXER_WRITE(SOUND_MIXER_PCM), &vol);
+}
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return info->num_out;
+}
+
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ const char *labels[] = SOUND_DEVICE_LABELS;
+
+ return labels[info->outs[i]];
+}
+
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return GetVolume(info->fd, info->outs[i]);
+}
+
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ int vol = (int)((volume * 100.0) + 0.5);
+ vol = (vol | (vol<<8));
+ ioctl(info->fd, MIXER_WRITE(info->outs[i]), &vol);
+}
+
+/*
+ Input sources
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return info->num_rec;
+}
+
+const char *Px_GetInputSourceName( PxMixer *mixer, int i)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ const char *labels[] = SOUND_DEVICE_LABELS;
+ return labels[info->recs[i]];
+}
+
+int Px_GetCurrentInputSource( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ int recmask;
+ int i;
+
+ /* Note that there may be more than one in OSS; we pick
+ the first one */
+
+ if (ioctl(info->fd, MIXER_READ(SOUND_MIXER_READ_RECSRC),
+ &recmask) == -1)
+ return -1; /* none / error */
+
+ for(i=0; i<info->num_rec; i++)
+ if (recmask & (1 << (info->recs[i])))
+ return i;
+
+ return -1; /* none */
+}
+
+void Px_SetCurrentInputSource( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ int newrecsrcmask = (1 << (info->recs[i]));
+
+ ioctl(info->fd, MIXER_WRITE(SOUND_MIXER_READ_RECSRC),
+ &newrecsrcmask);
+}
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ int i;
+
+ i = Px_GetCurrentInputSource(mixer);
+ if (i < 0)
+ return 0.0;
+
+ return GetVolume(info->fd, info->recs[i]);
+}
+
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ int vol;
+ int i;
+
+ i = Px_GetCurrentInputSource(mixer);
+ if (i < 0)
+ return;
+
+ vol = (int)((volume * 100.0) + 0.5);
+ vol = (vol | (vol<<8));
+ ioctl(info->fd, MIXER_WRITE(info->recs[i]), &vol);
+}
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxBalance Px_GetOutputBalance( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance )
+{
+}
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxVolume Px_GetPlaythrough( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume )
+{
+}
+
Added: freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,3 @@
+/Makefile/1.1/Mon Sep 22 09:01:06 2003//
+/px_win_wmme.c/1.8/Sat Jun 10 21:39:08 2006//
+D
Added: freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/px_win_wmme
Added: freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_win_wmme/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/px_win_wmme/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_win_wmme/Makefile Fri Aug 24 13:53:53 2007
@@ -0,0 +1,18 @@
+# Make PortMixer Library for Windows / Cygwin
+
+CC = gcc
+
+override CFLAGS = -g -I../px_common -I../../portaudio/pa_common
+PASRC = px_win_wmme.c
+PAINC = ../px_common/portmixer.h
+PAOBJ = px_win_wmme.o
+
+portmixer.a: $(PAOBJ)
+ ar ruv portmixer.a $(PAOBJ)
+ ranlib portmixer.a
+
+clean:
+ rm -f portmixer.a *.o
+
+%.o: %.c $(PAINC) Makefile
+ $(CC) -c $(CFLAGS) $< -o $@
Added: freeswitch/branches/cseket/libs/portmixer/px_win_wmme/px_win_wmme.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/px_win_wmme/px_win_wmme.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,622 @@
+/*
+ * PortMixer
+ * Windows WMME Implementation
+ *
+ * Copyright (c) 2002
+ *
+ * Written by Dominic Mazzoni and Augustus Saunders
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <Windows.h>
+
+#include "portaudio.h"
+#include "portmixer.h"
+
+#if defined(PaStream)
+#define PA_V18
+#else
+#define PA_V19
+#endif
+
+#if defined(PA_V18)
+#include "pa_host.h"
+
+typedef struct PaWMMEStreamData
+{
+ /* Input -------------- */
+ HWAVEIN hWaveIn;
+ WAVEHDR *inputBuffers;
+ int currentInputBuffer;
+ int bytesPerHostInputBuffer;
+ int bytesPerUserInputBuffer; /* native buffer size in bytes */
+ /* Output -------------- */
+ HWAVEOUT hWaveOut;
+} PaWMMEStreamData;
+#endif
+
+#if defined(PA_V19)
+#include "pa_cpuload.h"
+#include "pa_process.h"
+#include "pa_stream.h"
+
+typedef struct
+{
+ HANDLE bufferEvent;
+ void *waveHandles;
+ unsigned int deviceCount;
+ /* unsigned int channelCount; */
+ WAVEHDR **waveHeaders; /* waveHeaders[device][buffer] */
+ unsigned int bufferCount;
+ unsigned int currentBufferIndex;
+ unsigned int framesPerBuffer;
+ unsigned int framesUsedInCurrentBuffer;
+}PaWinMmeSingleDirectionHandlesAndBuffers;
+
+/* PaWinMmeStream - a stream data structure specifically for this implementation */
+/* note that struct PaWinMmeStream is typedeffed to PaWinMmeStream above. */
+struct PaWinMmeStream
+{
+ PaUtilStreamRepresentation streamRepresentation;
+ PaUtilCpuLoadMeasurer cpuLoadMeasurer;
+ PaUtilBufferProcessor bufferProcessor;
+
+ int primeStreamUsingCallback;
+
+ PaWinMmeSingleDirectionHandlesAndBuffers input;
+ PaWinMmeSingleDirectionHandlesAndBuffers output;
+
+ /* Processing thread management -------------- */
+ HANDLE abortEvent;
+ HANDLE processingThread;
+ DWORD processingThreadId;
+
+ char throttleProcessingThreadOnOverload; /* 0 -> don't throtte, non-0 -> throttle */
+ int processingThreadPriority;
+ int highThreadPriority;
+ int throttledThreadPriority;
+ unsigned long throttledSleepMsecs;
+
+ int isStopped;
+ volatile int isActive;
+ volatile int stopProcessing; /* stop thread once existing buffers have been returned */
+ volatile int abortProcessing; /* stop thread immediately */
+
+ DWORD allBuffersDurationMs; /* used to calculate timeouts */
+};
+#endif
+
+typedef struct PxSrcInfo
+{
+ char name[256];
+ DWORD lineID;
+ DWORD controlID;
+} PxSrcInfo;
+
+typedef struct PxInfo
+{
+ HMIXEROBJ hInputMixer;
+ HMIXEROBJ hOutputMixer;
+ int numInputs;
+ PxSrcInfo src[32];
+ DWORD muxID;
+ DWORD speakerID;
+ DWORD waveID;
+} PxInfo;
+
+int Px_GetNumMixers( void *pa_stream )
+{
+ return 1;
+}
+
+const char *Px_GetMixerName( void *pa_stream, int index )
+{
+ return "Mixer";
+}
+
+PxMixer *Px_OpenMixer( void *pa_stream, int index )
+{
+#if defined(PA_V18)
+ internalPortAudioStream *past;
+ PaWMMEStreamData *wmmeStreamData;
+#endif
+
+#if defined(PA_V19)
+ struct PaWinMmeStream *past;
+#endif
+
+ HWAVEIN hWaveIn;
+ HWAVEOUT hWaveOut;
+ PxInfo *mixer;
+ MMRESULT result;
+ MIXERLINE line;
+ MIXERLINECONTROLS controls;
+ MIXERCONTROL control;
+ MIXERCONTROLDETAILS details;
+ MIXERCONTROLDETAILS_LISTTEXT mixList[32];
+ int j;
+
+ if (!pa_stream)
+ return NULL;
+
+ mixer = (PxMixer *)malloc(sizeof(PxInfo));
+ mixer->hInputMixer = NULL;
+ mixer->hOutputMixer = NULL;
+
+#if defined(PA_V18)
+ past = (internalPortAudioStream *) pa_stream;
+ wmmeStreamData = (PaWMMEStreamData *) past->past_DeviceData;
+
+ hWaveIn = wmmeStreamData->hWaveIn;
+ hWaveOut = wmmeStreamData->hWaveOut;
+#endif
+
+#if defined(PA_V19)
+ past = (struct PaWinMmeStream *) pa_stream;
+
+ hWaveIn = 0;
+ if (past->input.waveHandles) {
+ hWaveIn = ((HWAVEIN *)past->input.waveHandles)[0];
+ }
+
+ hWaveOut = 0;
+ if (past->output.waveHandles) {
+ hWaveOut = ((HWAVEOUT *)past->output.waveHandles)[0];
+ }
+#endif
+
+ if (hWaveIn) {
+ result = mixerOpen((HMIXER *)&mixer->hInputMixer, (UINT)hWaveIn, 0, 0, MIXER_OBJECTF_HWAVEIN);
+ if (result != MMSYSERR_NOERROR) {
+ free(mixer);
+ return NULL;
+ }
+ }
+
+ if (hWaveOut) {
+ result = mixerOpen((HMIXER *)&mixer->hOutputMixer, (UINT)hWaveOut, 0, 0, MIXER_OBJECTF_HWAVEOUT);
+ if (result != MMSYSERR_NOERROR) {
+ free(mixer);
+ return NULL;
+ }
+ }
+
+ mixer->numInputs = 0;
+ mixer->muxID = 0;
+
+ /* ??? win32 default for wave control seems to be 0 ??? */
+ mixer->waveID = 0 ;
+
+ /*
+ * Find the input source selector (mux or mixer) and
+ * get the names and IDs of all of the input sources
+ */
+
+ if (mixer->hInputMixer) {
+ line.cbStruct = sizeof(MIXERLINE);
+ line.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN;
+ result = mixerGetLineInfo(mixer->hInputMixer,
+ &line,
+ MIXER_GETLINEINFOF_COMPONENTTYPE);
+ if (result == MMSYSERR_NOERROR) {
+
+ controls.cbStruct = sizeof(MIXERLINECONTROLS);
+ controls.dwLineID = line.dwLineID;
+ controls.dwControlType = MIXERCONTROL_CONTROLTYPE_MUX;
+ controls.cbmxctrl = sizeof(MIXERCONTROL);
+ controls.pamxctrl = &control;
+
+ control.cbStruct = sizeof(MIXERCONTROL);
+
+ result = mixerGetLineControls(mixer->hInputMixer,
+ &controls,
+ MIXER_GETLINECONTROLSF_ONEBYTYPE);
+
+ if (result != MMSYSERR_NOERROR) {
+ controls.dwControlType = MIXERCONTROL_CONTROLTYPE_MIXER;
+ result = mixerGetLineControls(mixer->hInputMixer,
+ &controls,
+ MIXER_GETLINECONTROLSF_ONEBYTYPE);
+ }
+
+ if (result == MMSYSERR_NOERROR) {
+ mixer->numInputs = control.cMultipleItems;
+ mixer->muxID = control.dwControlID;
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = mixer->muxID;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXT);
+ details.paDetails = (LPMIXERCONTROLDETAILS_LISTTEXT)&mixList[0];
+ details.cMultipleItems = mixer->numInputs;
+
+ result = mixerGetControlDetails(mixer->hInputMixer,
+ (LPMIXERCONTROLDETAILS)&details,
+ MIXER_GETCONTROLDETAILSF_LISTTEXT);
+
+ if (result != MMSYSERR_NOERROR)
+ mixer->numInputs = 0;
+
+ for(j=0; j<mixer->numInputs; j++) {
+ mixer->src[j].lineID = mixList[j].dwParam1;
+ strcpy(mixer->src[j].name, mixList[j].szName);
+ }
+ }
+
+ /*
+ * We've found the names - now we need to find the volume
+ * controls for each one
+ */
+
+ for(j=0; j<mixer->numInputs; j++) {
+ controls.cbStruct = sizeof(MIXERLINECONTROLS);
+ controls.dwLineID = mixer->src[j].lineID;
+ controls.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
+ controls.cbmxctrl = sizeof(MIXERCONTROL);
+ controls.pamxctrl = &control;
+
+ control.cbStruct = sizeof(MIXERCONTROL);
+
+ result = mixerGetLineControls(mixer->hInputMixer,
+ &controls,
+ MIXER_GETLINECONTROLSF_ONEBYTYPE);
+ if (result == MMSYSERR_NOERROR)
+ mixer->src[j].controlID = control.dwControlID;
+ else
+ mixer->src[j].controlID = 0;
+ }
+ }
+ }
+
+ /*
+ * Find the ID of the output speaker volume control
+ */
+
+ mixer->speakerID = 0;
+
+ if (mixer->hOutputMixer) {
+ line.cbStruct = sizeof(MIXERLINE);
+ line.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
+ result = mixerGetLineInfo(mixer->hOutputMixer,
+ &line,
+ MIXER_GETLINEINFOF_COMPONENTTYPE);
+ if (result == MMSYSERR_NOERROR) {
+ controls.cbStruct = sizeof(MIXERLINECONTROLS);
+ controls.dwLineID = line.dwLineID;
+ controls.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
+ controls.cbmxctrl = sizeof(MIXERCONTROL);
+ controls.pamxctrl = &control;
+
+ control.cbStruct = sizeof(MIXERCONTROL);
+
+ result = mixerGetLineControls(mixer->hOutputMixer,
+ &controls,
+ MIXER_GETLINECONTROLSF_ONEBYTYPE);
+
+ if (result == MMSYSERR_NOERROR)
+ mixer->speakerID = control.dwControlID;
+ }
+ }
+
+ return (PxMixer *)mixer;
+}
+
+void VolumeFunction(HMIXEROBJ hMixer, DWORD controlID, PxVolume *volume)
+{
+ MIXERCONTROLDETAILS details;
+ MMRESULT result;
+ MIXERCONTROLDETAILS_UNSIGNED value;
+
+ memset(&value, 0, sizeof(MIXERCONTROLDETAILS_UNSIGNED));
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = controlID;
+ details.cChannels = 1; /* all channels */
+ details.cMultipleItems = 0;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
+ details.paDetails = &value;
+
+ result = mixerGetControlDetails(hMixer, &details,
+ MIXER_GETCONTROLDETAILSF_VALUE);
+
+ if (*volume < 0.0) {
+ *volume = (PxVolume)(value.dwValue / 65535.0);
+ }
+ else {
+ if (result != MMSYSERR_NOERROR)
+ return;
+ value.dwValue = (unsigned short)(*volume * 65535.0);
+ mixerSetControlDetails(hMixer, &details,
+ MIXER_GETCONTROLDETAILSF_VALUE);
+ }
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (info->hInputMixer)
+ mixerClose((HMIXER)info->hInputMixer);
+ if (info->hOutputMixer)
+ mixerClose((HMIXER)info->hOutputMixer);
+ free( mixer );
+}
+
+/*
+ Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ PxVolume vol;
+
+ vol = -1.0;
+ VolumeFunction(info->hOutputMixer, info->speakerID, &vol);
+ return vol;
+}
+
+void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ VolumeFunction(info->hOutputMixer, info->speakerID, &volume);
+}
+
+/*
+ PCM output volume
+*/
+
+int Px_SupportsPCMOutputVolume( PxMixer* mixer )
+{
+ PxInfo* info = ( PxInfo* )( mixer ) ;
+ return ( info->waveID == -1 ) ? 0 : 1 ;
+}
+
+PxVolume Px_GetPCMOutputVolume( PxMixer *mixer )
+{
+ MMRESULT result;
+ DWORD vol = 0;
+ unsigned short mono_vol = 0;
+ PxInfo *info = (PxInfo *)mixer;
+
+ /* invalid waveID, return zero */
+ if ( info->waveID == -1 )
+ return 0.0 ;
+
+ /* get the wave output volume */
+ result = waveOutGetVolume( (HWAVEOUT)( info->waveID ), &vol);
+
+ /* on failure, mark waveID as invalid and return zero */
+ if ( result != MMSYSERR_NOERROR )
+ {
+ info->waveID = -1 ;
+ return 0.0 ;
+ }
+
+ mono_vol = (unsigned short)vol;
+ return (PxVolume)mono_vol/65535.0;
+}
+
+void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume )
+{
+ MMRESULT result;
+ PxInfo *info = (PxInfo *)mixer;
+
+ /* invalid waveID */
+ if ( info->waveID == -1 )
+ return ;
+
+ /* set the wave output volume */
+ result = waveOutSetVolume( (HWAVEOUT)( info->waveID ), MAKELONG(volume*0xFFFF, volume*0xFFFF));
+
+ /* on failure, mark waveID as invalid */
+ if ( result != MMSYSERR_NOERROR )
+ {
+ info->waveID = -1 ;
+ }
+
+ return ;
+}
+
+/*
+ All output volumes
+*/
+
+int Px_GetNumOutputVolumes( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return 2;
+}
+
+const char *Px_GetOutputVolumeName( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (i==1)
+ return "Wave Out";
+ else
+ return "Master Volume";
+}
+
+PxVolume Px_GetOutputVolume( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (i==1)
+ return Px_GetPCMOutputVolume(mixer);
+ else
+ return Px_GetMasterVolume(mixer);
+}
+
+void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ if (i==1)
+ Px_SetPCMOutputVolume(mixer, volume);
+ else
+ Px_SetMasterVolume(mixer, volume);
+}
+
+/*
+ Input sources
+*/
+
+int Px_GetNumInputSources( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return info->numInputs;
+}
+
+const char *Px_GetInputSourceName( PxMixer *mixer, int i)
+{
+ PxInfo *info = (PxInfo *)mixer;
+
+ return info->src[i].name;
+}
+
+int Px_GetCurrentInputSource( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ MIXERCONTROLDETAILS details;
+ MIXERCONTROLDETAILS_BOOLEAN flags[32];
+ MMRESULT result;
+ int i;
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = info->muxID;
+ details.cMultipleItems = info->numInputs;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
+ details.paDetails = (LPMIXERCONTROLDETAILS_BOOLEAN)&flags[0];
+
+ result = mixerGetControlDetails(info->hInputMixer,
+ (LPMIXERCONTROLDETAILS)&details,
+ MIXER_GETCONTROLDETAILSF_VALUE);
+
+ if (result == MMSYSERR_NOERROR) {
+ for(i=0; i<info->numInputs; i++)
+ if (flags[i].fValue)
+ return i;
+ }
+
+ return 0;
+}
+
+void Px_SetCurrentInputSource( PxMixer *mixer, int i )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ MIXERCONTROLDETAILS details;
+ MIXERCONTROLDETAILS_BOOLEAN flags[32];
+ MMRESULT result;
+ int j;
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = info->muxID;
+ details.cMultipleItems = info->numInputs;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
+ details.paDetails = (LPMIXERCONTROLDETAILS_BOOLEAN)&flags[0];
+
+ for(j=0; j<info->numInputs; j++)
+ flags[j].fValue = (i == j);
+
+ result = mixerSetControlDetails(info->hInputMixer,
+ (LPMIXERCONTROLDETAILS)&details,
+ MIXER_SETCONTROLDETAILSF_VALUE);
+}
+
+/*
+ Input volume
+*/
+
+PxVolume Px_GetInputVolume( PxMixer *mixer )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ PxVolume vol;
+ int src = Px_GetCurrentInputSource(mixer);
+
+ vol = -1.0;
+ VolumeFunction(info->hInputMixer, info->src[src].controlID, &vol);
+ return vol;
+}
+
+void Px_SetInputVolume( PxMixer *mixer, PxVolume volume )
+{
+ PxInfo *info = (PxInfo *)mixer;
+ int src = Px_GetCurrentInputSource(mixer);
+
+ VolumeFunction(info->hInputMixer, info->src[src].controlID, &volume);
+}
+
+/*
+ Balance
+*/
+
+int Px_SupportsOutputBalance( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxBalance Px_GetOutputBalance( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance )
+{
+}
+
+/*
+ Playthrough
+*/
+
+int Px_SupportsPlaythrough( PxMixer *mixer )
+{
+ return 0;
+}
+
+PxVolume Px_GetPlaythrough( PxMixer *mixer )
+{
+ return 0.0;
+}
+
+void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume )
+{
+}
+
Added: freeswitch/branches/cseket/libs/portmixer/src/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,11 @@
+/px_example_api.c/1.1/Mon Oct 2 00:27:52 2006//
+/px_linux_alsa.c/1.2/Sun Jun 3 08:30:36 2007//
+/px_mac_coreaudio.c/1.1/Mon Oct 2 00:27:52 2006//
+/px_mixer.c/1.4/Wed Jul 11 06:16:16 2007//
+/px_mixer.h/1.1/Mon Oct 2 00:27:52 2006//
+/px_unix_oss.c/1.3/Sun Jun 3 09:39:32 2007//
+/px_win_common.c/1.2/Thu Oct 5 22:59:44 2006//
+/px_win_common.h/1.1/Mon Oct 2 00:27:52 2006//
+/px_win_ds.c/1.2/Sun Oct 22 05:55:10 2006//
+/px_win_wmme.c/1.2/Thu Oct 5 22:59:44 2006//
+D
Added: freeswitch/branches/cseket/libs/portmixer/src/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/src
Added: freeswitch/branches/cseket/libs/portmixer/src/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/src/px_example_api.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_example_api.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,304 @@
+/*
+ * PortMixer
+ * Example API Implementation
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "portaudio.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+
+typedef struct PxInfo
+{
+ int example;
+} PxInfo;
+
+int OpenMixer_Platform_API(px_mixer *Px, int index)
+{
+ PxInfo *info;
+
+ if (!initialize(Px)) {
+ return FALSE;
+ }
+
+ info = (PxInfo *) Px->info;
+
+ return TRUE;
+}
+
+static int initialize(px_mixer *Px)
+{
+ Px->info = calloc(1, sizeof(PxInfo));
+ if (Px->info == NULL) {
+ return FALSE;
+ }
+
+ Px->CloseMixer = close_mixer;
+ Px->GetNumMixers = get_num_mixers;
+ Px->GetMixerName = get_mixer_name;
+ Px->GetMasterVolume = get_master_volume;
+ Px->SetMasterVolume = set_master_volume;
+ Px->SupportsPCMOutputVolume = supports_pcm_output_volume;
+ Px->GetPCMOutputVolume = get_pcm_output_volume;
+ Px->SetPCMOutputVolume = set_pcm_output_volume;
+ Px->GetNumOutputVolumes = get_num_output_volumes;
+ Px->GetOutputVolumeName = get_output_volume_name;
+ Px->GetOutputVolume = get_output_volume;
+ Px->SetOutputVolume = set_output_volume;
+ Px->GetNumInputSources = get_num_input_sources;
+ Px->GetInputSourceName = get_input_source_name;
+ Px->GetCurrentInputSource = get_current_input_source;
+ Px->SetCurrentInputSource = set_current_input_source;
+ Px->GetInputVolume = get_input_volume;
+ Px->SetInputVolume = set_input_volume;
+
+ Px->SupportsOutputBalance = supports_output_balance;
+ Px->GetOutputBalance = get_output_balance;
+ Px->SetOutputBalance = set_output_balance;
+
+ Px->SupportsPlaythrough = supports_play_through;
+ Px->GetPlaythrough = get_play_through;
+ Px->SetPlaythrough = set_play_through;
+
+ return TRUE;
+}
+
+static int cleanup(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info) {
+ free(info);
+ Px->info = NULL;
+ }
+
+ return FALSE;
+}
+
+static void close_mixer(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+static int get_num_mixers(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0;
+}
+
+static const char *get_mixer_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return NULL;
+}
+
+/*
+|| Master volume
+*/
+
+static PxVolume get_master_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0.0;
+}
+
+static void set_master_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+/*
+|| Main output volume
+*/
+
+static int supports_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return FALSE;
+}
+
+static PxVolume get_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0.0;
+}
+
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+/*
+|| All output volumes
+*/
+
+static int get_num_output_volumes(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0;
+}
+
+static const char *get_output_volume_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return NULL;
+}
+
+static PxVolume get_output_volume(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0.0;
+}
+
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+/*
+|| Input source
+*/
+
+static int get_num_input_sources(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0;
+}
+
+static const char *get_input_source_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return NULL;
+}
+
+static int get_current_input_source(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return -1;
+}
+
+static void set_current_input_source(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0.0;
+}
+
+static void set_input_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+/*
+|| Balance
+*/
+
+static int supports_output_balance(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return FALSE;
+}
+
+static PxBalance get_output_balance(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0.0;
+}
+
+static void set_output_balance(px_mixer *Px, PxBalance balance)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
+
+/*
+|| Playthrough
+*/
+
+static int supports_play_through(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return FALSE;
+}
+
+static PxVolume get_play_through(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return 0.0;
+}
+
+void set_play_through(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return;
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_linux_alsa.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_linux_alsa.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,671 @@
+/*
+ * PortMixer
+ * Linux ALSA Implementation
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <alsa/asoundlib.h>
+
+#include "portaudio.h"
+#include "pa_unix_oss.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+
+#if !defined(FALSE)
+#define FALSE 0
+#endif
+
+#if !defined(TRUE)
+#define TRUE 1
+#endif
+
+typedef struct PxSelem
+{
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_elem_t *elem;
+ char *name;
+} PxSelem;
+
+typedef struct PxDev
+{
+ snd_mixer_t *handle;
+ int card;
+
+ int numselems;
+ PxSelem *selems;
+} PxDev;
+
+typedef struct PxInfo
+{
+ int numMixers;
+ char *mixers;
+
+ PxDev capture;
+ PxDev playback;
+} PxInfo;
+
+static int open_mixer(PxDev *dev, int card, int playback)
+{
+ snd_mixer_elem_t *elem;
+ char name[256];
+ int err;
+ int i;
+
+ sprintf(name, "hw:%d", card);
+
+ dev->card = card;
+ dev->handle = NULL;
+
+ do {
+ err = snd_mixer_open(&dev->handle, 0);
+ if (err < 0) {
+ break;
+ }
+
+ err = snd_mixer_attach(dev->handle, name);
+ if (err < 0) {
+ break;
+ }
+
+ err = snd_mixer_selem_register(dev->handle, NULL, NULL);
+ if (err < 0) {
+ break;
+ }
+
+ err = snd_mixer_load(dev->handle);
+ if (err < 0) {
+ break;
+ }
+
+ for (elem = snd_mixer_first_elem(dev->handle);
+ elem != NULL;
+ elem = snd_mixer_elem_next(elem))
+ {
+ if (!playback) {
+ if (!snd_mixer_selem_has_capture_volume(elem) &&
+ !snd_mixer_selem_has_capture_switch(elem) &&
+ !snd_mixer_selem_has_common_volume(elem)) {
+ continue;
+ }
+ }
+ else {
+ if (!snd_mixer_selem_has_playback_volume(elem) &&
+ !snd_mixer_selem_has_playback_switch(elem) &&
+ !snd_mixer_selem_has_common_volume(elem)) {
+ continue;
+ }
+ }
+ dev->numselems++;
+ }
+
+ dev->selems = calloc(dev->numselems, sizeof(PxSelem));
+ if (dev->selems == NULL) {
+ break;
+ }
+
+ i = 0;
+ for (elem = snd_mixer_first_elem(dev->handle);
+ elem != NULL;
+ elem = snd_mixer_elem_next(elem))
+ {
+ if (!playback) {
+ if (!snd_mixer_selem_has_capture_volume(elem) &&
+ !snd_mixer_selem_has_capture_switch(elem) &&
+ !snd_mixer_selem_has_common_volume(elem)) {
+ continue;
+ }
+ }
+ else {
+ if (!snd_mixer_selem_has_playback_volume(elem) &&
+ !snd_mixer_selem_has_playback_switch(elem) &&
+ !snd_mixer_selem_has_common_volume(elem)) {
+ continue;
+ }
+ }
+
+ if (snd_mixer_selem_id_malloc(&dev->selems[i].sid) < 0) {
+ break;
+ }
+
+ snd_mixer_selem_get_id(elem, dev->selems[i].sid);
+ dev->selems[i].elem = elem;
+
+ snprintf(name,
+ sizeof(name),
+ "%s:%d",
+ snd_mixer_selem_id_get_name(dev->selems[i].sid),
+ snd_mixer_selem_id_get_index(dev->selems[i].sid));
+
+ dev->selems[i].name = strdup(name);
+ if (!dev->selems[i].name) {
+ break;
+ }
+ i++;
+ }
+
+ if (i == dev->numselems) {
+ return TRUE;
+ }
+
+ } while (FALSE);
+
+ if (dev->selems) {
+ for (i = 0; i < dev->numselems; i++) {
+ if (dev->selems[i].sid) {
+ snd_mixer_selem_id_free(dev->selems[i].sid);
+ }
+ if (dev->selems[i].name) {
+ free(dev->selems[i].name);
+ }
+ }
+ free(dev->selems);
+ dev->selems = NULL;
+ }
+
+ if (dev->handle) {
+ snd_mixer_close(dev->handle);
+ dev->handle = NULL;
+ }
+
+ return FALSE;
+}
+
+int OpenMixer_Linux_ALSA(px_mixer *Px, int index)
+{
+ PxInfo *info;
+ int card;
+
+ if (!initialize(Px)) {
+ return FALSE;
+ }
+
+ info = (PxInfo *) Px->info;
+
+ if (PaAlsa_GetStreamInputCard(Px->pa_stream, &card) == paNoError) {
+ if (!open_mixer(&info->capture, card, FALSE)) {
+ return cleanup(Px);
+ }
+ }
+
+ if (PaAlsa_GetStreamOutputCard(Px->pa_stream, &card) == paNoError) {
+ if (!open_mixer(&info->playback, card, TRUE)) {
+ return cleanup(Px);
+ }
+ }
+
+ return TRUE;
+}
+
+static int initialize(px_mixer *Px)
+{
+ Px->info = calloc(1, sizeof(PxInfo));
+ if (Px->info == NULL) {
+ return FALSE;
+ }
+
+ Px->CloseMixer = close_mixer;
+ Px->GetNumMixers = get_num_mixers;
+ Px->GetMixerName = get_mixer_name;
+ Px->GetMasterVolume = get_master_volume;
+ Px->SetMasterVolume = set_master_volume;
+ Px->SupportsPCMOutputVolume = supports_pcm_output_volume;
+ Px->GetPCMOutputVolume = get_pcm_output_volume;
+ Px->SetPCMOutputVolume = set_pcm_output_volume;
+ Px->GetNumOutputVolumes = get_num_output_volumes;
+ Px->GetOutputVolumeName = get_output_volume_name;
+ Px->GetOutputVolume = get_output_volume;
+ Px->SetOutputVolume = set_output_volume;
+ Px->GetNumInputSources = get_num_input_sources;
+ Px->GetInputSourceName = get_input_source_name;
+ Px->GetCurrentInputSource = get_current_input_source;
+ Px->SetCurrentInputSource = set_current_input_source;
+ Px->GetInputVolume = get_input_volume;
+ Px->SetInputVolume = set_input_volume;
+
+// Px->SupportsOutputBalance = supports_output_balance;
+// Px->GetOutputBalance = get_output_balance;
+// Px->SetOutputBalance = set_output_balance;
+// Px->SupportsPlaythrough = supports_play_through;
+// Px->GetPlaythrough = get_play_through;
+// Px->SetPlaythrough = set_play_through;
+
+ return TRUE;
+}
+
+static int cleanup(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+
+ if (info->capture.selems) {
+ for (i = 0; i < info->capture.numselems; i++) {
+ if (info->capture.selems[i].sid) {
+ snd_mixer_selem_id_free(info->capture.selems[i].sid);
+ }
+ if (info->capture.selems[i].name) {
+ free(info->capture.selems[i].name);
+ }
+ }
+ free(info->capture.selems);
+ }
+
+ if (info->capture.handle) {
+ snd_mixer_close(info->capture.handle);
+ }
+
+ if (info->playback.selems) {
+ for (i = 0; i < info->playback.numselems; i++) {
+ if (info->playback.selems[i].sid) {
+ snd_mixer_selem_id_free(info->playback.selems[i].sid);
+ }
+ if (info->playback.selems[i].name) {
+ free(info->playback.selems[i].name);
+ }
+ }
+ free(info->playback.selems);
+ }
+
+ if (info->playback.handle) {
+ snd_mixer_close(info->playback.handle);
+ }
+
+ if (info) {
+ free(info);
+ Px->info = NULL;
+ }
+
+ return FALSE;
+}
+
+static PxVolume get_volume_indexed(PxDev *dev, int i, int playback)
+{
+ snd_mixer_elem_t *elem;
+ long vol, min, max;
+
+ if (!dev->handle) {
+ return 0.0;
+ }
+
+ if (i < 0 || i > dev->numselems) {
+ return 0.0;
+ }
+
+ elem = dev->selems[i].elem;
+ if (playback) {
+ snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
+ if (snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_FRONT_LEFT)) {
+ snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, &vol);
+ return (PxVolume) vol / (max - min);
+ }
+ }
+ else {
+ snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
+ if (snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_FRONT_LEFT)) {
+ snd_mixer_selem_get_capture_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, &vol);
+ return (PxVolume) vol / (max - min);
+ }
+ }
+
+ return 0.0;
+}
+
+static PxVolume get_volume(PxDev *dev, const char *name, int playback)
+{
+ const char *sname;
+ int i;
+
+ if (!dev->handle) {
+ return 0.0;
+ }
+
+ for (i = 0; i < dev->numselems; i++) {
+ sname = snd_mixer_selem_id_get_name(dev->selems[i].sid);
+ if (strcmp(sname, name) == 0) {
+ return get_volume_indexed(dev, i, playback);
+ }
+ }
+
+ return 0.0;
+}
+
+static void set_volume_indexed(PxDev *dev, int i, PxVolume volume, int playback)
+{
+ snd_mixer_elem_t *elem;
+ long vol, min, max;
+ int j;
+
+ if (!dev->handle) {
+ return;
+ }
+
+ if (i < 0 || i > dev->numselems) {
+ return;
+ }
+
+ elem = dev->selems[i].elem;
+ if (playback) {
+ snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
+ for (j = 0; j < SND_MIXER_SCHN_LAST; j++) {
+ if (snd_mixer_selem_has_playback_channel(elem, j)) {
+ vol = (long) (volume * (max - min) + 0.5);
+ snd_mixer_selem_set_playback_volume(elem, j, vol);
+ }
+ }
+ }
+ else {
+ snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
+ for (j = 0; j < SND_MIXER_SCHN_LAST; j++) {
+ if (snd_mixer_selem_has_capture_channel(elem, j)) {
+ vol = (long) (volume * (max - min) + 0.5);
+ snd_mixer_selem_set_capture_volume(elem, j, vol);
+ }
+ }
+ }
+
+ return;
+}
+
+static void set_volume(PxDev *dev, const char *name, PxVolume volume, int playback)
+{
+ const char *sname;
+ int i;
+
+ if (!dev->handle) {
+ return;
+ }
+
+ for (i = 0; i < dev->numselems; i++) {
+ sname = snd_mixer_selem_id_get_name(dev->selems[i].sid);
+ if (strcmp(sname, name) == 0) {
+ set_volume_indexed(dev, i, volume, playback);
+ break;
+ }
+ }
+
+ return;
+}
+
+static void close_mixer(px_mixer *Px)
+{
+ cleanup(Px);
+
+ return;
+}
+
+static int get_num_mixers(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+ int fd;
+
+ info->numMixers = 0;
+#if 0
+ for (i = 0; i < MIXER_COUNT_MAX; i++) {
+ strcpy(info->mixers[i], MIXER_NAME_BASE);
+
+ if (i == 0)
+ info->mixers[i][strlen(MIXER_NAME_BASE)] = 0;
+ else
+ info->mixers[i][strlen(MIXER_NAME_BASE)] = '0' + (i - 1);
+
+ fd = open(info->mixers[i], O_RDWR);
+ if (fd >= 0) {
+ info->mixerIndexes[info->numMixers] = i;
+ info->numMixers++;
+ close(fd);
+ }
+ }
+#endif
+ return info->numMixers;
+}
+
+static const char *get_mixer_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+#if 0
+ if (info->numMixers <= 0)
+ get_num_mixers(Px);
+
+ if (i >= 0 && i < info->numMixers) {
+ return info->mixers[info->mixerIndexes[i]];
+ }
+#endif
+ return NULL;
+}
+
+/*
+|| Master volume
+*/
+
+static PxVolume get_master_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return get_volume(&info->playback, "Master", TRUE);
+}
+
+static void set_master_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ set_volume(&info->playback, "Master", volume, TRUE);
+
+ return;
+}
+
+/*
+|| Main output volume
+*/
+
+static int supports_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ snd_mixer_selem_id_t *id;
+
+ if (info->playback.handle) {
+ snd_mixer_selem_id_alloca(&id);
+ snd_mixer_selem_id_set_name(id, "PCM");
+
+ if (snd_mixer_find_selem(info->playback.handle, id)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static PxVolume get_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return get_volume(&info->playback, "PCM", TRUE);
+}
+
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ set_volume(&info->playback, "PCM", volume, TRUE);
+
+ return;
+}
+
+/*
+|| All output volumes
+*/
+
+static int get_num_output_volumes(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->playback.handle) {
+ return info->playback.numselems;
+ }
+
+ return 0;
+}
+
+static const char *get_output_volume_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ snd_mixer_elem_t *elem;
+ char name[64];
+ int ndx = 0;
+
+ if (info->playback.handle) {
+ if (i >= 0 && i < info->playback.numselems) {
+ return info->playback.selems[i].name;
+ }
+ }
+
+ return NULL;
+}
+
+static PxVolume get_output_volume(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return get_volume_indexed(&info->playback, i, TRUE);
+}
+
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ set_volume_indexed(&info->playback, i, volume, TRUE);
+
+ return;
+}
+
+/*
+|| Input source
+*/
+
+static int get_num_input_sources(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->capture.handle) {
+ return info->capture.numselems;
+ }
+
+ return 0;
+}
+
+static const char *get_input_source_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->capture.handle) {
+ if (i >= 0 && i < info->capture.numselems) {
+ return info->capture.selems[i].name;
+ }
+ }
+
+ return NULL;
+}
+
+static int get_current_input_source(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ snd_mixer_elem_t *elem;
+ int sw;
+ int i, j;
+
+ if (!info->capture.handle) {
+ return -1;
+ }
+
+ for (i = 0; i < info->capture.numselems; i++) {
+ elem = info->capture.selems[i].elem;
+ for (j = 0; j <= SND_MIXER_SCHN_LAST; j++) {
+ if (snd_mixer_selem_has_capture_switch(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, j, &sw);
+ if (sw) {
+ return i;
+ }
+ }
+ }
+ }
+
+ return -1; /* none */
+}
+
+static void set_current_input_source(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ snd_mixer_elem_t *elem;
+ int j;
+
+ if (!info->capture.handle) {
+ return;
+ }
+
+ if (i < 0 || i >= info->capture.numselems) {
+ return;
+ }
+
+ elem = info->capture.selems[i].elem;
+ for (j = 0; j <= SND_MIXER_SCHN_LAST; j++) {
+ if (snd_mixer_selem_has_capture_switch(elem)) {
+ snd_mixer_selem_set_capture_switch(elem, j, TRUE);
+ }
+ }
+
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return get_volume(&info->capture, "Capture", FALSE);
+}
+
+static void set_input_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ set_volume(&info->capture, "Capture", volume, FALSE);
+
+ return;
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_mac_coreaudio.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_mac_coreaudio.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,507 @@
+/*
+ * PortMixer
+ * Mac OS X / CoreAudio implementation
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioToolbox/AudioConverter.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "portaudio.h"
+#include "pa_mac_core.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+
+// define value of isInput passed to CoreAudio routines
+#define IS_INPUT (TRUE)
+#define IS_OUTPUT (FALSE)
+
+typedef struct PxInfo
+{
+ AudioDeviceID input;
+ AudioDeviceID output;
+ UInt32 *srcids;
+ char **srcnames;
+ int numsrcs;
+} PxInfo;
+
+int OpenMixer_Mac_CoreAudio(px_mixer *Px, int index)
+{
+ PxInfo *info;
+ OSStatus err;
+ UInt32 outSize;
+ UInt32 inID;
+ int i;
+
+ if (!initialize(Px)) {
+ return FALSE;
+ }
+
+ info = (PxInfo *) Px->info;
+
+ info->input = PaMacCore_GetStreamInputDevice(Px->pa_stream);;
+ info->output = PaMacCore_GetStreamOutputDevice(Px->pa_stream);
+
+ if (info->input == kAudioDeviceUnknown) {
+ outSize = sizeof(AudioDeviceID);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
+ &outSize,
+ &info->input);
+ if (err) {
+ return cleanup(Px);
+ }
+ }
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetPropertyInfo(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSources,
+ &outSize,
+ NULL);
+ if (err) {
+ return cleanup(Px);
+ }
+
+ info->numsrcs = outSize / sizeof(UInt32);
+ info->srcids = (UInt32 *)malloc(outSize);
+ info->srcnames = (char **)calloc(info->numsrcs, sizeof(char *));
+
+ if (info->srcids == NULL || info->srcnames == NULL) {
+ return cleanup(Px);
+ }
+
+ err = AudioDeviceGetProperty(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSources,
+ &outSize,
+ info->srcids);
+ if (err) {
+ return cleanup(Px);
+ }
+
+ for (i = 0; i < info->numsrcs; i++) {
+ AudioValueTranslation trans;
+ CFStringRef name;
+ Boolean ok;
+
+ trans.mInputData = &info->srcids[i];
+ trans.mInputDataSize = sizeof(UInt32);
+ trans.mOutputData = &name;
+ trans.mOutputDataSize = sizeof(CFStringRef);
+
+ outSize = sizeof(AudioValueTranslation);
+ err = AudioDeviceGetProperty(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSourceNameForIDCFString,
+ &outSize,
+ &trans);
+ if (err) {
+ return cleanup(Px);
+ }
+
+ info->srcnames[i] = malloc(CFStringGetLength(name)+1);
+ if (info->srcnames[i] == NULL) {
+ return cleanup(Px);
+ }
+
+ ok = CFStringGetCString(name,
+ info->srcnames[i],
+ CFStringGetLength(name)+1,
+ kCFStringEncodingISOLatin1);
+ if (!ok) {
+ return cleanup(Px);
+ }
+ }
+
+ return TRUE;
+}
+
+static int initialize(px_mixer *Px)
+{
+ Px->info = calloc(1, sizeof(PxInfo));
+ if (Px->info == NULL) {
+ return FALSE;
+ }
+
+ Px->CloseMixer = close_mixer;
+ Px->GetNumMixers = get_num_mixers;
+ Px->GetMixerName = get_mixer_name;
+
+// Px->GetMasterVolume = get_master_volume;
+// Px->SetMasterVolume = set_master_volume;
+
+ Px->SupportsPCMOutputVolume = supports_pcm_output_volume;
+ Px->GetPCMOutputVolume = get_pcm_output_volume;
+ Px->SetPCMOutputVolume = set_pcm_output_volume;
+ Px->GetNumOutputVolumes = get_num_output_volumes;
+ Px->GetOutputVolumeName = get_output_volume_name;
+ Px->GetOutputVolume = get_output_volume;
+ Px->SetOutputVolume = set_output_volume;
+ Px->GetNumInputSources = get_num_input_sources;
+ Px->GetInputSourceName = get_input_source_name;
+ Px->GetCurrentInputSource = get_current_input_source;
+ Px->SetCurrentInputSource = set_current_input_source;
+ Px->GetInputVolume = get_input_volume;
+ Px->SetInputVolume = set_input_volume;
+
+// Px->SupportsOutputBalance = supports_output_balance;
+// Px->GetOutputBalance = get_output_balance;
+// Px->SetOutputBalance = set_output_balance;
+
+ Px->SupportsPlaythrough = supports_play_through;
+ Px->GetPlaythrough = get_play_through;
+ Px->SetPlaythrough = set_play_through;
+
+ return TRUE;
+}
+
+static int cleanup(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+
+ if (info) {
+ if (info->srcids) {
+ free(info->srcids);
+ }
+
+ if (info->srcnames) {
+ for (i = 0; i < info->numsrcs; i++) {
+ if (info->srcnames[i]) {
+ free(info->srcnames[i]);
+ }
+ }
+ free(info->srcnames);
+ }
+
+ free(info);
+ Px->info = NULL;
+ }
+
+ return FALSE;
+}
+
+static int get_num_mixers(px_mixer *Px)
+{
+ return 1;
+}
+
+static const char *get_mixer_name(px_mixer *Px, int index)
+{
+ return "CoreAudio";
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+static void close_mixer(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ cleanup(Px);
+}
+
+/*
+|| PCM output volume
+*/
+
+static PxVolume get_volume(AudioDeviceID device, Boolean isInput)
+{
+ OSStatus err;
+ UInt32 outSize;
+ Float32 vol, maxvol = 0.0;
+ UInt32 mute, anymuted = 0;
+ int ch;
+ PxVolume max;
+
+ for (ch = 0; ch <= 2; ch++) {
+ outSize = sizeof(Float32);
+ err = AudioDeviceGetProperty(device,
+ ch,
+ isInput,
+ kAudioDevicePropertyVolumeScalar,
+ &outSize,
+ &vol);
+ if (!err) {
+ if (vol > maxvol)
+ maxvol = vol;
+ }
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetProperty(device,
+ ch,
+ isInput,
+ kAudioDevicePropertyMute,
+ &outSize,
+ &mute);
+
+ if (!err) {
+ if (mute)
+ anymuted = 1;
+ }
+ }
+
+ if (anymuted)
+ maxvol = 0.0;
+
+ return maxvol;
+}
+
+static void set_volume(AudioDeviceID device, Boolean isInput, PxVolume volume)
+{
+ Float32 vol = volume;
+ UInt32 mute = 0;
+ int ch;
+ OSStatus err;
+
+ /* Implement a passive attitude towards muting. If they
+ drag the volume above 0.05, unmute it. But if they
+ drag the volume down below that, just set the volume,
+ don't actually mute.
+ */
+
+ for (ch = 0; ch <= 2; ch++) {
+ err = AudioDeviceSetProperty(device,
+ 0,
+ ch,
+ isInput,
+ kAudioDevicePropertyVolumeScalar,
+ sizeof(Float32),
+ &vol);
+ if (vol > 0.05) {
+ err = AudioDeviceSetProperty(device,
+ 0,
+ ch,
+ isInput,
+ kAudioDevicePropertyMute,
+ sizeof(UInt32),
+ &mute);
+ }
+ }
+}
+
+static int supports_pcm_output_volume(px_mixer *Px)
+{
+ return 1 ;
+}
+
+static PxVolume get_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return get_volume(info->output, IS_OUTPUT);
+}
+
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ set_volume(info->output, IS_OUTPUT, volume);
+}
+
+/*
+|| All output volumes
+*/
+
+int get_num_output_volumes(px_mixer *Px)
+{
+ return 1;
+}
+
+const char *get_output_volume_name(px_mixer *Px, int i)
+{
+ if (i == 0)
+ return "PCM";
+ else
+ return "";
+}
+
+static PxVolume get_output_volume(px_mixer *Px, int i)
+{
+ return get_pcm_output_volume(Px);
+}
+
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume)
+{
+ set_pcm_output_volume(Px, volume);
+
+ return;
+}
+
+/*
+|| Input sources
+*/
+
+static int get_num_input_sources(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return info->numsrcs;
+}
+
+static const char *get_input_source_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (i >= info->numsrcs)
+ return NULL;
+
+ return info->srcnames[i];
+}
+
+static int get_current_input_source(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ OSStatus err;
+ UInt32 outSize;
+ UInt32 outID = 0;
+ int i;
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetProperty(info->input,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSource,
+ &outSize,
+ &outID);
+
+ if (!err) {
+ for (i = 0; i < info->numsrcs; i++) {
+ if (info->srcids[i] == outID) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+}
+
+static void set_current_input_source(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ OSStatus err;
+
+ if (i >= info->numsrcs) {
+ return;
+ }
+
+ err = AudioDeviceSetProperty(info->input,
+ 0,
+ 0,
+ IS_INPUT,
+ kAudioDevicePropertyDataSource,
+ sizeof(UInt32),
+ &info->srcids[i]);
+
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return get_volume(info->input, IS_INPUT);
+}
+
+static void set_input_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ set_volume(info->input, IS_INPUT, volume);
+
+ return;
+}
+
+/*
+|| Playthrough
+*/
+
+static int supports_play_through(px_mixer *Px)
+{
+ return TRUE;
+}
+
+static PxVolume get_play_through(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ OSStatus err;
+ UInt32 outSize;
+ UInt32 flag;
+
+ outSize = sizeof(UInt32);
+ err = AudioDeviceGetProperty(info->output,
+ 0,
+ IS_OUTPUT,
+ kAudioDevicePropertyPlayThru,
+ &outSize,
+ &flag);
+ if (err)
+ return 0.0;
+
+ if (flag)
+ return 1.0;
+ else
+ return 0.0;
+}
+
+static void set_play_through(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ UInt32 flag = (volume > 0.01);
+ OSStatus err;
+
+ err = AudioDeviceSetProperty(info->output,
+ 0,
+ 0,
+ IS_OUTPUT,
+ kAudioDevicePropertyPlayThru,
+ sizeof(UInt32),
+ &flag);
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_mixer.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_mixer.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,628 @@
+/*
+ * PortMixer
+ * PortMixer core
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "portaudio.h"
+#include "portmixer.h"
+#include "px_mixer.h"
+
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+#if defined(__LINUX__) || defined(__APPLE__)
+#include <stdlib.h>
+#endif
+#include <stdlib.h>
+
+#if defined(PX_USE_WIN_MME)
+int OpenMixer_Win_MME(px_mixer *Px, int index);
+#endif
+
+#if defined(PX_USE_WIN_DSOUND)
+int OpenMixer_Win_DirectSound(px_mixer *Px, int index);
+#endif
+
+#if defined(PX_USE_MAC_COREAUDIO)
+int OpenMixer_Mac_CoreAudio(px_mixer *Px, int index);
+#endif
+
+#if defined(PX_USE_UNIX_OSS)
+int OpenMixer_Unix_OSS(px_mixer *Px, int index);
+#endif
+
+#if defined(PX_USE_LINUX_ALSA)
+int OpenMixer_Linux_ALSA(px_mixer *Px, int index);
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(_DEBUG)
+#include <stdio.h>
+#include <stdlib.h>
+static void dprintf(const char *format, ...)
+{
+ char buf[4096];
+ va_list args;
+ int cnt;
+
+ va_start(args, format);
+ cnt = _vsnprintf(buf, sizeof(buf) - 1, format, args);
+ va_end(args);
+
+ if (cnt > 0) {
+ buf[cnt] = '\0';
+ OutputDebugString(buf);
+ }
+}
+#endif
+
+static px_mixer *verify_mixer(PxMixer *mixer)
+{
+ px_mixer *Px = (px_mixer *)mixer;
+
+ if (Px == NULL || Px->magic != PX_MIXER_MAGIC)
+ return NULL;
+
+ return Px;
+}
+
+/*
+ Px_OpenMixer() returns a mixer which will work with the given PortAudio
+ audio device. Pass 0 as the index for the first (default) mixer.
+*/
+
+PxMixer *Px_OpenMixer(PaStream *pa_stream, int i)
+{
+ px_mixer *Px;
+ int good = TRUE;
+
+ Px = (px_mixer *) malloc(sizeof(px_mixer));
+ if (Px == NULL) {
+ return NULL;
+ }
+
+ Px->magic = PX_MIXER_MAGIC;
+ Px->pa_stream = pa_stream;
+ Px->info = NULL;
+
+ if (!initialize(Px)) {
+ free(Px);
+ return NULL;
+ }
+
+ switch (Pa_GetStreamHostApiType(pa_stream))
+ {
+#if defined(PX_USE_WIN_MME)
+ case paMME:
+ good = OpenMixer_Win_MME(Px, i);
+ break;
+#endif
+
+#if defined(PX_USE_WIN_DSOUND)
+ case paDirectSound:
+ good = OpenMixer_Win_DirectSound(Px, i);
+ break;
+#endif
+
+#if defined(PX_USE_MAC_COREAUDIO)
+ case paCoreAudio:
+ good = OpenMixer_Mac_CoreAudio(Px, i);
+ break;
+#endif
+
+#if defined(PX_USE_UNIX_OSS)
+ case paOSS:
+ good = OpenMixer_Unix_OSS(Px, i);
+ break;
+#endif
+
+#if defined(PX_USE_LINUX_ALSA)
+ case paALSA:
+ good = OpenMixer_Linux_ALSA(Px, i);
+ break;
+#endif
+ }
+
+ if (!good) {
+ free(Px);
+ return NULL;
+ }
+
+ return Px;
+}
+
+/*
+ Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any
+ memory associated with it.
+*/
+
+void Px_CloseMixer(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->CloseMixer(Px);
+
+ free(Px);
+
+ return;
+}
+
+/*
+|| Mixer info
+*/
+int Px_GetNumMixers(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ int cnt;
+
+ if (!Px) {
+ return 0;
+ }
+
+ cnt = Px->GetNumMixers(Px);
+
+ return cnt;
+}
+
+const char *Px_GetMixerName(PxMixer *mixer, int i)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ const char *name;
+
+ if (!Px) {
+ return 0;
+ }
+
+ name = Px->GetMixerName(Px, i);
+
+ return name;
+}
+
+/*
+|| Master (output) volume
+*/
+
+PxVolume Px_GetMasterVolume(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0.0;
+
+ return Px->GetMasterVolume(Px);
+}
+
+void Px_SetMasterVolume(PxMixer *mixer, PxVolume volume)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetMasterVolume(Px, volume);
+
+ return;
+}
+
+/*
+|| Main output volume
+*/
+
+PxVolume Px_GetPCMOutputVolume(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0.0;
+
+ return Px->GetPCMOutputVolume(Px);
+}
+
+void Px_SetPCMOutputVolume(PxMixer *mixer, PxVolume volume)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetPCMOutputVolume(Px, volume);
+
+ return;
+}
+
+int Px_SupportsPCMOutputVolume(PxMixer* mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return FALSE;
+
+ return Px->SupportsPCMOutputVolume(Px);
+}
+
+/*
+|| Output info
+*/
+
+int Px_GetNumOutputVolumes(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0;
+
+ return Px->GetNumOutputVolumes(Px);
+}
+
+const char *Px_GetOutputVolumeName(PxMixer *mixer, int i)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return NULL;
+
+ return Px->GetOutputVolumeName(Px, i);
+}
+
+/*
+|| Output volume
+*/
+
+PxVolume Px_GetOutputVolume(PxMixer *mixer, int i)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0.0;
+
+ return Px->GetOutputVolume(Px, i);
+}
+
+void Px_SetOutputVolume(PxMixer *mixer, int i, PxVolume volume)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetOutputVolume(Px, i, volume);
+
+ return;
+}
+
+/*
+|| Input source
+*/
+
+int Px_GetNumInputSources(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0;
+
+ return Px->GetNumInputSources(Px);
+}
+
+const char *Px_GetInputSourceName(PxMixer *mixer, int i)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return NULL;
+
+ return Px->GetInputSourceName(Px, i);
+}
+
+int Px_GetCurrentInputSource(PxMixer *mixer) /* may return -1 == none */
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return -1;
+
+ return Px->GetCurrentInputSource(Px);
+}
+
+void Px_SetCurrentInputSource(PxMixer *mixer, int i)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetCurrentInputSource(Px, i);
+
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+PxVolume Px_GetInputVolume(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0.0;
+
+ return Px->GetInputVolume(Px);
+}
+
+void Px_SetInputVolume(PxMixer *mixer, PxVolume volume)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetInputVolume(Px, volume);
+
+ return;
+}
+
+/*
+|| Balance
+*/
+
+int Px_SupportsOutputBalance(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return FALSE;
+
+ return Px->SupportsOutputBalance(Px);
+}
+
+PxBalance Px_GetOutputBalance(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0.0;
+
+ return Px->GetOutputBalance(Px);
+}
+
+void Px_SetOutputBalance(PxMixer *mixer, PxBalance balance)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetOutputBalance(Px, balance);
+
+ return;
+}
+
+/*
+|| Playthrough
+*/
+
+int Px_SupportsPlaythrough(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return FALSE;
+
+ return Px->SupportsPlaythrough(Px);
+}
+
+PxVolume Px_GetPlaythrough(PxMixer *mixer)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return 0.0;
+
+ return Px->GetPlaythrough(Px);
+}
+
+void Px_SetPlaythrough(PxMixer *mixer, PxVolume volume)
+{
+ px_mixer *Px = verify_mixer(mixer);
+ if (!Px)
+ return;
+
+ Px->SetPlaythrough(Px, volume);
+
+ return;
+}
+
+/* ----------------------------------------------------------------------------
+|| Default API routines ||
+-----------------------------------------------------------------------------*/
+
+static int initialize(px_mixer *Px)
+{
+ Px->CloseMixer = close_mixer;
+ Px->GetNumMixers = get_num_mixers;
+ Px->GetMixerName = get_mixer_name;
+ Px->GetMasterVolume = get_master_volume;
+ Px->SetMasterVolume = set_master_volume;
+ Px->SupportsPCMOutputVolume = supports_pcm_output_volume;
+ Px->GetPCMOutputVolume = get_pcm_output_volume;
+ Px->SetPCMOutputVolume = set_pcm_output_volume;
+ Px->GetNumOutputVolumes = get_num_output_volumes;
+ Px->GetOutputVolumeName = get_output_volume_name;
+ Px->GetOutputVolume = get_output_volume;
+ Px->SetOutputVolume = set_output_volume;
+ Px->GetNumInputSources = get_num_input_sources;
+ Px->GetInputSourceName = get_input_source_name;
+ Px->GetCurrentInputSource = get_current_input_source;
+ Px->SetCurrentInputSource = set_current_input_source;
+ Px->GetInputVolume = get_input_volume;
+ Px->SetInputVolume = set_input_volume;
+ Px->SupportsOutputBalance = supports_output_balance;
+ Px->GetOutputBalance = get_output_balance;
+ Px->SetOutputBalance = set_output_balance;
+ Px->SupportsPlaythrough = supports_play_through;
+ Px->GetPlaythrough = get_play_through;
+ Px->SetPlaythrough = set_play_through;
+
+ return TRUE;
+}
+
+static void close_mixer(px_mixer *Px)
+{
+ return;
+}
+
+static int get_num_mixers(px_mixer *Px)
+{
+ return 0;
+}
+
+static const char *get_mixer_name(px_mixer *Px, int i)
+{
+ return NULL;
+}
+
+static PxVolume get_master_volume(px_mixer *Px)
+{
+ return 0.0;
+}
+
+static void set_master_volume(px_mixer *Px, PxVolume volume)
+{
+ return;
+}
+
+/*
+|| Main output volume
+*/
+
+static int supports_pcm_output_volume(px_mixer *Px)
+{
+ return FALSE;
+}
+
+static PxVolume get_pcm_output_volume(px_mixer *Px)
+{
+ return 0.0;
+}
+
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume)
+{
+ return;
+}
+
+/*
+|| All output volumes
+*/
+
+static int get_num_output_volumes(px_mixer *Px)
+{
+ return 0;
+}
+
+static const char *get_output_volume_name(px_mixer *Px, int i)
+{
+ return NULL;
+}
+
+static PxVolume get_output_volume(px_mixer *Px, int i)
+{
+ return 0.0;
+}
+
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume)
+{
+ return;
+}
+
+/*
+|| Input source
+*/
+
+static int get_num_input_sources(px_mixer *Px)
+{
+ return 0;
+}
+
+static const char *get_input_source_name(px_mixer *Px, int i)
+{
+ return NULL;
+}
+
+static int get_current_input_source(px_mixer *Px)
+{
+ return -1;
+}
+
+static void set_current_input_source(px_mixer *Px, int i)
+{
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px)
+{
+ return 0.0;
+}
+
+static void set_input_volume(px_mixer *Px, PxVolume volume)
+{
+ return;
+}
+
+/*
+|| Balance
+*/
+
+static int supports_output_balance(px_mixer *Px)
+{
+ return FALSE;
+}
+
+static PxBalance get_output_balance(px_mixer *Px)
+{
+ return 0.0;
+}
+
+static void set_output_balance(px_mixer *Px, PxBalance balance)
+{
+ return;
+}
+
+/*
+|| Playthrough
+*/
+
+static int supports_play_through(px_mixer *Px)
+{
+ return FALSE;
+}
+
+static PxVolume get_play_through(px_mixer *Px)
+{
+ return 0.0;
+}
+
+static void set_play_through(px_mixer *Px, PxVolume volume)
+{
+ return;
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_mixer.h
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_mixer.h Fri Aug 24 13:53:53 2007
@@ -0,0 +1,200 @@
+#ifndef PX_MIXER_H
+#define PX_MIXER_H
+/*
+ * PortMixer
+ * PortMixer core header
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#define PX_MIXER_MAGIC 0x50544D52
+
+#if !defined(NULL)
+#define NULL 0
+#endif
+
+#if !defined(FALSE)
+#define FALSE 0
+#endif
+
+#if !defined(TRUE)
+#define TRUE 1
+#endif
+
+typedef struct px_mixer px_mixer;
+
+struct px_mixer
+{
+ unsigned long magic;
+ void *pa_stream;
+ void *info;
+
+ PxMixer (*OpenMixer) (void *pa_stream, int i);
+ void (*CloseMixer) (px_mixer *Px);
+
+ /*
+ || Mixer info
+ */
+ int (*GetNumMixers) (px_mixer *Px);
+ const char *(*GetMixerName) (px_mixer *Px, int i);
+
+ /*
+ || Master (output) volume
+ */
+
+ PxVolume (*GetMasterVolume) (px_mixer *Px);
+ void (*SetMasterVolume) (px_mixer *Px, PxVolume volume);
+
+ /*
+ || Main output volume
+ */
+
+ int (*SupportsPCMOutputVolume) (px_mixer *Px);
+ PxVolume (*GetPCMOutputVolume) (px_mixer *Px);
+ void (*SetPCMOutputVolume) (px_mixer *Px, PxVolume volume);
+
+ /*
+ || Output info
+ */
+
+ int (*GetNumOutputVolumes) (px_mixer *Px);
+ const char *(*GetOutputVolumeName) (px_mixer *Px, int i);
+
+ /*
+ || Output volume
+ */
+
+ PxVolume (*GetOutputVolume) (px_mixer *Px, int i);
+ void (*SetOutputVolume) (px_mixer *Px, int i, PxVolume volume);
+
+ /*
+ || Input source
+ */
+
+ int (*GetNumInputSources) (px_mixer *Px);
+ const char *(*GetInputSourceName) (px_mixer *Px, int i);
+ int (*GetCurrentInputSource) (px_mixer *Px); /* may return -1 == none */
+ void (*SetCurrentInputSource) (px_mixer *Px, int i);
+
+ /*
+ || Input volume
+ */
+
+ PxVolume (*GetInputVolume) (px_mixer *Px);
+ void (*SetInputVolume) (px_mixer *Px, PxVolume volume);
+
+ /*
+ || Balance
+ */
+
+ int (*SupportsOutputBalance) (px_mixer *Px);
+ PxBalance (*GetOutputBalance) (px_mixer *Px);
+ void (*SetOutputBalance) (px_mixer *Px, PxBalance balance);
+
+ /*
+ || Playthrough
+ */
+
+ int (*SupportsPlaythrough) (px_mixer *Px);
+ PxVolume (*GetPlaythrough) (px_mixer *Px);
+ void (*SetPlaythrough) (px_mixer *Px, PxVolume volume);
+};
+
+static int initialize(px_mixer *Px);
+static int cleanup(px_mixer *Px);
+
+static void close_mixer(px_mixer *Px);
+static int get_num_mixers(px_mixer *Px);
+static const char *get_mixer_name(px_mixer *Px, int i);
+static PxVolume get_master_volume(px_mixer *Px);
+static void set_master_volume(px_mixer *Px, PxVolume volume);
+
+/*
+|| Main output volume
+*/
+
+static PxVolume get_pcm_output_volume(px_mixer *Px);
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume);
+static int supports_pcm_output_volume(px_mixer *Px);
+
+/*
+|| All output volumes
+*/
+
+static int get_num_output_volumes(px_mixer *Px);
+static const char *get_output_volume_name(px_mixer *Px, int i);
+static PxVolume get_output_volume(px_mixer *Px, int i);
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume);
+
+/*
+|| Input source
+*/
+
+static int get_num_input_sources(px_mixer *Px);
+static const char *get_input_source_name(px_mixer *Px, int i);
+static int get_current_input_source(px_mixer *Px);
+static void set_current_input_source(px_mixer *Px, int i);
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px);
+static void set_input_volume(px_mixer *Px, PxVolume volume);
+
+/*
+|| Balance
+*/
+
+static int supports_output_balance(px_mixer *Px);
+static PxBalance get_output_balance(px_mixer *Px);
+static void set_output_balance(px_mixer *Px, PxBalance balance);
+
+/*
+|| Playthrough
+*/
+
+static int supports_play_through(px_mixer *Px);
+static PxVolume get_play_through(px_mixer *Px);
+static void set_play_through(px_mixer *Px, PxVolume volume);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: freeswitch/branches/cseket/libs/portmixer/src/px_unix_oss.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_unix_oss.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,531 @@
+/*
+ * PortMixer
+ * Unix OSS Implementation
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#if defined(__linux__)
+#include <linux/soundcard.h>
+#elif defined(__FreeBSD__)
+#include <sys/soundcard.h>
+#else
+#include <machine/soundcard.h> /* JH20010905 */
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include "portaudio.h"
+#include "pa_unix_oss.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+
+#if !defined(FALSE)
+#define FALSE 0
+#endif
+
+#if !defined(TRUE)
+#define TRUE 1
+#endif
+
+#define MIXER_NAME_BASE "/dev/mixer"
+#define MIXER_COUNT_MAX 10
+
+typedef struct PxDev
+{
+ const char *name;
+ int fd;
+ int num;
+ int chans[SOUND_MIXER_NRDEVICES];
+} PxDev;
+
+typedef struct PxInfo
+{
+ int numMixers;
+ int mixerIndexes[MIXER_COUNT_MAX];
+ char mixers[MIXER_COUNT_MAX][sizeof(MIXER_NAME_BASE) + 1];
+
+ PxDev capture;
+ PxDev playback;
+} PxInfo;
+
+static const char *labels[] = SOUND_DEVICE_LABELS;
+
+static int open_mixer(PxDev *dev, int cmd)
+{
+ char name[sizeof(MIXER_NAME_BASE) + 1];
+ int mask;
+ int i;
+ int id = 0;
+
+ for (i = strlen(dev->name) - 1; i >= 0; i++) {
+ if (!isdigit(dev->name[i])) {
+ break;
+ }
+ }
+
+ id = atoi(&dev->name[i + 1]);
+ if (id < 0 || id >= MIXER_COUNT_MAX) {
+ return -1;
+ }
+
+ strcpy(name, MIXER_NAME_BASE);
+ if (id == 0)
+ name[strlen(MIXER_NAME_BASE)] = 0;
+ else
+ name[strlen(MIXER_NAME_BASE)] = '0' + (id - 1);
+
+ do {
+ dev->fd = open(name, O_RDWR);
+ if (dev->fd < 0) {
+ break;
+ }
+
+ if (ioctl(dev->fd, cmd, &mask) == -1) {
+ break;
+ }
+
+ dev->num = 0;
+
+ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
+ if (mask & (1 << i)) {
+ dev->chans[dev->num++] = i;
+ }
+ }
+ return TRUE;
+
+ } while (FALSE);
+
+ if (dev->fd >= 0) {
+ close(dev->fd);
+ dev->fd = -1;
+ }
+
+ return FALSE;
+}
+
+int OpenMixer_Unix_OSS(px_mixer *Px, int index)
+{
+ PxInfo *info;
+
+ if (!initialize(Px)) {
+ return FALSE;
+ }
+
+ get_num_mixers(Px);
+
+ info = (PxInfo *) Px->info;
+ info->capture.fd = -1;
+ info->capture.num = 0;
+ info->playback.fd = -1;
+ info->playback.num = 0;
+
+ do {
+ info->capture.name = PaOSS_GetStreamInputDevice(Px->pa_stream);
+
+ if (info->capture.name) {
+ if (!open_mixer(&info->capture, SOUND_MIXER_READ_RECMASK)) {
+ break;
+ }
+ }
+
+ info->playback.name = PaOSS_GetStreamOutputDevice(Px->pa_stream);
+ if (info->playback.name) {
+ if (!open_mixer(&info->playback, SOUND_MIXER_READ_DEVMASK)) {
+ break;
+ }
+ }
+
+ return TRUE;
+
+ } while (FALSE);
+
+ return cleanup(Px);
+}
+
+static PxVolume get_volume(int fd, int channel)
+{
+ int vol;
+ int stereo;
+
+ if (ioctl(fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == 0)
+ stereo = ((stereo & (1 << channel)) != 0);
+ else
+ stereo = 0;
+
+ if (ioctl(fd, MIXER_READ(channel), &vol) == -1)
+ return 0.0;
+
+ if (stereo)
+ return ((vol & 0xFF)/200.0) + (((vol>>8) & 0xFF)/200.0);
+ else
+ return (vol & 0xFF)/100.0;
+}
+
+static int initialize(px_mixer *Px)
+{
+ Px->info = calloc(1, sizeof(PxInfo));
+ if (Px->info == NULL) {
+ return FALSE;
+ }
+
+ Px->CloseMixer = close_mixer;
+ Px->GetNumMixers = get_num_mixers;
+ Px->GetMixerName = get_mixer_name;
+ Px->GetMasterVolume = get_master_volume;
+ Px->SetMasterVolume = set_master_volume;
+ Px->SupportsPCMOutputVolume = supports_pcm_output_volume;
+ Px->GetPCMOutputVolume = get_pcm_output_volume;
+ Px->SetPCMOutputVolume = set_pcm_output_volume;
+ Px->GetNumOutputVolumes = get_num_output_volumes;
+ Px->GetOutputVolumeName = get_output_volume_name;
+ Px->GetOutputVolume = get_output_volume;
+ Px->SetOutputVolume = set_output_volume;
+ Px->GetNumInputSources = get_num_input_sources;
+ Px->GetInputSourceName = get_input_source_name;
+ Px->GetCurrentInputSource = get_current_input_source;
+ Px->SetCurrentInputSource = set_current_input_source;
+ Px->GetInputVolume = get_input_volume;
+ Px->SetInputVolume = set_input_volume;
+
+// Px->SupportsOutputBalance = supports_output_balance;
+// Px->GetOutputBalance = get_output_balance;
+// Px->SetOutputBalance = set_output_balance;
+// Px->SupportsPlaythrough = supports_play_through;
+// Px->GetPlaythrough = get_play_through;
+// Px->SetPlaythrough = set_play_through;
+
+ return TRUE;
+}
+
+static int cleanup(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->capture.fd >= 0) {
+ close(info->capture.fd);
+ }
+
+ if (info->playback.fd >= 0) {
+ close(info->playback.fd);
+ }
+
+ if (info) {
+ free(info);
+ Px->info = NULL;
+ }
+
+ return FALSE;
+}
+
+static void close_mixer(px_mixer *Px)
+{
+ cleanup(Px);
+
+ return;
+}
+
+static int get_num_mixers(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+ int fd;
+
+ info->numMixers = 0;
+
+ for (i = 0; i < MIXER_COUNT_MAX; i++) {
+ strcpy(info->mixers[i], MIXER_NAME_BASE);
+
+ if (i == 0)
+ info->mixers[i][strlen(MIXER_NAME_BASE)] = 0;
+ else
+ info->mixers[i][strlen(MIXER_NAME_BASE)] = '0' + (i - 1);
+
+ fd = open(info->mixers[i], O_RDWR);
+ if (fd >= 0) {
+ info->mixerIndexes[info->numMixers] = i;
+ info->numMixers++;
+ close(fd);
+ }
+ }
+
+ return info->numMixers;
+}
+
+static const char *get_mixer_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->numMixers <= 0)
+ get_num_mixers(Px);
+
+ if (i >= 0 && i < info->numMixers) {
+ return info->mixers[info->mixerIndexes[i]];
+ }
+
+ return NULL;
+}
+
+/*
+|| Master volume
+*/
+
+static PxVolume get_master_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->playback.fd >= 0) {
+ return get_volume(info->playback.fd, SOUND_MIXER_READ_VOLUME);
+ }
+
+ return 0.0;
+}
+
+static void set_master_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int vol = (int) ((volume * 100.0) + 0.5);
+
+ if (info->playback.fd >= 0) {
+ vol = (vol | (vol << 8));
+ ioctl(info->playback.fd, SOUND_MIXER_WRITE_VOLUME, &vol);
+ }
+
+ return;
+}
+
+/*
+|| Main output volume
+*/
+
+static int supports_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+
+ if (info->playback.fd >= 0) {
+ for (i = 0; i < info->playback.num; i++) {
+ if (info->playback.chans[i] == SOUND_MIXER_PCM) {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+static PxVolume get_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (supports_pcm_output_volume(Px)) {
+ return get_volume(info->playback.fd, SOUND_MIXER_READ_PCM);
+ }
+
+ return 0.0;
+}
+
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int vol = (int) ((volume * 100.0) + 0.5);
+
+ if (supports_pcm_output_volume(Px)) {
+ vol = (vol | (vol << 8));
+ ioctl(info->playback.fd, SOUND_MIXER_WRITE_PCM, &vol);
+ }
+
+ return;
+}
+
+/*
+|| All output volumes
+*/
+
+static int get_num_output_volumes(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return info->playback.num;
+}
+
+static const char *get_output_volume_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->playback.fd >= 0) {
+ if (i >= 0 && i < info->playback.num) {
+ return labels[info->playback.chans[i]];
+ }
+ }
+
+ return NULL;
+}
+
+static PxVolume get_output_volume(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->playback.fd >= 0) {
+ if (i >= 0 && i < info->playback.num) {
+ return get_volume(info->playback.fd, info->playback.chans[i]);
+ }
+ }
+
+ return 0.0;
+}
+
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int vol = (int) ((volume * 100.0) + 0.5);
+
+ if (info->playback.fd >= 0) {
+ if (i >= 0 && i < info->playback.num) {
+ vol = (vol | (vol << 8));
+ ioctl(info->playback.fd, MIXER_WRITE(info->playback.chans[i]), &vol);
+ }
+ }
+
+ return;
+}
+
+/*
+|| Input source
+*/
+
+static int get_num_input_sources(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return info->capture.num;
+}
+
+static const char *get_input_source_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (info->capture.fd >= 0) {
+ if (i >= 0 && i < info->capture.num) {
+ return labels[info->capture.chans[i]];
+ }
+ }
+
+ return NULL;
+}
+
+static int get_current_input_source(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int mask;
+ int i;
+
+ /* Note that there may be more than one in OSS; we pick
+ the first one */
+ if (info->capture.fd >= 0) {
+ if (ioctl(info->capture.fd, SOUND_MIXER_READ_RECSRC, &mask) == -1) {
+ return -1; /* none / error */
+ }
+
+ for (i = 0; i < info->capture.num; i++) {
+ if (mask & (1 << info->capture.chans[i])) {
+ return i;
+ }
+ }
+ }
+
+ return -1; /* none */
+}
+
+static void set_current_input_source(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int mask;
+
+ if (info->capture.fd >= 0) {
+ if (i >= 0 && i < info->capture.num) {
+ mask = (1 << info->capture.chans[i]);
+
+ ioctl(info->capture.fd, SOUND_MIXER_WRITE_RECSRC, &mask);
+ }
+ }
+
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+
+ if (info->capture.fd >= 0) {
+ i = get_current_input_source(Px);
+ if (i >= 0) {
+ return get_volume(info->capture.fd, info->capture.chans[i]);
+ }
+ }
+
+ return 0.0;
+}
+
+static void set_input_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int vol;
+ int i;
+
+ if (info->capture.fd >= 0) {
+ i = get_current_input_source(Px);
+ if (i >= 0) {
+ vol = (int) ((volume * 100.0) + 0.5);
+ vol = (vol | (vol << 8));
+
+ ioctl(info->capture.fd, MIXER_WRITE(info->capture.chans[i]), &vol);
+ }
+ }
+
+ return;
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_win_common.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_win_common.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,744 @@
+/*
+ * PortMixer
+ * Common Windows routines
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni and Augustus Saunders
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <windows.h>
+
+#include "portaudio.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+#include "px_win_common.h"
+
+static UINT get_ctrls(HMIXEROBJ mixer, DWORD lineID, PxCtrl **pctrls);
+static DWORD find_ctrl(HMIXEROBJ mixer, DWORD lineID, DWORD ctrlID);
+
+#if defined(_DEBUG)
+#include <stdio.h>
+#include <stdlib.h>
+static void dprintf(const char *format, ...)
+{
+ char buf[4096];
+ va_list args;
+ int cnt;
+
+ va_start(args, format);
+ cnt = _vsnprintf(buf, sizeof(buf) - 1, format, args);
+ va_end(args);
+
+ if (cnt > 0) {
+ buf[cnt] = '\0';
+ OutputDebugString(buf);
+ }
+}
+#endif
+
+int open_mixers(px_mixer *Px, UINT deviceIn, UINT deviceOut)
+{
+ PxInfo*info;
+ MMRESULT res;
+
+ if (deviceIn == UINT_MAX && deviceOut == UINT_MAX) {
+ return FALSE;
+ }
+
+ if (!initialize(Px)) {
+ return FALSE;
+ }
+
+ info = (PxInfo *) Px->info;
+ info->hInputMixer = NULL;
+ info->hOutputMixer = NULL;
+ info->numInputs = 0;
+ info->muxID = 0;
+ info->speakerID = 0;
+ info->waveID = 0;
+
+ if (deviceIn != UINT_MAX) {
+ res = mixerOpen((LPHMIXER) &info->hInputMixer,
+ deviceIn,
+ 0,
+ 0,
+ MIXER_OBJECTF_WAVEIN);
+ if (res != MMSYSERR_NOERROR) {
+ return cleanup(Px);
+ }
+
+ info->muxID = find_ctrl(info->hInputMixer,
+ MIXERLINE_COMPONENTTYPE_DST_WAVEIN,
+ MIXERCONTROL_CONTROLTYPE_MUX);
+ if (info->muxID == -1) {
+ info->muxID = find_ctrl(info->hInputMixer,
+ MIXERLINE_COMPONENTTYPE_DST_WAVEIN,
+ MIXERCONTROL_CONTROLTYPE_MIXER);
+ }
+
+ info->numInputs = get_ctrls(info->hInputMixer,
+ MIXERLINE_COMPONENTTYPE_DST_WAVEIN,
+ &info->src);
+
+ if (info->numInputs == 0) {
+ return cleanup(Px);
+ }
+ }
+
+ if (deviceOut != UINT_MAX) {
+ res = mixerOpen((LPHMIXER) &info->hOutputMixer,
+ deviceOut,
+ 0,
+ 0,
+ MIXER_OBJECTF_WAVEOUT);
+ if (res != MMSYSERR_NOERROR) {
+ return cleanup(Px);
+ }
+
+ info->speakerID = find_ctrl(info->hOutputMixer,
+ MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,
+ MIXERCONTROL_CONTROLTYPE_VOLUME);
+
+ info->waveID = find_ctrl(info->hOutputMixer,
+ MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT,
+ MIXERCONTROL_CONTROLTYPE_VOLUME);
+
+ info->numOutputs = get_ctrls(info->hOutputMixer,
+ MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,
+ &info->dst);
+
+ if (info->numOutputs == 0) {
+ return cleanup(Px);
+ }
+ }
+
+ return TRUE;
+}
+
+static UINT get_ctrls(HMIXEROBJ mixer, DWORD lineID, PxCtrl **pctrls)
+{
+ MMRESULT res;
+ MIXERLINE line;
+ MIXERLINECONTROLS controls;
+ MIXERCONTROL control;
+ PxCtrl *ctrls = NULL;
+ UINT num;
+ UINT s;
+
+ do {
+ line.cbStruct = sizeof(MIXERLINE);
+ line.dwComponentType = lineID;
+
+ res = mixerGetLineInfo(mixer,
+ &line,
+ MIXER_GETLINEINFOF_COMPONENTTYPE);
+
+ if (res != MMSYSERR_NOERROR) {
+ break;
+ }
+
+ num = (UINT) line.cConnections;
+
+ ctrls = calloc(num, sizeof(PxInfo));
+ if (ctrls == NULL) {
+ break;
+ }
+
+ for (s = 0; s < num; s++)
+ {
+ line.dwSource = s;
+
+ res = mixerGetLineInfo(mixer,
+ &line,
+ MIXER_GETLINEINFOF_SOURCE);
+
+ if (res != MMSYSERR_NOERROR) {
+ break;
+ }
+
+ ctrls[s].lineID = line.dwLineID;
+ ctrls[s].name = strdup(line.szName);
+ if (ctrls[s].name == NULL) {
+ break;
+ }
+
+ controls.cbStruct = sizeof(MIXERLINECONTROLS);
+ controls.dwLineID = line.dwLineID;
+ controls.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
+ controls.cbmxctrl = sizeof(MIXERCONTROL);
+ controls.pamxctrl = &control;
+
+ control.cbStruct = sizeof(MIXERCONTROL);
+
+ res = mixerGetLineControls(mixer,
+ &controls,
+ MIXER_GETLINECONTROLSF_ONEBYTYPE);
+
+ if (res == MMSYSERR_NOERROR)
+ ctrls[s].controlID = control.dwControlID;
+ else
+ ctrls[s].controlID = 0;
+ }
+
+ if (s != num) {
+ break;
+ }
+
+ *pctrls = ctrls;
+
+ return num;
+
+ } while (FALSE);
+
+ if (ctrls) {
+ for (s = 0; s < num; s++) {
+ if (ctrls[s].name) {
+ free(ctrls[s].name);
+ }
+ }
+
+ free(ctrls);
+ }
+
+ return 0;
+}
+
+static DWORD find_ctrl(HMIXEROBJ mixer, DWORD lineID, DWORD ctrlID)
+{
+ MMRESULT res;
+ MIXERLINE line;
+ MIXERLINECONTROLS controls;
+ MIXERCONTROL control;
+
+ line.cbStruct = sizeof(MIXERLINE);
+ line.dwComponentType = lineID;
+
+ res = mixerGetLineInfo(mixer,
+ &line,
+ MIXER_GETLINEINFOF_COMPONENTTYPE);
+
+ if (res != MMSYSERR_NOERROR) {
+ return -1;
+ }
+
+ controls.cbStruct = sizeof(MIXERLINECONTROLS);
+ controls.dwLineID = line.dwLineID;
+ controls.dwControlType = ctrlID;
+ controls.cbmxctrl = sizeof(MIXERCONTROL);
+ controls.pamxctrl = &control;
+
+ control.cbStruct = sizeof(MIXERCONTROL);
+
+ res = mixerGetLineControls(mixer,
+ &controls,
+ MIXER_GETLINECONTROLSF_ONEBYTYPE);
+
+ if (res != MMSYSERR_NOERROR) {
+ return -1;
+ }
+
+ return control.dwControlID;
+}
+
+static int initialize(px_mixer *Px)
+{
+ Px->info = calloc(1, sizeof(PxInfo));
+ if (Px->info == NULL) {
+ return FALSE;
+ }
+
+ Px->CloseMixer = close_mixer;
+ Px->GetNumMixers = get_num_mixers;
+ Px->GetMixerName = get_mixer_name;
+ Px->GetMasterVolume = get_master_volume;
+ Px->SetMasterVolume = set_master_volume;
+ Px->SupportsPCMOutputVolume = supports_pcm_output_volume;
+ Px->GetPCMOutputVolume = get_pcm_output_volume;
+ Px->SetPCMOutputVolume = set_pcm_output_volume;
+ Px->GetNumOutputVolumes = get_num_output_volumes;
+ Px->GetOutputVolumeName = get_output_volume_name;
+ Px->GetOutputVolume = get_output_volume;
+ Px->SetOutputVolume = set_output_volume;
+ Px->GetNumInputSources = get_num_input_sources;
+ Px->GetInputSourceName = get_input_source_name;
+ Px->GetCurrentInputSource = get_current_input_source;
+ Px->SetCurrentInputSource = set_current_input_source;
+ Px->GetInputVolume = get_input_volume;
+ Px->SetInputVolume = set_input_volume;
+
+// Px->SupportsOutputBalance = supports_output_balance;
+// Px->GetOutputBalance = get_output_balance;
+// Px->SetOutputBalance = set_output_balance;
+
+// Px->SupportsPlaythrough = supports_play_through;
+// Px->GetPlaythrough = get_play_through;
+// Px->SetPlaythrough = set_play_through;
+
+ return TRUE;
+}
+
+static int cleanup(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int i;
+
+ if (info) {
+ if (info->hInputMixer) {
+ mixerClose((HMIXER) info->hInputMixer);
+ }
+
+ if (info->hOutputMixer) {
+ mixerClose((HMIXER) info->hOutputMixer);
+ }
+
+ if (info->inName) {
+ free(info->inName);
+ }
+
+ if (info->outName) {
+ free(info->outName);
+ }
+
+ if (info->src) {
+ for (i = 0; i < info->numInputs; i++) {
+ if (info->src[i].name) {
+ free(info->src[i].name);
+ }
+ }
+
+ free(info->src);
+ }
+
+ if (info->dst) {
+ for (i = 0; i < info->numOutputs; i++) {
+ if (info->dst[i].name) {
+ free(info->dst[i].name);
+ }
+ }
+
+ free(info->dst);
+ }
+
+ free(info);
+ Px->info = NULL;
+ }
+
+ return FALSE;
+}
+
+static void close_mixer(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ cleanup(Px);
+}
+
+static int get_num_mixers(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return (info->hInputMixer != NULL) + (info->hOutputMixer != NULL);
+}
+
+static const char *get_mixer_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ MIXERCAPS caps;
+ MMRESULT res;
+
+ if (i > 1) {
+ return NULL;
+ }
+
+ if (i == 0) {
+ if (!info->inName) {
+ res = mixerGetDevCaps((UINT) info->hInputMixer, &caps, sizeof(caps));
+ if (res == MMSYSERR_NOERROR) {
+ info->inName = strdup(caps.szPname);
+ }
+ }
+ return info->inName;
+ }
+
+ if (!info->outName) {
+ res = mixerGetDevCaps((UINT) info->hOutputMixer, &caps, sizeof(caps));
+ if (res == MMSYSERR_NOERROR) {
+ info->outName = strdup(caps.szPname);
+ }
+ }
+
+ return info->outName;
+}
+
+static PxVolume VolumeFunction(HMIXEROBJ hMixer, DWORD controlID, PxVolume volume)
+{
+ MIXERCONTROLDETAILS details;
+ MMRESULT result;
+ MIXERCONTROLDETAILS_UNSIGNED value;
+
+ if (hMixer == NULL) {
+ return -1.0;
+ }
+
+ memset(&value, 0, sizeof(MIXERCONTROLDETAILS_UNSIGNED));
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = controlID;
+ details.cChannels = 1; /* all channels */
+ details.cMultipleItems = 0;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
+ details.paDetails = &value;
+
+ if (volume < 0.0) {
+ result = mixerGetControlDetails(hMixer,
+ &details,
+ MIXER_GETCONTROLDETAILSF_VALUE);
+ if (result != MMSYSERR_NOERROR)
+ return -1.0;
+
+ return (PxVolume)(value.dwValue / 65535.0);
+ }
+
+ value.dwValue = (unsigned short)(volume * 65535.0);
+ result = mixerSetControlDetails(hMixer,
+ &details,
+ MIXER_GETCONTROLDETAILSF_VALUE);
+
+ if (result != MMSYSERR_NOERROR)
+ return -1.0;
+
+ return 0.0;
+}
+
+static PxVolume get_master_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return VolumeFunction(info->hOutputMixer, info->speakerID, -1.0);
+}
+
+static void set_master_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ VolumeFunction(info->hOutputMixer, info->speakerID, volume);
+
+ return;
+}
+
+/*
+|| Main output volume
+*/
+
+static int supports_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return (info->waveID != -1);
+}
+
+static PxVolume get_pcm_output_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return VolumeFunction(info->hOutputMixer, info->waveID, -1.0);
+}
+
+static void set_pcm_output_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ VolumeFunction(info->hOutputMixer, info->waveID, volume);
+
+ return;
+}
+
+/*
+|| Output info
+*/
+
+static int get_num_output_volumes(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return info->numOutputs;
+}
+
+static const char *get_output_volume_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (i < info->numOutputs) {
+ return info->dst[i].name;
+ }
+
+ return NULL;
+}
+
+/*
+|| Output volume
+*/
+
+static PxVolume get_output_volume(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (i < info->numOutputs) {
+ return VolumeFunction(info->hOutputMixer,
+ info->src[i].controlID,
+ -1.0);
+ }
+
+ return -1.0;
+}
+
+static void set_output_volume(px_mixer *Px, int i, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (i < info->numOutputs) {
+ VolumeFunction(info->hOutputMixer,
+ info->src[i].controlID,
+ volume);
+ }
+
+ return;
+}
+
+/*
+|| Input source
+*/
+
+static int get_num_input_sources(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ return info->numInputs;
+}
+
+static const char *get_input_source_name(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+
+ if (i < info->numInputs) {
+ return info->src[i].name;
+ }
+
+ return NULL;
+}
+
+static int get_current_input_source(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ MIXERCONTROLDETAILS details;
+ MIXERCONTROLDETAILS_LISTTEXT *list;
+ MIXERCONTROLDETAILS_BOOLEAN *flags;
+ MMRESULT res;
+ int i = -1;
+ int j;
+
+ if (!info->hInputMixer) {
+ return -1;
+ }
+
+ do {
+ list = calloc(info->numInputs, sizeof(MIXERCONTROLDETAILS_LISTTEXT));
+ flags = calloc(info->numInputs, sizeof(MIXERCONTROLDETAILS_BOOLEAN));
+ if (list == NULL || flags == NULL) {
+ break;
+ }
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = info->muxID;
+ details.cMultipleItems = info->numInputs;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXT);
+ details.paDetails = &list[0];
+
+ res = mixerGetControlDetails(info->hInputMixer,
+ &details,
+ MIXER_GETCONTROLDETAILSF_LISTTEXT);
+
+ if (res != MMSYSERR_NOERROR) {
+ break;
+ }
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = info->muxID;
+ details.cMultipleItems = info->numInputs;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
+ details.paDetails = &flags[0];
+
+ res = mixerGetControlDetails(info->hInputMixer,
+ &details,
+ MIXER_SETCONTROLDETAILSF_VALUE);
+
+ if (res != MMSYSERR_NOERROR) {
+ break;
+ }
+
+ for (j = 0; j < info->numInputs; j++) {
+ if (flags[j].fValue) {
+ i = j;
+ break;
+ }
+ }
+
+ for (j = 0; j < info->numInputs; j++) {
+ if (info->src[j].lineID == list[i].dwParam1 ) {
+ i = j;
+ break;
+ }
+ }
+
+ } while(FALSE);
+
+ if (list) {
+ free(list);
+ }
+
+ if (flags) {
+ free(flags);
+ }
+
+ return i;
+}
+
+static void set_current_input_source(px_mixer *Px, int i)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ MIXERCONTROLDETAILS details;
+ MIXERCONTROLDETAILS_LISTTEXT *list;
+ MIXERCONTROLDETAILS_BOOLEAN *flags;
+ MMRESULT res;
+ int j;
+
+ if (!info->hInputMixer) {
+ return;
+ }
+
+ do {
+ list = calloc(info->numInputs, sizeof(MIXERCONTROLDETAILS_LISTTEXT));
+ flags = calloc(info->numInputs, sizeof(MIXERCONTROLDETAILS_BOOLEAN));
+ if (list == NULL || flags == NULL) {
+ break;
+ }
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = info->muxID;
+ details.cMultipleItems = info->numInputs;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXT);
+ details.paDetails = &list[0];
+
+ res = mixerGetControlDetails(info->hInputMixer,
+ &details,
+ MIXER_GETCONTROLDETAILSF_LISTTEXT);
+
+ if (res != MMSYSERR_NOERROR) {
+ break;
+ }
+
+ for (j = 0; j < info->numInputs; j++) {
+ if (list[j].dwParam1 == info->src[i].lineID) {
+ flags[j].fValue = TRUE;
+ break;
+ }
+ }
+
+ details.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ details.dwControlID = info->muxID;
+ details.cMultipleItems = info->numInputs;
+ details.cChannels = 1;
+ details.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
+ details.paDetails = &flags[0];
+
+ res = mixerSetControlDetails(info->hInputMixer,
+ &details,
+ MIXER_SETCONTROLDETAILSF_VALUE);
+
+ if (res != MMSYSERR_NOERROR) {
+ break;
+ }
+ } while(FALSE);
+
+ if (list) {
+ free(list);
+ }
+
+ if (flags) {
+ free(flags);
+ }
+
+ return;
+}
+
+/*
+|| Input volume
+*/
+
+static PxVolume get_input_volume(px_mixer *Px)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int src;
+
+ if (info->hInputMixer) {
+ src = get_current_input_source(Px);
+ if (src < info->numInputs) {
+ return VolumeFunction(info->hInputMixer,
+ info->src[src].controlID,
+ -1.0);
+ }
+ }
+
+ return -1.0;
+}
+
+static void set_input_volume(px_mixer *Px, PxVolume volume)
+{
+ PxInfo *info = (PxInfo *)Px->info;
+ int src;
+
+ if (info->hInputMixer) {
+ src = get_current_input_source(Px);
+ if (src < info->numInputs) {
+ VolumeFunction(info->hInputMixer,
+ info->src[src].controlID,
+ volume);
+ }
+ }
+
+ return;
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_win_common.h
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_win_common.h Fri Aug 24 13:53:53 2007
@@ -0,0 +1,75 @@
+#ifndef PX_WIN_COMMON_H
+#define PX_WIN_COMMON_H
+/*
+ * PortMixer
+ * Windows Common Header
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+typedef struct PxCtrl
+{
+ char *name;
+ DWORD lineID;
+ DWORD controlID;
+} PxCtrl;
+
+typedef struct PxInfo
+{
+ HMIXEROBJ hInputMixer;
+ char *inName;
+ int numInputs;
+ PxCtrl *src;
+
+ HMIXEROBJ hOutputMixer;
+ char *outName;
+ int numOutputs;
+ PxCtrl *dst;
+
+ DWORD muxID;
+ DWORD speakerID;
+ DWORD waveID;
+} PxInfo;
+
+int open_mixers(px_mixer *Px, UINT deviceIn, UINT deviceOut);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: freeswitch/branches/cseket/libs/portmixer/src/px_win_ds.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_win_ds.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,179 @@
+/*
+ * PortMixer
+ * Windows DirectSound Implementation
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni and Augustus Saunders
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#define COBJMACROS
+#define DIRECTSOUND_VERSION 0x0300
+
+#include <windows.h>
+#include <dsound.h>
+#include <dsconf.h>
+#include <objbase.h>
+#include <unknwn.h>
+
+#include "portaudio.h"
+#include "pa_win_ds.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+#include "px_win_common.h"
+
+const GUID FAR DSPROPSETID_DirectSoundDevice =
+{0x84624f82, 0x25ec, 0x11d1, {0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca}};
+
+const GUID FAR CLSID_DirectSoundPrivate =
+{0x11ab3ec0, 0x25ec, 0x11d1, {0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca}};
+
+typedef HRESULT (CALLBACK *GCO) (REFCLSID, REFIID, LPVOID *);
+
+#if defined(_DEBUG)
+#include <stdio.h>
+static void dprintf(const char *format, ...)
+{
+ char buf[4096];
+ va_list args;
+ int cnt;
+
+ va_start(args, format);
+ cnt = _vsnprintf(buf, sizeof(buf) - 1, format, args);
+ va_end(args);
+
+ if (cnt > 0) {
+ buf[cnt] = '\0';
+ OutputDebugString(buf);
+ }
+}
+#endif
+
+int OpenMixer_Win_DirectSound(px_mixer *Px, int index)
+{
+ DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA desc;
+ HMODULE hDsound = INVALID_HANDLE_VALUE;
+ GCO DllGetClassObject;
+ IClassFactory *pcf = NULL;
+ IKsPropertySet *pps = NULL;
+ HRESULT hr;
+ ULONG bytes;
+ LPGUID guidIn;
+ LPGUID guidOut;
+ UINT deviceIn = -1;
+ UINT deviceOut = -1;
+
+ guidIn = PaWinDS_GetStreamInputGUID(Px->pa_stream);
+ guidOut = PaWinDS_GetStreamOutputGUID(Px->pa_stream);
+
+ do {
+ hDsound = LoadLibrary("dsound.dll");
+ if (hDsound == NULL) {
+ break;
+ }
+
+ DllGetClassObject = (GCO) GetProcAddress(hDsound, "DllGetClassObject");
+ if (DllGetClassObject == NULL) {
+ break;
+ }
+
+ hr = DllGetClassObject(&CLSID_DirectSoundPrivate,
+ &IID_IClassFactory,
+ (void **)(&pcf));
+ if (hr || pcf == NULL) {
+ break;
+ }
+
+ hr = IClassFactory_CreateInstance(pcf,
+ NULL,
+ &IID_IKsPropertySet,
+ (void **)(&pps));
+ if (hr || pps == NULL) {
+ break;
+ }
+
+ if (guidIn) {
+ memcpy(&desc.DeviceId, guidIn, sizeof(desc.DeviceId));
+ desc.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
+ hr = IKsPropertySet_Get(pps,
+ &DSPROPSETID_DirectSoundDevice,
+ DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
+ NULL,
+ 0,
+ &desc,
+ sizeof(desc),
+ &bytes);
+ if (FAILED(hr)) {
+ break;
+ }
+
+ deviceIn = desc.WaveDeviceId;
+ }
+
+ if (guidOut) {
+ memcpy(&desc.DeviceId, guidOut, sizeof(desc.DeviceId));
+ desc.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
+ hr = IKsPropertySet_Get(pps,
+ &DSPROPSETID_DirectSoundDevice,
+ DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
+ NULL,
+ 0,
+ &desc,
+ sizeof(desc),
+ &bytes);
+ if (FAILED(hr)) {
+ break;
+ }
+
+ deviceOut = desc.WaveDeviceId;
+ }
+
+ if (open_mixers(Px, deviceIn, deviceOut))
+ {
+ return TRUE;
+ }
+ } while( FALSE );
+
+ if (pps) {
+ IUnknown_Release(pps);
+ }
+
+ if (pcf) {
+ IUnknown_Release(pcf);
+ }
+
+ if (hDsound != INVALID_HANDLE_VALUE) {
+ FreeLibrary(hDsound);
+ }
+
+ return FALSE;
+}
Added: freeswitch/branches/cseket/libs/portmixer/src/px_win_wmme.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/src/px_win_wmme.c Fri Aug 24 13:53:53 2007
@@ -0,0 +1,82 @@
+/*
+ * PortMixer
+ * Windows WMME Implementation
+ *
+ * Copyright (c) 2002, 2006
+ *
+ * Written by Dominic Mazzoni and Augustus Saunders
+ * and Leland Lucius
+ *
+ * PortMixer is intended to work side-by-side with PortAudio,
+ * the Portable Real-Time Audio Library by Ross Bencina and
+ * Phil Burk.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <windows.h>
+
+#include "portaudio.h"
+#include "pa_win_wmme.h"
+
+#include "portmixer.h"
+#include "px_mixer.h"
+#include "px_win_common.h"
+
+int OpenMixer_Win_MME(px_mixer *Px, int index)
+{
+ HWAVEIN hWaveIn;
+ HWAVEOUT hWaveOut;
+ MMRESULT res;
+ UINT deviceIn = UINT_MAX;
+ UINT deviceOut = UINT_MAX;
+
+ hWaveIn = PaWinMME_GetStreamInputHandle(Px->pa_stream, 0);
+ hWaveOut = PaWinMME_GetStreamOutputHandle(Px->pa_stream, 0);
+
+ if (hWaveIn) {
+ res = mixerGetID((HMIXEROBJ) hWaveIn,
+ &deviceIn,
+ MIXER_OBJECTF_HWAVEIN);
+ if (res != MMSYSERR_NOERROR) {
+ return FALSE;
+ }
+ }
+
+ if (hWaveOut) {
+ res = mixerGetID((HMIXEROBJ) hWaveOut,
+ &deviceOut,
+ MIXER_OBJECTF_HWAVEOUT);
+ if (res != MMSYSERR_NOERROR) {
+ return FALSE;
+ }
+ }
+
+ if (open_mixers(Px, deviceIn, deviceOut)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
Added: freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Entries
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Entries Fri Aug 24 13:53:53 2007
@@ -0,0 +1,2 @@
+/portmixer.vcproj/1.13/Mon Jun 18 16:10:53 2007//
+D
Added: freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Repository
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Repository Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+lib-src/portmixer/winproj
Added: freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Root
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/winproj/CVS/Root Fri Aug 24 13:53:53 2007
@@ -0,0 +1 @@
+:pserver:anonymous@audacity.cvs.sourceforge.net:/cvsroot/audacity
Added: freeswitch/branches/cseket/libs/portmixer/winproj/portmixer.vcproj
==============================================================================
--- (empty file)
+++ freeswitch/branches/cseket/libs/portmixer/winproj/portmixer.vcproj Fri Aug 24 13:53:53 2007
@@ -0,0 +1,582 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="portmixer"
+ ProjectGUID="{3A76129B-55AB-4D54-BAA7-08F63ED52569}"
+ RootNamespace="portmixer"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\$(ConfigurationName)"
+ IntermediateDirectory=".\$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PX_USE_WIN_DSOUND 1 >>".\$(ConfigurationName)\config.h"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/O2"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\include;"..\..\portaudio-v19\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PX_USE_WIN_MME"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\$(ConfigurationName)/portmixer.pch"
+ AssemblerListingLocation=".\$(ConfigurationName)/"
+ ObjectFile=".\$(ConfigurationName)/"
+ ProgramDataBaseFileName=".\$(ConfigurationName)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\portmixer.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl /O2 /Ob1 /I "..\..\portaudio-v19\include" /I "..\include" /I"%DXSDK_DIR%include" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /MT /Gy /Fo".\$(OutDir)/" /Fd".\$(OutDir)/" /W3 /c /wd4996 "..\src\px_win_ds.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\$(ConfigurationName)"
+ IntermediateDirectory=".\$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PX_USE_WIN_DSOUND 1 >>".\$(ConfigurationName)\config.h"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\include;"..\..\portaudio-v19\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PX_USE_WIN_MME"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\$(ConfigurationName)/portmixer.pch"
+ AssemblerListingLocation=".\$(ConfigurationName)/"
+ ObjectFile=".\$(ConfigurationName)/"
+ ProgramDataBaseFileName=".\$(ConfigurationName)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\portmixerd.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl /Od /I "..\..\portaudio-v19\include" /I "..\include" /I"%DXSDK_DIR%include" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /FD /EHsc /RTC1 /MTd /Fo".\$(OutDir)/" /Fd".\$(OutDir)/" /W3 /c /ZI /wd4996 "..\src\px_win_ds.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode_Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PX_USE_WIN_DSOUND 1 >>".\$(ConfigurationName)\config.h"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\include;"..\..\portaudio-v19\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PX_USE_WIN_MME"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\$(ConfigurationName)/portmixer.pch"
+ AssemblerListingLocation=".\$(ConfigurationName)/"
+ ObjectFile=".\$(ConfigurationName)/"
+ ProgramDataBaseFileName=".\$(ConfigurationName)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\portmixerud.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl /Od /I "..\..\portaudio-v19\include" /I "..\include" /I"%DXSDK_DIR%include" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /FD /EHsc /RTC1 /MTd /Fo".\$(OutDir)/" /Fd".\$(OutDir)/" /W3 /c /ZI /wd4996 "..\src\px_win_ds.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode_Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PX_USE_WIN_DSOUND 1 >>".\$(ConfigurationName)\config.h"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/O2"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\include;"..\..\portaudio-v19\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PX_USE_WIN_MME"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\$(ConfigurationName)/portmixer.pch"
+ AssemblerListingLocation=".\$(ConfigurationName)/"
+ ObjectFile=".\$(ConfigurationName)/"
+ ProgramDataBaseFileName=".\$(ConfigurationName)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\portmixeru.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl /O2 /Ob1 /I "..\..\portaudio-v19\include" /I "..\include" /I"%DXSDK_DIR%include" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /MT /Gy /Fo".\$(OutDir)/" /Fd".\$(OutDir)/" /W3 /c /wd4996 "..\src\px_win_ds.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug DLL|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PX_USE_WIN_DSOUND 1 >>".\$(ConfigurationName)\config.h"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\include;"..\..\portaudio-v19\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PX_USE_WIN_MME"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\$(ConfigurationName)/portmixer.pch"
+ AssemblerListingLocation=".\$(ConfigurationName)/"
+ ObjectFile=".\$(ConfigurationName)/"
+ ProgramDataBaseFileName=".\$(ConfigurationName)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\portmixerd.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl /Od /I "..\..\portaudio-v19\include" /I "..\include" /I"%DXSDK_DIR%include" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /FD /EHsc /RTC1 /MTd /Fo".\$(OutDir)/" /Fd".\$(OutDir)/" /W3 /c /ZI /wd4996 "..\src\px_win_ds.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug wx284|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="echo // Automatically generated file >".\$(ConfigurationName)\config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PX_USE_WIN_DSOUND 1 >>".\$(ConfigurationName)\config.h"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\include;"..\..\portaudio-v19\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PX_USE_WIN_MME"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\$(ConfigurationName)/portmixer.pch"
+ AssemblerListingLocation=".\$(ConfigurationName)/"
+ ObjectFile=".\$(ConfigurationName)/"
+ ProgramDataBaseFileName=".\$(ConfigurationName)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="$(ProjectDir)\$(ConfigurationName)\config.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\portmixerd.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl /Od /I "..\..\portaudio-v19\include" /I "..\include" /I"%DXSDK_DIR%include" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /FD /EHsc /RTC1 /MTd /Fo".\$(OutDir)/" /Fd".\$(OutDir)/" /W3 /c /ZI /wd4996 "..\src\px_win_ds.c"

set LIBS="%DXSDK_DIR%lib\x86\dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" ".\$(OutDir)\*.obj" %LIBS%
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\src\px_mixer.c"
+ >
+ </File>
+ <File
+ RelativePath="..\src\px_mixer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\px_win_common.c"
+ >
+ </File>
+ <File
+ RelativePath="..\src\px_win_common.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\px_win_ds.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode_Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode_Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug DLL|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug wx284|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\px_win_wmme.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\include\portmixer.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
1
0
[commit] r5662 - freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio
by Freeswitch SVN 24 Aug '07
by Freeswitch SVN 24 Aug '07
24 Aug '07
Author: cseket
Date: Fri Aug 24 13:50:56 2007
New Revision: 5662
Modified:
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/ (props changed)
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/Makefile
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.c
freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.h
Log:
merge from trunk and try to fix MODENDP-20
Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/Makefile
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/Makefile (original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/Makefile Fri Aug 24 13:50:56 2007
@@ -1,22 +1,29 @@
-CFLAGS += -I.
-LDFLAGS += -lportaudio -L$(PREFIX)
-MYOBJS = pablio.o pa_ringbuffer.o
+BASE=../../../..
-all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
+PA_DIR=$(BASE)/libs/portaudio
-depends:
- MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install portaudio --prefix=$(PREFIX) --with-pic
-%.o: %.c
- $(CC) -fPIC $(CFLAGS) -c -o $@ $<
+PALA=$(PA_DIR)/lib/libportaudio.la
+LOCAL_CFLAGS=-I. -I$(PA_DIR)/include -D__EXTENSION__=1
-$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MYOBJS)
- $(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o
- $(CC) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(MYOBJS) $(LDFLAGS)
+LOCAL_INSERT_LDFLAGS=if test $$osarch = "Darwin" ; then echo "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" ; fi ;
+LOCAL_LIBADD=$(PALA)
+LOCAL_OBJS=pablio.o pa_ringbuffer.o
+LOCAL_SOURCES=pablio.c pa_ringbuffer.c
+PX_DIR=$(BASE)/libs/portmixer
+PXA=$(PX_DIR)/libportmixer.a
+LOCAL_CFLAGS+=-I$(PX_DIR)/include
+LOCAL_LIBADD+=$(PXA)
-clean:
- rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~
+include $(BASE)/build/modmake.rules
-install:
- cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
+$(PALA): $(PA_DIR) $(PA_DIR)/.update
+ cd $(PA_DIR) && $(MAKE)
+ $(TOUCH_TARGET)
+
+$(PXA): $(PX_DIR) $(PX_DIR)/.update
+ cd $(PX_DIR) && $(MAKE)
+ $(TOUCH_TARGET)
+
+$(LOCAL_OBJS): $(LOCAL_SOURCES)
Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/mod_portaudio.c Fri Aug 24 13:50:56 2007
@@ -6,7 +6,7 @@
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * the License. You may obtain a copy of the License `
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
@@ -29,32 +29,34 @@
* mod_portaudio.c -- PortAudio Endpoint Module
*
*/
-#include <switch.h>
+#include "switch.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pablio.h"
#include <string.h>
+#include <portmixer.h>
#define MY_EVENT_RINGING "portaudio::ringing"
-static const char modname[] = "mod_portaudio";
+SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown);
+SWITCH_MODULE_DEFINITION(mod_portaudio, mod_portaudio_load, mod_portaudio_shutdown, NULL);
static switch_memory_pool_t *module_pool = NULL;
-//static int running = 1;
+static switch_endpoint_interface_t *channel_endpoint_interface;
#define SAMPLE_TYPE paInt16
-//#define SAMPLE_TYPE paFloat32
-typedef short SAMPLE;
+typedef int16_t SAMPLE;
-typedef switch_status_t (*pa_command_t)(char **argv, int argc, switch_stream_handle_t *stream);
+typedef switch_status_t (*pa_command_t) (char **argv, int argc, switch_stream_handle_t *stream);
typedef enum {
- GFLAG_NONE = 0,
- GFLAG_EAR = (1 << 0),
- GFLAG_MOUTH = (1 << 1),
- GFLAG_RING = (1 << 2)
+ GFLAG_NONE = 0,
+ GFLAG_EAR = (1 << 0),
+ GFLAG_MOUTH = (1 << 1),
+ GFLAG_RING = (1 << 2)
} GFLAGS;
typedef enum {
@@ -75,17 +77,16 @@
switch_core_session_t *session;
switch_caller_profile_t *caller_profile;
char call_id[50];
- int sample_rate;
- int codec_ms;
+ int sample_rate;
+ int codec_ms;
switch_mutex_t *flag_mutex;
- char *hold_file;
- switch_file_handle_t fh;
- switch_file_handle_t *hfh;
+ char *hold_file;
+ switch_file_handle_t fh;
+ switch_file_handle_t *hfh;
switch_frame_t hold_frame;
- unsigned char holdbuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+ unsigned char holdbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
switch_codec_t write_codec;
- switch_timer_t timer;
- struct private_object *next;
+ struct private_object *next;
};
typedef struct private_object private_t;
@@ -96,9 +97,9 @@
char *cid_name;
char *cid_num;
char *dialplan;
- char *ring_file;
- char *hold_file;
- char *timer_name;
+ char *ring_file;
+ char *hold_file;
+ char *timer_name;
int ringdev;
int indev;
int outdev;
@@ -114,12 +115,14 @@
switch_codec_t read_codec;
switch_codec_t write_codec;
switch_frame_t read_frame;
- switch_frame_t cng_frame;
- unsigned char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
- unsigned char cngbuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
- private_t *call_list;
- int ring_interval;
- GFLAGS flags;
+ switch_frame_t cng_frame;
+ unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ unsigned char cngbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ private_t *call_list;
+ int ring_interval;
+ GFLAGS flags;
+ switch_timer_t timer;
+ PxMixer *mixer;
} globals;
@@ -128,126 +131,125 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name)
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num)
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file)
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_hold_file, globals.hold_file)
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name)
-
+ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name)
+ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num)
+ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file)
+ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_hold_file, globals.hold_file)
+ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name)
#define is_master(t) switch_test_flag(t, TFLAG_MASTER)
-static void add_pvt(private_t *tech_pvt, int master);
-static void remove_pvt(private_t *tech_pvt);
-static switch_status_t channel_on_init(switch_core_session_t *session);
-static switch_status_t channel_on_hangup(switch_core_session_t *session);
-static switch_status_t channel_on_ring(switch_core_session_t *session);
-static switch_status_t channel_on_loopback(switch_core_session_t *session);
-static switch_status_t channel_on_transmit(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
- switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t **pool);
-static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
- switch_io_flag_t flags, int stream_id);
-static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
- switch_io_flag_t flags, int stream_id);
-static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
-static switch_status_t engage_device(int samplerate, int codec_ms);
-static switch_status_t engage_ring_device(int sample_rate, int channels);
-static void deactivate_ring_device(void);
-static int dump_info(void);
-static switch_status_t load_config(void);
-static int get_dev_by_name(char *name, int in);
-static int get_dev_by_number(int number, int in);
-static switch_status_t pa_cmd(char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
-static switch_status_t padep(char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
-
+ static void add_pvt(private_t * tech_pvt, int master);
+ static void remove_pvt(private_t * tech_pvt);
+ static switch_status_t channel_on_init(switch_core_session_t *session);
+ static switch_status_t channel_on_hangup(switch_core_session_t *session);
+ static switch_status_t channel_on_ring(switch_core_session_t *session);
+ static switch_status_t channel_on_loopback(switch_core_session_t *session);
+ static switch_status_t channel_on_transmit(switch_core_session_t *session);
+ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t **pool);
+ static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
+ static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
+ static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
+ static switch_status_t engage_device(int samplerate, int codec_ms);
+ static switch_status_t engage_ring_device(int sample_rate, int channels);
+ static void deactivate_ring_device(void);
+ static int dump_info(void);
+ static switch_status_t load_config(void);
+ static int get_dev_by_name(char *name, int in);
+ static int get_dev_by_number(int number, int in);
+ static switch_status_t pa_cmd(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
/*
State methods they get called when the state changes to the specific state
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
*/
-static switch_status_t channel_on_init(switch_core_session_t *session)
+ static switch_status_t channel_on_init(switch_core_session_t *session)
{
switch_channel_t *channel;
private_t *tech_pvt = NULL;
switch_time_t last;
int waitsec = globals.ring_interval * 1000000;
- switch_file_handle_t fh = {0};
- char *val, *ring_file = NULL, *hold_file = NULL;
- int16_t abuf[2048];
+ switch_file_handle_t fh = { 0 };
+ char *val, *ring_file = NULL, *hold_file = NULL;
+ int16_t abuf[2048];
- tech_pvt = switch_core_session_get_private(session);
+ tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
last = switch_time_now() - waitsec;
- if ((val = switch_channel_get_variable(channel, "pa_hold_file"))) {
- hold_file = val;
- } else {
- hold_file = globals.hold_file;
- }
-
- if (hold_file) {
- tech_pvt->hold_file = switch_core_session_strdup(session, hold_file);
- }
+
+ if ((val = switch_channel_get_variable(channel, "pa_hold_file"))) {
+ hold_file = val;
+ } else {
+ hold_file = globals.hold_file;
+ }
+
+ if (hold_file) {
+ tech_pvt->hold_file = switch_core_session_strdup(session, hold_file);
+ }
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL INIT %d %d\n", switch_channel_get_name(channel),
- switch_channel_get_state(channel), switch_test_flag(tech_pvt, TFLAG_ANSWER));
-
-
-
- if (engage_device(tech_pvt->sample_rate, tech_pvt->codec_ms) != SWITCH_STATUS_SUCCESS) {
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_FALSE;
- }
-
- if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
- add_pvt(tech_pvt, PA_SLAVE);
-
- ring_file = globals.ring_file;
- if ((val = switch_channel_get_variable(channel, "pa_ring_file"))) {
- ring_file = val;
- }
-
- if (switch_test_flag((&globals), GFLAG_RING)) {
- ring_file = NULL;
- }
- switch_set_flag_locked((&globals), GFLAG_RING);
- if (ring_file) {
- if (switch_core_file_open(&fh,
- ring_file,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- NULL) == SWITCH_STATUS_SUCCESS) {
-
- if (engage_ring_device(fh.samplerate, fh.channels) != SWITCH_STATUS_SUCCESS) {
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Ring Error!\n");
- switch_core_file_close(&fh);
- return SWITCH_STATUS_GENERR;
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open %s, disabling ring file!\n", ring_file);
- ring_file = NULL;
- }
- }
- }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL INIT %d %d\n",
+ switch_channel_get_name(channel), switch_channel_get_state(channel), switch_test_flag(tech_pvt, TFLAG_ANSWER));
+
+
+
+ if (engage_device(tech_pvt->sample_rate, tech_pvt->codec_ms) != SWITCH_STATUS_SUCCESS) {
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+ add_pvt(tech_pvt, PA_SLAVE);
+
+ ring_file = globals.ring_file;
+ if ((val = switch_channel_get_variable(channel, "pa_ring_file"))) {
+ ring_file = val;
+ }
+
+ if (switch_test_flag((&globals), GFLAG_RING)) {
+ ring_file = NULL;
+ }
+ switch_set_flag_locked((&globals), GFLAG_RING);
+ if (ring_file) {
+ if (switch_core_file_open(&fh,
+ ring_file,
+ globals.read_codec.implementation->number_of_channels,
+ globals.read_codec.implementation->samples_per_second,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
+
+ if (engage_ring_device(fh.samplerate, fh.channels) != SWITCH_STATUS_SUCCESS) {
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Ring Error!\n");
+ switch_core_file_close(&fh);
+ return SWITCH_STATUS_GENERR;
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open %s, disabling ring file!\n", ring_file);
+ ring_file = NULL;
+ }
+ }
+ }
switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
-
+
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
+ switch_size_t olen = globals.timer.samples;
+
if (switch_time_now() - last >= waitsec) {
char buf[512];
switch_event_t *event;
-
+
snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
@@ -256,49 +258,46 @@
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
last = switch_time_now();
- if (ring_file) {
- unsigned int pos = 0;
- switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
- for (;;) {
- switch_size_t olen = 1024;
- switch_core_file_read(&fh, abuf, &olen);
- if (olen == 0) {
- break;
- }
- WriteAudioStream(globals.ring_stream, abuf, (long)olen);
- }
- }
- }
-
- switch_yield(globals.read_codec.implementation->microseconds_per_frame);
-
- }
- switch_clear_flag_locked((&globals), GFLAG_RING);
- }
-
- if (ring_file) {
- deactivate_ring_device();
- switch_core_file_close(&fh);
- switch_core_codec_destroy(&tech_pvt->write_codec);
- switch_core_timer_destroy(&tech_pvt->timer);
- }
+ }
+
+ if (ring_file) {
+ if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
+ switch_core_file_close(&fh);
+ break;
+ }
+ switch_core_file_read(&fh, abuf, &olen);
+ if (olen == 0) {
+ unsigned int pos = 0;
+ switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
+ }
+ if (globals.ring_stream) {
+ WriteAudioStream(globals.ring_stream, abuf, (long) olen, &globals.timer);
+ }
+ }
+ }
+ switch_clear_flag_locked((&globals), GFLAG_RING);
+ }
+
+ if (ring_file) {
+ deactivate_ring_device();
+ switch_core_file_close(&fh);
+ }
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
- if (!switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
- switch_channel_hangup(channel, SWITCH_CAUSE_NO_ANSWER);
- return SWITCH_STATUS_SUCCESS;
- }
+ if (!switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
+ switch_channel_hangup(channel, SWITCH_CAUSE_NO_ANSWER);
+ return SWITCH_STATUS_SUCCESS;
+ }
}
- switch_set_flag_locked(tech_pvt, TFLAG_IO);
-
- /* Move Channel's State Machine to RING */
- switch_channel_set_state(channel, CS_RING);
-
- return SWITCH_STATUS_SUCCESS;
+ switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+ /* Move Channel's State Machine to RING */
+ switch_channel_set_state(channel, CS_RING);
+
+ return SWITCH_STATUS_SUCCESS;
}
@@ -344,6 +343,11 @@
globals.audio_stream = NULL;
}
switch_mutex_unlock(globals.device_lock);
+ if (globals.mixer) {
+ Px_CloseMixer(globals.mixer);
+ globals.mixer = NULL;
+ }
+
}
@@ -359,72 +363,72 @@
-static void add_pvt(private_t *tech_pvt, int master)
+static void add_pvt(private_t * tech_pvt, int master)
{
- private_t *tp;
- uint8_t in_list = 0;
+ private_t *tp;
+ uint8_t in_list = 0;
+
+ switch_mutex_lock(globals.pvt_lock);
+
+ if (switch_strlen_zero(tech_pvt->call_id)) {
+ snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
+ switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
+ switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
+ switch_core_session_set_write_codec(tech_pvt->session, &globals.write_codec);
+ }
+
+ for (tp = globals.call_list; tp; tp = tp->next) {
+ if (tp == tech_pvt) {
+ in_list = 1;
+ }
+ if (master) {
+ switch_clear_flag_locked(tp, TFLAG_MASTER);
+ }
+ }
- switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(tech_pvt->call_id)) {
- snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
- switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
- switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
- switch_core_session_set_write_codec(tech_pvt->session, &globals.write_codec);
- }
-
- for (tp = globals.call_list; tp; tp = tp->next) {
- if (tp == tech_pvt) {
- in_list = 1;
- }
- if (master) {
- switch_clear_flag_locked(tp, TFLAG_MASTER);
- }
- }
-
-
- if (master) {
- if (!in_list) {
- tech_pvt->next = globals.call_list;
- globals.call_list = tech_pvt;
- }
- switch_set_flag_locked(tech_pvt, TFLAG_MASTER);
-
- } else if (!in_list) {
- for (tp = globals.call_list; tp && tp->next; tp = tp->next);
- if (tp) {
- tp->next = tech_pvt;
- } else {
- globals.call_list = tech_pvt;
- }
- }
+ if (master) {
+ if (!in_list) {
+ tech_pvt->next = globals.call_list;
+ globals.call_list = tech_pvt;
+ }
+ switch_set_flag_locked(tech_pvt, TFLAG_MASTER);
+
+ } else if (!in_list) {
+ for (tp = globals.call_list; tp && tp->next; tp = tp->next);
+ if (tp) {
+ tp->next = tech_pvt;
+ } else {
+ globals.call_list = tech_pvt;
+ }
+ }
switch_mutex_unlock(globals.pvt_lock);
}
-static void remove_pvt(private_t *tech_pvt)
+static void remove_pvt(private_t * tech_pvt)
{
- private_t *tp, *last = NULL;
+ private_t *tp, *last = NULL;
switch_mutex_lock(globals.pvt_lock);
- for (tp = globals.call_list; tp; tp = tp->next) {
- switch_clear_flag_locked(tp, TFLAG_MASTER);
- if (tp == tech_pvt) {
- if (last) {
- last->next = tp->next;
- } else {
- globals.call_list = tp->next;
- }
- }
- last = tp;
- }
-
- if (globals.call_list) {
- switch_set_flag_locked(globals.call_list, TFLAG_MASTER);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No more channels, deactivating audio\n");
- deactivate_audio_device();
- }
+ for (tp = globals.call_list; tp; tp = tp->next) {
+ switch_clear_flag_locked(tp, TFLAG_MASTER);
+ if (tp == tech_pvt) {
+ if (last) {
+ last->next = tp->next;
+ } else {
+ globals.call_list = tp->next;
+ }
+ }
+ last = tp;
+ }
+
+ if (globals.call_list) {
+ switch_set_flag_locked(globals.call_list, TFLAG_MASTER);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No more channels, deactivating audio\n");
+ deactivate_audio_device();
+ }
switch_mutex_unlock(globals.pvt_lock);
}
@@ -440,17 +444,17 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- remove_pvt(tech_pvt);
+ remove_pvt(tech_pvt);
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
switch_set_flag_locked(tech_pvt, TFLAG_HUP);
switch_core_hash_delete(globals.call_hash, tech_pvt->call_id);
- if (tech_pvt->hfh) {
- tech_pvt->hfh = NULL;
- switch_core_file_close(&tech_pvt->fh);
- }
+ if (tech_pvt->hfh) {
+ tech_pvt->hfh = NULL;
+ switch_core_file_close(&tech_pvt->fh);
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
@@ -468,14 +472,14 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- switch (sig) {
- case SWITCH_SIG_KILL:
- switch_set_flag_locked(tech_pvt, TFLAG_HUP);
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- break;
- default:
- break;
- }
+ switch (sig) {
+ case SWITCH_SIG_KILL:
+ switch_set_flag_locked(tech_pvt, TFLAG_HUP);
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ break;
+ default:
+ break;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
@@ -538,8 +542,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
- switch_io_flag_t flags, int stream_id)
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
@@ -553,109 +556,90 @@
assert(tech_pvt != NULL);
if (!globals.audio_stream) {
- return SWITCH_STATUS_FALSE;
- }
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ goto cng;
+ }
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
- goto cng;
- }
-
- if (!is_master(tech_pvt)) {
- if (tech_pvt->hold_file) {
- if (!tech_pvt->hfh) {
- int codec_ms = tech_pvt->codec_ms ? tech_pvt->codec_ms : globals.codec_ms;
- int sample_rate = tech_pvt->sample_rate ? tech_pvt->sample_rate : globals.sample_rate;
-
- if (switch_core_codec_init(&tech_pvt->write_codec,
- "L16",
- NULL,
- sample_rate,
- codec_ms,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
- switch_core_codec_destroy(&globals.read_codec);
- tech_pvt->hold_file = NULL;
- goto cng;
- }
-
- if (switch_core_file_open(&tech_pvt->fh,
- tech_pvt->hold_file,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
- switch_core_codec_destroy(&tech_pvt->write_codec);
- tech_pvt->hold_file = NULL;
- goto cng;
- }
-
- if (switch_core_timer_init(&tech_pvt->timer,
- globals.timer_name,
- codec_ms,
- globals.read_codec.implementation->samples_per_frame,
- switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
- switch_core_file_close(&tech_pvt->fh);
- switch_core_codec_destroy(&tech_pvt->write_codec);
- goto cng;
- }
-
- tech_pvt->hfh = &tech_pvt->fh;
- tech_pvt->hold_frame.data = tech_pvt->holdbuf;
- tech_pvt->hold_frame.buflen = sizeof(tech_pvt->holdbuf);
- tech_pvt->hold_frame.rate = sample_rate;
- tech_pvt->hold_frame.codec = &tech_pvt->write_codec;
- }
-
- goto hold;
- }
- cng:
- switch_yield(globals.read_codec.implementation->microseconds_per_frame);
- *frame = &globals.cng_frame;
+ if (!is_master(tech_pvt)) {
+ if (tech_pvt->hold_file) {
+ if (!tech_pvt->hfh) {
+ int sample_rate = tech_pvt->sample_rate ? tech_pvt->sample_rate : globals.sample_rate;
+ if (switch_core_file_open(&tech_pvt->fh,
+ tech_pvt->hold_file,
+ globals.read_codec.implementation->number_of_channels,
+ globals.read_codec.implementation->samples_per_second,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
+ switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+ tech_pvt->hold_file = NULL;
+ goto cng;
+ }
+
+ tech_pvt->hfh = &tech_pvt->fh;
+ tech_pvt->hold_frame.data = tech_pvt->holdbuf;
+ tech_pvt->hold_frame.buflen = sizeof(tech_pvt->holdbuf);
+ tech_pvt->hold_frame.rate = sample_rate;
+ tech_pvt->hold_frame.codec = &globals.write_codec;
+ }
+
+ goto hold;
+ }
+ cng:
+ switch_yield(globals.read_codec.implementation->microseconds_per_frame);
+ *frame = &globals.cng_frame;
return SWITCH_STATUS_SUCCESS;
- hold:
+ hold:
- {
- switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
- if (switch_core_timer_next(&tech_pvt->timer) != SWITCH_STATUS_SUCCESS) {
- switch_core_file_close(&tech_pvt->fh);
- switch_core_codec_destroy(&tech_pvt->write_codec);
- goto cng;
+ {
+ switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
+ if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
+ switch_core_file_close(&tech_pvt->fh);
+ goto cng;
+ }
+ switch_core_file_read(tech_pvt->hfh, tech_pvt->hold_frame.data, &olen);
+
+ if (olen == 0) {
+ unsigned int pos = 0;
+ switch_core_file_seek(tech_pvt->hfh, &pos, 0, SEEK_SET);
+ goto cng;
}
- switch_core_file_read(tech_pvt->hfh, tech_pvt->hold_frame.data, &olen);
-
- if (olen == 0) {
- unsigned int pos = 0;
- switch_core_file_seek(tech_pvt->hfh, &pos, 0, SEEK_SET);
- goto cng;
- }
-
-
- tech_pvt->hold_frame.datalen = (uint32_t)(olen * sizeof(int16_t));
- tech_pvt->hold_frame.samples = (uint32_t)olen;
- *frame = &tech_pvt->hold_frame;
-
- }
- return SWITCH_STATUS_SUCCESS;
- }
+
+ tech_pvt->hold_frame.datalen = (uint32_t) (olen * sizeof(int16_t));
+ tech_pvt->hold_frame.samples = (uint32_t) olen;
+ tech_pvt->hold_frame.timestamp = globals.timer.samplecount;
+ *frame = &tech_pvt->hold_frame;
+
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+ }
switch_mutex_lock(globals.device_lock);
- if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) != 0) {
+ if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
+ globals.read_codec.implementation->samples_per_frame,
+ &globals.timer)) == 0) {
+ switch_mutex_unlock(globals.device_lock);
+ goto cng;
+ } else {
globals.read_frame.datalen = samples * 2;
globals.read_frame.samples = samples;
+
+ switch_core_timer_check(&globals.timer);
+ globals.read_frame.timestamp = globals.timer.samplecount;
*frame = &globals.read_frame;
- if (!switch_test_flag((&globals), GFLAG_MOUTH)) {
- memset(globals.read_frame.data, 255, globals.read_frame.datalen);
- }
+ if (!switch_test_flag((&globals), GFLAG_MOUTH)) {
+ memset(globals.read_frame.data, 255, globals.read_frame.datalen);
+ }
status = SWITCH_STATUS_SUCCESS;
}
@@ -664,8 +648,7 @@
return status;
}
-static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
- switch_io_flag_t flags, int stream_id)
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
@@ -677,21 +660,22 @@
assert(tech_pvt != NULL);
if (!globals.audio_stream) {
- return SWITCH_STATUS_FALSE;
- }
+ return SWITCH_STATUS_FALSE;
+ }
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!is_master(tech_pvt) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
- return SWITCH_STATUS_SUCCESS;
- }
+ if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!is_master(tech_pvt) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_SUCCESS;
+ }
if (globals.audio_stream) {
- if (switch_test_flag((&globals), GFLAG_EAR)) {
- WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)));
- }
+ if (switch_test_flag((&globals), GFLAG_EAR)) {
+ WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)),
+ &globals.timer);
+ }
status = SWITCH_STATUS_SUCCESS;
}
@@ -717,16 +701,19 @@
{
switch_channel_t *channel;
private_t *tech_pvt;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
switch (msg->message_id) {
- case SWITCH_MESSAGE_INDICATE_PROGRESS:
+ case SWITCH_MESSAGE_INDICATE_ANSWER:
+ channel_answer_channel(session);
+ break;
+ case SWITCH_MESSAGE_INDICATE_PROGRESS:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engage Early Media\n");
switch_set_flag_locked(tech_pvt, TFLAG_IO);
@@ -737,55 +724,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_api_interface_t send_dtmf_interface = {
- /*.interface_name */ "padtmf",
- /*.desc */ "DEPRICATED (see 'pa')",
- /*.function */ padep,
- /*.syntax */ "DEPRICATED (see 'pa')",
- /*.next */ NULL
-};
-
-static switch_api_interface_t answer_call_interface = {
- /*.interface_name */ "paoffhook",
- /*.desc */ "DEPRICATED (see 'pa')",
- /*.function */ padep,
- /*.syntax */ "DEPRICATED (see 'pa')",
- /*.next */ &send_dtmf_interface
-};
-
-static switch_api_interface_t channel_info_interface = {
- /*.interface_name */ "painfo",
- /*.desc */ "DEPRICATED (see 'pa')",
- /*.function */ padep,
- /*.syntax */ "DEPRICATED (see 'pa')",
- /*.next */ &answer_call_interface
-};
-
-static switch_api_interface_t channel_hup_interface = {
- /*.interface_name */ "pahup",
- /*.desc */ "DEPRICATED (see 'pa')",
- /*.function */ padep,
- /*.syntax */ "DEPRICATED (see 'pa')",
- /*.next */ &channel_info_interface
-};
-
-static switch_api_interface_t channel_call_interface = {
- /*.interface_name */ "pacall",
- /*.desc */ "DEPRICATED (see 'pa')",
- /*.function */ padep,
- /*.syntax */ "DEPRICATED (see 'pa')",
- /*.next */ &channel_hup_interface
-};
-
-static switch_api_interface_t channel_api_interface = {
- /*.interface_name */ "pa",
- /*.desc */ "PortAudio",
- /*.function */ pa_cmd,
- /*.syntax */ "<command> [<args>]",
- /*.next */ &channel_call_interface
-};
-
-static const switch_state_handler_table_t channel_event_handlers = {
+static switch_state_handler_table_t channel_event_handlers = {
/*.on_init */ channel_on_init,
/*.on_ring */ channel_on_ring,
/*.on_execute */ channel_on_execute,
@@ -794,56 +733,38 @@
/*.on_transmit */ channel_on_transmit
};
-static const switch_io_routines_t channel_io_routines = {
+static switch_io_routines_t channel_io_routines = {
/*.outgoing_channel */ channel_outgoing_channel,
- /*.answer_channel */ channel_answer_channel,
/*.read_frame */ channel_read_frame,
/*.write_frame */ channel_write_frame,
/*.kill_channel */ channel_kill_channel,
/*.waitfor_read */ channel_waitfor_read,
/*.waitfor_write */ channel_waitfor_write,
/*.send_dtmf */ channel_send_dtmf,
- /*.receive_message*/ channel_receive_message
-};
-
-static const switch_endpoint_interface_t channel_endpoint_interface = {
- /*.interface_name */ "portaudio",
- /*.io_routines */ &channel_io_routines,
- /*.event_handlers */ &channel_event_handlers,
- /*.private */ NULL,
- /*.next */ NULL
-};
-
-static const switch_loadable_module_interface_t channel_module_interface = {
- /*.module_name */ modname,
- /*.endpoint_interface */ &channel_endpoint_interface,
- /*.timer_interface */ NULL,
- /*.dialplan_interface */ NULL,
- /*.codec_interface */ NULL,
- /*.application_interface */ NULL,
- /*.api_interface */ &channel_api_interface
+ /*.receive_message */ channel_receive_message
};
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+ switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool)
{
- if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(channel_endpoint_interface, pool)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
switch_core_session_add_stream(*new_session, NULL);
if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
- memset(tech_pvt, 0, sizeof(*tech_pvt));
+ memset(tech_pvt, 0, sizeof(*tech_pvt));
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(*new_session));
channel = switch_core_session_get_channel(*new_session);
switch_core_session_set_private(*new_session, tech_pvt);
tech_pvt->session = *new_session;
- globals.flags = GFLAG_EAR | GFLAG_MOUTH;
+ globals.flags = GFLAG_EAR | GFLAG_MOUTH;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
switch_core_session_destroy(new_session);
@@ -852,9 +773,9 @@
if (outbound_profile) {
char name[128];
- char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
+ char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
snprintf(name, sizeof(name), "PortAudio/%s", id);
-
+
switch_channel_set_name(channel, name);
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -877,30 +798,28 @@
}
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
+SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)
{
+ switch_status_t status;
+ switch_api_interface_t *api_interface;
- switch_status_t status;
-
- if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
- return SWITCH_STATUS_TERM;
- }
+ module_pool = pool;
Pa_Initialize();
if (dump_info()) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't find any audio devices!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't find any audio devices!\n");
return SWITCH_STATUS_TERM;
- }
+ }
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
- return status;
- }
+ return status;
+ }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Input Device: %d, Output Device: %d, Ring Device: %d Sample Rate: %d MS: %d\n",
- globals.indev, globals.outdev, globals.ringdev, globals.sample_rate, globals.codec_ms);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ "Input Device: %d, Output Device: %d, Ring Device: %d Sample Rate: %d MS: %d\n", globals.indev,
+ globals.outdev, globals.ringdev, globals.sample_rate, globals.codec_ms);
switch_core_hash_init(&globals.call_hash, module_pool);
@@ -920,10 +839,16 @@
globals.cng_frame.data = globals.cngbuf;
globals.cng_frame.buflen = sizeof(globals.cngbuf);
globals.cng_frame.datalen = sizeof(globals.cngbuf);
- switch_set_flag((&globals.cng_frame), SFF_CNG);
+ switch_set_flag((&globals.cng_frame), SFF_CNG);
/* connect my internal structure to the blank pointer passed to me */
- *module_interface = &channel_module_interface;
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ channel_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+ channel_endpoint_interface->interface_name = "portaudio";
+ channel_endpoint_interface->io_routines = &channel_io_routines;
+ channel_endpoint_interface->state_handler = &channel_event_handlers;
+
+ SWITCH_ADD_API(api_interface, "pa", "PortAudio", pa_cmd, "<command> [<args>]");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
@@ -934,7 +859,7 @@
{
char *cf = "portaudio.conf";
switch_xml_t cfg, xml, settings, param;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -942,7 +867,7 @@
}
memset(&globals, 0, sizeof(globals));
- globals.indev = globals.outdev = globals.ringdev = -1;
+ globals.indev = globals.outdev = globals.ringdev = -1;
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
@@ -952,7 +877,7 @@
if (!strcmp(var, "debug")) {
globals.debug = atoi(val);
} else if (!strcmp(var, "ring-interval")) {
- globals.ring_interval = atoi(val);
+ globals.ring_interval = atoi(val);
} else if (!strcmp(var, "ring-file")) {
set_global_ring_file(val);
} else if (!strcmp(var, "hold-file")) {
@@ -987,7 +912,7 @@
} else {
globals.ringdev = get_dev_by_name(val, 0);
}
- }
+ }
}
}
@@ -1006,44 +931,44 @@
if (!globals.ring_interval) {
globals.ring_interval = 5;
}
-
- if (!globals.timer_name) {
- set_global_timer_name("soft");
- }
-
- if (globals.indev < 0) {
- globals.indev = get_dev_by_name(NULL, 1);
- if (globals.indev > -1) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default input device!\n");
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device!\n");
- status = SWITCH_STATUS_GENERR;
- }
- }
-
- if (globals.outdev < 0) {
- globals.outdev = get_dev_by_name(NULL, 0);
- if (globals.outdev > -1) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default output device!\n");
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device!\n");
- status = SWITCH_STATUS_GENERR;
- }
- }
-
- if (globals.ringdev < 0) {
- if (globals.outdev > -1) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ring device configured using output device!\n");
- globals.ringdev = globals.outdev;
- }
- }
+
+ if (!globals.timer_name) {
+ set_global_timer_name("soft");
+ }
+
+ if (globals.indev < 0) {
+ globals.indev = get_dev_by_name(NULL, 1);
+ if (globals.indev > -1) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default input device!\n");
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device!\n");
+ status = SWITCH_STATUS_GENERR;
+ }
+ }
+
+ if (globals.outdev < 0) {
+ globals.outdev = get_dev_by_name(NULL, 0);
+ if (globals.outdev > -1) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default output device!\n");
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device!\n");
+ status = SWITCH_STATUS_GENERR;
+ }
+ }
+
+ if (globals.ringdev < 0) {
+ if (globals.outdev > -1) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ring device configured using output device!\n");
+ globals.ringdev = globals.outdev;
+ }
+ }
switch_xml_free(xml);
return status;
}
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
{
if (globals.read_codec.implementation) {
switch_core_codec_destroy(&globals.read_codec);
@@ -1053,6 +978,7 @@
switch_core_codec_destroy(&globals.write_codec);
}
+ switch_core_timer_destroy(&globals.timer);
Pa_Terminate();
return SWITCH_STATUS_SUCCESS;
@@ -1061,18 +987,18 @@
static int get_dev_by_number(int number, int in)
{
- int numDevices = Pa_GetDeviceCount();
+ int numDevices = Pa_GetDeviceCount();
const PaDeviceInfo *pdi;
- if (number > -1 && number < numDevices && (pdi = Pa_GetDeviceInfo(number))) {
- if (in && pdi->maxInputChannels) {
- return number;
- } else if (!in && pdi->maxOutputChannels) {
- return number;
- }
- }
-
- return -1;
+ if (number > -1 && number < numDevices && (pdi = Pa_GetDeviceInfo(number))) {
+ if (in && pdi->maxInputChannels) {
+ return number;
+ } else if (!in && pdi->maxOutputChannels) {
+ return number;
+ }
+ }
+
+ return -1;
}
static int get_dev_by_name(char *name, int in)
@@ -1088,15 +1014,15 @@
}
for (i = 0; i < numDevices; i++) {
- int match = 0;
+ int match = 0;
pdi = Pa_GetDeviceInfo(i);
-
+
if (switch_strlen_zero(name)) {
- match = 1;
- } else if (strstr(pdi->name, name)) {
- match = 1;
- }
-
+ match = 1;
+ } else if (strstr(pdi->name, name)) {
+ match = 1;
+ }
+
if (match) {
if (in && pdi->maxInputChannels) {
return i;
@@ -1106,248 +1032,253 @@
}
}
- if (switch_strlen_zero(name)) {
- return -1;
- }
+ if (switch_strlen_zero(name)) {
+ return -1;
+ }
return get_dev_by_name(NULL, in);
}
/*******************************************************************/
-static void PrintSupportedStandardSampleRates(const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters)
+static void PrintSupportedStandardSampleRates(const PaStreamParameters * inputParameters, const PaStreamParameters * outputParameters)
{
- int i, printCount, cr = 7;
- PaError err;
- static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
- 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1};
-
- printCount = cr;
- for(i=0; standardSampleRates[i] > 0; i++) {
- err = Pa_IsFormatSupported(inputParameters, outputParameters, standardSampleRates[i]);
- if (err == paFormatIsSupported) {
- if (printCount == cr) {
- printCount = 0;
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "\n\t%0.2f", standardSampleRates[i]);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, ", %0.2f", standardSampleRates[i]);
- }
- printCount++;
- }
- }
- if (!printCount) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, " None\n");
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "\n");
- }
+ int i, printCount, cr = 7;
+ PaError err;
+ static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
+ 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1
+ };
+
+ printCount = cr;
+ for (i = 0; standardSampleRates[i] > 0; i++) {
+ err = Pa_IsFormatSupported(inputParameters, outputParameters, standardSampleRates[i]);
+ if (err == paFormatIsSupported) {
+ if (printCount == cr) {
+ printCount = 0;
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "\n\t%0.2f", standardSampleRates[i]);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, ", %0.2f", standardSampleRates[i]);
+ }
+ printCount++;
+ }
+ }
+ if (!printCount) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, " None\n");
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "\n");
+ }
}
+
/*******************************************************************/
static switch_status_t devlist(char **argv, int argc, switch_stream_handle_t *stream)
{
- int i, numDevices;
- const PaDeviceInfo *deviceInfo;
-
- numDevices = Pa_GetDeviceCount();
- if (numDevices < 0) {
+ int i, numDevices;
+ const PaDeviceInfo *deviceInfo;
+
+ numDevices = Pa_GetDeviceCount();
+ if (numDevices < 0) {
return SWITCH_STATUS_SUCCESS;
- }
- for(i=0; i<numDevices; i++) {
- deviceInfo = Pa_GetDeviceInfo(i);
- stream->write_function(stream, "%d;%s;%d;%d\n", i, deviceInfo->name, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels);
+ }
+ for (i = 0; i < numDevices; i++) {
+ deviceInfo = Pa_GetDeviceInfo(i);
+ stream->write_function(stream, "%d;%s;%d;%d\n", i, deviceInfo->name, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels);
}
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static int dump_info(void)
{
- int i, numDevices, defaultDisplayed;
- const PaDeviceInfo *deviceInfo;
- PaStreamParameters inputParameters, outputParameters;
- PaError err;
- const char *line = "--------------------------------------------------------------------------------\n";
-
+ int i, numDevices, defaultDisplayed;
+ const PaDeviceInfo *deviceInfo;
+ PaStreamParameters inputParameters, outputParameters;
+ PaError err;
+ const char *line = "--------------------------------------------------------------------------------\n";
+
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "PortAudio version number = %d\nPortAudio version text = '%s'\n",
- Pa_GetVersion(), Pa_GetVersionText());
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
+ "PortAudio version number = %d\nPortAudio version text = '%s'\n", Pa_GetVersion(), Pa_GetVersionText());
if (globals.audio_stream) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");
return 0;
}
-
- numDevices = Pa_GetDeviceCount();
- if (numDevices < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
- err = numDevices;
- goto error;
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Number of devices = %d\n", numDevices);
- for(i=0; i<numDevices; i++) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", line);
- deviceInfo = Pa_GetDeviceInfo(i);
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Device #%d ", i);
-
- /* Mark global and API specific default devices */
- defaultDisplayed = 0;
- if (i == Pa_GetDefaultInputDevice()) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default Input");
- defaultDisplayed = 1;
-
- } else if (i == Pa_GetHostApiInfo(deviceInfo->hostApi)->defaultInputDevice) {
-
- const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default %s Input", hostInfo->name);
- defaultDisplayed = 1;
- }
-
- if (i == Pa_GetDefaultOutputDevice()) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default Output");
- defaultDisplayed = 1;
-
- } else if (i == Pa_GetHostApiInfo(deviceInfo->hostApi)->defaultOutputDevice) {
-
- const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default %s Output", hostInfo->name);
- defaultDisplayed = 1;
- }
-
- if (defaultDisplayed) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "** | ");
- }
- /* print device info fields */
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Name: %s\n", deviceInfo->name);
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Host: %s | ", Pa_GetHostApiInfo(deviceInfo->hostApi)->name);
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "inputs: %d | ", deviceInfo->maxInputChannels );
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "outputs: %d | ", deviceInfo->maxOutputChannels );
-
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Default rate: %8.2f\n", deviceInfo->defaultSampleRate);
-
- /* poll for standard sample rates */
- inputParameters.device = i;
- inputParameters.channelCount = deviceInfo->maxInputChannels;
- inputParameters.sampleFormat = paInt16;
- inputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
- inputParameters.hostApiSpecificStreamInfo = NULL;
-
- outputParameters.device = i;
- outputParameters.channelCount = deviceInfo->maxOutputChannels;
- outputParameters.sampleFormat = paInt16;
- outputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- if (inputParameters.channelCount > 0) {
-
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel input rates:",
- inputParameters.channelCount);
- PrintSupportedStandardSampleRates(&inputParameters, NULL);
- }
-
- if (outputParameters.channelCount > 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel output rates:",
- outputParameters.channelCount);
- PrintSupportedStandardSampleRates(NULL, &outputParameters);
- }
-
- if (inputParameters.channelCount > 0 && outputParameters.channelCount > 0) {
-
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "full-duplex 16 bit %d channel input, %d channel output rates:",
- inputParameters.channelCount, outputParameters.channelCount);
- PrintSupportedStandardSampleRates(&inputParameters, &outputParameters);
- }
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", line);
-
- return 0;
-
- error:
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "An error occured while using the portaudio stream\n");
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error number: %d\n", err);
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error message: %s\n", Pa_GetErrorText(err));
- return err;
+
+ numDevices = Pa_GetDeviceCount();
+ if (numDevices < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
+ err = numDevices;
+ goto error;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Number of devices = %d\n", numDevices);
+ for (i = 0; i < numDevices; i++) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", line);
+ deviceInfo = Pa_GetDeviceInfo(i);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Device #%d ", i);
+
+ /* Mark global and API specific default devices */
+ defaultDisplayed = 0;
+ if (i == Pa_GetDefaultInputDevice()) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default Input");
+ defaultDisplayed = 1;
+
+ } else if (i == Pa_GetHostApiInfo(deviceInfo->hostApi)->defaultInputDevice) {
+
+ const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default %s Input", hostInfo->name);
+ defaultDisplayed = 1;
+ }
+
+ if (i == Pa_GetDefaultOutputDevice()) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default Output");
+ defaultDisplayed = 1;
+
+ } else if (i == Pa_GetHostApiInfo(deviceInfo->hostApi)->defaultOutputDevice) {
+
+ const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "**Default %s Output", hostInfo->name);
+ defaultDisplayed = 1;
+ }
+
+ if (defaultDisplayed) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "** | ");
+ }
+ /* print device info fields */
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Name: %s\n", deviceInfo->name);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Host: %s | ", Pa_GetHostApiInfo(deviceInfo->hostApi)->name);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "inputs: %d | ", deviceInfo->maxInputChannels);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "outputs: %d | ", deviceInfo->maxOutputChannels);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Default rate: %8.2f\n", deviceInfo->defaultSampleRate);
+
+ /* poll for standard sample rates */
+ inputParameters.device = i;
+ inputParameters.channelCount = deviceInfo->maxInputChannels;
+ inputParameters.sampleFormat = paInt16;
+ inputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
+ inputParameters.hostApiSpecificStreamInfo = NULL;
+
+ outputParameters.device = i;
+ outputParameters.channelCount = deviceInfo->maxOutputChannels;
+ outputParameters.sampleFormat = paInt16;
+ outputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ if (inputParameters.channelCount > 0) {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel input rates:", inputParameters.channelCount);
+ PrintSupportedStandardSampleRates(&inputParameters, NULL);
+ }
+
+ if (outputParameters.channelCount > 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel output rates:", outputParameters.channelCount);
+ PrintSupportedStandardSampleRates(NULL, &outputParameters);
+ }
+
+ if (inputParameters.channelCount > 0 && outputParameters.channelCount > 0) {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
+ "full-duplex 16 bit %d channel input, %d channel output rates:", inputParameters.channelCount,
+ outputParameters.channelCount);
+ PrintSupportedStandardSampleRates(&inputParameters, &outputParameters);
+ }
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", line);
+
+ return 0;
+
+ error:
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "An error occured while using the portaudio stream\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error number: %d\n", err);
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error message: %s\n", Pa_GetErrorText(err));
+ return err;
}
static switch_status_t engage_device(int sample_rate, int codec_ms)
{
- PaStreamParameters inputParameters, outputParameters;
+ PaStreamParameters inputParameters, outputParameters;
PaError err;
- if (!globals.audio_stream) {
- if (!sample_rate) {
- sample_rate = globals.sample_rate;
- }
- if (!codec_ms) {
- codec_ms = globals.codec_ms;
- }
-
- if (switch_core_codec_init(&globals.read_codec,
- "L16",
- NULL,
- sample_rate,
- codec_ms,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
- return SWITCH_STATUS_FALSE;
- } else {
- if (switch_core_codec_init(&globals.write_codec,
- "L16",
- NULL,
- sample_rate,
- codec_ms,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
- switch_core_codec_destroy(&globals.read_codec);
- return SWITCH_STATUS_FALSE;
- }
- }
-
- globals.read_frame.rate = sample_rate;
- globals.read_frame.codec = &globals.read_codec;
-
-
-
- switch_mutex_lock(globals.device_lock);
- /* LOCKED ***************************************************************************************************/
- inputParameters.device = globals.indev;
- inputParameters.channelCount = 1;
- inputParameters.sampleFormat = SAMPLE_TYPE;
- inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;
- inputParameters.hostApiSpecificStreamInfo = NULL;
-
- outputParameters.device = globals.outdev;
- outputParameters.channelCount = 1;
- outputParameters.sampleFormat = SAMPLE_TYPE;
- outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
- err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff);
- /* UNLOCKED **************************************************************************************************/
- switch_mutex_unlock(globals.device_lock);
-
-
- if (err != paNoError) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device!\n");
- switch_core_codec_destroy(&globals.read_codec);
- switch_core_codec_destroy(&globals.write_codec);
-
- return SWITCH_STATUS_FALSE;
- }
- }
+ if (!globals.audio_stream) {
+ if (!sample_rate) {
+ sample_rate = globals.sample_rate;
+ }
+ if (!codec_ms) {
+ codec_ms = globals.codec_ms;
+ }
+
+ if (switch_core_codec_init(&globals.read_codec,
+ "L16",
+ NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+ return SWITCH_STATUS_FALSE;
+ } else {
+ if (switch_core_codec_init(&globals.write_codec,
+ "L16",
+ NULL,
+ sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+ switch_core_codec_destroy(&globals.read_codec);
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+
+ if (switch_core_timer_init(&globals.timer,
+ globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame,
+ module_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
+ switch_core_codec_destroy(&globals.read_codec);
+ switch_core_codec_destroy(&globals.write_codec);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ globals.read_frame.rate = sample_rate;
+ globals.read_frame.codec = &globals.read_codec;
- return SWITCH_STATUS_SUCCESS;
+
+
+ switch_mutex_lock(globals.device_lock);
+ /* LOCKED ************************************************************************************************** */
+ inputParameters.device = globals.indev;
+ inputParameters.channelCount = 1;
+ inputParameters.sampleFormat = SAMPLE_TYPE;
+ inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;
+ inputParameters.hostApiSpecificStreamInfo = NULL;
+
+ outputParameters.device = globals.outdev;
+ outputParameters.channelCount = 1;
+ outputParameters.sampleFormat = SAMPLE_TYPE;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+ err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
+ globals.read_codec.implementation->samples_per_frame);
+ /* UNLOCKED ************************************************************************************************* */
+ switch_mutex_unlock(globals.device_lock);
+
+ globals.mixer = Px_OpenMixer(&globals.audio_stream, 0);
+
+
+ if (err != paNoError) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device!\n");
+ switch_core_codec_destroy(&globals.read_codec);
+ switch_core_codec_destroy(&globals.write_codec);
+
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+
+
+
+ return SWITCH_STATUS_SUCCESS;
}
@@ -1355,35 +1286,35 @@
static switch_status_t engage_ring_device(int sample_rate, int channels)
{
- //int codec_ms = 20;
- PaStreamParameters outputParameters;
+ PaStreamParameters outputParameters;
PaError err;
- if (!globals.ring_stream) {
- if (!sample_rate) {
- sample_rate = globals.sample_rate;
- }
-
- switch_mutex_lock(globals.device_lock);
- /* LOCKED ***************************************************************************************************/
- outputParameters.device = globals.ringdev;
- outputParameters.channelCount = channels;
- outputParameters.sampleFormat = SAMPLE_TYPE;
- outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
- err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff);
- /* UNLOCKED **************************************************************************************************/
- switch_mutex_unlock(globals.device_lock);
-
-
- if (err != paNoError) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device!\n");
- return SWITCH_STATUS_FALSE;
- }
- }
+ if (!globals.ring_stream) {
+ if (!sample_rate) {
+ sample_rate = globals.sample_rate;
+ }
+
+ switch_mutex_lock(globals.device_lock);
+ /* LOCKED ************************************************************************************************** */
+ outputParameters.device = globals.ringdev;
+ outputParameters.channelCount = channels;
+ outputParameters.sampleFormat = SAMPLE_TYPE;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+ err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff,
+ globals.read_codec.implementation->samples_per_frame);
+ /* UNLOCKED ************************************************************************************************* */
+ switch_mutex_unlock(globals.device_lock);
+
+
+ if (err != paNoError) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+ }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Engage ring device! rate: %d channels %d\n", sample_rate, channels);
- return SWITCH_STATUS_SUCCESS;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Engage ring device! rate: %d channels %d\n", sample_rate, channels);
+ return SWITCH_STATUS_SUCCESS;
}
@@ -1391,64 +1322,64 @@
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
- char *dtmf = argv[0];
+ char *dtmf = argv[0];
- if (switch_strlen_zero(dtmf)) {
- stream->write_function(stream, "No DTMF Supplied!\n");
- } else {
- switch_mutex_lock(globals.pvt_lock);
- if (globals.call_list) {
- switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
- switch_channel_queue_dtmf(channel, dtmf);
- }
- switch_mutex_unlock(globals.pvt_lock);
- }
+ if (switch_strlen_zero(dtmf)) {
+ stream->write_function(stream, "No DTMF Supplied!\n");
+ } else {
+ switch_mutex_lock(globals.pvt_lock);
+ if (globals.call_list) {
+ switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
+ switch_channel_queue_dtmf(channel, dtmf);
+ }
+ switch_mutex_unlock(globals.pvt_lock);
+ }
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t *stream)
{
- private_t *tp,*tech_pvt = NULL;
- char *callid = argv[0];
- uint8_t one_call = 0;
-
- switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
- if (globals.call_list) {
- if (globals.call_list->next) {
- tech_pvt = globals.call_list->next;
- } else {
- tech_pvt = globals.call_list;
- one_call = 1;
- }
- }
- } else if (!strcasecmp(callid, "none")) {
- for (tp = globals.call_list; tp; tp = tp->next) {
- switch_clear_flag_locked(tp, TFLAG_MASTER);
- }
- stream->write_function(stream, "OK\n");
- goto done;
- } else {
- tech_pvt = switch_core_hash_find(globals.call_hash, callid);
- }
+ private_t *tp, *tech_pvt = NULL;
+ char *callid = argv[0];
+ uint8_t one_call = 0;
+
+ switch_mutex_lock(globals.pvt_lock);
+ if (switch_strlen_zero(callid)) {
+ if (globals.call_list) {
+ if (globals.call_list->next) {
+ tech_pvt = globals.call_list->next;
+ } else {
+ tech_pvt = globals.call_list;
+ one_call = 1;
+ }
+ }
+ } else if (!strcasecmp(callid, "none")) {
+ for (tp = globals.call_list; tp; tp = tp->next) {
+ switch_clear_flag_locked(tp, TFLAG_MASTER);
+ }
+ stream->write_function(stream, "OK\n");
+ goto done;
+ } else {
+ tech_pvt = switch_core_hash_find(globals.call_hash, callid);
+ }
if (tech_pvt) {
- if (tech_pvt == globals.call_list && !tech_pvt->next) {
- one_call = 1;
- }
-
- if (!one_call) {
- remove_pvt(tech_pvt);
- }
- add_pvt(tech_pvt, PA_MASTER);
- stream->write_function(stream, "OK\n");
+ if (tech_pvt == globals.call_list && !tech_pvt->next) {
+ one_call = 1;
+ }
+
+ if (!one_call) {
+ remove_pvt(tech_pvt);
+ }
+ add_pvt(tech_pvt, PA_MASTER);
+ stream->write_function(stream, "OK\n");
} else {
stream->write_function(stream, "NO SUCH CALL\n");
}
- done:
- switch_mutex_unlock(globals.pvt_lock);
+ done:
+ switch_mutex_unlock(globals.pvt_lock);
return SWITCH_STATUS_SUCCESS;
@@ -1456,23 +1387,23 @@
static switch_status_t hangup_call(char **argv, int argc, switch_stream_handle_t *stream)
{
- private_t *tech_pvt;
- char *callid = argv[0];
-
- switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
- tech_pvt = globals.call_list;
- } else {
- tech_pvt = switch_core_hash_find(globals.call_hash, callid);
- }
+ private_t *tech_pvt;
+ char *callid = argv[0];
+
+ switch_mutex_lock(globals.pvt_lock);
+ if (switch_strlen_zero(callid)) {
+ tech_pvt = globals.call_list;
+ } else {
+ tech_pvt = switch_core_hash_find(globals.call_hash, callid);
+ }
if (tech_pvt) {
- switch_set_flag_locked(tech_pvt, TFLAG_HUP);
+ switch_channel_hangup(switch_core_session_get_channel(tech_pvt->session), SWITCH_CAUSE_NORMAL_CLEARING);
stream->write_function(stream, "OK\n");
} else {
stream->write_function(stream, "NO SUCH CALL\n");
}
- switch_mutex_unlock(globals.pvt_lock);
+ switch_mutex_unlock(globals.pvt_lock);
return SWITCH_STATUS_SUCCESS;
@@ -1480,43 +1411,43 @@
static switch_status_t answer_call(char **argv, int argc, switch_stream_handle_t *stream)
{
- private_t *tp;
- int x = 0;
- char *callid = argv[0];
-
- switch_mutex_lock(globals.pvt_lock);
-
- if (!switch_strlen_zero(callid)) {
- if ((tp = switch_core_hash_find(globals.call_hash, callid))) {
- if (switch_test_flag(tp, TFLAG_ANSWER)) {
- stream->write_function(stream, "CALL ALREADY ANSWERED\n");
- } else {
- switch_channel_t *channel = switch_core_session_get_channel(tp->session);
- switch_set_flag_locked(tp, TFLAG_ANSWER);
- switch_channel_answer(channel);
- add_pvt(tp, PA_MASTER);
- }
- } else {
- stream->write_function(stream, "NO SUCH CALL\n");
- }
-
- goto done;
- }
-
- for (tp = globals.call_list; tp; tp = tp->next) {
- if (!switch_test_flag(tp, TFLAG_ANSWER)) {
- switch_channel_t *channel = switch_core_session_get_channel(tp->session);
- switch_set_flag_locked(tp, TFLAG_ANSWER);
- switch_channel_answer(channel);
- add_pvt(tp, PA_MASTER);
- x++;
- break;
- }
- }
- done:
- switch_mutex_unlock(globals.pvt_lock);
+ private_t *tp;
+ int x = 0;
+ char *callid = argv[0];
+
+ switch_mutex_lock(globals.pvt_lock);
+
+ if (!switch_strlen_zero(callid)) {
+ if ((tp = switch_core_hash_find(globals.call_hash, callid))) {
+ if (switch_test_flag(tp, TFLAG_ANSWER)) {
+ stream->write_function(stream, "CALL ALREADY ANSWERED\n");
+ } else {
+ switch_channel_t *channel = switch_core_session_get_channel(tp->session);
+ switch_set_flag_locked(tp, TFLAG_ANSWER);
+ switch_channel_answer(channel);
+ add_pvt(tp, PA_MASTER);
+ }
+ } else {
+ stream->write_function(stream, "NO SUCH CALL\n");
+ }
- stream->write_function(stream, "Answered %d channels.\n", x);
+ goto done;
+ }
+
+ for (tp = globals.call_list; tp; tp = tp->next) {
+ if (!switch_test_flag(tp, TFLAG_ANSWER)) {
+ switch_channel_t *channel = switch_core_session_get_channel(tp->session);
+ switch_set_flag_locked(tp, TFLAG_ANSWER);
+ switch_channel_answer(channel);
+ add_pvt(tp, PA_MASTER);
+ x++;
+ break;
+ }
+ }
+ done:
+ switch_mutex_unlock(globals.pvt_lock);
+
+ stream->write_function(stream, "Answered %d channels.\n", x);
return SWITCH_STATUS_SUCCESS;
@@ -1525,113 +1456,110 @@
static switch_status_t do_flags(char **argv, int argc, switch_stream_handle_t *stream)
{
- char *action = argv[0];
- char *flag_str = argv[1];
- GFLAGS flags = GFLAG_NONE;
- char *p;
- int x = 0;
-
- if (argc < 2) {
- goto desc;
- }
-
- for (x = 1; x < argc; x++) {
- flag_str = argv[x];
- for(p = flag_str; *p; p++) {
- *p = (char)tolower(*p);
- }
-
- if (strstr(flag_str, "ear")) {
- flags |= GFLAG_EAR;
- }
- if (strstr(flag_str, "mouth")) {
- flags |= GFLAG_MOUTH;
- }
- }
-
- if (!strcasecmp(action, "on")) {
- if (flags & GFLAG_EAR) {
- switch_set_flag((&globals), GFLAG_EAR);
- }
- if (flags & GFLAG_MOUTH) {
- switch_set_flag((&globals), GFLAG_MOUTH);
- }
- } else if (!strcasecmp(action, "off")) {
- if (flags & GFLAG_EAR) {
- switch_clear_flag((&globals), GFLAG_EAR);
- }
- if (flags & GFLAG_MOUTH) {
- switch_clear_flag((&globals), GFLAG_MOUTH);
- }
- } else {
- goto bad;
- }
-
- desc:
- x = 0;
- stream->write_function(stream, "FLAGS: ");
- if (switch_test_flag((&globals), GFLAG_EAR)) {
- stream->write_function(stream, "ear");
- x++;
- }
- if (switch_test_flag((&globals), GFLAG_MOUTH)) {
- stream->write_function(stream, "%smouth", x ? "|" : "");
- x++;
- }
- if (!x) {
- stream->write_function(stream, "none");
- }
-
- goto done;
-
- bad:
- stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
- done:
- return SWITCH_STATUS_SUCCESS;
+ char *action = argv[0];
+ char *flag_str = argv[1];
+ GFLAGS flags = GFLAG_NONE;
+ char *p;
+ int x = 0;
+
+ if (argc < 2) {
+ goto desc;
+ }
+
+ for (x = 1; x < argc; x++) {
+ flag_str = argv[x];
+ for (p = flag_str; *p; p++) {
+ *p = (char) tolower(*p);
+ }
+
+ if (strstr(flag_str, "ear")) {
+ flags |= GFLAG_EAR;
+ }
+ if (strstr(flag_str, "mouth")) {
+ flags |= GFLAG_MOUTH;
+ }
+ }
+
+ if (!strcasecmp(action, "on")) {
+ if (flags & GFLAG_EAR) {
+ switch_set_flag((&globals), GFLAG_EAR);
+ }
+ if (flags & GFLAG_MOUTH) {
+ switch_set_flag((&globals), GFLAG_MOUTH);
+ }
+ } else if (!strcasecmp(action, "off")) {
+ if (flags & GFLAG_EAR) {
+ switch_clear_flag((&globals), GFLAG_EAR);
+ }
+ if (flags & GFLAG_MOUTH) {
+ switch_clear_flag((&globals), GFLAG_MOUTH);
+ }
+ } else {
+ goto bad;
+ }
+
+ desc:
+ x = 0;
+ stream->write_function(stream, "FLAGS: ");
+ if (switch_test_flag((&globals), GFLAG_EAR)) {
+ stream->write_function(stream, "ear");
+ x++;
+ }
+ if (switch_test_flag((&globals), GFLAG_MOUTH)) {
+ stream->write_function(stream, "%smouth", x ? "|" : "");
+ x++;
+ }
+ if (!x) {
+ stream->write_function(stream, "none");
+ }
+
+ goto done;
+
+ bad:
+ stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
+ done:
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t list_calls(char **argv, int argc, switch_stream_handle_t *stream)
{
- private_t *tp;
- int x = 0;
- char *cid_name = "n/a";
- char *cid_num = "n/a";
-
- switch_mutex_lock(globals.pvt_lock);
- for (tp = globals.call_list; tp; tp = tp->next) {
+ private_t *tp;
+ int x = 0;
+ char *cid_name = "n/a";
+ char *cid_num = "n/a";
+
+ switch_mutex_lock(globals.pvt_lock);
+ for (tp = globals.call_list; tp; tp = tp->next) {
switch_channel_t *channel;
- switch_caller_profile_t *profile;
- x++;
- channel = switch_core_session_get_channel(tp->session);
-
- if ((profile = switch_channel_get_caller_profile(channel))) {
- if (profile->originatee_caller_profile) {
- cid_name = "Outbound Call";
- cid_num = profile->originatee_caller_profile->destination_number;
- } else {
- cid_name = profile->caller_id_name;
- cid_num = profile->caller_id_number;
- }
- }
-
- stream->write_function(stream, "%s %s [%s (%s)] %s\n", tp->call_id, switch_channel_get_name(channel),
- cid_name,
- cid_num,
- switch_test_flag(tp, TFLAG_MASTER) ? "active" : "hold"
- );
- }
- switch_mutex_unlock(globals.pvt_lock);
+ switch_caller_profile_t *profile;
+ x++;
+ channel = switch_core_session_get_channel(tp->session);
+
+ if ((profile = switch_channel_get_caller_profile(channel))) {
+ if (profile->originatee_caller_profile) {
+ cid_name = "Outbound Call";
+ cid_num = profile->originatee_caller_profile->destination_number;
+ } else {
+ cid_name = profile->caller_id_name;
+ cid_num = profile->caller_id_number;
+ }
+ }
+
+ stream->write_function(stream, "%s %s [%s (%s)] %s\n", tp->call_id, switch_channel_get_name(channel),
+ cid_name, cid_num, switch_test_flag(tp, TFLAG_MASTER) ? "active" : "hold");
+ }
+ switch_mutex_unlock(globals.pvt_lock);
- stream->write_function(stream, "\n%d call%s\n", x, x == 1 ? "" : "s");
+ stream->write_function(stream, "\n%d call%s\n", x, x == 1 ? "" : "s");
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t *stream)
{
switch_core_session_t *session;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- char *dest = NULL;
+ char *dest = NULL;
if (!argv[0]) {
stream->write_function(stream, "FAIL:Usage: call <dest>\n");
@@ -1639,12 +1567,12 @@
}
dest = argv[0];
- if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
+ if ((session = switch_core_session_request(channel_endpoint_interface, NULL)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
- char *dialplan = globals.dialplan;
- char *cid_name = globals.cid_name;
- char *cid_num = globals.cid_num;
+ char *dialplan = globals.dialplan;
+ char *cid_name = globals.cid_name;
+ char *cid_num = globals.cid_num;
switch_core_session_add_stream(session, NULL);
if ((tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t))) != 0) {
@@ -1653,7 +1581,7 @@
channel = switch_core_session_get_channel(session);
switch_core_session_set_private(session, tech_pvt);
tech_pvt->session = session;
- globals.flags = GFLAG_EAR | GFLAG_MOUTH;
+ globals.flags = GFLAG_EAR | GFLAG_MOUTH;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
switch_core_session_destroy(&session);
@@ -1661,31 +1589,29 @@
}
if (!switch_strlen_zero(argv[1])) {
- dialplan = argv[1];
- }
+ dialplan = argv[1];
+ }
- if (!switch_strlen_zero(argv[2])) {
- cid_num = argv[2];
- }
-
- if (!switch_strlen_zero(argv[3])) {
- cid_name = argv[3];
- }
-
- if (!switch_strlen_zero(argv[4])) {
- tech_pvt->sample_rate = atoi(argv[4]);
- }
-
- if (!switch_strlen_zero(argv[4])) {
- tech_pvt->codec_ms = atoi(argv[5]);
- }
+ if (!switch_strlen_zero(argv[2])) {
+ cid_num = argv[2];
+ }
+
+ if (!switch_strlen_zero(argv[3])) {
+ cid_name = argv[3];
+ }
+
+ if (!switch_strlen_zero(argv[4])) {
+ tech_pvt->sample_rate = atoi(argv[4]);
+ }
+
+ if (!switch_strlen_zero(argv[4])) {
+ tech_pvt->codec_ms = atoi(argv[5]);
+ }
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
NULL,
- dialplan,
- cid_name,
- cid_num,
- NULL, NULL, NULL, NULL, (char *)modname, NULL, dest)) != 0) {
+ dialplan, cid_name, cid_num, NULL, NULL, NULL, NULL, (char *) modname, NULL,
+ dest)) != 0) {
char name[128];
snprintf(name, sizeof(name), "PortAudio/%s",
tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
@@ -1695,14 +1621,19 @@
}
tech_pvt->session = session;
if ((status = engage_device(tech_pvt->sample_rate, tech_pvt->codec_ms)) == SWITCH_STATUS_SUCCESS) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
- switch_channel_mark_answered(channel);
+ switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
+ switch_channel_mark_answered(channel);
switch_channel_set_state(channel, CS_INIT);
- switch_core_session_thread_launch(tech_pvt->session);
- add_pvt(tech_pvt, PA_MASTER);
- stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id, switch_core_session_get_uuid(tech_pvt->session));
+ if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
+ switch_core_session_destroy(&session);
+ stream->write_function(stream, "FAIL:Thread Error!\n");
+ } else {
+ add_pvt(tech_pvt, PA_MASTER);
+ stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id, switch_core_session_get_uuid(tech_pvt->session));
+ }
} else {
- switch_core_session_destroy(&session);
+ switch_core_session_destroy(&session);
stream->write_function(stream, "FAIL:Device Error!\n");
}
}
@@ -1710,74 +1641,131 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t padep(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
+static switch_status_t set_volume(char **argv, int argc, switch_stream_handle_t *stream)
{
- stream->write_function(stream, "This command no longer exists (try 'pa help')\n");
- return SWITCH_STATUS_SUCCESS;
+ PxVolume volume;
+ switch_mutex_lock(globals.device_lock);
+ if (!switch_strlen_zero(argv[1])) {
+ volume = (PxVolume) atof(argv[1]);
+ Px_SetMasterVolume( globals.mixer, volume );
+ }
+ switch_mutex_unlock(globals.device_lock);
+ return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t pa_cmd(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
+SWITCH_STANDARD_API(pa_cmd)
{
- char *argv[1024] = {0};
- int argc = 0;
- char *mycmd = NULL, *devname = NULL;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- pa_command_t func = NULL;
- int lead = 1, devval = 0;
- const char *usage_string = "USAGE:\n"
- "--------------------------------------------------------------------------------\n"
- "pa help\n"
- "pa dump\n"
- "pa call <dest> [<dialplan> <cid_name> <cid_num> <rate>]\n"
- "pa answer [<call_id>]\n"
- "pa hangup [<call_id>]\n"
- "pa list\n"
- "pa switch [<call_id>|none]\n"
- "pa dtmf <digit string>\n"
- "pa flags [on|off] [ear] [mouth]\n"
+ char *argv[1024] = { 0 };
+ int argc = 0;
+ char *mycmd = NULL, *devname = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ pa_command_t func = NULL;
+ int lead = 1, devval = 0;
+ char *wcmd = NULL, *action = NULL;
+ char cmd_buf[1024] = "";
+ char *http = NULL;
+
+ const char *usage_string = "USAGE:\n"
+ "--------------------------------------------------------------------------------\n"
+ "pa help\n"
+ "pa dump\n"
+ "pa call <dest> [<dialplan> <cid_name> <cid_num> <rate>]\n"
+ "pa answer [<call_id>]\n"
+ "pa hangup [<call_id>]\n"
+ "pa list\n"
+ "pa switch [<call_id>|none]\n"
+ "pa dtmf <digit string>\n"
+ "pa flags [on|off] [ear] [mouth]\n"
"pa devlist\n"
"pa indev [#<num>|<partial name>\n"
"pa outdev [#<num>|<partial name>\n"
"pa ringdev [#<num>|<partial name>\n"
- "--------------------------------------------------------------------------------\n";
+ "pa setvolume <volume between 0.0 and 1.0>\n"
+ "--------------------------------------------------------------------------------\n";
+
+ if (stream->event) {
+ http = switch_event_get_header(stream->event, "http-host");
+ }
+
+
+ if (http) {
+#if 0
+ switch_event_header_t *hp;
+ stream->write_function(stream, "<pre>");
+ for (hp = stream->event->headers; hp; hp = hp->next) {
+ stream->write_function(stream, "[%s]=[%s]\n", hp->name, hp->value);
+ }
+ stream->write_function(stream, "</pre>");
+#endif
+
+ wcmd = switch_str_nil(switch_event_get_header(stream->event, "wcmd"));
+ action = switch_event_get_header(stream->event, "action");
- if (switch_strlen_zero(cmd)) {
- stream->write_function(stream, "%s", usage_string);
- goto done;
- }
-
- if (!(mycmd = strdup(cmd))) {
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
-
- if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
- stream->write_function(stream, "%s", usage_string);
- goto done;
- }
-
- if (!strcasecmp(argv[0], "call")) {
- func = place_call;
- } else if (!strcasecmp(argv[0], "help")) {
- stream->write_function(stream, "%s", usage_string);
- goto done;
- } else if (!strcasecmp(argv[0], "devlist")) {
+ if (action) {
+ if (strlen(action) == 1) {
+ snprintf(cmd_buf, sizeof(cmd_buf), "dtmf %s", action);
+ cmd = cmd_buf;
+ } else if (!strcmp(action, "mute")) {
+ snprintf(cmd_buf, sizeof(cmd_buf), "flags off mouth");
+ cmd = cmd_buf;
+ } else if (!strcmp(action, "unmute")) {
+ snprintf(cmd_buf, sizeof(cmd_buf), "flags on mouth");
+ cmd = cmd_buf;
+ } else if (!strcmp(action, "switch")) {
+ snprintf(cmd_buf, sizeof(cmd_buf), "switch %s", wcmd);
+ cmd = cmd_buf;
+ } else if (!strcmp(action, "call")) {
+ snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd);
+ cmd = cmd_buf;
+ } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "answer")) {
+ cmd = action;
+ }
+ }
+
+ if (switch_strlen_zero(cmd)) {
+ goto done;
+ }
+
+ } else {
+
+ if (switch_strlen_zero(cmd)) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
+ }
+ }
+
+ if (!(mycmd = strdup(cmd))) {
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
+
+ if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
+ }
+
+ if (!strcasecmp(argv[0], "call")) {
+ func = place_call;
+ } else if (!strcasecmp(argv[0], "help")) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
+ } else if (!strcasecmp(argv[0], "devlist")) {
func = devlist;
- } else if (!strcasecmp(argv[0], "dump")) {
- dump_info();
- goto done;
- } else if (!strcasecmp(argv[0], "list")) {
- func = list_calls;
- } else if (!strcasecmp(argv[0], "flags")) {
- func = do_flags;
- } else if (!strcasecmp(argv[0], "hangup")) {
- func = hangup_call;
- } else if (!strcasecmp(argv[0], "answer")) {
- func = answer_call;
- } else if (!strcasecmp(argv[0], "switch")) {
- func = switch_call;
- } else if (!strcasecmp(argv[0], "dtmf")) {
- func = dtmf_call;
+ } else if (!strcasecmp(argv[0], "dump")) {
+ dump_info();
+ goto done;
+ } else if (!strcasecmp(argv[0], "list")) {
+ func = list_calls;
+ } else if (!strcasecmp(argv[0], "flags")) {
+ func = do_flags;
+ } else if (!strcasecmp(argv[0], "hangup")) {
+ func = hangup_call;
+ } else if (!strcasecmp(argv[0], "answer")) {
+ func = answer_call;
+ } else if (!strcasecmp(argv[0], "switch")) {
+ func = switch_call;
+ } else if (!strcasecmp(argv[0], "dtmf")) {
+ func = dtmf_call;
} else if (argv[1] && !strcmp(argv[0], "indev")) {
if (*argv[1] == '#') {
devval = get_dev_by_number(atoi(argv[1] + 1), 1);
@@ -1795,7 +1783,7 @@
devval = get_dev_by_name(argv[1], 0);
}
devname = "outdev";
- if (devval > 0) {
+ if (devval > 0) {
globals.outdev = devval;
}
} else if (argv[1] && !strcmp(argv[0], "ringdev")) {
@@ -1807,12 +1795,20 @@
devname = "ringdev";
if (devval > 0) {
globals.ringdev = devval;
+ }
+ } else if (!strcasecmp(argv[0], "setvolume")) {
+ func = set_volume;
+ }
+
+ if (func) {
+ if (http) {
+ stream->write_function(stream, "<pre>");
}
- }
-
- if (func) {
- status = func(&argv[lead], argc - lead, stream);
- } else {
+ status = func(&argv[lead], argc - lead, stream);
+ if (http) {
+ stream->write_function(stream, "\n\n</pre>");
+ }
+ } else {
if (devname) {
if (devval > 0) {
stream->write_function(stream, "%s set to %d\n", devname, devval);
@@ -1822,13 +1818,52 @@
} else {
stream->write_function(stream, "Unknown Command [%s]\n", argv[0]);
}
- }
+ }
+
+ done:
- done:
+ if (http) {
- switch_safe_free(mycmd);
+ stream->write_function(stream,
+ "<br><br><table align=center><tr><td><center><form method=post>\n"
+ "<input type=text name=wcmd size=40><br><br>\n"
+
+ "<input name=action type=submit value=\"call\"> "
+ "<input name=action type=submit value=\"hangup\"> "
+ "<input name=action type=submit value=\"list\"> "
+ "<input name=action type=submit value=\"switch\"> "
+ "<input name=action type=submit value=\"mute\"> "
+ "<input name=action type=submit value=\"unmute\"> "
+ "<input name=action type=submit value=\"answer\"> <br><br>"
+ "<table border=1>\n"
+ "<tr><td><input name=action type=submit value=\"1\"></td>"
+ "<td><input name=action type=submit value=\"2\"></td>"
+ "<td><input name=action type=submit value=\"3\"></td>\n"
+ "<td><input name=action type=submit value=\"A\"></td></tr>\n"
+
+ "<tr><td><input name=action type=submit value=\"4\"></td>"
+ "<td><input name=action type=submit value=\"5\"></td>"
+ "<td><input name=action type=submit value=\"6\"></td>\n"
+ "<td><input name=action type=submit value=\"B\"></td></tr>\n"
+
+ "<tr><td><input name=action type=submit value=\"7\"></td>"
+ "<td><input name=action type=submit value=\"8\"></td>"
+ "<td><input name=action type=submit value=\"9\"></td>\n"
+ "<td><input name=action type=submit value=\"C\"></td></tr>\n"
+
+ "<tr><td><input name=action type=submit value=\"*\"></td>"
+ "<td><input name=action type=submit value=\"0\"></td>"
+ "<td><input name=action type=submit value=\"#\"></td>\n"
+ "<td><input name=action type=submit value=\"D\"></td></tr>\n"
+ "</table>"
+
+ "</form><br></center></td></tr></table>\n"
+ );
+ }
- return status;
+ switch_safe_free(mycmd);
+
+ return status;
}
Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c (original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c Fri Aug 24 13:50:56 2007
@@ -81,24 +81,25 @@
# define PaUtil_WriteMemoryBarrier()
#else
-#if defined(__APPLE__) //|| defined(__FreeBSD__)
+#if defined(__APPLE__) //|| defined(__FreeBSD__)
# include <libkern/OSAtomic.h>
- /* Here are the memory barrier functions. Mac OS X and FreeBSD only provide
- full memory barriers, so the three types of barriers are the same. */
+ /* Here are the memory barrier functions. Mac OS X and FreeBSD only provide
+ full memory barriers, so the three types of barriers are the same. */
# define PaUtil_FullMemoryBarrier() OSMemoryBarrier()
# define PaUtil_ReadMemoryBarrier() OSMemoryBarrier()
# define PaUtil_WriteMemoryBarrier() OSMemoryBarrier()
#elif defined(__GNUC__)
- /* GCC understands volatile asm and "memory" to mean it
- * should not reorder memory read/writes */
+
+ /* GCC understands volatile asm and "memory" to mean it
+ * should not reorder memory read/writes */
# if defined( __PPC__ )
-# define PaUtil_FullMemoryBarrier() asm volatile("sync":::"memory")
-# define PaUtil_ReadMemoryBarrier() asm volatile("sync":::"memory")
-# define PaUtil_WriteMemoryBarrier() asm volatile("sync":::"memory")
+# define PaUtil_FullMemoryBarrier() __asm__ volatile("sync":::"memory")
+# define PaUtil_ReadMemoryBarrier() __asm__ volatile("sync":::"memory")
+# define PaUtil_WriteMemoryBarrier() __asm__ volatile("sync":::"memory")
# elif defined( __i386__ ) || defined( __i486__ ) || defined( __i586__ ) || defined( __i686__ ) || defined(__x86_64__)
-# define PaUtil_FullMemoryBarrier() asm volatile("mfence":::"memory")
-# define PaUtil_ReadMemoryBarrier() asm volatile("lfence":::"memory")
-# define PaUtil_WriteMemoryBarrier() asm volatile("sfence":::"memory")
+# define PaUtil_FullMemoryBarrier() __asm__ volatile("mfence":::"memory")
+# define PaUtil_ReadMemoryBarrier() __asm__ volatile("lfence":::"memory")
+# define PaUtil_WriteMemoryBarrier() __asm__ volatile("sfence":::"memory")
# else
# define PaUtil_FullMemoryBarrier()
# define PaUtil_ReadMemoryBarrier()
@@ -122,37 +123,39 @@
* Initialize FIFO.
* numBytes must be power of 2, returns -1 if not.
*/
-long PaUtil_InitializeRingBuffer( PaUtilRingBuffer *rbuf, long numBytes, void *dataPtr )
+long PaUtil_InitializeRingBuffer(PaUtilRingBuffer * rbuf, long numBytes, void *dataPtr)
{
- if( ((numBytes-1) & numBytes) != 0) return -1; /* Not Power of two. */
- rbuf->bufferSize = numBytes;
- rbuf->buffer = (char *)dataPtr;
- PaUtil_FlushRingBuffer( rbuf );
- rbuf->bigMask = (numBytes*2)-1;
- rbuf->smallMask = (numBytes)-1;
- return 0;
+ if (((numBytes - 1) & numBytes) != 0)
+ return -1; /* Not Power of two. */
+ rbuf->bufferSize = numBytes;
+ rbuf->buffer = (char *) dataPtr;
+ PaUtil_FlushRingBuffer(rbuf);
+ rbuf->bigMask = (numBytes * 2) - 1;
+ rbuf->smallMask = (numBytes) - 1;
+ return 0;
}
/***************************************************************************
** Return number of bytes available for reading. */
-long PaUtil_GetRingBufferReadAvailable( PaUtilRingBuffer *rbuf )
+long PaUtil_GetRingBufferReadAvailable(PaUtilRingBuffer * rbuf)
{
- PaUtil_ReadMemoryBarrier();
- return ( (rbuf->writeIndex - rbuf->readIndex) & rbuf->bigMask );
+ PaUtil_ReadMemoryBarrier();
+ return ((rbuf->writeIndex - rbuf->readIndex) & rbuf->bigMask);
}
+
/***************************************************************************
** Return number of bytes available for writing. */
-long PaUtil_GetRingBufferWriteAvailable( PaUtilRingBuffer *rbuf )
+long PaUtil_GetRingBufferWriteAvailable(PaUtilRingBuffer * rbuf)
{
- /* Since we are calling PaUtil_GetRingBufferReadAvailable, we don't need an aditional MB */
- return ( rbuf->bufferSize - PaUtil_GetRingBufferReadAvailable(rbuf));
+ /* Since we are calling PaUtil_GetRingBufferReadAvailable, we don't need an aditional MB */
+ return (rbuf->bufferSize - PaUtil_GetRingBufferReadAvailable(rbuf));
}
/***************************************************************************
** Clear buffer. Should only be called when buffer is NOT being read. */
-void PaUtil_FlushRingBuffer( PaUtilRingBuffer *rbuf )
+void PaUtil_FlushRingBuffer(PaUtilRingBuffer * rbuf)
{
- rbuf->writeIndex = rbuf->readIndex = 0;
+ rbuf->writeIndex = rbuf->readIndex = 0;
}
/***************************************************************************
@@ -161,42 +164,38 @@
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be written or numBytes, whichever is smaller.
*/
-long PaUtil_GetRingBufferWriteRegions( PaUtilRingBuffer *rbuf, long numBytes,
- void **dataPtr1, long *sizePtr1,
- void **dataPtr2, long *sizePtr2 )
-{
- long index;
- long available = PaUtil_GetRingBufferWriteAvailable( rbuf );
- if( numBytes > available ) numBytes = available;
- /* Check to see if write is not contiguous. */
- index = rbuf->writeIndex & rbuf->smallMask;
- if( (index + numBytes) > rbuf->bufferSize )
- {
- /* Write data in two blocks that wrap the buffer. */
- long firstHalf = rbuf->bufferSize - index;
- *dataPtr1 = &rbuf->buffer[index];
- *sizePtr1 = firstHalf;
- *dataPtr2 = &rbuf->buffer[0];
- *sizePtr2 = numBytes - firstHalf;
- }
- else
- {
- *dataPtr1 = &rbuf->buffer[index];
- *sizePtr1 = numBytes;
- *dataPtr2 = NULL;
- *sizePtr2 = 0;
- }
- return numBytes;
+long PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2)
+{
+ long index;
+ long available = PaUtil_GetRingBufferWriteAvailable(rbuf);
+ if (numBytes > available)
+ numBytes = available;
+ /* Check to see if write is not contiguous. */
+ index = rbuf->writeIndex & rbuf->smallMask;
+ if ((index + numBytes) > rbuf->bufferSize) {
+ /* Write data in two blocks that wrap the buffer. */
+ long firstHalf = rbuf->bufferSize - index;
+ *dataPtr1 = &rbuf->buffer[index];
+ *sizePtr1 = firstHalf;
+ *dataPtr2 = &rbuf->buffer[0];
+ *sizePtr2 = numBytes - firstHalf;
+ } else {
+ *dataPtr1 = &rbuf->buffer[index];
+ *sizePtr1 = numBytes;
+ *dataPtr2 = NULL;
+ *sizePtr2 = 0;
+ }
+ return numBytes;
}
/***************************************************************************
*/
-long PaUtil_AdvanceRingBufferWriteIndex( PaUtilRingBuffer *rbuf, long numBytes )
+long PaUtil_AdvanceRingBufferWriteIndex(PaUtilRingBuffer * rbuf, long numBytes)
{
- /* we need to ensure that previous writes are seen before we update the write index */
- PaUtil_WriteMemoryBarrier();
- return rbuf->writeIndex = (rbuf->writeIndex + numBytes) & rbuf->bigMask;
+ /* we need to ensure that previous writes are seen before we update the write index */
+ PaUtil_WriteMemoryBarrier();
+ return rbuf->writeIndex = (rbuf->writeIndex + numBytes) & rbuf->bigMask;
}
/***************************************************************************
@@ -205,81 +204,72 @@
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be written or numBytes, whichever is smaller.
*/
-long PaUtil_GetRingBufferReadRegions( PaUtilRingBuffer *rbuf, long numBytes,
- void **dataPtr1, long *sizePtr1,
- void **dataPtr2, long *sizePtr2 )
-{
- long index;
- long available = PaUtil_GetRingBufferReadAvailable( rbuf );
- if( numBytes > available ) numBytes = available;
- /* Check to see if read is not contiguous. */
- index = rbuf->readIndex & rbuf->smallMask;
- if( (index + numBytes) > rbuf->bufferSize )
- {
- /* Write data in two blocks that wrap the buffer. */
- long firstHalf = rbuf->bufferSize - index;
- *dataPtr1 = &rbuf->buffer[index];
- *sizePtr1 = firstHalf;
- *dataPtr2 = &rbuf->buffer[0];
- *sizePtr2 = numBytes - firstHalf;
- }
- else
- {
- *dataPtr1 = &rbuf->buffer[index];
- *sizePtr1 = numBytes;
- *dataPtr2 = NULL;
- *sizePtr2 = 0;
- }
- return numBytes;
+long PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2)
+{
+ long index;
+ long available = PaUtil_GetRingBufferReadAvailable(rbuf);
+ if (numBytes > available)
+ numBytes = available;
+ /* Check to see if read is not contiguous. */
+ index = rbuf->readIndex & rbuf->smallMask;
+ if ((index + numBytes) > rbuf->bufferSize) {
+ /* Write data in two blocks that wrap the buffer. */
+ long firstHalf = rbuf->bufferSize - index;
+ *dataPtr1 = &rbuf->buffer[index];
+ *sizePtr1 = firstHalf;
+ *dataPtr2 = &rbuf->buffer[0];
+ *sizePtr2 = numBytes - firstHalf;
+ } else {
+ *dataPtr1 = &rbuf->buffer[index];
+ *sizePtr1 = numBytes;
+ *dataPtr2 = NULL;
+ *sizePtr2 = 0;
+ }
+ return numBytes;
}
+
/***************************************************************************
*/
-long PaUtil_AdvanceRingBufferReadIndex( PaUtilRingBuffer *rbuf, long numBytes )
+long PaUtil_AdvanceRingBufferReadIndex(PaUtilRingBuffer * rbuf, long numBytes)
{
- /* we need to ensure that previous writes are always seen before updating the index. */
- PaUtil_WriteMemoryBarrier();
- return rbuf->readIndex = (rbuf->readIndex + numBytes) & rbuf->bigMask;
+ /* we need to ensure that previous writes are always seen before updating the index. */
+ PaUtil_WriteMemoryBarrier();
+ return rbuf->readIndex = (rbuf->readIndex + numBytes) & rbuf->bigMask;
}
/***************************************************************************
** Return bytes written. */
-long PaUtil_WriteRingBuffer( PaUtilRingBuffer *rbuf, const void *data, long numBytes )
+long PaUtil_WriteRingBuffer(PaUtilRingBuffer * rbuf, const void *data, long numBytes)
{
- long size1, size2, numWritten;
- void *data1, *data2;
- numWritten = PaUtil_GetRingBufferWriteRegions( rbuf, numBytes, &data1, &size1, &data2, &size2 );
- if( size2 > 0 )
- {
-
- memcpy( data1, data, size1 );
- data = ((char *)data) + size1;
- memcpy( data2, data, size2 );
- }
- else
- {
- memcpy( data1, data, size1 );
- }
- PaUtil_AdvanceRingBufferWriteIndex( rbuf, numWritten );
- return numWritten;
+ long size1, size2, numWritten;
+ void *data1, *data2;
+ numWritten = PaUtil_GetRingBufferWriteRegions(rbuf, numBytes, &data1, &size1, &data2, &size2);
+ if (size2 > 0) {
+
+ memcpy(data1, data, size1);
+ data = ((char *) data) + size1;
+ memcpy(data2, data, size2);
+ } else {
+ memcpy(data1, data, size1);
+ }
+ PaUtil_AdvanceRingBufferWriteIndex(rbuf, numWritten);
+ return numWritten;
}
/***************************************************************************
** Return bytes read. */
-long PaUtil_ReadRingBuffer( PaUtilRingBuffer *rbuf, void *data, long numBytes )
+long PaUtil_ReadRingBuffer(PaUtilRingBuffer * rbuf, void *data, long numBytes)
{
- long size1, size2, numRead;
- void *data1, *data2;
- numRead = PaUtil_GetRingBufferReadRegions( rbuf, numBytes, &data1, &size1, &data2, &size2 );
- if( size2 > 0 )
- {
- memcpy( data, data1, size1 );
- data = ((char *)data) + size1;
- memcpy( data, data2, size2 );
- }
- else
- {
- memcpy( data, data1, size1 );
- }
- PaUtil_AdvanceRingBufferReadIndex( rbuf, numRead );
- return numRead;
+ long size1, size2, numRead;
+ void *data1, *data2;
+ numRead = PaUtil_GetRingBufferReadRegions(rbuf, numBytes, &data1, &size1, &data2, &size2);
+ if (size2 > 0) {
+ memcpy(data, data1, size1);
+ data = ((char *) data) + size1;
+ memcpy(data, data2, size2);
+ } else {
+ memcpy(data, data1, size1);
+ }
+ PaUtil_AdvanceRingBufferReadIndex(rbuf, numRead);
+ return numRead;
}
Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h (original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h Fri Aug 24 13:50:56 2007
@@ -51,19 +51,17 @@
*/
#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-typedef struct PaUtilRingBuffer
-{
- long bufferSize; /* Number of bytes in FIFO. Power of 2. Set by PaUtil_InitRingBuffer. */
- long writeIndex; /* Index of next writable byte. Set by PaUtil_AdvanceRingBufferWriteIndex. */
- long readIndex; /* Index of next readable byte. Set by PaUtil_AdvanceRingBufferReadIndex. */
- long bigMask; /* Used for wrapping indices with extra bit to distinguish full/empty. */
- long smallMask; /* Used for fitting indices to buffer. */
- char *buffer;
-}PaUtilRingBuffer;
+extern "C" {
+#endif /* __cplusplus */
+
+ typedef struct PaUtilRingBuffer {
+ long bufferSize; /* Number of bytes in FIFO. Power of 2. Set by PaUtil_InitRingBuffer. */
+ long writeIndex; /* Index of next writable byte. Set by PaUtil_AdvanceRingBufferWriteIndex. */
+ long readIndex; /* Index of next readable byte. Set by PaUtil_AdvanceRingBufferReadIndex. */
+ long bigMask; /* Used for wrapping indices with extra bit to distinguish full/empty. */
+ long smallMask; /* Used for fitting indices to buffer. */
+ char *buffer;
+ } PaUtilRingBuffer;
/** Initialize Ring Buffer.
@@ -76,13 +74,13 @@
@return -1 if numBytes is not a power of 2, otherwise 0.
*/
-long PaUtil_InitializeRingBuffer( PaUtilRingBuffer *rbuf, long numBytes, void *dataPtr );
+ long PaUtil_InitializeRingBuffer(PaUtilRingBuffer * rbuf, long numBytes, void *dataPtr);
/** Clear buffer. Should only be called when buffer is NOT being read.
@param rbuf The ring buffer.
*/
-void PaUtil_FlushRingBuffer( PaUtilRingBuffer *rbuf );
+ void PaUtil_FlushRingBuffer(PaUtilRingBuffer * rbuf);
/** Retrieve the number of bytes available in the ring buffer for writing.
@@ -90,7 +88,7 @@
@return The number of bytes available for writing.
*/
-long PaUtil_GetRingBufferWriteAvailable( PaUtilRingBuffer *rbuf );
+ long PaUtil_GetRingBufferWriteAvailable(PaUtilRingBuffer * rbuf);
/** Retrieve the number of bytes available in the ring buffer for reading.
@@ -98,7 +96,7 @@
@return The number of bytes available for reading.
*/
-long PaUtil_GetRingBufferReadAvailable( PaUtilRingBuffer *rbuf );
+ long PaUtil_GetRingBufferReadAvailable(PaUtilRingBuffer * rbuf);
/** Write data to the ring buffer.
@@ -110,7 +108,7 @@
@return The number of bytes written.
*/
-long PaUtil_WriteRingBuffer( PaUtilRingBuffer *rbuf, const void *data, long numBytes );
+ long PaUtil_WriteRingBuffer(PaUtilRingBuffer * rbuf, const void *data, long numBytes);
/** Read data from the ring buffer.
@@ -122,7 +120,7 @@
@return The number of bytes read.
*/
-long PaUtil_ReadRingBuffer( PaUtilRingBuffer *rbuf, void *data, long numBytes );
+ long PaUtil_ReadRingBuffer(PaUtilRingBuffer * rbuf, void *data, long numBytes);
/** Get address of region(s) to which we can write data.
@@ -144,9 +142,7 @@
@return The room available to be written or numBytes, whichever is smaller.
*/
-long PaUtil_GetRingBufferWriteRegions( PaUtilRingBuffer *rbuf, long numBytes,
- void **dataPtr1, long *sizePtr1,
- void **dataPtr2, long *sizePtr2 );
+ long PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2);
/** Advance the write index to the next location to be written.
@@ -156,7 +152,7 @@
@return The new position.
*/
-long PaUtil_AdvanceRingBufferWriteIndex( PaUtilRingBuffer *rbuf, long numBytes );
+ long PaUtil_AdvanceRingBufferWriteIndex(PaUtilRingBuffer * rbuf, long numBytes);
/** Get address of region(s) from which we can write data.
@@ -178,9 +174,7 @@
@return The number of bytes available for reading.
*/
-long PaUtil_GetRingBufferReadRegions( PaUtilRingBuffer *rbuf, long numBytes,
- void **dataPtr1, long *sizePtr1,
- void **dataPtr2, long *sizePtr2 );
+ long PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2);
/** Advance the read index to the next location to be read.
@@ -190,9 +184,9 @@
@return The new position.
*/
-long PaUtil_AdvanceRingBufferReadIndex( PaUtilRingBuffer *rbuf, long numBytes );
+ long PaUtil_AdvanceRingBufferReadIndex(PaUtilRingBuffer * rbuf, long numBytes);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
-#endif /* PA_RINGBUFFER_H */
+#endif /* __cplusplus */
+#endif /* PA_RINGBUFFER_H */
Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.c (original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.c Fri Aug 24 13:50:56 2007
@@ -40,6 +40,7 @@
* license above.
*/
+#include <switch.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -49,176 +50,181 @@
#include <string.h>
#include <time.h>
-/************************************************************************/
-/******** Constants *****************************************************/
-/************************************************************************/
-
-#define FRAMES_PER_BUFFER (256)
/************************************************************************/
/******** Prototypes ****************************************************/
/************************************************************************/
-static int blockingIOCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData );
-static PaError PABLIO_InitFIFO( PaUtilRingBuffer *rbuf, long numFrames, long bytesPerFrame );
-static PaError PABLIO_TermFIFO( PaUtilRingBuffer *rbuf );
+static int blockingIOCallback(const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
+static PaError PABLIO_InitFIFO(PaUtilRingBuffer * rbuf, long numFrames, long bytesPerFrame);
+static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf);
/************************************************************************/
/******** Functions *****************************************************/
/************************************************************************/
/* Called from PortAudio.
- * Read and write data only if there is room in FIFOs.
+ * Read and write data
*/
-static int blockingIOCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
+static int blockingIOCallback(const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
{
- PABLIO_Stream *data = (PABLIO_Stream*)userData;
- long numBytes = data->bytesPerFrame * framesPerBuffer;
-
- /* This may get called with NULL inputBuffer during initial setup. */
- if( inputBuffer != NULL )
- {
- PaUtil_WriteRingBuffer( &data->inFIFO, inputBuffer, numBytes );
- }
- if( outputBuffer != NULL )
- {
- int i;
- int numRead = PaUtil_ReadRingBuffer( &data->outFIFO, outputBuffer, numBytes );
- /* Zero out remainder of buffer if we run out of data. */
- for( i=numRead; i<numBytes; i++ )
- {
- ((char *)outputBuffer)[i] = 0;
- }
- }
+ PABLIO_Stream *data = (PABLIO_Stream *) userData;
+ long numBytes = data->bytesPerFrame * framesPerBuffer;
+
+ /* This may get called with NULL inputBuffer during initial setup. */
+ if (inputBuffer != NULL) {
+ if (PaUtil_WriteRingBuffer(&data->inFIFO, inputBuffer, numBytes) != numBytes) {
+ PaUtil_FlushRingBuffer(&data->inFIFO);
+ PaUtil_WriteRingBuffer(&data->inFIFO, inputBuffer, numBytes);
+ }
+ }
+ if (outputBuffer != NULL) {
+ int i;
+ int numRead = PaUtil_ReadRingBuffer(&data->outFIFO, outputBuffer, numBytes);
+ /* Zero out remainder of buffer if we run out of data. */
+ for (i = numRead; i < numBytes; i++) {
+ ((char *) outputBuffer)[i] = 0;
+ }
+ }
- return 0;
+ return 0;
}
/* Allocate buffer. */
-static PaError PABLIO_InitFIFO( PaUtilRingBuffer *rbuf, long numFrames, long bytesPerFrame )
+static PaError PABLIO_InitFIFO(PaUtilRingBuffer * rbuf, long numFrames, long bytesPerFrame)
{
- long numBytes = numFrames * bytesPerFrame;
- char *buffer = (char *) malloc( numBytes );
- if( buffer == NULL ) return paInsufficientMemory;
- memset( buffer, 0, numBytes );
- return (PaError) PaUtil_InitializeRingBuffer( rbuf, numBytes, buffer );
+ long numBytes = numFrames * bytesPerFrame;
+ char *buffer = (char *) malloc(numBytes);
+ if (buffer == NULL)
+ return paInsufficientMemory;
+ memset(buffer, 0, numBytes);
+ return (PaError) PaUtil_InitializeRingBuffer(rbuf, numBytes, buffer);
}
/* Free buffer. */
-static PaError PABLIO_TermFIFO( PaUtilRingBuffer *rbuf )
+static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf)
{
- if( rbuf->buffer ) free( rbuf->buffer );
- rbuf->buffer = NULL;
- return paNoError;
+ if (rbuf->buffer)
+ free(rbuf->buffer);
+ rbuf->buffer = NULL;
+ return paNoError;
}
/************************************************************
* Write data to ring buffer.
* Will not return until all the data has been written.
*/
-long WriteAudioStream( PABLIO_Stream *aStream, void *data, long numFrames )
+long WriteAudioStream(PABLIO_Stream * aStream, void *data, long numFrames, switch_timer_t *timer)
{
- long bytesWritten;
- char *p = (char *) data;
- long numBytes = aStream->bytesPerFrame * numFrames;
- while( numBytes > 0)
- {
- bytesWritten = PaUtil_WriteRingBuffer( &aStream->outFIFO, p, numBytes );
- numBytes -= bytesWritten;
- p += bytesWritten;
- if( numBytes > 0) Pa_Sleep(10);
- }
- return numFrames;
+ long bytesWritten;
+ char *p = (char *) data;
+ long numBytes = aStream->bytesPerFrame * numFrames;
+
+ while (numBytes > 0) {
+ bytesWritten = PaUtil_WriteRingBuffer(&aStream->outFIFO, p, numBytes);
+ numBytes -= bytesWritten;
+ p += bytesWritten;
+ if (numBytes > 0) {
+ if (switch_core_timer_check(timer) == SWITCH_STATUS_SUCCESS) {
+ PaUtil_FlushRingBuffer(&aStream->outFIFO);
+ return 0;
+ }
+ switch_yield(1000);
+ }
+ }
+ return numFrames;
}
/************************************************************
* Read data from ring buffer.
* Will not return until all the data has been read.
*/
-long ReadAudioStream( PABLIO_Stream *aStream, void *data, long numFrames )
+long ReadAudioStream(PABLIO_Stream * aStream, void *data, long numFrames, switch_timer_t *timer)
{
- long bytesRead;
- char *p = (char *) data;
- long numBytes = aStream->bytesPerFrame * numFrames;
-
- while( numBytes > 0)
- {
- bytesRead = PaUtil_ReadRingBuffer( &aStream->inFIFO, p, numBytes );
- numBytes -= bytesRead;
- p += bytesRead;
- if( numBytes > 0) Pa_Sleep(10);
- }
- return numFrames;
+ long bytesRead;
+ char *p = (char *) data;
+ long numBytes = aStream->bytesPerFrame * numFrames;
+
+ while (numBytes > 0) {
+ bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, numBytes);
+ numBytes -= bytesRead;
+ if (numBytes > 0) {
+ if (switch_core_timer_check(timer) == SWITCH_STATUS_SUCCESS) {
+ PaUtil_FlushRingBuffer(&aStream->inFIFO);
+ return 0;
+ }
+ switch_yield(1000);
+ }
+ }
+ return numFrames;
}
/************************************************************
* Return the number of frames that could be written to the stream without
* having to wait.
*/
-long GetAudioStreamWriteable( PABLIO_Stream *aStream )
+long GetAudioStreamWriteable(PABLIO_Stream * aStream)
{
- int bytesEmpty = PaUtil_GetRingBufferWriteAvailable( &aStream->outFIFO );
- return bytesEmpty / aStream->bytesPerFrame;
+ int bytesEmpty = PaUtil_GetRingBufferWriteAvailable(&aStream->outFIFO);
+ return bytesEmpty / aStream->bytesPerFrame;
}
/************************************************************
* Return the number of frames that are available to be read from the
* stream without having to wait.
*/
-long GetAudioStreamReadable( PABLIO_Stream *aStream )
+long GetAudioStreamReadable(PABLIO_Stream * aStream)
{
- int bytesFull = PaUtil_GetRingBufferReadAvailable( &aStream->inFIFO );
- return bytesFull / aStream->bytesPerFrame;
+ int bytesFull = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
+ return bytesFull / aStream->bytesPerFrame;
}
-/************************************************************/
-static unsigned long RoundUpToNextPowerOf2( unsigned long n )
+/***********************************************************/
+static unsigned long RoundUpToNextPowerOf2(unsigned long n)
{
- long numBits = 0;
- if( ((n-1) & n) == 0) return n; /* Already Power of two. */
- while( n > 0 )
- {
- n= n>>1;
- numBits++;
- }
- return (1<<numBits);
+ long numBits = 0;
+ if (((n - 1) & n) == 0)
+ return n;
+ while (n > 0) {
+ n = n >> 1;
+ numBits++;
+ }
+ return (1 << numBits);
}
+
+
/************************************************************
* Opens a PortAudio stream with default characteristics.
* Allocates PABLIO_Stream structure.
*
*/
-PaError OpenAudioStream( PABLIO_Stream **rwblPtr,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate,
- PaStreamFlags streamFlags)
+PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
+ const PaStreamParameters *inputParameters,
+ const PaStreamParameters *outputParameters,
+ double sampleRate,
+ PaStreamFlags streamFlags,
+ long samples_per_frame)
{
- long bytesPerSample;
- PaError err;
- PABLIO_Stream *aStream;
- long minNumBuffers;
- long numFrames;
- long numBytes;
+ long bytesPerSample = 2;
+ PaError err;
+ PABLIO_Stream *aStream;
+ long numFrames;
+ //long numBytes;
int channels = 1;
- /* Allocate PABLIO_Stream structure for caller. */
- aStream = (PABLIO_Stream *) malloc( sizeof(PABLIO_Stream) );
- if( aStream == NULL ) return paInsufficientMemory;
- memset( aStream, 0, sizeof(PABLIO_Stream) );
-
- /* Initialize PortAudio */
- err = Pa_Initialize();
- if( err != paNoError ) goto error;
+ /* Allocate PABLIO_Stream structure for caller. */
+ aStream = (PABLIO_Stream *) malloc(sizeof(PABLIO_Stream));
+ if (aStream == NULL)
+ return paInsufficientMemory;
+ memset(aStream, 0, sizeof(PABLIO_Stream));
+
+ /* Initialize PortAudio */
+ err = Pa_Initialize();
+ if (err != paNoError)
+ goto error;
if (inputParameters) {
channels = inputParameters->channelCount;
@@ -226,81 +232,74 @@
channels = outputParameters->channelCount;
}
- numFrames = 4 * FRAMES_PER_BUFFER;
- numFrames = RoundUpToNextPowerOf2( numFrames );
-
- bytesPerSample = 2;
- aStream->samplesPerFrame = channels;
- aStream->bytesPerFrame = bytesPerSample * aStream->samplesPerFrame;
+ numFrames = RoundUpToNextPowerOf2(samples_per_frame * 5);
+ aStream->bytesPerFrame = bytesPerSample;
- /* Initialize Ring Buffers */
+ /* Initialize Ring Buffers */
if (inputParameters) {
- err = PABLIO_InitFIFO( &aStream->inFIFO, numFrames, aStream->bytesPerFrame );
- if( err != paNoError ) goto error;
+ err = PABLIO_InitFIFO(&aStream->inFIFO, numFrames, aStream->bytesPerFrame);
+ if (err != paNoError)
+ goto error;
}
if (outputParameters) {
- err = PABLIO_InitFIFO( &aStream->outFIFO, numFrames, aStream->bytesPerFrame );
- if( err != paNoError ) goto error;
+ err = PABLIO_InitFIFO(&aStream->outFIFO, numFrames, aStream->bytesPerFrame);
+ if (err != paNoError)
+ goto error;
}
/* Make Write FIFO appear full initially. */
- numBytes = PaUtil_GetRingBufferWriteAvailable( &aStream->outFIFO );
- PaUtil_AdvanceRingBufferWriteIndex( &aStream->outFIFO, numBytes );
-
+ //numBytes = PaUtil_GetRingBufferWriteAvailable(&aStream->outFIFO);
+ //PaUtil_AdvanceRingBufferWriteIndex(&aStream->outFIFO, numBytes);
+
- /* Open a PortAudio stream that we will use to communicate with the underlying
- * audio drivers. */
- err = Pa_OpenStream(
- &aStream->stream,
- inputParameters,
- outputParameters,
- sampleRate,
- FRAMES_PER_BUFFER,
- streamFlags,
- blockingIOCallback,
- aStream );
- if( err != paNoError ) goto error;
-
- err = Pa_StartStream( aStream->stream );
- if( err != paNoError ) goto error;
- *rwblPtr = aStream;
- return paNoError;
-
-error:
- CloseAudioStream( aStream );
- *rwblPtr = NULL;
- return err;
+ /* Open a PortAudio stream that we will use to communicate with the underlying
+ * audio drivers. */
+ err = Pa_OpenStream(&aStream->stream, inputParameters, outputParameters, sampleRate, samples_per_frame, streamFlags, blockingIOCallback, aStream);
+
+ if (err != paNoError)
+ goto error;
+
+ err = Pa_StartStream(aStream->stream);
+ if (err != paNoError)
+ goto error;
+ *rwblPtr = aStream;
+ return paNoError;
+
+ error:
+ CloseAudioStream(aStream);
+ *rwblPtr = NULL;
+ return err;
}
/************************************************************/
-PaError CloseAudioStream( PABLIO_Stream *aStream )
+PaError CloseAudioStream(PABLIO_Stream * aStream)
{
- PaError err;
- int bytesEmpty;
- int byteSize = aStream->outFIFO.bufferSize;
-
- /* If we are writing data, make sure we play everything written. */
- if( byteSize > 0 )
- {
- bytesEmpty = PaUtil_GetRingBufferWriteAvailable( &aStream->outFIFO );
- while( bytesEmpty < byteSize )
- {
- Pa_Sleep( 10 );
- bytesEmpty = PaUtil_GetRingBufferWriteAvailable( &aStream->outFIFO );
- }
- }
-
- err = Pa_StopStream( aStream->stream );
- if( err != paNoError ) goto error;
- err = Pa_CloseStream( aStream->stream );
- if( err != paNoError ) goto error;
- Pa_Terminate();
-
-error:
- PABLIO_TermFIFO( &aStream->inFIFO );
- PABLIO_TermFIFO( &aStream->outFIFO );
- free( aStream );
- return err;
+ PaError err;
+ int bytesEmpty;
+ int byteSize = aStream->outFIFO.bufferSize;
+
+ /* If we are writing data, make sure we play everything written. */
+ if (byteSize > 0) {
+ bytesEmpty = PaUtil_GetRingBufferWriteAvailable(&aStream->outFIFO);
+ while (bytesEmpty < byteSize) {
+ Pa_Sleep(10);
+ bytesEmpty = PaUtil_GetRingBufferWriteAvailable(&aStream->outFIFO);
+ }
+ }
+
+ err = Pa_StopStream(aStream->stream);
+ if (err != paNoError)
+ goto error;
+ err = Pa_CloseStream(aStream->stream);
+ if (err != paNoError)
+ goto error;
+ Pa_Terminate();
+
+ error:
+ PABLIO_TermFIFO(&aStream->inFIFO);
+ PABLIO_TermFIFO(&aStream->outFIFO);
+ free(aStream);
+ return err;
}
Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.h
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.h (original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_portaudio/pablio.h Fri Aug 24 13:50:56 2007
@@ -2,9 +2,8 @@
#define _PABLIO_H
#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+extern "C" {
+#endif /* __cplusplus */
/*
* $Id: pablio.h 1083 2006-08-23 07:30:49Z rossb $
@@ -57,15 +56,12 @@
#include <string.h>
-typedef struct
-{
- PaUtilRingBuffer inFIFO;
- PaUtilRingBuffer outFIFO;
- PaStream *stream;
- int bytesPerFrame;
- int samplesPerFrame;
-}
-PABLIO_Stream;
+ typedef struct {
+ PaUtilRingBuffer inFIFO;
+ PaUtilRingBuffer outFIFO;
+ PaStream *stream;
+ int bytesPerFrame;
+ } PABLIO_Stream;
/* Values for flags for OpenAudioStream(). */
#define PABLIO_READ (1<<0)
@@ -78,25 +74,25 @@
* Write data to ring buffer.
* Will not return until all the data has been written.
*/
-long WriteAudioStream( PABLIO_Stream *aStream, void *data, long numFrames );
+ long WriteAudioStream(PABLIO_Stream * aStream, void *data, long numFrames, switch_timer_t *timer);
/************************************************************
* Read data from ring buffer.
* Will not return until all the data has been read.
*/
-long ReadAudioStream( PABLIO_Stream *aStream, void *data, long numFrames );
+ long ReadAudioStream(PABLIO_Stream * aStream, void *data, long numFrames, switch_timer_t *timer);
/************************************************************
* Return the number of frames that could be written to the stream without
* having to wait.
*/
-long GetAudioStreamWriteable( PABLIO_Stream *aStream );
+ long GetAudioStreamWriteable(PABLIO_Stream * aStream);
/************************************************************
* Return the number of frames that are available to be read from the
* stream without having to wait.
*/
-long GetAudioStreamReadable( PABLIO_Stream *aStream );
+ long GetAudioStreamReadable(PABLIO_Stream * aStream);
/************************************************************
* Opens a PortAudio stream with default characteristics.
@@ -106,15 +102,13 @@
* PABLIO_READ, PABLIO_WRITE, or PABLIO_READ_WRITE,
* and either PABLIO_MONO or PABLIO_STEREO
*/
-PaError OpenAudioStream( PABLIO_Stream **rwblPtr,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate,
- PaStreamCallbackFlags statusFlags);
+ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
+ const PaStreamParameters * inputParameters,
+ const PaStreamParameters * outputParameters, double sampleRate, PaStreamCallbackFlags statusFlags, long samples_per_frame);
-PaError CloseAudioStream( PABLIO_Stream *aStream );
+ PaError CloseAudioStream(PABLIO_Stream * aStream);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
-#endif /* _PABLIO_H */
+#endif /* __cplusplus */
+#endif /* _PABLIO_H */
1
0
[commit] r5651 - in freeswitch/branches/greenlizard/src: . include mod/applications/mod_conference mod/asr_tts/mod_openmrcp mod/endpoints/mod_sofia
by Freeswitch SVN 21 Aug '07
by Freeswitch SVN 21 Aug '07
21 Aug '07
Author: greenlizard
Date: Tue Aug 21 13:44:11 2007
New Revision: 5651
Modified:
freeswitch/branches/greenlizard/src/include/switch_caller.h
freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/branches/greenlizard/src/switch_caller.c
Log:
merge trunk 5640:5650
Modified: freeswitch/branches/greenlizard/src/include/switch_caller.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_caller.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_caller.h Tue Aug 21 13:44:11 2007
@@ -67,16 +67,24 @@
char *caller_id_name;
/*! Caller ID Number */
char *caller_id_number;
+ uint8_t caller_ton;
+ uint8_t caller_numplan;
/*! Caller Network Address (when applicable) */
char *network_addr;
/*! ANI (when applicable) */
char *ani;
+ uint8_t ani_ton;
+ uint8_t ani_numplan;
/*! ANI II (when applicable) */
char *aniii;
/*! RDNIS */
char *rdnis;
+ uint8_t rdnis_ton;
+ uint8_t rdnis_numplan;
/*! Destination Number */
char *destination_number;
+ uint8_t destination_number_ton;
+ uint8_t destination_number_numplan;
/*! channel type */
char *source;
/*! channel name */
Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c Tue Aug 21 13:44:11 2007
@@ -1720,7 +1720,7 @@
switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
}
mux_used = 0;
- } else if (mux_used > bytes * 2) {
+ } else if (mux_used > bytes * 4) {
/* getting behind, clear the buffer */
switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
}
Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c (original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c Tue Aug 21 13:44:11 2007
@@ -1,926 +1,966 @@
-/*
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct(a)yahoo.com>
- *
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- *
- * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct(a)yahoo.com>
- * Portions created by the Initial Developer are Copyright (C)
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Traun Leyden <tleyden(a)branchcut.com>
- * Arsen Chaloyan <achaloyan(a)yahoo.com>
- *
- * Module which acts as an MRCP client to an MRCP speech recognition
- * server. In other words it bridges freeswitch to an external speech
- * recognition system. Documentation on how to install and configure
- * the module is here: http://wiki.freeswitch.org/wiki/Mod_openmrcp
- *
- * Uses OpenMrcp (http://wiki.freeswitch.org/wiki/OpenMRCP) as the
- * the client library.
- *
- * TODO
- * =======
- *
- * - There are two memory pools in use. One in asr_session which is managed
- * by this module, and one in the switch_asr_handle_t, which is managed by freeswitch.
- * These need to be consolidated into one. (basically throw away the one in asr_session)
- *
- * - fs status codes (eg, SWITCH_STATUS_GENERR) and mrcp status codes (MRCP_STATUS_FAILURE)
- * are intermixed badly. this needs cleanup
- *
- * - openmrcp_flush_tts, openmrcp_text_param_tts, openmrcp_numeric_param_tts,
- * openmrcp_float_param_tts need to have functionality added
- *
- * - use a regex for extracting xml from raw result received from mrcp recognition
- * server
- *
- */
-
-#ifdef __ICC
-#pragma warning (disable:188)
-#endif
-
-
-#include "openmrcp_client.h"
-#include "mrcp_client_context.h"
-#include "mrcp_recognizer.h"
-#include "mrcp_synthesizer.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_resource_set.h"
-
-#include <switch.h>
-
-#define OPENMRCP_WAIT_TIMEOUT 5000
-#define MY_BUF_LEN 1024 * 128
-#define MY_BLOCK_SIZE MY_BUF_LEN
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load);
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown);
-SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load,
- mod_openmrcp_shutdown, NULL);
-
-typedef struct {
- char *name;
- openmrcp_client_options_t *mrcp_options;
- mrcp_client_t *mrcp_client;
- mrcp_client_context_t *mrcp_context;
-} openmrcp_profile_t;
-
-typedef struct {
- openmrcp_profile_t *profile;
- mrcp_session_t *client_session;
- mrcp_client_channel_t *control_channel;
- mrcp_audio_channel_t *audio_channel;
- mrcp_message_t *mrcp_message_last_rcvd;
- apr_pool_t *pool;
- switch_speech_flag_t flags;
- switch_mutex_t *flag_mutex;
- switch_thread_cond_t *wait_object;
-} openmrcp_session_t;
-
-typedef enum {
- FLAG_HAS_TEXT = (1 << 0),
- FLAG_BARGE = (1 << 1),
- FLAG_READY = (1 << 2),
- FLAG_SPEAK_COMPLETE = (1 << 3),
- FLAG_FEED_STARTED = (1 << 4),
- FLAG_TERMINATING = (1 << 5)
-} mrcp_flag_t;
-
-typedef struct {
- switch_memory_pool_t *pool;
- switch_hash_t *profile_hash;
-
- openmrcp_profile_t *asr_profile;
- openmrcp_profile_t *tts_profile;
-} openmrcp_module_t;
-
-static openmrcp_module_t openmrcp_module;
-
-
-static openmrcp_session_t* openmrcp_session_create(openmrcp_profile_t *profile)
-{
- openmrcp_session_t *openmrcp_session;
- apr_pool_t *session_pool;
-
- if(!profile) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no profile specified\n");
- return NULL;
- }
-
- if(apr_pool_create(&session_pool,NULL) != APR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create session_pool\n");
- return NULL;
- }
-
- openmrcp_session = apr_palloc(session_pool,sizeof(openmrcp_session_t));
- openmrcp_session->pool = session_pool;
- openmrcp_session->profile = profile;
- openmrcp_session->client_session = NULL;
- openmrcp_session->control_channel = NULL;
- openmrcp_session->audio_channel = NULL;
- openmrcp_session->mrcp_message_last_rcvd = NULL;
-
- switch_mutex_init(&openmrcp_session->flag_mutex, SWITCH_MUTEX_NESTED, openmrcp_session->pool);
-
- if (switch_thread_cond_create(&openmrcp_session->wait_object, openmrcp_session->pool)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait object creation failed\n");
- }
-
- openmrcp_session->client_session = mrcp_client_context_session_create(openmrcp_session->profile->mrcp_context,openmrcp_session);
- if (!openmrcp_session->client_session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "session creation FAILED\n");
- apr_pool_destroy(session_pool);
- return NULL;
- }
-
- return openmrcp_session;
-}
-
-static void openmrcp_session_destroy(openmrcp_session_t *openmrcp_session)
-{
- if(openmrcp_session && openmrcp_session->pool) {
- mrcp_client_context_session_destroy(openmrcp_session->profile->mrcp_context,openmrcp_session->client_session);
- apr_pool_destroy(openmrcp_session->pool);
- }
-}
-
-static mrcp_status_t openmrcp_on_session_initiate(mrcp_client_context_t *context, mrcp_session_t *session)
-{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_session_initiate called\n");
- return MRCP_STATUS_SUCCESS;
-}
-
-static mrcp_status_t openmrcp_on_session_terminate(mrcp_client_context_t *context, mrcp_session_t *session)
-{
- openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_session_terminate called\n");
- if(!openmrcp_session) {
- return MRCP_STATUS_FAILURE;
- }
-
- if (switch_test_flag(openmrcp_session, FLAG_TERMINATING)) {
- openmrcp_session_destroy(openmrcp_session);
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "abnormal session terminate\n");
- }
- return MRCP_STATUS_SUCCESS;
-}
-
-static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel, mrcp_audio_channel_t *audio_channel)
-{
- openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_add called\n");
- if(!openmrcp_session) {
- return MRCP_STATUS_FAILURE;
- }
- switch_mutex_lock(openmrcp_session->flag_mutex);
- openmrcp_session->control_channel = control_channel;
- openmrcp_session->audio_channel = audio_channel;
- switch_thread_cond_signal(openmrcp_session->wait_object);
- switch_mutex_unlock(openmrcp_session->flag_mutex);
- return MRCP_STATUS_SUCCESS;
-}
-
-static mrcp_status_t openmrcp_on_channel_remove(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel)
-{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_remove called\n");
- return MRCP_STATUS_SUCCESS;
-}
-
-/** this is called by the mrcp core whenever an mrcp message is received from
- the other side. */
-static mrcp_status_t openmrcp_on_channel_modify(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_message_t *mrcp_message)
-{
- openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_channel_modify called\n");
- if (!openmrcp_session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "!openmrcp_session\n");
- return MRCP_STATUS_FAILURE;
- }
- if (!mrcp_message) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "!mrcp_message\n");
- return MRCP_STATUS_FAILURE;
- }
-
- if (mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_EVENT) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ignoring mrcp response\n");
- return MRCP_STATUS_SUCCESS;
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mrcp msg body: %s\n", mrcp_message->body);
-
- if (mrcp_message->channel_id.resource_id == MRCP_RESOURCE_RECOGNIZER) {
- if (mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
- openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_HAS_TEXT\n");
- switch_set_flag_locked(openmrcp_session, FLAG_HAS_TEXT);
- }
- else if (mrcp_message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
- openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_BARGE\n");
- switch_set_flag_locked(openmrcp_session, FLAG_BARGE);
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ignoring event: %s\n", mrcp_message->start_line.method_name);
- }
- }
- else if(mrcp_message->channel_id.resource_id == MRCP_RESOURCE_SYNTHESIZER) {
- if (mrcp_message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setting FLAG_SPEAK_COMPLETE\n");
- switch_set_flag_locked(openmrcp_session, FLAG_SPEAK_COMPLETE);
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ignoring event: %s\n", mrcp_message->start_line.method_name);
- }
- }
-
- return MRCP_STATUS_SUCCESS;
-}
-
-/** Read in the grammar and construct an MRCP Recognize message that has
- The grammar attached as the payload */
-static mrcp_status_t openmrcp_recog_start(mrcp_client_context_t *context, openmrcp_session_t *asr_session, char *path)
-{
- mrcp_generic_header_t *generic_header;
- apr_status_t rv;
- apr_file_t *fp;
- apr_pool_t *mp;
- apr_finfo_t finfo;
- char *buf1;
- apr_size_t bytes2read = 0;
-
- mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
-
- if(!mrcp_message) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create mrcp msg\n");
- return MRCP_STATUS_FAILURE;
- }
-
- /* open the file with the grammar and read into char* buffer */
- mp = mrcp_message->pool;
- if ((rv = apr_file_open(&fp, path, APR_READ, APR_OS_DEFAULT, mp)) != APR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not read grammar\n");
- return -1;
- }
- rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fp);
-
- buf1 = apr_palloc(mp, (apr_size_t)finfo.size);
- bytes2read = (apr_size_t)finfo.size;
- rv = apr_file_read(fp, buf1, &bytes2read);
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(!generic_header) {
- return MRCP_STATUS_FAILURE;
- }
-
- generic_header->content_type = mrcp_str_pdup(mrcp_message->pool,"application/srgs+xml");
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- mrcp_message->body = mrcp_str_pdup(mrcp_message->pool,buf1);
-
- /* send the MRCP RECOGNIZE message to MRCP server */
- return mrcp_client_context_channel_modify(context, asr_session->client_session, mrcp_message);
-}
-
-
-/**
- * Freeswitch calls this from switch_ivr_detect_speech() and then adds a media
- * bug to tap into the channel's audio, which will result in all data getting
- * passed to asr_feed() and calls to asr_check_results() on each recevied frame.
- *
- * This code expects certain one-time initialization of the openmrcp client
- * engine/systeme to have already taken place.function to open the asr interface
- */
-static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags)
-{
- openmrcp_session_t *asr_session;
- mrcp_client_channel_t *asr_channel;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "asr_open called, codec: %s, rate: %d\n", codec, rate);
-
- if (strcmp(codec,"L16")) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only L16 codec supported\n");
- return SWITCH_STATUS_GENERR;
- }
- if (rate != 8000) {
- // TODO: look into supporting other sample rates
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only 8kz supported\n");
- return SWITCH_STATUS_GENERR;
- }
- /* create session */
- asr_session = openmrcp_session_create(openmrcp_module.asr_profile);
- if (!asr_session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_session creation FAILED\n");
- return SWITCH_STATUS_GENERR;
- }
-
- /* create recognizer channel, also starts outgoing rtp media */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create Recognizer Channel\n");
- asr_channel = mrcp_client_recognizer_channel_create(asr_session->profile->mrcp_context, asr_session->client_session, NULL);
- if (!asr_channel) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create recognizer channel\n");
- return SWITCH_STATUS_FALSE;
- }
-
- switch_mutex_lock(asr_session->flag_mutex);
- mrcp_client_context_channel_add(asr_session->profile->mrcp_context, asr_session->client_session, asr_channel, NULL);
- if(switch_thread_cond_timedwait(asr_session->wait_object,asr_session->flag_mutex,5000*1000) != APR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
- }
- switch_mutex_unlock(asr_session->flag_mutex);
- if(!asr_session->control_channel) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No recognizer channel available\n");
- return SWITCH_STATUS_FALSE;
- }
-
- asr_session->flags = *flags;
- ah->private_info = asr_session;
- return SWITCH_STATUS_SUCCESS;
-}
-
-/* function to load a grammar to the asr interface */
-static switch_status_t openmrcp_asr_load_grammar(switch_asr_handle_t *ah, char *grammar, char *path)
-{
- /** Read grammar from path and create and send and MRCP RECOGNIZE msg
- that has the grammar attached to body.
-
- TODO: - how does DEFINE-GRAMMAR fit into the picture here? (if at all)
- */
-
- openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
- mrcp_client_context_t *context = asr_session->profile->mrcp_context;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loading grammar\n");
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Start Recognizer\n");
- openmrcp_recog_start(context, asr_session, path);
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Finished loading grammar\n");
- return SWITCH_STATUS_SUCCESS;
-}
-
-/*! function to feed audio to the ASR*/
-static switch_status_t openmrcp_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
-{
- openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
- media_frame_t media_frame;
- audio_sink_t *audio_sink = mrcp_client_audio_sink_get(asr_session->audio_channel);
-
- media_frame.type = MEDIA_FRAME_TYPE_AUDIO;
- /* sampling rate and frame size should be retrieved from audio sink */
- media_frame.codec_frame.size = 160;
- media_frame.codec_frame.buffer = data;
- while(len >= media_frame.codec_frame.size) {
- if (!audio_sink) {
- return SWITCH_STATUS_GENERR;
- }
- audio_sink->method_set->write_frame(audio_sink,&media_frame);
-
- len -= (unsigned int)media_frame.codec_frame.size;
- media_frame.codec_frame.buffer = (char*)media_frame.codec_frame.buffer + media_frame.codec_frame.size;
- }
- if(len > 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "None frame alligned data len [%d]\n",len);
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-
-static switch_status_t openmrcp_asr_pause(switch_asr_handle_t *ah)
-{
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_pause called\n");
-
- return SWITCH_STATUS_SUCCESS;
-
-}
-
-static switch_status_t openmrcp_asr_resume(switch_asr_handle_t *ah)
-{
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "openmrcp_asr_resume called\n");
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-
-/*! function to unload a grammar to the asr interface */
-static switch_status_t openmrcp_asr_unload_grammar(switch_asr_handle_t *ah, char *grammar)
-{
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Freeswitch calls this whenever the channel is hungup or the
- * speech detection is stopped via a call to switch_ivr_stop_detect_speech()
- */
-static switch_status_t openmrcp_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
-{
- openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
- mrcp_client_context_t *context = asr_session->profile->mrcp_context;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_close()\n");
-
- // TODO!! should we do a switch_pool_clear(switch_memory_pool_t *p) on the pool held
- // by asr_session?
-
- // terminate client session
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to TERMINATE SESSION\n");
- switch_set_flag_locked(asr_session, FLAG_TERMINATING);
- mrcp_client_context_session_terminate(context, asr_session->client_session);
-
- switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-
-/**
- * Freeswitch calls this method from the speech_thread() thread body method
- * in switch_ivr_async.c every time a new frame is received by the media bug
- * attached to the audio channel. If this method returns SWITCH_STATUS_SUCCESS,
- * then Freeswitch will call openmrcp_asr_get_results() to get the result value.
- */
-static switch_status_t openmrcp_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
-{
- openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
-
- switch_status_t rv = (switch_test_flag(asr_session, FLAG_HAS_TEXT) || switch_test_flag(asr_session, FLAG_BARGE)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
-
- return rv;
-}
-
-/*! This will be called after asr_check_results returns SUCCESS */
-static switch_status_t openmrcp_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
-{
- openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
- switch_status_t ret = SWITCH_STATUS_SUCCESS;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_get_results called\n");
-
- if (switch_test_flag(asr_session, FLAG_BARGE)) {
- switch_clear_flag_locked(asr_session, FLAG_BARGE);
- ret = SWITCH_STATUS_BREAK;
- }
-
- if (switch_test_flag(asr_session, FLAG_HAS_TEXT)) {
- /*!
- we have to extract the XML but stripping off the <?xml version="1.0"?>
- header. the body looks like:
-
- Completion-Cause:001 no-match
- Content-Type: application/nlsml+xml
- Content-Length: 260
-
- <?xml version="1.0"?>
- <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1@form-level.store">
- <interpretation> <input mode="speech">open a</input>
- </interpretation>
- </result>
- */
-
- if(asr_session->mrcp_message_last_rcvd && asr_session->mrcp_message_last_rcvd->body) {
- char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
- char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
- if (!position) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
- ret = SWITCH_STATUS_FALSE;
- }
- else {
- position += strlen(marker);
- *xmlstr = strdup(position);
- }
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server");
- ret = SWITCH_STATUS_FALSE;
- }
-
- // since we are returning our result here, future calls to check_results
- // should return False
- switch_clear_flag_locked(asr_session, FLAG_HAS_TEXT);
- ret = SWITCH_STATUS_SUCCESS;
- }
- return ret;
-}
-
-
-static mrcp_status_t synth_speak(mrcp_client_context_t *context, openmrcp_session_t *tts_session, char *text)
-{
- mrcp_generic_header_t *generic_header;
- mrcp_message_t *mrcp_message;
-
- char *text2speak;
- const char xml_head[] =
- "<?xml version=\"1.0\"?>\r\n"
- "<speak>\r\n"
- "<paragraph>\r\n"
- " <sentence>";
-
- const char xml_tail[] = "</sentence>\r\n"
- "</paragraph>\r\n"
- "</speak>\r\n";
-
- size_t len = sizeof(xml_head) + sizeof(text) + sizeof(xml_tail);
- text2speak = (char *) switch_core_alloc(tts_session->pool, len);
- strcat(text2speak, xml_head);
- strcat(text2speak, text);
- strcat(text2speak, xml_tail);
-
- mrcp_message = mrcp_client_context_message_get(context,tts_session->client_session,tts_session->control_channel,SYNTHESIZER_SPEAK);
- if(!mrcp_message) {
- return MRCP_STATUS_FAILURE;
- }
-
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(!generic_header) {
- return MRCP_STATUS_FAILURE;
- }
-
- generic_header->content_type = mrcp_str_pdup(mrcp_message->pool,"application/synthesis+ssml");
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- mrcp_message->body = mrcp_str_pdup(mrcp_message->pool,text2speak);
-
- return mrcp_client_context_channel_modify(context,tts_session->client_session,mrcp_message);
-}
-
-static mrcp_status_t synth_stop(mrcp_client_context_t *context, openmrcp_session_t *tts_session)
-{
- mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context,tts_session->client_session,tts_session->control_channel,SYNTHESIZER_STOP);
- if(!mrcp_message) {
- return MRCP_STATUS_FAILURE;
- }
-
- return mrcp_client_context_channel_modify(context,tts_session->client_session,mrcp_message);
-}
-
-
-static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags)
-{
- openmrcp_session_t *tts_session;
- mrcp_client_channel_t *tts_channel;
-
- /* create session */
- tts_session = openmrcp_session_create(openmrcp_module.tts_profile);
- if (!tts_session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "tts_session creation FAILED\n");
- return SWITCH_STATUS_GENERR;
- }
-
- /* create synthesizer channel */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Create Synthesizer Channel\n");
- tts_channel = mrcp_client_synthesizer_channel_create(tts_session->profile->mrcp_context, tts_session->client_session, NULL);
- if (!tts_channel) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create synthesizer channel\n");
- return SWITCH_STATUS_FALSE;
- }
- switch_mutex_lock(tts_session->flag_mutex);
- mrcp_client_context_channel_add(tts_session->profile->mrcp_context, tts_session->client_session, tts_channel, NULL);
- if(switch_thread_cond_timedwait(tts_session->wait_object,tts_session->flag_mutex,5000*1000) != APR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
- }
- switch_mutex_unlock(tts_session->flag_mutex);
- if(!tts_session->control_channel) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No synthesizer channel available\n");
- return SWITCH_STATUS_FALSE;
- }
-
- tts_session->flags = *flags;
- sh->private_info = tts_session;
- return SWITCH_STATUS_SUCCESS;
-}
-
-static switch_status_t openmrcp_tts_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
-{
- openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
- mrcp_client_context_t *context = tts_session->profile->mrcp_context;
-
- /* terminate tts session */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "terminate tts_session\n");
- switch_set_flag_locked(tts_session, FLAG_TERMINATING);
- mrcp_client_context_session_terminate(context,tts_session->client_session);
- return SWITCH_STATUS_SUCCESS;
-}
-
-static switch_status_t openmrcp_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
-{
- openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
- mrcp_client_context_t *context = tts_session->profile->mrcp_context;
-
- if(!tts_session->control_channel) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no synthesizer channel too feed tts\n");
- return SWITCH_STATUS_FALSE;
- }
-
- synth_speak(context, tts_session, text);
-
- switch_clear_flag(tts_session,FLAG_FEED_STARTED);
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Freeswitch calls this when its ready to read datalen bytes of data.
- *
- * TODO: check the blocking flag passed in flags and act accordingly
- * (see mod_cepstral.c)
- */
-static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
-{
- openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
- size_t return_len=0;
- media_frame_t media_frame;
- audio_source_t *audio_source;
-
- if (switch_test_flag(tts_session, FLAG_SPEAK_COMPLETE)) {
- /* tell fs we are done */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FLAG_SPEAK_COMPLETE\n");
- return SWITCH_STATUS_BREAK;
- }
-
- audio_source = mrcp_client_audio_source_get(tts_session->audio_channel);
- if(!audio_source) {
- return SWITCH_STATUS_BREAK;
- }
-
- if (!switch_test_flag(tts_session, FLAG_FEED_STARTED)) {
- switch_set_flag(tts_session, FLAG_FEED_STARTED);
- if(audio_source->method_set->open) {
- audio_source->method_set->open(audio_source);
- }
- }
-
- /* sampling rate and frame size should be retrieved from audio source */
- *rate = 8000;
- media_frame.codec_frame.size = 160;
- while(return_len < *datalen) {
- media_frame.codec_frame.buffer = (char*)data + return_len;
- audio_source->method_set->read_frame(audio_source,&media_frame);
- if(media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
- memset(media_frame.codec_frame.buffer,0,media_frame.codec_frame.size);
- }
- return_len += media_frame.codec_frame.size;
- }
- *datalen = return_len;
- return SWITCH_STATUS_SUCCESS;
-}
-
-
-static void openmrcp_flush_tts(switch_speech_handle_t *sh)
-{
- openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
- mrcp_client_context_t *context = tts_session->profile->mrcp_context;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "flush_tts called\n");
- synth_stop(context,tts_session); // TODO
-}
-
-static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, char *val)
-{
-
-}
-
-static void openmrcp_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
-{
-
-}
-
-static void openmrcp_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
-{
-
-}
-
-
-static switch_status_t do_config()
-{
- char *cf = "mod_openmrcp.conf";
- const char *asr_profile_name = NULL;
- const char *tts_profile_name = NULL;
- switch_xml_t cfg, xml, settings, profiles, xprofile, param;
- openmrcp_profile_t *mrcp_profile;
- openmrcp_client_options_t *mrcp_options;
-
- if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
- return SWITCH_STATUS_TERM;
- }
-
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct(a)yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct(a)yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Traun Leyden <tleyden(a)branchcut.com>
+ * Arsen Chaloyan <achaloyan(a)yahoo.com>
+ *
+ * Module which acts as an MRCP client to an MRCP speech recognition
+ * server. In other words it bridges freeswitch to an external speech
+ * recognition system. Documentation on how to install and configure
+ * the module is here: http://wiki.freeswitch.org/wiki/Mod_openmrcp
+ *
+ * Uses OpenMrcp (http://wiki.freeswitch.org/wiki/OpenMRCP) as the
+ * the client library.
+ *
+ * TODO
+ * =======
+ *
+ * - There are two memory pools in use. One in asr_session which is managed
+ * by this module, and one in the switch_asr_handle_t, which is managed by freeswitch.
+ * These need to be consolidated into one. (basically throw away the one in asr_session)
+ *
+ * - fs status codes (eg, SWITCH_STATUS_GENERR) and mrcp status codes (MRCP_STATUS_FAILURE)
+ * are intermixed badly. this needs cleanup
+ *
+ * - openmrcp_flush_tts, openmrcp_text_param_tts, openmrcp_numeric_param_tts,
+ * openmrcp_float_param_tts need to have functionality added
+ *
+ * - use a regex for extracting xml from raw result received from mrcp recognition
+ * server
+ *
+ */
+
+#ifdef __ICC
+#pragma warning (disable:188)
+#endif
+
+
+#include "openmrcp_client.h"
+#include "mrcp_client_context.h"
+#include "mrcp_recognizer.h"
+#include "mrcp_synthesizer.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_resource_set.h"
+
+#include <switch.h>
+
+#define OPENMRCP_WAIT_TIMEOUT 5000
+#define MY_BUF_LEN 1024 * 128
+#define MY_BLOCK_SIZE MY_BUF_LEN
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown);
+SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load,
+ mod_openmrcp_shutdown, NULL);
+
+typedef struct {
+ char *name;
+ openmrcp_client_options_t *mrcp_options;
+ mrcp_client_t *mrcp_client;
+ mrcp_client_context_t *mrcp_context;
+} openmrcp_profile_t;
+
+typedef struct {
+ openmrcp_profile_t *profile;
+ mrcp_session_t *client_session;
+ mrcp_client_channel_t *control_channel;
+ mrcp_audio_channel_t *audio_channel;
+ mrcp_message_t *mrcp_message_last_rcvd;
+ apr_pool_t *pool;
+ switch_speech_flag_t flags;
+ switch_mutex_t *flag_mutex;
+ switch_thread_cond_t *wait_object;
+} openmrcp_session_t;
+
+typedef enum {
+ FLAG_HAS_TEXT = (1 << 0),
+ FLAG_BARGE = (1 << 1),
+ FLAG_READY = (1 << 2),
+ FLAG_SPEAK_COMPLETE = (1 << 3),
+ FLAG_FEED_STARTED = (1 << 4),
+ FLAG_TERMINATING = (1 << 5)
+} mrcp_flag_t;
+
+typedef struct {
+ switch_memory_pool_t *pool;
+ switch_hash_t *profile_hash;
+
+ openmrcp_profile_t *asr_profile;
+ openmrcp_profile_t *tts_profile;
+} openmrcp_module_t;
+
+static openmrcp_module_t openmrcp_module;
+
+
+static openmrcp_session_t* openmrcp_session_create(openmrcp_profile_t *profile)
+{
+ openmrcp_session_t *openmrcp_session;
+ apr_pool_t *session_pool;
+
+ if(!profile) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no profile specified\n");
+ return NULL;
+ }
+
+ if(apr_pool_create(&session_pool,NULL) != APR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create session_pool\n");
+ return NULL;
+ }
+
+ openmrcp_session = apr_palloc(session_pool,sizeof(openmrcp_session_t));
+ openmrcp_session->pool = session_pool;
+ openmrcp_session->profile = profile;
+ openmrcp_session->client_session = NULL;
+ openmrcp_session->control_channel = NULL;
+ openmrcp_session->audio_channel = NULL;
+ openmrcp_session->mrcp_message_last_rcvd = NULL;
+
+ switch_mutex_init(&openmrcp_session->flag_mutex, SWITCH_MUTEX_NESTED, openmrcp_session->pool);
+
+ if (switch_thread_cond_create(&openmrcp_session->wait_object, openmrcp_session->pool)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait object creation failed\n");
+ }
+
+ openmrcp_session->client_session = mrcp_client_context_session_create(openmrcp_session->profile->mrcp_context,openmrcp_session);
+ if (!openmrcp_session->client_session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "session creation FAILED\n");
+ apr_pool_destroy(session_pool);
+ return NULL;
+ }
+
+ return openmrcp_session;
+}
+
+static void openmrcp_session_destroy(openmrcp_session_t *openmrcp_session)
+{
+ if(openmrcp_session && openmrcp_session->pool) {
+ mrcp_client_context_session_destroy(openmrcp_session->profile->mrcp_context,openmrcp_session->client_session);
+ apr_pool_destroy(openmrcp_session->pool);
+ }
+}
+
+static mrcp_status_t openmrcp_on_session_initiate(mrcp_client_context_t *context, mrcp_session_t *session)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_session_initiate called\n");
+ return MRCP_STATUS_SUCCESS;
+}
+
+static mrcp_status_t openmrcp_on_session_terminate(mrcp_client_context_t *context, mrcp_session_t *session)
+{
+ openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_session_terminate called\n");
+ if(!openmrcp_session) {
+ return MRCP_STATUS_FAILURE;
+ }
+
+ if (switch_test_flag(openmrcp_session, FLAG_TERMINATING)) {
+ openmrcp_session_destroy(openmrcp_session);
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "abnormal session terminate\n");
+ }
+ return MRCP_STATUS_SUCCESS;
+}
+
+static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel, mrcp_audio_channel_t *audio_channel)
+{
+ openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_add called\n");
+ if(!openmrcp_session) {
+ return MRCP_STATUS_FAILURE;
+ }
+ switch_mutex_lock(openmrcp_session->flag_mutex);
+ openmrcp_session->control_channel = control_channel;
+ openmrcp_session->audio_channel = audio_channel;
+ switch_thread_cond_signal(openmrcp_session->wait_object);
+ switch_mutex_unlock(openmrcp_session->flag_mutex);
+ return MRCP_STATUS_SUCCESS;
+}
+
+static mrcp_status_t openmrcp_on_channel_remove(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_remove called\n");
+ return MRCP_STATUS_SUCCESS;
+}
+
+/** this is called by the mrcp core whenever an mrcp message is received from
+ the other side. */
+static mrcp_status_t openmrcp_on_channel_modify(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_message_t *mrcp_message)
+{
+ openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_channel_modify called\n");
+ if (!openmrcp_session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "!openmrcp_session\n");
+ return MRCP_STATUS_FAILURE;
+ }
+ if (!mrcp_message) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "!mrcp_message\n");
+ return MRCP_STATUS_FAILURE;
+ }
+
+ if (mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_EVENT) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ignoring mrcp response\n");
+ return MRCP_STATUS_SUCCESS;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mrcp msg body: %s\n", mrcp_message->body);
+
+ if (mrcp_message->channel_id.resource_id == MRCP_RESOURCE_RECOGNIZER) {
+ if (mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
+ openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_HAS_TEXT\n");
+ switch_set_flag_locked(openmrcp_session, FLAG_HAS_TEXT);
+ }
+ else if (mrcp_message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
+ openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting FLAG_BARGE\n");
+ switch_set_flag_locked(openmrcp_session, FLAG_BARGE);
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ignoring event: %s\n", mrcp_message->start_line.method_name);
+ }
+ }
+ else if(mrcp_message->channel_id.resource_id == MRCP_RESOURCE_SYNTHESIZER) {
+ if (mrcp_message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setting FLAG_SPEAK_COMPLETE\n");
+ switch_set_flag_locked(openmrcp_session, FLAG_SPEAK_COMPLETE);
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ignoring event: %s\n", mrcp_message->start_line.method_name);
+ }
+ }
+
+ return MRCP_STATUS_SUCCESS;
+}
+
+/** Read in the grammar and construct an MRCP Recognize message that has
+ The grammar attached as the payload */
+static mrcp_status_t openmrcp_recog_start(mrcp_client_context_t *context, openmrcp_session_t *asr_session, char *path)
+{
+ mrcp_generic_header_t *generic_header;
+ apr_status_t rv;
+ apr_file_t *fp;
+ apr_pool_t *mp;
+ apr_finfo_t finfo;
+ char *buf1;
+ apr_size_t bytes2read = 0;
+
+ mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
+
+ if(!mrcp_message) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create mrcp msg\n");
+ return MRCP_STATUS_FAILURE;
+ }
+
+ /* open the file with the grammar and read into char* buffer */
+ mp = mrcp_message->pool;
+ if ((rv = apr_file_open(&fp, path, APR_READ, APR_OS_DEFAULT, mp)) != APR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not read grammar\n");
+ return -1;
+ }
+ rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fp);
+
+ buf1 = apr_palloc(mp, (apr_size_t)finfo.size + 1);
+ bytes2read = (apr_size_t)finfo.size;
+ rv = apr_file_read(fp, buf1, &bytes2read);
+ buf1[bytes2read] = '\0';
+
+ generic_header = mrcp_generic_header_prepare(mrcp_message);
+ if(!generic_header) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not prepare generic_header\n");
+ return MRCP_STATUS_FAILURE;
+ }
+
+ generic_header->content_type = "application/srgs+xml";
+ mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
+ mrcp_message->body = buf1;
+
+ /* send the MRCP RECOGNIZE message to MRCP server */
+ return mrcp_client_context_channel_modify(context, asr_session->client_session, mrcp_message);
+}
+
+
+/**
+ * Freeswitch calls this from switch_ivr_detect_speech() and then adds a media
+ * bug to tap into the channel's audio, which will result in all data getting
+ * passed to asr_feed() and calls to asr_check_results() on each recevied frame.
+ *
+ * This code expects certain one-time initialization of the openmrcp client
+ * engine/systeme to have already taken place.function to open the asr interface
+ */
+static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags)
+{
+ openmrcp_session_t *asr_session;
+ mrcp_client_channel_t *asr_channel;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "asr_open called, codec: %s, rate: %d\n", codec, rate);
+
+ if (strcmp(codec,"L16")) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only L16 codec supported\n");
+ return SWITCH_STATUS_GENERR;
+ }
+ if (rate != 8000) {
+ // TODO: look into supporting other sample rates
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only 8kz supported\n");
+ return SWITCH_STATUS_GENERR;
+ }
+ /* create session */
+ asr_session = openmrcp_session_create(openmrcp_module.asr_profile);
+ if (!asr_session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_session creation FAILED\n");
+ return SWITCH_STATUS_GENERR;
+ }
+
+ /* create recognizer channel, also starts outgoing rtp media */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create Recognizer Channel\n");
+ asr_channel = mrcp_client_recognizer_channel_create(asr_session->profile->mrcp_context, asr_session->client_session, NULL);
+ if (!asr_channel) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create recognizer channel\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch_mutex_lock(asr_session->flag_mutex);
+ mrcp_client_context_channel_add(asr_session->profile->mrcp_context, asr_session->client_session, asr_channel, NULL);
+ if(switch_thread_cond_timedwait(asr_session->wait_object,asr_session->flag_mutex,5000*1000) != APR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
+ }
+ switch_mutex_unlock(asr_session->flag_mutex);
+ if(!asr_session->control_channel) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No recognizer channel available\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ asr_session->flags = *flags;
+ ah->private_info = asr_session;
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* function to load a grammar to the asr interface */
+static switch_status_t openmrcp_asr_load_grammar(switch_asr_handle_t *ah, char *grammar, char *path)
+{
+ /** Read grammar from path and create and send and MRCP RECOGNIZE msg
+ that has the grammar attached to body.
+
+ TODO: - how does DEFINE-GRAMMAR fit into the picture here? (if at all)
+ */
+
+ openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
+ mrcp_client_context_t *context = asr_session->profile->mrcp_context;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loading grammar\n");
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Start Recognizer\n");
+ openmrcp_recog_start(context, asr_session, path);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Finished loading grammar\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/*! function to feed audio to the ASR*/
+static switch_status_t openmrcp_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
+{
+ openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
+ media_frame_t media_frame;
+ audio_sink_t *audio_sink = mrcp_client_audio_sink_get(asr_session->audio_channel);
+
+ media_frame.type = MEDIA_FRAME_TYPE_AUDIO;
+ /* sampling rate and frame size should be retrieved from audio sink */
+ media_frame.codec_frame.size = 160;
+ media_frame.codec_frame.buffer = data;
+ while(len >= media_frame.codec_frame.size) {
+ if (!audio_sink) {
+ /*!
+ If there is no audio_sink established yet, discard the audio and
+ return SUCCESS. returning anything other than success causes freeswitch
+ to abort the call and tear down the channel. One reason there might
+ not be an audio sink is that the openmrcp client lib is still in the startup
+ process.
+ */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!audio_sink\n");
+ return SWITCH_STATUS_SUCCESS;
+ }
+ audio_sink->method_set->write_frame(audio_sink,&media_frame);
+
+ len -= (unsigned int)media_frame.codec_frame.size;
+ media_frame.codec_frame.buffer = (char*)media_frame.codec_frame.buffer + media_frame.codec_frame.size;
+ }
+ if(len > 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "None frame alligned data len [%d]\n",len);
+ }
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t openmrcp_asr_pause(switch_asr_handle_t *ah)
+{
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_pause called\n");
+
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t openmrcp_asr_resume(switch_asr_handle_t *ah)
+{
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "openmrcp_asr_resume called\n");
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+/*! function to unload a grammar to the asr interface */
+static switch_status_t openmrcp_asr_unload_grammar(switch_asr_handle_t *ah, char *grammar)
+{
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Freeswitch calls this whenever the channel is hungup or the
+ * speech detection is stopped via a call to switch_ivr_stop_detect_speech()
+ */
+static switch_status_t openmrcp_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
+{
+ openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
+ mrcp_client_context_t *context = asr_session->profile->mrcp_context;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_close()\n");
+
+ // TODO!! should we do a switch_pool_clear(switch_memory_pool_t *p) on the pool held
+ // by asr_session?
+
+ // terminate client session
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to TERMINATE SESSION\n");
+ switch_set_flag_locked(asr_session, FLAG_TERMINATING);
+ mrcp_client_context_session_terminate(context, asr_session->client_session);
+
+ switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+/**
+ * Freeswitch calls this method from the speech_thread() thread body method
+ * in switch_ivr_async.c every time a new frame is received by the media bug
+ * attached to the audio channel. If this method returns SWITCH_STATUS_SUCCESS,
+ * then Freeswitch will call openmrcp_asr_get_results() to get the result value.
+ */
+static switch_status_t openmrcp_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
+{
+ openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
+
+ switch_status_t rv = (switch_test_flag(asr_session, FLAG_HAS_TEXT) || switch_test_flag(asr_session, FLAG_BARGE)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+
+ return rv;
+}
+
+/*! This will be called after asr_check_results returns SUCCESS */
+static switch_status_t openmrcp_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
+{
+ openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
+ switch_status_t ret = SWITCH_STATUS_SUCCESS;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_get_results called\n");
+
+ if (switch_test_flag(asr_session, FLAG_BARGE)) {
+ switch_clear_flag_locked(asr_session, FLAG_BARGE);
+ ret = SWITCH_STATUS_BREAK;
+ }
+
+ if (switch_test_flag(asr_session, FLAG_HAS_TEXT)) {
+ /*!
+ we have to extract the XML but stripping off the <?xml version="1.0"?>
+ header. the body looks like:
+
+ Completion-Cause:001 no-match
+ Content-Type: application/nlsml+xml
+ Content-Length: 260
+
+ <?xml version="1.0"?>
+ <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1@form-level.store">
+ <interpretation> <input mode="speech">open a</input>
+ </interpretation>
+ </result>
+ */
+
+ if(asr_session->mrcp_message_last_rcvd && asr_session->mrcp_message_last_rcvd->body) {
+ char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
+ char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
+ if (!position) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
+ ret = SWITCH_STATUS_FALSE;
+ }
+ else {
+ position += strlen(marker);
+ *xmlstr = strdup(position);
+ }
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server\n");
+ ret = SWITCH_STATUS_FALSE;
+ }
+
+ // since we are returning our result here, future calls to check_results
+ // should return False
+ switch_clear_flag_locked(asr_session, FLAG_HAS_TEXT);
+ ret = SWITCH_STATUS_SUCCESS;
+ }
+ return ret;
+}
+
+
+static mrcp_status_t synth_speak(mrcp_client_context_t *context, openmrcp_session_t *tts_session, char *text)
+{
+ mrcp_generic_header_t *generic_header;
+ mrcp_message_t *mrcp_message;
+
+ char *text2speak;
+ const char xml_head[] =
+ "<?xml version=\"1.0\"?>\r\n"
+ "<speak>\r\n"
+ "<paragraph>\r\n"
+ " <sentence>";
+
+ const char xml_tail[] = "</sentence>\r\n"
+ "</paragraph>\r\n"
+ "</speak>\r\n";
+
+ size_t len = sizeof(xml_head) + sizeof(text) + sizeof(xml_tail);
+ text2speak = (char *) switch_core_alloc(tts_session->pool, len);
+ strcat(text2speak, xml_head);
+ strcat(text2speak, text);
+ strcat(text2speak, xml_tail);
+
+ mrcp_message = mrcp_client_context_message_get(context,tts_session->client_session,tts_session->control_channel,SYNTHESIZER_SPEAK);
+ if(!mrcp_message) {
+ return MRCP_STATUS_FAILURE;
+ }
+
+ generic_header = mrcp_generic_header_prepare(mrcp_message);
+ if(!generic_header) {
+ return MRCP_STATUS_FAILURE;
+ }
+
+ generic_header->content_type = "application/synthesis+ssml";
+ mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
+ mrcp_message->body = text2speak;
+
+ return mrcp_client_context_channel_modify(context,tts_session->client_session,mrcp_message);
+}
+
+static mrcp_status_t synth_stop(mrcp_client_context_t *context, openmrcp_session_t *tts_session)
+{
+ mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context,tts_session->client_session,tts_session->control_channel,SYNTHESIZER_STOP);
+ if(!mrcp_message) {
+ return MRCP_STATUS_FAILURE;
+ }
+
+ return mrcp_client_context_channel_modify(context,tts_session->client_session,mrcp_message);
+}
+
+
+static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags)
+{
+ openmrcp_session_t *tts_session;
+ mrcp_client_channel_t *tts_channel;
+
+ /* create session */
+ tts_session = openmrcp_session_create(openmrcp_module.tts_profile);
+ if (!tts_session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "tts_session creation FAILED\n");
+ return SWITCH_STATUS_GENERR;
+ }
+
+ /* create synthesizer channel */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Create Synthesizer Channel\n");
+ tts_channel = mrcp_client_synthesizer_channel_create(tts_session->profile->mrcp_context, tts_session->client_session, NULL);
+ if (!tts_channel) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create synthesizer channel\n");
+ return SWITCH_STATUS_FALSE;
+ }
+ switch_mutex_lock(tts_session->flag_mutex);
+ mrcp_client_context_channel_add(tts_session->profile->mrcp_context, tts_session->client_session, tts_channel, NULL);
+ if(switch_thread_cond_timedwait(tts_session->wait_object,tts_session->flag_mutex,5000*1000) != APR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
+ }
+ switch_mutex_unlock(tts_session->flag_mutex);
+ if(!tts_session->control_channel) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No synthesizer channel available\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ tts_session->flags = *flags;
+ sh->private_info = tts_session;
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t openmrcp_tts_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
+{
+ openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
+ mrcp_client_context_t *context = tts_session->profile->mrcp_context;
+
+ /* terminate tts session */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "terminate tts_session\n");
+ switch_set_flag_locked(tts_session, FLAG_TERMINATING);
+ mrcp_client_context_session_terminate(context,tts_session->client_session);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t openmrcp_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
+{
+ openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
+ mrcp_client_context_t *context = tts_session->profile->mrcp_context;
+
+ if(!tts_session->control_channel) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no synthesizer channel too feed tts\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ synth_speak(context, tts_session, text);
+
+ switch_clear_flag(tts_session,FLAG_FEED_STARTED);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/**
+ * Freeswitch calls this when its ready to read datalen bytes of data.
+ *
+ * TODO: check the blocking flag passed in flags and act accordingly
+ * (see mod_cepstral.c)
+ */
+static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
+{
+ openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
+ size_t return_len=0;
+ media_frame_t media_frame;
+ audio_source_t *audio_source;
+
+ if (switch_test_flag(tts_session, FLAG_SPEAK_COMPLETE)) {
+ /* tell fs we are done */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FLAG_SPEAK_COMPLETE\n");
+ return SWITCH_STATUS_BREAK;
+ }
+
+ audio_source = mrcp_client_audio_source_get(tts_session->audio_channel);
+ if(!audio_source) {
+ return SWITCH_STATUS_BREAK;
+ }
+
+ if (!switch_test_flag(tts_session, FLAG_FEED_STARTED)) {
+ switch_set_flag(tts_session, FLAG_FEED_STARTED); // shouldn't this use set_flag_locked? -tl
+ if(audio_source->method_set->open) {
+ audio_source->method_set->open(audio_source);
+ }
+ }
+
+ /* sampling rate and frame size should be retrieved from audio source */
+ *rate = 8000;
+ media_frame.codec_frame.size = 160;
+ while(return_len < *datalen) {
+ media_frame.codec_frame.buffer = (char*)data + return_len;
+ audio_source->method_set->read_frame(audio_source,&media_frame);
+ if(media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
+ memset(media_frame.codec_frame.buffer,0,media_frame.codec_frame.size);
+ }
+ return_len += media_frame.codec_frame.size;
+ }
+ *datalen = return_len;
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static void openmrcp_flush_tts(switch_speech_handle_t *sh)
+{
+ openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
+ mrcp_client_context_t *context = tts_session->profile->mrcp_context;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "flush_tts called\n");
+ synth_stop(context,tts_session); // TODO
+}
+
+static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, char *val)
+{
+
+}
+
+static void openmrcp_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
+{
+
+}
+
+static void openmrcp_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
+{
+
+}
+
+
+static switch_status_t do_config()
+{
+ char *cf = "mod_openmrcp.conf";
+ const char *asr_profile_name = NULL;
+ const char *tts_profile_name = NULL;
+ switch_xml_t cfg, xml, settings, profiles, xprofile, param;
+ openmrcp_profile_t *mrcp_profile;
+ openmrcp_client_options_t *mrcp_options;
+
+ if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+ return SWITCH_STATUS_TERM;
+ }
+
mrcp_logger.priority = MRCP_PRIO_EMERGENCY;
- if ((settings = switch_xml_child(cfg, "settings"))) {
- for (param = switch_xml_child(settings, "param"); param; param = param->next) {
- const char *var = switch_xml_attr_soft(param, "name");
- const char *val = switch_xml_attr_soft(param, "value");
-
- if (!strcasecmp(var, "asr_default_profile")) {
- asr_profile_name = val;
- } else if (!strcasecmp(var, "tts_default_profile")) {
- tts_profile_name = val;
- } else if (!strcasecmp(var, "log_level")) {
+ if ((settings = switch_xml_child(cfg, "settings"))) {
+ for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+ const char *var = switch_xml_attr_soft(param, "name");
+ const char *val = switch_xml_attr_soft(param, "value");
+
+ if (!strcasecmp(var, "asr_default_profile")) {
+ asr_profile_name = val;
+ } else if (!strcasecmp(var, "tts_default_profile")) {
+ tts_profile_name = val;
+ } else if (!strcasecmp(var, "log_level")) {
mrcp_logger.priority = atoi(val);
- }
- }
- }
- else {
- goto error;
- }
- if ((profiles = switch_xml_child(cfg, "profiles"))) {
- for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
- const char *profile_name = switch_xml_attr_soft(xprofile, "name");
- mrcp_profile = switch_core_alloc(openmrcp_module.pool,sizeof(openmrcp_profile_t));
- mrcp_profile->mrcp_client = NULL;
- mrcp_profile->mrcp_context = NULL;
- mrcp_profile->name = "noname";
- if(profile_name) {
- mrcp_profile->name = switch_core_strdup(openmrcp_module.pool,profile_name);
- }
-
- mrcp_options = openmrcp_client_options_create(openmrcp_module.pool);
- for (param = switch_xml_child(xprofile, "param"); param; param = param->next) {
- const char *var = switch_xml_attr_soft(param, "name");
- const char *val = switch_xml_attr_soft(param, "value");
-
- if (!strcasecmp(var, "proto_version")) {
- mrcp_options->proto_version =(mrcp_version_t) atoi(val);
- }
- else if (!strcasecmp(var, "client_ip")) {
- mrcp_options->client_ip = switch_core_strdup(openmrcp_module.pool,val);
- } else if (!strcasecmp(var, "server_ip")) {
- mrcp_options->server_ip = switch_core_strdup(openmrcp_module.pool,val);
- } else if (!strcasecmp(var, "client_port")) {
- mrcp_options->client_port = (apr_port_t) atoi(val);
- } else if (!strcasecmp(var, "server_port")) {
- mrcp_options->server_port = (apr_port_t) atoi(val);
- } else if (!strcasecmp(var, "rtp_port_min")) {
- mrcp_options->rtp_port_min = (apr_port_t) atoi(val);
- } else if (!strcasecmp(var, "rtp_port_max")) {
- mrcp_options->rtp_port_max = (apr_port_t) atoi(val);
- }
- }
- mrcp_profile->mrcp_options = mrcp_options;
-
- /* add profile */
- if (!switch_core_hash_find(openmrcp_module.profile_hash, mrcp_profile->name)) {
- switch_core_hash_insert(openmrcp_module.profile_hash, mrcp_profile->name, mrcp_profile);
-
- /* try to set default asr profile */
- if (!openmrcp_module.asr_profile) {
- if (asr_profile_name) {
- if (!strcasecmp(mrcp_profile->name,asr_profile_name)) {
- openmrcp_module.asr_profile = mrcp_profile;
- }
- }
- else {
- openmrcp_module.asr_profile = mrcp_profile;
- }
- }
- /* try to set default tts profile */
- if (!openmrcp_module.tts_profile) {
- if (tts_profile_name) {
- if (!strcasecmp(mrcp_profile->name,tts_profile_name)) {
- openmrcp_module.tts_profile = mrcp_profile;
- }
- }
- else {
- openmrcp_module.tts_profile = mrcp_profile;
- }
- }
- }
- }
- }
- else {
- goto error;
- }
-
- switch_xml_free(xml);
- return SWITCH_STATUS_SUCCESS;
-
- error:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load module configuration\n");
- switch_xml_free(xml);
- return SWITCH_STATUS_TERM;
-
-}
-
-static switch_status_t openmrcp_profile_run(openmrcp_profile_t *profile)
-{
- mrcp_client_event_handler_t *mrcp_event_handler;
- mrcp_client_t *mrcp_client;
- mrcp_client_context_t *mrcp_context;
-
- /*!
- Perform one-time initialization of mrcp client library
- */
- mrcp_event_handler = switch_core_alloc(openmrcp_module.pool,sizeof(mrcp_client_event_handler_t));
- mrcp_event_handler->on_session_initiate = openmrcp_on_session_initiate;
- mrcp_event_handler->on_session_terminate = openmrcp_on_session_terminate;
- mrcp_event_handler->on_channel_add = openmrcp_on_channel_add;
- mrcp_event_handler->on_channel_remove = openmrcp_on_channel_remove;
- mrcp_event_handler->on_channel_modify = openmrcp_on_channel_modify;
-
- // create client context, which must be passed to client engine
- mrcp_context = mrcp_client_context_create(&openmrcp_module,mrcp_event_handler);
- if(!mrcp_context) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mrcp_client_context creation failed\n");
- return SWITCH_STATUS_GENERR;
- }
- profile->mrcp_context = mrcp_context;
-
- // this basically starts a thread that pulls events from the event queue
- // and handles them
- mrcp_client = openmrcp_client_start(profile->mrcp_options,mrcp_context);
- if(!mrcp_client) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "openmrcp_client_start FAILED\n");
- mrcp_client_context_destroy(mrcp_context);
- return SWITCH_STATUS_GENERR;
- }
- profile->mrcp_client = mrcp_client;
- return SWITCH_STATUS_SUCCESS;
-}
-
-
-static switch_status_t openmrcp_init()
-{
- openmrcp_module.pool = mrcp_global_pool_get();
- openmrcp_module.asr_profile = NULL;
- openmrcp_module.tts_profile = NULL;
-
- switch_core_hash_init(&openmrcp_module.profile_hash,openmrcp_module.pool);
-
- /* read config */
- if (do_config() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
-
- /* run default asr/tts profiles */
- if(openmrcp_module.asr_profile) {
- openmrcp_profile_run(openmrcp_module.asr_profile);
- }
- if(openmrcp_module.tts_profile && openmrcp_module.tts_profile != openmrcp_module.asr_profile) {
- openmrcp_profile_run(openmrcp_module.tts_profile);
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load)
-{
- /* connect my internal structure to the blank pointer passed to me */
- //*module_interface = &openmrcp_module_interface;
-
- switch_speech_interface_t *speech_interface;
- switch_asr_interface_t *asr_interface;
-
- /* connect my internal structure to the blank pointer passed to me */
- *module_interface = switch_loadable_module_create_module_interface(pool, modname);
- speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
- speech_interface->interface_name = "openmrcp";
- speech_interface->speech_open = openmrcp_tts_open;
- speech_interface->speech_close = openmrcp_tts_close;
- speech_interface->speech_feed_tts = openmrcp_feed_tts;
- speech_interface->speech_read_tts = openmrcp_read_tts;
- speech_interface->speech_flush_tts = openmrcp_flush_tts;
- speech_interface->speech_text_param_tts = openmrcp_text_param_tts;
- speech_interface->speech_numeric_param_tts = openmrcp_numeric_param_tts;
- speech_interface->speech_float_param_tts = openmrcp_float_param_tts;
- asr_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ASR_INTERFACE);
- asr_interface->interface_name = "openmrcp";
- asr_interface->asr_open = openmrcp_asr_open;
- asr_interface->asr_load_grammar = openmrcp_asr_load_grammar;
- asr_interface->asr_unload_grammar = openmrcp_asr_unload_grammar;
- asr_interface->asr_close = openmrcp_asr_close;
- asr_interface->asr_feed = openmrcp_asr_feed;
- asr_interface->asr_resume = openmrcp_asr_resume;
- asr_interface->asr_pause = openmrcp_asr_pause;
- asr_interface->asr_check_results = openmrcp_asr_check_results;
- asr_interface->asr_get_results = openmrcp_asr_get_results;
-
- mrcp_global_init();
-
- /* initialize openmrcp */
- if (openmrcp_init() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
-
- /* indicate that the module should continue to be loaded */
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown)
-{
- return SWITCH_STATUS_UNLOAD;
-}
+ }
+ }
+ }
+ else {
+ goto error;
+ }
+ if ((profiles = switch_xml_child(cfg, "profiles"))) {
+ for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
+ const char *profile_name = switch_xml_attr_soft(xprofile, "name");
+ mrcp_profile = switch_core_alloc(openmrcp_module.pool,sizeof(openmrcp_profile_t));
+ mrcp_profile->mrcp_client = NULL;
+ mrcp_profile->mrcp_context = NULL;
+ mrcp_profile->name = "noname";
+ if(profile_name) {
+ mrcp_profile->name = switch_core_strdup(openmrcp_module.pool,profile_name);
+ }
+
+ mrcp_options = openmrcp_client_options_create(openmrcp_module.pool);
+ for (param = switch_xml_child(xprofile, "param"); param; param = param->next) {
+ const char *var = switch_xml_attr_soft(param, "name");
+ const char *val = switch_xml_attr_soft(param, "value");
+
+ if (!strcasecmp(var, "proto_version")) {
+ mrcp_options->proto_version =(mrcp_version_t) atoi(val);
+ }
+ else if (!strcasecmp(var, "client_ip")) {
+ mrcp_options->client_ip = switch_core_strdup(openmrcp_module.pool,val);
+ } else if (!strcasecmp(var, "server_ip")) {
+ mrcp_options->server_ip = switch_core_strdup(openmrcp_module.pool,val);
+ } else if (!strcasecmp(var, "client_port")) {
+ mrcp_options->client_port = (apr_port_t) atoi(val);
+ } else if (!strcasecmp(var, "server_port")) {
+ mrcp_options->server_port = (apr_port_t) atoi(val);
+ } else if (!strcasecmp(var, "rtp_port_min")) {
+ mrcp_options->rtp_port_min = (apr_port_t) atoi(val);
+ } else if (!strcasecmp(var, "rtp_port_max")) {
+ mrcp_options->rtp_port_max = (apr_port_t) atoi(val);
+ }
+ }
+ mrcp_profile->mrcp_options = mrcp_options;
+
+ /* add profile */
+ if (!switch_core_hash_find(openmrcp_module.profile_hash, mrcp_profile->name)) {
+ switch_core_hash_insert(openmrcp_module.profile_hash, mrcp_profile->name, mrcp_profile);
+
+ /* try to set default asr profile */
+ if (!openmrcp_module.asr_profile) {
+ if (asr_profile_name) {
+ if (!strcasecmp(mrcp_profile->name,asr_profile_name)) {
+ openmrcp_module.asr_profile = mrcp_profile;
+ }
+ }
+ else {
+ openmrcp_module.asr_profile = mrcp_profile;
+ }
+ }
+ /* try to set default tts profile */
+ if (!openmrcp_module.tts_profile) {
+ if (tts_profile_name) {
+ if (!strcasecmp(mrcp_profile->name,tts_profile_name)) {
+ openmrcp_module.tts_profile = mrcp_profile;
+ }
+ }
+ else {
+ openmrcp_module.tts_profile = mrcp_profile;
+ }
+ }
+ }
+ }
+ }
+ else {
+ goto error;
+ }
+
+ switch_xml_free(xml);
+ return SWITCH_STATUS_SUCCESS;
+
+ error:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load module configuration\n");
+ switch_xml_free(xml);
+ return SWITCH_STATUS_TERM;
+
+}
+
+static switch_status_t openmrcp_profile_run(openmrcp_profile_t *profile)
+{
+ mrcp_client_event_handler_t *mrcp_event_handler;
+ mrcp_client_t *mrcp_client;
+ mrcp_client_context_t *mrcp_context;
+
+ /*!
+ Perform one-time initialization of mrcp client library
+ */
+ mrcp_event_handler = switch_core_alloc(openmrcp_module.pool,sizeof(mrcp_client_event_handler_t));
+ mrcp_event_handler->on_session_initiate = openmrcp_on_session_initiate;
+ mrcp_event_handler->on_session_terminate = openmrcp_on_session_terminate;
+ mrcp_event_handler->on_channel_add = openmrcp_on_channel_add;
+ mrcp_event_handler->on_channel_remove = openmrcp_on_channel_remove;
+ mrcp_event_handler->on_channel_modify = openmrcp_on_channel_modify;
+
+ // create client context, which must be passed to client engine
+ mrcp_context = mrcp_client_context_create(&openmrcp_module,mrcp_event_handler);
+ if(!mrcp_context) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mrcp_client_context creation failed\n");
+ return SWITCH_STATUS_GENERR;
+ }
+ profile->mrcp_context = mrcp_context;
+
+ // this basically starts a thread that pulls events from the event queue
+ // and handles them
+ mrcp_client = openmrcp_client_start(profile->mrcp_options,mrcp_context);
+ if(!mrcp_client) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "openmrcp_client_start FAILED\n");
+ mrcp_client_context_destroy(mrcp_context);
+ return SWITCH_STATUS_GENERR;
+ }
+ profile->mrcp_client = mrcp_client;
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t openmrcp_init()
+{
+ /* one-time mrcp global initialization */
+ mrcp_global_init();
+
+ openmrcp_module.pool = mrcp_global_pool_get();
+ openmrcp_module.asr_profile = NULL;
+ openmrcp_module.tts_profile = NULL;
+
+ switch_core_hash_init(&openmrcp_module.profile_hash,openmrcp_module.pool);
+
+ /* read config */
+ if (do_config() != SWITCH_STATUS_SUCCESS) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* run default asr/tts profiles */
+ if(openmrcp_module.asr_profile) {
+ openmrcp_profile_run(openmrcp_module.asr_profile);
+ }
+ if(openmrcp_module.tts_profile && openmrcp_module.tts_profile != openmrcp_module.asr_profile) {
+ openmrcp_profile_run(openmrcp_module.tts_profile);
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t openmrcp_destroy()
+{
+ /* destroy asr/tts profiles */
+ if(openmrcp_module.asr_profile) {
+ /* shutdown client engine */
+ openmrcp_client_shutdown(openmrcp_module.asr_profile->mrcp_client);
+ /* destroy client context */
+ mrcp_client_context_destroy(openmrcp_module.asr_profile->mrcp_context);
+ if(openmrcp_module.tts_profile == openmrcp_module.asr_profile) {
+ openmrcp_module.tts_profile = NULL;
+ }
+ openmrcp_module.asr_profile = NULL;
+ }
+ if(openmrcp_module.tts_profile) {
+ /* shutdown client engine */
+ openmrcp_client_shutdown(openmrcp_module.tts_profile->mrcp_client);
+ /* destroy client context */
+ mrcp_client_context_destroy(openmrcp_module.tts_profile->mrcp_context);
+ openmrcp_module.tts_profile = NULL;
+ }
+
+ switch_core_hash_destroy(openmrcp_module.profile_hash);
+ openmrcp_module.profile_hash = NULL;
+
+ /* one-time mrcp global destroy */
+ mrcp_global_destroy();
+ return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load)
+{
+ switch_speech_interface_t *speech_interface;
+ switch_asr_interface_t *asr_interface;
+
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
+ speech_interface->interface_name = "openmrcp";
+ speech_interface->speech_open = openmrcp_tts_open;
+ speech_interface->speech_close = openmrcp_tts_close;
+ speech_interface->speech_feed_tts = openmrcp_feed_tts;
+ speech_interface->speech_read_tts = openmrcp_read_tts;
+ speech_interface->speech_flush_tts = openmrcp_flush_tts;
+ speech_interface->speech_text_param_tts = openmrcp_text_param_tts;
+ speech_interface->speech_numeric_param_tts = openmrcp_numeric_param_tts;
+ speech_interface->speech_float_param_tts = openmrcp_float_param_tts;
+ asr_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ASR_INTERFACE);
+ asr_interface->interface_name = "openmrcp";
+ asr_interface->asr_open = openmrcp_asr_open;
+ asr_interface->asr_load_grammar = openmrcp_asr_load_grammar;
+ asr_interface->asr_unload_grammar = openmrcp_asr_unload_grammar;
+ asr_interface->asr_close = openmrcp_asr_close;
+ asr_interface->asr_feed = openmrcp_asr_feed;
+ asr_interface->asr_resume = openmrcp_asr_resume;
+ asr_interface->asr_pause = openmrcp_asr_pause;
+ asr_interface->asr_check_results = openmrcp_asr_check_results;
+ asr_interface->asr_get_results = openmrcp_asr_get_results;
+
+ /* initialize openmrcp */
+ if (openmrcp_init() != SWITCH_STATUS_SUCCESS) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown)
+{
+ /* destroy openmrcp */
+ openmrcp_destroy();
+ return SWITCH_STATUS_UNLOAD;
+}
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h Tue Aug 21 13:44:11 2007
@@ -117,7 +117,8 @@
typedef enum {
- PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 1)
+ PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 0),
+ PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1)
} sofia_NDLB_t;
typedef enum {
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c Tue Aug 21 13:44:11 2007
@@ -793,6 +793,10 @@
if (switch_true(val)) {
profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
}
+ } else if (!strcasecmp(var, "NDLB-broken-auth-hash")) {
+ if (switch_true(val)) {
+ profile->ndlb |= PFLAG_NDLB_BROKEN_AUTH_HASH;
+ }
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
profile->pflags |= PFLAG_PASS_RFC2833;
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c Tue Aug 21 13:44:11 2007
@@ -725,8 +725,11 @@
char bigdigest[2 * SU_MD5_DIGEST_SIZE + 1];
char *username, *realm, *nonce, *uri, *qop, *cnonce, *nc, *response, *input = NULL, *input2 = NULL;
auth_res_t ret = AUTH_FORBIDDEN;
- char *npassword = NULL;
- int cnt = 0;
+ int cnt = 0, first = 0;
+ const char *passwd = NULL;
+ const char *a1_hash = NULL;
+ char *sql;
+ switch_xml_t domain, xml, user, param, xparams;
username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
@@ -783,11 +786,7 @@
}
if (switch_strlen_zero(np)) {
- switch_xml_t domain, xml, user, param, xparams;
- const char *passwd = NULL;
- const char *a1_hash = NULL;
- char *sql;
-
+ first = 1;
sql = switch_mprintf("select nonce from sip_authentication where nonce='%q'", nonce);
assert(sql != NULL);
if (!sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, np, nplen)) {
@@ -796,72 +795,72 @@
goto end;
}
free(sql);
-
- if (switch_xml_locate_user(username, realm, ip, &xml, &domain, &user) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, realm);
- ret = AUTH_FORBIDDEN;
- goto end;
- }
+ }
+
+ if (switch_xml_locate_user(username, realm, ip, &xml, &domain, &user) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, realm);
+ ret = AUTH_FORBIDDEN;
+ goto end;
+ }
- if (!(xparams = switch_xml_child(user, "params"))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", username, realm);
- ret = AUTH_FORBIDDEN;
- goto end;
+ if (!(xparams = switch_xml_child(user, "params"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", username, realm);
+ switch_xml_free(xml);
+ ret = AUTH_FORBIDDEN;
+ goto end;
+ }
+
+ for (param = switch_xml_child(xparams, "param"); param; param = param->next) {
+ const char *var = switch_xml_attr_soft(param, "name");
+ const char *val = switch_xml_attr_soft(param, "value");
+
+ if (!strcasecmp(var, "password")) {
+ passwd = val;
}
- for (param = switch_xml_child(xparams, "param"); param; param = param->next) {
- const char *var = switch_xml_attr_soft(param, "name");
- const char *val = switch_xml_attr_soft(param, "value");
-
- if (!strcasecmp(var, "password")) {
- passwd = val;
- }
-
- if (!strcasecmp(var, "a1-hash")) {
- a1_hash = val;
- }
+ if (!strcasecmp(var, "a1-hash")) {
+ a1_hash = val;
}
+ }
+ if (first) {
if (v_event && (xparams = switch_xml_child(user, "variables"))) {
if (switch_event_create(v_event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
for (param = switch_xml_child(xparams, "variable"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
const char *val = switch_xml_attr_soft(param, "value");
-
+
if (!switch_strlen_zero(var) && !switch_strlen_zero(val)) {
switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, var, "%s", val);
}
}
}
}
+ }
+ switch_xml_free(xml);
- if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
- ret = AUTH_OK;
- goto end;
- }
-
- if (!a1_hash) {
- su_md5_t ctx;
- char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1];
- char *input;
-
- input = switch_mprintf("%s:%s:%s", username, realm, passwd);
- su_md5_init(&ctx);
- su_md5_strupdate(&ctx, input);
- su_md5_hexdigest(&ctx, hexdigest);
- su_md5_deinit(&ctx);
- switch_safe_free(input);
- a1_hash = hexdigest;
-
- }
+ if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
+ ret = AUTH_OK;
+ goto end;
+ }
- np = strdup(a1_hash);
+ if (!a1_hash) {
+ su_md5_t ctx;
+ char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1];
+ char *input;
- switch_xml_free(xml);
+ input = switch_mprintf("%s:%s:%s", username, realm, passwd);
+ su_md5_init(&ctx);
+ su_md5_strupdate(&ctx, input);
+ su_md5_hexdigest(&ctx, hexdigest);
+ su_md5_deinit(&ctx);
+ switch_safe_free(input);
+ a1_hash = hexdigest;
+
}
- npassword = np;
+ for_the_sake_of_interop:
if ((input = switch_mprintf("%s:%q", regstr, uri))) {
su_md5_init(&ctx);
@@ -870,7 +869,7 @@
su_md5_deinit(&ctx);
}
- if ((input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", npassword, nonce, nc, cnonce, qop, uridigest))) {
+ if ((input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc, cnonce, qop, uridigest))) {
memset(&ctx, 0, sizeof(ctx));
su_md5_init(&ctx);
su_md5_strupdate(&ctx, input2);
@@ -880,6 +879,16 @@
if (!strcasecmp(bigdigest, response)) {
ret = AUTH_OK;
} else {
+ if ((profile->ndlb & PFLAG_NDLB_BROKEN_AUTH_HASH) && strcasecmp(regstr, "REGISTER") && strcasecmp(regstr, "INVITE")) {
+ /* some clients send an ACK with the method 'INVITE' in the hash which will break auth so we will
+ try again with INVITE so we don't get people complaining to us when someone else's client has a bug......
+ */
+ switch_safe_free(input);
+ switch_safe_free(input2);
+ regstr = "INVITE";
+ goto for_the_sake_of_interop;
+ }
+
ret = AUTH_FORBIDDEN;
}
}
Modified: freeswitch/branches/greenlizard/src/switch_caller.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_caller.c (original)
+++ freeswitch/branches/greenlizard/src/switch_caller.c Tue Aug 21 13:44:11 2007
@@ -86,6 +86,14 @@
profile->source = switch_core_session_strdup(session, tocopy->source);
profile->context = switch_core_session_strdup(session, tocopy->context);
profile->chan_name = switch_core_session_strdup(session, tocopy->chan_name);
+ profile->caller_ton = tocopy->caller_ton;
+ profile->caller_numplan = tocopy->caller_numplan;
+ profile->ani_ton = tocopy->ani_ton;
+ profile->ani_numplan = tocopy->ani_numplan;
+ profile->rdnis_ton = tocopy->rdnis_ton;
+ profile->rdnis_numplan = tocopy->rdnis_numplan;
+ profile->destination_number_ton = tocopy->destination_number_ton;
+ profile->destination_number_numplan = tocopy->destination_number_numplan;
profile->flags = tocopy->flags;
}
1
0
[commit] r5641 - in freeswitch/branches/greenlizard/src: . mod/asr_tts/mod_openmrcp mod/timers/mod_softtimer
by Freeswitch SVN 20 Aug '07
by Freeswitch SVN 20 Aug '07
20 Aug '07
Author: greenlizard
Date: Mon Aug 20 18:01:13 2007
New Revision: 5641
Modified:
freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c
freeswitch/branches/greenlizard/src/switch_loadable_module.c
Log:
merge trunk 5627:5639
Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c (original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c Mon Aug 20 18:01:13 2007
@@ -99,7 +99,8 @@
FLAG_BARGE = (1 << 1),
FLAG_READY = (1 << 2),
FLAG_SPEAK_COMPLETE = (1 << 3),
- FLAG_FEED_STARTED = (1 << 4)
+ FLAG_FEED_STARTED = (1 << 4),
+ FLAG_TERMINATING = (1 << 5)
} mrcp_flag_t;
typedef struct {
@@ -173,7 +174,13 @@
if(!openmrcp_session) {
return MRCP_STATUS_FAILURE;
}
- openmrcp_session_destroy(openmrcp_session);
+
+ if (switch_test_flag(openmrcp_session, FLAG_TERMINATING)) {
+ openmrcp_session_destroy(openmrcp_session);
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "abnormal session terminate\n");
+ }
return MRCP_STATUS_SUCCESS;
}
@@ -436,6 +443,7 @@
// terminate client session
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to TERMINATE SESSION\n");
+ switch_set_flag_locked(asr_session, FLAG_TERMINATING);
mrcp_client_context_session_terminate(context, asr_session->client_session);
switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
@@ -487,15 +495,21 @@
</result>
*/
- char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
- char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
- if (!position) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
- ret = SWITCH_STATUS_FALSE;
+ if(asr_session->mrcp_message_last_rcvd && asr_session->mrcp_message_last_rcvd->body) {
+ char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
+ char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
+ if (!position) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
+ ret = SWITCH_STATUS_FALSE;
+ }
+ else {
+ position += strlen(marker);
+ *xmlstr = strdup(position);
+ }
}
else {
- position += strlen(marker);
- *xmlstr = strdup(position);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server");
+ ret = SWITCH_STATUS_FALSE;
}
// since we are returning our result here, future calls to check_results
@@ -599,6 +613,7 @@
/* terminate tts session */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "terminate tts_session\n");
+ switch_set_flag_locked(tts_session, FLAG_TERMINATING);
mrcp_client_context_session_terminate(context,tts_session->client_session);
return SWITCH_STATUS_SUCCESS;
}
@@ -705,6 +720,7 @@
return SWITCH_STATUS_TERM;
}
+ mrcp_logger.priority = MRCP_PRIO_EMERGENCY;
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
@@ -714,6 +730,8 @@
asr_profile_name = val;
} else if (!strcasecmp(var, "tts_default_profile")) {
tts_profile_name = val;
+ } else if (!strcasecmp(var, "log_level")) {
+ mrcp_logger.priority = atoi(val);
}
}
}
Modified: freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c (original)
+++ freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c Mon Aug 20 18:01:13 2007
@@ -74,7 +74,7 @@
#define IDLE_SPEED 100
-static inline switch_status_t timer_init(switch_timer_t *timer)
+static switch_status_t timer_init(switch_timer_t *timer)
{
timer_private_t *private_info;
int sanity = 0;
@@ -112,7 +112,7 @@
-static inline switch_status_t timer_step(switch_timer_t *timer)
+static switch_status_t timer_step(switch_timer_t *timer)
{
timer_private_t *private_info = timer->private_info;
uint64_t samples;
@@ -136,7 +136,7 @@
}
-static inline switch_status_t timer_next(switch_timer_t *timer)
+static switch_status_t timer_next(switch_timer_t *timer)
{
timer_private_t *private_info = timer->private_info;
@@ -154,7 +154,7 @@
return SWITCH_STATUS_FALSE;
}
-static inline switch_status_t timer_check(switch_timer_t *timer)
+static switch_status_t timer_check(switch_timer_t *timer)
{
timer_private_t *private_info = timer->private_info;
switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -182,7 +182,7 @@
}
-static inline switch_status_t timer_destroy(switch_timer_t *timer)
+static switch_status_t timer_destroy(switch_timer_t *timer)
{
timer_private_t *private_info = timer->private_info;
switch_mutex_lock(globals.mutex);
Modified: freeswitch/branches/greenlizard/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_loadable_module.c (original)
+++ freeswitch/branches/greenlizard/src/switch_loadable_module.c Mon Aug 20 18:01:13 2007
@@ -1047,6 +1047,7 @@
assert(module != NULL);
switch_loadable_module_unprocess(module);
+ switch_core_hash_delete_locked(loadable_modules.module_hash, module->key, loadable_modules.mutex);
if (module->switch_module_shutdown) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping: %s\n", module->module_interface->module_name);
@@ -1067,7 +1068,7 @@
}
- switch_core_hash_delete_locked(loadable_modules.module_hash, module->key, loadable_modules.mutex);
+
}
1
0
[commit] r5640 - freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp
by Freeswitch SVN 20 Aug '07
by Freeswitch SVN 20 Aug '07
20 Aug '07
Author: greenlizard
Date: Mon Aug 20 17:54:21 2007
New Revision: 5640
Modified:
freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
Log:
attempting to fix shutdown segfault, convert to new style module loading as seen in mod_cepstral
Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c (original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c Mon Aug 20 17:54:21 2007
@@ -690,47 +690,6 @@
}
-static switch_asr_interface_t openmrcp_asr_interface = {
- /*.interface_name*/ "openmrcp",
- /*.asr_open*/ openmrcp_asr_open,
- /*.asr_load_grammar*/ openmrcp_asr_load_grammar,
- /*.asr_unload_grammar*/ openmrcp_asr_unload_grammar,
- /*.asr_close*/ openmrcp_asr_close,
- /*.asr_feed*/ openmrcp_asr_feed,
- /*.asr_resume*/ openmrcp_asr_resume,
- /*.asr_pause*/ openmrcp_asr_pause,
- /*.asr_check_results*/ openmrcp_asr_check_results,
- /*.asr_get_results*/ openmrcp_asr_get_results
-};
-
-static switch_speech_interface_t openmrcp_tts_interface = {
- /*.interface_name*/ "openmrcp",
- /*.speech_open*/ openmrcp_tts_open,
- /*.speech_close*/ openmrcp_tts_close,
- /*.speech_feed_tts*/ openmrcp_feed_tts,
- /*.speech_read_tts*/ openmrcp_read_tts,
- /*.speech_flush_tts*/ openmrcp_flush_tts,
- /*.speech_text_param_tts*/ openmrcp_text_param_tts,
- /*.speech_numeric_param_tts*/ openmrcp_numeric_param_tts,
- /*.speech_float_param_tts*/ openmrcp_float_param_tts,
-};
-
-static switch_loadable_module_interface_t openmrcp_module_interface = {
- /*.module_name */ modname,
- /*.endpoint_interface */ NULL,
- /*.timer_interface */ NULL,
- /*.dialplan_interface */ NULL,
- /*.codec_interface */ NULL,
- /*.application_interface */ NULL,
- /*.api_interface */ NULL,
- /*.file_interface */ NULL,
- /*.speech_interface */ &openmrcp_tts_interface,
- /*.directory_interface */ NULL,
- /*.chat_interface */ NULL,
- /*.say_interface */ NULL,
- /*.asr_interface */ &openmrcp_asr_interface
-};
-
static switch_status_t do_config()
{
@@ -903,7 +862,34 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load)
{
/* connect my internal structure to the blank pointer passed to me */
- *module_interface = &openmrcp_module_interface;
+ //*module_interface = &openmrcp_module_interface;
+
+ switch_speech_interface_t *speech_interface;
+ switch_asr_interface_t *asr_interface;
+
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
+ speech_interface->interface_name = "openmrcp";
+ speech_interface->speech_open = openmrcp_tts_open;
+ speech_interface->speech_close = openmrcp_tts_close;
+ speech_interface->speech_feed_tts = openmrcp_feed_tts;
+ speech_interface->speech_read_tts = openmrcp_read_tts;
+ speech_interface->speech_flush_tts = openmrcp_flush_tts;
+ speech_interface->speech_text_param_tts = openmrcp_text_param_tts;
+ speech_interface->speech_numeric_param_tts = openmrcp_numeric_param_tts;
+ speech_interface->speech_float_param_tts = openmrcp_float_param_tts;
+ asr_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ASR_INTERFACE);
+ asr_interface->interface_name = "openmrcp";
+ asr_interface->asr_open = openmrcp_asr_open;
+ asr_interface->asr_load_grammar = openmrcp_asr_load_grammar;
+ asr_interface->asr_unload_grammar = openmrcp_asr_unload_grammar;
+ asr_interface->asr_close = openmrcp_asr_close;
+ asr_interface->asr_feed = openmrcp_asr_feed;
+ asr_interface->asr_resume = openmrcp_asr_resume;
+ asr_interface->asr_pause = openmrcp_asr_pause;
+ asr_interface->asr_check_results = openmrcp_asr_check_results;
+ asr_interface->asr_get_results = openmrcp_asr_get_results;
mrcp_global_init();
1
0
Author: greenlizard
Date: Mon Aug 20 15:59:51 2007
New Revision: 5637
Modified:
freeswitch/branches/greenlizard/src/switch_cpp.cpp
Log:
did not have a return value and was breaking on windows build
Modified: freeswitch/branches/greenlizard/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_cpp.cpp (original)
+++ freeswitch/branches/greenlizard/src/switch_cpp.cpp Mon Aug 20 15:59:51 2007
@@ -165,6 +165,7 @@
begin_allow_threads();
switch_ivr_collect_digits_callback(session, ap, timeout);
end_allow_threads();
+ return SWITCH_STATUS_SUCCESS;
}
int CoreSession::getDigits(char *dtmf_buf,
1
0