From ff198d68fe6dd6b5c91bf0101a94355fcf02a673 Mon Sep 17 00:00:00 2001
From: Marek Blok <Marek.Blok@pg.edu.pl>
Date: Tue, 4 Apr 2023 12:42:06 +0200
Subject: [PATCH] Fix: phase rotation in DSP::u::SymbolMapper

---
 CHANGELOG                   |  4 +++-
 src/cpp/DSP_modules2.cpp    | 10 +++++++++-
 src/include/DSP_lib.h       |  2 +-
 src/include/DSP_logstream.h |  2 ++
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 187ac12..341def6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,12 +2,14 @@ TODO::
   SOUND_support_t::get_wave_in_raw_buffer - zastąpić metodą zawierającą konwersję typu, ew. rozbudować konwersję w DSP::u::AudioInput
   - test socket support on Linux (test examples as there are have been noticed some problems with bind)
   ? DSP::Clock_ptr => migrate to std::shared_ptr
-  !!! Add TELEsound and PiAPS_sound projects to GitLab and start addaptation to new library version
+  !!! Add PiAPS_sound projects to GitLab and start addaptation to new library version
 
   unsigned long SamplingRate // -1 => 0
 LAST DONE:
 
 CHANGES:
+- ver. 0.20.020 - <b>2022.04.04</b> Fixed: 
+  - DSP::u::SymbolMapper - fixed support for phase rotation of DSP::e::ModulationType::ASK constelation 
 - ver. 0.20.019 - <b>2022.03.30</b> Fixed: 
   - DSP::u::Vacuum fix for AreInputsComplex = true: not all input lines were grouped in input "in"
 - ver. 0.20.018 - <b>2022.03.29</b> Changed: 
diff --git a/src/cpp/DSP_modules2.cpp b/src/cpp/DSP_modules2.cpp
index 2c4bd33..2b5d424 100644
--- a/src/cpp/DSP_modules2.cpp
+++ b/src/cpp/DSP_modules2.cpp
@@ -1822,7 +1822,15 @@ unsigned int getConstellation(
           constellation[n].re = static_cast<DSP::Float>(n)/static_cast<DSP::Float>(M-1);
           constellation[n].im = 0;
         }
-        is_real = true;
+        if (constellation_phase_offset != 0.0) {
+          for (unsigned int ind=0; ind < M; ind++) {
+            constellation[ind] = constellation[ind] * DSP::Complex(cos(constellation_phase_offset), sin(constellation_phase_offset));
+          }
+          is_real = false;
+        }
+        else {
+          is_real = true;
+        }
       }
       break;
 
diff --git a/src/include/DSP_lib.h b/src/include/DSP_lib.h
index b7fd6b7..9ff7484 100644
--- a/src/include/DSP_lib.h
+++ b/src/include/DSP_lib.h
@@ -11,7 +11,7 @@
 
 #define DSP_VER_MAJOR 0
 #define DSP_VER_MINOR 20
-#define DSP_VER_BUILD 19 // !!! without zeroes before, else this will be treated as octal number
+#define DSP_VER_BUILD 20 // !!! without zeroes before, else this will be treated as octal number
 #define DSP_VER_YEAR  2023
 #define DSP_VER       DSP_VER_MAJOR.DSP_VER_MINOR.DSP_VER_BUILD
 
diff --git a/src/include/DSP_logstream.h b/src/include/DSP_logstream.h
index dabc018..16f8de8 100644
--- a/src/include/DSP_logstream.h
+++ b/src/include/DSP_logstream.h
@@ -7,7 +7,9 @@
 #ifndef DSP_TEESTREAM_H
 #define DSP_TEESTREAM_H
 
+  //#include <iostream>
   #include <ostream>
+  #include <fstream>
   #include <memory>
   #include <mutex>
 
-- 
GitLab