From d21ec9d597df1d04d80a0082bc5fb4974ca3e48a Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 13 Dec 2021 06:29:08 -0700 Subject: [PATCH] improved some comments --- Controller.cpp | 30 +++++++++++++++++------------- DV3003.h | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Controller.cpp b/Controller.cpp index dc38418..f5d2a48 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -140,17 +140,20 @@ void CController::IncrementDStarVocoder() current_dstar_vocoder = (current_dstar_vocoder + 1) % dstar_vocoder_count; } -// Incoming packets from clients with different starting codecs, DStar, DMR, and M17. The transcoder fills -// in the missing data. -// AMBE codecs go to the DVSI hardware for decoding to audio. No need to transcode between M17 codecs. +// DMR and YSF use the exact same codec, both AMBE. +// Incoming packets from clients have different starting codecs, AMBE or M17. +// The transcoder's task is to fill in the missing data. +// Incoming AMBE codecs go to the DVSI hardware for decoding to audio. The ambeThread will finish up. // Incoming M17 codecs are decoded in software and the audio data send to the two different AMBE encoders. +// There is no need to transcode between M17 codecs. void CController::ReadReflector() { while (keep_running) { STCPacket tcpack; - //wait up to 40 ms to read something on the unix port + // wait up to 40 ms to read something on the unix port if (reader.Receive(&tcpack, 40)) { - //create a std::shared_ptr to a new packet + // create a shared pointer to a new packet + // there is only one CTranscoderPacket created for each new STCPacket received from the reflector auto packet = std::make_shared(tcpack); #ifdef DEBUG Dump(packet, "Incoming TC Packet:"); @@ -205,20 +208,20 @@ void CController::ReadReflector() // encode the audio to dstar devnum = current_dstar_vocoder / 3; vocnum = current_dstar_vocoder % 3; - //send the audio to the current dstar vocoder + // send the audio to the current dstar vocoder dstar_device[devnum]->SendAudio(vocnum, packet->GetAudio()); //push the packet onto the vocoder's queue dstar_device[devnum]->packet_queue[vocnum].push(packet); - //increment the dstar vocoder index + // increment the dstar vocoder index IncrementDStarVocoder(); // encode the audio to dmr devnum = current_dmr_vocoder / 3; vocnum = current_dmr_vocoder % 3; - //send the audio to the corrent dmr vocoder + // send the audio to the corrent dmr vocoder dmr_device[devnum]->SendAudio(vocnum, packet->GetAudio()); - //push the packet onto the dmr vocoder's queue + // push the packet onto the dmr vocoder's queue dmr_device[devnum]->packet_queue[vocnum].push(packet); - //increment the dmr vocoder index + // increment the dmr vocoder index IncrementDMRVocoder(); break; case ECodecType::none: @@ -287,11 +290,11 @@ void CController::ReadAmbeDevices() } } -// Any audio packet recevied from the DVSI vocoders means that the codec_in was AMBE (DStar or DMR). +// Any audio packet recevied from the DVSI vocoders means that the original codec was AMBE (DStar or DMR). // These audio packets need to be encoded, by the complimentary AMBE vocoder _and_ M17. // Since code_in was AMBE, the audio will be encoded to c2_3200, and copied to the packet. -// If we have read AMBE data, it needs to be put back into the packet. -// If the packet is complete, it can be sent back to the reflector. +// If we have read AMBE data from the vocoder, it needs to be put back into the packet. +// Finally if the packet is complete, it can be sent back to the reflector. void CController::ReadDevice(std::shared_ptr device, EAmbeType type) { //save the dmr/dstar type @@ -376,6 +379,7 @@ void CController::ReadDevice(std::shared_ptr device, EAmbeType type) } else /* the response is ambe data */ { + // put the AMBE data in the packet if (type == EAmbeType::dmr) { spPacket->SetDMRData(devpacket.payload.ambe.data); diff --git a/DV3003.h b/DV3003.h index e5ee996..3083b4b 100644 --- a/DV3003.h +++ b/DV3003.h @@ -110,7 +110,7 @@ public: std::string GetProductID() const; std::string GetVersion() const; - CPacketQueue packet_queue[3]; + CPacketQueue packet_queue[3]; // we need a queue for each vocoder private: const Encoding type; int fd;