Files
Work/midiseq/purenote.hpp
2024-08-07 09:16:27 -04:00

105 lines
1.7 KiB
C++

#ifndef _MIDISEQ_PURENOTE_HPP_
#define _MIDISEQ_PURENOTE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_FILEIO_HPP_
#include <common/fileio.hpp>
#endif
class PureNote
{
public:
enum {PureNoteLength=2};
PureNote(void);
PureNote(BYTE pitch,BYTE velocity);
virtual ~PureNote();
BYTE pitch(void)const;
void pitch(BYTE pitch);
BYTE velocity(void)const;
void velocity(BYTE velocity);
PureNote &operator=(const PureNote &somePureNote);
WORD operator==(const PureNote &somePureNote)const;
FileIO &operator<<(FileIO &someFileIO);
String toString(void)const;
private:
BYTE mPitch;
BYTE mVelocity;
};
inline
PureNote::PureNote(void)
: mPitch(0), mVelocity(0)
{
}
inline
PureNote::PureNote(BYTE pitch,BYTE velocity)
: mPitch(pitch), mVelocity(velocity)
{
}
inline
PureNote::~PureNote()
{
}
inline
BYTE PureNote::pitch(void)const
{
return mPitch;
}
inline
BYTE PureNote::velocity(void)const
{
return mVelocity;
}
inline
void PureNote::pitch(BYTE pitch)
{
mPitch=pitch;
}
inline
void PureNote::velocity(BYTE velocity)
{
mVelocity=velocity;
}
inline
PureNote &PureNote::operator=(const PureNote &somePureNote)
{
pitch(somePureNote.pitch());
velocity(somePureNote.velocity());
return *this;
}
inline
WORD PureNote::operator==(const PureNote &somePureNote)const
{
return (pitch()==somePureNote.pitch()&&
velocity()==somePureNote.velocity());
}
inline
FileIO &PureNote::operator<<(FileIO &someFileIO)
{
someFileIO.read(mPitch);
someFileIO.read(mVelocity);
return someFileIO;
}
inline
String PureNote::toString(void)const
{
String str;
::sprintf(str,"pitch:%d velocity:%d",mPitch,mVelocity);
return str;
}
#endif