AJA NTV2 SDK  18.1.0.2145
NTV2 SDK 18.1.0.2145
ntv2audio.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #include "ntv2card.h"
8 #include "ntv2devicefeatures.h"
9 #include "ntv2utils.h"
10 #include "ntv2audiodefines.h"
11 #include "ajabase/common/common.h"
12 #include "ajabase/system/debug.h"
14 #ifdef MSWindows
15  #include <math.h>
16  #pragma warning(disable: 4800)
17 #endif // MSWindows
18 
19 using namespace std;
20 
21 
22 #define AUDFAIL(__x__) AJA_sERROR (AJA_DebugUnit_AudioGeneric, " " << HEX0N(uint64_t(this),16) << "::" << AJAFUNC << ": " << __x__)
23 #define AUDWARN(__x__) AJA_sWARNING(AJA_DebugUnit_AudioGeneric, " " << HEX0N(uint64_t(this),16) << "::" << AJAFUNC << ": " << __x__)
24 #define AUDNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_AudioGeneric, " " << HEX0N(uint64_t(this),16) << "::" << AJAFUNC << ": " << __x__)
25 #define AUDINFO(__x__) AJA_sINFO (AJA_DebugUnit_AudioGeneric, " " << HEX0N(uint64_t(this),16) << "::" << AJAFUNC << ": " << __x__)
26 #define AUDDBUG(__x__) AJA_sDEBUG (AJA_DebugUnit_AudioGeneric, " " << HEX0N(uint64_t(this),16) << "::" << AJAFUNC << ": " << __x__)
27 
28 
31 
34 
37 
40 
43 
45 
48 
51 
54 
59  inline PCM_CONTROL_INFO(ULWord regNum, ULWord mask, ULWord shift) : pcmControlReg(regNum), pcmControlMask(mask), pcmControlShift(shift){}
60 };
61 
63 {
64  {
73  },
74  {
83  },
84  {
93  },
94  {
103  },
104  {
113  },
114  {
123  },
124  {
133  },
134  {
143  }
144 };
145 
146 
147 bool CNTV2Card::SetNumberAudioChannels (const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem)
148 {
149  const ULWord regAudControl (NTV2_IS_VALID_AUDIO_SYSTEM (inAudioSystem) ? gAudioSystemToAudioControlRegNum [inAudioSystem] : 0);
150 
151  if (regAudControl == 0)
152  return false;
153  else if (inNumChannels == 6 || inNumChannels == 8)
154  {
155  // Make sure 16 channel audio is off
156  WriteRegister (regAudControl, 0, kRegMaskAudio16Channel, kRegShiftAudio16Channel);
157 
158  // Now turn on 6 or 8 channel audio
159  return WriteRegister (regAudControl, inNumChannels == 8, kRegMaskNumChannels, kRegShiftNumChannels);
160  }
161  else if (inNumChannels == 16)
162  {
163  // Turn 16 channel audio on, doesn't matter how 8 or 6 channel is set
164  return WriteRegister (regAudControl, 1, kRegMaskAudio16Channel, kRegShiftAudio16Channel);
165  }
166  else
167  return false;
168 }
169 
170 
171 bool CNTV2Card::SetNumberAudioChannels (const ULWord inNumChannels, const NTV2AudioSystemSet & inAudioSystems)
172 {
173  size_t numFailures(0);
174  for (NTV2AudioSystemSetConstIter it(inAudioSystems.begin()); it != inAudioSystems.end(); ++it)
175  if (!SetNumberAudioChannels (inNumChannels, *it))
176  numFailures++;
177  return numFailures == 0;
178 }
179 
180 
181 bool CNTV2Card::GetNumberAudioChannels (ULWord & outNumChannels, const NTV2AudioSystem inAudioSystem)
182 {
183  const ULWord regAudControl (NTV2_IS_VALID_AUDIO_SYSTEM (inAudioSystem) ? gAudioSystemToAudioControlRegNum [inAudioSystem] : 0);
184  ULWord value (0);
185  bool status (false);
186 
187  if (regAudControl == 0)
188  return false;
189 
190  status = ReadRegister (regAudControl, value, kRegMaskAudio16Channel, kRegShiftAudio16Channel);
191  if (value == 1)
192  outNumChannels = 16;
193  else
194  {
195  status = ReadRegister (regAudControl, value, kRegMaskNumChannels, kRegShiftNumChannels);
196  if (value == 1)
197  outNumChannels = 8;
198  else
199  outNumChannels = 6;
200  }
201 
202  return status;
203 }
204 
205 
206 bool CNTV2Card::SetAudioRate (const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem)
207 {
208  ULWord rateLow (0);
209  ULWord rateHigh (0);
210  bool status;
211 
212  if ((inRate == NTV2_AUDIO_192K) && (inAudioSystem == NTV2_AUDIOSYSTEM_1))
213  return false;
214 
215  if (inRate == NTV2_AUDIO_96K)
216  rateLow = 1;
217  else if (inRate == NTV2_AUDIO_192K)
218  rateHigh = 1;
219 
220  status = WriteRegister (gAudioSystemToAudioControlRegNum [inAudioSystem], rateLow, kRegMaskAudioRate, kRegShiftAudioRate);
221  status &= WriteRegister (kRegAudioControl2, rateHigh, gAudioRateHighMask [inAudioSystem], gAudioRateHighShift [inAudioSystem]);
222 
223  return status;
224 }
225 
226 
227 bool CNTV2Card::GetAudioRate (NTV2AudioRate & outRate, const NTV2AudioSystem inAudioSystem)
228 {
229  ULWord rateLow (0);
230  ULWord rateHigh (0);
231  bool status;
232 
233  status = ReadRegister (gAudioSystemToAudioControlRegNum [inAudioSystem], rateLow, kRegMaskAudioRate, kRegShiftAudioRate);
234  status &= ReadRegister (kRegAudioControl2, rateHigh, gAudioRateHighMask [inAudioSystem], gAudioRateHighShift [inAudioSystem]);
235  if (status)
236  {
237  if ((rateLow == 0) && (rateHigh == 0))
238  outRate = NTV2_AUDIO_48K;
239  else if ((rateLow == 1) && (rateHigh == 0))
240  outRate = NTV2_AUDIO_96K;
241  else if ((rateLow == 0) && (rateHigh == 1))
242  outRate = NTV2_AUDIO_192K;
243  else
244  status = false;
245  }
246  return status;
247 }
248 
249 
250 bool CNTV2Card::SetAudioBufferSize (const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem)
251 {
252  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
253  return false;
254  if (inValue != NTV2_AUDIO_BUFFER_SIZE_4MB && IsSupported(kDeviceCanDoStackedAudio))
255  return false; // Stacked audio devices are fixed at 4MB
256  return WriteRegister (gAudioSystemToAudioControlRegNum[inAudioSystem], inValue, kK2RegMaskAudioBufferSize, kK2RegShiftAudioBufferSize);
257 }
258 
259 bool CNTV2Card::SetAudioBufferSize (const NTV2AudioBufferSize inMode, const NTV2AudioSystemSet & inAudioSystems)
260 {
261  size_t numFailures(0);
262  for (NTV2AudioSystemSetConstIter it(inAudioSystems.begin()); it != inAudioSystems.end(); ++it)
263  if (!SetAudioBufferSize (inMode, *it))
264  numFailures++;
265  return numFailures == 0;
266 }
267 
268 
270 {
271  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
272  return false;
273  outSize = NTV2_AUDIO_BUFFER_SIZE_4MB; // NTV2 has standardized on 4MB audio buffers
274  if (IsSupported(kDeviceCanDoStackedAudio))
275  return true; // Done!
276 
278 }
279 
280 
281 bool CNTV2Card::SetAudioAnalogLevel (const NTV2AudioLevel inLevel, const NTV2AudioSystem inAudioSystem)
282 {
283  (void)inAudioSystem;
284  if (IsSupported(kDeviceHasBreakoutBoard))
286  else
287  return WriteRegister (kRegAud1Control, inLevel, kFS1RegMaskAudioLevel, kFS1RegShiftAudioLevel);
288 }
289 
290 
291 bool CNTV2Card::GetAudioAnalogLevel (NTV2AudioLevel & outLevel, const NTV2AudioSystem inAudioSystem)
292 {
293  (void)inAudioSystem;
294  if (IsSupported(kDeviceHasBreakoutBoard))
296  else
298 }
299 
300 
301 bool CNTV2Card::SetAudioLoopBack (const NTV2AudioLoopBack inValue, const NTV2AudioSystem inAudioSystem)
302 {
303  if (!NTV2_IS_VALID_AUDIO_LOOPBACK(inValue))
304  return false;
305  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
306  return false;
307  if (inValue == NTV2_AUDIO_LOOPBACK_ON)
308  SetEmbeddedAudioClock (NTV2_EMBEDDED_AUDIO_CLOCK_REFERENCE, inAudioSystem); // Use board reference as audio clock
309  return WriteRegister (gAudioSystemToAudioControlRegNum [inAudioSystem], inValue, kRegMaskLoopBack, kRegShiftLoopBack);
310 }
311 
312 bool CNTV2Card::SetAudioLoopBack (const NTV2AudioLoopBack inMode, const NTV2AudioSystemSet & inAudioSystems)
313 {
314  size_t numFailures(0);
315  for (NTV2AudioSystemSetConstIter it(inAudioSystems.begin()); it != inAudioSystems.end(); ++it)
316  if (!SetAudioLoopBack (inMode, *it))
317  numFailures++;
318  return numFailures == 0;
319 }
320 
321 
322 bool CNTV2Card::GetAudioLoopBack (NTV2AudioLoopBack & outValue, const NTV2AudioSystem inAudioSystem)
323 {
324  outValue = NTV2_AUDIO_LOOPBACK_INVALID;
325  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
326  return false;
328 }
329 
330 
332 {
333  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
334  return false;
335  return WriteRegister (gAudioSystemToAudioControlRegNum[inAudioSystem], inMode, kRegMaskEncodedAudioMode, kRegShiftEncodedAudioMode);
336 }
337 
338 
340 {
341  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
342  return false;
344 }
345 
346 
347 bool CNTV2Card::SetEmbeddedAudioInput (const NTV2EmbeddedAudioInput inAudioInput, const NTV2AudioSystem inAudioSystem)
348 {
349  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
350  return false;
351  const ULWord regAudSource (gAudioSystemToSrcSelectRegNum [inAudioSystem]);
352  const ULWord numInputs (GetNumSupported(kDeviceGetNumVideoInputs));
353  const ULWord numHDMI (GetNumSupported(kDeviceGetNumHDMIVideoInputs));
354  bool status (false);
355  ULWord value1 (0);
356  ULWord value2 (0);
357 
358  switch (inAudioInput)
359  { // Sparse bits
360  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_1: value1 = 0x0; value2 = 0x0; break;
361  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_2: value1 = 0x1; value2 = 0x0; break;
362  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_3: value1 = 0x0; value2 = 0x1; break;
363  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_4: value1 = 0x1; value2 = 0x1; break;
364  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_5: value1 = 0x0; value2 = 0x0; break;
365  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_6: value1 = 0x1; value2 = 0x0; break;
366  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_7: value1 = 0x0; value2 = 0x1; break;
367  case NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_8: value1 = 0x1; value2 = 0x1; break;
368  default: return false;
369  }
370 
371  status = WriteRegister (regAudSource, value1, kRegMaskEmbeddedAudioInput, kRegShiftEmbeddedAudioInput);
372  if (numInputs > 2 || inAudioInput > NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_4 || numHDMI > 1)
373  status = WriteRegister (regAudSource, value2, kRegMaskEmbeddedAudioInput2, kRegShiftEmbeddedAudioInput2);
374  return status;
375 }
376 
377 
379 {
380  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
381  return false;
382  const ULWord srcSelectReg (gAudioSystemToSrcSelectRegNum [inAudioSystem]);
383  const ULWord numInputs (GetNumSupported(kDeviceGetNumVideoInputs));
384  ULWord value (0);
385  bool status (false);
386 
387  if (numInputs <= 2)
388  status = ReadRegister (srcSelectReg, value, kRegMaskEmbeddedAudioInput, kRegShiftEmbeddedAudioInput);
389  else
390  {
391  ULWord sparse1(0), sparse2(0); // Sparse bits
392  status = ReadRegister (srcSelectReg, sparse1, kRegMaskEmbeddedAudioInput, kRegShiftEmbeddedAudioInput)
393  && ReadRegister (srcSelectReg, sparse2, kRegMaskEmbeddedAudioInput2, kRegShiftEmbeddedAudioInput2);
394  if (!sparse1 && !sparse2)
396  else if (sparse1 && !sparse2)
398  else if (!sparse1 && sparse2)
400  else if (sparse1 && sparse2)
402 
403  if (inAudioSystem >= NTV2_AUDIOSYSTEM_5)
404  switch (value)
405  {
410  }
411  }
412  if (status)
413  outAudioInput = NTV2EmbeddedAudioInput(value);
414  return status;
415 }
416 
417 
419 {
420  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
421  return false;
422  return WriteRegister (gAudioSystemToSrcSelectRegNum[inAudioSystem], inValue, kRegMaskEmbeddedAudioClock, kRegShiftEmbeddedAudioClock);
423 }
424 
425 
427 {
428  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
429  return false;
431 }
432 
433 
434 bool CNTV2Card::GetAudioWrapAddress (ULWord & outWrapAddress, const NTV2AudioSystem inAudioSystem)
435 {
437  if (!GetAudioBufferSize (bufferSize, inAudioSystem))
438  return false;
439 
440  switch (bufferSize)
441  {
442  case NTV2_AUDIO_BUFFER_SIZE_1MB: outWrapAddress = NTV2_AUDIO_WRAPADDRESS; break; // (0x000FF000 * 1)
443  case NTV2_AUDIO_BUFFER_SIZE_4MB: outWrapAddress = NTV2_AUDIO_WRAPADDRESS_BIG; break; // (0x000FF000 * 4)
444  default: outWrapAddress = NTV2_AUDIO_WRAPADDRESS; break;
445  }
446  return true;
447 }
448 
449 
450 bool CNTV2Card::GetAudioReadOffset (ULWord & outReadOffset, const NTV2AudioSystem inAudioSystem)
451 {
453  if (!GetAudioBufferSize (bufferSize, inAudioSystem))
454  return false;
455 
456  switch (bufferSize)
457  {
458  case NTV2_AUDIO_BUFFER_SIZE_1MB: outReadOffset = NTV2_AUDIO_READBUFFEROFFSET; break; // (0x00100000 * 1) 1MB
459  case NTV2_AUDIO_BUFFER_SIZE_4MB: outReadOffset = NTV2_AUDIO_READBUFFEROFFSET_BIG; break; // (0x00100000 * 4) 4MB
460  default: outReadOffset = NTV2_AUDIO_READBUFFEROFFSET; break; // (0x00100000 * 1) 1MB
461  }
462  return true;
463 }
464 
465 
466 bool CNTV2Card::ReadAudioLastIn (ULWord & outValue, const NTV2AudioSystem inAudioSystem)
467 {
468  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
469  return false;
470  return ReadRegister (gChannelToAudioInLastAddrRegNum[inAudioSystem], outValue);
471 }
472 
473 bool CNTV2Card::ReadAudioLastOut (ULWord & outValue, const NTV2AudioSystem inAudioSystem)
474 {
475  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
476  return false;
477  return ReadRegister (gChannelToAudioOutLastAddrRegNum[inAudioSystem], outValue);
478 }
479 
480 #if !defined(NTV2_DEPRECATE_16_0)
481  bool CNTV2Card::ReadAudioSource (ULWord & outValue, const NTV2Channel inChannel) {return ReadRegister(gAudioSystemToSrcSelectRegNum[inChannel], outValue);}
482  bool CNTV2Card::WriteAudioSource (const ULWord inValue, const NTV2Channel inChannel) {return WriteRegister(gAudioSystemToSrcSelectRegNum[inChannel], inValue);}
483 #endif // !defined(NTV2_DEPRECATE_16_0)
484 
485 
486 bool CNTV2Card::SetAudioSystemInputSource (const NTV2AudioSystem inAudioSystem, const NTV2AudioSource inAudioSource, const NTV2EmbeddedAudioInput inEmbeddedSource)
487 {
488  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
489  return false;
490  bool result(false);
491  static const ULWord sAudioSourceToRegValues [] = { 0x1, // NTV2_AUDIO_EMBEDDED
492  0x0, // NTV2_AUDIO_AES
493  0x9, // NTV2_AUDIO_ANALOG
494  0xA, // NTV2_AUDIO_HDMI
495  0xB}; // NTV2_AUDIO_MIC
496 
497  if (ULWord(inAudioSystem) < GetNumSupported(kDeviceGetTotalNumAudioSystems))
498  if (NTV2_IS_VALID_AUDIO_SOURCE(inAudioSource))
499  result = WriteRegister (gAudioSystemToSrcSelectRegNum [inAudioSystem],
500  sAudioSourceToRegValues [inAudioSource],
502  if (result)
503  {
504  if ((inAudioSource == NTV2_AUDIO_EMBEDDED) || (inAudioSource == NTV2_AUDIO_HDMI))
505  if (SetEmbeddedAudioInput (inEmbeddedSource, inAudioSystem)) // Use the specified input for grabbing embedded audio
506  result = SetEmbeddedAudioClock (NTV2_EMBEDDED_AUDIO_CLOCK_VIDEO_INPUT, inAudioSystem); // Use video input clock (not reference)
507 
508  if (IsSupported(kDeviceCanDoBreakoutBoard))
509  result = EnableBOBAnalogAudioIn(IsSupported(kDeviceHasBreakoutBoard) && inAudioSource == NTV2_AUDIO_ANALOG);
510  }
511  return result;
512 
513 } // SetAudioSystemInputSource
514 
515 
516 bool CNTV2Card::GetAudioSystemInputSource (const NTV2AudioSystem inAudioSystem, NTV2AudioSource & outAudioSource, NTV2EmbeddedAudioInput & outEmbeddedSource)
517 {
518  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
519  return false;
520  ULWord regValue (0);
521 
522  outAudioSource = NTV2_AUDIO_SOURCE_INVALID;
523  outEmbeddedSource = NTV2_EMBEDDED_AUDIO_INPUT_INVALID;
524 
525  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetTotalNumAudioSystems))
526  return false; // Invalid audio system
527  if (!ReadRegister (gAudioSystemToSrcSelectRegNum [inAudioSystem], regValue, kRegMaskAudioSource, kRegShiftAudioSource))
528  return false;
529  switch (regValue & 0x0000000F)
530  {
531  case 0x1: outAudioSource = NTV2_AUDIO_EMBEDDED; break;
532  case 0x0: outAudioSource = NTV2_AUDIO_AES; break;
533  case 0x9: outAudioSource = NTV2_AUDIO_ANALOG; break;
534  case 0xA: outAudioSource = NTV2_AUDIO_HDMI; break;
535  case 0xB: outAudioSource = NTV2_AUDIO_MIC; break;
536  default: return false;
537  }
538 
539  if (outAudioSource == NTV2_AUDIO_EMBEDDED)
540  GetEmbeddedAudioInput(outEmbeddedSource, inAudioSystem);
541  return true;
542 
543 }
544 
545 
548 
549 
551 {
552  outAudioSystem = NTV2_AUDIOSYSTEM_INVALID;
553  if (!IsSupported(kDeviceCanDoAudioMixer))
554  return false; // No Audio Mixer -- shouldn't be calling this function
555  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
556  return false; // Bad Mixer Input specified
558  sAudioMixerInputSelectMasks[inMixerInput],
559  sAudioMixerInputSelectShifts[inMixerInput]);
560 }
561 
563 {
564  if (!IsSupported(kDeviceCanDoAudioMixer))
565  return false; // No Audio Mixer -- shouldn't be calling this function
566  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
567  return false; // Bad Mixer Input specified
568  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetNumAudioSystems) + 1)
569  return false; // No such audio system on this device
570  return WriteRegister (kRegAudioMixerInputSelects, ULWord(inAudioSystem),
571  sAudioMixerInputSelectMasks[inMixerInput],
572  sAudioMixerInputSelectShifts[inMixerInput]);
573 }
574 
576 {
577  outChannelPair = NTV2_AUDIO_CHANNEL_PAIR_INVALID;
578  if (!IsSupported(kDeviceCanDoAudioMixer))
579  return false; // No Audio Mixer -- shouldn't be calling this function
580  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
581  return false; // Bad Mixer Input specified
582  if (NTV2_IS_AUDIO_MIXER_INPUT_MAIN(inMixerInput))
586  outChannelPair = NTV2_AudioChannel1_2; // Aux1/Aux2 always use 1&2
587  return true;
588 }
589 
591 {
592  if (!IsSupported(kDeviceCanDoAudioMixer))
593  return false; // No Audio Mixer -- shouldn't be calling this function
594  if (!NTV2_IS_AUDIO_MIXER_INPUT_MAIN(inMixerInput))
595  return false; // Can only change Main channel selection
596  if (!NTV2_IS_WITHIN_AUDIO_CHANNELS_1_TO_16(inChannelPair))
597  return false; // Only audio channels 1 thru 16 allowed
598  return WriteRegister (kRegAudioMixerChannelSelect, ULWord(inChannelPair),
600 }
601 
604 
605 bool CNTV2Card::GetAudioMixerInputGain (const NTV2AudioMixerInput inMixerInput, const NTV2AudioMixerChannel inChannel, ULWord & outGainValue)
606 {
607  outGainValue = 0;
608  if (!IsSupported(kDeviceCanDoAudioMixer))
609  return false; // No Audio Mixer -- shouldn't be calling this function
610  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
611  return false; // Bad Mixer Input specified
612  if (!NTV2_IS_AUDIO_MIXER_CHANNELS_1_OR_2(inChannel))
613  return false; // Bad audio channel specified -- must be Ch1 or Ch2
614  return ReadRegister (inChannel == NTV2_AudioMixerChannel1
615  ? sAudioMixerInputGainCh1Regs[inMixerInput]
616  : sAudioMixerInputGainCh2Regs[inMixerInput], outGainValue);
617 }
618 
619 bool CNTV2Card::SetAudioMixerInputGain (const NTV2AudioMixerInput inMixerInput, const NTV2AudioMixerChannel inChannel, const ULWord inGainValue)
620 {
621  if (!IsSupported(kDeviceCanDoAudioMixer))
622  return false; // No Audio Mixer -- shouldn't be calling this function
623  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
624  return false; // Bad Mixer Input specified
625  if (!NTV2_IS_AUDIO_MIXER_CHANNELS_1_OR_2(inChannel))
626  return false; // Bad audio channel specified -- must be Ch1 or Ch2
627  return WriteRegister(inChannel == NTV2_AudioMixerChannel1
628  ? sAudioMixerInputGainCh1Regs[inMixerInput]
629  : sAudioMixerInputGainCh2Regs[inMixerInput], inGainValue);
630 }
631 
633 {
634  outGainValue = 0;
635  if (!IsSupported(kDeviceCanDoAudioMixer))
636  return false; // No Audio Mixer -- shouldn't be calling this function
637  return ReadRegister (kRegAudioMixerOutGain, outGainValue);
638 }
639 
641 {
642  if (!IsSupported(kDeviceCanDoAudioMixer))
643  return false; // No Audio Mixer -- shouldn't be calling this function
644  WriteRegister(kRegAudioMixerOutLGain, inGainValue);
645  return WriteRegister(kRegAudioMixerOutRGain, inGainValue);
646 }
647 
649  vector<uint32_t> & outLevels)
650 {
655  outLevels.clear();
656  if (!IsSupported(kDeviceCanDoAudioMixer))
657  return false;
658 
659  // If caller specified empty channelPairs set, do "all" possible pairs...
660  NTV2AudioChannelPairs chanPairs;
661  if (inChannelPairs.empty())
662  {
664  chanPairs.insert(chPr); // Main supports Ch 1-16
665  }
666  else
667  chanPairs = inChannelPairs; // Non-empty set: do what the caller requested
668 
669  // Build a bulk register read...
670  NTV2RegisterReads regs;
671  std::set<ULWord> regsToRead;
672  for (NTV2AudioChannelPairsConstIter it(chanPairs.begin()); it != chanPairs.end(); ++it)
673  {
674  const NTV2AudioChannelPair chanPair(*it);
676  return false;
677  uint32_t regNum(gAudMxrMainOutLvlRegs[chanPair]);
678  regsToRead.insert(regNum);
679  } // for each audio channel pair
680  for (std::set<ULWord>::const_iterator it(regsToRead.begin()); it != regsToRead.end(); ++it)
681  regs.push_back(NTV2RegInfo(*it));
682 
683  // Read the level registers...
684  const bool result(ReadRegisters(regs));
685  if (result)
686  for (NTV2RegisterReadsConstIter it(regs.begin()); it != regs.end(); ++it)
687  {
688  ULWord rawLevels(it->IsValid() ? it->registerValue : 0);
689  outLevels.push_back(uint32_t((rawLevels & kRegMaskAudioMixerInputLeftLevel) >> kRegShiftAudioMixerInputLeftLevel));
690  outLevels.push_back(uint32_t((rawLevels & kRegMaskAudioMixerInputRightLevel) >> kRegShiftAudioMixerInputRightLevel));
691  }
692  else
693  while (outLevels.size() < chanPairs.size() * 2)
694  outLevels.push_back(0);
695  return result;
696 }
697 
699 {
700  outGainValue = 0;
701  if (!IsSupported(kDeviceHasRotaryEncoder))
702  return false; // No Rotary Encoder control
703  return ReadRegister (kRegRotaryEncoder, outGainValue, kRegMaskRotaryEncoderGain, kRegShiftRotaryEncoderGain);
704 }
705 
707 {
708  if (!IsSupported(kDeviceHasRotaryEncoder))
709  return false; // No Rotary Encoder control
710  return WriteRegister(kRegRotaryEncoder, inGainValue, kRegMaskRotaryEncoderGain, kRegShiftRotaryEncoderGain);
711 }
712 
715 
717 {
718  outMutes.reset();
719  if (!IsSupported(kDeviceCanDoAudioMixer))
720  return false; // No Audio Mixer -- shouldn't be calling this function
721  unsigned long ulongvalue(0);
723  return false;
724  outMutes = NTV2AudioChannelsMuted16(ulongvalue); // Hardware uses 1=mute 0=enabled
725  return true;
726 }
727 
729 {
730  if (!IsSupported(kDeviceCanDoAudioMixer))
731  return false; // No Audio Mixer -- shouldn't be calling this function
733 }
734 
736 {
737  outMutes.reset();
738  if (!IsSupported(kDeviceCanDoAudioMixer))
739  return false; // No Audio Mixer -- shouldn't be calling this function
740  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
741  return false; // Bad Mixer Input specified
742  ULWord muteBits(0);
743  if (!ReadRegister(kRegAudioMixerMutes, muteBits, sAudioMixerInputMuteMasks[inMixerInput], sAudioMixerInputMuteShifts[inMixerInput]))
744  return false;
745  outMutes = NTV2AudioChannelsMuted16(muteBits);
746  return true;
747 }
748 
750 {
751  if (!IsSupported(kDeviceCanDoAudioMixer))
752  return false; // No Audio Mixer -- shouldn't be calling this function
753  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
754  return false; // Bad Mixer Input specified
755  const ULWord muteBits(ULWord(inMutes.to_ulong()));
756  return WriteRegister (kRegAudioMixerMutes, muteBits, sAudioMixerInputMuteMasks[inMixerInput], sAudioMixerInputMuteShifts[inMixerInput]);
757 }
758 
759 
761  const NTV2AudioChannelPairs & inChannelPairs,
762  vector<uint32_t> & outLevels)
763 {
768  outLevels.clear();
769  if (!IsSupported(kDeviceCanDoAudioMixer))
770  return false;
771  if (!NTV2_IS_VALID_AUDIO_MIXER_INPUT(inMixerInput))
772  return false;
773 
774  // If caller specified empty channelPairs set, do "all" possible pairs...
775  NTV2AudioChannelPairs chanPairs;
776  if (inChannelPairs.empty())
777  {
778  if (!NTV2_IS_AUDIO_MIXER_INPUT_MAIN(inMixerInput))
779  chanPairs.insert(NTV2_AudioChannel1_2); // Aux1/Aux2 only support Ch1&2
780  else
782  chanPairs.insert(chPr); // Main supports Ch 1-16
783  }
784  else
785  chanPairs = inChannelPairs; // Non-empty set: do what the caller requested
786 
787  // Build a bulk register read...
788  NTV2RegisterReads regs;
789  std::set<ULWord> regsToRead;
790  for (NTV2AudioChannelPairsConstIter it(chanPairs.begin()); it != chanPairs.end(); ++it)
791  {
792  const NTV2AudioChannelPair chanPair(*it);
794  return false;
795  uint32_t regNum(gAudMxrMainInLvlRegs[chanPair]);
796  if (!NTV2_IS_AUDIO_MIXER_INPUT_MAIN(inMixerInput))
797  {
798  if (chanPair != NTV2_AudioChannel1_2)
799  return false; // Aux1 & Aux2 can only report Chan 1&2 levels
800  regNum = (inMixerInput == NTV2_AudioMixerInputAux1)
803  }
804  regsToRead.insert(regNum);
805  } // for each audio channel pair
806  for (std::set<ULWord>::const_iterator it(regsToRead.begin()); it != regsToRead.end(); ++it)
807  regs.push_back(NTV2RegInfo(*it));
808 
809  // Read the level registers...
810  const bool result(ReadRegisters(regs));
811  if (result)
812  for (NTV2RegisterReadsConstIter it(regs.begin()); it != regs.end(); ++it)
813  {
814  ULWord rawLevels(it->IsValid() ? it->registerValue : 0);
815  outLevels.push_back(uint32_t((rawLevels & kRegMaskAudioMixerInputLeftLevel) >> kRegShiftAudioMixerInputLeftLevel));
816  outLevels.push_back(uint32_t((rawLevels & kRegMaskAudioMixerInputRightLevel) >> kRegShiftAudioMixerInputRightLevel));
817  }
818  else
819  while (outLevels.size() < chanPairs.size() * 2)
820  outLevels.push_back(0);
821  return result;
822 }
823 
825 {
826  outSampleCount = 0;
828  return false;
829  outSampleCount = 1 << outSampleCount;
830  return true;
831 }
832 
834 {
835  if (!inSampleCount)
836  return false; // Must be > 0
837  if (inSampleCount > 0x00008000)
838  return false; // Must be <= 0x8000
839  ULWord result(0), sampleCount(inSampleCount);
840  while (sampleCount >>= 1)
841  ++result;
843 }
844 
845 
846 
848 {
850 
851  if (!GetHDMIOutControlReg(reg, inWhichHDMIOut))
852  return false;
853 
854  return WriteRegister (reg, ULWord(value), kRegMaskHDMIOutAudioCh, kRegShiftHDMIOutAudioCh);
855 }
856 
857 
859 {
861 
862  if (!GetHDMIOutControlReg(reg, inWhichHDMIOut))
863  return false;
864 
866 }
867 
868 
869 bool CNTV2Card::SetHDMIOutAudioSource2Channel (const NTV2AudioChannelPair inValue, const NTV2AudioSystem inAudioSystem, const NTV2Channel inWhichHDMIOut)
870 {
872  ULWord regOC(kRegHDMIOutControl);
873 
874  if (!NTV2_IS_VALID_AUDIO_CHANNEL_PAIR (inValue))
875  return false;
876 
877  if (GetNumSupported(kDeviceGetHDMIVersion) > 3)
878  {
879  if (!GetHDMIOutInputControlRegNum(regIC, inWhichHDMIOut))
880  return false;
881  if (!GetHDMIOutControlReg(regOC, inWhichHDMIOut))
882  return false;
883 
885  ULWord channelSelect = static_cast<ULWord>(inValue) % 4;
886  WriteRegister (regIC, inAudioSystem, kRegMaskHDMIOutSourceSelect, kRegShiftHDMIOutSourceSelect);
887  WriteRegister (regOC, bankSelect, kRegMaskHDMIOut8ChGroupSelect, kRegShiftHDMIOut8ChGroupSelect);
888  WriteRegister (regIC, channelSelect, kRegMaskHDMIOutAudio2ChannelSelect, kRegShiftHDMIOutAudio2ChannelSelect);
889  return SetHDMIOutAudioChannels(NTV2_HDMIAudio2Channels, inWhichHDMIOut);
890  }
891  else
892  {
893  const ULWord encoding ((ULWord (inAudioSystem) << 4) | inValue);
895  }
896 }
897 
898 
899 bool CNTV2Card::GetHDMIOutAudioSource2Channel (NTV2AudioChannelPair & outValue, NTV2AudioSystem & outAudioSystem, const NTV2Channel inWhichHDMIOut)
900 {
902  ULWord regOC(kRegHDMIOutControl);
903  bool result = false;
904 
905  if (GetNumSupported(kDeviceGetHDMIVersion) > 3)
906  {
907  if (!GetHDMIOutInputControlRegNum(regIC, inWhichHDMIOut))
908  return false;
909  if (!GetHDMIOutControlReg(regOC, inWhichHDMIOut))
910  return false;
911 
912  ULWord engineSelect (0), channelSelect(0), bankSelect(0);
913  result = ReadRegister(regIC, engineSelect, kRegMaskHDMIOutSourceSelect, kRegShiftHDMIOutSourceSelect);
914  if (result)
915  {
916  outAudioSystem = NTV2AudioSystem(engineSelect);
917  result = ReadRegister(regIC, channelSelect, kRegMaskHDMIOutAudio2ChannelSelect, kRegShiftHDMIOutAudio2ChannelSelect);
918  result = ReadRegister(regOC, bankSelect, kRegMaskHDMIOut8ChGroupSelect, kRegShiftHDMIOut8ChGroupSelect);
919  outValue = NTV2AudioChannelPair((bankSelect == 0 ? 0 : 4) + channelSelect);
920  }
921  }
922  else
923  {
924  ULWord encoding (0);
926  if (result)
927  {
928  outValue = NTV2AudioChannelPair(encoding & 0x7);
929  outAudioSystem = NTV2AudioSystem(encoding >> 4);
930  }
931  }
932  return result;
933 }
934 
935 
936 bool CNTV2Card::SetHDMIOutAudioSource8Channel (const NTV2Audio8ChannelSelect inValue, const NTV2AudioSystem inAudioSystem, const NTV2Channel inWhichHDMIOut)
937 {
939  ULWord regOC(kRegHDMIOutControl);
940 
941  if (!NTV2_IS_VALID_AUDIO_CHANNEL_OCTET (inValue))
942  return false;
943 
944  if (GetNumSupported(kDeviceGetHDMIVersion) > 3)
945  {
946  if (!GetHDMIOutInputControlRegNum(regIC, inWhichHDMIOut))
947  return false;
948  if (!GetHDMIOutControlReg(regOC, inWhichHDMIOut))
949  return false;
950 
952  WriteRegister (regIC, inAudioSystem, kRegMaskHDMIOutSourceSelect, kRegShiftHDMIOutSourceSelect);
953  WriteRegister (regOC, channelSelect, kRegMaskHDMIOut8ChGroupSelect, kRegShiftHDMIOut8ChGroupSelect);
954  return SetHDMIOutAudioChannels(NTV2_HDMIAudio8Channels, inWhichHDMIOut);
955  }
956  else
957  {
958  ULWord encoding (0);
959  ULWord ch (ULWord (inAudioSystem) << 2);
960  if (inValue == NTV2_AudioChannel1_8)
961  encoding = (ch + NTV2_AudioChannel1_4) | ((ch + NTV2_AudioChannel5_8) << 4);
962  else
963  encoding = (ch + NTV2_AudioChannel9_12) | ((ch + NTV2_AudioChannel13_16) << 4);
964 
966  }
967 }
968 
969 
970 bool CNTV2Card::GetHDMIOutAudioSource8Channel (NTV2Audio8ChannelSelect & outValue, NTV2AudioSystem & outAudioSystem, const NTV2Channel inWhichHDMIOut)
971 {
973  ULWord regOC(kRegHDMIOutControl);
974  bool result = false;
975 
976  if (GetNumSupported(kDeviceGetHDMIVersion) > 3)
977  {
978  if (!GetHDMIOutInputControlRegNum(regIC, inWhichHDMIOut))
979  return false;
980  if (!GetHDMIOutControlReg(regOC, inWhichHDMIOut))
981  return false;
982 
983  ULWord engineSelect (0), channelSelect(0);
984  result = ReadRegister(regOC, channelSelect, kRegMaskHDMIOut8ChGroupSelect, kRegShiftHDMIOut8ChGroupSelect);
985  if (result)
986  {
987  outValue = channelSelect == 1 ? NTV2_AudioChannel9_16 : NTV2_AudioChannel1_8;
988  result = ReadRegister(regIC, engineSelect, kRegMaskHDMIOutSourceSelect, kRegShiftHDMIOutSourceSelect);
989  outAudioSystem = static_cast <NTV2AudioSystem> (engineSelect);
990  }
991  }
992  else
993  {
994  ULWord encoding (0);
996  if (result)
997  {
998  if ((encoding & 0x3) == static_cast <ULWord> (NTV2_AudioChannel1_4))
999  outValue = NTV2_AudioChannel1_8;
1000  else
1001  outValue = NTV2_AudioChannel9_16;
1002 
1003  outAudioSystem = static_cast <NTV2AudioSystem> ((encoding & 0xC) >> 2);
1004  }
1005  }
1006  return result;
1007 }
1008 
1009 
1010 bool CNTV2Card::SetHDMIOutAudioRate (const NTV2AudioRate inNewValue, const NTV2Channel inWhichHDMIOut)
1011 {
1013 
1014  if (!GetHDMIOutInputControlRegNum(reg, inWhichHDMIOut))
1015  return false;
1016 
1017  return WriteRegister (reg, static_cast <ULWord> (inNewValue), kRegMaskHDMIOutAudioRate, kRegShiftHDMIOutAudioRate);
1018 }
1019 
1020 
1021 bool CNTV2Card::GetHDMIOutAudioRate (NTV2AudioRate & outValue, const NTV2Channel inWhichHDMIOut)
1022 {
1024 
1025  if (!GetHDMIOutInputControlRegNum(reg, inWhichHDMIOut))
1026  return false;
1027 
1029 }
1030 
1031 
1032 bool CNTV2Card::SetHDMIOutAudioFormat (const NTV2AudioFormat inNewValue, const NTV2Channel inWhichHDMIOut)
1033 {
1035 
1036  if (!GetHDMIOutControlReg(reg, inWhichHDMIOut))
1037  return false;
1038 
1039  return WriteRegister (reg, static_cast <ULWord> (inNewValue), kRegMaskHDMIOutAudioFormat, kRegShiftHDMIOutAudioFormat);
1040 }
1041 
1042 
1043 bool CNTV2Card::GetHDMIOutAudioFormat (NTV2AudioFormat & outValue, const NTV2Channel inWhichHDMIOut)
1044 {
1046 
1047  if (!GetHDMIOutControlReg(reg, inWhichHDMIOut))
1048  return false;
1049 
1051 }
1052 
1053 
1054 bool CNTV2Card::SetAudioOutputMonitorSource (const NTV2AudioChannelPair inChannelPair, const NTV2AudioSystem inAudioSystem)
1055 {
1056  if (!NTV2_IS_WITHIN_AUDIO_CHANNELS_1_TO_16(inChannelPair))
1057  return false;
1058  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
1059  return false;
1060  const ULWord encoding ((ULWord(inAudioSystem) << 4) | inChannelPair);
1061  return WriteRegister (kRegAudioOutputSourceMap, encoding, kRegMaskMonitorSource, kRegShiftMonitorSource);
1062 }
1063 
1064 
1066 {
1067  ULWord encoding (0);
1068  bool result = ReadRegister (kRegAudioOutputSourceMap, encoding, kRegMaskMonitorSource, kRegShiftMonitorSource);
1069  if (result)
1070  {
1071  outChannelPair = NTV2AudioChannelPair(encoding & 0xF);
1072  outAudioSystem = NTV2AudioSystem(encoding >> 4);
1073  }
1074  return result;
1075 }
1076 
1077 bool CNTV2Card::StartAudioOutput (const NTV2AudioSystem inAudSys, bool inWaitForVBI)
1078 {
1079  if (inAudSys >= NTV2_NUM_AUDIOSYSTEMS)
1080  return false; // Bad AudioSystem
1081  const ULWord audioCtrlRegNum(gAudioSystemToAudioControlRegNum[inAudSys]);
1082  if (IsSupported(kDeviceAudioCanWaitForVBI))
1083  {
1084  // Set or clear the start-at-VBI bit...
1085  if (!WriteRegister(audioCtrlRegNum, inWaitForVBI ? 1UL : 0UL, kRegMaskOutputStartAtVBI, kRegShiftOutputStartAtVBI))
1086  return false;
1087  }
1088  else if (inWaitForVBI)
1089  {inWaitForVBI = false; AUDWARN("Aud" << DEC(inAudSys+1) << " wait-for-VBI requested but not supported on " << GetDescription());}
1090 
1091  if (!WriteRegister (audioCtrlRegNum, 0, kRegMaskResetAudioOutput, kRegShiftResetAudioOutput))
1092  return false;
1093  AUDINFO("Aud" << DEC(inAudSys+1) << " output started" << (inWaitForVBI ? " at VBI" : "") << " on " << GetDescription());
1094  if (inWaitForVBI && IsSupported(kDeviceAudioCanWaitForVBI)) // Restore default start-at-VBI bit setting
1095  {AJATime::Sleep(20); WriteRegister(audioCtrlRegNum, 0UL, kRegMaskOutputStartAtVBI, kRegShiftOutputStartAtVBI);}
1096 #if defined(NTV2_CHECK_SDRAM_COLLISIONS)
1097  // Now that this audio system is reading from SDRAM, see if its buffer is colliding with other device SDRAM activity...
1098  ULWordSequence badRgns;
1099  SDRAMAuditor auditor;
1100  auditor.AssessDevice(*this, /*ignoreStoppedAudioSystemBuffers*/true); // Only care about running audio systems
1101  auditor.GetBadRegions(badRgns); // Receive the interfering memory regions
1102  for (size_t ndx(0); ndx < badRgns.size(); ndx++)
1103  { const ULWord rgnInfo(badRgns.at(ndx));
1104  const UWord startBlk(rgnInfo >> 16), numBlks(UWord(rgnInfo & 0x0000FFFF));
1105  NTV2StringSet tags;
1106  auditor.GetTagsForFrameIndex (startBlk, tags);
1107  const string infoStr (aja::join(tags, ", "));
1108  ostringstream acLabel; acLabel << "Aud" << DEC(inAudSys+1); // Search for label e.g. "Aud2"
1109  if (infoStr.find(acLabel.str()) != string::npos)
1110  { ostringstream warning;
1111  if (numBlks > 1)
1112  warning << "8MB Frms " << DEC0N(startBlk,3) << "-" << DEC0N(startBlk+numBlks-1,3);
1113  else
1114  warning << "8MB Frm " << DEC0N(startBlk,3);
1115  AUDWARN("Aud" << DEC(inAudSys+1) << " memory overlap/interference: " << warning.str() << ": " << infoStr);
1116  }
1117  } // for each "bad" region
1118 #endif // defined(NTV2_CHECK_SDRAM_COLLISIONS)
1119  return true;
1120 } // StartAudioOutput
1121 
1123 {
1124  if (inAudSys >= NTV2_NUM_AUDIOSYSTEMS)
1125  return false;
1127  return false;
1128  AUDINFO("Aud" << DEC(inAudSys+1) << " output stopped on " << GetDescription());
1129  return true;
1130 }
1131 
1132 bool CNTV2Card::IsAudioOutputRunning (const NTV2AudioSystem inAudioSystem, bool & outIsRunning)
1133 {
1134  bool isStopped (true);
1135  bool result (inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1138  if (result)
1139  outIsRunning = !isStopped;
1140  return result;
1141 }
1142 
1143 
1144 bool CNTV2Card::SetAudio20BitMode (const NTV2AudioSystem inAudioSystem, const bool inEnable)
1145 {
1146  return IsSupported(kDeviceCanDoIP)
1147  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1148  && WriteRegister (gAudioSystemToAudioControlRegNum[inAudioSystem], inEnable ? 1 : 0, kRegMask20BitMode, kRegShift20BitMode);
1149 }
1150 
1151 
1152 bool CNTV2Card::GetAudio20BitMode (const NTV2AudioSystem inAudioSystem, bool & outEnable)
1153 {
1154  return IsSupported(kDeviceCanDoIP)
1155  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1157 }
1158 
1159 
1160 bool CNTV2Card::SetAudioOutputPause (const NTV2AudioSystem inAudioSystem, const bool inEnable)
1161 {
1162  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1163  && WriteRegister (gAudioSystemToAudioControlRegNum[inAudioSystem], inEnable ? 1 : 0, kRegMaskPauseAudio, kRegShiftPauseAudio);
1164 }
1165 
1166 
1167 bool CNTV2Card::GetAudioOutputPause (const NTV2AudioSystem inAudioSystem, bool & outEnable)
1168 {
1169  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1171 }
1172 
1173 
1174 bool CNTV2Card::StartAudioInput (const NTV2AudioSystem inAudSys, bool inWaitForVBI)
1175 {
1176  if (inAudSys >= NTV2_NUM_AUDIOSYSTEMS)
1177  return false; // Bad AudioSystem
1178  const ULWord audioCtrlRegNum(gAudioSystemToAudioControlRegNum[inAudSys]);
1179  if (IsSupported(kDeviceAudioCanWaitForVBI))
1180  {
1181  // Set or clear the start-at-VBI bit...
1182  if (!WriteRegister(audioCtrlRegNum, inWaitForVBI ? 1UL : 0UL, kRegMaskInputStartAtVBI, kRegShiftInputStartAtVBI))
1183  return false;
1184  }
1185  else if (inWaitForVBI)
1186  AUDWARN("Aud" << DEC(inAudSys+1) << " wait-for-VBI requested but not supported on " << GetDescription());
1187 
1188  if (!WriteRegister (audioCtrlRegNum, 0, kRegMaskResetAudioInput, kRegShiftResetAudioInput))
1189  return false;
1190  AUDINFO("Aud" << DEC(inAudSys+1) << " input started" << (inWaitForVBI ? " at VBI" : "") << " on " << GetDescription());
1191  if (inWaitForVBI && IsSupported(kDeviceAudioCanWaitForVBI)) // Restore default start-at-VBI bit setting
1192  {AJATime::Sleep(20); WriteRegister(audioCtrlRegNum, 0UL, kRegMaskInputStartAtVBI, kRegShiftInputStartAtVBI);}
1193 #if defined(NTV2_CHECK_SDRAM_COLLISIONS)
1194  // Now that this audio system is writing into SDRAM, see if its buffer is colliding with other device SDRAM activity...
1195  ULWordSequence badRgns;
1196  SDRAMAuditor auditor;
1197  auditor.AssessDevice(*this, /*ignoreStoppedAudioSystemBuffers*/true); // Only care about running audio systems
1198  auditor.GetBadRegions(badRgns); // Receive the interfering memory regions
1199  for (size_t ndx(0); ndx < badRgns.size(); ndx++)
1200  { const ULWord rgnInfo(badRgns.at(ndx));
1201  const UWord startBlk(rgnInfo >> 16), numBlks(UWord(rgnInfo & 0x0000FFFF));
1202  NTV2StringSet tags;
1203  auditor.GetTagsForFrameIndex (startBlk, tags);
1204  const string infoStr (aja::join(tags, ", "));
1205  ostringstream acLabel; acLabel << "Aud" << DEC(inAudSys+1); // Search for label e.g. "Aud2"
1206  if (infoStr.find(acLabel.str()) != string::npos)
1207  { ostringstream warning;
1208  if (numBlks > 1)
1209  warning << "8MB Frms " << DEC0N(startBlk,3) << "-" << DEC0N(startBlk+numBlks-1,3);
1210  else
1211  warning << "8MB Frm " << DEC0N(startBlk,3);
1212  AUDWARN("Aud" << DEC(inAudSys+1) << " memory overlap/interference: " << warning.str() << ": " << infoStr);
1213  }
1214  } // for each "bad" region
1215 #endif // defined(NTV2_CHECK_SDRAM_COLLISIONS)
1216  return true;
1217 } // StartAudioInput
1218 
1219 
1221 {
1222  if (inAudSys >= NTV2_NUM_AUDIOSYSTEMS)
1223  return false;
1225  return false;
1226  AUDINFO("Aud" << DEC(inAudSys+1) << " input stopped on " << GetDescription());
1227  return true;
1228 }
1229 
1230 
1231 bool CNTV2Card::IsAudioInputRunning (const NTV2AudioSystem inAudioSystem, bool & outIsRunning)
1232 {
1233  bool isStopped (true);
1234  bool result (inAudioSystem < NTV2_NUM_AUDIOSYSTEMS &&
1237  if (result)
1238  outIsRunning = !isStopped;
1239  return result;
1240 }
1241 
1242 
1243 bool CNTV2Card::SetAudioCaptureEnable (const NTV2AudioSystem inAudioSystem, const bool inEnable)
1244 {
1245  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1246  && WriteRegister (gAudioSystemToAudioControlRegNum[inAudioSystem], inEnable ? 1 : 0, kRegMaskCaptureEnable, kRegShiftCaptureEnable);
1247 }
1248 
1249 
1250 bool CNTV2Card::GetAudioCaptureEnable (const NTV2AudioSystem inAudioSystem, bool & outEnable)
1251 {
1252  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1254 }
1255 
1256 
1257 bool CNTV2Card::SetAudioPlayCaptureModeEnable (const NTV2AudioSystem inAudioSystem, const bool inEnable)
1258 {
1259  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1260  && WriteRegister (kRegGlobalControl2, inEnable ? 1 : 0, gAudioPlayCaptureModeMasks[inAudioSystem], gAudioPlayCaptureModeShifts[inAudioSystem]);
1261 }
1262 
1263 
1264 bool CNTV2Card::GetAudioPlayCaptureModeEnable (const NTV2AudioSystem inAudioSystem, bool & outEnable)
1265 {
1266  outEnable = false;
1267  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1269 }
1270 
1271 
1272 bool CNTV2Card::SetAudioInputDelay (const NTV2AudioSystem inAudioSystem, const ULWord inDelay)
1273 {
1274  return IsSupported(kDeviceCanDoAudioDelay)
1275  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1276  && WriteRegister (gAudioDelayRegisterNumbers [inAudioSystem], inDelay, kRegMaskAudioInDelay, kRegShiftAudioInDelay);
1277 }
1278 
1279 
1280 bool CNTV2Card::GetAudioInputDelay (const NTV2AudioSystem inAudioSystem, ULWord & outDelay)
1281 {
1282  return IsSupported(kDeviceCanDoAudioDelay)
1283  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1284  && ReadRegister (gAudioDelayRegisterNumbers[inAudioSystem], outDelay, kRegMaskAudioInDelay, kRegShiftAudioInDelay);
1285 }
1286 
1287 
1288 bool CNTV2Card::SetAudioOutputDelay (const NTV2AudioSystem inAudioSystem, const ULWord inDelay)
1289 {
1290  return IsSupported(kDeviceCanDoAudioDelay)
1291  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1292  && WriteRegister (gAudioDelayRegisterNumbers[inAudioSystem], inDelay, kRegMaskAudioOutDelay, kRegShiftAudioOutDelay);
1293 }
1294 
1295 
1296 bool CNTV2Card::GetAudioOutputDelay (const NTV2AudioSystem inAudioSystem, ULWord & outDelay)
1297 {
1298  return IsSupported(kDeviceCanDoAudioDelay)
1299  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1300  && ReadRegister (gAudioDelayRegisterNumbers[inAudioSystem], outDelay, kRegMaskAudioOutDelay, kRegShiftAudioOutDelay);
1301 }
1302 
1303 
1304 bool CNTV2Card::SetAudioPCMControl (const NTV2AudioSystem inAudioSystem, const bool inNonPCM)
1305 {
1306  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1307  && WriteRegister (gAudioSystemToSrcSelectRegNum[inAudioSystem], inNonPCM ? 1 : 0, BIT(17), 17);
1308 }
1309 
1310 
1311 bool CNTV2Card::GetAudioPCMControl (const NTV2AudioSystem inAudioSystem, bool & outIsNonPCM)
1312 {
1313  return inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1314  && CNTV2DriverInterface::ReadRegister (gAudioSystemToSrcSelectRegNum[inAudioSystem], outIsNonPCM, BIT(17), 17);
1315 }
1316 
1317 
1318 bool CNTV2Card::SetAudioPCMControl (const NTV2AudioSystem inAudioSystem, const NTV2AudioChannelPair inChannelSelect, bool inNonPCM)
1319 {
1320  return IsSupported(kDeviceCanDoPCMControl)
1321  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1322  && NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(inChannelSelect)
1323  && WriteRegister(gAudioEngineChannelPairToFieldInformation[inAudioSystem][inChannelSelect].pcmControlReg,
1324  inNonPCM ? 1 : 0,
1325  gAudioEngineChannelPairToFieldInformation[inAudioSystem][inChannelSelect].pcmControlMask,
1326  gAudioEngineChannelPairToFieldInformation[inAudioSystem][inChannelSelect].pcmControlShift);
1327 }
1328 
1329 
1330 bool CNTV2Card::SetAudioPCMControl (const NTV2AudioSystem inAudioSystem, const NTV2AudioChannelPairs & inNonPCMChannelPairs)
1331 {
1332  if (!IsSupported(kDeviceCanDoPCMControl) || inAudioSystem >= NTV2_NUM_AUDIOSYSTEMS)
1333  return false;
1334 
1335  bool result (true);
1336  for (NTV2AudioChannelPair chanPair (NTV2_AudioChannel1_2); NTV2_IS_VALID_AUDIO_CHANNEL_PAIR (chanPair); chanPair = NTV2AudioChannelPair (chanPair + 1))
1337  {
1338  if (NTV2_IS_EXTENDED_AUDIO_CHANNEL_PAIR (chanPair))
1339  break; // Extended audio channels not yet supported
1340 
1341  const bool isNonPCM (inNonPCMChannelPairs.find (chanPair) != inNonPCMChannelPairs.end ());
1342  result = WriteRegister (gAudioEngineChannelPairToFieldInformation[inAudioSystem][chanPair].pcmControlReg, isNonPCM ? 1 : 0,
1343  gAudioEngineChannelPairToFieldInformation[inAudioSystem][chanPair].pcmControlMask,
1344  gAudioEngineChannelPairToFieldInformation[inAudioSystem][chanPair].pcmControlShift);
1345  if (!result)
1346  break;
1347  }
1348  return result;
1349 }
1350 
1351 
1352 bool CNTV2Card::GetAudioPCMControl (const NTV2AudioSystem inAudioSystem, const NTV2AudioChannelPair inChannelSelect, bool & outIsNonPCM)
1353 {
1354  return IsSupported(kDeviceCanDoPCMControl)
1355  && inAudioSystem < NTV2_NUM_AUDIOSYSTEMS
1356  && NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(inChannelSelect)
1357  && CNTV2DriverInterface::ReadRegister (gAudioEngineChannelPairToFieldInformation[inAudioSystem][inChannelSelect].pcmControlReg,
1358  outIsNonPCM,
1359  gAudioEngineChannelPairToFieldInformation[inAudioSystem][inChannelSelect].pcmControlMask,
1360  gAudioEngineChannelPairToFieldInformation[inAudioSystem][inChannelSelect].pcmControlShift);
1361 }
1362 
1363 
1364 bool CNTV2Card::GetAudioPCMControl (const NTV2AudioSystem inAudioSystem, NTV2AudioChannelPairs & outNonPCMChannelPairs)
1365 {
1366  ULWord numAudioChannels (0);
1367  bool isNonPCM (false);
1368 
1369  outNonPCMChannelPairs.clear ();
1370  if (inAudioSystem >= NTV2_NUM_AUDIOSYSTEMS)
1371  return false; // no such audio system on this device
1372  if (!GetNumberAudioChannels (numAudioChannels, inAudioSystem))
1373  return false; // fail
1374 
1375  const NTV2AudioChannelPair maxPair (NTV2AudioChannelPair(numAudioChannels/2));
1376  if (!GetAudioPCMControl (inAudioSystem, isNonPCM))
1377  return false; // fail
1378 
1379  if (isNonPCM) // this global mode overrides per-channel PCM control
1380  {
1381  for (UWord chPair (0); chPair <= maxPair; chPair++)
1382  outNonPCMChannelPairs.insert (NTV2AudioChannelPair (chPair));
1383  return true; // done
1384  }
1385 
1386  if (IsSupported(kDeviceCanDoPCMControl))
1387  {
1388  ULWord regVal (0);
1389  if (!ReadRegister (inAudioSystem < NTV2_AUDIOSYSTEM_5 ? kRegPCMControl4321 : kRegPCMControl8765, regVal))
1390  return false;
1392  if (regVal & BIT(inAudioSystem * 8 + chanPair))
1393  outNonPCMChannelPairs.insert (chanPair);
1394  }
1395  return true;
1396 }
1397 
1398 
1399 // NTV2_AUDIOSYSTEM_1 NTV2_AUDIOSYSTEM_2 NTV2_AUDIOSYSTEM_3 NTV2_AUDIOSYSTEM_4
1401 // NTV2_AUDIOSYSTEM_5 NTV2_AUDIOSYSTEM_6 NTV2_AUDIOSYSTEM_7 NTV2_AUDIOSYSTEM_8
1403 
1404 // NTV2_AUDIOSYSTEM_1 NTV2_AUDIOSYSTEM_2 NTV2_AUDIOSYSTEM_3 NTV2_AUDIOSYSTEM_4
1405 static const unsigned sAudioDetectGroups [] = { 0, 1, 0, 1,
1406 // NTV2_AUDIOSYSTEM_5 NTV2_AUDIOSYSTEM_6 NTV2_AUDIOSYSTEM_7 NTV2_AUDIOSYSTEM_8
1407  0, 1, 2, 3 };
1408 
1409 bool CNTV2Card::IsAudioChannelPairPresent (const NTV2AudioSystem inAudioSystem, const NTV2AudioChannelPair inChannelPair, bool & outIsPresent)
1410 {
1411  NTV2AudioChannelPairs activeChannelPairs;
1412  outIsPresent = false;
1413  if (!GetDetectedAudioChannelPairs (inAudioSystem, activeChannelPairs))
1414  return false;
1415  if (activeChannelPairs.find (inChannelPair) != activeChannelPairs.end ())
1416  outIsPresent = true;
1417  return true;
1418 }
1419 
1420 
1421 bool CNTV2Card::GetDetectedAudioChannelPairs (const NTV2AudioSystem inAudioSystem, NTV2AudioChannelPairs & outDetectedChannelPairs)
1422 {
1423  outDetectedChannelPairs.clear ();
1424  if (inAudioSystem >= NTV2_NUM_AUDIOSYSTEMS)
1425  return false;
1426 
1427  ULWord detectBits (0);
1428  if (!ReadRegister (sAudioDetectRegs[inAudioSystem], detectBits))
1429  return false;
1430 
1431  const unsigned bitGroup (sAudioDetectGroups[inAudioSystem]);
1433  if (detectBits & BIT(bitGroup * 8 + chanPair))
1434  outDetectedChannelPairs.insert (chanPair);
1435  return true;
1436 }
1437 
1438 
1440 {
1441  uint32_t valLo8(0), valHi8(0);
1442  outDetectedChannelPairs.clear ();
1443  if (!IsSupported(kDeviceCanDoAESAudioIn))
1444  return false;
1445  if (!ReadRegister(kRegInputStatus, valLo8)) // Reg 22, bits 24..27
1446  return false;
1447  if (!ReadRegister(kRegAud1SourceSelect, valHi8)) // Reg 25, bits 28..31
1448  return false;
1449 
1450  const uint32_t detectBits (((valLo8 >> 24) & 0x0000000F) | ((valHi8 >> 24) & 0x000000F0));
1451  for (NTV2AudioChannelPair chPair (NTV2_AudioChannel1_2); chPair < NTV2_AudioChannel15_16; chPair = NTV2AudioChannelPair(chPair+1))
1452  if (!(detectBits & BIT(chPair))) // bit set means "not connected"
1453  outDetectedChannelPairs.insert(chPair);
1454  return true;
1455 }
1456 
1457 
1458 bool CNTV2Card::SetSuspendHostAudio (const bool inIsSuspended)
1459 {
1460  return WriteRegister (kVRegSuspendSystemAudio, ULWord(inIsSuspended));
1461 }
1462 
1463 
1464 bool CNTV2Card::GetSuspendHostAudio (bool & outIsSuspended)
1465 {
1467 }
1468 
1469 
1470 // GetAESOutputSource / SetAESOutputSource:
1471 //
1472 // Register 190 (kRegAudioOutputSourceMap) does the mapping by audio group (audio channel quads).
1473 // Each of the least-significant 4 nibbles correspond to AES output audio channel quads:
1474 //
1475 // RegMask NTV2Audio4ChannelSelect
1476 // ========== =======================
1477 // 0x0000000F NTV2_AudioChannel1_4
1478 // 0x000000F0 NTV2_AudioChannel5_8
1479 // 0x00000F00 NTV2_AudioChannel9_12
1480 // 0x0000F000 NTV2_AudioChannel13_16
1481 //
1482 // The value of the nibble determines the source:
1483 // Value NTV2AudioSystem NTV2Audio4ChannelSelect
1484 // ===== =============== =======================
1485 // 0x0: NTV2_AUDIOSYSTEM_1 NTV2_AudioChannel1_4
1486 // 0x1: NTV2_AUDIOSYSTEM_1 NTV2_AudioChannel5_8
1487 // 0x2: NTV2_AUDIOSYSTEM_1 NTV2_AudioChannel9_12
1488 // 0x3: NTV2_AUDIOSYSTEM_1 NTV2_AudioChannel13_16
1489 // 0x4: NTV2_AUDIOSYSTEM_2 NTV2_AudioChannel1_4
1490 // 0x5: NTV2_AUDIOSYSTEM_2 NTV2_AudioChannel5_8
1491 // 0x6: NTV2_AUDIOSYSTEM_2 NTV2_AudioChannel9_12
1492 // 0x7: NTV2_AUDIOSYSTEM_2 NTV2_AudioChannel13_16
1493 // 0x8: NTV2_AUDIOSYSTEM_3 NTV2_AudioChannel1_4
1494 // 0x9: NTV2_AUDIOSYSTEM_3 NTV2_AudioChannel5_8
1495 // 0xA: NTV2_AUDIOSYSTEM_3 NTV2_AudioChannel9_12
1496 // 0xB: NTV2_AUDIOSYSTEM_3 NTV2_AudioChannel13_16
1497 // 0xC: NTV2_AUDIOSYSTEM_4 NTV2_AudioChannel1_4
1498 // 0xD: NTV2_AUDIOSYSTEM_4 NTV2_AudioChannel5_8
1499 // 0xE: NTV2_AUDIOSYSTEM_4 NTV2_AudioChannel9_12
1500 // 0xF: NTV2_AUDIOSYSTEM_4 NTV2_AudioChannel13_16
1501 
1502 static const unsigned gAESChannelMappingShifts [4] = {0, 4, 8, 12};
1503 
1504 
1505 bool CNTV2Card::GetAESOutputSource (const NTV2Audio4ChannelSelect inAESAudioChannels, NTV2AudioSystem & outSrcAudioSystem, NTV2Audio4ChannelSelect & outSrcAudioChannels)
1506 {
1507  const ULWord numAESAudioOutputChannels (GetNumSupported(kDeviceGetNumAESAudioOutputChannels));
1508  const ULWord maxNumAudioChannelsForQuad ((inAESAudioChannels + 1) * 4);
1509 
1510  outSrcAudioSystem = NTV2_AUDIOSYSTEM_INVALID;
1511  outSrcAudioChannels = NTV2_AUDIO_CHANNEL_QUAD_INVALID;
1512 
1513  if (numAESAudioOutputChannels < 4)
1514  return false; // Fail, device doesn't support AES output
1515  if (maxNumAudioChannelsForQuad > numAESAudioOutputChannels)
1516  return false; // Fail, illegal inAESAudioChannels value
1517 
1518  ULWord regValue (0);
1519  if (!ReadRegister (kRegAudioOutputSourceMap, regValue))
1520  return false; // Failed in ReadRegister
1521 
1522  regValue = (regValue >> gAESChannelMappingShifts[inAESAudioChannels]) & 0x0000000F;
1523  outSrcAudioSystem = NTV2AudioSystem(regValue / 4);
1524  NTV2_ASSERT (NTV2_IS_VALID_AUDIO_SYSTEM (outSrcAudioSystem));
1525 
1526  outSrcAudioChannels = NTV2Audio4ChannelSelect(regValue % 4);
1527  NTV2_ASSERT (NTV2_IS_NORMAL_AUDIO_CHANNEL_QUAD (outSrcAudioChannels));
1528  return true;
1529 }
1530 
1531 
1532 bool CNTV2Card::SetAESOutputSource (const NTV2Audio4ChannelSelect inAESAudioChannels, const NTV2AudioSystem inSrcAudioSystem, const NTV2Audio4ChannelSelect inSrcAudioChannels)
1533 {
1534  const ULWord nibble (ULWord(inSrcAudioSystem) * 4 + ULWord(inSrcAudioChannels));
1535  return WriteRegister (kRegAudioOutputSourceMap, // reg
1536  nibble, // value
1537  ULWord(0xF << gAESChannelMappingShifts[inAESAudioChannels]), // mask
1538  gAESChannelMappingShifts[inAESAudioChannels]); // shift
1539 }
1540 
1541 
1542 static NTV2AudioChannelPairs BitMasksToNTV2AudioChannelPairs (const ULWord inBitMask, const ULWord inExtendedBitMask)
1543 {
1544  NTV2AudioChannelPairs result;
1545  if (inBitMask)
1546  for (NTV2AudioChannelPair channelPair (NTV2_AudioChannel1_2); channelPair < NTV2_AudioChannel17_18; channelPair = NTV2AudioChannelPair (channelPair + 1))
1547  if (inBitMask & BIT (channelPair))
1548  result.insert (channelPair);
1549  if (inExtendedBitMask)
1550  for (NTV2AudioChannelPair channelPair (NTV2_AudioChannel17_18); channelPair < NTV2_MAX_NUM_AudioChannelPair; channelPair = NTV2AudioChannelPair (channelPair + 1))
1551  if (inExtendedBitMask & BIT (channelPair))
1552  result.insert (channelPair);
1553  return result;
1554 }
1555 
1556 
1557 static inline NTV2RegisterNumber GetNonPCMDetectRegisterNumber (const NTV2Channel inSDIInputChannel, const bool inIsExtended = false)
1558 {
1559  return NTV2RegisterNumber (kRegFirstNonPCMAudioDetectRegister + inSDIInputChannel * 2 + (inIsExtended ? 1 : 0));
1560 }
1561 
1562 
1563 bool CNTV2Card::InputAudioChannelPairHasPCM (const NTV2Channel inSDIInputChannel, const NTV2AudioChannelPair inAudioChannelPair, bool & outHasPCM)
1564 {
1565  if (!NTV2_IS_VALID_AUDIO_CHANNEL_PAIR (inAudioChannelPair))
1566  return false;
1567  NTV2AudioChannelPairs withPCMs;
1568  if (!GetInputAudioChannelPairsWithPCM (inSDIInputChannel, withPCMs))
1569  return false;
1570 
1571  outHasPCM = withPCMs.find (inAudioChannelPair) != withPCMs.end (); // Test set membership
1572  return true;
1573 }
1574 
1575 
1577 {
1578  outPCMPairs.clear ();
1579  if (!IsSupported(kDeviceCanDoPCMDetection))
1580  return false;
1581  if (!NTV2_IS_VALID_CHANNEL (inSDIInputChannel))
1582  return false;
1583  if (ULWord(inSDIInputChannel) >= GetNumSupported(kDeviceGetNumVideoInputs))
1584  return false;
1585 
1586  // Read channel pair bitmask registers...
1587  const ULWord numChannels (GetNumSupported(kDeviceGetMaxAudioChannels));
1588  const bool isExtended (numChannels > 16);
1589  const NTV2RegisterNumber regNum (::GetNonPCMDetectRegisterNumber (inSDIInputChannel));
1590  ULWord mask (0);
1591  ULWord extMask (0);
1592  if (!ReadRegister (regNum, mask))
1593  return false;
1594  if (isExtended)
1595  if (!ReadRegister (regNum + 1, extMask))
1596  return false;
1597 
1598  // Convert bitmasks to set of with-PCM pairs...
1599  outPCMPairs = ::BitMasksToNTV2AudioChannelPairs (~mask, isExtended ? ~extMask : 0);
1600  return true;
1601 }
1602 
1603 
1605 {
1606  outNonPCMPairs.clear ();
1607  if (!IsSupported(kDeviceCanDoPCMDetection))
1608  return false;
1609  if (!NTV2_IS_VALID_CHANNEL (inSDIInputChannel))
1610  return false;
1611  if (ULWord(inSDIInputChannel) >= GetNumSupported(kDeviceGetNumVideoInputs))
1612  return false;
1613 
1614  // Read channel pair bitmask registers...
1615  const ULWord numChannels (GetNumSupported(kDeviceGetMaxAudioChannels));
1616  const bool isExtended (numChannels > 16);
1617  const NTV2RegisterNumber regNum (::GetNonPCMDetectRegisterNumber (inSDIInputChannel));
1618  ULWord mask (0);
1619  ULWord extMask (0);
1620  if (!ReadRegister (regNum, mask))
1621  return false;
1622  if (isExtended)
1623  if (!ReadRegister (regNum + 1, extMask))
1624  return false;
1625 
1626  // Convert bitmasks to set of non-PCM pairs...
1627  outNonPCMPairs = ::BitMasksToNTV2AudioChannelPairs (mask, isExtended ? extMask : 0);
1628  return true;
1629 }
1630 
1631 // GetSDIOutputAudioEnabled, SetSDIOutputAudioEnabled:
1632 // The audio HANC disable bit actually controls the SDI Output, not the Audio System
1633 // (They probably should've been put in the SDIOut widget control registers.)
1634 // Also thanks to "legacy", bits 13 & 15 control an even-numbered and odd-numbered, respectively, SDI output:
1635 // Thus the ctrl reg of AudSys1 controls SDI1 & SDI2; AudSys3 controls SDIOut3 & SDIOut4; AudSys5 for SDI5 & SDI6; etc...
1636 // The control registers of Audio Systems 2, 4, 6 & 8 ignore bits 13 & 15.
1639 
1640 bool CNTV2Card::GetSDIOutputAudioEnabled (const NTV2Channel inSDIOutputSpigot, bool & outIsEnabled)
1641 {
1642  outIsEnabled = true; // presume normal
1643  if (!NTV2_IS_VALID_CHANNEL (inSDIOutputSpigot))
1644  return false;
1645  if (ULWord(inSDIOutputSpigot) >= GetNumSupported(kDeviceGetNumVideoOutputs))
1646  return false;
1647 
1648  ULWord value (0);
1649  if (!ReadRegister (kAudCtrlRegsForSDIOutputs[inSDIOutputSpigot], value,
1652  return false;
1653  outIsEnabled = value ? false : true; // Bit sense is 1=disabled, 0=enabled/normal
1654  return true;
1655 }
1656 
1657 bool CNTV2Card::SetSDIOutputAudioEnabled (const NTV2Channel inSDIOutputSpigot, const bool & inEnable)
1658 {
1659  if (!NTV2_IS_VALID_CHANNEL (inSDIOutputSpigot))
1660  return false;
1661  if (ULWord(inSDIOutputSpigot) >= GetNumSupported(kDeviceGetNumVideoOutputs))
1662  return false;
1663 
1664  return WriteRegister (kAudCtrlRegsForSDIOutputs[inSDIOutputSpigot], inEnable ? 0 : 1,
1667 }
1668 
1669 
1670 bool CNTV2Card::GetAudioOutputEraseMode (const NTV2AudioSystem inAudioSystem, bool & outEraseModeEnabled)
1671 {
1672  outEraseModeEnabled = false;
1673  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
1674  return false;
1675  if (UWord(inAudioSystem) >= GetNumSupported(kDeviceGetNumBufferedAudioSystems))
1676  return false;
1677  ULWord regValue(0);
1678  if (!ReadRegister (gAudioSystemToSrcSelectRegNum[inAudioSystem], regValue))
1679  return false;
1680  outEraseModeEnabled = (regValue & kRegMaskAudioAutoErase) ? true : false;
1681  return true;
1682 }
1683 
1684 
1685 bool CNTV2Card::SetAudioOutputEraseMode (const NTV2AudioSystem inAudioSystem, const bool & inEraseModeEnabled)
1686 {
1687  if (!NTV2_IS_VALID_AUDIO_SYSTEM (inAudioSystem))
1688  return false;
1689  if (UWord(inAudioSystem) >= GetNumSupported(kDeviceGetNumBufferedAudioSystems))
1690  return false;
1691  return WriteRegister (gAudioSystemToSrcSelectRegNum[inAudioSystem], inEraseModeEnabled ? 1 : 0, kRegMaskAudioAutoErase, kRegShiftAudioAutoErase);
1692 }
1693 
1694 bool CNTV2Card::SetAnalogAudioTransmitEnable (const NTV2Audio4ChannelSelect inChannelQuad, const bool inXmitEnable)
1695 {
1696  // Reg 108 (kRegGlobalControl3) has two bits for controlling XLR direction: BIT(0) for XLRs 1-4, BIT(1) for XLRs 5-8
1697  if (!IsSupported(kDeviceHasBiDirectionalAnalogAudio))
1698  return false; // unsupported
1699  if (inChannelQuad > NTV2_AudioChannel5_8)
1700  return false; // NTV2_AudioChannel1_4 & NTV2_AudioChannel5_8 only
1701  return WriteRegister (kRegGlobalControl3, inXmitEnable ? 0 : 1, // 0 == xmit 1 == recv
1703  ULWord(inChannelQuad));
1704 }
1705 
1706 bool CNTV2Card::GetAnalogAudioTransmitEnable (const NTV2Audio4ChannelSelect inChannelQuad, bool & outXmitEnabled)
1707 {
1708  outXmitEnabled = false;
1709  // Reg 108 (kRegGlobalControl3) has two bits for controlling XLR direction: BIT(0) for XLRs 1-4, BIT(1) for XLRs 5-8
1710  if (!IsSupported(kDeviceHasBiDirectionalAnalogAudio))
1711  return false; // unsupported
1712  if (inChannelQuad > NTV2_AudioChannel5_8)
1713  return false; // NTV2_AudioChannel1_4 & NTV2_AudioChannel5_8 only
1714  if (!CNTV2DriverInterface::ReadRegister (kRegGlobalControl3, outXmitEnabled, // false == xmit true == recv
1716  ULWord(inChannelQuad)))
1717  return false;
1718  outXmitEnabled = !outXmitEnabled; // Flip the sense, we want xmit == true, recv == false
1719  return true;
1720 }
1721 
1722 bool CNTV2Card::SetMultiLinkAudioMode (const NTV2AudioSystem inAudioSystem, const bool inEnable)
1723 {
1724  if (!IsSupported(kDeviceCanDoMultiLinkAudio))
1725  return false;
1726  return WriteRegister(gAudioSystemToAudioControlRegNum[inAudioSystem], inEnable ? 1 : 0, kRegMaskMultiLinkAudio, kRegShiftMultiLinkAudio);
1727 }
1728 
1729 bool CNTV2Card::GetMultiLinkAudioMode (const NTV2AudioSystem inAudioSystem, bool & outEnabled)
1730 {
1731  outEnabled = false;
1732  if (!IsSupported(kDeviceCanDoMultiLinkAudio))
1733  return false;
1735 }
1736 
1737 #if !defined(NTV2_DEPRECATE_16_1)
1739  {
1740  if (inConfig > NTV2_AnalogAudioIO_8In)
1741  return false;
1742  return SetAnalogAudioTransmitEnable (NTV2_AudioChannel1_4, inConfig == NTV2_AnalogAudioIO_8Out || inConfig == NTV2_AnalogAudioIO_4Out_4In)
1743  && SetAnalogAudioTransmitEnable (NTV2_AudioChannel5_8, inConfig == NTV2_AnalogAudioIO_8Out || inConfig == NTV2_AnalogAudioIO_4In_4Out);
1744  }
1745 
1747  {
1748  bool xlr14Xmit(false), xlr58Xmit(false);
1749  if (!GetAnalogAudioTransmitEnable (NTV2_AudioChannel1_4, xlr14Xmit))
1750  return false;
1751  if (!GetAnalogAudioTransmitEnable (NTV2_AudioChannel5_8, xlr58Xmit))
1752  return false;
1753  if (xlr14Xmit && xlr58Xmit)
1754  outConfig = NTV2_AnalogAudioIO_8Out;
1755  else if (xlr14Xmit && !xlr58Xmit)
1756  outConfig = NTV2_AnalogAudioIO_4Out_4In;
1757  else if (!xlr14Xmit && xlr58Xmit)
1758  outConfig = NTV2_AnalogAudioIO_4In_4Out;
1759  else
1760  outConfig = NTV2_AnalogAudioIO_8In;
1761  return true;
1762  }
1763 #endif // !defined(NTV2_DEPRECATE_16_1)
1764 
1765 bool CNTV2Card::GetAudioOutputAESSyncModeBit (const NTV2AudioSystem inAudioSystem, bool & outAESSyncModeBitSet)
1766 {
1767  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
1768  return false;
1769  if (UWord(inAudioSystem) >= GetNumSupported(kDeviceGetNumBufferedAudioSystems))
1770  return false;
1771  ULWord regValue(0);
1772  if (!ReadRegister (gAudioSystemToSrcSelectRegNum[inAudioSystem], regValue, BIT(18), 18))
1773  return false;
1774  outAESSyncModeBitSet = regValue ? true : false;
1775  return true;
1776 }
1777 
1778 bool CNTV2Card::SetAudioOutputAESSyncModeBit (const NTV2AudioSystem inAudioSystem, const bool & inAESSyncModeBitSet)
1779 {
1780  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
1781  return false;
1782  if (UWord(inAudioSystem) >= GetNumSupported(kDeviceGetNumBufferedAudioSystems))
1783  return false;
1784  return WriteRegister(gAudioSystemToSrcSelectRegNum[inAudioSystem], inAESSyncModeBitSet?1:0, BIT(18), 18);
1785 }
1786 
1787 bool CNTV2Card::GetRawAudioTimer (ULWord & outValue, const NTV2AudioSystem inAudioSystem)
1788 {
1789  if (!NTV2_IS_VALID_AUDIO_SYSTEM(inAudioSystem))
1790  return false;
1791  return ReadRegister(kRegAud1Counter, outValue);
1792 }
1793 
1795 {
1796  return IsSupported(kDeviceCanDoBreakoutBoard)
1798 }
1799 
1800 bool CNTV2Card::GetAudioMemoryOffset (const ULWord inOffsetBytes, ULWord & outAbsByteOffset,
1801  const NTV2AudioSystem inAudioSystem, const bool inCaptureBuffer)
1802 {
1803  outAbsByteOffset = 0;
1804  const NTV2DeviceID deviceID(GetDeviceID());
1805  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetNumBufferedAudioSystems))
1806  return false; // Invalid audio system
1807 
1808  if (IsSupported(kDeviceCanDoStackedAudio))
1809  {
1810  const ULWord EIGHT_MEGABYTES (0x800000);
1811  const ULWord memSize (GetNumSupported(kDeviceGetActiveMemorySize));
1812  const ULWord engineOffset (memSize - EIGHT_MEGABYTES * ULWord(inAudioSystem+1));
1813  outAbsByteOffset = inOffsetBytes + engineOffset;
1814  }
1815  else
1816  {
1819  if (!GetFrameGeometry (fg, NTV2Channel(inAudioSystem)) || !GetFrameBufferFormat (NTV2Channel(inAudioSystem), fbf))
1820  return false;
1821 
1822  const ULWord audioFrameBuffer (::NTV2DeviceGetNumberFrameBuffers(deviceID, fg, fbf) - 1);
1823  outAbsByteOffset = inOffsetBytes + audioFrameBuffer * ::NTV2DeviceGetFrameBufferSize(deviceID, fg, fbf);
1824  }
1825 
1826  if (inCaptureBuffer) // Capture mode?
1827  { ULWord rdBufOffset(0x400000); // 4MB
1828  GetAudioReadOffset (rdBufOffset, inAudioSystem);
1829  outAbsByteOffset += rdBufOffset; // Add offset to point to capture buffer
1830  }
1831  return true;
1832 }
1833 
1834 #ifdef MSWindows
1835  #pragma warning(default: 4800)
1836 #endif
virtual bool GetAudioPCMControl(const NTV2AudioSystem inAudioSystem, bool &outIsNonPCM)
Answers whether or not all outgoing audio channel pairs are currently being flagged as non-PCM for th...
Definition: ntv2audio.cpp:1311
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
This selects the Audio Mixer&#39;s 1st Auxiliary input.
Definition: ntv2enums.h:3260
virtual bool GetAudioWrapAddress(ULWord &outWrapAddress, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the wrap address, the threshold at which input/record or out...
Definition: ntv2audio.cpp:434
#define AUDINFO(__x__)
Definition: ntv2audio.cpp:25
virtual bool GetAudioOutputPause(const NTV2AudioSystem inAudioSystem, bool &outIsPaused)
Answers if the device&#39;s Audio System is currently paused or not.
Definition: ntv2audio.cpp:1167
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3898
virtual bool SetAudioAnalogLevel(const NTV2AudioLevel value, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Definition: ntv2audio.cpp:281
virtual bool GetHDMIOutAudioRate(NTV2AudioRate &outValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Answers with the HDMI output&#39;s current audio rate.
Definition: ntv2audio.cpp:1021
virtual bool SetMultiLinkAudioMode(const NTV2AudioSystem inAudioSystem, const bool inEnable)
Sets the multi-link audio mode for the given audio system.
Definition: ntv2audio.cpp:1722
bool GetBadRegions(ULWordSequence &outBlks) const
Answers with the list of colliding and illegal memory regions.
Definition: ntv2card.h:7007
virtual bool SetHDMIOutAudioSource2Channel(const NTV2AudioChannelPair inNewValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output&#39;s 2-channel audio source.
Definition: ntv2audio.cpp:869
virtual bool GetAudioLoopBack(NTV2AudioLoopBack &outMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Answers if NTV2AudioLoopBack mode is currently on or off for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:322
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:301
virtual bool GetDetectedAESChannelPairs(NTV2AudioChannelPairs &outDetectedChannelPairs)
Answers which AES/EBU audio channel pairs are present on the device.
Definition: ntv2audio.cpp:1439
static const ULWord gAudioPlayCaptureModeMasks[]
Definition: ntv2audio.cpp:38
NTV2AudioBufferSize
Represents the size of the audio buffer used by a device audio system for storing captured samples or...
Definition: ntv2enums.h:1917
This selects audio channels 5 thru 8.
Definition: ntv2enums.h:3277
#define DEC0N(__x__, __n__)
virtual bool EnableBOBAnalogAudioIn(bool inEnable)
Enables breakout board analog audio XLR inputs.
Definition: ntv2audio.cpp:1794
virtual bool GetAudioMixerInputLevels(const NTV2AudioMixerInput inMixerInput, const NTV2AudioChannelPairs &inChannelPairs, std::vector< uint32_t > &outLevels)
Answers with the Audio Mixer&#39;s current audio input levels.
Definition: ntv2audio.cpp:760
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:221
#define BIT(_x_)
Definition: ajatypes.h:596
The number of AES/EBU audio output channels on the device.
PCM_CONTROL_INFO(ULWord regNum, ULWord mask, ULWord shift)
Definition: ntv2audio.cpp:59
virtual bool GetAudioOutputAESSyncModeBit(const NTV2AudioSystem inAudioSystem, bool &outAESSyncModeBitSet)
Answers with the current state of the AES Sync Mode bit for the given Audio System&#39;s output...
Definition: ntv2audio.cpp:1765
Obtain audio samples from the device AES inputs, if available.
Definition: ntv2enums.h:2011
virtual bool GetHDMIOutAudioChannels(NTV2HDMIAudioChannels &outValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Answers with the audio channel count for the given HDMI output (2 or 8).
Definition: ntv2audio.cpp:858
bool AssessDevice(CNTV2Card &inDevice, const bool inIgnoreStoppedAudioBuffers=(0))
Assesses the given device.
Definition: ntv2card.cpp:610
Declares the AJADebug class.
static const ULWord sAudioDetectRegs[]
Definition: ntv2audio.cpp:1400
Obtain audio samples from the device HDMI input, if available.
Definition: ntv2enums.h:2013
virtual bool GetAudioInputDelay(const NTV2AudioSystem inAudioSystem, ULWord &outDelay)
Answers with the audio input delay for the given Audio System on the device.
Definition: ntv2audio.cpp:1280
virtual bool SetAudioCaptureEnable(const NTV2AudioSystem inAudioSystem, const bool inEnable)
Enables or disables the writing of incoming audio into the given Audio System&#39;s capture buffer...
Definition: ntv2audio.cpp:1243
virtual bool SetAudioMixerOutputChannelsMute(const NTV2AudioChannelsMuted16 inMutes)
Mutes or enables the individual output audio channels of the Audio Mixer.
Definition: ntv2audio.cpp:728
Audits an NTV2 device&#39;s SDRAM utilization, and can report contiguous regions of SDRAM, whether unused/free, those being read/written by AutoCirculate, those being read/written by non-AutoCirculating FrameStores, those that are in conflict (AutoCirculate, FrameStore and/or Audio collisions), plus invalid/out-of-bounds regions being accessed.
Definition: ntv2card.h:6942
The number of independent Audio Systems on the device.
virtual bool SetAudioOutputEraseMode(const NTV2AudioSystem inAudioSystem, const bool &inEraseModeEnabled)
Enables or disables output erase mode for the given Audio System, which, when enabled, automatically writes zeroes into the audio output buffer behind the output read head.
Definition: ntv2audio.cpp:1685
NTV2AnalogAudioIO
Definition: ntv2enums.h:2235
virtual bool GetAudioSystemInputSource(const NTV2AudioSystem inAudioSystem, NTV2AudioSource &outAudioSource, NTV2EmbeddedAudioInput &outEmbeddedSource)
Answers with the device&#39;s current NTV2AudioSource (and also possibly its NTV2EmbeddedAudioInput) for ...
Definition: ntv2audio.cpp:516
static const ULWord kAudCtrlRegsForSDIOutputs[]
Definition: ntv2audio.cpp:1637
virtual bool GetHDMIOutAudioSource2Channel(NTV2AudioChannelPair &outValue, NTV2AudioSystem &outAudioSystem, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Answers with the HDMI output&#39;s current 2-channel audio source.
Definition: ntv2audio.cpp:899
virtual bool GetAudioRate(NTV2AudioRate &outRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:227
virtual bool GetEncodedAudioMode(NTV2EncodedAudioMode &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Definition: ntv2audio.cpp:339
True if device can detect which audio channel pairs are not carrying PCM (Pulse Code Modulation) audi...
virtual bool GetAudioMixerOutputGain(ULWord &outGainValue)
Answers with the current gain setting for the Audio Mixer&#39;s output.
Definition: ntv2audio.cpp:632
virtual bool ReadAudioSource(ULWord &outValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Definition: ntv2audio.cpp:481
virtual bool SetAudioOutputDelay(const NTV2AudioSystem inAudioSystem, const ULWord inDelay)
Sets the audio output delay for the given Audio System on the device.
Definition: ntv2audio.cpp:1288
Declares the AJATime class.
virtual bool SetAudioOutputMonitorSource(const NTV2AudioChannelPair inChannelPair, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the audio monitor output source to a specified audio system and channel pair. The audio output monitor is typically a pair of RCA jacks (white + red) and/or a headphone jack.
Definition: ntv2audio.cpp:1054
virtual bool GetInputAudioChannelPairsWithoutPCM(const NTV2Channel inSDIInputConnector, NTV2AudioChannelPairs &outChannelPairs)
For the given SDI input (specified as a channel number), returns the set of audio channel pairs that ...
Definition: ntv2audio.cpp:1604
std::bitset< 16 > NTV2AudioChannelsMuted16
Per-audio-channel mute state for up to 16 audio channels.
Obtain audio samples from the audio that&#39;s embedded in the video HANC.
Definition: ntv2enums.h:2010
NTV2EmbeddedAudioClock
This enum value determines/states the device audio clock reference source. It was important to set th...
Definition: ntv2enums.h:1993
#define NTV2_IS_EXTENDED_AUDIO_CHANNEL_PAIR(__p__)
Definition: ntv2enums.h:3209
True if device has SFP connectors.
#define NTV2_IS_VALID_AUDIO_CHANNEL_OCTET(__p__)
Definition: ntv2enums.h:3347
This selects audio channels 9 thru 16.
Definition: ntv2enums.h:3326
static const ULWord gAudioRateHighShift[]
Definition: ntv2audio.cpp:52
virtual bool GetAudioOutputDelay(const NTV2AudioSystem inAudioSystem, ULWord &outDelay)
Answers with the audio output delay for the given Audio System on the device.
Definition: ntv2audio.cpp:1296
Definition: json.hpp:5362
NTV2HDMIAudioChannels
Indicates or specifies the HDMI audio channel count.
Definition: ntv2enums.h:3670
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:206
virtual bool IsAudioInputRunning(const NTV2AudioSystem inAudioSystem, bool &outIsRunning)
Answers whether or not the capture side of the given NTV2AudioSystem is currently running...
Definition: ntv2audio.cpp:1231
virtual bool IsAudioChannelPairPresent(const NTV2AudioSystem inAudioSystem, const NTV2AudioChannelPair inChannelPair, bool &outIsPresent)
Answers whether or not the given NTV2AudioChannelPair in the given NTV2AudioSystem on the device is p...
Definition: ntv2audio.cpp:1409
Declares common audio macros and structs used in the SDK.
static const ULWord sAudioMixerInputMuteShifts[]
Definition: ntv2audio.cpp:714
#define false
#define NTV2_IS_AUDIO_MIXER_CHANNELS_1_OR_2(__p__)
Definition: ntv2enums.h:3251
uint32_t ULWord
Definition: ajatypes.h:236
Embeds SDI input source audio into the data stream.
Definition: ntv2enums.h:2034
NTV2AudioFormat
Definition: ntv2enums.h:1954
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1359
True if Audio System(s) support an adjustable delay.
True if device supports an AJA breakout board. (New in SDK 17.0)
virtual bool SetAnalogAudioIOConfiguration(const NTV2AnalogAudioIO inConfig)
Definition: ntv2audio.cpp:1738
std::set< NTV2AudioChannelPair > NTV2AudioChannelPairs
A set of distinct NTV2AudioChannelPair values.
virtual bool SetHDMIOutAudioChannels(const NTV2HDMIAudioChannels inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the audio channel count to use for the given HDMI output.
Definition: ntv2audio.cpp:847
static const ULWord sAudioMixerInputMuteMasks[]
Definition: ntv2audio.cpp:713
This identifies the 5th Audio System.
Definition: ntv2enums.h:3904
True if device supports grouped audio system control.
virtual bool SetAudioMixerOutputGain(const ULWord inGainValue)
Sets the gain for the output of the Audio Mixer.
Definition: ntv2audio.cpp:640
virtual bool StartAudioOutput(const NTV2AudioSystem inAudioSystem, const bool inWaitForVBI=(0))
Starts the playout side of the given NTV2AudioSystem, reading outgoing audio samples from the Audio S...
Definition: ntv2audio.cpp:1077
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:489
The number of SDI video outputs on the device.
#define NTV2_AUDIO_WRAPADDRESS
Obtain audio samples from the device analog input(s), if available.
Definition: ntv2enums.h:2012
NTV2RegWritesConstIter NTV2RegisterReadsConstIter
This selects audio channels 15 and 16 (Group 4 channels 3 and 4)
Definition: ntv2enums.h:3143
The total number of audio systems on the device, including host audio and mixer audio systems...
True if device can mark specific audio channel pairs as not carrying PCM (Pulse Code Modulation) audi...
virtual bool SetAudioPlayCaptureModeEnable(const NTV2AudioSystem inAudioSystem, const bool inEnable)
Enables or disables a special mode for the given Audio System whereby its embedder and deembedder bot...
Definition: ntv2audio.cpp:1257
virtual bool SetAudioSystemInputSource(const NTV2AudioSystem inAudioSystem, const NTV2AudioSource inAudioSource, const NTV2EmbeddedAudioInput inEmbeddedInput)
Sets the audio source for the given NTV2AudioSystem on the device.
Definition: ntv2audio.cpp:486
ULWord pcmControlShift
Definition: ntv2audio.cpp:58
virtual bool SetHDMIOutAudioRate(const NTV2AudioRate inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output&#39;s audio rate.
Definition: ntv2audio.cpp:1010
This selects audio channels 1 thru 8.
Definition: ntv2enums.h:3325
static const unsigned sAudioDetectGroups[]
Definition: ntv2audio.cpp:1405
#define true
virtual bool GetAudioMixerOutputLevels(const NTV2AudioChannelPairs &inChannelPairs, std::vector< uint32_t > &outLevels)
Answers with the Audio Mixer&#39;s current audio output levels.
Definition: ntv2audio.cpp:648
virtual bool IsAudioOutputRunning(const NTV2AudioSystem inAudioSystem, bool &outIsRunning)
Answers whether or not the playout side of the given NTV2AudioSystem is currently running...
Definition: ntv2audio.cpp:1132
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
virtual bool SetAudioMixerInputChannelSelect(const NTV2AudioMixerInput inMixerInput, const NTV2AudioChannelPair inChannelPair)
Specifies the Audio Channel Pair that will drive the given input of the Audio Mixer.
Definition: ntv2audio.cpp:590
virtual bool GetAudioMixerInputChannelSelect(const NTV2AudioMixerInput inMixerInput, NTV2AudioChannelPair &outChannelPair)
Answers with the Audio Channel Pair that&#39;s currently driving the given input of the Audio Mixer...
Definition: ntv2audio.cpp:575
virtual bool GetAudioMixerOutputChannelsMute(NTV2AudioChannelsMuted16 &outMutes)
Answers with a std::bitset that indicates which output audio channels of the Audio Mixer are currentl...
Definition: ntv2audio.cpp:716
virtual bool GetAudioCaptureEnable(const NTV2AudioSystem inAudioSystem, bool &outEnable)
Answers whether or not the Audio System is configured to write captured audio samples into device aud...
Definition: ntv2audio.cpp:1250
std::set< std::string > NTV2StringSet
virtual bool GetAudioAnalogLevel(NTV2AudioLevel &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Definition: ntv2audio.cpp:291
static const ULWord gChannelToAudioOutLastAddrRegNum[]
Definition: ntv2audio.cpp:35
ULWord pcmControlReg
Definition: ntv2audio.cpp:56
True if device has attached breakout board. (New in SDK 17.0)
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device...
virtual bool StartAudioInput(const NTV2AudioSystem inAudioSystem, const bool inWaitForVBI=(0))
Starts the capture side of the given NTV2AudioSystem, writing incoming audio samples into the Audio S...
Definition: ntv2audio.cpp:1174
NTV2AudioLoopBack
This enum value determines/states if an audio output embedder will embed silence (zeroes) or de-embed...
Definition: ntv2enums.h:2031
virtual bool GetHDMIOutAudioFormat(NTV2AudioFormat &outValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Answers with the HDMI output&#39;s current audio format.
Definition: ntv2audio.cpp:1043
This selects audio channels 1 thru 4.
Definition: ntv2enums.h:3276
#define NTV2_IS_AUDIO_MIXER_INPUT_MAIN(__p__)
Definition: ntv2enums.h:3267
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
This selects audio channels 1 and 2 (Group 1 channels 1 and 2)
Definition: ntv2enums.h:3136
True if device uses a "stacked" arrangement of its audio buffers.
This selects audio channels 9 thru 12.
Definition: ntv2enums.h:3278
virtual bool GetHDMIOutAudioSource8Channel(NTV2Audio8ChannelSelect &outValue, NTV2AudioSystem &outAudioSystem, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Answers with the HDMI output&#39;s current 8-channel audio source.
Definition: ntv2audio.cpp:970
NTV2AudioChannelPair
Identifies a pair of audio channels.
Definition: ntv2enums.h:3134
virtual bool GetAnalogAudioIOConfiguration(NTV2AnalogAudioIO &outConfig)
Definition: ntv2audio.cpp:1746
virtual bool ReadAudioLastIn(ULWord &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the byte offset to the last byte of the latest chunk of 4-by...
Definition: ntv2audio.cpp:466
virtual bool SetEmbeddedAudioInput(const NTV2EmbeddedAudioInput inEmbeddedSource, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the embedded (SDI) audio source for the given NTV2AudioSystem on the device. ...
Definition: ntv2audio.cpp:347
NTV2RegWrites NTV2RegisterReads
virtual bool GetAudioOutputMonitorSource(NTV2AudioChannelPair &outChannelPair, NTV2AudioSystem &outAudioSystem)
Answers with the current audio monitor source. The audio output monitor is typically a pair of RCA ja...
Definition: ntv2audio.cpp:1065
virtual bool GetAudioOutputEraseMode(const NTV2AudioSystem inAudioSystem, bool &outEraseModeEnabled)
Answers with the current state of the audio output erase mode for the given Audio System...
Definition: ntv2audio.cpp:1670
virtual bool InputAudioChannelPairHasPCM(const NTV2Channel inSDIInputConnector, const NTV2AudioChannelPair inAudioChannelPair, bool &outIsPCM)
For the given SDI input (specified as a channel number), answers if the specified audio channel pair ...
Definition: ntv2audio.cpp:1563
The maximum number of audio channels that a single Audio System can support on the device...
std::set< NTV2AudioSystem > NTV2AudioSystemSet
A set of distinct NTV2AudioSystem values. New in SDK 16.2.
virtual bool GetAudioBufferSize(NTV2AudioBufferSize &outSize, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Retrieves the size of the input or output audio buffer being used for a given Audio System on the AJA...
Definition: ntv2audio.cpp:269
#define AUDWARN(__x__)
Definition: ntv2audio.cpp:23
static const ULWord gAudioRateHighMask[]
Definition: ntv2audio.cpp:49
#define NTV2_AUDIO_WRAPADDRESS_BIG
static const ULWord sAudioMixerInputGainCh1Regs[]
Definition: ntv2audio.cpp:602
virtual bool WriteAudioSource(const ULWord inValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Definition: ntv2audio.cpp:482
virtual bool SetAudio20BitMode(const NTV2AudioSystem inAudioSystem, const bool inEnable)
Enables or disables 20-bit mode for the NTV2AudioSystem.
Definition: ntv2audio.cpp:1144
NTV2AudioLevel
Definition: ntv2enums.h:2316
virtual bool GetRawAudioTimer(ULWord &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Answers with the current value of the 48kHz audio clock counter.
Definition: ntv2audio.cpp:1787
virtual bool GetAnalogAudioTransmitEnable(const NTV2Audio4ChannelSelect inChannelQuad, bool &outEnabled)
Answers whether or not the specified bidirectional XLR audio connectors are collectively acting as in...
Definition: ntv2audio.cpp:1706
virtual bool GetDetectedAudioChannelPairs(const NTV2AudioSystem inAudioSystem, NTV2AudioChannelPairs &outDetectedChannelPairs)
Answers which audio channel pairs are present in the given Audio System&#39;s input stream.
Definition: ntv2audio.cpp:1421
virtual bool GetAudioPlayCaptureModeEnable(const NTV2AudioSystem inAudioSystem, bool &outEnable)
Answers whether or not the device&#39;s Audio System is currently operating in a special mode in which it...
Definition: ntv2audio.cpp:1264
ULWord NTV2DeviceGetNumberFrameBuffers(NTV2DeviceID id, NTV2FrameGeometry fg, NTV2FrameBufferFormat fbf)
virtual bool GetAESOutputSource(const NTV2Audio4ChannelSelect inAESAudioChannels, NTV2AudioSystem &outSrcAudioSystem, NTV2Audio4ChannelSelect &outSrcAudioChannels)
Answers with the current audio source for a given quad of AES audio output channels. By default, at power-up, for AJA devices that support AES audio output, the content of AES audio output channels 1/2/3/4 reflect what&#39;s being output from audio channels 1/2/3/4 from NTV2_AUDIOSYSTEM_1, likewise with audio channels 5/6/7/8, etc.
Definition: ntv2audio.cpp:1505
#define NTV2_IS_VALID_AUDIO_LOOPBACK(_x_)
Definition: ntv2enums.h:2038
static const ULWord gAudioPlayCaptureModeShifts[]
Definition: ntv2audio.cpp:41
#define NTV2_IS_VALID_AUDIO_MIXER_INPUT(__p__)
Definition: ntv2enums.h:3266
#define NTV2_IS_VALID_CHANNEL(__x__)
Definition: ntv2enums.h:1373
virtual bool SetEncodedAudioMode(const NTV2EncodedAudioMode value, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Definition: ntv2audio.cpp:331
virtual bool GetAudioMixerLevelsSampleCount(ULWord &outSampleCount)
Answers with the Audio Mixer&#39;s current sample count used for measuring audio levels.
Definition: ntv2audio.cpp:824
virtual bool GetAudioReadOffset(ULWord &outReadOffset, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the byte offset from the start of the audio buffer to the fi...
Definition: ntv2audio.cpp:450
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device...
Definition: ntv2audio.cpp:250
virtual bool ReadAudioLastOut(ULWord &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the byte offset of the tail end of the last chunk of audio s...
Definition: ntv2audio.cpp:473
virtual bool GetNumberAudioChannels(ULWord &outNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current number of audio channels being captured or played by a given Audio System on the ...
Definition: ntv2audio.cpp:181
static NTV2AudioChannelPairs BitMasksToNTV2AudioChannelPairs(const ULWord inBitMask, const ULWord inExtendedBitMask)
Definition: ntv2audio.cpp:1542
This selects audio channels 13 thru 16.
Definition: ntv2enums.h:3279
2 audio channels
Definition: ntv2enums.h:3672
static const ULWord gChannelToAudioInLastAddrRegNum[]
Definition: ntv2audio.cpp:32
#define DEC(__x__)
NTV2RegisterNumber
This selects audio channels 17 and 18.
Definition: ntv2enums.h:3144
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:350
This identifies the first Audio System.
Definition: ntv2enums.h:3900
The total number of audio systems on the device that can read/write audio buffer memory. Includes host audio system, if present. (New in SDK 17.0)
static const unsigned gAESChannelMappingShifts[4]
Definition: ntv2audio.cpp:1502
Declares numerous NTV2 utility functions.
#define NTV2_AUDIO_READBUFFEROFFSET_BIG
virtual bool SetHDMIOutAudioSource8Channel(const NTV2Audio8ChannelSelect inNewValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Changes the HDMI output&#39;s 8-channel audio source.
Definition: ntv2audio.cpp:936
static const ULWord sAudioMixerInputSelectShifts[]
Definition: ntv2audio.cpp:547
virtual bool SetHDMIOutAudioFormat(const NTV2AudioFormat inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output&#39;s audio format.
Definition: ntv2audio.cpp:1032
uint16_t UWord
Definition: ajatypes.h:234
virtual bool SetHeadphoneOutputGain(const ULWord inGainValue)
Sets the gain for the headphone out.
Definition: ntv2audio.cpp:706
virtual bool GetSuspendHostAudio(bool &outIsSuspended)
Answers as to whether or not the host OS audio services for the AJA device (e.g. CoreAudio on MacOS) ...
Definition: ntv2audio.cpp:1464
virtual bool GetEmbeddedAudioClock(NTV2EmbeddedAudioClock &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given NTV2AudioSystem, answers with the current NTV2EmbeddedAudioClock setting.
Definition: ntv2audio.cpp:426
Obtain audio samples from the device microphone input, if available.
Definition: ntv2enums.h:2014
ULWord pcmControlMask
Definition: ntv2audio.cpp:57
virtual bool SetAudioMixerInputAudioSystem(const NTV2AudioMixerInput inMixerInput, const NTV2AudioSystem inAudioSystem)
Sets the Audio System that will drive the given input of the Audio Mixer.
Definition: ntv2audio.cpp:562
virtual bool SetAudioMixerInputGain(const NTV2AudioMixerInput inMixerInput, const NTV2AudioMixerChannel inChannel, const ULWord inGainValue)
Sets the gain for the given input of the Audio Mixer.
Definition: ntv2audio.cpp:619
virtual bool GetSDIOutputAudioEnabled(const NTV2Channel inSDIOutput, bool &outIsEnabled)
Answers with the current state of the audio output embedder for the given SDI output connector (speci...
Definition: ntv2audio.cpp:1640
#define NTV2_IS_VALID_AUDIO_SYSTEM(__x__)
Definition: ntv2enums.h:3917
bool GetTagsForFrameIndex(const UWord inIndex, NTV2StringSet &outTags) const
Answers with the list of tags for the given frame number.
Definition: ntv2card.cpp:744
#define NTV2_IS_VALID_AUDIO_SOURCE(_x_)
Definition: ntv2enums.h:2023
static const ULWord gAudioSystemToAudioControlRegNum[]
Definition: ntv2audio.cpp:46
NTV2AudioSystemSet::const_iterator NTV2AudioSystemSetConstIter
A handy const iterator into an NTV2AudioSystemSet. New in SDK 16.2.
virtual bool SetSDIOutputAudioEnabled(const NTV2Channel inSDIOutput, const bool &inEnable)
Enables or disables the audio output embedder for the given SDI output connector (specified as a chan...
Definition: ntv2audio.cpp:1657
virtual bool SetAudioInputDelay(const NTV2AudioSystem inAudioSystem, const ULWord inDelay)
Sets the audio input delay for the given Audio System on the device.
Definition: ntv2audio.cpp:1272
NTV2AudioSource
This enum value determines/states where an audio system will obtain its audio samples.
Definition: ntv2enums.h:2008
Declares the CNTV2Card class.
virtual bool GetInputAudioChannelPairsWithPCM(const NTV2Channel inSDIInputConnector, NTV2AudioChannelPairs &outChannelPairs)
For the given SDI input (specified as a channel number), returns the set of audio channel pairs that ...
Definition: ntv2audio.cpp:1576
#define NTV2_IS_WITHIN_AUDIO_CHANNELS_1_TO_16(__p__)
Definition: ntv2enums.h:3207
virtual bool GetEmbeddedAudioInput(NTV2EmbeddedAudioInput &outEmbeddedSource, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Answers with the device&#39;s current embedded (SDI) audio source for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:378
virtual bool SetAudioMixerLevelsSampleCount(const ULWord inSampleCount)
Sets the Audio Mixer&#39;s sample count it uses for measuring audio levels.
Definition: ntv2audio.cpp:833
virtual bool SetAnalogAudioTransmitEnable(const NTV2Audio4ChannelSelect inChannelQuad, const bool inEnable)
Sets the specified bidirectional XLR audio connectors to collectively act as inputs or outputs...
Definition: ntv2audio.cpp:1694
ULWord NTV2DeviceGetFrameBufferSize(NTV2DeviceID id, NTV2FrameGeometry fg, NTV2FrameBufferFormat fbf)
virtual bool SetAudioPCMControl(const NTV2AudioSystem inAudioSystem, const bool inIsNonPCM)
Determines whether or not all outgoing audio channel pairs are to be flagged as non-PCM for the given...
Definition: ntv2audio.cpp:1304
Private include file for all ajabase sources.
The version number of the HDMI chipset on the device.
True if device audio systems can wait for VBI before starting. (New in SDK 17.0)
NTV2AudioRate
Definition: ntv2enums.h:1931
std::vector< uint32_t > ULWordSequence
An ordered sequence of ULWord (uint32_t) values.
virtual bool GetHeadphoneOutputGain(ULWord &outGainValue)
Answers with the current gain setting for the headphone out.
Definition: ntv2audio.cpp:698
std::string join(const std::vector< std::string > &parts, const std::string &delim)
Definition: common.cpp:468
NTV2AudioMixerChannel
Definition: ntv2enums.h:3228
#define NTV2_AUDIO_READBUFFEROFFSET
True if device has a firmware audio mixer.
virtual bool GetAudioMixerInputChannelsMute(const NTV2AudioMixerInput inMixerInput, NTV2AudioChannelsMuted16 &outMutes)
Answers with a std::bitset that indicates which input audio channels of the given Audio Mixer input a...
Definition: ntv2audio.cpp:735
Audio clock derived from the device reference.
Definition: ntv2enums.h:1995
8 audio channels
Definition: ntv2enums.h:3673
NTV2Audio4ChannelSelect
Identifies a contiguous, adjacent group of four audio channels.
Definition: ntv2enums.h:3274
virtual bool SetAudioOutputAESSyncModeBit(const NTV2AudioSystem inAudioSystem, const bool &inAESSyncModeBitSet)
Sets or clears the AES Sync Mode bit for the given Audio System&#39;s output.
Definition: ntv2audio.cpp:1778
True if device has a bi-directional analog audio connector.
static const ULWord gAudioSystemToSrcSelectRegNum[]
Definition: ntv2audio.cpp:29
True if device has a rotary encoder volume control.
virtual bool GetAudio20BitMode(const NTV2AudioSystem inAudioSystem, bool &outEnable)
Answers whether or not the device&#39;s NTV2AudioSystem is currently operating in 20-bit mode...
Definition: ntv2audio.cpp:1152
NTV2AudioChannelPairs::const_iterator NTV2AudioChannelPairsConstIter
Handy const iterator to iterate over a set of distinct NTV2AudioChannelPair values.
virtual bool GetAudioMixerInputGain(const NTV2AudioMixerInput inMixerInput, const NTV2AudioMixerChannel inChannel, ULWord &outGainValue)
Answers with the current gain setting for the Audio Mixer&#39;s given input.
Definition: ntv2audio.cpp:605
This selects audio channels 9 and 10 (Group 3 channels 1 and 2)
Definition: ntv2enums.h:3140
#define NTV2_IS_NORMAL_AUDIO_CHANNEL_QUAD(__p__)
Definition: ntv2enums.h:3315
virtual bool SetAESOutputSource(const NTV2Audio4ChannelSelect inAESAudioChannels, const NTV2AudioSystem inSrcAudioSystem, const NTV2Audio4ChannelSelect inSrcAudioChannels)
Changes the audio source for the given quad of AES audio output channels. By default, at power-up, for AJA devices that support AES audio output, the content of AES audio output channels 1/2/3/4 reflect what&#39;s being output from audio channels 1/2/3/4 from NTV2_AUDIOSYSTEM_1, likewise with audio channels 5/6/7/8, etc.
Definition: ntv2audio.cpp:1532
static const ULWord sAudioMixerInputSelectMasks[]
Definition: ntv2audio.cpp:546
virtual bool StopAudioOutput(const NTV2AudioSystem inAudioSystem)
Stops the playout side of the given NTV2AudioSystem, parking the "Read Head" at the start of the play...
Definition: ntv2audio.cpp:1122
NTV2EmbeddedAudioInput
This enum value determines/states which SDI video input will be used to supply audio samples to an au...
Definition: ntv2enums.h:1970
virtual bool SetNumberAudioChannels(const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the number of audio channels to be concurrently captured or played for a given Audio System on t...
Definition: ntv2audio.cpp:147
virtual bool StopAudioInput(const NTV2AudioSystem inAudioSystem)
Stops the capture side of the given NTV2AudioSystem, and resets the capture position (i...
Definition: ntv2audio.cpp:1220
#define NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(__p__)
Definition: ntv2enums.h:3206
The number of SDI video inputs on the device.
static const ULWord gAudioDelayRegisterNumbers[]
Definition: ntv2audio.cpp:44
virtual bool SetSuspendHostAudio(const bool inSuspend)
Suspends or resumes host OS audio (e.g. CoreAudio on MacOS) for the AJA device.
Definition: ntv2audio.cpp:1458
Declares device capability functions.
virtual bool SetAudioMixerInputChannelsMute(const NTV2AudioMixerInput inMixerInput, const NTV2AudioChannelsMuted16 inMutes)
Mutes (or enables) the given output audio channel of the Audio Mixer.
Definition: ntv2audio.cpp:749
NTV2Audio8ChannelSelect
Identifies a contiguous, adjacent group of eight audio channels.
Definition: ntv2enums.h:3323
The size, in bytes, of the device&#39;s active RAM available for video and audio.
virtual bool GetAudioMixerInputAudioSystem(const NTV2AudioMixerInput inMixerInput, NTV2AudioSystem &outAudioSystem)
Answers with the Audio System that&#39;s currently driving the given input of the Audio Mixer...
Definition: ntv2audio.cpp:550
NTV2EncodedAudioMode
Definition: ntv2enums.h:1943
True if device has any AES audio inputs or outputs.
static const ULWord sAudioMixerInputGainCh2Regs[]
Definition: ntv2audio.cpp:603
static NTV2RegisterNumber GetNonPCMDetectRegisterNumber(const NTV2Channel inSDIInputChannel, const bool inIsExtended=(0))
Definition: ntv2audio.cpp:1557
Audio clock derived from the video input.
Definition: ntv2enums.h:1996
virtual bool GetMultiLinkAudioMode(const NTV2AudioSystem inAudioSystem, bool &outEnabled)
Answers with the current multi-link audio mode for the given audio system.
Definition: ntv2audio.cpp:1729
virtual bool SetEmbeddedAudioClock(const NTV2EmbeddedAudioClock inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2EmbeddedAudioClock setting for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:418
virtual bool SetAudioOutputPause(const NTV2AudioSystem inAudioSystem, const bool inPausePlayout)
Pauses or resumes output of audio samples and advancement of the audio buffer pointer ("play head") o...
Definition: ntv2audio.cpp:1160
The number of HDMI video inputs on the device.
static const PCM_CONTROL_INFO gAudioEngineChannelPairToFieldInformation[][8]
Definition: ntv2audio.cpp:62
virtual bool GetAudioMemoryOffset(const ULWord inOffsetBytes, ULWord &outAbsByteOffset, const NTV2AudioSystem inAudioSystem, const bool inCaptureBuffer=(0))
Answers with the byte offset in device SDRAM into the specified Audio System&#39;s audio buffer...
Definition: ntv2audio.cpp:1800
NTV2AudioMixerInput
Identifies the Audio Mixer&#39;s audio inputs.
Definition: ntv2enums.h:3257