105 lines
1.6 KiB
C++
105 lines
1.6 KiB
C++
#ifndef _GUITAR_FRET_HPP_
|
|
#define _GUITAR_FRET_HPP_
|
|
#ifndef _COMMON_RECTANGLE_HPP_
|
|
#include <common/rect.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_NOTE_HPP_
|
|
#include <guitar/note.hpp>
|
|
#endif
|
|
#ifndef _COMMON_ARRAY_HPP_
|
|
#include <common/array.hpp>
|
|
#endif
|
|
|
|
class Fret;
|
|
typedef Array<Fret> GuitarString;
|
|
typedef Array<GuitarString> VirtualFretboard;
|
|
|
|
class Fret
|
|
{
|
|
public:
|
|
typedef enum FretStatus{Active,Inactive,Hidden};
|
|
Fret(void);
|
|
Fret(const Fret &fret);
|
|
Fret(const Note ¬e,const Rect &boundingRect);
|
|
virtual ~Fret();
|
|
Fret &operator=(const Fret &fret);
|
|
const Note &getNote(void)const;
|
|
void setNote(const Note ¬e);
|
|
const Rect &getBoundingRect(void)const;
|
|
void setBoundingRect(const Rect &boundingRect);
|
|
FretStatus getStatus(void)const;
|
|
void setStatus(FretStatus status);
|
|
private:
|
|
Note mNote;
|
|
Rect mBoundingRect;
|
|
FretStatus mStatus;
|
|
};
|
|
|
|
inline
|
|
Fret::Fret(void)
|
|
: mStatus(Hidden)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Fret::Fret(const Fret &fret)
|
|
{
|
|
*this=fret;
|
|
}
|
|
|
|
inline
|
|
Fret::Fret(const Note ¬e,const Rect &boundingRect)
|
|
: mNote(note), mBoundingRect(boundingRect)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Fret::~Fret()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Fret &Fret::operator=(const Fret &fret)
|
|
{
|
|
setNote(fret.getNote());
|
|
setBoundingRect(fret.getBoundingRect());
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
const Note &Fret::getNote(void)const
|
|
{
|
|
return mNote;
|
|
}
|
|
|
|
inline
|
|
void Fret::setNote(const Note ¬e)
|
|
{
|
|
mNote=note;
|
|
}
|
|
|
|
inline
|
|
const Rect &Fret::getBoundingRect(void)const
|
|
{
|
|
return mBoundingRect;
|
|
}
|
|
|
|
inline
|
|
void Fret::setBoundingRect(const Rect &boundingRect)
|
|
{
|
|
mBoundingRect=boundingRect;
|
|
}
|
|
|
|
inline
|
|
Fret::FretStatus Fret::getStatus(void)const
|
|
{
|
|
return mStatus;
|
|
}
|
|
|
|
inline
|
|
void Fret::setStatus(FretStatus status)
|
|
{
|
|
mStatus=status;
|
|
}
|
|
#endif
|