1 # iae-service.tcl --
2 #
3 # Service API for Indiva Audio Encoder
4 #
5 # Copyright (c) 1996-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/indiva/services/iae/iae-service.tcl,v 1.2 2002/06/20 00:17:24 weitsang Exp $
32
33 import IndivaService
34 Class IAEService -superclass IndivaService
35
36
37 IAEService instproc init {agent manager} {
38 $self next
39
40 $self set agent_ $agent
41 $self set manager_ $manager
42 $self set started_ 0
43 $self set dest_ ""
44 $self set port_ ""
45 }
46
47
48 IAEService instproc gui {parent} {
49 $self instvar agent_
50 set layout "
51 frame $parent.iae
52
53 label $parent.iae.fpsl -text {Volume} -anchor e
54 scale $parent.iae.fpss -from 0 -to 256 -orient horiz -showvalue 0
55 $parent.iae.fpss set [$agent_ get_input_gain]
56 pack $parent.iae.fpsl $parent.iae.fpss -side left -fill x
57 grid $parent.iae.fpsl -column 0 -row 0 -sticky news
58 grid $parent.iae.fpss -column 1 -row 0 -sticky news
59
60 pack $parent.iae -fill both -expand 1
61 "
62 lappend commands widget $parent.iae.fpss "$agent_ set_input_gain"
63 return [list $layout $commands]
64 }
65
66
67 IAEService instproc start {args} {
68 # Check for validity
69 if {[llength $args] != 2} {
70 error "calling $class $proc with wrong number of args. Pls check you code"
71 }
72
73 $self instvar agent_ started_ dest_ port_
74 puts "$class $proc $args"
75
76 set dest [lindex $args 0]
77 set port [lindex $args 1]
78 if {$dest_ == $dest && $port_ == $port} {
79 set cname [$agent_ get_local_sdes cname]
80 set ssrc [$agent_ get_local_srcid]
81 return [list $cname $ssrc]
82 } else {
83 set dest_ $dest
84 set port_ $port
85 }
86 $agent_ reset $dest_
87 $agent_ set_input_port $port_
88 $agent_ set_output_port [lindex [$agent_ get_output_ports] 0]
89 $agent_ set_input_mute 0
90 $agent_ set_output_mute 0
91 if {![$agent_ have_audio]} {
92 $agent_ obtain
93 }
94
95 set cname [$agent_ get_local_sdes cname]
96 set ssrc [$agent_ get_local_srcid]
97 return [list $cname $ssrc]
98 }
99
100 IAEService instproc friendlyname {} {
101 return "Audio Encoder"
102 }
103
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.