encode_voice

Function encode_voice 

Source
pub fn encode_voice(
    out: &mut [u8],
    header: &DStarHeader,
    stream_id: StreamId,
    seq: u8,
    frame: &VoiceFrame,
    is_end: bool,
) -> Result<usize, EncodeError>
Expand description

Encode a 100-byte voice frame.

Layout per ircDDBGateway/Common/AMBEData.cpp:391-431 (getDCSData) combined with ircDDBGateway/Common/HeaderData.cpp:515-529 (getDCSData embedding):

  • [0..4]: b"0001" magic
  • [4..7]: header flag bytes (flag1/flag2/flag3)
  • [7..15]: RPT2 callsign (gateway)
  • [15..23]: RPT1 callsign (access)
  • [23..31]: YOUR callsign
  • [31..39]: MY callsign
  • [39..43]: MY suffix (4 bytes)
  • [43..45]: stream id little-endian
  • [45]: frame seq byte
  • [46..55]: 9 AMBE bytes
  • [55..58]: slow data (or 0x55 0x55 0x55 if is_end)
  • [58..61]: 3-byte repeater sequence counter (always zero in this codec — clients that care can layer counters on top)
  • [61]: 0x01
  • [62]: 0x00
  • [63]: 0x21
  • [64..84]: 20-byte text field (zero-filled)
  • [84..100]: 16 bytes of zero padding

§Errors

Returns EncodeError::BufferTooSmall if out.len() < 100.

§See also

ircDDBGateway/Common/AMBEData.cpp:391-431 (getDCSData) and ircDDBGateway/Common/HeaderData.cpp:515-529 (getDCSData embedding) for the reference encoders this function combines into a single 100-byte DCS voice frame.