A small program for speakers under Linux

zhaozj2021-02-16  69

#include #include

Void Play (Unsigned Int * DELAY);

Main () {Int i; unsigned int freq [] = {330, 392, 330, 294, 330, 330, 330, 392, 330, 294, 262, 294, 330, 392, 294, 262, 262, 220, 196, 196, 220, 262, 294, 330, 262, 0};

Unsigned int Time [] = {50, 50, 50, 25, 25, 50, 25, 25, 50, 50, 25, 25, 100, 50, 25, 25, 50 , 25, 25, 50, 25, 25, 100};

unsigned int freq2 [] = {196,262,262,262,330,294,262,294,330,294,262, 330,394,440,440,394,330,330,262,294,262,294, 330,294,262,230,230,196,262,440,394,330,330, 262,294,262,294,440,394,330,330,394,440,523, 394,330,330,262,294,262,294,330,294,262,230, 230,196,262,440,394,330,330,262,294,262,294, 440,394,330,330,394,440,523,394,330,330,262, 294,262,294,330,294,262,230,230,196,262,0};

Unsigned int Time2 [] = {25, 38, 12, 25, 25, 38, 12, 25, 12, 12, 56, 25, 25, 50, 25, 38, 12, 12, 12, 38, 12, 25 12, 12, 38, 12, 25, 25, 12, 12, 38, 12, 25, 25, 38, 12, 25, 25, 12, 25, 38, 12, 12, 12, 38 12, 25, 12, 12, 38, 12, 25, 25, 100, 25, 38, 12, 12, 12, 38, 12, 25, 25, 38, 12, 25, 25, 12, 25, 38, 12, 12 12, 38, 12, 25, 12, 12, 38, 12, 25, 25, 100}; unsigned int freQ_lert [] = {2000, 2400, 0}; unsigned int Time_lert [] = {50, 60}; i = 0; i <5; i ) {Play (freq_lert, time_lert);} Play (freq2, time2);}

Void Play (unsigned int * time) {INT i; for (i = 0; freq [i]! = 0; i ) {Speaker (freq [i], time [i]);}}

转载请注明原文地址:https://www.9cbs.com/read-15352.html

New Post(0)