blob: 9cceda9ab9ef69463a26e9684b9cc0bbb30cd381 (
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
|
#include "portaudiocpp/CFunCallbackStream.hxx"
#include "portaudiocpp/StreamParameters.hxx"
#include "portaudiocpp/Exception.hxx"
namespace portaudio
{
CFunCallbackStream::CFunCallbackStream()
{
}
CFunCallbackStream::CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
{
open(parameters, funPtr, userData);
}
CFunCallbackStream::~CFunCallbackStream()
{
try
{
close();
}
catch (...)
{
// ignore all errors
}
}
// ---------------------------------------------------------------------------------==
void CFunCallbackStream::open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
{
PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData);
if (err != paNoError)
{
throw PaException(err);
}
}
}
|