■ SignalGenerator 클래스를 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
using System; using System.Threading; using NAudio.Wave; using NAudio.Wave.SampleProviders; ISampleProvider provider = new SignalGenerator() { Gain = 0.2, Frequency = 500, Type = SignalGeneratorType.Sin }.Take(TimeSpan.FromSeconds(5)); using(WaveOutEvent waveOutEvent = new WaveOutEvent()) { waveOutEvent.Init(provider); waveOutEvent.Play(); while(waveOutEvent.PlaybackState == PlaybackState.Playing) { Thread.Sleep(500); } } |