void ApplyParameters() { if (SoundParams.IsChanged()) { Looped = SoundParams->Looped(); const Time::Microseconds frameDuration = SoundParams->FrameDuration(); SamplesPerFrame = static_cast<uint_t>(frameDuration.Get() * ::SNES_SPC::sample_rate / frameDuration.PER_SECOND); Resampler = Sound::CreateResampler(::SNES_SPC::sample_rate, SoundParams->SoundFreq(), Target); } }
void SetFrameDuration(Time::Microseconds frameDuration) { const auto totalDuration = Time::Microseconds(Data->TotalSamples * frameDuration.PER_SECOND / Data->Frequency); Data->FramesCount = std::max<uint_t>(1, static_cast<uint_t>(totalDuration.Get() / frameDuration.Get())); Data->SamplesPerFrame = Data->TotalSamples / Data->FramesCount; }