SAL
A C++ library for spatial audio.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pawrapper.h
Go to the documentation of this file.
1 /*
2  pawrapper.h
3  Spatial Audio Library (SAL)
4  Copyright (c) 2016, Enzo De Sena
5  All rights reserved.
6 
7  Authors: Enzo De Sena, enzodesena@gmail.com
8 
9  */
10 
11 #ifndef SAL_pawrapper_h
12 #define SAL_pawrapper_h
13 
14 #include "saltypes.h"
15 #include "mcltypes.h"
16 #include "portaudio.h"
17 #include "decoder.h"
18 #include <strings.h>
19 #include "salconstants.h"
20 #include "audiobuffer.h"
21 
22 namespace sal {
23 
25 class PaWrapper {
26 public:
27  PaWrapper(Time sampling_frequency, Int out_dev_num,
28  std::vector<Int> channel_ids);
29 
31 
32  PaError WriteStream(const Buffer& output_buffer);
33 
35 
36  Int max_num_channels() { return channel_ids_.size(); }
37 
38  static void PrintError(PaError err);
39 
40  static void PrintDevicesInfo();
41  static Int NumOutputChannels(const Int out_dev_id);
42  static std::vector<mcl::Int> SelectChannelIds(const Int num_loudspeakers,
43  const Int out_dev_id);
44 
45  ~PaWrapper();
46 private:
47  static PaError Init();
48  static PaError Terminate();
49 
50  PaStream* stream_;
51  std::vector<Int> channel_ids_;
52 };
53 
54 
55 } // namespace sal
56 
57 #endif