Exemplo n.º 1
0
        public static void Beep(int frequency, int duration)
        {
            // AsyncBeep?
            // X:\jsc.svn\examples\javascript\audio\StandardOscillator\StandardOscillator\Application.cs

            //  number of hardware contexts reached maximum (6).

            if (__AudioContext == null)
            {
                __AudioContext = new WebAudio.AudioContext();
            }

            var a = __AudioContext;
            var o = a.createOscillator();

            o.start(0);
            o.frequency.value = frequency;
            o.type            = WebAudio.OscillatorType.square;
            o.connect(o.context.destination);

            __Task.Delay(duration).ContinueWith(
                delegate
            {
                o.disconnect();

                //a.close();
            }
                );
        }
Exemplo n.º 2
0
        public static void Beep(int frequency, int duration)
        {
            // AsyncBeep?
            // X:\jsc.svn\examples\javascript\audio\StandardOscillator\StandardOscillator\Application.cs

            //  number of hardware contexts reached maximum (6).

            if (__AudioContext == null)
                __AudioContext = new WebAudio.AudioContext();

            var a = __AudioContext;
            var o = a.createOscillator();

            o.start(0);
            o.frequency.value = frequency;
            o.type = WebAudio.OscillatorType.square;
            o.connect(o.context.destination);

            __Task.Delay(duration).ContinueWith(
                delegate
                {
                    o.disconnect();

                    //a.close();
                }
            );

        }