Files
XCEngine/MVS/Music fluctuations/source/audio3d/Resampler.h

26 lines
674 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include<vector>
struct SRC_STATE_tag;
//音频重采样,这对于音频处理和音频应用程序非常有用,因为它可以使音频数据适应不同的采样率或音频设备
class Resampler
{
public:
//input_len 表示输入音频的长度resampling_factor 表示重采样的因子,用于确定输出音频的采样率
Resampler(int input_len, double resampling_factor);
~Resampler();
//接受一个输入音频数据的 std::vectorinput并将重采样后的结果存储在传递的输出
void Resample(const std::vector<float>& intput, std::vector<float>* output);
//获取重采样后的音频数据的长度
int GetOutputLength();
private:
int input_len_;
int output_len_;
double resample_factor_;
SRC_STATE_tag* libsamplerate_handle_;
};