You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// and when output size is fixed, the input size varies.
56
56
///
57
57
/// The number of frames on the fixed side is determined by the chunk size argument to the constructor.
58
-
/// This value can be changed by the `set_chunk_size()` method,
59
-
/// to let the resampler process smaller chunks of audio data.
58
+
/// This value can be changed by the [set_chunk_size](Resizable::set_chunk_size) method of the
59
+
/// [Resizable] trait (which must be in scope), to let the resampler process smaller chunks of audio data.
60
60
/// Note that the chunk size cannot exceed the value given at creation time.
61
61
///
62
62
/// When the input size is fixed, the maximum value can be retrieved using the `input_size_max()` method,
@@ -155,7 +155,7 @@ where
155
155
///
156
156
/// Parameters are:
157
157
/// - `resample_ratio`: Starting ratio between output and input sample rates, must be > 0.
158
-
/// - `max_resample_ratio_relative`: Maximum ratio that can be set with [Resampler::set_resample_ratio] relative to `resample_ratio`, must be >= 1.0. The minimum relative ratio is the reciprocal of the maximum. For example, with `max_resample_ratio_relative` of 10.0, the ratio can be set between `resample_ratio * 10.0` and `resample_ratio / 10.0`.
158
+
/// - `max_resample_ratio_relative`: Maximum ratio that can be set with [Adjustable::set_resample_ratio](crate::Adjustable::set_resample_ratio) relative to `resample_ratio`, must be >= 1.0. The minimum relative ratio is the reciprocal of the maximum. For example, with `max_resample_ratio_relative` of 10.0, the ratio can be set between `resample_ratio * 10.0` and `resample_ratio / 10.0`.
159
159
/// - `interpolation_type`: Degree of polynomial used for interpolation, see [PolynomialDegree].
160
160
/// - `chunk_size`: Size of input data in frames.
161
161
/// - `nbr_channels`: Number of channels in input/output.
@@ -237,7 +237,7 @@ where
237
237
///
238
238
/// Parameters are:
239
239
/// - `resample_ratio`: Starting ratio between output and input sample rates, must be > 0.
240
-
/// - `max_resample_ratio_relative`: Maximum ratio that can be set with [Resampler::set_resample_ratio] relative to `resample_ratio`, must be >= 1.0. The minimum relative ratio is the reciprocal of the maximum. For example, with `max_resample_ratio_relative` of 10.0, the ratio can be set between `resample_ratio * 10.0` and `resample_ratio / 10.0`.
240
+
/// - `max_resample_ratio_relative`: Maximum ratio that can be set with [Adjustable::set_resample_ratio](crate::Adjustable::set_resample_ratio) relative to `resample_ratio`, must be >= 1.0. The minimum relative ratio is the reciprocal of the maximum. For example, with `max_resample_ratio_relative` of 10.0, the ratio can be set between `resample_ratio * 10.0` and `resample_ratio / 10.0`.
241
241
/// - `parameters`: Parameters for interpolation, see [SincInterpolationParameters].
242
242
/// - `chunk_size`: Size of input data in frames.
243
243
/// - `nbr_channels`: Number of channels in input/output.
@@ -277,7 +277,7 @@ where
277
277
///
278
278
/// Parameters are:
279
279
/// - `resample_ratio`: Starting ratio between output and input sample rates, must be > 0.
280
-
/// - `max_resample_ratio_relative`: Maximum ratio that can be set with [Resampler::set_resample_ratio] relative to `resample_ratio`, must be >= 1.0. The minimum relative ratio is the reciprocal of the maximum. For example, with `max_resample_ratio_relative` of 10.0, the ratio can be set between `resample_ratio` * 10.0 and `resample_ratio` / 10.0.
280
+
/// - `max_resample_ratio_relative`: Maximum ratio that can be set with [Adjustable::set_resample_ratio](crate::Adjustable::set_resample_ratio) relative to `resample_ratio`, must be >= 1.0. The minimum relative ratio is the reciprocal of the maximum. For example, with `max_resample_ratio_relative` of 10.0, the ratio can be set between `resample_ratio` * 10.0 and `resample_ratio` / 10.0.
281
281
/// - `interpolation_type`: Parameters for interpolation, see `SincInterpolationParameters`.
282
282
/// - `interpolator`: The interpolator to use.
283
283
/// - `chunk_size`: Size of output data in frames.
@@ -441,6 +441,23 @@ where
441
441
self.needed_output_size
442
442
);
443
443
}
444
+
445
+
/// Check whether a ratio, expressed relative to the original ratio, is within the
446
+
/// allowed `1 / max` to `max` range. Checking the relative ratio directly avoids the
447
+
/// rounding error that a `(original * rel) / original` round-trip would introduce at
Copy file name to clipboardExpand all lines: src/error.rs
+1-11Lines changed: 1 addition & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -119,17 +119,14 @@ impl error::Error for ResamplerConstructionError {}
119
119
#[derive(Clone,Copy,PartialEq)]
120
120
#[non_exhaustive]
121
121
pubenumResampleError{
122
-
/// Error raised when [Resampler::set_resample_ratio](crate::Resampler::set_resample_ratio)
122
+
/// Error raised when [Adjustable::set_resample_ratio](crate::Adjustable::set_resample_ratio)
123
123
/// is called with a ratio outside the maximum range specified when
124
124
/// the resampler was constructed.
125
125
RatioOutOfBounds{
126
126
provided:f64,
127
127
original:f64,
128
128
max_relative_ratio:f64,
129
129
},
130
-
/// Error raised when calling [Resampler::set_resample_ratio](crate::Resampler::set_resample_ratio)
131
-
/// on a synchronous resampler.
132
-
SyncNotAdjustable,
133
130
/// Error raised when the number of channels in the input buffer doesn't match the value expected.
134
131
WrongNumberOfInputChannels{
135
132
expected:usize,
@@ -161,7 +158,6 @@ pub enum ResampleError {
161
158
max:usize,
162
159
requested:usize,
163
160
},
164
-
ChunkSizeNotAdjustable,
165
161
}
166
162
167
163
impl fmt::DisplayforResampleError{
@@ -175,9 +171,6 @@ impl fmt::Display for ResampleError {
175
171
write!(f,"New resample ratio out of bounds. Provided ratio {}, original resample ratio {}, maximum relative ratio {}, allowed absolute range {} to {}",
176
172
provided, original, max_relative_ratio, original / max_relative_ratio, original * max_relative_ratio)
177
173
}
178
-
Self::SyncNotAdjustable{ .. } => {
179
-
write!(f,"Not possible to adjust a synchronous resampler")
180
-
}
181
174
Self::WrongNumberOfInputChannels{ expected, actual } => {
182
175
write!(
183
176
f,
@@ -220,9 +213,6 @@ impl fmt::Display for ResampleError {
220
213
requested, max
221
214
)
222
215
}
223
-
Self::ChunkSizeNotAdjustable{ .. } => {
224
-
write!(f,"This resampler does not support changing the chunk size")
0 commit comments