summaryrefslogtreecommitdiff
path: root/examples/opiemm
Unidiff
Diffstat (limited to 'examples/opiemm') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp b/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp
index f74a1b9..b18d719 100644
--- a/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp
+++ b/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp
@@ -1,66 +1,72 @@
1/* 1/*
2 =. This file is part of the Opie Project 2 =. This file is part of the Opie Project
3 .=l. Copyright (C) 2004 Opie Team <opie-devel@handhelds.org> 3 .=l. Copyright (C) 2004 Opie Team <opie-devel@handhelds.org>
4 .>+-= 4 .>+-=
5 _;:, .> :=|. This library is free software; you can 5 _;:, .> :=|. This library is free software; you can
6.> <`_, > . <= redistribute it and/or modify it under 6.> <`_, > . <= redistribute it and/or modify it under
7:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 7:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
8.="- .-=="i, .._ License as published by the Free Software 8.="- .-=="i, .._ License as published by the Free Software
9 - . .-<_> .<> Foundation; either version 2 of the License, 9 - . .-<_> .<> Foundation; either version 2 of the License,
10 ._= =} : or (at your option) any later version. 10 ._= =} : or (at your option) any later version.
11 .%`+i> _;_. 11 .%`+i> _;_.
12 .i_,=:_. -<s. This library is distributed in the hope that 12 .i_,=:_. -<s. This library is distributed in the hope that
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14 : .. .:, . . . without even the implied warranty of 14 : .. .:, . . . without even the implied warranty of
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.= = ; Library General Public License for more 17..}^=.= = ; Library General Public License for more
18++= -. .` .: details. 18++= -. .` .: details.
19 : = ...= . :.=- 19 : = ...= . :.=-
20 -. .:....=;==+<; You should have received a copy of the GNU 20 -. .:....=;==+<; You should have received a copy of the GNU
21 -_. . . )=. = Library General Public License along with 21 -_. . . )=. = Library General Public License along with
22 -- :-=` this library; see the file COPYING.LIB. 22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29/* OPIE */ 29/* OPIE */
30#include <opie2/osoundsystem.h> 30#include <opie2/osoundsystem.h>
31#include <opie2/odebug.h> 31#include <opie2/odebug.h>
32 32
33using namespace Opie::MM; 33using namespace Opie::MM;
34 34
35int main( int argc, char** argv ) 35int main( int argc, char** argv )
36{ 36{
37 odebug << "OPIE Sound System Demo" << oendl; 37 odebug << "OPIE Sound System Demo" << oendl;
38 38
39 OSoundSystem* sound = OSoundSystem::instance(); 39 OSoundSystem* sound = OSoundSystem::instance();
40 40
41 OSoundSystem::CardIterator it = sound->iterator(); 41 OSoundSystem::CardIterator it = sound->iterator();
42/* 42/*
43 while ( it.current() ) 43 while ( it.current() )
44 { 44 {
45 odebug << "DEMO: OSoundSystem contains Interface '" << it.current()->name() << "'" << oendl; 45 odebug << "DEMO: OSoundSystem contains Interface '" << it.current()->name() << "'" << oendl;
46 ++it; 46 ++it;
47 } 47 }
48 48
49*/ 49*/
50 OSoundCard* card = it.current(); 50 OSoundCard* card = it.current();
51
52 OMixerInterface* mixer = card->mixer(); 51 OMixerInterface* mixer = card->mixer();
52 odebug << "This device " << ( mixer->hasMultipleRecording() ? "does" : "does not" ) << " feature multiple recording sources." << oendl;
53 53
54 QStringList channels = mixer->allChannels(); 54 QStringList channels = mixer->allChannels();
55 55
56 for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it ) 56 for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it )
57 { 57 {
58 bool stereo = mixer->isStereo( *it ); 58 bool stereo = mixer->isStereo( *it );
59 odebug << "OSSDEMO: Mixer has channel " << *it << ( stereo ? "[stereo]" : "[mono]" ) << oendl; 59 bool recsrc = mixer->isRecordable( *it );
60 odebug << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff ) 60 QString line = "OSSDEMO: Mixer has channel " + *it + " ";
61 << " (left) | " << ( mixer->volume( *it ) >> 8 ) << " (right)" << oendl; 61 line = line.leftJustify( 50 ) + ( stereo ? "[stereo]" : "[mono]" );
62 line = line.leftJustify( 60 ) + ( recsrc ? "[recsrc]" : "[ ]" );
63 line = line.leftJustify( 70 );
64 line += " [ " + QString::number( mixer->volume( *it ) & 0xff ).rightJustify( 3 );
65 if ( stereo ) line += " | " + QString::number( mixer->volume( *it ) >> 8 ).rightJustify( 3 );
66 line += " ]";
67 odebug << line << oendl;
62 } 68 }
63 69
64 return 0; 70 return 0;
65 71
66} 72}