1
//--------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2010 LenMus project
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation,
7
// either version 3 of the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along with this
14
// program. If not, see <http://www.gnu.org/licenses/>.
16
// For any comment, suggestion or feature request, please contact the manager of
17
// the project at cecilios@users.sourceforge.net
19
//-------------------------------------------------------------------------------------
21
#ifndef __LM_METRONOME_H__ //to avoid nested includes
22
#define __LM_METRONOME_H__
24
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
25
#pragma interface "Metronome.cpp"
28
// For compilers that support precompilation, includes <wx/wx.h>.
29
#include <wx/wxprec.h>
39
class lmMetronome; //forward declaration
41
class lmMetronomeTimer : public wxTimer
44
lmMetronomeTimer(lmMetronome* pOwner) : wxTimer() { m_pOwner = pOwner; }
46
virtual void Notify();
49
lmMetronome* m_pOwner;
56
lmMetronome(long nMM = 60);
61
void SetInterval(long milliseconds);
64
long GetMM() { return m_nMM; }
65
long GetInterval() { return m_nInterval; }
66
bool IsEnabled() { return m_fEnabled; }
67
bool IsRunning() { return m_fRunning; }
69
// timer events handler
75
void Enable(bool fValue) { m_fEnabled = fValue; }
76
void DoClick(bool fFirstBeatOfBar=true);
80
void ClickOn(bool fFirstBeatOfBar);
83
int m_nSound; //last click on sound
84
long m_nMM; //metronome frequency: beats per minute
85
long m_nInterval; //metronome period: milliseconds between beats
86
bool m_fEnabled; //metronome is enabled
87
bool m_fRunning; //true if Start() invoked
88
lmMetronomeTimer* m_pTimer; //timer associated to this metronome
92
#endif // __LM_METRONOME_H__