Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
resampler.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __UTILS_RESAMPLER_H__
11#define __UTILS_RESAMPLER_H__
12
13#include "zrythm-config.h"
14
15#include <stdbool.h>
16
17#include "utils/types.h"
18
25typedef enum ResamplerQuality
26{
27 RESAMPLER_QUALITY_QUICK,
28 RESAMPLER_QUALITY_LOW,
29 RESAMPLER_QUALITY_MEDIUM,
30 RESAMPLER_QUALITY_HIGH,
31 RESAMPLER_QUALITY_VERY_HIGH,
32} ResamplerQuality;
33
40typedef struct Resampler
41{
43 void * priv;
44
45 double input_rate;
46 double output_rate;
47 unsigned int num_channels;
48
50 const float * in_frames;
51
54
57
60 float * out_frames;
61
64
67
68 ResamplerQuality quality;
69} Resampler;
70
80 const float * in_frames,
81 const size_t num_in_frames,
82 const double input_rate,
83 const double output_rate,
84 const unsigned int num_channels,
85 const ResamplerQuality quality,
86 GError ** error);
87
92NONNULL_ARGS (1) bool resampler_process (Resampler * self, GError ** error);
93
97NONNULL bool
99
100NONNULL void
101resampler_free (Resampler * self);
102
107#endif
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
NONNULL bool resampler_is_done(Resampler *self)
Indicates whether resampling is finished.
Resampler * resampler_new(const float *in_frames, const size_t num_in_frames, const double input_rate, const double output_rate, const unsigned int num_channels, const ResamplerQuality quality, GError **error)
Creates a new instance of a Resampler with the given settings.
Resampler.
Definition resampler.h:41
size_t num_in_frames
Number of frames per channel.
Definition resampler.h:53
const float * in_frames
Given input (interleaved) frames .
Definition resampler.h:50
void * priv
Private data.
Definition resampler.h:43
size_t num_out_frames
Number of frames per channel.
Definition resampler.h:63
size_t frames_written
Number of frames written so far.
Definition resampler.h:66
size_t frames_read
Number of frames read so far.
Definition resampler.h:56
float * out_frames
Output (interleaved) frames to be allocated during resampler_new().
Definition resampler.h:60
Custom types.