diff --git a/_audio_types_8h_source.html b/_audio_types_8h_source.html index cb33199e8..7206c54e8 100644 --- a/_audio_types_8h_source.html +++ b/_audio_types_8h_source.html @@ -345,9 +345,9 @@
347 #endif
348  }
349 
-
351  template <typename From, typename T>
-
352  static T clipT(From value){
-
353  From mv = maxValue(sizeof(T)*8);
+
351  template <typename T>
+
352  static T clipT(float value){
+
353  float mv = maxValueT<T>();
354  if (value > mv){
355  return mv;
356  } else if (value < -mv){
@@ -387,7 +387,7 @@
396  template <typename FromT, typename ToT>
397  static ToT convert(FromT value){
398  int64_t value1 = value;
-
399  return clipT<FromT,ToT>(value1 * maxValueT<ToT>() / maxValueT<FromT>());
+
399  return clipT<ToT>(value1 * maxValueT<ToT>() / maxValueT<FromT>());
400  }
401 
403  template <typename FromT, typename ToT>
@@ -395,7 +395,7 @@
405  float factor = static_cast<float>(maxValueT<ToT>()) / maxValueT<FromT>();
406  float vol_factor = factor * vol;
407  for (int j=0;j<samples;j++){
-
408  to[j] = clipT<FromT, ToT>(vol_factor * from[j]);
+
408  to[j] = clipT<ToT>(vol_factor * from[j]);
409  }
410  }
411 
@@ -523,9 +523,9 @@
audio_tools::NumberConverter
Converts from a source to a target number with a different type.
Definition: AudioTypes.h:298
audio_tools::NumberConverter::toFloatT
static float toFloatT(T value)
Convert an integer integer autio type to a float (with max 1.0)
Definition: AudioTypes.h:375
audio_tools::NumberConverter::fromFloatT
static T fromFloatT(float value)
Convert a float (with max 1.0) to an integer autio type.
Definition: AudioTypes.h:381
-
audio_tools::NumberConverter::clipT
static T clipT(From value)
Clips the value to avoid any over or underflows.
Definition: AudioTypes.h:352
audio_tools::NumberConverter::convertArray
static void convertArray(FromT *from, ToT *to, int samples, float vol=1.0f)
Convert an array of int types.
Definition: AudioTypes.h:404
audio_tools::NumberConverter::toFloat
static float toFloat(int32_t value, int bits)
Convert an integer integer autio type to a float (with max 1.0)
Definition: AudioTypes.h:386
+
audio_tools::NumberConverter::clipT
static T clipT(float value)
Clips the value to avoid any over or underflows.
Definition: AudioTypes.h:352
audio_tools::NumberConverter::fromFloat
static int32_t fromFloat(float value, int bits)
Convert a float (with max 1.0) to an integer autio type.
Definition: AudioTypes.h:391
audio_tools::NumberConverter::maxValue
static int64_t maxValue(int value_bits_per_sample)
provides the biggest number for the indicated number of bits
Definition: AudioTypes.h:325
audio_tools::NumberConverter::convert
static ToT convert(FromT value)
Convert an int number from one type to another.
Definition: AudioTypes.h:397
diff --git a/_codec_l8_8h_source.html b/_codec_l8_8h_source.html index f1b8ee7bf..fbbf4aaf5 100644 --- a/_codec_l8_8h_source.html +++ b/_codec_l8_8h_source.html @@ -133,7 +133,7 @@
93  if (!is_signed) {
94  tmp -= 129;
95  }
-
96  return NumberConverter::clipT<int32_t, int16_t>(tmp * 258);
+
96  return NumberConverter::clipT<int16_t>(tmp * 258);
97  }
98 
99  virtual operator bool() override { return p_print!=nullptr; }
@@ -188,7 +188,7 @@
168  operator bool() override { return is_open; }
169 
170  int16_t convertSample(int16_t sample) {
-
171  int16_t tmp = NumberConverter::clipT<int16_t, int8_t>(sample / 258);
+
171  int16_t tmp = NumberConverter::clipT<int8_t>(sample / 258);
172  if (!is_signed) {
173  tmp += 129;
174  // clip to range
diff --git a/_synthesizer_8h_source.html b/_synthesizer_8h_source.html index 526fc6a88..b03b30c3e 100644 --- a/_synthesizer_8h_source.html +++ b/_synthesizer_8h_source.html @@ -259,7 +259,7 @@
224  // prevent divide by zero
225  int result = 0;
226  if (count>0){
-
227  result = NumberConverter::clipT<int, int16_t>(total / count);
+
227  result = NumberConverter::clipT<int16_t>(total / count);
228  }
229  return result;
230  }
diff --git a/classaudio__tools_1_1_number_converter-members.html b/classaudio__tools_1_1_number_converter-members.html index 7e4a9d461..0cde452da 100644 --- a/classaudio__tools_1_1_number_converter-members.html +++ b/classaudio__tools_1_1_number_converter-members.html @@ -73,7 +73,7 @@

This is the complete list of members for NumberConverter, including all inherited members.

- + diff --git a/classaudio__tools_1_1_number_converter.html b/classaudio__tools_1_1_number_converter.html index d7476ade9..721948bc4 100644 --- a/classaudio__tools_1_1_number_converter.html +++ b/classaudio__tools_1_1_number_converter.html @@ -84,11 +84,11 @@ static int32_t  - - - - + + + + diff --git a/functions_c.html b/functions_c.html index 05765e219..9b1c97516 100644 --- a/functions_c.html +++ b/functions_c.html @@ -154,7 +154,7 @@

- c -

clip(float value, int bits)NumberConverterinlinestatic
clipT(From value)NumberConverterinlinestatic
clipT(float value)NumberConverterinlinestatic
convert(FromT value)NumberConverterinlinestatic
convertArray(FromT *from, ToT *to, int samples, float vol=1.0f)NumberConverterinlinestatic
fromFloat(float value, int bits)NumberConverterinlinestatic
clip (float value, int bits)
 clips a value
 
-template<typename From , typename T >
static T clipT (From value)
 Clips the value to avoid any over or underflows.
 
+template<typename T >
static T clipT (float value)
 Clips the value to avoid any over or underflows.
 
template<typename FromT , typename ToT >
static ToT convert (FromT value)