LibAudio/Wav: Always use u32 for the sample rate

This commit is contained in:
Lucas CHOLLET 2024-02-14 20:53:33 -05:00 committed by Tim Flynn
parent 901baf31ff
commit 1f62984301
Notes: sideshowbarker 2024-07-16 18:03:21 +09:00
2 changed files with 4 additions and 4 deletions

View File

@ -12,14 +12,14 @@
namespace Audio {
ErrorOr<NonnullOwnPtr<WavWriter>> WavWriter::create_from_file(StringView path, int sample_rate, u16 num_channels, PcmSampleFormat sample_format)
ErrorOr<NonnullOwnPtr<WavWriter>> WavWriter::create_from_file(StringView path, u32 sample_rate, u16 num_channels, PcmSampleFormat sample_format)
{
auto wav_writer = TRY(adopt_nonnull_own_or_enomem(new (nothrow) WavWriter(sample_rate, num_channels, sample_format)));
TRY(wav_writer->set_file(path));
return wav_writer;
}
WavWriter::WavWriter(int sample_rate, u16 num_channels, PcmSampleFormat sample_format)
WavWriter::WavWriter(u32 sample_rate, u16 num_channels, PcmSampleFormat sample_format)
: m_sample_rate(sample_rate)
, m_num_channels(num_channels)
, m_sample_format(sample_format)

View File

@ -23,8 +23,8 @@ class WavWriter : public Encoder {
AK_MAKE_NONMOVABLE(WavWriter);
public:
static ErrorOr<NonnullOwnPtr<WavWriter>> create_from_file(StringView path, int sample_rate = 44100, u16 num_channels = 2, PcmSampleFormat sample_format = PcmSampleFormat::Int16);
WavWriter(int sample_rate = 44100, u16 num_channels = 2, PcmSampleFormat sample_format = PcmSampleFormat::Int16);
static ErrorOr<NonnullOwnPtr<WavWriter>> create_from_file(StringView path, u32 sample_rate = 44100, u16 num_channels = 2, PcmSampleFormat sample_format = PcmSampleFormat::Int16);
WavWriter(u32 sample_rate = 44100, u16 num_channels = 2, PcmSampleFormat sample_format = PcmSampleFormat::Int16);
~WavWriter();
virtual ErrorOr<void> write_samples(ReadonlySpan<Sample> samples) override;