AudioFormat, pcm/Dsd*: remove redundant inline
keywords from constexpr
functions
This commit is contained in:
parent
24cde31328
commit
f2cacaf6b6
@ -178,8 +178,8 @@ struct AudioFormat {
|
|||||||
*
|
*
|
||||||
* @param sample_rate the sample rate in Hz
|
* @param sample_rate the sample rate in Hz
|
||||||
*/
|
*/
|
||||||
static constexpr inline bool
|
constexpr bool
|
||||||
audio_valid_sample_rate(unsigned sample_rate)
|
audio_valid_sample_rate(unsigned sample_rate) noexcept
|
||||||
{
|
{
|
||||||
return sample_rate > 0 && sample_rate < (1 << 30);
|
return sample_rate > 0 && sample_rate < (1 << 30);
|
||||||
}
|
}
|
||||||
@ -187,8 +187,8 @@ audio_valid_sample_rate(unsigned sample_rate)
|
|||||||
/**
|
/**
|
||||||
* Checks whether the number of channels is valid.
|
* Checks whether the number of channels is valid.
|
||||||
*/
|
*/
|
||||||
static constexpr inline bool
|
constexpr bool
|
||||||
audio_valid_channel_count(unsigned channels)
|
audio_valid_channel_count(unsigned channels) noexcept
|
||||||
{
|
{
|
||||||
return channels >= 1 && channels <= MAX_CHANNELS;
|
return channels >= 1 && channels <= MAX_CHANNELS;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* Construct a 16 bit integer from two bytes.
|
* Construct a 16 bit integer from two bytes.
|
||||||
*/
|
*/
|
||||||
static constexpr inline uint16_t
|
static constexpr uint16_t
|
||||||
Construct16(uint8_t a, uint8_t b) noexcept
|
Construct16(uint8_t a, uint8_t b) noexcept
|
||||||
{
|
{
|
||||||
/* "a" is the oldest byte, which must be in the most
|
/* "a" is the oldest byte, which must be in the most
|
||||||
@ -33,7 +33,7 @@ Construct16(uint8_t a, uint8_t b) noexcept
|
|||||||
return uint16_t(b) | (uint16_t(a) << 8);
|
return uint16_t(b) | (uint16_t(a) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr inline uint16_t
|
static constexpr uint16_t
|
||||||
Dsd8To16Sample(const uint8_t *src, unsigned channels) noexcept
|
Dsd8To16Sample(const uint8_t *src, unsigned channels) noexcept
|
||||||
{
|
{
|
||||||
return Construct16(src[0], src[channels]);
|
return Construct16(src[0], src[channels]);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* Construct a 32 bit integer from four bytes.
|
* Construct a 32 bit integer from four bytes.
|
||||||
*/
|
*/
|
||||||
static constexpr inline uint32_t
|
static constexpr uint32_t
|
||||||
Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) noexcept
|
Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) noexcept
|
||||||
{
|
{
|
||||||
/* "a" is the oldest byte, which must be in the most
|
/* "a" is the oldest byte, which must be in the most
|
||||||
@ -34,7 +34,7 @@ Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) noexcept
|
|||||||
(uint32_t(b) << 16) | (uint32_t(a) << 24);
|
(uint32_t(b) << 16) | (uint32_t(a) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr inline uint32_t
|
static constexpr uint32_t
|
||||||
Dsd8To32Sample(const uint8_t *src, unsigned channels) noexcept
|
Dsd8To32Sample(const uint8_t *src, unsigned channels) noexcept
|
||||||
{
|
{
|
||||||
return Construct32(src[0], src[channels],
|
return Construct32(src[0], src[channels],
|
||||||
|
@ -45,13 +45,13 @@ static constexpr int PCM_VOLUME_1S = PCM_VOLUME_1;
|
|||||||
* Converts a float value (0.0 = silence, 1.0 = 100% volume) to an
|
* Converts a float value (0.0 = silence, 1.0 = 100% volume) to an
|
||||||
* integer volume value (1000 = 100%).
|
* integer volume value (1000 = 100%).
|
||||||
*/
|
*/
|
||||||
static constexpr inline int
|
constexpr int
|
||||||
pcm_float_to_volume(float volume) noexcept
|
pcm_float_to_volume(float volume) noexcept
|
||||||
{
|
{
|
||||||
return volume * PCM_VOLUME_1 + 0.5;
|
return volume * PCM_VOLUME_1 + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr inline float
|
constexpr float
|
||||||
pcm_volume_to_float(int volume) noexcept
|
pcm_volume_to_float(int volume) noexcept
|
||||||
{
|
{
|
||||||
return (float)volume / (float)PCM_VOLUME_1;
|
return (float)volume / (float)PCM_VOLUME_1;
|
||||||
|
Loading…
Reference in New Issue
Block a user