Exemplo n.º 1
0
        /// <summary>
        /// Play a file.
        /// </summary>
        /// <param name="fileName">Name of file to play</param>
        /// <param name="bufferSize">Size of playback buffers</param>
        /// <param name="volLeft">Volume of left channel</param>
        /// <param name="volRight">Volume of right channel</param>
        /// <returns>MMSYSERR.NOERROR if successful</returns>
        public Wave.MMSYSERR Play(string fileName, int bufferSize, ushort volLeft, ushort volRight)
        {
            if (m_file != null)
            {
                return(m_file.Play(0, fileName, m_msgWindow.Hwnd, bufferSize, volLeft, volRight));
            }

            return(Wave.MMSYSERR.ERROR);
        }
Exemplo n.º 2
0
        static void WriteToFreebox(string freeboxCode)
        {
            Console.WriteLine($"Enter to send {freeboxCode}...");
            Console.ReadLine();

            WaveFile waveFile   = new WaveFile(SampleRate.Hz8000, BitsPerSample.Bits16, DataChannels.Mono);
            var      touchTones = TouchTone.GetTouchTones(freeboxCode);

            DTMF.Generate(waveFile, touchTones, 1);

            Console.WriteLine($"Dialing {freeboxCode}...");
            waveFile.Play();
            Task.Delay(waveFile.AudioLength + TimeSpan.FromSeconds(1)).Wait();
        }