📄 note.h
字号:
#ifndef NOTE_H
#define NOTE_H
#pragma once
#include "Time.h"
#include <list>
using std::list;
// +-------------------------------------------------------------
// |
// | Class : ParserException
// | Descripci髇 :
// |
// +-------------------------------------------------------------
class ParserException
{
public:
ParserException( const char* description, const char* string );
const CString& GetDescription();
const CString& GetNoteString();
const char* GetNextNote();
private:
CString description_;
CString noteString_;
const char* nextNote_;
};
// +-------------------------------------------------------------
// |
// | Class : Note
// | Descripci髇 :
// |
// +-------------------------------------------------------------
class Note : public CObject
{
DECLARE_SERIAL(Note)
public:
enum Tone { Silence, ToneC, ToneD, ToneE, ToneF, ToneG, ToneA, ToneB };
Note();
Note(Tone tone, int duration, int octave, bool dot, bool sharp);
Note(const Note& other);
virtual ~Note();
CString GetString() const;
const char* ParseString(const char* string);
void GetMIDINote(int& duration, int& note) const;
Tone GetTone() { return tone_; }
int GetDuration() { return duration_; }
bool HasDot() { return dot_; }
bool HasSharp() { return sharp_; }
int GetOctave() { return octave_; }
virtual void Serialize(CArchive &ar);
void OctaveUp();
void OctaveDown();
void SemitoneUp();
void SemitoneDown();
bool CanOctaveUp() const;
bool CanOctaveDown() const;
bool CanSemitoneUp() const;
bool CanSemitoneDown() const;
private:
Tone tone_;
int duration_;
int octave_;
bool dot_;
bool sharp_;
virtual void AssertValid() const;
bool IsValid(const char** reason) const;
};
typedef list<Note> NoteSequence;
#endif //NOTE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -