view intercom/intercom @ 2:13be24d74cd2

import intercom-0.4.1
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 09:57:52 +0200
parents
children
line wrap: on
line source

#!/bin/bash

# intercom
#
# Copyright (C) DFS Deutsche Flugsicherung (2004, 2005). 
# All Rights Reserved.
# Author: Andre Adrian
#
# Voice-over-IP Intercom start skript for Linux with ALSA and OSS
#
# Version 0.4
#

echo "usage: intercom [OPTIONS] [Partner1-IP [Partner2-IP ...]]"
echo " -a value   set ambient (background) noise to value decibel"
# echo " -b value   set Acoustic Echo Suppression to value decibel"
echo " -e         enable 2040Hz Sinustone for VHF transmitter"
echo " -f Number  Number of 20ms Frames in RTP packet"
echo " -k         use Packet Loss Concealment (PLC)"
echo " -l         use hardware AEC and Line-in for microphone"
echo " -m         use hardware AEC and Mic-in for microphone"
echo " -p Number  RTP Portnumber (default is 5004)"
echo " -t         Telephone conference (everybody with everybody else)"
echo " -s Percent simulated packet loss"
echo " -w         visualize vector w"
echo " -I         use iLBC codec (default), can do PLC"
echo " -A         use G.711 A-law codec"
echo " -U         use G.711 u-law codec"
echo " -6         use G.726 32kbps codec"
echo " -G         use GSM codec"
echo " -S         use Wideband Speex codec, can do PLC"

# disable screen saver
xset s off
xset -dpms

# delete old process
killall -9 intercomd 2>/dev/null
killall -9 intercomd1 2>/dev/null

# configure audio mixer (AC97 compatible)
# check your mixer hardware with:
# 	cat /dev/sndstat
#
# hardware AEC test was successful with on-board sound mixers:
# Analog Devices AD1985, ICEnsemble ICE1232, Realtek ALC650 and ALC655, 
# SigmaTel STAC9750/51
#
# hardware AEC test was successful with PCI sound cards:
# Soundblaster PCI128
#
# hardware AEC test failed with PCI sound cards:
# Soundblaster Audigy 2, C-Media 8738

# set playback volume
amixer -q sset 'PCM',0 70%
amixer -q sset 'Master',0 70%

# use only PCM for playback
amixer -q set 'Master',0 unmute
amixer -q set 'PCM',0 unmute
amixer -q set 'Mic',0 mute
amixer -q set 'Line',0 mute
amixer -q set 'CD',0 mute
amixer -q set 'Aux',0 mute

# enable recording
amixer -q cset iface=MIXER,name='Capture Switch' 1
EXEC=intercomd
WOPTION=320
WSTART=0

# handle all options
for argv in $* ;do
  # echo $argv
  case $argv in
  ("-l")
    # for Hardware AEC and Line-In Capture
    amixer -q set 'Capture',0 0%-,100%-
    amixer -q cset iface=MIXER,name='Capture Source' 4,5
  ;;
  ("-m")
    # for Hardware AEC and Mic-In Capture
    amixer -q set 'Capture',0 0%-,100%-
    amixer -q cset iface=MIXER,name='Capture Source' 0,5
  ;;
  ("-9")
    # other EXEC because of EFR G.729 link mismatch (same functionnames)
    EXEC=intercomd2
  ;;
  ("-S")
    # other EXEC because Speex is Wideband codec
    EXEC=intercomd1
    WOPTION=640
  ;;
  ("-w")
    # start wdisplay.tcl
    WSTART=1
  ;;
  esac
done

# start wdisplay
if test $WSTART -eq 1 ;then
  /usr/local/bin/wdisplay.tcl $WOPTION &
  sleep 1
fi

# start audio/network daemon
/usr/local/bin/$EXEC $* &
sleep 1

# give audio/network daemon realtime process prio
# enable this if you don't use hardware AEC
# (setpriority is in RPM package rtstools)
# sudo /usr/sbin/setpriority `pidof $EXEC` fifo 1

# To make sudo work without password add as superuser with the program 
# visudo:
# %users ALL=(root) NOPASSWD: /usr/sbin/setpriority

# start graphical user interface
# /usr/local/bin/intercom.tcl $* -geometry 800x600 &
/usr/local/bin/intercom.tcl $* &

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.