20 std::vector<size_t> channelIndices (numChannels);
22 for (size_t i = 0; i < channelIndices.size(); ++i)
23 channelIndices[i] = i;
25 return channelIndices;
30 std::vector<std::pair<size_t, size_t>> channelPairIndices;
31 channelPairIndices.reserve (numChannels * (numChannels - 1) / 2);
33 for (size_t channelA = 0; channelA < numChannels; ++channelA)
34 for (size_t channelB = channelA + 1; channelB < numChannels; ++channelB)
35 channelPairIndices.emplace_back (channelA, channelB);
37 return channelPairIndices;
42 std::vector<std::pair<size_t, size_t>> channelPairIndices;
43 channelPairIndices.reserve (numChannels);
45 for (size_t channel = 0; channel < numChannels; ++channel)
46 channelPairIndices.emplace_back (channel, channel);
48 return channelPairIndices;
55template <
typename Reducer,
typename Iterator>
59 std::declval<Reducer>()(
60 std::declval<Iterator>(),
61 std::declval<Iterator>()
70template <
typename Reducer,
typename Iterator>
71using ReducerResultType =
72 typename ReducerResult<Reducer, Iterator>::type;
78template <
typename SampleType>
79std::vector<size_t> getChannelIndicesToProcess (
const AudioBuffer<SampleType>& buffer, std::initializer_list<size_t> channels)
81 if (channels.size() != 0)
82 return std::vector<size_t> (channels.begin(), channels.end());
84 std::vector<size_t> indices (buffer.getNumChannels());
86 for (size_t i = 0; i < indices.size(); ++i)
97template <
typename SampleType>
98std::vector<size_t> getChannelIndicesToProcess (
const AudioBuffer<SampleType>& bufferA,
const AudioBuffer<SampleType>& bufferB, std::initializer_list<size_t> channels)
100 if (bufferA.getNumChannels() > bufferB.getNumChannels())
101 return getChannelIndicesToProcess (bufferB, channels);
103 return getChannelIndicesToProcess (bufferA, channels);
Container for audio data.
CorrelationSearchMode
Describes how to look for best cross-correlation.
@ bestAbsoluteCorrelation
Helpers to generate common default channel subsets.
static std::vector< std::pair< size_t, size_t > > upperTriangleChannelPairs(size_t numChannels)
static std::vector< std::pair< size_t, size_t > > diagonalChannelPairs(size_t numChannels)
static std::vector< size_t > allChannels(size_t numChannels)