annotate audioio/AudioTargetFactory.cpp @ 122:ab861544f998

* Comment out problematic test -- sincerequest_t always seemed to be zero when this line was reached, so the pointer was often getting stuck if you asked to play a loop that had been drawn to the left of the position the pointer was at when you then tried to play it
author Chris Cannam
date Fri, 06 Jun 2008 10:32:50 +0000
parents 2bc8bf6d016c
children d615d0220828
rev   line source
Chris@43 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@43 2
Chris@43 3 /*
Chris@43 4 Sonic Visualiser
Chris@43 5 An audio file viewer and annotation editor.
Chris@43 6 Centre for Digital Music, Queen Mary, University of London.
Chris@43 7 This file copyright 2006 Chris Cannam.
Chris@43 8
Chris@43 9 This program is free software; you can redistribute it and/or
Chris@43 10 modify it under the terms of the GNU General Public License as
Chris@43 11 published by the Free Software Foundation; either version 2 of the
Chris@43 12 License, or (at your option) any later version. See the file
Chris@43 13 COPYING included with this distribution for more information.
Chris@43 14 */
Chris@43 15
Chris@43 16 #include "AudioTargetFactory.h"
Chris@43 17
Chris@43 18 #include "AudioJACKTarget.h"
Chris@43 19 #include "AudioCoreAudioTarget.h"
Chris@43 20 #include "AudioPortAudioTarget.h"
Chris@117 21 #include "AudioPulseAudioTarget.h"
Chris@43 22
Chris@43 23 #include <iostream>
Chris@43 24
Chris@43 25 AudioCallbackPlayTarget *
Chris@43 26 AudioTargetFactory::createCallbackTarget(AudioCallbackPlaySource *source)
Chris@43 27 {
Chris@43 28 AudioCallbackPlayTarget *target = 0;
Chris@43 29
Chris@43 30 #ifdef HAVE_JACK
Chris@43 31 target = new AudioJACKTarget(source);
Chris@43 32 if (target->isOK()) return target;
Chris@43 33 else {
Chris@43 34 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open JACK target" << std::endl;
Chris@43 35 delete target;
Chris@43 36 }
Chris@43 37 #endif
Chris@117 38
Chris@117 39 #ifdef HAVE_LIBPULSE
Chris@117 40 target = new AudioPulseAudioTarget(source);
Chris@117 41 if (target->isOK()) return target;
Chris@117 42 else {
Chris@117 43 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open PulseAudio target" << std::endl;
Chris@117 44 delete target;
Chris@117 45 }
Chris@117 46 #endif
Chris@43 47
Chris@43 48 #ifdef HAVE_COREAUDIO
Chris@43 49 target = new AudioCoreAudioTarget(source);
Chris@43 50 if (target->isOK()) return target;
Chris@43 51 else {
Chris@43 52 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open CoreAudio target" << std::endl;
Chris@43 53 delete target;
Chris@43 54 }
Chris@43 55 #endif
Chris@43 56
Chris@43 57 #ifdef HAVE_DIRECTSOUND
Chris@43 58 target = new AudioDirectSoundTarget(source);
Chris@43 59 if (target->isOK()) return target;
Chris@43 60 else {
Chris@43 61 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open DirectSound target" << std::endl;
Chris@43 62 delete target;
Chris@43 63 }
Chris@43 64 #endif
Chris@114 65
Chris@114 66 #ifdef HAVE_PORTAUDIO_2_0
Chris@43 67 target = new AudioPortAudioTarget(source);
Chris@43 68 if (target->isOK()) return target;
Chris@43 69 else {
Chris@43 70 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open PortAudio target" << std::endl;
Chris@43 71 delete target;
Chris@43 72 }
Chris@43 73 #endif
Chris@43 74
Chris@43 75 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: No suitable targets available" << std::endl;
Chris@43 76 return 0;
Chris@43 77 }
Chris@43 78
Chris@43 79