Call BIOS speaker Audible

Source: Internet
Author: User

Words don't say much, on the code:

#include <windows.h> #include <iostream> #include <map>using namespace std;const int do = 261;const int R E = 293;const int MI = 329;const int FA = 349;const int so = 392;const int LA = 440;const int TI = 493;const int do_ = 130 ; const int re_ = 147;const int mi_ = 165;const int fa_ = 174;const int so_ = 186;const int la_ = 220;const int ti_ = 247;i        NT frequency (char note) {static map<const char,int> table;            if (table.size () = = 0) {table[' 1 '] = do;                    table[' 2 '] = RE;            table[' 3 '] = MI;            table[' 4 '] = FA;            table[' 5 '] = so;            table[' 6 '] = LA;                    table[' 7 '] = TI;            Table[' C '] = Do_;                    table[' d '] = re_;            Table[' e '] = mi_;            table[' f '] = Fa_;            Table[' g '] = So_;            Table[' a '] = La_;        Table[' B '] = ti_; } return Table.find (note), second;}        Class music{private:string notes; int TenUTO;        Public:music (string &song, int tenuto_) {notes = song; tenuto = Tenuto_; Play (Notes.end (), Tenuto);} void Play (String::iterator it,int duration);};        void Music::p Lay (String::iterator it, int duration) {char note = *it;        if (it = = Notes.begin ()) return;    if (note = = '-') Play (it-1, duration + tenuto);                        else {if (isalnum (note)) {Play (it-1, 0);        Beep (Frequency (note), Tenuto + duration);    } else Play (it-1, duration); }} String bee = "5 3 3-| 4 2 2-| 1 2 3 4 |  5 5 5-| 5 3 3-| 4 2 2-| 1 3 5 5 |  3 3 3-| 2 2 2 2 | 2 3 4-| 3 3 3 3 |  3 4 5-| 5 3 3-| 4 2 2-| 1 3 5 5 |   1 3 1-|  "; String happynewyear = "1 1 1-g-| 3 3 3-1-|   1 3 5-5-| 4 3 2---| 2 3 4-4-|   3 2 3-1-| 1 3 2-g-|   B 2 1---|  ";  int main () {Music m (bee, 300);  Music m2 (happynewyear, 200); return 0;   }


Call BIOS speaker Audible

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.