Astopia

C# 을 이용한 비프음 출력 예제 본문

개발/C# 개발

C# 을 이용한 비프음 출력 예제

bsy0317 2015. 4. 4. 20:44


간단하게 위와 같이 만들어 보았습니다 ㅎㅎ

재생시간 단위는 초단위로 해두었습니다.


비프음 출력.exe



{소스코드}






 private void button1_Click(object sender, EventArgs e)
        {
            

            int mhz = Int32.Parse(textBox1.Text);
            int time = Int32.Parse(textBox2.Text) * 1000;
            
            if (mhz > 32767)
            {
                MessageBox.Show("37 ~ 32767Hz 범위만 가능합니다.","경고");
                
                return;
                
            }
            if (mhz < 37)
            {
                MessageBox.Show("37 ~ 32767Hz 범위만 가능합니다.", "경고");
                return;
            }


            Console.WriteLine (sound(mhz,time));
            

        } 

        public string sound (int mhz , int time)
        {
            Console.Beep(mhz, time);
            Console.WriteLine("출력이 시작되었습니다.");
            string ok = "OK";
            return ok;
            
        }


Please Donate To Bitcoin Address: [[address]]

Donation of [[value]] BTC Received. Thank You.
[[error]]