Package org.freedesktop.gstreamer.audio
Class AudioResampler
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.freedesktop.gstreamer.audio.AudioResampler
- All Implemented Interfaces:
Proxy
GstAudioResampler
is a structure which holds the information
required to perform various kinds of resampling filtering.-
Constructor Summary
ConstructorDescriptionAudioResampler
(MemorySegment address) Create a AudioResampler proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
Free a previously allocatedGstAudioResampler
this AudioResampler.long
getInFrames
(long outFrames) Get the number of input frames that would currently be needed to produceoutFrames
from this AudioResampler.long
Get the maximum number of input samples that the resampler would need before producing output.long
getOutFrames
(long inFrames) Get the number of output frames that would be currently available wheninFrames
are given to this AudioResampler.static AudioResampler
new_
(AudioResamplerMethod method, Set<AudioResamplerFlags> flags, AudioFormat format, int channels, int inRate, int outRate, Structure options) Make a new resampler.static AudioResampler
new_
(AudioResamplerMethod method, AudioResamplerFlags flags, AudioFormat format, int channels, int inRate, int outRate, Structure options) Make a new resampler.static void
optionsSetQuality
(AudioResamplerMethod method, int quality, int inRate, int outRate, Structure options) Set the parameters for resampling frominRate
tooutRate
usingmethod
forquality
inoptions
.void
resample
(@Nullable MemorySegment in, long inFrames, @Nullable MemorySegment out, long outFrames) Perform resampling oninFrames
frames inin
and writeoutFrames
toout
.void
reset()
Reset this AudioResampler to the state it was when it was first created, discarding all sample history.boolean
Update the resampler parameters for this AudioResampler.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AudioResampler
Create a AudioResampler proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
new_
public static AudioResampler new_(AudioResamplerMethod method, Set<AudioResamplerFlags> flags, AudioFormat format, int channels, int inRate, int outRate, Structure options) Make a new resampler.- Parameters:
method
- aGstAudioResamplerMethod
flags
-GstAudioResamplerFlags
format
- theGstAudioFormat
channels
- the number of channelsinRate
- input rateoutRate
- output rateoptions
- extra options- Returns:
- The new
GstAudioResampler
.
-
new_
public static AudioResampler new_(AudioResamplerMethod method, AudioResamplerFlags flags, AudioFormat format, int channels, int inRate, int outRate, Structure options) Make a new resampler.- Parameters:
method
- aGstAudioResamplerMethod
flags
-GstAudioResamplerFlags
format
- theGstAudioFormat
channels
- the number of channelsinRate
- input rateoutRate
- output rateoptions
- extra options- Returns:
- The new
GstAudioResampler
.
-
optionsSetQuality
public static void optionsSetQuality(AudioResamplerMethod method, int quality, int inRate, int outRate, Structure options) Set the parameters for resampling frominRate
tooutRate
usingmethod
forquality
inoptions
.- Parameters:
method
- aGstAudioResamplerMethod
quality
- the qualityinRate
- the input rateoutRate
- the output rateoptions
- aGstStructure
-
free
public void free()Free a previously allocatedGstAudioResampler
this AudioResampler. -
getInFrames
public long getInFrames(long outFrames) Get the number of input frames that would currently be needed to produceoutFrames
from this AudioResampler.- Parameters:
outFrames
- number of input frames- Returns:
- The number of input frames needed for producing
outFrames
of data from this AudioResampler.
-
getMaxLatency
public long getMaxLatency()Get the maximum number of input samples that the resampler would need before producing output.- Returns:
- the latency of this AudioResampler as expressed in the number of frames.
-
getOutFrames
public long getOutFrames(long inFrames) Get the number of output frames that would be currently available wheninFrames
are given to this AudioResampler.- Parameters:
inFrames
- number of input frames- Returns:
- The number of frames that would be available after giving
inFrames
as input to this AudioResampler.
-
resample
public void resample(@Nullable @Nullable MemorySegment in, long inFrames, @Nullable @Nullable MemorySegment out, long outFrames) Perform resampling oninFrames
frames inin
and writeoutFrames
toout
.In case the samples are interleaved,
in
andout
must point to an array with a single element pointing to a block of interleaved samples.If non-interleaved samples are used,
in
andout
must point to an array with pointers to memory blocks, one for each channel.in
may benull
, in which caseinFrames
of silence samples are pushed into the resampler.This function always produces
outFrames
of output and consumesinFrames
of input. Use gst_audio_resampler_get_out_frames() and gst_audio_resampler_get_in_frames() to make sureinFrames
andoutFrames
are matching andin
andout
point to enough memory.- Parameters:
in
- input samplesinFrames
- number of input framesout
- output samplesoutFrames
- number of output frames
-
reset
public void reset()Reset this AudioResampler to the state it was when it was first created, discarding all sample history. -
update
Update the resampler parameters for this AudioResampler. This function should not be called concurrently with any other function on this AudioResampler.When
inRate
oroutRate
is 0, its value is unchanged.When
options
isnull
, the previously configured options are reused.- Parameters:
inRate
- new input rateoutRate
- new output rateoptions
- new options ornull
- Returns:
true
if the new parameters could be set
-