Further midi file support.
This commit is contained in:
parent
36826fa1d4
commit
4d5ca4d654
12 changed files with 739 additions and 200 deletions
|
@ -1,26 +1,49 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "MidiEvent.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class MetaMidiEvent : public MidiEvent
|
||||
{
|
||||
public:
|
||||
enum class Type
|
||||
{
|
||||
UNSET,
|
||||
TRACK_NAME
|
||||
};
|
||||
enum class Type
|
||||
{
|
||||
UNSET,
|
||||
TRACK_NAME,
|
||||
SET_TEMPO,
|
||||
TIME_SIGNATURE
|
||||
};
|
||||
|
||||
Type mType = Type::UNSET;
|
||||
std::string mLabel;
|
||||
MetaMidiEvent();
|
||||
private:
|
||||
|
||||
static bool IsTrackName(char c)
|
||||
{
|
||||
return (c & META_TRACK_NAME) == META_TRACK_NAME;
|
||||
}
|
||||
static const int META_SET_TEMPO = 0x51; // 0101 0001
|
||||
static const int META_TRACK_NAME = 0x3; // 0000 0011
|
||||
static const int META_TIME_SIG = 0x58; // 0101 1000
|
||||
Type mType;
|
||||
std::string mLabel;
|
||||
int mValue;
|
||||
|
||||
static const int META_TRACK_NAME = 0x3; // 0000 0011
|
||||
public:
|
||||
|
||||
MetaMidiEvent();
|
||||
static std::shared_ptr<MetaMidiEvent> Create();
|
||||
|
||||
void SetValue(int value);
|
||||
|
||||
void SetIsTrackName();
|
||||
|
||||
void SetIsSetTempo();
|
||||
|
||||
void SetIsTimeSignature();
|
||||
|
||||
void SetLabel(const std::string& label);
|
||||
|
||||
static bool IsTrackName(char c);
|
||||
|
||||
static bool IsSetTempo(char c);
|
||||
|
||||
static bool IsTimeSignature(char c);
|
||||
};
|
||||
|
||||
using MetaMidiEventPtr = std::shared_ptr<MetaMidiEvent>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue