NAudio의 FadeInOutSampleProvider
을 사용하여 샘플 및을 페이드 아웃하면 페이드 아웃됩니다. 페이드 인은 정상적으로 작동하지만 점차적으로 페이드 아웃하는 대신 페이드 아웃이 시작되어야하는 곳에서 갑자기 침묵을 느낍니다.FadeInOutSampleProvider로 페이드 아웃 할 수 없음
FadeInOutSampleProvider
으로 페이드 아웃하는 올바른 방법은 무엇입니까? 내가 처음에 원본 소스가 끝나기 전에 500ms로에서 비 - 제로 샘플을 읽을 fadeOut
을 기대하고 있습니다
IWaveProvider waveSource; // initialised by reading a WAV file
// The ISampleProvider will be the underlying source for the following operations
ISampleProvider sampleSource = waveSource.ToSampleProvider();
// Create a provider which defines the samples we want to fade in
// (including the full-volume "middle" of the final output)
ISampleProvider fadeInSource = new OffsetSampleProvider(sampleSource);
fadeInSource.TakeSamples = most_of_file; // calculation omitted for brevity
// Create a provider which defines the samples we want to fade out:
// We will play these samples when fadeInSource is finished
ISampleProvider fadeOutSource = new OffsetSampleProvider(sampleSource);
fadeOutSource.SkipOverSamples = fadeInSource.TakeSamples;
// Wrap the truncated sources in FadeInOutSampleProviders
var fadeIn = new FadeInOutSampleProvider(fadeInSource);
fadeIn.BeginFadeIn(500); // half-second fade
var fadeOut = new FadeInOutSampleProvider(fadeOutSource);
fadeOut.BeginFadeOut(500);
// doc-comments suggest the fade-out will begin "after first Read"
을하지만,에 의해 0으로 페이드 아웃 : 여기
내가 그것을 할 노력하고있어 방법 근원의 끝. I는 fadeIn
가 완료 후 fadeOut
놀이시
단, I는 fadeOut
에 최초Read
호출 0으로 버퍼를 채우는 것을 발견.
내가 잘못 했나요? 아니면 NAudio에 버그가 있습니까?
참고 : 나는 나 자신을 구현 ConcatenatingSampleProvider
를 사용하여 연속 재생을 처리하고있어 - 내가 NAudio의 API와 유사한 아무것도 할 수 없습니다. 그것은 꽤 사소한 것이므로 여기에서 소스를 생략했습니다.
'FadeOutSampleProvider'를 제안 할 때, 내가 직접 구현해야한다는 것을 의미합니까? 또한 NAudio에 많은 도움을 주신 것에 대해 감사드립니다. – Jeremy
네, NAudio의 아이디어는 여러분 자신의 샘플 공급자를 만들고 함께 묶는 것입니다. 잘 작동하고 다른 사람들에게 유용 할 라이브러리를 만들면 라이브러리에 추가 될 수 있습니다. –