Beispiel #1
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;

            List <string> devices = new List <string>();

            for (int n = 0; n < WaveIn.DeviceCount; n++)
            {
                devices.Add(WaveIn.GetCapabilities(n).ProductName);
            }

            for (int n = 0; n < devices.Count; n++)
            {
                Console.WriteLine(n + " : " + devices[n]);
            }

            WheelWells ww = new WheelWells();

            DisplayWriter.DrawScreen();
            Thread.Sleep(1000000);
        }
Beispiel #2
0
        void OnDataAvailable(object sender, WaveInEventArgs e)
        {
            byte[] buffer = e.Buffer;

            for (int index = 0; index < e.BytesRecorded; index += 2)
            {
                short sample = (short)((buffer[index + 1] << 8) |
                                       buffer[index + 0]);
                float sample32 = sample / 32768f;
                maxValue = Math.Max(maxValue, sample32);
                minValue = Math.Min(minValue, sample32);
                sampleCount++;
            }

            if (sampleCount > 100)
            {
                VolArgs va = new VolArgs(DisplayWriter.VolMeter(Math.Max(maxValue, Math.Abs(minValue))), position);
                sampleCount = 0;
                maxValue    = 0f;
                minValue    = 0f;

                displayVolume(this, va);
            }
        }