VISR  0.11.8
Versatile Interactive Scene Renderer
mex_wrapper.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_MEXSUPPORT_MEX_WRAPPER_HPP_INCLUDED
4 #define VISR_MEXSUPPORT_MEX_WRAPPER_HPP_INCLUDED
5 
6 #include <libvisr/constants.hpp>
7 
8 #include <matrix.h>
9 
10 #include <cstddef>
11 #include <memory>
12 #include <vector>
13 
14 namespace visr
15 {
16 // forward declarations
17 class Component;
18 class SignalFlowContext;
19 namespace rrl
20 {
21 class AudioSignalFlow;
22 template<typename SampleType> class CommunicationArea;
23 }
24 
25 namespace mexsupport
26 {
27 
29 {
30 public:
31 MexWrapper( Component & flow,
32  SignalFlowContext const & context,
33  mxArray const * input,
34  mxArray * & output,
35  mxArray const * messages = 0 );
36 
37 ~MexWrapper( );
38 
39 void process( );
40 
41 private:
46  template<mxClassID classId>
47  void transferInputSamples( std::size_t blockIdx );
48 
53  template<mxClassID classId>
54  void transferOutputSamples( std::size_t blockIdx );
55 
56  Component & mFlow;
57 
58  mxClassID const mSignalType;
59 
60  std::size_t mSignalLength;
61  std::size_t mNumberOfBlocks;
62 
63  std::size_t mNumberOfCaptureSignals;
64  std::size_t mNumberOfPlaybackSignals;
65 
66  mxArray const * mInputMatrix;
67  mxArray * mOutputMatrix;
68 
69  std::size_t const mPeriodSize;
70 
71  std::vector<SampleType *> mInputBufferPtrs;
72  std::vector<SampleType *> mOutputBufferPtrs;
73 
78  std::unique_ptr<rrl::CommunicationArea<SampleType> > mCommBuffer;
79 
80  std::unique_ptr<rrl::AudioSignalFlow> mAudioWrapper;
81 };
82 
83 } // namespace mexsupport
84 } // namespace visr
85 
86 #endif // #ifndef VISR_MEXSUPPORT_MEX_WRAPPER_HPP_INCLUDED
Definition: audio_signal_flow.hpp:49
Definition: mex_wrapper.hpp:22
Definition: component.hpp:38
Definition: options.cpp:10
Definition: signal_flow_context.hpp:15
Definition: mex_wrapper.hpp:28