Mercurial > hg > sv-dependency-builds
comparison src/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx @ 4:e13257ea84a4
Add bzip2, zlib, liblo, portaudio sources
author | Chris Cannam |
---|---|
date | Wed, 20 Mar 2013 13:59:52 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:6c505a35919a | 4:e13257ea84a4 |
---|---|
1 #include "portaudiocpp/InterfaceCallbackStream.hxx" | |
2 | |
3 #include "portaudiocpp/StreamParameters.hxx" | |
4 #include "portaudiocpp/Exception.hxx" | |
5 #include "portaudiocpp/CallbackInterface.hxx" | |
6 | |
7 namespace portaudio | |
8 { | |
9 | |
10 // ---------------------------------------------------------------------------------== | |
11 | |
12 InterfaceCallbackStream::InterfaceCallbackStream() | |
13 { | |
14 } | |
15 | |
16 InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance) | |
17 { | |
18 open(parameters, instance); | |
19 } | |
20 | |
21 InterfaceCallbackStream::~InterfaceCallbackStream() | |
22 { | |
23 try | |
24 { | |
25 close(); | |
26 } | |
27 catch (...) | |
28 { | |
29 // ignore all errors | |
30 } | |
31 } | |
32 | |
33 // ---------------------------------------------------------------------------------== | |
34 | |
35 void InterfaceCallbackStream::open(const StreamParameters ¶meters, CallbackInterface &instance) | |
36 { | |
37 PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), | |
38 parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast<void *>(&instance)); | |
39 | |
40 if (err != paNoError) | |
41 { | |
42 throw PaException(err); | |
43 } | |
44 } | |
45 } |