Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/media/webaudio/PanningUtils.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim:set ts=2 sw=2 sts=2 et cindent: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef PANNING_UTILS_H
8
#define PANNING_UTILS_H
9
10
#include "AudioSegment.h"
11
#include "AudioNodeEngine.h"
12
13
namespace mozilla {
14
namespace dom {
15
16
template<typename T>
17
void
18
GainMonoToStereo(const AudioBlock& aInput, AudioBlock* aOutput,
19
                 T aGainL, T aGainR)
20
0
{
21
0
  float* outputL = aOutput->ChannelFloatsForWrite(0);
22
0
  float* outputR = aOutput->ChannelFloatsForWrite(1);
23
0
  const float* input = static_cast<const float*>(aInput.mChannelData[0]);
24
0
25
0
  MOZ_ASSERT(aInput.ChannelCount() == 1);
26
0
  MOZ_ASSERT(aOutput->ChannelCount() == 2);
27
0
28
0
  AudioBlockPanMonoToStereo(input, aGainL, aGainR, outputL, outputR);
29
0
}
Unexecuted instantiation: void mozilla::dom::GainMonoToStereo<float>(mozilla::AudioBlock const&, mozilla::AudioBlock*, float, float)
Unexecuted instantiation: void mozilla::dom::GainMonoToStereo<float*>(mozilla::AudioBlock const&, mozilla::AudioBlock*, float*, float*)
30
31
// T can be float or an array of float, and  U can be bool or an array of bool,
32
// depending if the value of the parameters are constant for this block.
33
template<typename T, typename U>
34
void
35
GainStereoToStereo(const AudioBlock& aInput, AudioBlock* aOutput,
36
                   T aGainL, T aGainR, U aOnLeft)
37
0
{
38
0
  float* outputL = aOutput->ChannelFloatsForWrite(0);
39
0
  float* outputR = aOutput->ChannelFloatsForWrite(1);
40
0
  const float* inputL = static_cast<const float*>(aInput.mChannelData[0]);
41
0
  const float* inputR = static_cast<const float*>(aInput.mChannelData[1]);
42
0
43
0
  MOZ_ASSERT(aInput.ChannelCount() == 2);
44
0
  MOZ_ASSERT(aOutput->ChannelCount() == 2);
45
0
46
0
  AudioBlockPanStereoToStereo(inputL, inputR, aGainL, aGainR, aOnLeft, outputL, outputR);
47
0
}
Unexecuted instantiation: void mozilla::dom::GainStereoToStereo<float, bool>(mozilla::AudioBlock const&, mozilla::AudioBlock*, float, float, bool)
Unexecuted instantiation: void mozilla::dom::GainStereoToStereo<float*, bool*>(mozilla::AudioBlock const&, mozilla::AudioBlock*, float*, float*, bool*)
48
49
// T can be float or an array of float, and  U can be bool or an array of bool,
50
// depending if the value of the parameters are constant for this block.
51
template<typename T, typename U>
52
void ApplyStereoPanning(const AudioBlock& aInput, AudioBlock* aOutput,
53
                        T aGainL, T aGainR, U aOnLeft)
54
0
{
55
0
  if (aInput.ChannelCount() == 1) {
56
0
    GainMonoToStereo(aInput, aOutput, aGainL, aGainR);
57
0
  } else {
58
0
    GainStereoToStereo(aInput, aOutput, aGainL, aGainR, aOnLeft);
59
0
  }
60
0
}
Unexecuted instantiation: void mozilla::dom::ApplyStereoPanning<float, bool>(mozilla::AudioBlock const&, mozilla::AudioBlock*, float, float, bool)
Unexecuted instantiation: void mozilla::dom::ApplyStereoPanning<float*, bool*>(mozilla::AudioBlock const&, mozilla::AudioBlock*, float*, float*, bool*)
61
62
} // namespace dom
63
} // namespace mozilla
64
65
#endif // PANNING_UTILS_H