Skip to content

Commit

Permalink
Merge branch '2.3' of git@github.com:mixxxdj/mixxx.git
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed May 19, 2021
2 parents bddbcaa + b76bd7f commit edf4747
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
15 changes: 8 additions & 7 deletions src/audio/types.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <QtDebug>
#include <cstdint>

#include "util/assert.h"
#include "util/optional.h"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand All @@ -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.
Expand All @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/encoder/encoderopus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ constexpr int kMaxOpusBufferSize = 1+1275;
constexpr int kOpusFrameMs = 60;
constexpr int kOpusChannelCount = 2;
// Opus only supports 48 and 96 kHz samplerates
constexpr int kMasterSamplerate = 48000;
constexpr mixxx::audio::SampleRate kMasterSamplerate = mixxx::audio::SampleRate(48000);

const mixxx::Logger kLogger("EncoderOpus");

Expand Down Expand Up @@ -73,7 +73,7 @@ int getSerial() {
} // namespace

//static
int EncoderOpus::getMasterSamplerate() {
mixxx::audio::SampleRate EncoderOpus::getMasterSamplerate() {
return kMasterSamplerate;
}

Expand Down
9 changes: 5 additions & 4 deletions src/encoder/encoderopus.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once

#include <ogg/ogg.h>
#include <opus/opus.h>

#include <QMap>
#include <QString>
#include <QVector>

#include <ogg/ogg.h>
#include <opus/opus.h>

#include "audio/types.h"
#include "encoder/encoder.h"
#include "encoder/encodercallback.h"
#include "util/fifo.h"
Expand All @@ -16,7 +17,7 @@

class EncoderOpus: public Encoder {
public:
static int getMasterSamplerate();
static mixxx::audio::SampleRate getMasterSamplerate();
static QString getInvalidSamplerateMessage();

explicit EncoderOpus(EncoderCallback* pCallback = nullptr);
Expand Down

0 comments on commit edf4747

Please sign in to comment.