comparison audioio/AudioTargetFactory.cpp @ 0:db6fcbd4405c

initial import
author Chris Cannam
date Tue, 10 Jan 2006 16:33:16 +0000
parents
children df5923e33d01
comparison
equal deleted inserted replaced
-1:000000000000 0:db6fcbd4405c
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 A waveform viewer and audio annotation editor.
5 Chris Cannam, Queen Mary University of London, 2005
6
7 This is experimental software. Not for distribution.
8 */
9
10 #include "AudioTargetFactory.h"
11
12 #include "AudioJACKTarget.h"
13 #include "AudioCoreAudioTarget.h"
14 #include "AudioPortAudioTarget.h"
15
16 #include <iostream>
17
18 AudioCallbackPlayTarget *
19 AudioTargetFactory::createCallbackTarget(AudioCallbackPlaySource *source)
20 {
21 AudioCallbackPlayTarget *target = 0;
22
23 #ifdef HAVE_JACK
24 target = new AudioJACKTarget(source);
25 if (target->isOK()) return target;
26 else {
27 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open JACK target" << std::endl;
28 delete target;
29 }
30 #endif
31
32 #ifdef HAVE_COREAUDIO
33 target = new AudioCoreAudioTarget(source);
34 if (target->isOK()) return target;
35 else {
36 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open CoreAudio target" << std::endl;
37 delete target;
38 }
39 #endif
40
41 #ifdef HAVE_DIRECTSOUND
42 target = new AudioDirectSoundTarget(source);
43 if (target->isOK()) return target;
44 else {
45 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open DirectSound target" << std::endl;
46 delete target;
47 }
48 #endif
49
50 #ifdef HAVE_PORTAUDIO
51 target = new AudioPortAudioTarget(source);
52 if (target->isOK()) return target;
53 else {
54 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open PortAudio target" << std::endl;
55 delete target;
56 }
57 #endif
58
59 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: No suitable targets available" << std::endl;
60 return 0;
61 }
62
63