]> git.vomp.tv Git - vompclient.git/blob - audio.cc
Demuxer::scanForVideo()
[vompclient.git] / audio.cc
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "audio.h"
22
23 Audio* Audio::instance = NULL;
24
25 Audio::Audio()
26 {
27   if (instance) return;
28   instance = this;
29   memset(&Aoffset, 0, sizeof(Aoffset));
30   userMute = 0;
31   systemMute = 0;
32 }
33
34 Audio::~Audio()
35 {
36   instance = NULL;
37 }
38
39 Audio* Audio::getInstance()
40 {
41   return instance;
42 }
43
44 int Audio::volumeUp()
45 {
46   if (!initted) return 0;
47   if (userMute) toggleUserMute();
48   if (volume == 20) return volume;
49   volume++;
50   setVolume(volume);
51   return volume;
52 }
53
54 int Audio::volumeDown()
55 {
56   if (!initted) return 0;
57   if (userMute) toggleUserMute();
58   if (volume == 0) return 0;
59   volume--;
60   setVolume(volume);
61   return volume;
62 }
63
64 int Audio::getVolume()
65 {
66   if (!initted) return 0;
67   return volume;
68 }
69
70 int Audio::toggleUserMute()
71 {
72   if (!initted) return 0;
73
74   if (userMute)
75   {
76     userMute = 0;
77   }
78   else
79   {
80     userMute = 1;
81   }
82
83   doMuting();
84
85   return userMute;
86 }
87
88 int Audio::systemMuteOn()
89 {
90   systemMute = 1;
91   return doMuting();
92 }
93
94 int Audio::systemMuteOff()
95 {
96   systemMute = 0;
97   return doMuting();
98 }
99
100 int Audio::doMuting()
101 {
102   Log::getInstance()->log("Audio", Log::DEBUG, "doMuting: user=%i sys=%i", userMute, systemMute);
103
104
105   if (userMute || systemMute)
106   {
107     return mute();
108   }
109   else
110   {
111     return unMute();
112   }
113 }