Nsound  0.9.4
AudioBackendLibportaudio.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: AudioBackendLibportaudio.h 875 2014-09-27 22:25:13Z 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_LIBPORTAUDIO_H_
34 #define _NSOUND_AUDIO_BACKEND_LIBPORTAUDIO_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
45 typedef void PaStream;
46 
47 namespace Nsound
48 {
49 
50 //-----------------------------------------------------------------------------
52 {
53  public:
54 
56  uint32 sample_rate = 44100,
57  uint32 channels = 1,
58  uint32 bits_per_sample = 16);
59 
61 
64 
65  std::string
66  getError();
67 
68  std::string
69  getInfo();
70 
71  void
72  initialize();
73 
74  void
75  play(void * data, uint32 n_bytes);
76 
77  void
78  scanDevices(AudioPlayback & pb, const AudioStream & test_clip);
79 
81  //
103  void
104  setOption(const std::string & key, const std::string & value);
105 
106  void
107  shutdown();
108 
109  private:
110 
111  // disable copy constructor and op=
112 
114  :
115  AudioBackend(),
116  options_(),
117  error_buffer_(""),
118  out_params_(NULL),
119  stream_(NULL),
120 //~ pos_(0),
122  driver_id_(0){};
123 
125  {return *this;};
126 
127 
128  std::vector< std::string > options_;
129  std::stringstream error_buffer_;
130 
133 
134 //~ uint32 pos_;
135 
137 
139 
140 };
141 
142 } // namespace Nsound
143 
144 // :mode=c++: jEdit modeline
145 #endif
unsigned int uint32
Definition: Nsound.h:153
AudioBackendLibportaudio(uint32 sample_rate=44100, uint32 channels=1, uint32 bits_per_sample=16)
AudioBackendLibportaudio(const AudioBackendLibportaudio &copy)
void setOption(const std::string &key, const std::string &value)
Set Libportaudio options.
void scanDevices(AudioPlayback &pb, const AudioStream &test_clip)
AudioBackendLibportaudio & operator=(const AudioBackendLibportaudio &rhs)
void play(void *data, uint32 n_bytes)
void PaStream