annotate sv/audioio/AudioTargetFactory.cpp @ 282:d9319859a4cf tip

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