Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tangara-fw/src/tangara/audio/resample.hpp

37 lines
680 B

/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
#include <cstdint>
#include <span>
#include <vector>
#include "speex/speex_resampler.h"
#include "sample.hpp"
namespace audio {
class Resampler {
public:
Resampler(uint32_t source_sample_rate,
uint32_t target_sample_rate,
uint8_t num_channels);
~Resampler();
auto Process(std::span<sample::Sample> input,
std::span<sample::Sample> output,
bool end_of_data) -> std::pair<size_t, size_t>;
private:
int err_;
SpeexResamplerState* resampler_;
uint8_t num_channels_;
};
} // namespace audio