pcm/Normalizer: use std::size_t

This commit is contained in:
Max Kellermann 2023-03-13 12:20:54 +01:00
parent e6fedcbd10
commit 1298a82f4f
2 changed files with 8 additions and 7 deletions

View File

@ -5,17 +5,17 @@
#include "Normalizer.hxx"
void
PcmNormalizer::ProcessS16(int16_t *audio, unsigned int count) noexcept
PcmNormalizer::ProcessS16(int16_t *audio, std::size_t count) noexcept
{
int16_t *ap;
unsigned int i;
std::size_t i;
int curGain = gain[pos];
int newGain;
int peakVal = 1;
int peakPos = 0;
int slot = (pos + 1) % bufsz;
int *clipped_ = clipped + slot;
unsigned int ramp = count;
std::size_t ramp = count;
int delta;
ap = audio;

View File

@ -4,6 +4,7 @@
#pragma once
#include <cstddef>
#include <cstdint>
class PcmNormalizer {
@ -25,11 +26,11 @@ class PcmNormalizer {
//! History of clip amounts
int *const clipped;
unsigned int pos = 0;
const unsigned int bufsz;
std::size_t pos = 0;
const std::size_t bufsz;
public:
PcmNormalizer(unsigned history=400) noexcept
PcmNormalizer(std::size_t history=400) noexcept
:peaks(new int[history]{}),
gain(new int[history]{}),
clipped(new int[history]{}),
@ -44,7 +45,7 @@ public:
}
//! Process 16-bit signed data
void ProcessS16(int16_t *data, unsigned int count) noexcept;
void ProcessS16(int16_t *data, std::size_t count) noexcept;
};
//! TODO: Compressor_Process_int32, Compressor_Process_float, others as needed