jacktrip_globals.h 5.32 KB
Newer Older
Chris Chafe's avatar
src/  
Chris Chafe committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//*****************************************************************
/*
  JackTrip: A System for High-Quality Audio Network Performance
  over the Internet

  Copyright (c) 2008 Juan-Pablo Caceres, Chris Chafe.
  SoundWIRE group at CCRMA, Stanford University.
  
  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation
  files (the "Software"), to deal in the Software without
  restriction, including without limitation the rights to use,
  copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the
  Software is furnished to do so, subject to the following
  conditions:
  
  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.
  
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  OTHER DEALINGS IN THE SOFTWARE.
*/
//*****************************************************************

/**
 * \file globals.cpp
 * \author Juan-Pablo Caceres
 * \date June 2008
 */

#ifndef __JACKTRIP_GLOBALS_H__
#define __JACKTRIP_GLOBALS_H__

#include "AudioInterface.h"
//#include "JackAudioInterface.h"

/// \todo Add this namespace
//namespace JackTrip

const char* const gVersion = "1.2"; ///< JackTrip version

//*******************************************************************************
/// \name Default Values
//@{
const int gDefaultNumInChannels = 2;
const int gDefaultNumOutChannels = 2;

#define PROTOCOL_STACK QHostAddress::AnyIPv4 // as opposed to Any
56
57
// #define WAIR_AUDIO_NAME "JackTrip" // for jack connection
const QString WAIR_AUDIO_NAME = QString("JackTrip"); // keep legacy for WAIR
Chris Chafe's avatar
src/  
Chris Chafe committed
58
const int gMAX_WAIRS = 10; // jmess revision needed for string parse if > 1 digit
59
60

// hubpatch = 2 for TUB ensemble patching
61
62
const QString gDOMAIN_TRIPLE = QString("130.149.23"); // for TUB multiclient hub
const QString gTUB_AUDIO_NAME = QString("TUB"); // for TUB multiclient hub
Chris Chafe's avatar
Chris Chafe committed
63
64
const int gMIN_TUB = 215; // lowest client address
const int gMAX_TUB = 215; // highest client address
65

Chris Chafe's avatar
src/  
Chris Chafe committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#ifdef WAIR // wair
// uses hub mode
// hard wire the number of netrev (comb filter) channels
  #define NUMNETREVCHANSbecauseNOTINRECEIVEDheader 16 // for jacktripworker, jmess
  const int gDefaultNumNetRevChannels = NUMNETREVCHANSbecauseNOTINRECEIVEDheader;
  const int gDefaultAddCombFilterLength = 0;
  const int gDefaultCombFilterFeedback = 0;
#endif // endwhere

//const JackAudioInterface::audioBitResolutionT gDefaultBitResolutionMode =
//    JackAudioInterface::BIT16;
const AudioInterface::audioBitResolutionT gDefaultBitResolutionMode =
        AudioInterface::BIT16;
const int gDefaultQueueLength = 4;
const int gDefaultOutputQueueLength = 4;
const uint32_t gDefaultSampleRate = 48000;
const uint32_t gDefaultBufferSizeInSamples = 128;
const QString gDefaultLocalAddress = QString();
const int gDefaultRedundancy = 1;
const int gTimeOutMultiThreadedServer = 5000; // seconds
const int gWaitCounter = 60;
//@}


//*******************************************************************************
/// \name Network related ports
//@{
const int gDefaultPort = 4464; ///< Default JackTrip Port
//const int gInputPort_0 = 4464; ///< Input base port
//const int gOutputPort_0 = 4465; ///< Output base port
//const int gDefaultSendPort = 4464; ///< Default for to use to send packet
//@}


//*******************************************************************************
/// \name Separator for terminal printing
//@{
const char* const gPrintSeparator = "---------------------------------------------------------";
//@}


//*******************************************************************************
/// \name Global flags
//@{
extern int gVerboseFlag; ///< Verbose mode flag declaration
//@}


//*******************************************************************************
/// \name JackAudio
//@{
const int gJackBitResolution = 32; ///< Audio Bit Resolution of the Jack Server
//@}


//*******************************************************************************
/// \name Global Functions

void set_crossplatform_realtime_priority();

//@{
// Linux Specific Functions
#if defined ( __LINUX__ )
/// \brief Returns fifo priority
int get_fifo_priority (bool half);
/// \brief Set fifo priority (if user has sufficient privileges).
int set_fifo_priority (bool half);
int set_realtime_priority (void);
#endif //__LINUX__
//@}

//@{
// Mac OS X Specific Functions
#if defined ( __MAC_OSX__ )
int set_realtime(int period, int computation, int constraint);
#endif //__MAC_OSX__ 
//@}

//@{
// Windows Specific Functions
#if defined ( __WIN_32__ )
int win_priority();
#endif //__WIN_32__
//@}

//*******************************************************************************
/// \name JackTrip Server parameters
//@{
/// Maximum Threads that can be run at the same time
const int gMaxThreads = 290; // some pthread limit around 297?

/// Public well-known UDP port to where the clients will connect
const int gServerUdpPort = 4464;
//@}


#endif