summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer_v1.0/doc/html/sample_8hcc-source.html
blob: f7ee92e8d897eb07e27491c67c10b220dcdfda99 (plain)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Graphic Equalizer: C:/Project  Marcel &amp; Oliver/Graphic_Equalizer/src/sample.hcc Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="globals.html">Globals</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">C:</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">Project  Marcel &amp; Oliver</a>&nbsp;/&nbsp;<a class="el" href="dir_000002.html">Graphic_Equalizer</a>&nbsp;/&nbsp;<a class="el" href="dir_000004.html">src</a></div>
<h1>sample.hcc</h1><a href="sample_8hcc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 
00019 <span class="comment">/******** System Includes *************/</span>
00020 
00021 <span class="comment">/******** Application Includes ********/</span>
00022 <span class="preprocessor">#include "<a class="code" href="sample_8hch.html">sample.hch</a>"</span>
00023 
00024 
00025 
00026 <span class="comment">/*</span>
00027 <span class="comment"> * Pointer that points towards the current 64 bits samples.</span>
00028 <span class="comment"> */</span>
00029 <span class="keywordtype">signed</span> 16 *audio_in_ptr;
00030 
00031 <span class="comment">/*</span>
00032 <span class="comment"> * 64 step counter to keep track of our samples. This is a private variable.</span>
00033 <span class="comment"> */</span>
00034 <span class="keywordtype">unsigned</span> 8 sample_count;
00035 
00036 
00037 
<a name="l00046"></a><a class="code" href="sample_8hcc.html#a2">00046</a> <span class="keywordtype">void</span> <a class="code" href="sample_8hcc.html#a2">sample_add</a>(<span class="keywordtype">signed</span> 16 in_sample) {
00047         <span class="comment">/*</span>
00048 <span class="comment">         * We only sample 64 bits in our buffer, hence we circulate around the</span>
00049 <span class="comment">         * last 6 bits.</span>
00050 <span class="comment">         */</span>
00051         audio_in_ptr[sample_count &lt;-6] = in_sample;
00052         sample_count++;
00053 } <span class="comment">/* --- sample_add() --- */</span>
00054 
00055 
00056 
<a name="l00065"></a><a class="code" href="sample_8hcc.html#a3">00065</a> <span class="keywordtype">void</span> <a class="code" href="sample_8hcc.html#a3">sample_get</a>(<span class="keywordtype">signed</span> 16 *out_sample) {
00066         <span class="comment">/*</span>
00067 <span class="comment">         * We circulate around a 64 bits buffer, therefor we only use the last</span>
00068 <span class="comment">         *  6 bits.</span>
00069 <span class="comment">         */</span>
00070         *out_sample = audio_out_ptr[sample_count &lt;-6];
00071 } <span class="comment">/* --- sample_get() --- */</span>
00072 
00073 
00074 
<a name="l00084"></a><a class="code" href="sample_8hcc.html#a4">00084</a> <span class="keywordtype">unsigned</span> 1 <a class="code" href="sample_8hch.html#a2">sample_rotate_buffers</a>(<span class="keywordtype">void</span>) {
00085         <span class="keywordtype">unsigned</span> 1 retval;      <span class="comment">/* store for returnvalue */</span>
00086 
00087         retval = 0;
00088         <span class="comment">/*</span>
00089 <span class="comment">         * We only want to read 64 samples, but calculations work nicer if we</span>
00090 <span class="comment">         * use 256 samples. Therefor we circulate our audio pointer around.</span>
00091 <span class="comment">         */</span>
00092         <span class="keywordflow">if</span> (!(sample_count &lt;- 6)) {
00093                 <span class="comment">/*</span>
00094 <span class="comment">                 * 64 Samples have passed. We are back at '0'. Use the full</span>
00095 <span class="comment">                 * sample count as index which is 0 64 128 or 192 and back to</span>
00096 <span class="comment">                 * 0. Our Output is only 128 big so we only look at the</span>
00097 <span class="comment">                 * 7 LSB. Also, notify the main application that 64 samples</span>
00098 <span class="comment">                 * have been processed.</span>
00099 <span class="comment">                 */</span>
00100                 par {
00101                         audio_in_ptr = &amp;pcm_audio_in[sample_count];
00102                         audio_out_ptr = &amp;pcm_audio_out[(sample_count &lt;- 7)];
00103                         retval = 1;
00104                 }
00105         }
00106 } <span class="comment">/* --- sample_rotate_buffers() --- */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Nov 29 10:53:29 2004 for Graphic Equalizer by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
</body>
</html>