summaryrefslogtreecommitdiff
path: root/libopie2/opiemm/osoundsystem.cpp
Unidiff
Diffstat (limited to 'libopie2/opiemm/osoundsystem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/osoundsystem.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp
index fd23bea..d857659 100644
--- a/libopie2/opiemm/osoundsystem.cpp
+++ b/libopie2/opiemm/osoundsystem.cpp
@@ -1,89 +1,90 @@
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 33
34#include <errno.h> 34#include <errno.h>
35#include <fcntl.h> 35#include <fcntl.h>
36#include <string.h> 36#include <string.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38#include <sys/types.h> 38#include <sys/types.h>
39#include <sys/soundcard.h> 39#include <sys/soundcard.h>
40#include <sys/stat.h> 40#include <sys/stat.h>
41 41
42#include <qstringlist.h>
42 43
43/*====================================================================================== 44/*======================================================================================
44 * OSoundSystem 45 * OSoundSystem
45 *======================================================================================*/ 46 *======================================================================================*/
46 47
47OSoundSystem* OSoundSystem::_instance = 0; 48OSoundSystem* OSoundSystem::_instance = 0;
48 49
49OSoundSystem::OSoundSystem() 50OSoundSystem::OSoundSystem()
50{ 51{
51 qDebug( "OSoundSystem::OSoundSystem()" ); 52 qDebug( "OSoundSystem::OSoundSystem()" );
52 synchronize(); 53 synchronize();
53} 54}
54 55
55void OSoundSystem::synchronize() 56void OSoundSystem::synchronize()
56{ 57{
57 // gather available interfaces by inspecting /dev 58 // gather available interfaces by inspecting /dev
58 //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
59 //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
60 61
61 _interfaces.clear(); 62 _interfaces.clear();
62 _interfaces.insert( "soundcard", new OSoundCard( this, "soundcard" ) ); 63 _interfaces.insert( "soundcard", new OSoundCard( this, "soundcard" ) );
63 64
64 65
65 /* 66 /*
66 67
67 68
68 69
69 70
70 QString str; 71 QString str;
71 QFile f( "/dev/sound" ); 72 QFile f( "/dev/sound" );
72 bool hasFile = f.open( IO_ReadOnly ); 73 bool hasFile = f.open( IO_ReadOnly );
73 if ( !hasFile ) 74 if ( !hasFile )
74 { 75 {
75 qDebug( "OSoundSystem: /dev/sound not existing. No sound devices available" ); 76 qDebug( "OSoundSystem: /dev/sound not existing. No sound devices available" );
76 return; 77 return;
77 } 78 }
78 QTextStream s( &f ); 79 QTextStream s( &f );
79 s.readLine(); 80 s.readLine();
80 s.readLine(); 81 s.readLine();
81 while ( !s.atEnd() ) 82 while ( !s.atEnd() )
82 { 83 {
83 s >> str; 84 s >> str;
84 str.truncate( str.find( ':' ) ); 85 str.truncate( str.find( ':' ) );
85 qDebug( "OSoundSystem: found interface '%s'", (const char*) str ); 86 qDebug( "OSoundSystem: found interface '%s'", (const char*) str );
86 OAudioInterface* iface; 87 OAudioInterface* iface;
87 iface = new OAudioInterface( this, (const char*) str ); 88 iface = new OAudioInterface( this, (const char*) str );
88 89
89 _interfaces.insert( str, iface ); 90 _interfaces.insert( str, iface );