Mercurial > hg > svapp
comparison audioio/AudioTargetFactory.cpp @ 43:3c5756fb6a68
* Move some things around to facilitate plundering libraries for other
applications without needing to duplicate so much code.
sv/osc -> data/osc
sv/audioio -> audioio
sv/transform -> plugin/transform
sv/document -> document (will rename to framework in next commit)
author | Chris Cannam |
---|---|
date | Wed, 24 Oct 2007 16:34:31 +0000 |
parents | |
children | ccdc5b30e54c |
comparison
equal
deleted
inserted
replaced
42:0619006a1ee3 | 43:3c5756fb6a68 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006 Chris Cannam. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #include "AudioTargetFactory.h" | |
17 | |
18 #include "AudioJACKTarget.h" | |
19 #include "AudioCoreAudioTarget.h" | |
20 #include "AudioPortAudioTarget.h" | |
21 | |
22 #include <iostream> | |
23 | |
24 AudioCallbackPlayTarget * | |
25 AudioTargetFactory::createCallbackTarget(AudioCallbackPlaySource *source) | |
26 { | |
27 AudioCallbackPlayTarget *target = 0; | |
28 | |
29 #ifdef HAVE_JACK | |
30 target = new AudioJACKTarget(source); | |
31 if (target->isOK()) return target; | |
32 else { | |
33 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open JACK target" << std::endl; | |
34 delete target; | |
35 } | |
36 #endif | |
37 | |
38 #ifdef HAVE_COREAUDIO | |
39 target = new AudioCoreAudioTarget(source); | |
40 if (target->isOK()) return target; | |
41 else { | |
42 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open CoreAudio target" << std::endl; | |
43 delete target; | |
44 } | |
45 #endif | |
46 | |
47 #ifdef HAVE_DIRECTSOUND | |
48 target = new AudioDirectSoundTarget(source); | |
49 if (target->isOK()) return target; | |
50 else { | |
51 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open DirectSound target" << std::endl; | |
52 delete target; | |
53 } | |
54 #endif | |
55 | |
56 #ifdef HAVE_PORTAUDIO | |
57 target = new AudioPortAudioTarget(source); | |
58 if (target->isOK()) return target; | |
59 else { | |
60 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: Failed to open PortAudio target" << std::endl; | |
61 delete target; | |
62 } | |
63 #endif | |
64 | |
65 std::cerr << "WARNING: AudioTargetFactory::createCallbackTarget: No suitable targets available" << std::endl; | |
66 return 0; | |
67 } | |
68 | |
69 |