JackTrip

RtAudioInterface.h
Go to the documentation of this file.
1 //*****************************************************************
2 /*
3 JackTrip: A System for High-Quality Audio Network Performance
4 over the Internet
5
6 Copyright (c) 2008 Juan-Pablo Caceres, Chris Chafe.
7 SoundWIRE group at CCRMA, Stanford University.
8
9 Permission is hereby granted, free of charge, to any person
10 obtaining a copy of this software and associated documentation
11 files (the "Software"), to deal in the Software without
12 restriction, including without limitation the rights to use,
13 copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the
15 Software is furnished to do so, subject to the following
16 conditions:
17
18 The above copyright notice and this permission notice shall be
19 included in all copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 OTHER DEALINGS IN THE SOFTWARE.
29 */
30 //*****************************************************************
31
38 #ifndef __RTAUDIOINTERFACE_H__
39 #define __RTAUDIOINTERFACE_H__
40
41 #include "RtAudio.h"
42
43 #include "AudioInterface.h"
44 #include "jacktrip_globals.h"
45 class JackTrip; // Forward declaration
46
48 class RtAudioInterface : public AudioInterface
49 {
50 public:
51
58 RtAudioInterface(JackTrip* jacktrip,
59 int NumInChans = gDefaultNumInChannels,
60 int NumOutChans = gDefaultNumOutChannels,
61 audioBitResolutionT AudioBitResolution = BIT16);
63 virtual ~RtAudioInterface();
64
66 virtual void listAllInterfaces();
67 virtual void setup();
68 virtual int startProcess() const;
69 virtual int stopProcess() const;
71 virtual void connectDefaultPorts() {}
72
73 //--------------SETTERS---------------------------------------------
75 virtual void setClientName(const char* /*ClientName*/) {}
76 //------------------------------------------------------------------
77
78 //--------------GETTERS---------------------------------------------
79 //------------------------------------------------------------------
80
81
82 private:
83 int RtAudioCallback(void *outputBuffer, void *inputBuffer, unsigned int nFrames,
84 double streamTime, RtAudioStreamStatus status);
85 static int wrapperRtAudioCallback(void *outputBuffer, void *inputBuffer, unsigned int nFrames,
86 double streamTime, RtAudioStreamStatus status, void *userData);
87 void printDeviceInfo(unsigned int deviceId);
88
89 JackTrip* mJackTrip;
90 int mNumInChans;
91 int mNumOutChans;
92 QVarLengthArray<float*> mInBuffer;
93 QVarLengthArray<float*> mOutBuffer;
94 RtAudio* mRtAudio;
95 };
96
97 #endif // __RTAUDIOINTERFACE_H__
RtAudioInterface::connectDefaultPorts
virtual void connectDefaultPorts()
This has no effect in RtAudio.
Definition: RtAudioInterface.h:71
AudioInterface::audioBitResolutionT
audioBitResolutionT
Enum for Audio Resolution in bits.
Definition: AudioInterface.h:61
AudioInterface
Base Class that provides an interface with audio.
Definition: AudioInterface.h:56
RtAudioInterface::RtAudioInterface
RtAudioInterface(JackTrip *jacktrip, int NumInChans=gDefaultNumInChannels, int NumOutChans=gDefaultNumOutChannels, audioBitResolutionT AudioBitResolution=BIT16)
The class constructor.
Definition: RtAudioInterface.cpp:49
RtAudio
Realtime audio i/o C++ classes.
Definition: RtAudio.h:205
RtAudioInterface::startProcess
virtual int startProcess() const
Tell the audio server that we are ready to roll. The process-callback will start running. This runs on its own thread.
Definition: RtAudioInterface.cpp:213
RtAudioInterface::stopProcess
virtual int stopProcess() const
Stops the process-callback thread.
Definition: RtAudioInterface.cpp:225
RtAudioInterface::listAllInterfaces
virtual void listAllInterfaces()
List all avialable audio interfaces, with its properties.
Definition: RtAudioInterface.cpp:137
gDefaultNumInChannels
const int gDefaultNumInChannels
Definition: jacktrip_globals.h:52
AudioInterface.h
AudioInterface::BIT16
16 bits (default)
Definition: AudioInterface.h:63
RtAudioInterface::setup
virtual void setup()
Setup the client. This function should be called just before.
Definition: RtAudioInterface.cpp:68
RtAudio.h
RtAudioInterface::~RtAudioInterface
virtual ~RtAudioInterface()
The class destructor.
Definition: RtAudioInterface.cpp:61
RtAudioStreamStatus
unsigned int RtAudioStreamStatus
RtAudio stream status (over- or underflow) flags.
Definition: RtAudio.h:140
RtAudioInterface
Base Class that provides an interface with RtAudio.
Definition: RtAudioInterface.h:48
jacktrip_globals.h
RtAudioInterface::setClientName
virtual void setClientName(const char *)
This has no effect in RtAudio.
Definition: RtAudioInterface.h:75
JackTrip
Main class to creates a SERVER (to listen) or a CLIENT (to connect to a listening server) to send aud...
Definition: JackTrip.h:67
gDefaultNumOutChannels
const int gDefaultNumOutChannels
Definition: jacktrip_globals.h:53