AudioTargetFactory.cpp

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006 Chris Cannam.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #include "AudioTargetFactory.h"
00017 
00018 #include "AudioJACKTarget.h"
00019 #include "AudioCoreAudioTarget.h"
00020 #include "AudioPortAudioTarget.h"
00021 
00022 #include <iostream>
00023 
00024 AudioCallbackPlayTarget *
00025 AudioTargetFactory::createCallbackTarget(AudioCallbackPlaySource *source)
00026 {
00027     AudioCallbackPlayTarget *target = 0;
00028 
00029 #ifdef HAVE_JACK
00030     target = new AudioJACKTarget(source);
00031     if (target->isOK()) return target;
00032     else {
00033         std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open JACK target" << std::endl;
00034         delete target;
00035     }
00036 #endif
00037 
00038 #ifdef HAVE_COREAUDIO
00039     target = new AudioCoreAudioTarget(source);
00040     if (target->isOK()) return target;
00041     else {
00042         std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open CoreAudio target" << std::endl;
00043         delete target;
00044     }
00045 #endif
00046 
00047 #ifdef HAVE_DIRECTSOUND
00048     target = new AudioDirectSoundTarget(source);
00049     if (target->isOK()) return target;
00050     else {
00051         std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open DirectSound target" << std::endl;
00052         delete target;
00053     }
00054 #endif
00055 
00056 #ifdef HAVE_PORTAUDIO
00057     target = new AudioPortAudioTarget(source);
00058     if (target->isOK()) return target;
00059     else {
00060         std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open PortAudio target" << std::endl;
00061         delete target;
00062     }
00063 #endif
00064 
00065     std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: No suitable targets available" << std::endl;
00066     return 0;
00067 }
00068 
00069 

Generated on Wed Feb 20 15:45:25 2008 for SonicVisualiser by  doxygen 1.5.1