diff audioio/AudioPortAudioTarget.cpp @ 114:ccdc5b30e54c

* Remove PAv18 support, change PORTAUDIO to PORTAUDIO_2_0 throughout as this is what comes from PAv19's pkgconfig module name
author Chris Cannam
date Fri, 09 May 2008 15:39:42 +0000
parents e177e6ee7c12
children 4c9c04645685
line wrap: on
line diff
--- a/audioio/AudioPortAudioTarget.cpp	Thu May 08 14:46:22 2008 +0000
+++ b/audioio/AudioPortAudioTarget.cpp	Fri May 09 15:39:42 2008 +0000
@@ -13,7 +13,7 @@
     COPYING included with this distribution for more information.
 */
 
-#ifdef HAVE_PORTAUDIO
+#ifdef HAVE_PORTAUDIO_2_0
 
 #include "AudioPortAudioTarget.h"
 #include "AudioCallbackPlaySource.h"
@@ -35,12 +35,8 @@
     PaError err;
 
 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET
-#ifdef HAVE_PORTAUDIO_V18
-    std::cerr << "AudioPortAudioTarget: Initialising for PortAudio v18" << std::endl;
-#else
     std::cerr << "AudioPortAudioTarget: Initialising for PortAudio v19" << std::endl;
 #endif
-#endif
 
     err = Pa_Initialize();
     if (err != paNoError) {
@@ -54,15 +50,6 @@
 	m_sampleRate = m_source->getSourceSampleRate();
     }
 
-#ifdef HAVE_PORTAUDIO_V18
-    m_latency = Pa_GetMinNumBuffers(m_bufferSize, m_sampleRate) * m_bufferSize;
-#endif
-
-#ifdef HAVE_PORTAUDIO_V18
-    err = Pa_OpenDefaultStream(&m_stream, 0, 2, paFloat32,
-			       m_sampleRate, m_bufferSize, 0,
-			       processStatic, this);
-#else
     PaStreamParameters op;
     op.device = Pa_GetDefaultOutputDevice();
     op.channelCount = 2;
@@ -72,9 +59,7 @@
     err = Pa_OpenStream(&m_stream, 0, &op, m_sampleRate,
                         paFramesPerBufferUnspecified,
                         paNoFlag, processStatic, this);
-#endif    
 
-#ifndef HAVE_PORTAUDIO_V18
     if (err != paNoError) {
 
         std::cerr << "WARNING: AudioPortAudioTarget: Failed to open PortAudio stream with default frames per buffer, trying again with fixed frames per buffer..." << std::endl;
@@ -84,7 +69,6 @@
                             paNoFlag, processStatic, this);
 	m_bufferSize = 1024;
     }
-#endif
 
     if (err != paNoError) {
 	std::cerr << "ERROR: AudioPortAudioTarget: Failed to open PortAudio stream: " << Pa_GetErrorText(err) << std::endl;
@@ -93,11 +77,9 @@
 	return;
     }
 
-#ifndef HAVE_PORTAUDIO_V18
     const PaStreamInfo *info = Pa_GetStreamInfo(m_stream);
     m_latency = int(info->outputLatency * m_sampleRate + 0.001);
     if (m_bufferSize < m_latency) m_bufferSize = m_latency;
-#endif
 
     std::cerr << "PortAudio latency = " << m_latency << " frames" << std::endl;
 
@@ -175,16 +157,6 @@
     else return Pa_GetStreamTime(m_stream);
 }
 
-#ifdef HAVE_PORTAUDIO_V18
-int
-AudioPortAudioTarget::processStatic(void *input, void *output,
-				    unsigned long nframes,
-				    PaTimestamp outTime, void *data)
-{
-    return ((AudioPortAudioTarget *)data)->process(input, output,
-						   nframes, outTime);
-}
-#else
 int
 AudioPortAudioTarget::processStatic(const void *input, void *output,
                                     unsigned long nframes,
@@ -195,7 +167,6 @@
                                                    nframes, timeInfo,
                                                    flags);
 }
-#endif
 
 void
 AudioPortAudioTarget::sourceModelReplaced()
@@ -203,18 +174,11 @@
     m_source->setTargetSampleRate(m_sampleRate);
 }
 
-#ifdef HAVE_PORTAUDIO_V18
-int
-AudioPortAudioTarget::process(void *inputBuffer, void *outputBuffer,
-			      unsigned long nframes,
-			      PaTimestamp)
-#else
 int
 AudioPortAudioTarget::process(const void *, void *outputBuffer,
                               unsigned long nframes,
                               const PaStreamCallbackTimeInfo *,
                               PaStreamCallbackFlags)
-#endif
 {
 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET    
     std::cout << "AudioPortAudioTarget::process(" << nframes << ")" << std::endl;