Constants.h 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. /* Constants.h
  2. this file defines global configuration/persistence and runtime constants
  3. */
  4. #ifndef _CONSTANTS_H_
  5. #define _CONSTANTS_H_
  6. #include <ninjam/audiostream.h>
  7. #include <ninjam/njclient.h>
  8. #include "JuceHeader.h"
  9. /*\ CAVEATS:
  10. |*| when adding GUI components to Channels be sure to update N_STATIC_CHANNELS_CHILDREN
  11. |*| and when adding GUI components to Mixer be sure to update N_STATIC_MIXER_CHILDREN
  12. |*|
  13. |*| when adding nodes or properties to CONFIG_XML be sure to
  14. |*| * if new property - denote datatype in #define CONFIG_TYPES_XML
  15. |*| - sanitize data in LinJamConfig::sanitizeGui()
  16. |*| LinJamConfig::sanitizeClient() // TODO: nyi
  17. |*| LinJamConfig::sanitizeBlacklist() // TODO: nyi
  18. |*| LinJamConfig::sanitizeAudio() // TODO: nyi
  19. |*| LinJamConfig::sanitizeServer() // TODO: nyi
  20. |*| LinJamConfig::sanitizeUser() // TODO: nyi
  21. |*| LinJamConfig::sanitizeChannel() // TODO: nyi
  22. |*| * if user property - verify data in LinJamConfig::validateUsers()
  23. |*| * if channel property - verify data in LinJamConfig::validateChannels()
  24. |*| - add to LinJamConfig::newChannel()
  25. |*| * if new node - switch in LinJamConfig::restoreVarTypeInfo()
  26. |*| - validate in LinJamConfig::validateConfig()
  27. |*| - invalidate in LinJamConfig::isConfigValid()
  28. |*| * validate and trace data/errors in #define DEBUG_VALIDATE_CONFIG_DEFAULTS
  29. |*| #define DEBUG_VALIDATE_CONFIG_ROOT
  30. |*| #define DEBUG_VALIDATE_CONFIG_GUI
  31. |*| #define DEBUG_VALIDATE_CONFIG_CLIENT
  32. |*| #define DEBUG_VALIDATE_CONFIG_BLACKLIST
  33. |*| #define DEBUG_VALIDATE_CONFIG_AUDIO
  34. |*| #define DEBUG_VALIDATE_CONFIG_SERVER
  35. |*| #define DEBUG_VALIDATE_CONFIG_MASTERS
  36. |*| #define DEBUG_TRACE_VALIDATE_CONFIG
  37. |*| #define DEBUG_TRACE_VALIDATE_USER
  38. |*| #define DEBUG_TRACE_VALIDATE_CHANNEL
  39. |*| #define DEBUG_TRACE_ADD_CHANNEL_GUI
  40. |*| #define DEBUG_TRACE_CONFIGURE_LOCAL_CHANNEL
  41. |*| #define DEBUG_TRACE_REMOTE_CHANNELS
  42. |*| #define DEBUG_TRACE_CONFIGURE_REMOTE
  43. |*| #define DEBUG_TRACE_SANITIZE_GUI
  44. |*| #define DEBUG_TRACE_SANITIZE_CLIENT
  45. |*| #define DEBUG_TRACE_SANITIZE_BLACKLIST
  46. |*| #define DEBUG_TRACE_SANITIZE_AUDIO
  47. |*| #define DEBUG_TRACE_SANITIZE_SERVER
  48. |*| #define DEBUG_TRACE_SANITIZE_USER
  49. |*| #define DEBUG_TRACE_SANITIZE_CHANNEL
  50. \*/
  51. /* default configuration raw data */
  52. #define XML_HEADER "<?xml version=\"1.0\"?><"
  53. #ifdef _WIN32
  54. # define WIN_AUDIO_XML \
  55. ASIO_DRIVER_KEY + "=\"" + String(DEFAULT_ASIO_DRIVERN ) + "\" " + \
  56. ASIO_INPUTB_KEY + "=\"" + String(DEFAULT_ASIO_INPUTBN ) + "\" " + \
  57. ASIO_INPUTE_KEY + "=\"" + String(DEFAULT_ASIO_INPUTEN ) + "\" " + \
  58. ASIO_OUTPUTB_KEY + "=\"" + String(DEFAULT_ASIO_OUTPUTBN ) + "\" " + \
  59. ASIO_OUTPUTE_KEY + "=\"" + String(DEFAULT_ASIO_OUTPUTEN ) + "\" " + \
  60. ASIO_CONTROL_KEY + "=\"" + String(DEFAULT_ASIO_CONTROL ) + "\" " + \
  61. KS_INPUT_KEY + "=\"" + String(DEFAULT_KS_INPUTN ) + "\" " + \
  62. KS_OUTPUT_KEY + "=\"" + String(DEFAULT_KS_OUTPUTN ) + "\" " + \
  63. KS_SAMPLERATE_KEY + "=\"" + String(DEFAULT_KS_SAMPLERATE ) + "\" " + \
  64. KS_BITDEPTH_KEY + "=\"" + String(DEFAULT_KS_BITDEPTH ) + "\" " + \
  65. KS_NBLOCKS_KEY + "=\"" + String(DEFAULT_KS_NBLOCKS ) + "\" " + \
  66. KS_BLOCKSIZE_KEY + "=\"" + String(DEFAULT_KS_BLOCKSIZE ) + "\" " + \
  67. DS_INPUT_KEY + "=\"" + String(DEFAULT_DS_INPUT_NAME ) + "\" " + \
  68. DS_OUTPUT_KEY + "=\"" + String(DEFAULT_DS_OUTPUT_NAME ) + "\" " + \
  69. DS_SAMPLERATE_KEY + "=\"" + String(DEFAULT_DS_SAMPLERATE ) + "\" " + \
  70. DS_BITDEPTH_KEY + "=\"" + String(DEFAULT_DS_BITDEPTH ) + "\" " + \
  71. DS_NBLOCKS_KEY + "=\"" + String(DEFAULT_DS_NBLOCKS ) + "\" " + \
  72. DS_BLOCKSIZE_KEY + "=\"" + String(DEFAULT_DS_BLOCKSIZE ) + "\" " + \
  73. WAVE_INPUT_KEY + "=\"" + String(DEFAULT_WAVE_INPUTN ) + "\" " + \
  74. WAVE_OUTPUT_KEY + "=\"" + String(DEFAULT_WAVE_OUTPUTN ) + "\" " + \
  75. WAVE_SAMPLERATE_KEY + "=\"" + String(DEFAULT_WAVE_SAMPLERATE ) + "\" " + \
  76. WAVE_BITDEPTH_KEY + "=\"" + String(DEFAULT_WAVE_BITDEPTH ) + "\" " + \
  77. WAVE_NBLOCKS_KEY + "=\"" + String(DEFAULT_WAVE_NBLOCKS ) + "\" " + \
  78. WAVE_BLOCKSIZE_KEY + "=\"" + String(DEFAULT_WAVE_BLOCKSIZE ) + "\" "
  79. # define MAC_AUDIO_XML ""
  80. # define NIX_AUDIO_XML ""
  81. #else // _WIN32
  82. # ifdef _MAC
  83. # define WIN_AUDIO_XML ""
  84. # define NIX_AUDIO_XML ""
  85. # define MAC_AUDIO_XML \
  86. CA_INPUT_KEY + "=\"" + String(DEFAULT_CA_INPUT_NAME ) + "\" " + \
  87. CA_OUTPUT_KEY + "=\"" + String(DEFAULT_CA_OUTPUT_NAME ) + "\" " + \
  88. CA_NCHANNELS_KEY + "=\"" + String(DEFAULT_CA_NCHANNELS ) + "\" " + \
  89. CA_SAMPLERATE_KEY + "=\"" + String(DEFAULT_CA_SAMPLERATE ) + "\" " + \
  90. CA_BITDEPTH_KEY + "=\"" + String(DEFAULT_CA_BITDEPTH ) + "\" "
  91. # else // _MAC
  92. # define WIN_AUDIO_XML ""
  93. # define MAC_AUDIO_XML ""
  94. # define NIX_AUDIO_XML \
  95. JACK_SERVER_KEY + "=\"" + String(DEFAULT_JACK_SERVERN ) + "\" " + \
  96. JACK_NAME_KEY + "=\"" + String(DEFAULT_JACK_NAME ) + "\" " + \
  97. JACK_NINPUTS_KEY + "=\"" + String(DEFAULT_JACK_NINPUTS ) + "\" " + \
  98. JACK_NOUTPUTS_KEY + "=\"" + String(DEFAULT_JACK_NOUTPUTS ) + "\" " + \
  99. ALSA_INPUT_KEY + "=\"" + String(DEFAULT_ALSA_INPUT_NAME ) + "\" " + \
  100. ALSA_OUTPUT_KEY + "=\"" + String(DEFAULT_ALSA_OUTPUT_NAME) + "\" " + \
  101. ALSA_NCHANNELS_KEY + "=\"" + String(DEFAULT_ALSA_NCHANNELS ) + "\" " + \
  102. ALSA_SAMPLERATE_KEY + "=\"" + String(DEFAULT_ALSA_SAMPLERATE ) + "\" " + \
  103. ALSA_BITDEPTH_KEY + "=\"" + String(DEFAULT_ALSA_BITDEPTH ) + "\" " + \
  104. ALSA_NBLOCKS_KEY + "=\"" + String(DEFAULT_ALSA_NBLOCKS ) + "\" " + \
  105. ALSA_BLOCKSIZE_KEY + "=\"" + String(DEFAULT_ALSA_BLOCKSIZE ) + "\" "
  106. # endif // _MAC
  107. #endif // _WIN32
  108. /** CONFIG_XML, WIN_AUDIO_XML, NIX_AUDIO_XML, MAC_AUDIO_XML define the schema
  109. and default values for the configuration/persistence model
  110. this data is instantiated below as DEFAULT_CONFIG_XML */
  111. #define CONFIG_XML XML_HEADER + \
  112. STORAGE_KEY + " " + \
  113. CONFIG_VERSION_KEY + "=\"" + String(CONFIG_VERSION ) + "\"" + \
  114. "><" + \
  115. GUI_KEY + " " + \
  116. FONT_SIZE_KEY + "=\"" + String(DEFAULT_FONT_SIZE_N ) + "\" " + \
  117. UPDATE_IVL_KEY + "=\"" + String(DEFAULT_UPDATE_IVL_N ) + "\" " + \
  118. "/><" + \
  119. CLIENT_KEY + " " + \
  120. SAVE_AUDIO_MODE_KEY + "=\"" + String(DEFAULT_SAVE_AUDIO_MODE ) + "\" " + \
  121. MIXDOWN_MODE_KEY + "=\"" + String(DEFAULT_MIXDOWN_MODE ) + "\" " + \
  122. SHOULD_SAVE_LOG_KEY + "=\"" + BOOLSTR(DEFAULT_SHOULD_SAVE_LOG ) + "\" " + \
  123. DEBUG_LEVEL_KEY + "=\"" + String(DEFAULT_DEBUG_LEVEL ) + "\" " + \
  124. SHOULD_HIDE_BOTS_KEY + "=\"" + BOOLSTR(DEFAULT_SHOULD_HIDE_BOTS) + "\" " + \
  125. "/><" + \
  126. BLACKLIST_KEY + " " + \
  127. SUBSCRIBE_MODE_KEY + "=\"" + String(DEFAULT_SUBSCRIBE_MODE ) + "\" " + \
  128. "/><" + \
  129. AUDIO_KEY + " " + \
  130. AUDIO_API_KEY + "=\"" + String(DEFAULT_AUDIO_API ) + "\" " + \
  131. String(WIN_AUDIO_XML) + \
  132. String(MAC_AUDIO_XML) + \
  133. String(NIX_AUDIO_XML) + \
  134. "/><" + \
  135. SERVER_KEY + " " + \
  136. HOST_KEY + "=\"" + String(DEFAULT_HOST ) + "\" " + \
  137. LOGIN_KEY + "=\"" + String(DEFAULT_LOGIN ) + "\" " + \
  138. PASS_KEY + "=\"" + String(DEFAULT_PASS ) + "\" " + \
  139. IS_ANONYMOUS_KEY + "=\"" + BOOLSTR(DEFAULT_IS_ANONYMOUS ) + "\" " + \
  140. IS_AGREED_KEY + "=\"" + BOOLSTR(DEFAULT_IS_AGREED ) + "\" " + \
  141. SHOULD_AGREE_KEY + "=\"" + BOOLSTR(DEFAULT_SHOULD_AGREE ) + "\" " + \
  142. BOT_NAME_KEY + "=\"" + String(DEFAULT_BOT_NAME ) + "\" " + \
  143. BOT_USERIDX_KEY + "=\"" + String(DEFAULT_BOT_USERIDX ) + "\" " + \
  144. "/><" + \
  145. SERVERS_KEY + " /><" + \
  146. MASTERS_KEY + "><" + \
  147. MASTER_KEY + " " + \
  148. CHANNEL_NAME_KEY + "=\"" + String(MASTER_KEY ) + "\" " + \
  149. VOLUME_KEY + "=\"" + String(DEFAULT_VOLUME ) + "\" " + \
  150. PAN_KEY + "=\"" + String(DEFAULT_PAN ) + "\" " + \
  151. IS_MUTED_KEY + "=\"" + BOOLSTR(DEFAULT_IS_MUTED ) + "\" " + \
  152. STEREO_KEY + "=\"" + String(STEREO ) + "\" " + \
  153. VU_LEFT_KEY + "=\"" + String(DEFAULT_VU ) + "\" " + \
  154. VU_RIGHT_KEY + "=\"" + String(DEFAULT_VU ) + "\" " + \
  155. "/><" + \
  156. METRO_KEY + " " + \
  157. CHANNEL_NAME_KEY + "=\"" + String(METRO_KEY ) + "\" " + \
  158. VOLUME_KEY + "=\"" + String(DEFAULT_VOLUME ) + "\" " + \
  159. PAN_KEY + "=\"" + String(DEFAULT_PAN ) + "\" " + \
  160. IS_MUTED_KEY + "=\"" + BOOLSTR(DEFAULT_IS_MUTED ) + "\" " + \
  161. SOURCE_N_KEY + "=\"" + String(DEFAULT_SOURCE_N ) + "\" " + \
  162. STEREO_KEY + "=\"" + String(STEREO ) + "\" " + \
  163. VU_LEFT_KEY + "=\"" + String(DEFAULT_VU ) + "\" " + \
  164. VU_RIGHT_KEY + "=\"" + String(DEFAULT_VU ) + "\" " + \
  165. "/>" + \
  166. "</" + MASTERS_KEY + "><" + \
  167. LOCALS_KEY + " /><" + \
  168. REMOTES_KEY + " />" + \
  169. "</" + STORAGE_KEY + ">"
  170. /** CONFIG_TYPES_XML denotes the property datatypes for the schema above
  171. these are grouped by leaf type (not a one-to-one correspondence)
  172. because <channel> leaves for example are found in several locations
  173. and some list nodes such as <locals> have no intrinsic properties
  174. this data is instantiated below as CONFIG_DATATYPES_XML */
  175. #define CONFIG_TYPES_XML XML_HEADER + \
  176. STORAGE_TYPES_KEY + " " + \
  177. CONFIG_VERSION_KEY + "=\"" + DOUBLE_TYPE + "\"><" + \
  178. GUI_KEY + " " + \
  179. FONT_SIZE_KEY + "=\"" + INT_TYPE + "\" " + \
  180. UPDATE_IVL_KEY + "=\"" + INT_TYPE + "\" " + \
  181. "/><" + \
  182. CLIENT_KEY + " " + \
  183. SAVE_AUDIO_MODE_KEY + "=\"" + INT_TYPE + "\" " + \
  184. MIXDOWN_MODE_KEY + "=\"" + INT_TYPE + "\" " + \
  185. SHOULD_SAVE_LOG_KEY + "=\"" + BOOL_TYPE + "\" " + \
  186. DEBUG_LEVEL_KEY + "=\"" + INT_TYPE + "\" " + \
  187. SHOULD_HIDE_BOTS_KEY + "=\"" + BOOL_TYPE + "\" " + \
  188. "/><" + \
  189. BLACKLIST_KEY + " " + \
  190. SUBSCRIBE_MODE_KEY + "=\"" + INT_TYPE + "\" " + \
  191. "/><" + \
  192. AUDIO_KEY + " " + \
  193. AUDIO_API_KEY + "=\"" + INT_TYPE + "\" " + \
  194. ASIO_DRIVER_KEY + "=\"" + INT_TYPE + "\" " + \
  195. ASIO_INPUTB_KEY + "=\"" + INT_TYPE + "\" " + \
  196. ASIO_INPUTE_KEY + "=\"" + INT_TYPE + "\" " + \
  197. ASIO_OUTPUTB_KEY + "=\"" + INT_TYPE + "\" " + \
  198. ASIO_OUTPUTE_KEY + "=\"" + INT_TYPE + "\" " + \
  199. ASIO_CONTROL_KEY + "=\"" + INT_TYPE + "\" " + \
  200. KS_INPUT_KEY + "=\"" + INT_TYPE + "\" " + \
  201. KS_OUTPUT_KEY + "=\"" + INT_TYPE + "\" " + \
  202. KS_SAMPLERATE_KEY + "=\"" + INT_TYPE + "\" " + \
  203. KS_BITDEPTH_KEY + "=\"" + INT_TYPE + "\" " + \
  204. KS_NBLOCKS_KEY + "=\"" + INT_TYPE + "\" " + \
  205. KS_BLOCKSIZE_KEY + "=\"" + INT_TYPE + "\" " + \
  206. DS_INPUT_KEY + "=\"" + STRING_TYPE + "\" " + \
  207. DS_OUTPUT_KEY + "=\"" + STRING_TYPE + "\" " + \
  208. DS_SAMPLERATE_KEY + "=\"" + INT_TYPE + "\" " + \
  209. DS_BITDEPTH_KEY + "=\"" + INT_TYPE + "\" " + \
  210. DS_NBLOCKS_KEY + "=\"" + INT_TYPE + "\" " + \
  211. DS_BLOCKSIZE_KEY + "=\"" + INT_TYPE + "\" " + \
  212. WAVE_INPUT_KEY + "=\"" + INT_TYPE + "\" " + \
  213. WAVE_OUTPUT_KEY + "=\"" + INT_TYPE + "\" " + \
  214. WAVE_SAMPLERATE_KEY + "=\"" + INT_TYPE + "\" " + \
  215. WAVE_BITDEPTH_KEY + "=\"" + INT_TYPE + "\" " + \
  216. WAVE_NBLOCKS_KEY + "=\"" + INT_TYPE + "\" " + \
  217. WAVE_BLOCKSIZE_KEY + "=\"" + INT_TYPE + "\" " + \
  218. CA_INPUT_KEY + "=\"" + STRING_TYPE + "\" " + \
  219. CA_OUTPUT_KEY + "=\"" + STRING_TYPE + "\" " + \
  220. CA_NCHANNELS_KEY + "=\"" + INT_TYPE + "\" " + \
  221. CA_SAMPLERATE_KEY + "=\"" + INT_TYPE + "\" " + \
  222. CA_BITDEPTH_KEY + "=\"" + INT_TYPE + "\" " + \
  223. JACK_SERVER_KEY + "=\"" + INT_TYPE + "\" " + \
  224. JACK_NAME_KEY + "=\"" + STRING_TYPE + "\" " + \
  225. JACK_NINPUTS_KEY + "=\"" + INT_TYPE + "\" " + \
  226. JACK_NOUTPUTS_KEY + "=\"" + INT_TYPE + "\" " + \
  227. ALSA_INPUT_KEY + "=\"" + STRING_TYPE + "\" " + \
  228. ALSA_OUTPUT_KEY + "=\"" + STRING_TYPE + "\" " + \
  229. ALSA_NCHANNELS_KEY + "=\"" + INT_TYPE + "\" " + \
  230. ALSA_SAMPLERATE_KEY + "=\"" + INT_TYPE + "\" " + \
  231. ALSA_BITDEPTH_KEY + "=\"" + INT_TYPE + "\" " + \
  232. ALSA_NBLOCKS_KEY + "=\"" + INT_TYPE + "\" " + \
  233. ALSA_BLOCKSIZE_KEY + "=\"" + INT_TYPE + "\" " + \
  234. "/><" + \
  235. SERVER_KEY + " " + \
  236. HOST_KEY + "=\"" + STRING_TYPE + "\" " + \
  237. LOGIN_KEY + "=\"" + STRING_TYPE + "\" " + \
  238. PASS_KEY + "=\"" + STRING_TYPE + "\" " + \
  239. IS_ANONYMOUS_KEY + "=\"" + BOOL_TYPE + "\" " + \
  240. IS_AGREED_KEY + "=\"" + BOOL_TYPE + "\" " + \
  241. SHOULD_AGREE_KEY + "=\"" + BOOL_TYPE + "\" " + \
  242. BOT_NAME_KEY + "=\"" + STRING_TYPE + "\" " + \
  243. BOT_USERIDX_KEY + "=\"" + INT_TYPE + "\" " + \
  244. "/><" + \
  245. USERS_KEY + " " + \
  246. USER_IDX_KEY + "=\"" + INT_TYPE + "\" " + \
  247. "/><" + \
  248. CHANNELS_KEY + " " + \
  249. CHANNEL_NAME_KEY + "=\"" + STRING_TYPE + "\" " + \
  250. CHANNEL_IDX_KEY + "=\"" + INT_TYPE + "\" " + \
  251. PAIR_IDX_KEY + "=\"" + INT_TYPE + "\" " + \
  252. VOLUME_KEY + "=\"" + DOUBLE_TYPE + "\" " + \
  253. PAN_KEY + "=\"" + DOUBLE_TYPE + "\" " + \
  254. IS_XMIT_RCV_KEY + "=\"" + BOOL_TYPE + "\" " + \
  255. IS_MUTED_KEY + "=\"" + BOOL_TYPE + "\" " + \
  256. IS_SOLO_KEY + "=\"" + BOOL_TYPE + "\" " + \
  257. SOURCE_N_KEY + "=\"" + INT_TYPE + "\" " + \
  258. STEREO_KEY + "=\"" + INT_TYPE + "\" " + \
  259. VU_LEFT_KEY + "=\"" + DOUBLE_TYPE + "\" " + \
  260. VU_RIGHT_KEY + "=\"" + DOUBLE_TYPE + "\" " + \
  261. "/>" + \
  262. "</" + STORAGE_TYPES_KEY + "> "
  263. #define KNOWN_HOSTS_XML XML_HEADER + \
  264. NETWORK::KNOWN_HOSTS_KEY + "><" + \
  265. NETWORK::NINBOT_2049_URL + " /><" + \
  266. NETWORK::NINBOT_2050_URL + " /><" + \
  267. NETWORK::NINBOT_2051_URL + " /><" + \
  268. NETWORK::NINBOT_2052_URL + " /><" + \
  269. NETWORK::NINJAMER_2049_URL + " /><" + \
  270. NETWORK::NINJAMER_2050_URL + " /><" + \
  271. NETWORK::NINJAMER_2051_URL + " /><" + \
  272. NETWORK::NINJAMER_2052_URL + " /></" + \
  273. NETWORK::KNOWN_HOSTS_KEY + ">"
  274. #define KNOWN_BOTS_XML XML_HEADER + \
  275. NETWORK::KNOWN_BOTS_KEY + " " + \
  276. STRING(LinJamConfig::MakeHostId(NETWORK::NINBOT_2049_URL )) + "=\"" + \
  277. STRING(NETWORK::NINBOT_USER) + "\" " + \
  278. STRING(LinJamConfig::MakeHostId(NETWORK::NINBOT_2050_URL )) + "=\"" + \
  279. STRING(NETWORK::NINBOT_USER) + "\" " + \
  280. STRING(LinJamConfig::MakeHostId(NETWORK::NINBOT_2051_URL )) + "=\"" + \
  281. STRING(NETWORK::NINBOT_USER) + "\" " + \
  282. STRING(LinJamConfig::MakeHostId(NETWORK::NINBOT_2052_URL )) + "=\"" + \
  283. STRING(NETWORK::NINBOT_USER) + "\" " + \
  284. STRING(LinJamConfig::MakeHostId(NETWORK::NINJAMER_2049_URL )) + "=\"" + \
  285. STRING(NETWORK::JAMBOT_USER) + "\" " + \
  286. STRING(LinJamConfig::MakeHostId(NETWORK::NINJAMER_2050_URL )) + "=\"" + \
  287. STRING(NETWORK::JAMBOT_USER) + "\" " + \
  288. STRING(LinJamConfig::MakeHostId(NETWORK::NINJAMER_2051_URL )) + "=\"" + \
  289. STRING(NETWORK::JAMBOT_USER) + "\" " + \
  290. STRING(LinJamConfig::MakeHostId(NETWORK::NINJAMER_2052_URL )) + "=\"" + \
  291. STRING(NETWORK::JAMBOT_USER) + "\" " + \
  292. STRING(LinJamConfig::MakeHostId(NETWORK::SERVEBEER_2049_URL)) + "=\"" + \
  293. STRING(NETWORK::BEERBOT_USER) + "\" " + \
  294. "/>"
  295. /* global constants */
  296. /** the APP namespace defines configuration and runtime constants
  297. pertaining to the core LinJam application and business logic */
  298. class APP
  299. {
  300. public:
  301. // app state
  302. enum LinJamStatus { LINJAM_STATUS_INIT = -10 ,
  303. LINJAM_STATUS_AUDIOINIT = -9 ,
  304. LINJAM_STATUS_CONFIGPENDING = -8 ,
  305. LINJAM_STATUS_AUDIOERROR = -7 ,
  306. LINJAM_STATUS_READY = -6 ,
  307. LINJAM_STATUS_LICENSEPENDING = -5 ,
  308. LINJAM_STATUS_ROOMFULL = -4 ,
  309. NJC_STATUS_DISCONNECTED = -3 , // NJClient::ConnectionStatus
  310. NJC_STATUS_INVALIDAUTH = -2 , // NJClient::ConnectionStatus
  311. NJC_STATUS_CANTCONNECT = -1 , // NJClient::ConnectionStatus
  312. NJC_STATUS_OK = 0 , // NJClient::ConnectionStatus
  313. NJC_STATUS_PRECONNECT = 1 } ; // NJClient::ConnectionStatus
  314. // timers
  315. static const int CLIENT_TIMER_ID = 0 ; static const int CLIENT_DRIVER_IVL = 50 ;
  316. static const int AUDIO_INIT_TIMER_ID = 1 ; static const int AUDIO_INIT_DELAY = 250 ;
  317. static const int GUI_LO_TIMER_ID = 2 ; static const int GUI_LO_UPDATE_IVL = 10000 ;
  318. static const int GUI_MD_TIMER_ID = 3 ; static const int GUI_MD_UPDATE_IVL = 2000 ;
  319. static const int GUI_HI_TIMER_ID = 4 ; static const Array<int> GUI_HI_UPDATE_IVLS ;
  320. // runtime initialization of static constants
  321. static void Initialize() ;
  322. // helpers
  323. static StringArray ParseLines(String a_string) ;
  324. static StringArray ParseCSV (String a_string) ;
  325. static String Pluck (StringArray* a_stringarray , int idx) ;
  326. } ;
  327. /** the CLIENT namespace defines configuration and runtime constants
  328. pertaining to NJClient */
  329. namespace CLIENT
  330. {
  331. // server
  332. static const String SERVER_FULL_ERROR = "server full" ;
  333. static const int CHATMSG_TYPE_IDX = 0 ;
  334. static const int CHATMSG_USER_IDX = 1 ;
  335. static const int CHATMSG_MSG_IDX = 2 ;
  336. static const int BOT_CHANNELIDX = 0 ;
  337. // chat
  338. static const String CHATMSG_TYPE_TOPIC = "TOPIC" ;
  339. static const String CHATMSG_TYPE_MSG = "MSG" ;
  340. static const String CHATMSG_TYPE_PRIVMSG = "PRIVMSG" ;
  341. static const String CHATMSG_TYPE_JOIN = "JOIN" ;
  342. static const String CHATMSG_TYPE_PART = "PART" ;
  343. static const String CHATMSG_TYPE_ADMIN = "ADMIN" ;
  344. static const String CHATMSG_CMD_ME = "/me " ;
  345. static const String CHATMSG_CMD_MSG = "/msg " ;
  346. static const String CHATMSG_CMD_TOPIC = "/topic " ;
  347. static const String CHATMSG_CMD_KICK = "/kick " ;
  348. static const String CHATMSG_CMD_BPM = "/bpm " ;
  349. static const String CHATMSG_CMD_BPI = "/bpi " ;
  350. static const String CHATMSG_CMD_ADMIN = "/admin " ;
  351. static const StringRef CHATMSG_CMD_VOTE = "!vote " ;
  352. // configuration
  353. static const String STEREO_L_POSTFIX = "-L" ;
  354. static const String STEREO_R_POSTFIX = "-R" ;
  355. static const int STEREO_POSTFIX_N_CHARS = STEREO_L_POSTFIX.length() ;
  356. // persistence and storage
  357. #ifdef _WIN32
  358. static const String STORAGE_DIRNAME = "LinJam\\" ;
  359. static const String SESSION_DIRNAME = STORAGE_DIRNAME + "Session" ;
  360. #else // _WIN32
  361. static const String STORAGE_DIRNAME = ".linjam/" ;
  362. static const String SESSION_DIRNAME = STORAGE_DIRNAME + "session" ;
  363. #endif // _WIN32
  364. static const String STORAGE_FILENAME = STORAGE_DIRNAME + "linjam.xml" ;
  365. static const String LOG_FILENAME = STORAGE_DIRNAME + "clipsort.log" ;
  366. }
  367. /** the NETWORK namespace defines configuration and runtime constants
  368. pertaining to login and communications */
  369. class NETWORK
  370. {
  371. public:
  372. // login and validations
  373. static const int N_LOGIN_RETRIES ;
  374. static const StringRef HOST_MASK ;
  375. static const StringRef LETTERS ;
  376. static const StringRef DIGITS ;
  377. static const String HOST_CHARS ;
  378. static const String NICK_CHARS ;
  379. // known hosts and bots
  380. static const String LOCALHOST_HOSTNAME ;
  381. static const String LOCALHOST_2049_URL ;
  382. static const String NINJAM_2049_URL ;
  383. static const String NINJAM_2050_URL ;
  384. static const String NINJAM_2051_URL ;
  385. static const String NINJAM_2052_URL ;
  386. static const String NINJAM_2600_URL ;
  387. static const String NINJAM_2601_URL ;
  388. static const String NINBOT_2049_URL ;
  389. static const String NINBOT_2050_URL ;
  390. static const String NINBOT_2051_URL ;
  391. static const String NINBOT_2052_URL ;
  392. static const String NINJAMER_2049_URL ;
  393. static const String NINJAMER_2050_URL ;
  394. static const String NINJAMER_2051_URL ;
  395. static const String NINJAMER_2052_URL ;
  396. static const String SERVEBEER_2049_URL ;
  397. static const String SERVEBEER_2050_URL ;
  398. static const String MUTANTLAB_2049_URL ;
  399. static const Identifier NINBOT_USER ;
  400. static const Identifier JAMBOT_USER ;
  401. static const Identifier BEERBOT_USER ;
  402. static const String KNOWN_HOSTS_KEY ;
  403. static const String KNOWN_BOTS_KEY ;
  404. static ValueTree KNOWN_HOSTS ;
  405. static ValueTree KNOWN_BOTS ;
  406. // http requests
  407. static const String WEBSITE_URL ;
  408. static const String VERSION_URL ;
  409. static const String CLIENTS_URL ;
  410. // outbound control messages
  411. static const String LOGIN_KEY ;
  412. static const String HOST_KEY ;
  413. // static const String MODE_KEY ;
  414. // static const String LINKS_KEY ;
  415. // static const String COLOR_KEY :
  416. // inbound control messages
  417. static const String USER_KEY ;
  418. static const URL POLL_URL ;
  419. static bool IsKnownHost(String host) ;
  420. } ;
  421. /** the CONFIG namespace defines keys/value pairs and default value constants
  422. pertaining to the configuration/persistence model */
  423. namespace CONFIG
  424. {
  425. /* config XML and ValueTree keys */
  426. // config root keys
  427. static const String STORAGE_KEY = "linjam-data" ;
  428. static const Identifier STORAGE_ID = STORAGE_KEY ;
  429. static const String STORAGE_TYPES_KEY = STORAGE_KEY + "-types" ;
  430. static const String CONFIG_VERSION_KEY = "config-version" ;
  431. static const Identifier CONFIG_VERSION_ID = CONFIG_VERSION_KEY ;
  432. // gui config keys
  433. static const String GUI_KEY = "gui" ;
  434. static const Identifier GUI_ID = GUI_KEY ;
  435. static const String FONT_SIZE_KEY = "chat-font-size" ;
  436. static const Identifier FONT_SIZE_ID = FONT_SIZE_KEY ;
  437. static const String UPDATE_IVL_KEY = "gui-update-ivl" ;
  438. static const Identifier UPDATE_IVL_ID = UPDATE_IVL_KEY ;
  439. // client config keys
  440. static const String CLIENT_KEY = "client" ;
  441. static const Identifier CLIENT_ID = CLIENT_KEY ;
  442. static const String SAVE_AUDIO_MODE_KEY = "save-multitrack-mode" ;
  443. static const Identifier SAVE_AUDIO_MODE_ID = SAVE_AUDIO_MODE_KEY ;
  444. static const String MIXDOWN_MODE_KEY = "save-mixdown-mode" ;
  445. static const Identifier MIXDOWN_MODE_ID = MIXDOWN_MODE_KEY ;
  446. static const String SHOULD_SAVE_LOG_KEY = "should-save-log" ;
  447. static const Identifier SHOULD_SAVE_LOG_ID = SHOULD_SAVE_LOG_KEY ;
  448. static const String DEBUG_LEVEL_KEY = "debug-level" ;
  449. static const Identifier DEBUG_LEVEL_ID = DEBUG_LEVEL_KEY ;
  450. static const String SHOULD_HIDE_BOTS_KEY = "should-hide-bots" ;
  451. static const Identifier SHOULD_HIDE_BOTS_ID = SHOULD_HIDE_BOTS_KEY ;
  452. // blacklist config keys
  453. static const String BLACKLIST_KEY = "blacklist" ;
  454. static const Identifier BLACKLIST_ID = BLACKLIST_KEY ;
  455. static const String SUBSCRIBE_MODE_KEY = "subscribe-mode" ;
  456. static const Identifier SUBSCRIBE_MODE_ID = SUBSCRIBE_MODE_KEY ;
  457. // audio device config keys
  458. static const String AUDIO_KEY = "audio" ;
  459. static const Identifier AUDIO_ID = AUDIO_KEY ;
  460. static const String AUDIO_API_KEY = "audio-api-n" ;
  461. static const Identifier AUDIO_API_ID = AUDIO_API_KEY ;
  462. static const String ASIO_DRIVER_KEY = "asio-driver-n" ;
  463. static const Identifier ASIO_DRIVER_ID = ASIO_DRIVER_KEY ;
  464. static const String ASIO_INPUTB_KEY = "asio-input-begin-n" ;
  465. static const Identifier ASIO_INPUTB_ID = ASIO_INPUTB_KEY ;
  466. static const String ASIO_INPUTE_KEY = "asio-input1-end-n" ;
  467. static const Identifier ASIO_INPUTE_ID = ASIO_INPUTE_KEY ;
  468. static const String ASIO_OUTPUTB_KEY = "asio-output-begin-n" ;
  469. static const Identifier ASIO_OUTPUTB_ID = ASIO_OUTPUTB_KEY ;
  470. static const String ASIO_OUTPUTE_KEY = "asio-output-end-n" ;
  471. static const Identifier ASIO_OUTPUTE_ID = ASIO_OUTPUTE_KEY ;
  472. static const String ASIO_CONTROL_KEY = "should-show-asio-cp" ;
  473. static const Identifier ASIO_CONTROL_ID = ASIO_CONTROL_KEY ;
  474. static const String KS_INPUT_KEY = "ks-input-n" ;
  475. static const Identifier KS_INPUT_ID = KS_INPUT_KEY ;
  476. static const String KS_OUTPUT_KEY = "ks-output-n" ;
  477. static const Identifier KS_OUTPUT_ID = KS_OUTPUT_KEY ;
  478. static const String KS_SAMPLERATE_KEY = "ks-sample-rate" ;
  479. static const Identifier KS_SAMPLERATE_ID = KS_SAMPLERATE_KEY ;
  480. static const String KS_BITDEPTH_KEY = "ks-bit-depth" ;
  481. static const Identifier KS_BITDEPTH_ID = KS_BITDEPTH_KEY ;
  482. static const String KS_NBLOCKS_KEY = "ks-n-blocks" ;
  483. static const Identifier KS_NBLOCKS_ID = KS_NBLOCKS_KEY ;
  484. static const String KS_BLOCKSIZE_KEY = "ks-block-size" ;
  485. static const Identifier KS_BLOCKSIZE_ID = KS_BLOCKSIZE_KEY ;
  486. static const String DS_INPUT_KEY = "ds-input" ;
  487. static const Identifier DS_INPUT_ID = DS_INPUT_KEY ;
  488. static const String DS_OUTPUT_KEY = "ds-output" ;
  489. static const Identifier DS_OUTPUT_ID = DS_OUTPUT_KEY ;
  490. static const String DS_SAMPLERATE_KEY = "ds-sample-rate" ;
  491. static const Identifier DS_SAMPLERATE_ID = DS_SAMPLERATE_KEY ;
  492. static const String DS_BITDEPTH_KEY = "ds-bit-depth" ;
  493. static const Identifier DS_BITDEPTH_ID = DS_BITDEPTH_KEY ;
  494. static const String DS_NBLOCKS_KEY = "ds-n-blocks" ;
  495. static const Identifier DS_NBLOCKS_ID = DS_NBLOCKS_KEY ;
  496. static const String DS_BLOCKSIZE_KEY = "ds-block-size" ;
  497. static const Identifier DS_BLOCKSIZE_ID = DS_BLOCKSIZE_KEY ;
  498. static const String WAVE_INPUT_KEY = "wave-input-n" ;
  499. static const Identifier WAVE_INPUT_ID = WAVE_INPUT_KEY ;
  500. static const String WAVE_OUTPUT_KEY = "wave-output-n" ;
  501. static const Identifier WAVE_OUTPUT_ID = WAVE_OUTPUT_KEY ;
  502. static const String WAVE_SAMPLERATE_KEY = "wave-sample-rate" ;
  503. static const Identifier WAVE_SAMPLERATE_ID = WAVE_SAMPLERATE_KEY ;
  504. static const String WAVE_BITDEPTH_KEY = "wave-bit-depth" ;
  505. static const Identifier WAVE_BITDEPTH_ID = WAVE_BITDEPTH_KEY ;
  506. static const String WAVE_NBLOCKS_KEY = "wave-n-blocks" ;
  507. static const Identifier WAVE_NBLOCKS_ID = WAVE_NBLOCKS_KEY ;
  508. static const String WAVE_BLOCKSIZE_KEY = "wave-block-size" ;
  509. static const Identifier WAVE_BLOCKSIZE_ID = WAVE_BLOCKSIZE_KEY ;
  510. static const String CA_INPUT_KEY = "ca-input" ;
  511. static const Identifier CA_INPUT_ID = CA_INPUT_KEY ;
  512. static const String CA_OUTPUT_KEY = "ca-output" ;
  513. static const Identifier CA_OUTPUT_ID = CA_OUTPUT_KEY ;
  514. static const String CA_NCHANNELS_KEY = "ca-n-channels" ;
  515. static const Identifier CA_NCHANNELS_ID = CA_NCHANNELS_KEY ;
  516. static const String CA_SAMPLERATE_KEY = "ca-sample-rate" ;
  517. static const Identifier CA_SAMPLERATE_ID = CA_SAMPLERATE_KEY ;
  518. static const String CA_BITDEPTH_KEY = "ca-bit-depth" ;
  519. static const Identifier CA_BITDEPTH_ID = CA_BITDEPTH_KEY ;
  520. static const String JACK_SERVER_KEY = "jack-server" ;
  521. static const Identifier JACK_SERVER_ID = JACK_SERVER_KEY ;
  522. static const String JACK_NAME_KEY = "jack-name" ;
  523. static const Identifier JACK_NAME_ID = JACK_NAME_KEY ;
  524. static const String JACK_NINPUTS_KEY = "jack-n-inputs" ;
  525. static const Identifier JACK_NINPUTS_ID = JACK_NINPUTS_KEY ;
  526. static const String JACK_NOUTPUTS_KEY = "jack-n-outputs" ;
  527. static const Identifier JACK_NOUTPUTS_ID = JACK_NOUTPUTS_KEY ;
  528. static const String ALSA_INPUT_KEY = "alsa-input" ;
  529. static const Identifier ALSA_INPUT_ID = ALSA_INPUT_KEY ;
  530. static const String ALSA_OUTPUT_KEY = "alsa-output" ;
  531. static const Identifier ALSA_OUTPUT_ID = ALSA_OUTPUT_KEY ;
  532. static const String ALSA_NCHANNELS_KEY = "alsa-n-channels" ;
  533. static const Identifier ALSA_NCHANNELS_ID = ALSA_NCHANNELS_KEY ;
  534. static const String ALSA_SAMPLERATE_KEY = "alsa-sample-rate" ;
  535. static const Identifier ALSA_SAMPLERATE_ID = ALSA_SAMPLERATE_KEY ;
  536. static const String ALSA_BITDEPTH_KEY = "alsa-bit-depth" ;
  537. static const Identifier ALSA_BITDEPTH_ID = ALSA_BITDEPTH_KEY ;
  538. static const String ALSA_NBLOCKS_KEY = "alsa-n-blocks" ;
  539. static const Identifier ALSA_NBLOCKS_ID = ALSA_NBLOCKS_KEY ;
  540. static const String ALSA_BLOCKSIZE_KEY = "alsa-block-size" ;
  541. static const Identifier ALSA_BLOCKSIZE_ID = ALSA_BLOCKSIZE_KEY ;
  542. // server config keys
  543. static const String SERVER_KEY = "server" ;
  544. static const Identifier SERVER_ID = SERVER_KEY ;
  545. static const String SERVERS_KEY = "servers" ;
  546. static const Identifier SERVERS_ID = SERVERS_KEY ;
  547. static const String HOST_KEY = "host" ;
  548. static const Identifier HOST_ID = HOST_KEY ;
  549. static const String LOGIN_KEY = "login" ;
  550. static const Identifier LOGIN_ID = LOGIN_KEY ;
  551. static const String PASS_KEY = "pass" ;
  552. static const Identifier PASS_ID = PASS_KEY ;
  553. static const String IS_ANONYMOUS_KEY = "is-anonymous" ;
  554. static const Identifier IS_ANONYMOUS_ID = IS_ANONYMOUS_KEY ;
  555. static const String IS_AGREED_KEY = "is-agreed" ;
  556. static const Identifier IS_AGREED_ID = IS_AGREED_KEY ;
  557. static const String SHOULD_AGREE_KEY = "should-agree" ;
  558. static const Identifier SHOULD_AGREE_ID = SHOULD_AGREE_KEY ;
  559. static const String BOT_NAME_KEY = "bot-name" ;
  560. static const Identifier BOT_NAME_ID = BOT_NAME_KEY ;
  561. static const String BOT_USERIDX_KEY = "bot-useridx" ;
  562. static const Identifier BOT_USERIDX_ID = BOT_USERIDX_KEY ;
  563. static const Identifier CLIENTS_ID = "clients" ;
  564. // channel config keys
  565. static const Identifier CONFIG_INIT_ID = "configure-all" ;
  566. static const String MASTERS_KEY = "master-channels" ;
  567. static const Identifier MASTERS_ID = MASTERS_KEY ;
  568. static const String MASTER_KEY = "master" ;
  569. static const Identifier MASTER_ID = MASTER_KEY ;
  570. static const String METRO_KEY = "metronome" ;
  571. static const Identifier METRO_ID = METRO_KEY ;
  572. static const String LOCALS_KEY = "local-channels" ;
  573. static const Identifier LOCALS_ID = LOCALS_KEY ;
  574. static const String REMOTES_KEY = "remote-channels" ;
  575. static const Identifier REMOTES_ID = REMOTES_KEY ;
  576. static const String USER_IDX_KEY = "user-idx" ;
  577. static const Identifier USER_IDX_ID = USER_IDX_KEY ;
  578. static const String CHANNEL_NAME_KEY = "channel-name" ;
  579. static const Identifier CHANNEL_NAME_ID = CHANNEL_NAME_KEY ;
  580. static const String CHANNEL_IDX_KEY = "channel-idx" ;
  581. static const Identifier CHANNEL_IDX_ID = CHANNEL_IDX_KEY ;
  582. static const String PAIR_IDX_KEY = "stereo-pair-idx" ;
  583. static const Identifier PAIR_IDX_ID = PAIR_IDX_KEY ;
  584. static const String VOLUME_KEY = "volume" ;
  585. static const Identifier VOLUME_ID = VOLUME_KEY ;
  586. static const String PAN_KEY = "pan" ;
  587. static const Identifier PAN_ID = PAN_KEY ;
  588. static const String IS_XMIT_RCV_KEY = "should-xmit-rcv" ;
  589. static const Identifier IS_XMIT_RCV_ID = IS_XMIT_RCV_KEY ;
  590. static const String IS_MUTED_KEY = "is-muted" ;
  591. static const Identifier IS_MUTED_ID = IS_MUTED_KEY ;
  592. static const String IS_SOLO_KEY = "is-solo" ;
  593. static const Identifier IS_SOLO_ID = IS_SOLO_KEY ;
  594. static const String SOURCE_N_KEY = "source-sink-n" ;
  595. static const Identifier SOURCE_N_ID = SOURCE_N_KEY ;
  596. static const String BIT_DEPTH_KEY = "bit-depth" ;
  597. static const Identifier BIT_DEPTH_ID = BIT_DEPTH_KEY ;
  598. static const String STEREO_KEY = "stereo-status" ;
  599. static const Identifier STEREO_ID = STEREO_KEY ;
  600. static const String VU_LEFT_KEY = "vu-left" ;
  601. static const Identifier VU_LEFT_ID = VU_LEFT_KEY ;
  602. static const String VU_RIGHT_KEY = "vu-right" ;
  603. static const Identifier VU_RIGHT_ID = VU_RIGHT_KEY ;
  604. /* config XML and ValueTree default values */
  605. // config root defaults
  606. static const double CONFIG_VERSION = 0.27 ; // major.minor at last schema change
  607. // gui config defaults
  608. static const int DEFAULT_FONT_SIZE_N = 2 ;
  609. static const int DEFAULT_UPDATE_IVL_N = 3 ;
  610. // client config defaults
  611. static const int SAVE_AUDIO_ENUM_OFFSET = 2 ;
  612. static const int DEFAULT_SAVE_AUDIO_MODE = (int)NJClient::SAVE_TEMP ;
  613. static const int DEFAULT_MIXDOWN_MODE = (int)NJClient::MIXDOWN_NONE ;
  614. static const bool DEFAULT_SHOULD_SAVE_LOG = false ;
  615. static const int DEFAULT_DEBUG_LEVEL = (int)NJClient::DEBUG_SILENT ;
  616. static const bool DEFAULT_SHOULD_HIDE_BOTS = true ;
  617. // blacklist config defaults
  618. static const int DEFAULT_SUBSCRIBE_MODE = (int)NJClient::SUBSCRIBE_DENY ;
  619. // audio config defaults
  620. #ifdef _WIN32
  621. static const int DEFAULT_AUDIO_API = (int)audioStreamer::WIN_AUDIO_WAVE ;
  622. static const int DEFAULT_ASIO_DRIVERN = audioStreamer::DEFAULT_ASIO_DRIVER_N ;
  623. static const int DEFAULT_ASIO_INPUTBN = audioStreamer::DEFAULT_ASIO_INPUTB_N ;
  624. static const int DEFAULT_ASIO_INPUTEN = audioStreamer::DEFAULT_ASIO_INPUTE_N ;
  625. static const int DEFAULT_ASIO_OUTPUTBN = audioStreamer::DEFAULT_ASIO_OUTPUTB_N ;
  626. static const int DEFAULT_ASIO_OUTPUTEN = audioStreamer::DEFAULT_ASIO_OUTPUTE_N ;
  627. static const int DEFAULT_ASIO_CONTROL = audioStreamer::DEFAULT_ASIO_CONTROL ;
  628. static const int DEFAULT_KS_INPUTN = -1 ; // libninjam does not implement this
  629. static const int DEFAULT_KS_OUTPUTN = -1 ; // libninjam does not implement this
  630. static const int DEFAULT_KS_SAMPLERATE = audioStreamer::DEFAULT_SAMPLE_RATE ;
  631. static const int DEFAULT_KS_BITDEPTH = audioStreamer::DEFAULT_BIT_DEPTH ;
  632. static const int DEFAULT_KS_NBLOCKS = audioStreamer::DEFAULT_KS_N_BLOCKS ;
  633. static const int DEFAULT_KS_BLOCKSIZE = audioStreamer::DEFAULT_KS_BLOCK_SIZE ;
  634. static const String DEFAULT_DS_INPUT_NAME = audioStreamer::DEFAULT_DS_DEVICE_NAME ;
  635. static const String DEFAULT_DS_OUTPUT_NAME = audioStreamer::DEFAULT_DS_DEVICE_NAME ;
  636. static const int DEFAULT_DS_SAMPLERATE = audioStreamer::DEFAULT_SAMPLE_RATE ;
  637. static const int DEFAULT_DS_BITDEPTH = audioStreamer::DEFAULT_BIT_DEPTH ;
  638. static const int DEFAULT_DS_NBLOCKS = audioStreamer::DEFAULT_DS_N_BLOCKS ;
  639. static const int DEFAULT_DS_BLOCKSIZE = audioStreamer::DEFAULT_DS_BLOCK_SIZE ;
  640. static const int DEFAULT_WAVE_INPUTN = audioStreamer::DEFAULT_WAVE_INPUT_N ;
  641. static const int DEFAULT_WAVE_OUTPUTN = audioStreamer::DEFAULT_WAVE_OUTPUT_N ;
  642. static const int DEFAULT_WAVE_SAMPLERATE = audioStreamer::DEFAULT_SAMPLE_RATE ;
  643. static const int DEFAULT_WAVE_BITDEPTH = audioStreamer::DEFAULT_BIT_DEPTH ;
  644. static const int DEFAULT_WAVE_NBLOCKS = audioStreamer::DEFAULT_WAVE_N_BLOCKS ;
  645. static const int DEFAULT_WAVE_BLOCKSIZE = audioStreamer::DEFAULT_WAVE_BLOCK_SIZE ;
  646. #else // _WIN32
  647. # ifdef _MAC
  648. static const int DEFAULT_AUDIO_API = (int)audioStreamer::MAC_AUDIO_CA ;
  649. static const String DEFAULT_CA_INPUT_NAME = audioStreamer::DEFAULT_CA_INPUT_NAME ;
  650. static const String DEFAULT_CA_OUTPUT_NAME = audioStreamer::DEFAULT_CA_OUTPUT_NAME ;
  651. static const int DEFAULT_CA_NCHANNELS = audioStreamer::DEFAULT_N_INPUTS ;
  652. static const int DEFAULT_CA_SAMPLERATE = audioStreamer::DEFAULT_SAMPLE_RATE ;
  653. static const int DEFAULT_CA_BITDEPTH = audioStreamer::DEFAULT_BIT_DEPTH ;
  654. # else // _MAC
  655. static const int DEFAULT_AUDIO_API = (int)audioStreamer::NIX_AUDIO_JACK ;
  656. static const int DEFAULT_JACK_SERVERN = 0 ; // libninjam does not implement this
  657. static const String DEFAULT_JACK_NAME = "LinJam" ;
  658. static const int DEFAULT_JACK_NINPUTS = audioStreamer::DEFAULT_N_INPUTS ;
  659. static const int DEFAULT_JACK_NOUTPUTS = audioStreamer::DEFAULT_N_OUTPUTS ;
  660. static const String DEFAULT_ALSA_INPUT_NAME = audioStreamer::DEFAULT_ALSA_INPUT_NAME ;
  661. static const String DEFAULT_ALSA_OUTPUT_NAME = audioStreamer::DEFAULT_ALSA_OUTPUT_NAME ;
  662. static const int DEFAULT_ALSA_NCHANNELS = audioStreamer::DEFAULT_N_INPUTS ;
  663. static const int DEFAULT_ALSA_SAMPLERATE = audioStreamer::DEFAULT_SAMPLE_RATE ;
  664. static const int DEFAULT_ALSA_BITDEPTH = audioStreamer::DEFAULT_BIT_DEPTH ;
  665. static const int DEFAULT_ALSA_NBLOCKS = audioStreamer::DEFAULT_ALSA_N_BLOCKS ;
  666. static const int DEFAULT_ALSA_BLOCKSIZE = audioStreamer::DEFAULT_ALSA_BLOCK_SIZE ;
  667. # endif // _MAC
  668. #endif // _WIN32
  669. // server config defaults
  670. static const String DEFAULT_HOST = "" ;
  671. static const String DEFAULT_LOGIN = "" ;
  672. static const String DEFAULT_PASS = "" ;
  673. static const bool DEFAULT_IS_ANONYMOUS = true ;
  674. static const bool DEFAULT_IS_AGREED = false ;
  675. static const bool DEFAULT_SHOULD_AGREE = false ;
  676. static const String DEFAULT_BOT_NAME = "" ;
  677. static const int DEFAULT_BOT_USERIDX = -1 ;
  678. // channel config defaults
  679. static const Identifier NEWCHANNEL_ID = "new-channel" ;
  680. static const String CHANNEL_BASE_ID = "channel" ;
  681. static const String CHANNELS_KEY = "channels" ;
  682. static const Identifier CHANNELS_ID = CHANNELS_KEY ;
  683. static const String USERS_KEY = "users" ;
  684. static const Identifier USERS_ID = USERS_KEY ;
  685. static const String DEFAULT_CHANNEL_NAME = "unnamed" ;
  686. static const int DEFAULT_CHANNEL_IDX = 42 ; // this is o/c outside bounds
  687. static const int MASTER_CHANNEL_IDX = DEFAULT_CHANNEL_IDX ;
  688. static const double DEFAULT_VOLUME = 0.0f ;
  689. static const double DEFAULT_PAN = 0.0f ;
  690. static const bool DEFAULT_IS_XMIT_RCV = true ;
  691. static const bool DEFAULT_IS_MUTED = false ;
  692. static const bool DEFAULT_IS_SOLO = false ;
  693. static const int DEFAULT_SOURCE_N = 0 ;
  694. static const int MONO = 0 ; // default NJClient mono
  695. static const int STEREO_L = -1 ; // faux-stereo pairs
  696. static const int STEREO_R = +1 ; // faux-stereo pairs
  697. static const int STEREO = 42 ; // masters and metro
  698. static const int DEFAULT_STEREO_STATUS = MONO ;
  699. static const double DEFAULT_VU = -120.0 ;
  700. // config XML storage
  701. static const String BOOL_TYPE = "bool" ;
  702. static const String DOUBLE_TYPE = "double" ;
  703. static const String INT_TYPE = "int" ;
  704. static const String STRING_TYPE = "string" ;
  705. static const String DEFAULT_CONFIG_XML = String(CONFIG_XML) ;
  706. static const String CONFIG_DATATYPES_XML = String(CONFIG_TYPES_XML) ;
  707. // validation
  708. static const StringRef VALID_NAME_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_- " ;
  709. static const StringRef USER_IP_SPLIT_CHAR = "@" ;
  710. }
  711. /** the GUI namespace defines configuration and runtime constants
  712. pertaining to graphical elements */
  713. namespace GUI
  714. {
  715. // common
  716. static const int PAD = 4 ;
  717. static const float PADF = 4.0f ;
  718. static const int PAD2 = PAD * 2 ;
  719. static const float PAD2F = PADF * 2.0f ;
  720. static const int PAD3 = PAD * 3 ;
  721. static const float PAD3F = PADF * 3.0f ;
  722. static const int PAD4 = PAD * 4 ;
  723. static const float PAD4F = PADF * 4.0f ;
  724. static const int PAD5 = PAD * 5 ;
  725. static const float PAD5F = PADF * 5.0f ;
  726. static const int PAD6 = PAD * 6 ;
  727. static const float BORDER_PX = 1.0f ;
  728. static const float BORDER2_PX = 2.0f ;
  729. static const float BORDER_RADIUS = 10.0f ;
  730. static const Colour BORDER_L0_COLOR = Colour(0xFF808080) ; // nest level 0
  731. static const Colour BORDER_L1_COLOR = Colour(0xFFA0A0A0) ; // ...
  732. static const Colour BORDER_L2_COLOR = Colour(0xFFC0C0C0) ; // ...
  733. static const Colour BORDER_L3_COLOR = Colour(0xFFE0E0E0) ; // ...
  734. static const Colour BORDER_L4_COLOR = Colour(0xFFFFFFFF) ; // nest level 4
  735. static const Colour BACKGROUND_L0_COLOR = Colour(0xFF404040) ; // nest level 0
  736. static const Colour BACKGROUND_L1_COLOR = Colour(0xFF303030) ; // ...
  737. static const Colour BACKGROUND_L2_COLOR = Colour(0xFF202020) ; // ...
  738. static const Colour BACKGROUND_L3_COLOR = Colour(0xFF101010) ; // ...
  739. static const Colour BACKGROUND_LTOP_COLOR = Colour(0xFF000000) ; // innermost nest level
  740. static const Colour TEXT_EMPTY_COLOR = Colour(0x80808080) ;
  741. static const Colour TEXT_NORMAL_COLOR = Colour(0xFFFFFFFF) ;
  742. static const Colour TEXT_HILITE_COLOR = Colour(0xFFFFFFFF) ;
  743. static const Colour TEXT_HILITEBG_COLOR = Colour(0xFF000040) ;
  744. static const Colour TEXT_CARET_COLOR = Colour(0xFFBBBBFF) ;
  745. // MainWindow
  746. static const String APP_NAME = "LinJam" ;
  747. static const int BORDERS_W = 2 ;
  748. static const int TITLEBAR_H = 24 ;
  749. static const int CONFIG_BTN_X = GUI::PAD ;
  750. static const int CONFIG_BTN_Y = 3 ;
  751. static const int CONFIG_BTN_W = GUI::TITLEBAR_H - GUI::PAD ;
  752. static const int CONFIG_BTN_H = GUI::TITLEBAR_H - GUI::PAD ;
  753. // MainContent
  754. static const String CONTENT_GUI_ID = "main-content-gui" ;
  755. static const int CONTENT_W = 640 - BORDERS_W ;
  756. static const int CONTENT_H = 480 - BORDERS_W - TITLEBAR_H ;
  757. // Background
  758. static const String BACKGROUND_GUI_ID = "background-gui" ;
  759. // Config
  760. static const String CONFIG_GUI_ID = "config-gui" ;
  761. static const int AUDIO_TAB_IDX = 0 ;
  762. static const int CLIENT_TAB_IDX = 1 ;
  763. static const int GUI_TAB_IDX = 2 ;
  764. static const int BLACKLIST_TAB_IDX = 3 ;
  765. static const String AUDIO_TAB_TEXT = "audio" ;
  766. static const String CLIENT_TAB_TEXT = "client" ;
  767. static const String GUI_TAB_TEXT = "gui" ;
  768. static const String BLACKLIST_TAB_TEXT = "ignores" ;
  769. static const Colour AUDIO_TAB_COLOR = Colour(0xFF002000) ;
  770. static const Colour CLIENT_TAB_COLOR = Colour(0xFF202000) ;
  771. static const Colour GUI_TAB_COLOR = Colour(0xFF000020) ;
  772. static const Colour BLACKLIST_TAB_COLOR = Colour(0xFF200000) ;
  773. static const Colour DISMISS_BTN_OUT_INIT_COLOR = Colour(0xFF404000) ;
  774. static const Colour DISMISS_BTN_OUT_ERROR_COLOR = Colour(0xFF400000) ;
  775. static const Colour DISMISS_BTN_OUT_NORMAL_COLOR = Colour(0xFF004000) ;
  776. static const Colour DISMISS_BTN_IN_INIT_COLOR = Colour(0xFF808000) ;
  777. static const Colour DISMISS_BTN_IN_ERROR_COLOR = Colour(0xFF800000) ;
  778. static const Colour DISMISS_BTN_IN_NORMAL_COLOR = Colour(0xFF008000) ;
  779. static const Colour DISMISS_BTN_TEXT_INIT_COLOR = Colour(0xFFFFFF00) ;
  780. static const Colour DISMISS_BTN_TEXT_ERROR_COLOR = Colour(0xFFFF0000) ;
  781. static const Colour DISMISS_BTN_TEXT_NORMAL_COLOR = Colour(0xFF00FF00) ;
  782. static const String DISMISS_BTN_INIT_TEXT = "initializing" ;
  783. static const String DISMISS_BTN_ERROR_TEXT = "error" ;
  784. static const String DISMISS_BTN_NORMAL_TEXT = "done" ;
  785. // ConfigAudio
  786. static const int DEFAULT_DS_INDEX = 0 ;
  787. static const int DEFAULT_CA_INDEX = 0 ;
  788. static const int DEFAULT_ALSA_INDEX = 0 ;
  789. static const String BUFFERS_GROUP_TEXT = "buffers" ;
  790. static const String NSOURCES_LABEL_TEXT = "# of sources" ;
  791. static const String NCHANNELS_LABEL_TEXT = "# of channels" ;
  792. static const String ASIO_DEVICE_TYPE = "ASIO" ;
  793. static const String KS_DEVICE_TYPE = "KernelStreaming" ; // non-juce
  794. static const String DS_DEVICE_TYPE = "DirectSound" ;
  795. static const String WAVE_DEVICE_TYPE = "Wave" ; // non-juce
  796. static const String WASAPI_DEVICE_TYPE = "WASAPI" ;
  797. static const String CA_DEVICE_TYPE = "CoreAudio" ;
  798. static const String JACK_DEVICE_TYPE = "JACK" ;
  799. static const String ALSA_DEVICE_TYPE = "ALSA" ;
  800. static const String ROID_DEVICE_TYPE = "Android" ;
  801. static const String SLES_DEVICE_TYPE = "OpenSLES" ;
  802. static const String IOS_DEVICE_TYPE = "iOSAudio" ;
  803. static const String NFG_DEVICE_TYPE = "unknown" ; // non-juce
  804. #define WINAUDIOAPIS ASIO_DEVICE_TYPE + "\n" + KS_DEVICE_TYPE + "\n" + \
  805. DS_DEVICE_TYPE + "\n" + WAVE_DEVICE_TYPE
  806. #define MACAUDIOAPIS CA_DEVICE_TYPE
  807. #define NIXAUDIOAPIS JACK_DEVICE_TYPE + "\n" + ALSA_DEVICE_TYPE
  808. #define BUFFERSIZES "32\n64\n128\n256\n512\n1024\n2048\n4096\n8192"
  809. #ifdef _WIN32
  810. static const StringArray AUDIO_APIS = StringArray::fromLines(WINAUDIOAPIS) ;
  811. #else // _WIN32
  812. # ifdef _MAC
  813. static const StringArray AUDIO_APIS = StringArray::fromLines(MACAUDIOAPIS) ;
  814. # else // _MAC
  815. static const StringArray AUDIO_APIS = StringArray::fromLines(NIXAUDIOAPIS) ;
  816. # endif // _MAC
  817. #endif // _WIN32
  818. static const StringArray BUFFER_SIZES = StringArray::fromLines(BUFFERSIZES) ;
  819. static const int BIT_DEPTH_16 = 16 ;
  820. static const int BIT_DEPTH_24 = 24 ;
  821. static const int BIT_DEPTH_32 = 32 ;
  822. static const int SAMPLE_RATE_44100 = 44100 ;
  823. static const int SAMPLE_RATE_48000 = 48000 ;
  824. static const int SAMPLE_RATE_96000 = 96000 ;
  825. static const int MIN_N_BUFFERS = 2 ;
  826. static const int MAX_N_BUFFERS = 16 ;
  827. static const int MIN_N_SOURCES = 0 ;
  828. static const int MAX_N_SOURCES = 16 ;
  829. static const int MIN_N_SINKS = 0 ;
  830. static const int MAX_N_SINKS = 16 ;
  831. // ConfigClient
  832. static const int CONFIG_SCROLLBAR_W = 12 ;
  833. static const int BLACKLIST_X = 24 ;
  834. static const int BLACKLIST_Y = 68 ;
  835. static const int BLACKLIST_W = 144 ;
  836. static const int BLACKLIST_H = 76 ;
  837. #define SAVEMODES "delete asap\ndo not save\nsave ogg\nsave ogg and wav"
  838. #define DEBUGLEVELS "silent\naudio\naudio and network\nlinjam trace"
  839. static const StringArray SAVE_MODES = StringArray::fromLines(SAVEMODES ) ;
  840. static const StringArray DEBUG_LEVELS = StringArray::fromLines(DEBUGLEVELS) ;
  841. // ConfigGui
  842. #define FONTSIZES "12\n16\n20\n24\n36\n48"
  843. #define UPDATEIVLS "none\nslow\nnormal\nfast"
  844. static const StringArray FONT_SIZES = StringArray::fromLines(FONTSIZES ) ;
  845. static const StringArray UPDATE_IVLS = StringArray::fromLines(UPDATEIVLS) ;
  846. // ConfigBlacklist
  847. static const int BLACKLIST_ENTRY_W = BLACKLIST_W - CONFIG_SCROLLBAR_W - PAD2 ;
  848. static const int BLACKLIST_ENTRY_H = 16 ;
  849. // Login
  850. static const String LOGIN_GUI_ID = "login-gui" ;
  851. static const int N_STATIC_LOGIN_CHILDREN = 6 ;
  852. static const int LOGIN_BUTTONS_GROUP_X = GUI::PAD6 ;
  853. static const int LOGIN_BUTTONS_GROUP_Y = GUI::PAD6 ;
  854. static const int LOGIN_BUTTON_L = LOGIN_BUTTONS_GROUP_X + GUI::PAD4 ;
  855. static const int LOGIN_BUTTON_T = LOGIN_BUTTONS_GROUP_Y + GUI::PAD4 ;
  856. static const int LOGIN_BUTTON_W = 128 ;
  857. static const int LOGIN_BUTTON_H = 24 ;
  858. static const String LOGIN_BUTTON_TOOLTIP = "Jammers:\n\t" ;
  859. static const String ROOM_VACANT_TOOLTIP = "(vacant)" ;
  860. static const Colour PROMPT_BACKGROUND_NORMAL_COLOR = Colour(0xFF000000) ;
  861. static const Colour PROMPT_BORDER_NORMAL_COLOR = Colour(0xFFFFFFFF) ;
  862. static const Colour PROMPT_FOCUS_NORMAL_COLOR = Colour(0xFFFFFFFF) ;
  863. static const Colour PROMPT_BACKGROUND_ERROR_COLOR = Colour(0xFF200000) ;
  864. static const Colour PROMPT_BORDER_ERROR_COLOR = Colour(0xFF800000) ;
  865. static const Colour PROMPT_FOCUS_ERROR_COLOR = Colour(0xFFFF0000) ;
  866. static const String HOST_PROMPT_TEXT = "<type a server url here>" ;
  867. static const String LOGIN_PROMPT_TEXT = "<type a nickname here>" ;
  868. static const String PASS_PROMPT_TEXT = "<type a password here>" ;
  869. // License
  870. static const String LICENSE_GUI_ID = "license-gui" ;
  871. // Chat
  872. static const String CHAT_GUI_ID = "chat-gui" ;
  873. static const String SERVER_NICK = "NINJAM" ;
  874. static const String TOPIC_TEXT = "Topic is: " ;
  875. static const String SET_TOPIC_TEXT = " sets topic to: " ;
  876. static const String PM_TEXT = " (whispers)" ;
  877. static const String JOINPART_TEXTa = " has " ;
  878. static const String JOIN_TEXT = "joined" ;
  879. static const String PART_TEXT = "left" ;
  880. static const String JOINPART_TEXTb = " the jam" ;
  881. static const String UNKNOWN_COMMAND_MSG = "Error: unknown command" ;
  882. static const String INVALID_PM_MSG = "Error: /msg requires a username and a message" ;
  883. static const String CHAT_PROMPT_TEXT = "<type some chat here - then press ENTER key to send>" ;
  884. static const Colour TOPIC_TEXT_COLOR = Colour(0xFF8080FF) ;
  885. static const Colour CHAT_TEXT_COLOR = Colour(0xFF808080) ;
  886. static const Colour CHAT_OUTLINE_COLOR = Colour(0x00000000) ;
  887. static const Colour CHAT_FOCUS_COLOR = Colour(0x00000000) ;
  888. static const Colour CHAT_SHADOW_COLOR = Colour(0x00000000) ;
  889. static const Colour CHAT_TEXT_BG_COLOR = Colour(0x00000000) ;
  890. static const int MIN_SHOW_TOPIC_CHAT_H = 200 ;
  891. static const float CHAT_PANE_BORDER_X = 0.0f ;
  892. static const float CHAT_PANE_BORDER_Y = 0.0f ;
  893. static const float TOPIC_FONT_H = 16.0f ;
  894. static const int TOPIC_H = TOPIC_FONT_H ;
  895. static const float TOPIC_BORDER_X = PAD2F ;
  896. static const float TOPIC_BORDER_Y = PAD2F ;
  897. static const float TOPIC_BORDER_PADW = PAD4F ;
  898. static const float TOPIC_BORDER_H = TOPIC_H + PADF ;
  899. static const int TOPIC_X = TOPIC_BORDER_X + PAD ;
  900. static const int TOPIC_PADW = TOPIC_X * 2 ;
  901. static const int TOPIC_PADH = PAD / 2 ;
  902. static const int TOPIC_Y = TOPIC_BORDER_Y + TOPIC_PADH ;
  903. static const int CHAT_X = PAD2 ;
  904. static const int CHAT_Y = PAD2 ;
  905. static const int CHAT_WITH_TOPIC_Y = CHAT_Y + TOPIC_H + PAD2 ;
  906. static const int CHAT_PADH = PAD3 ;
  907. static const int CHAT_PADW = CHAT_X * 2 ;
  908. static const float CHAT_ENTRY_PADH = PADF / 2.0 ;
  909. static const int CHAT_ENTRY_PADY = (CHAT_ENTRY_PADH * 2) + PAD ;
  910. static const float CHAT_BORDER_X = PADF ;
  911. static const float CHAT_BORDER_Y = PADF ;
  912. static const float CHAT_BORDER_PADW = CHAT_BORDER_X * 2.0 ;
  913. // Channel
  914. static const Identifier MASTER_GUI_ID = CONFIG::MASTER_ID ;
  915. static const Identifier METRO_GUI_ID = CONFIG::METRO_ID ;
  916. static const String XMIT_LABEL_TEXT = "XMIT" ;
  917. static const String RCV_LABEL_TEXT = "RCV" ;
  918. static const CharPointer_UTF8 INFINITY_CHAR = CharPointer_UTF8("\xe2\x88\x9e") ;
  919. static const int N_STATIC_CHANNELS_CHILDREN = 4 ;
  920. static const int CHANNEL_LABEL_H = 12 ;
  921. static const int CHANNEL_Y = CHANNEL_LABEL_H + PAD2 ;
  922. static const int CHANNEL_W = 60 ;
  923. static const int CHANNEL_H = 252 ;
  924. static const int HOVER_BTN_W = 15 ;
  925. static const int HOVER_BTN_H = 16 ;
  926. static const int HOVER_BTN_XC = HOVER_BTN_W / 2 ;
  927. static const int HOVER_BTN_YC = HOVER_BTN_H / 2 ;
  928. static const double VU_DB_RANGE = 140.0 ;
  929. static const double VU_DB_MIN = -120.0 ;
  930. // Channels
  931. static const Identifier MASTERS_GUI_ID = CONFIG::MASTERS_ID ;
  932. static const Identifier LOCALS_GUI_ID = CONFIG::LOCALS_ID ;
  933. static const String MASTERS_LABEL_TEXT = "Master" ;
  934. static const String LOCALS_LABEL_TEXT = "Local" ;
  935. static const int CHANNEL_CONFIG_W = 200 ;
  936. static const int CHANNEL_CONFIG_H = 200 ;
  937. static const int MIXERGROUP_Y = PAD ;
  938. static const int MIXERGROUP_H = CHANNEL_H + CHANNEL_LABEL_H + PAD3 ;
  939. static inline int MIXERGROUP_W(int n_channels)
  940. {
  941. return PAD + (n_channels * (CHANNEL_W + PAD)) ;
  942. }
  943. // Mixer
  944. static const String MIXER_GUI_ID = "mixer-gui" ;
  945. static const int MIXER_H = PAD2 + MIXERGROUP_H ;
  946. static const int RESIZER_W = PAD + 2 ;
  947. static const int N_STATIC_MIXER_CHILDREN = 5 ;
  948. static const int LOCALS_IDX = 0 ;
  949. static const int FIRST_REMOTE_IDX = 1 ;
  950. static const int CHANNEL_SCROLL_BTN_H = MIXERGROUP_H / 4 ;
  951. static const int CHANNEL_SCROLL_BTN_W = 24 ;
  952. static const int CHANNEL_SCROLL_BTN_Y = MIXERGROUP_Y +
  953. (MIXERGROUP_H / 2) -
  954. (CHANNEL_SCROLL_BTN_H / 2) ;
  955. // StatusBar
  956. static const String STATUS_GUI_ID = "statusbar-gui" ;
  957. static const String AUDIO_INIT_MSG = "initializing audio" ;
  958. static const String AUDIO_INIT_ERROR_MSG = "audio device error" ;
  959. static const String CONFIG_PENDING_MSG = "press '" + DISMISS_BTN_NORMAL_TEXT + "' to continue" ;
  960. static const String DISCONNECTED_TEXT = "Disconnected" ;
  961. static const String ROOM_FULL_TEXT = "Jam room full" ;
  962. static const String INVALID_AUTH_TEXT = "Invalid login/pass" ;
  963. static const String LICENSE_PENDING_TEXT = "Pending license" ;
  964. static const String FAILED_CONNECTION_TEXT = "Connection failed" ;
  965. static const String CONNECTING_TEXT = "Connecting to " ;
  966. static const String CONNECTED_TEXT = "Connected to " ;
  967. static const String IDLE_TEXT = "Ready" ;
  968. static const int STATUSBAR_H = 24 ;
  969. static const int STATUS_W = 160 ;
  970. static const int STATUS_H = 16 ;
  971. static const int STATUS_PAD_X = 8 ;
  972. static const int STATUS_PAD_Y = 2 ;
  973. // Loop
  974. static const String LOOP_GUI_ID = "loop-gui" ;
  975. static const int LOOP_X = STATUS_W + PAD3 ;
  976. static const int LOOP_H = STATUS_H ;
  977. }
  978. // KLUDGE: no valid conversion for String(a_var) on linux
  979. #define str(a_var) a_var.toString()
  980. #endif // _CONSTANTS_H_