Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.9 KiB

  1. /**********************************************************************
  2. Copyright (c) Microsoft Corporation 1994-1996. All Rights Reserved
  3. LtcDecode, Ken Greenebaum, November 1996
  4. **********************************************************************/
  5. #ifndef _H_LTCDECODER
  6. #define _H_LTCDECODER
  7. #include <wtypes.h>
  8. #include "timecode.h"
  9. typedef struct bitData {
  10. int value;
  11. LONGLONG sample;
  12. } foo;
  13. typedef struct LTCuserBits {
  14. int user1:4;
  15. int user2:4;
  16. int user3:4;
  17. int user4:4;
  18. int user5:4;
  19. int user6:4;
  20. int user7:4;
  21. int user8:4;
  22. } bar;
  23. class LTCdecoder {
  24. public:
  25. LTCdecoder(); // XXX really should spec format, rate...
  26. int decodeBuffer(short **buffer, int *bufferSize);
  27. int getTimeCode(TimeCode *tc); // convert LTC bits to SMPTE timecode
  28. int getUserBits(LTCuserBits *bits);
  29. int getStartStopSample(LONGLONG *start, LONGLONG *end);
  30. private:
  31. int _addBuffer(int bit, LONGLONG sample); // store the bit and detect sync
  32. int _bitWidth; // dynamicaly adjusted bit width
  33. int _sampleWidth; // length of the state we are sampling
  34. int _verticalEpsilon; // how close we have to be to the rail
  35. int _waveState; // high or low
  36. int _lastBit; // width of last bit (0-long, 1-short, 2-2nd short)
  37. // ring buffer
  38. bitData _ringBuffer[80];// this is where we keep our bits!
  39. int _bufferIndex;
  40. int _bitsRecorded; // total number of bits intered (morbid, eh?)
  41. LONGLONG _samplesProcessed; // number of audio samples processed
  42. int _validTimeCode; // set if the ringBuffer contains a timecode
  43. // sync detector
  44. int _onesCount; // track number of consequiative ones! (12==sync)
  45. LONGLONG _syncSample; // the sample corresponding to the LTC sync
  46. LONGLONG _endSample; // the sample corresponding to end of LTC
  47. };
  48. #endif /* _H_LTCDECODER */