Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
prism/extern/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx

42 lines
995 B
C++
Raw Normal View History

2020-08-11 12:07:21 -04:00
#include "portaudiocpp/CFunCallbackStream.hxx"
#include "portaudiocpp/StreamParameters.hxx"
#include "portaudiocpp/Exception.hxx"
namespace portaudio
{
CFunCallbackStream::CFunCallbackStream()
{
}
CFunCallbackStream::CFunCallbackStream(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData)
{
open(parameters, funPtr, userData);
}
CFunCallbackStream::~CFunCallbackStream()
{
try
{
close();
}
catch (...)
{
// ignore all errors
}
}
// ---------------------------------------------------------------------------------==
void CFunCallbackStream::open(const StreamParameters &parameters, 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);
}
}
}