Commit 4e4fb23f authored by atraczyk's avatar atraczyk

portaudiolayer: replace handleError with ring debug macros

- Removes the handleError member function in the PortAudioLayer class, and
  replaces it's usage with ring debug macros to report the appropriate
  line numbers during error reporting in portaudiolayer.cpp.

Change-Id: Ibdfffbfabdb985d249813895a84cc2d1266e68f3
Tuleap: #791
parent 294db6bc
......@@ -65,7 +65,7 @@ PortAudioLayer::getAudioDeviceIndex(const std::string& name,
numDevices = Pa_GetDeviceCount();
if (numDevices < 0)
this->handleError(numDevices);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(numDevices));
else {
const PaDeviceInfo *deviceInfo;
for (int i = 0; i < numDevices; i++) {
......@@ -127,11 +127,11 @@ PortAudioLayer::stopStream()
for (int i = 0; i < Direction::End; i++) {
auto err = Pa_StopStream(streams[i]);
if(err != paNoError)
this->handleError(err);
RING_ERR("Pa_StopStream error : %s", Pa_GetErrorText(err));
err = Pa_CloseStream(streams[i]);
if (err != paNoError)
this->handleError(err);
RING_ERR("Pa_StopStream error : %s", Pa_GetErrorText(err));
}
{
......@@ -186,7 +186,7 @@ PortAudioLayer::getDeviceByType(const bool& playback) const
numDevices = Pa_GetDeviceCount();
if (numDevices < 0)
this->handleError(numDevices);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(numDevices));
else {
for (int i = 0; i < numDevices; i++) {
const auto deviceInfo = Pa_GetDeviceInfo(i);
......@@ -338,20 +338,13 @@ PortAudioLayer::paInputCallback(const void *inputBuffer, void *outputBuffer,
return paContinue;
}
// PRIVATE METHOD
void
PortAudioLayer::handleError(const PaError& err) const
{
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(err));
}
void
PortAudioLayer::init()
{
RING_DBG("Init PortAudioLayer");
const auto err = Pa_Initialize();
if (err != paNoError) {
this->handleError(err);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(err));
this->terminate();
}
......@@ -388,7 +381,7 @@ PortAudioLayer::terminate() const
RING_DBG("PortAudioLayer terminate.");
const auto err = Pa_Terminate();
if (err != paNoError)
this->handleError(err);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(err));
}
void
......@@ -421,7 +414,7 @@ PortAudioLayer::initStream()
&PortAudioLayer::paOutputCallback,
this);
if(err != paNoError)
this->handleError(err);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(err));
}
RING_DBG("Open PortAudio Input Stream");
......@@ -448,7 +441,7 @@ PortAudioLayer::initStream()
&PortAudioLayer::paInputCallback,
this);
if(err != paNoError)
this->handleError(err);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(err));
}
RING_DBG("Start PortAudio Streams");
......@@ -456,7 +449,7 @@ PortAudioLayer::initStream()
if (streams[i]) {
auto err = Pa_StartStream(streams[i]);
if (err != paNoError)
this->handleError(err);
RING_ERR("PortAudioLayer error : %s", Pa_GetErrorText(err));
}
}
......
......@@ -60,7 +60,6 @@ public:
private:
NON_COPYABLE(PortAudioLayer);
void handleError(const PaError& err) const;
void init(void);
void terminate(void) const;
void initStream(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment