Home
Information
Classes
Download
Usage
Mail List
Requirements
Links
FAQ
Tutorial
include
RtWvIn.h
1
#ifndef STK_RTWVIN_H
2
#define STK_RTWVIN_H
3
4
#include "WvIn.h"
5
#include "
RtAudio.h
"
6
#include "Mutex.h"
7
8
namespace
stk {
9
10
/***************************************************/
29
/***************************************************/
30
31
class
RtWvIn
:
public
WvIn
32
{
33
public
:
35
42
RtWvIn
(
unsigned
int
nChannels = 1, StkFloat
sampleRate
=
Stk::sampleRate
(),
43
int
device = 0,
int
bufferFrames = RT_BUFFER_SIZE,
int
nBuffers = 20 );
44
46
~RtWvIn
();
47
49
53
void
start
(
void
);
54
56
60
void
stop
(
void
);
61
63
72
StkFloat
lastOut
(
unsigned
int
channel = 0 );
73
75
84
StkFloat
tick
(
unsigned
int
channel = 0 );
85
87
94
StkFrames
&
tick
(
StkFrames
& frames );
95
96
// This function is not intended for general use but must be
97
// public for access from the audio callback function.
98
void
fillBuffer(
void
*buffer,
unsigned
int
nFrames );
99
100
protected
:
101
102
RtAudio
adc_;
103
Mutex
mutex_;
104
bool
stopped_;
105
unsigned
int
readIndex_;
106
unsigned
int
writeIndex_;
107
unsigned
int
framesFilled_;
108
109
};
110
111
inline
StkFloat
RtWvIn :: lastOut
(
unsigned
int
channel )
112
{
113
#if defined(_STK_DEBUG_)
114
if
( channel >= data_.
channels
() ) {
115
oStream_ <<
"RtWvIn::lastOut(): channel argument and audio stream are incompatible!"
;
116
handleError
( StkError::FUNCTION_ARGUMENT );
117
}
118
#endif
119
120
return
lastFrame_[channel];
121
}
122
123
}
// stk namespace
124
125
#endif
The Synthesis ToolKit in C++ (STK)
©1995--2014 Perry R. Cook and Gary P. Scavone. All Rights Reserved.