annotate audioio/AudioTargetFactory.cpp @ 142:459045d6dfd6

* Add Mac .icns file
author Chris Cannam
date Wed, 02 May 2007 10:57:49 +0000
parents 00309c07f7a9
children
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 Sonic Visualiser
Chris@0 5 An audio file viewer and annotation editor.
Chris@0 6 Centre for Digital Music, Queen Mary, University of London.
Chris@0 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@0 9 This program is free software; you can redistribute it and/or
Chris@0 10 modify it under the terms of the GNU General Public License as
Chris@0 11 published by the Free Software Foundation; either version 2 of the
Chris@0 12 License, or (at your option) any later version. See the file
Chris@0 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #include "AudioTargetFactory.h"
Chris@0 17
Chris@0 18 #include "AudioJACKTarget.h"
Chris@0 19 #include "AudioCoreAudioTarget.h"
Chris@0 20 #include "AudioPortAudioTarget.h"
Chris@0 21
Chris@0 22 #include <iostream>
Chris@0 23
Chris@0 24 AudioCallbackPlayTarget *
Chris@0 25 AudioTargetFactory::createCallbackTarget(AudioCallbackPlaySource *source)
Chris@0 26 {
Chris@0 27 AudioCallbackPlayTarget *target = 0;
Chris@0 28
Chris@0 29 #ifdef HAVE_JACK
Chris@0 30 target = new AudioJACKTarget(source);
Chris@0 31 if (target->isOK()) return target;
Chris@0 32 else {
Chris@0 33 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open JACK target" << std::endl;
Chris@0 34 delete target;
Chris@0 35 }
Chris@0 36 #endif
Chris@0 37
Chris@0 38 #ifdef HAVE_COREAUDIO
Chris@0 39 target = new AudioCoreAudioTarget(source);
Chris@0 40 if (target->isOK()) return target;
Chris@0 41 else {
Chris@0 42 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open CoreAudio target" << std::endl;
Chris@0 43 delete target;
Chris@0 44 }
Chris@0 45 #endif
Chris@0 46
Chris@0 47 #ifdef HAVE_DIRECTSOUND
Chris@0 48 target = new AudioDirectSoundTarget(source);
Chris@0 49 if (target->isOK()) return target;
Chris@0 50 else {
Chris@0 51 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open DirectSound target" << std::endl;
Chris@0 52 delete target;
Chris@0 53 }
Chris@0 54 #endif
Chris@0 55
Chris@0 56 #ifdef HAVE_PORTAUDIO
Chris@102 57 target = new AudioPortAudioTarget(source);
Chris@102 58 if (target->isOK()) return target;
Chris@102 59 else {
Chris@102 60 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open PortAudio target" << std::endl;
Chris@102 61 delete target;
Chris@102 62 }
Chris@0 63 #endif
Chris@0 64
Chris@0 65 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: No suitable targets available" << std::endl;
Chris@0 66 return 0;
Chris@0 67 }
Chris@0 68
Chris@0 69