voice_packet.bt.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //--------------------------------------
  2. //--- 010 Editor v6.0.3 Binary Template
  3. //
  4. // File:
  5. // Author:
  6. // Revision:
  7. // Purpose:
  8. //--------------------------------------
  9. // CClientAudio::DecompressVoice
  10. local int64 crcLength = FileSize() - sizeof(uint32);
  11. uint64 steamId;
  12. FSeek(crcLength);
  13. uint32 crc;
  14. local int64 crc_calc = Checksum(CHECKSUM_CRC32, 0, crcLength);
  15. if (crc != crc_calc) {
  16. Warning("CRC mismatch!");
  17. return;
  18. }
  19. // CVoiceDecoder::ProcessVoicePayload
  20. FSeek(sizeof(uint64));
  21. while (FTell() < crcLength) {
  22. char payloadType;
  23. switch (payloadType) {
  24. default:
  25. Warning("Unhandled payload!");
  26. return;
  27. case 11: // Sample Rate
  28. short sampleRate;
  29. break;
  30. case 10: // Unknown / Unused
  31. char unk1;
  32. char unk2;
  33. break;
  34. case 1: // Unknown Codec???
  35. case 2: // Speex Data (Unsupported)
  36. case 3: // Uncompressed Data
  37. case 4: // SILK Data
  38. short dataLength;
  39. char data[dataLength];
  40. break;
  41. case 0: // Silence
  42. short numSamples;
  43. break;
  44. }
  45. }
  46. // CVoiceDecoder::AddIncomingData
  47. FSeek(startof(data));
  48. // VoiceEncoder_SILK::Decompress
  49. // chunkLength == -1 means ResetState
  50. while ((FTell() - startof(data)) < dataLength) {
  51. struct Chunk {
  52. short chunkLength;
  53. if (chunkLength != -1) {
  54. char chunk[chunkLength];
  55. }
  56. } chunk;
  57. }