00001 #ifndef __SPKRNOTE_H_INCLUDED__ 00002 #define __SPKRNOTE_H_INCLUDED__ 00003 00004 // $Id 00005 00006 //********************************************************************** 00007 // * 00008 // Description: Implementation using PC speaker to produce sound * 00009 // for a single note. * 00010 // * 00011 // Author: Chris White (whitecf@bcs.org.uk) * 00012 // * 00013 // Copyright (C) 2003 Monitor Computing Services Ltd. * 00014 // * 00015 // This program is free software; you can redistribute it and/or * 00016 // modify it under the terms of the GNU General Public License * 00017 // as published by the Free Software Foundation; either version 2 * 00018 // of the License, or any later version. * 00019 // * 00020 // This program is distributed in the hope that it will be useful, * 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of * 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00023 // GNU General Public License for more details. * 00024 // * 00025 // You should have received a copy of the GNU General Public * 00026 // License (http://www.gnu.org/copyleft/gpl.html) along with this * 00027 // program; if not, write to: * 00028 // The Free Software Foundation Inc., * 00029 // 59 Temple Place - Suite 330, * 00030 // Boston, MA 02111-1307, * 00031 // USA. * 00032 // * 00033 //********************************************************************** 00034 // * 00035 // Notes: * 00036 // * 00037 //********************************************************************** 00038 00039 00040 #include <note.h> 00041 00042 00043 namespace Monitor { 00044 namespace Utility { 00045 00049 class SpeakerNote : public Note 00050 { 00051 public: 00052 typedef int Frequency; 00053 typedef int Length; 00054 00061 SpeakerNote(Frequency newFrequency, Length newLength); 00062 00066 virtual ~SpeakerNote(); 00067 00073 virtual void 00074 sound() const 00075 throw (Note::Busy); 00076 00080 Frequency 00081 getFrequency() const; 00082 00086 void 00087 setFrequency(Frequency newFrequency); 00088 00092 Length 00093 getLength() const; 00094 00098 void 00099 setLength(Length newLength); 00100 00101 00102 private: 00106 void 00107 endSound() const; 00108 00113 static int busy; 00114 00118 Frequency frequency; 00119 00123 Length length; 00124 }; 00125 00126 }; // namespace Utility 00127 }; // namespace Monitor 00128 00129 #endif // __SPKRNOTE_H_INCLUDED__