author | chicken <chicken> | 2004-03-01 15:58:07 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-01 15:58:07 (UTC) |
commit | 931c55406a043195712955c732a875e17899df90 (patch) (unidiff) | |
tree | 8097c88ee3e96f8fb613ccca1ebf36bf73070dcc /libopie2/opiemm | |
parent | 87676b131aad1bfe979570a48107527db4040020 (diff) | |
download | opie-931c55406a043195712955c732a875e17899df90.zip opie-931c55406a043195712955c732a875e17899df90.tar.gz opie-931c55406a043195712955c732a875e17899df90.tar.bz2 |
fix includes
-rw-r--r-- | libopie2/opiemm/osoundsystem.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp index ca63389..51e088c 100644 --- a/libopie2/opiemm/osoundsystem.cpp +++ b/libopie2/opiemm/osoundsystem.cpp | |||
@@ -1,171 +1,170 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/osoundsystem.h> | 32 | #include <opie2/osoundsystem.h> |
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | 34 | ||
35 | #include <errno.h> | 35 | #include <errno.h> |
36 | #include <fcntl.h> | 36 | #include <fcntl.h> |
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | #include <sys/soundcard.h> | 40 | #include <sys/soundcard.h> |
41 | #include <sys/stat.h> | 41 | #include <sys/stat.h> |
42 | 42 | ||
43 | #include <qstringlist.h> | ||
44 | 43 | ||
45 | /*====================================================================================== | 44 | /*====================================================================================== |
46 | * OSoundSystem | 45 | * OSoundSystem |
47 | *======================================================================================*/ | 46 | *======================================================================================*/ |
48 | 47 | ||
49 | OSoundSystem* OSoundSystem::_instance = 0; | 48 | OSoundSystem* OSoundSystem::_instance = 0; |
50 | 49 | ||
51 | OSoundSystem::OSoundSystem() | 50 | OSoundSystem::OSoundSystem() |
52 | { | 51 | { |
53 | odebug << "OSoundSystem::OSoundSystem()" << oendl; | 52 | odebug << "OSoundSystem::OSoundSystem()" << oendl; |
54 | synchronize(); | 53 | synchronize(); |
55 | } | 54 | } |
56 | 55 | ||
57 | void OSoundSystem::synchronize() | 56 | void OSoundSystem::synchronize() |
58 | { | 57 | { |
59 | // gather available interfaces by inspecting /dev | 58 | // gather available interfaces by inspecting /dev |
60 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 59 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
61 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | 60 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
62 | 61 | ||
63 | _interfaces.clear(); | 62 | _interfaces.clear(); |
64 | _interfaces.insert( "soundcard", new OSoundCard( this, "soundcard" ) ); | 63 | _interfaces.insert( "soundcard", new OSoundCard( this, "soundcard" ) ); |
65 | 64 | ||
66 | 65 | ||
67 | /* | 66 | /* |
68 | 67 | ||
69 | QString str; | 68 | QString str; |
70 | QFile f( "/dev/sound" ); | 69 | QFile f( "/dev/sound" ); |
71 | bool hasFile = f.open( IO_ReadOnly ); | 70 | bool hasFile = f.open( IO_ReadOnly ); |
72 | if ( !hasFile ) | 71 | if ( !hasFile ) |
73 | { | 72 | { |
74 | odebug << "OSoundSystem: /dev/sound not existing. No sound devices available" << oendl; | 73 | odebug << "OSoundSystem: /dev/sound not existing. No sound devices available" << oendl; |
75 | return; | 74 | return; |
76 | } | 75 | } |
77 | QTextStream s( &f ); | 76 | QTextStream s( &f ); |
78 | s.readLine(); | 77 | s.readLine(); |
79 | s.readLine(); | 78 | s.readLine(); |
80 | while ( !s.atEnd() ) | 79 | while ( !s.atEnd() ) |
81 | { | 80 | { |
82 | s >> str; | 81 | s >> str; |
83 | str.truncate( str.find( ':' ) ); | 82 | str.truncate( str.find( ':' ) ); |
84 | qDebug( "OSoundSystem: found interface '%s'", (const char*) str ); | 83 | qDebug( "OSoundSystem: found interface '%s'", (const char*) str ); |
85 | OAudioInterface* iface; | 84 | OAudioInterface* iface; |
86 | iface = new OAudioInterface( this, (const char*) str ); | 85 | iface = new OAudioInterface( this, (const char*) str ); |
87 | 86 | ||
88 | _interfaces.insert( str, iface ); | 87 | _interfaces.insert( str, iface ); |
89 | s.readLine(); | 88 | s.readLine(); |
90 | } | 89 | } |
91 | */ | 90 | */ |
92 | } | 91 | } |
93 | 92 | ||
94 | 93 | ||
95 | int OSoundSystem::count() const | 94 | int OSoundSystem::count() const |
96 | { | 95 | { |
97 | return _interfaces.count(); | 96 | return _interfaces.count(); |
98 | } | 97 | } |
99 | 98 | ||
100 | 99 | ||
101 | OSoundCard* OSoundSystem::card( const QString& iface ) const | 100 | OSoundCard* OSoundSystem::card( const QString& iface ) const |
102 | { | 101 | { |
103 | return _interfaces[iface]; | 102 | return _interfaces[iface]; |
104 | } | 103 | } |
105 | 104 | ||
106 | 105 | ||
107 | OSoundSystem* OSoundSystem::instance() | 106 | OSoundSystem* OSoundSystem::instance() |
108 | { | 107 | { |
109 | if ( !_instance ) _instance = new OSoundSystem(); | 108 | if ( !_instance ) _instance = new OSoundSystem(); |
110 | return _instance; | 109 | return _instance; |
111 | } | 110 | } |
112 | 111 | ||
113 | 112 | ||
114 | OSoundSystem::CardIterator OSoundSystem::iterator() const | 113 | OSoundSystem::CardIterator OSoundSystem::iterator() const |
115 | { | 114 | { |
116 | return OSoundSystem::CardIterator( _interfaces ); | 115 | return OSoundSystem::CardIterator( _interfaces ); |
117 | } | 116 | } |
118 | 117 | ||
119 | 118 | ||
120 | /*====================================================================================== | 119 | /*====================================================================================== |
121 | * OSoundCard | 120 | * OSoundCard |
122 | *======================================================================================*/ | 121 | *======================================================================================*/ |
123 | 122 | ||
124 | OSoundCard::OSoundCard( QObject* parent, const char* name ) | 123 | OSoundCard::OSoundCard( QObject* parent, const char* name ) |
125 | :QObject( parent, name ), _audio( 0 ), _mixer( 0 ) | 124 | :QObject( parent, name ), _audio( 0 ), _mixer( 0 ) |
126 | { | 125 | { |
127 | odebug << "OSoundCard::OSoundCard()" << oendl; | 126 | odebug << "OSoundCard::OSoundCard()" << oendl; |
128 | init(); | 127 | init(); |
129 | } | 128 | } |
130 | 129 | ||
131 | 130 | ||
132 | OSoundCard::~OSoundCard() | 131 | OSoundCard::~OSoundCard() |
133 | { | 132 | { |
134 | } | 133 | } |
135 | 134 | ||
136 | 135 | ||
137 | void OSoundCard::init() | 136 | void OSoundCard::init() |
138 | { | 137 | { |
139 | _audio = new OAudioInterface( this, "/dev/dsp" ); | 138 | _audio = new OAudioInterface( this, "/dev/dsp" ); |
140 | _mixer = new OMixerInterface( this, "/dev/mixer" ); | 139 | _mixer = new OMixerInterface( this, "/dev/mixer" ); |
141 | } | 140 | } |
142 | 141 | ||
143 | 142 | ||
144 | /*====================================================================================== | 143 | /*====================================================================================== |
145 | * OAudioInterface | 144 | * OAudioInterface |
146 | *======================================================================================*/ | 145 | *======================================================================================*/ |
147 | 146 | ||
148 | OAudioInterface::OAudioInterface( QObject* parent, const char* name ) | 147 | OAudioInterface::OAudioInterface( QObject* parent, const char* name ) |
149 | :QObject( parent, name ) | 148 | :QObject( parent, name ) |
150 | { | 149 | { |
151 | odebug << "OAudioInterface::OAudioInterface()" << oendl; | 150 | odebug << "OAudioInterface::OAudioInterface()" << oendl; |
152 | init(); | 151 | init(); |
153 | } | 152 | } |
154 | 153 | ||
155 | 154 | ||
156 | OAudioInterface::~OAudioInterface() | 155 | OAudioInterface::~OAudioInterface() |
157 | { | 156 | { |
158 | } | 157 | } |
159 | 158 | ||
160 | 159 | ||
161 | void OAudioInterface::init() | 160 | void OAudioInterface::init() |
162 | { | 161 | { |
163 | 162 | ||
164 | 163 | ||
165 | } | 164 | } |
166 | 165 | ||
167 | 166 | ||
168 | /*====================================================================================== | 167 | /*====================================================================================== |
169 | * OMixerInterface | 168 | * OMixerInterface |
170 | *======================================================================================*/ | 169 | *======================================================================================*/ |
171 | 170 | ||