Nsound  0.9.4
AudioBackendLibao.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: AudioBackendLibao.h 874 2014-09-08 02:21:29Z weegreenblobbie $
4 //
5 // Nsound is a C++ library and Python module for audio synthesis featuring
6 // dynamic digital filters. Nsound lets you easily shape waveforms and write
7 // to disk or plot them. Nsound aims to be as powerful as Csound but easy to
8 // use.
9 //
10 // Copyright (c) 2011-Present Nick Hilton
11 //
12 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13 //
14 //-----------------------------------------------------------------------------
15 
16 //-----------------------------------------------------------------------------
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 // This program is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 // GNU Library General Public License for more details.
27 //
28 // You should have received a copy of the GNU General Public License
29 // along with this program; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 //
32 //-----------------------------------------------------------------------------
33 #ifndef _NSOUND_AUDIO_BACKEND_LIBAO_H_
34 #define _NSOUND_AUDIO_BACKEND_LIBAO_H_
35 
36 #include <Nsound/Nsound.h>
37 #include <Nsound/AudioBackend.h>
38 
39 #include <sstream>
40 #include <string>
41 #include <vector>
42 
43 // Forward declare
44 struct ao_device;
45 
46 namespace Nsound
47 {
48 
49 //-----------------------------------------------------------------------------
51 {
52  public:
53 
55  uint32 sample_rate = 44100,
56  uint32 channels = 1,
57  uint32 bits_per_sample = 16);
58 
60 
63 
64  std::string
65  getError();
66 
67  std::string
68  getInfo();
69 
70  void
71  initialize();
72 
73  void
74  play(void * data, uint32 n_bytes);
75 
76  void
77  scanDevices(AudioPlayback & pb, const AudioStream & test_clip);
78 
80  //
102  void
103  setOption(const std::string & key, const std::string & value);
104 
105  void
106  shutdown();
107 
108  private:
109 
110  // disable these
112  :
113  AudioBackend(),
114  options_(),
115  error_buffer_(""),
116  driver_id_(-1),
117  device_ptr_(NULL){};
118 
119  AudioBackendLibao & operator=(const AudioBackendLibao & rhs){return *this;};
120 
121  std::vector< std::string > options_;
122  std::stringstream error_buffer_;
123 
125  ao_device * device_ptr_;
126 };
127 
128 } // namespace Nsound
129 
130 // :mode=c++: jEdit modeline
131 #endif
unsigned int uint32
Definition: Nsound.h:153
AudioBackendLibao(uint32 sample_rate=44100, uint32 channels=1, uint32 bits_per_sample=16)
AudioBackendLibao(const AudioBackendLibao &copy)
AudioBackendType getBackendType()
std::vector< std::string > options_
void setOption(const std::string &key, const std::string &value)
Set libao options.
void scanDevices(AudioPlayback &pb, const AudioStream &test_clip)
signed int int32
Definition: Nsound.h:142
void play(void *data, uint32 n_bytes)
std::stringstream error_buffer_
AudioBackendLibao & operator=(const AudioBackendLibao &rhs)