Changeset 5613
Add a script to do mixing and use it by default to mix monitor files
Modern versions of sox have options rather than a separate soxmix
program.
Modern versions of sox can either combine inputs onto different channels
of a stereo file or mix them into a single channel.
Many people would like to normalize the volume of the channels.
Committed by:
mjagdis
Date:
Feb 05 2010 * 00:42 (6 months ago)
Affected files:
callweaver/trunk/res/Makefile.am (diff)
callweaver/trunk/res/res_monitor.c (diff)
callweaver/trunk/utils/Makefile.am (diff)
callweaver/trunk/res/Makefile.am (unified diff)
| r5590 | r5613 | |
|---|---|---|
| 21 | 21 | res_monitor_la_SOURCES = res_monitor.c |
| 22 | 22 | res_monitor_la_LDFLAGS = -module -avoid-version @NO_UNDEFINED@ |
| 23 | 23 | res_monitor_la_LIBADD = @CALLWEAVER_LIB@ |
| 24 | res_monitor_la_CFLAGS = $(AM_CFLAGS) -DCW_UTILSDIR="$(cwutilsdir)" | |
| 24 | 25 | |
| 25 | 26 | res_ogi_la_SOURCES = res_ogi.c |
| 26 | 27 | res_ogi_la_LDFLAGS = -module -avoid-version @NO_UNDEFINED@ |
callweaver/trunk/res/res_monitor.c (unified diff)
| r5594 | r5613 | |
|---|---|---|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if (chan->monitor->joinfiles && !cw_strlen_zero(chan->monitor->filename_base)) { |
| 268 | char tmp[1024]; | |
| 269 | char tmp2[1024]; | |
| 268 | struct cw_dynstr *cmd = NULL; | |
| 269 | /* This mapping is because that's what corelib/file.c does when asked to write wav49 */ | |
| 270 | 270 | const char *format = (strcasecmp(chan->monitor->format, "wav49") == 0) ? "WAV" : chan->monitor->format; |
| 271 | 271 | char *name = chan->monitor->filename_base; |
| 272 | 272 | int directory = strchr(name, '/') ? 1 : 0; |
| --- | --- | |
| 277 | 277 | execute = pbx_builtin_getvar_helper(chan, CW_KEYWORD_MONITOR_EXEC, "MONITOR_EXEC"); |
| 278 | 278 | execute_args = pbx_builtin_getvar_helper(chan, CW_KEYWORD_MONITOR_EXEC_ARGS, "MONITOR_EXEC_ARGS"); |
| 279 | 279 | |
| 280 | snprintf(tmp, sizeof(tmp), "%s \"%s/%s-in.%s\" \"%s/%s-out.%s\" %s%s \"%s/%s.%s\" %s &", | |
| 281 | (execute ? execute->value : "nice -n 19 soxmix"), | |
| 282 | dir, name, format, dir, name, format, | |
| 283 | (execute ? "" : "-t "), | |
| 284 | (execute ? "" : format), | |
| 280 | cw_dynstr_printf(&cmd, | |
| 281 | "%s '%s/%s-in.%s' '%s/%s-out.%s' '%s/%s.%s' %s > /dev/null 2>&1 &", | |
| 282 | (execute ? execute->value : "nice -n 19 " CW_CPP_DO(CW_CPP_MKSTR, CW_UTILSDIR) "/cw_mixer"), | |
| 285 | 283 | dir, name, format, |
| 286 | (execute_args ? execute_args->value : "")); | |
| 284 | dir, name, format, | |
| 285 | dir, name, format, | |
| 286 | (execute_args ? execute_args->value : "") | |
| 287 | ); | |
| 287 | 288 | |
| 288 | 289 | if (execute_args) |
| 289 | 290 | cw_object_put(execute_args); |
| 291 | ||
| 290 | 292 | if (execute) |
| 291 | 293 | cw_object_put(execute); |
| 292 | else { | |
| 293 | /* Remove legs when done mixing */ | |
| 294 | snprintf(tmp2, sizeof(tmp2), "( %s& rm -f \"%s/%s-\"* ) &", tmp, dir ,name); | |
| 295 | cw_copy_string(tmp, tmp2, sizeof(tmp)); | |
| 296 | } | |
| 297 | cw_log(CW_LOG_DEBUG,"monitor executing %s\n", tmp); | |
| 298 | if (cw_safe_system(tmp) == -1) | |
| 299 | cw_log(CW_LOG_WARNING, "Execute of %s failed.\n", tmp); | |
| 294 | ||
| 295 | if (cmd && !cmd->error) { | |
| 296 | cw_log(CW_LOG_DEBUG,"Executing: %s\n", cmd->data); | |
| 297 | if (cw_safe_system(cmd->data) == -1) | |
| 298 | cw_log(CW_LOG_WARNING, "Failed to execute: %s failed.\n", cmd->data); | |
| 299 | } else | |
| 300 | cw_log(CW_LOG_ERROR, "Out of memory!\n"); | |
| 301 | ||
| 302 | if (cmd) | |
| 303 | cw_dynstr_free(cmd); | |
| 300 | 304 | } |
| 301 | 305 | |
| 302 | 306 | free(chan->monitor->format); |
callweaver/trunk/utils/Makefile.am (unified diff)
| r5564 | r5613 | |
|---|---|---|
| 6 | 6 | noinst_SCRIPTS = cc |
| 7 | 7 | noinst_PROGRAMS = genkeywords |
| 8 | 8 | cwutils_PROGRAMS = streamplayer # check_expr |
| 9 | cwutils_SCRIPTS = cw_mixer | |
| 9 | 10 | |
| 10 | 11 | streamplayer_SOURCES = streamplayer.c ${top_srcdir}/corelib/strcompat.c |
| 11 | 12 | |
| --- | --- | |
| 29 | 30 | smsq_SOURCES = smsq.c |
| 30 | 31 | smsq_LDADD = -lpopt |
| 31 | 32 | endif WANT_SMSQ |
| 33 | ||
| 34 | ||
| 35 | install-data-hook: | |
| 36 | cfgdir=/etc/sysconfig; \ | |
| 37 | test -d $$cfgdir || cfgdir=/etc/default; \ | |
| 38 | test -f $(DESTDIR)$$cfgdir/cw_mixer \ | |
| 39 | || $(INSTALL) -m 0644 $(srcdir)/cw_mixer.conf.sample $(DESTDIR)$$cfgdir/cw_mixer |
![Home changeset 5613 [home]](/images/logo.png?1180520111)
RSS Feeds