1 2 /* 3 * Diverse SLab audio routines. 4 * Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2012 5 * 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 23 #ifndef SLAB_REVS 24 #define SLAB_REVS 25 26 /***************************************************************** 27 * 28 * The diskBuffer is a large area of shared memory. The child process, 29 * or MIX IO Daemon, reads from the disk into this buffer. It has a 30 * trailing edge of where it needs to write data back to disk (only if 31 * recording), and a leading edge into which it may load data. 32 * The engine process or MIX Daemon also has a leading and trailing 33 * edge into this buffer. Preferably the mixiod can load one block extra 34 * into the buffer to keep ahead of the MIXD. 35 * 36 37 MIXD using this for new writen data - PWrite 38 | MIXD currently mixing this data - PRead 39 | | 40 V V 41 _______________________________________________________ 42 | | | | | 43 | | | | | 44 | | | | | 45 ------------------------------------------------------- 46 ^ ^ ^ ^ 47 | MIXIOD cannot use this | 48 | MIXIOD loading this portion - CRead 49 MIXIOD needs to synchronise this portion to disk - CWrite 50 51 * 52 * Management of the various window pointers is responsibility of the 53 * engine process. Child process is dumb - it reads as far ahead as it 54 * can, and synchronises back to disk all the data between CWrite and PWrite. 55 * Each of the 4 sections of the shared disk buffer consists of X kB from each 56 * track. EG, if we have 16 tracks, at 8192 samples 16bit, this is 1MB of 57 * circular buffer space. The daemon will only write data to disk for the 58 * track data being recorded, not the whole buffer segment. 59 * 60 * The audio daemon buffers and bus buffers are similarly managed. 61 * 62 * Changed the PWrite management to be the adiod for duplex operation. 63 * In this case the pointer is managed by adiod during recording, so 64 * newly recorded data does not even hit the mixengine. 65 * 66 * Any changes to this file should result in alterations to the structure 67 * revision. The controlBuffer revision should be checked whenever a 68 * daemon attaches, reporting an error with different revisions. It is 69 * possible to have different code releases use the same controlBuffer 70 * revision, but not visa versa. 71 * 72 * Revised to allow building different releases simply* and easily. 73 * 74 *****************************************************************/ 75 76 #define BUILD_LEVEL 410 /* For compiling different version from same codebase */ 77 78 /* 79 * Defines the revision of the controlbuffer. Should be reved if changes are 80 * made to this file. Applications will check this structure MAJOR.MINOR.REV 81 * when attaching. If they are different, will fail attachment. 82 * 83 * Reved to 1.1.0 for inclusion of per track dynamics. 84 * Reved to 1.1.1 for additional dynamics parameters. 85 * Reved to 1.1.2 for addition of parametric filter. 86 * Reved to 1.1.3 for pre and post dyn/EQ VU meterage. 87 * Reved to 1.1.4 for ADSR dynamics envelope 88 * Reved to 1.1.5 for decompressionMethod 89 * Reved to 1.1.7 for initial Midi Stuff 90 * Reved to 1.2.0 for 2.0 beta1 91 * Reved to 1.2.1 for removal of CSI file stuff 92 * Reved to 1.3.0 for 2.0 release 93 * Reved to 1.4.0 for post 2.0 release 94 * Reved to 1.5.0 for 2.1 release (input noise reduction) 95 * 96 * Reved to 1.6.0 for 2.2 integrations (effects chains, trims, on/off) 97 * Reved to 1.6.1 for 2.2 audio buffer window configurations. 98 * Reved to 1.6.2 for 2.2 n-backout edits 99 * Reved to 1.6.3 for 2.2 beta 1 100 * Reved to 1.6.4 for DAEMON_VERS entries 101 * Reved to 1.6.5 for SB_NR testing 102 * Reved to 1.6.6 for GEN_CONVERGE testing 103 * Reved to 1.6.7 for adiod debug options 104 * Reved to 1.6.8 for SB_ONR additions 105 * Reved to 1.6.9 for METRONOME additions 106 * Reved to 1.6.10 for input adjustment additions 107 * Reved to 1.6.11 for output mastering 108 * 109 * Reserved 1.7.0 for 2.20 release. 110 * 111 * Reved to 1.7.1 for new audio dev config routines. 112 * Reved to 1.8.0 for 2.30 beta release. 113 * Reved to 1.9.0 for 2.30 release. 114 * Reved to 2.0.0 for 3.00 beta releases. 115 * Reved to 2.1.0 for 3.00 releases. 116 * Reved to 3.10 for 3.10 releases. 117 * Reserved 4.0 for 4.0 releases. 118 */ 119 120 /* 121 * Defines the revision of the software. Should be reved with each software 122 * release. 123 * Reved to 2.0.-1(b) for first round of beta testing. 124 * Reved to 2.0.-2(b) for another half duplex fix. 125 * Reved to 2.0.0(r) ready for distribution. 126 * Reved to 2.1.0(r) ready for distribution. 127 * Reved to 2.2.X(a) for alpha and beta phases. 128 * Reved to 2.20.0(r) for release 129 * Reved to 2.20.1(r) for release 130 * Reved to 2.21.0(d) for audio dev issues. Will become 2.30? 131 * Reved to 2.30-7(b) 132 * Reved to 3.0-1(b) includes floating point fully bussed. 133 * Reved to 3.0-2(b) 134 * Reved to 3.0-3(b) 135 * Reved to 3.10-1(f) 136 * Reved to 4.0-8(b) 137 * Reved to 4.09-11(b) 138 */ 139 140 #if BUILD_LEVEL == 230 141 #define SLAB_MAJOR_ID 1 /* 1.X.-Y(z) */ 142 #ifdef MIDI 143 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 144 #else 145 #define SLAB_MINOR_ID 8 /* X.8.-Y(z) */ 146 #endif 147 #define SLAB_REV_ID -7 /* X.Y.-7(z) */ 148 #define SLAB_STATUS_ID 'b' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 149 #define APP_MAJOR_ID 2 /* 2.X.Y(Z) */ 150 #ifdef MIDI 151 #define APP_MINOR_ID A /* X.A.Y(Z) */ 152 #else 153 #define APP_MINOR_ID 30 /* X.30.Y(Z) */ 154 #endif 155 #define APP_REV_ID -7 /* X.Y.-7(Z) */ 156 #define APP_STATUS_ID 'b' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 157 #endif /* 230 */ 158 159 #if BUILD_LEVEL == 300 160 #define SLAB_MAJOR_ID 3 /* 3.X.-Y(z) */ 161 #ifdef MIDI 162 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 163 #else 164 #define SLAB_MINOR_ID 3 /* X.03.-Y(z) */ 165 #endif 166 #define SLAB_REV_ID 0 /* X.Y.0(z) */ 167 #define SLAB_STATUS_ID 'f' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 168 #define APP_MAJOR_ID 3 /* 3.X.Y(Z) */ 169 #ifdef MIDI 170 #define APP_MINOR_ID A /* X.A.Y(Z) */ 171 #else 172 #define APP_MINOR_ID 3 /* X.03.Y(Z) */ 173 #endif 174 #define APP_REV_ID 0 /* X.Y.0(Z) */ 175 #define APP_STATUS_ID 'f' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 176 #endif /* 300 */ 177 178 #if BUILD_LEVEL == 310 179 #define SLAB_MAJOR_ID 3 /* 3.X.-Y(z) */ 180 #ifdef MIDI 181 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 182 #else 183 #define SLAB_MINOR_ID 11 /* X.11.-Y(z) */ 184 #endif 185 #define SLAB_REV_ID -3 /* X.Y.-3(z) */ 186 #define SLAB_STATUS_ID 'b' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 187 #define APP_MAJOR_ID 3 /* 3.X.Y(Z) */ 188 #ifdef MIDI 189 #define APP_MINOR_ID A /* X.A.Y(Z) */ 190 #else 191 #define APP_MINOR_ID 11 /* X.11.Y(Z) */ 192 #endif 193 #define APP_REV_ID -3 /* X.Y.-3(Z) */ 194 #define APP_STATUS_ID 'b' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 195 #endif /* 310 */ 196 197 #if BUILD_LEVEL == 320 198 #define SLAB_MAJOR_ID 3 /* 2.X.-Y(z) */ 199 #ifdef MIDI 200 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 201 #else 202 #define SLAB_MINOR_ID 21 /* X.21.-Y(z) */ 203 #endif 204 #define SLAB_REV_ID -3 /* X.Y.-3(z) */ 205 #define SLAB_STATUS_ID 'd' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 206 #define APP_MAJOR_ID 3 /* 3.X.Y(Z) */ 207 #ifdef MIDI 208 #define APP_MINOR_ID A /* X.A.Y(Z) */ 209 #else 210 #define APP_MINOR_ID 21 /* X.21.Y(Z) */ 211 #endif 212 #define APP_REV_ID -3 /* X.Y.-3(Z) */ 213 #define APP_STATUS_ID 'd' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 214 #endif /* 320 */ 215 216 #if BUILD_LEVEL == 400 217 #define SLAB_MAJOR_ID 4 /* 2.X.-Y(z) */ 218 #ifdef MIDI 219 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 220 #else 221 #define SLAB_MINOR_ID 0 /* X.0.-Y(z) */ 222 #endif 223 #define SLAB_REV_ID 0 /* X.Y.-4(z) */ 224 #define SLAB_STATUS_ID 'r' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 225 #define APP_MAJOR_ID 4 /* 4.X.Y(Z) */ 226 #ifdef MIDI 227 #define APP_MINOR_ID A /* X.A.Y(Z) */ 228 #else 229 #define APP_MINOR_ID 0 /* X.0.Y(Z) */ 230 #endif 231 #define APP_REV_ID 0 /* X.Y.-4(Z) */ 232 #define APP_STATUS_ID 'r' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 233 #endif /* 400 */ 234 235 #if BUILD_LEVEL == 410 236 #define SLAB_MAJOR_ID 4 /* 2.X.-Y(z) */ 237 #ifdef MIDI 238 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 239 #else 240 #define SLAB_MINOR_ID 9 /* X.1.-Y(z) */ 241 #endif 242 #define SLAB_REV_ID -13 /* X.Y.-1(z) */ 243 #define SLAB_STATUS_ID 'b' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 244 #define APP_MAJOR_ID 4 /* 4.X.Y(Z) */ 245 #ifdef MIDI 246 #define APP_MINOR_ID A /* X.A.Y(Z) */ 247 #else 248 #define APP_MINOR_ID 9 /* X.01.Y(Z) */ 249 #endif 250 #define APP_REV_ID -13 /* X.Y.-1(Z) */ 251 #define APP_STATUS_ID 'b' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 252 #endif /* 410 */ 253 254 #if BUILD_LEVEL == 500 255 #define SLAB_MAJOR_ID 5 /* 2.X.-Y(z) */ 256 #ifdef MIDI 257 #define SLAB_MINOR_ID A /* X.A.-Y(z) */ 258 #else 259 #define SLAB_MINOR_ID 0 /* X.0.-Y(z) */ 260 #endif 261 #define SLAB_REV_ID -1 /* X.Y.-6(z) */ 262 #define SLAB_STATUS_ID 'd' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 263 #define APP_MAJOR_ID 5 /* 4.X.Y(Z) */ 264 #ifdef MIDI 265 #define APP_MINOR_ID A /* X.A.Y(Z) */ 266 #else 267 #define APP_MINOR_ID 0 /* X.0.Y(Z) */ 268 #endif 269 #define APP_REV_ID -1 /* X.Y.-1(Z) */ 270 #define APP_STATUS_ID 'd' /* 'r'elease, 'a'lpha, 'b'eta, 'f'ix, 'd'evel */ 271 #endif /* 500 */ 272 273 /* 274 * The following are compilation options, 275 * impression software, and expression software 276 * 277 * Define some options. FX_ONOFF requires FX_CHAINS..... 278 */ 279 #define ADIOD_DBG /* Duplex dev debug flags */ 280 #define OUTPUT_VU /* output VU meters done in adiod */ 281 #define INPUT_TRACKING /* VU meters will track the input source */ 282 #define GEN_CONVERGE /* For arbitrary 16<->8 audio IO */ 283 #define I_NR true /* filters and dynamics in record channel */ 284 #define SB_DUPLEX 0x20/* Support for SoundBlaster 8 bit full duplex input */ 285 #define SB_NR /* Support for SoundBlaster interpolative noise red */ 286 #define SB_ONR /* Support for 8 bit output noise reduction */ 287 #define SOX_FE /* Support for SOX frontend */ 288 #define NBE 1 /* n-backout edit facilities version */ 289 #define LOOPS /* Export data, then loop it to main audio out */ 290 #define DAEMON_VERS /* All Daemons will register their revisions */ 291 /* 292 * New device configuration was intended for 3.0, but due to issues with the 293 * previous config methods it has been moved forward. 294 */ 295 #define NEW_DEV_CONFIG /* All devices to be configured from dev file */ 296 #define NEWER_DEV_CONFIG/* ALL devices options configured from dev file */ 297 /* 298 * Want to have the engine insert metronome beats at a configurable interval, 299 * and GUI will allow beats such as 4/4, 3/4, perhaps 6/8 (others on demand) 300 * and a tempo. The controlBuffer will only carry the sample insert location 301 * This will be appended in WaveSLab with Beat and Bar highlights, plus 302 * ability to select beats and bars for editing. 303 * Note that input adjust really requires METRONOME support. 304 */ 305 #define METRONOME 0x20 /* Applied to conversionFlags, watch for RE_RECORD */ 306 #define SMPTE_EDITS /* WaveSLab support for frame marking/selection */ 307 /* 308 * Going to add a couple of features to a possible 2.30 release. These will be 309 * additional libmixer ioctl() debug options, plus a subfragment feature to 310 * decouple the audio fragment size from the blockSampleSize, a capability to 311 * use a modified audio init sequence and finally a single adiod for all 312 * devices for better sync. 313 */ 314 #if BUILD_LEVEL >= 230 315 #define FX_CHAINS /* Ability to chain effects - now a requirement */ 316 #define FX_TRIMMING /* Ability to trim inbound and outbound effect signal */ 317 #define FX_ONOFF /* Ability to bypass effects */ 318 #define IOCTL_DBG /* More output of ioctl routines */ 319 #define SUBFRAGMENT /* New dev init, plus subfragment bss to output size */ 320 #define MICROADJUST /* Ability to permille speedup/slowdown of IO speeds */ 321 #define HELLO_DIS /* Ability to disable hello message */ 322 #define MICRO_TAPE /* Insert small tape controller on desk */ 323 #define NEW_DBG /* Ability to disable hello message */ 324 #define SMALL_ICONS /* This is for GUI only */ 325 #define SLAB_PIPO 0x1000 /* Punch in punch out support */ 326 #define YASBHACK /* Yet another SoundBlaster hack, for 16/8 support */ 327 #endif /* BUILD_LEVEL 230 */ 328 /* 329 * The above feature definitions are for 2.X software, and the features below 330 * will be 3.0 and above. 331 */ 332 #if BUILD_LEVEL >= 300 333 /* 334 * The next two are going into SLab 3.0 only. They will not be compiled into 335 * the code that becomes 2.20 (they will hit the 2.2 beta for testing). 336 */ 337 #define FLOAT_PROC 0x800 /* Processing of floats as well as ints */ 338 #define SLAB_SEPARATE /* Separate disk track from mixer track */ 339 #define MASTERING 0x80 /* output daemon support for master files */ 340 #define PRIVATE_SCALE /* Internal scaler with modified graphics */ 341 #define FLOAT_SYNC_FIX 342 #define USE_SHADOW /* Use the shadow device for auditioning */ 343 #endif /* BUILD_LEVEL 300 */ 344 345 #if BUILD_LEVEL >= 310 346 #define ADIOD_MULTI 0x4000 /* Single audio IO daemon */ 347 #define SESSION_TIMERS /* milli second timers for session recording */ 348 #define SESSION_POINTERS /* Offsets for session list from TapeSLab */ 349 #define SMOOTH_MEMORY /* Check for alterations from baseline to current mix */ 350 /* 351 * NOTE: We do not need a SOFT_START flag, I would prefer to make this into 352 * an enable/disable flag. 353 */ 354 #define SOFT_START 0x8000 /* Use crossfade when starting ALL record ops */ 355 #define SLAB_MIDI_SYNC /* Engine is general sync (SMPTE), GUI is MIDI now */ 356 #define GLIBC_21 /* This should be dropped */ 357 #define DEV_SELECTOR /* Requestor for parameters of some known cards */ 358 #define DE_CLICK 359 #define AUDIO_API 360 #define SECONDARY_FLAGS /* devDisable, SLAB_MIDI_SYNC and others require this */ 361 #endif /* BUILD_LEVEL 310 */ 362 363 #if BUILD_LEVEL >= 320 364 /* 365 * 3.20 is a build for Xoan Pedrokova(?), with the single main enhancement that 366 * there is an API for linking to an external mix driver. This will be used by 367 * the University to build a MIDI driver and a hardware mixer for SLab. The 368 * API will be based on the sessionRecording facilities (if they agree), such 369 * that track/master/operator events will be linked into the mix via session 370 * recording which is the single common point for all events. There will be some 371 * enhancements required to allow the MIDI interface to define some things like 372 * the algorithms and file/device management. 373 * To avoid the complexities of having to link to the controlBuffer, this will 374 * require we have an internal socket interface to which session events are 375 * sent. 376 */ 377 #define CONTROL_API /* */ 378 #define GLIBC_21 /* This is a requirement for the control API */ 379 /* 380 * This is not going into this release? Maybe, maybe not, it would make sense 381 * to let it hit the CONTROL_API release. 382 */ 383 #endif /* BUILD_LEVEL 320 */ 384 385 #if BUILD_LEVEL >= 400 386 #define CD_MASTER /* GUI Frontend to cdwrite */ 387 #define CD_R_OUTPUT 2352/* CD-R redbook mastering format */ 388 #define CD_RECORD /* burner application */ 389 #define DAEMON_AUTOTUNE 0x08 /* mixiod and mixengined will evaluate sleepP */ 390 #define CONTROL_FLOAT 391 /* 392 * To disable ALSA support, comment out this next line. FreeBSD does not have 393 * any access to ALSA devices, hence they are not included in compilation. 394 * 395 * This now defaults to disabled, I don't think ALSA has either the stability 396 * nor the penetration for general use. There are large changes between ALSA 397 * releases, so if you have 0.5.X or later, be prepare for hacking my audio 398 * libraries. If you enable ALSA driver support, you need to check out the 399 * makefile in the "src/bin" directory as well. 400 */ 401 #define MASTERING_WAV 402 #define MASTERING_MP3 403 #endif /* BUILD_LEVEL 400 */ 404 405 #if BUILD_LEVEL >= 410 406 #define INC_SOURCE /* Some alterations for distribution of source code */ 407 #endif /* BUILD_LEVEL 410 */ 408 409 #if BUILD_LEVEL >= 420 410 #define FULL_MIDI_SYNC 411 #endif /* BUILD_LEVEL 420 */ 412 413 #if BUILD_LEVEL >= 500 414 /* 415 * Not sure exactly where we will go after 4.0, but this will probably be the 416 * first MIDI support, with MTC sync. Will also look towards SMTPE sync, and 417 * also into more general MIDI support. Realtime mixing is also a possibility. 418 * Should also look to build some kind of event editor for session recording. 419 * 420 * Going for a hit on realtime mixing, 24bit/96kHz support. Will include 421 * multichannel cards, and require floating point support. 422 * 423 * Sync is slowly slipping, there have been very few request for sync, although 424 * several parties have asked for multihead board, and multihead is decidedly 425 * with realtime operations. Apart from that, I am very interested in putting 426 * this together, and MIDI sync kind of depends on developments at the Uni 427 * in Spain, who are writing a MIDI interface. On a related note, I should 428 * put out some requests for somebody to write an EDL interface..... 429 */ 430 #define MULTI_CHANNEL 431 #define REAL_TIME 432 #endif /* BUILD_LEVEL 500 */ 433 434 /* 435 * There are a few definitions which are pretty global. In order to be able to 436 * make a true slabaudiodev.h visible they are needed here. 437 */ 438 /* 439 * This is going to be the max configuration - 64-16-8-4-2: 440 * 64 tracks, plus master, master lefts and rights, bus LR, and . 441 * 8 EACH of sends and auxs (these are more or less the same.....) 442 * 8 mix busses (ie, 4 stereo busses). 443 * 8 Stereo outs (for multihead support, or aux monitor support). 444 */ 445 #define MAX_DEVICES 8 446 typedef int (*mixAlgo)(); 447 448 /* 449 * These are now being taken right out of the sys/soundcard.h file. This is 450 * perhaps not too clever, but I do not want to require this in the source GUI 451 * source code. It should be turned into API calls? 452 */ 453 #ifndef INC_SOURCE 454 #define SLAB_NRDEVICES SOUND_MIXER_NRDEVICES 455 #define SLAB_DEVICE_LABELS SOUND_DEVICE_LABELS 456 #else 457 #define SLAB_NRDEVICES 64 458 #endif 459 460 #endif /* SLAB_REVS */ 461 462