mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 20:42:49 +00:00
bug 1404220 assign zero to AUDIO_FORMAT_SILENCE enumerator r=padenot
I don't know whether or not another zero initial AudioChunk member value makes initialization more efficient, but zero for silence is more intuitive for humans. MozReview-Commit-ID: JEYv65btMul --HG-- extra : rebase_source : 3089362ce4773da91c7139a3127e1491cbcf1dc5
This commit is contained in:
parent
5ea2376fe3
commit
3a143e4a1f
@ -20,12 +20,12 @@ namespace mozilla {
|
||||
*/
|
||||
enum AudioSampleFormat
|
||||
{
|
||||
// Silence: format will be chosen later
|
||||
AUDIO_FORMAT_SILENCE,
|
||||
// Native-endian signed 16-bit audio samples
|
||||
AUDIO_FORMAT_S16,
|
||||
// Signed 32-bit float samples
|
||||
AUDIO_FORMAT_FLOAT32,
|
||||
// Silence: format will be chosen later
|
||||
AUDIO_FORMAT_SILENCE,
|
||||
// The format used for output by AudioStream.
|
||||
#ifdef MOZ_SAMPLE_TYPE_S16
|
||||
AUDIO_OUTPUT_FORMAT = AUDIO_FORMAT_S16
|
||||
@ -246,11 +246,11 @@ inline const void*
|
||||
AddAudioSampleOffset(const void* aBase, AudioSampleFormat aFormat,
|
||||
int32_t aOffset)
|
||||
{
|
||||
static_assert(AUDIO_FORMAT_S16 == 0, "Bad constant");
|
||||
static_assert(AUDIO_FORMAT_FLOAT32 == 1, "Bad constant");
|
||||
static_assert(AUDIO_FORMAT_S16 == 1, "Bad constant");
|
||||
static_assert(AUDIO_FORMAT_FLOAT32 == 2, "Bad constant");
|
||||
MOZ_ASSERT(aFormat == AUDIO_FORMAT_S16 || aFormat == AUDIO_FORMAT_FLOAT32);
|
||||
|
||||
return static_cast<const uint8_t*>(aBase) + (aFormat + 1)*2*aOffset;
|
||||
return static_cast<const uint8_t*>(aBase) + aFormat*2*aOffset;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
Loading…
x
Reference in New Issue
Block a user