|
AVPKit
|
Used to resample IAudioSamples to different sample rates or number of channels. More...
#include <IAudioResampler.h>


Public Member Functions | |
| virtual int | getOutputChannels ()=0 |
| number of channels in output audio. More... | |
| virtual int | getOutputRate ()=0 |
| sample rate of output audio. More... | |
| virtual int | getInputChannels ()=0 |
| number of channels expected in input audio. More... | |
| virtual int | getInputRate ()=0 |
| sample rate expected in input audio. More... | |
| virtual int | resample (IAudioSamples *outputSamples, IAudioSamples *inputSamples, int32_t numSamples)=0 |
| Re-sample up to numSamples from inputSamples to outputSamples. More... | |
| virtual IAudioSamples::Format | getOutputFormat ()=0 |
| Get the sample format we expect to resample to. More... | |
| virtual IAudioSamples::Format | getInputFormat ()=0 |
| Get the sample format we expect to resample from. More... | |
| virtual int32_t | getFilterLen ()=0 |
| Get the length of each filter in the resampler filter bank. More... | |
| virtual int32_t | getLog2PhaseCount ()=0 |
| Get log2(number of entries in filter bank). More... | |
| virtual bool | isLinear ()=0 |
| Are we linearly interpolating between filters? More... | |
| virtual double | getCutoffFrequency ()=0 |
| What is the cuttoff frequency used? More... | |
| virtual int32_t | getMinimumNumSamplesRequiredInOutputSamples (IAudioSamples *inSamples)=0 |
| Get the minimum number of samples that must be placeable in an output set of samples in order for a resample with this resampler to succeed. More... | |
| virtual int32_t | getMinimumNumSamplesRequiredInOutputSamples (int32_t numSamples)=0 |
| Get the minimum number of samples that must be placeable in an output set of samples in order for a resample with this resampler to succeed. More... | |
Public Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual int32_t | acquire () |
| Internal Only. More... | |
| virtual int32_t | release () |
| Internal Only. More... | |
| virtual RefCounted * | copyReference () |
| Create a new Java object that refers to the same native object. More... | |
| virtual int32_t | getCurrentRefCount () |
| Return the current reference count on this object. More... | |
| void | setJavaAllocator (void *allocator) |
| This method is public but not part of the standard API. More... | |
| void * | getJavaAllocator () |
| This method is public but not part of the standard API. More... | |
Static Public Member Functions | |
| static IAudioResampler * | make (int32_t outputChannels, int32_t inputChannels, int32_t outputRate, int32_t inputRate) |
| Create a new IAudioResampler object. More... | |
| static IAudioResampler * | make (int32_t outputChannels, int32_t inputChannels, int32_t outputRate, int32_t inputRate, IAudioSamples::Format outputFmt, IAudioSamples::Format inputFmt) |
| Create a new IAudioResampler object. More... | |
| static IAudioResampler * | make (int32_t outputChannels, int32_t inputChannels, int32_t outputRate, int32_t inputRate, IAudioSamples::Format outputFmt, IAudioSamples::Format inputFmt, int32_t filterLen, int32_t log2PhaseCount, bool isLinear, double cutoffFrequency) |
| Create a new IAudioResampler object. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual void | destroy () |
| This method is called by RefCounted objects when their Ref Count reaches zero and they are about to be destroyed. | |
Protected Attributes inherited from com::avpkit::ferry::RefCounted | |
| AtomicInteger * | mRefCount |
| This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe. | |
| void * | mAllocator |
| Not part of public API. | |
Used to resample IAudioSamples to different sample rates or number of channels.
Definition at line 32 of file IAudioResampler.h.
|
pure virtual |
What is the cuttoff frequency used?
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Get the length of each filter in the resampler filter bank.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
number of channels expected in input audio.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Get the sample format we expect to resample from.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
sample rate expected in input audio.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Get log2(number of entries in filter bank).
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Get the minimum number of samples that must be placeable in an output set of samples in order for a resample with this resampler to succeed.
| inSamples | The input samples that will be passed to resample. |
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Get the minimum number of samples that must be placeable in an output set of samples in order for a resample with this resampler to succeed.
| numSamples | The number of input samples. |
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
number of channels in output audio.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Get the sample format we expect to resample to.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
sample rate of output audio.
Implemented in com::avpkit::core::AudioResampler.
|
pure virtual |
Are we linearly interpolating between filters?
Implemented in com::avpkit::core::AudioResampler.
Referenced by make().
|
static |
Create a new IAudioResampler object.
Creation of IAudioResampler objects is relatively expensive compared to the resample(IAudioSamples, IAudioSamples, long) method, so users are encouraged to create once and use often.
This method assumes all samples are in IAudioSamples.Format.FMT_S16 format.
| outputChannels | The number of channels you will want in resampled audio we output. |
| inputChannels | The number of channels you will pass in the source audio for resampling. |
| outputRate | The sample rate you will want in resampled audio we output. |
| inputRate | The sample rate you will pass in the source audio for resampling. |
Definition at line 36 of file IAudioResampler.cpp.
References com::avpkit::core::Global::init().
|
static |
Create a new IAudioResampler object.
Creation of IAudioResampler objects is relatively expensive compared to the resample(IAudioSamples, IAudioSamples, long) method, so users are encouraged to create once and use often.
"Sensible" defaults are passed in for filter length and other parameters.
| outputChannels | The number of channels you will want in resampled audio we output. |
| inputChannels | The number of channels you will pass in the source audio for resampling. |
| outputRate | The sample rate you will want in resampled audio we output. |
| inputRate | The sample rate you will pass in the source audio for resampling. |
| outputFmt | The format of the output samples. |
| inputFmt | The format of the input samples. |
Definition at line 45 of file IAudioResampler.cpp.
References com::avpkit::core::Global::init().
|
static |
Create a new IAudioResampler object.
Creation of IAudioResampler objects is relatively expensive compared to the resample(IAudioSamples, IAudioSamples, long) method, so users are encouraged to create once and use often.
| outputChannels | The number of channels you will want in resampled audio we output. |
| inputChannels | The number of channels you will pass in the source audio for resampling. |
| outputRate | The sample rate you will want in resampled audio we output. |
| inputRate | The sample rate you will pass in the source audio for resampling. |
| outputFmt | The format of the output samples. |
| inputFmt | The format of the input samples. |
| filterLen | The length of each filter in the filterbank, relative to the cutoff frequency. |
| log2PhaseCount | log2 of the number of entries in the polyphase filterbank |
| isLinear | If true, the used filter will be linearly interpolated between the 2 closest filters. if false, the closest will be used. |
| cutoffFrequency | Cutoff frequency. 1.0 is 1/2 the output sampling rate. |
Definition at line 57 of file IAudioResampler.cpp.
References com::avpkit::core::Global::init(), and isLinear().
|
pure virtual |
Re-sample up to numSamples from inputSamples to outputSamples.
This function re-samples the audio in inputSamples to have the same number of channels, and the same sample rate, as this IAudioResampler was initialized with.
Caller is responsible for making sure that the IAudioSamples object passed in has enough space. This object requires space for an additional 16-samples * output-channels per IAudioSamples passed in.
If the
is not large enough to fit the required resamples, then the IAudioResampler will attempt to allocate a new output buffer and override the buffer set on
. To ensure you have enough space in your output buffer, use the getMinimumNumSamplesRequiredInOutputSamples(int) method.
| outputSamples | [out] The sample buffer we output to. |
| inputSamples | [in] The samples we're going to re-sample. |
| numSamples | [in] The number of samples from inputSamples to use. if 0, this defaults to inputSamples.getNumSamples(). |
Implemented in com::avpkit::core::AudioResampler.