1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
<html>
<head>
<title>Camstream: CamStream API documentation</title>
<link rel="stylesheet" href="../../tech.css" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.3.7 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<h1>AudioDevice.h</h1><a href="_audio_device_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* audiodevs: Abstraction layer for audio hardware & samples</span>
00002 <span class="comment"> Copyright (C) 2003-2004 Nemosoft Unv.</span>
00003 <span class="comment"></span>
00004 <span class="comment"> This program is free software; you can redistribute it and/or modify</span>
00005 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
00006 <span class="comment"> the Free Software Foundation; either version 2 of the License, or</span>
00007 <span class="comment"> (at your option) any later version.</span>
00008 <span class="comment"></span>
00009 <span class="comment"> This program is distributed in the hope that it will be useful,</span>
00010 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00011 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
00012 <span class="comment"> GNU General Public License for more details.</span>
00013 <span class="comment"></span>
00014 <span class="comment"> You should have received a copy of the GNU General Public License</span>
00015 <span class="comment"> along with this program; if not, write to the Free Software</span>
00016 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
00017 <span class="comment"></span>
00018 <span class="comment"> For questions, remarks, patches, etc. for this program, the author can be</span>
00019 <span class="comment"> reached at camstream@smcc.demon.nl.</span>
00020 <span class="comment">*/</span>
00021
00022 <span class="preprocessor">#ifndef AUDIODEVICE_HPP</span>
00023 <span class="preprocessor"></span><span class="preprocessor">#define AUDIODEVICE_HPP</span>
00024 <span class="preprocessor"></span>
00025 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
00026 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span>
00027 <span class="preprocessor">#endif</span>
00028 <span class="preprocessor"></span>
00029 <span class="preprocessor">#include <qglobal.h></span>
00030
00031 <span class="preprocessor">#if (QT_VERSION >= 0x030000)</span>
00032 <span class="preprocessor"></span><span class="preprocessor">#include <qmutex.h></span>
00033 <span class="preprocessor">#endif</span>
00034 <span class="preprocessor"></span>
00035 <span class="preprocessor">#include <qdom.h></span>
00036 <span class="preprocessor">#include <qobject.h></span>
00037 <span class="preprocessor">#include <qthread.h></span>
00038
00039 <span class="preprocessor">#include "<a class="code" href="_audio_ring_buffer_8h.html">AudioRingBuffer.h</a>"</span>
00040 <span class="preprocessor">#include "<a class="code" href="_sound_attributes_8h.html">SoundAttributes.h</a>"</span>
00041
<a name="l00042"></a><a class="code" href="class_c_audio_device.html">00042</a> <span class="keyword">class </span><a class="code" href="class_c_audio_device.html">CAudioDevice</a>: <span class="keyword">public</span> QObject, <span class="keyword">public</span> QThread
00043 {
00044 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_c_audio_collector.html">CAudioCollector</a>;
00045 Q_OBJECT
00046 <span class="keyword">public</span>:
<a name="l00047"></a><a class="code" href="class_c_audio_device.html#w2">00047</a> <span class="keyword">enum</span> <a class="code" href="class_c_audio_device.html#w2">Mode</a> { <a class="code" href="class_c_audio_device.html#w2w0">Capture</a>, <a class="code" href="class_c_audio_device.html#w2w1">Playback</a> };
00048
00049 <span class="keyword">private</span>:
00050 Mode m_Mode;
00051 <span class="keywordtype">int</span> m_OpenCount;
00052 <span class="keywordtype">int</span> m_CaptureCount, m_PlaybackCount;
00053
00054 <span class="keyword">private</span> slots:
00055 <span class="keywordtype">void</span> EnableCapture();
00056 <span class="keywordtype">void</span> DisableCapture();
00057 <span class="keywordtype">void</span> EnablePlayback();
00058 <span class="keywordtype">void</span> DisablePlayback();
00059
00060 <span class="keyword">protected</span>:
<a name="l00061"></a><a class="code" href="class_c_audio_device.html#p0">00061</a> QString <a class="code" href="class_c_audio_device.html#p0">m_ShortName</a>, <a class="code" href="class_c_audio_device.html#p1">m_LongName</a>;
<a name="l00062"></a><a class="code" href="class_c_audio_device.html#p2">00062</a> QString <a class="code" href="class_c_audio_device.html#p2">m_NodeName</a>;
<a name="l00063"></a><a class="code" href="class_c_audio_device.html#p3">00063</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_audio_device.html#p3">m_Validated</a>;
00064
<a name="l00065"></a><a class="code" href="class_c_audio_device.html#p4">00065</a> <a class="code" href="struct_sound_attributes.html">SoundAttributes</a> <a class="code" href="class_c_audio_device.html#p4">m_CurrentSoundAttr</a>;
<a name="l00066"></a><a class="code" href="class_c_audio_device.html#p6">00066</a> <a class="code" href="class_c_ring_buffer.html">CRingBuffer</a> <a class="code" href="class_c_audio_device.html#p5">m_CaptureBuffer</a>, <a class="code" href="class_c_audio_device.html#p6">m_PlaybackBuffer</a>;
00067
00068 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_audio_device.html#b0">Init</a>() = 0;
00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_audio_device.html#b1">Exit</a>() = 0;
00070
00071 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_c_audio_device.html#b2">StartCapture</a>() = 0;
00072 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_audio_device.html#b3">StopCapture</a>() = 0;
00073 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_c_audio_device.html#b4">StartPlayback</a>() = 0;
00074 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_audio_device.html#b5">StopPlayback</a>() = 0;
00075
<a name="l00076"></a><a class="code" href="class_c_audio_device.html#b6">00076</a> <a class="code" href="class_c_audio_device.html#w2">Mode</a> <a class="code" href="class_c_audio_device.html#b6">GetMode</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Mode; };
<a name="l00077"></a><a class="code" href="class_c_audio_device.html#b7">00077</a> <span class="keywordtype">int</span> <a class="code" href="class_c_audio_device.html#b7">GetCaptureCount</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_CaptureCount; };
<a name="l00078"></a><a class="code" href="class_c_audio_device.html#b8">00078</a> <span class="keywordtype">int</span> <a class="code" href="class_c_audio_device.html#b8">GetPlaybackCount</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PlaybackCount; };
00079
00080 <span class="keyword">public</span>:
00081 <a class="code" href="class_c_audio_device.html#a0">CAudioDevice</a>();
00082 <span class="keyword">virtual</span> <a class="code" href="class_c_audio_device.html#a1">~CAudioDevice</a>();
00083
00084 QString <a class="code" href="class_c_audio_device.html#a2">GetName</a>() const;
00085 QString GetLongName() const;
00086 QString GetNodeName() const;
00087
00088 <span class="keywordtype">bool</span> IsValid() const;
00089 <span class="keywordtype">bool</span> Open(Mode m);
00090 <span class="keywordtype">void</span> Close();
00091 <span class="keywordtype">bool</span> IsOpen() const;
00092
00093 <span class="keywordtype">bool</span> SetSoundAttributes(const <a class="code" href="struct_sound_attributes.html">SoundAttributes</a> &);
00094 SoundAttributes GetSoundAttributes() const;
00095
00096 <a class="code" href="class_c_audio_ring_buffer_reader.html">CAudioRingBufferReader</a> *CreateReader();
00097 <a class="code" href="class_c_ring_buffer_writer.html">CRingBufferWriter</a> *CreateWriter();
00098
00099 virtual <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetPlaybackPointer() const = 0;
00100
00101 virtual <span class="keywordtype">void</span> SetBufferLength(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chunk_length = 0) = 0;
00102 virtual <span class="keywordtype">void</span> SetBufferTime(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ms, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chunk_length = 0) = 0;
00103 <span class="comment">// virtual int WriteDirectly(const void *, unsigned int len) = 0;</span>
00104
00106 virtual <span class="keywordtype">void</span> ShowMixerControls() = 0;
00107
00108 virtual <span class="keywordtype">void</span> GetMixerSettings(QDomNode &) const = 0;
00109 virtual <span class="keywordtype">void</span> SetMixerSettings(const QDomNode &) const = 0;
00110
00111 signals:
00112 <span class="keywordtype">void</span> Opened();
00113 <span class="keywordtype">void</span> Closed();
00114
00123 <span class="keywordtype">void</span> SoundAttributesChanged(const SoundAttributes &);
00124 };
00125
00126
00127 #endif
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Wed Dec 13 23:38:46 2006 for CamStream by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address>
</body>
</html>
|