summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2021-05-19 12:58:52 +0200
committerUwe Klotz <uklotz@mixxx.org>2021-05-19 13:41:43 +0200
commit3608365c400e97a75537eeae5cd3c070d089c6d0 (patch)
tree2ab371f917b1b2715bddca7f57c61a234d870150 /src/audio
parent7e16ae58691a81cbd1c74e8b63a8a96390c44285 (diff)
Use fixed-size integer types for audio stream properties
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/types.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/audio/types.h b/src/audio/types.h
index 7bfb0cf83e..764163168f 100644
--- a/src/audio/types.h
+++ b/src/audio/types.h
@@ -1,6 +1,7 @@
#pragma once
#include <QtDebug>
+#include <cstdint>
#include "util/assert.h"
#include "util/optional.h"
@@ -34,7 +35,9 @@ QDebug operator<<(QDebug dbg, ChannelLayout arg);
class ChannelCount {
public:
- typedef SINT value_t;
+ // Use a native type with more than 8 bits to avoid -Werror=type-limits
+ // errors on comparisons with the min/max constants.
+ typedef uint16_t value_t;
private:
// The default value is invalid and indicates a missing or unknown value.
@@ -73,8 +76,7 @@ class ChannelCount {
}
constexpr bool isValid() const {
- return (kValueMin <= m_value) &&
- (m_value <= kValueMax);
+ return kValueMin <= m_value && m_value <= kValueMax;
}
/*implicit*/ constexpr operator value_t() const {
@@ -87,7 +89,7 @@ class ChannelCount {
class SampleRate {
public:
- typedef SINT value_t;
+ typedef uint32_t value_t;
private:
// The default value is invalid and indicates a missing or unknown value.
@@ -114,8 +116,7 @@ class SampleRate {
}
constexpr bool isValid() const {
- return (kValueMin <= m_value) &&
- (m_value <= kValueMax);
+ return kValueMin <= m_value && m_value <= kValueMax;
}
void operator=(const value_t& value) {
@@ -145,7 +146,7 @@ QDebug operator<<(QDebug dbg, SampleRate arg);
// expected quality.
class Bitrate {
public:
- typedef SINT value_t;
+ typedef uint32_t value_t;
private:
// The default value is invalid and indicates a missing or unknown value.