AVPKit
IAudioResampler.cpp
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 #include "IAudioResampler.h"
21 #include "Global.h"
22 #include "AudioResampler.h"
23 
24 namespace com { namespace avpkit { namespace core
25  {
26 
27  IAudioResampler :: IAudioResampler()
28  {
29  }
30 
31  IAudioResampler :: ~IAudioResampler()
32  {
33  }
34 
35  IAudioResampler*
36  IAudioResampler:: make(int32_t outputChannels, int32_t inputChannels,
37  int32_t outputRate, int32_t inputRate)
38  {
39  Global::init();
40  return AudioResampler::make(outputChannels, inputChannels,
41  outputRate, inputRate);
42  }
43 
45  IAudioResampler :: make(int32_t outputChannels, int32_t inputChannels,
46  int32_t outputRate, int32_t inputRate,
47  IAudioSamples::Format outputFmt, IAudioSamples::Format inputFmt)
48  {
49  Global::init();
50  return AudioResampler::make(outputChannels, inputChannels,
51  outputRate, inputRate,
52  outputFmt, inputFmt);
53  }
54 
55 
57  IAudioResampler :: make(int32_t outputChannels, int32_t inputChannels,
58  int32_t outputRate, int32_t inputRate,
59  IAudioSamples::Format outputFmt, IAudioSamples::Format inputFmt,
60  int32_t filterLen, int32_t log2PhaseCount,
61  bool isLinear, double cutoff)
62  {
63  Global::init();
64  return AudioResampler::make(outputChannels, inputChannels,
65  outputRate, inputRate,
66  outputFmt, inputFmt,
67  filterLen, log2PhaseCount,
68  isLinear, cutoff);
69  }
70 
71  }}}
static void init()
Internal Only.
Definition: Global.cpp:157
Used to resample IAudioSamples to different sample rates or number of channels.
static IAudioResampler * make(int32_t outputChannels, int32_t inputChannels, int32_t outputRate, int32_t inputRate)
Create a new IAudioResampler object.
virtual bool isLinear()=0
Are we linearly interpolating between filters?
Format
The format we use to represent audio.
Definition: IAudioSamples.h:46
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...