Improve audio and midi support.
This commit is contained in:
parent
9bcc0ae88e
commit
8b5f485d1e
47 changed files with 1446 additions and 634 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "MidiEvent.h"
|
||||
#include "MidiElements.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
@ -10,40 +11,65 @@ public:
|
|||
enum class Type
|
||||
{
|
||||
UNSET,
|
||||
UNKNOWN,
|
||||
SEQ_NUM,
|
||||
TEXT,
|
||||
COPYRIGHT,
|
||||
TRACK_NAME,
|
||||
INSTRUMENT_NAME,
|
||||
LYRIC,
|
||||
MARKER,
|
||||
CUE_POINT,
|
||||
CHANNEL_PREFIX,
|
||||
END_TRACK,
|
||||
SET_TEMPO,
|
||||
TIME_SIGNATURE
|
||||
SMPTE_OFFSET,
|
||||
TIME_SIG,
|
||||
KEY_SIG,
|
||||
SEQ_CUSTOM
|
||||
};
|
||||
|
||||
private:
|
||||
static const int META_SEQ_NUM = 0x0;
|
||||
static const int META_TEXT = 0x1;
|
||||
static const int META_COPYRIGHT = 0x2;
|
||||
static const int META_TRACK_NAME = 0x3; // 0000 0011
|
||||
static const int META_INSTRUMENT_NAME = 0x4;
|
||||
static const int META_LYRIC = 0x5;
|
||||
static const int META_MARKER = 0x6;
|
||||
static const int META_CUE_POINT = 0x7;
|
||||
static const int META_CHANNEL_PREFIX = 0x20;
|
||||
static const int META_END_TRACK = 0x2F;
|
||||
|
||||
static const int META_SET_TEMPO = 0x51; // 0101 0001
|
||||
static const int META_TRACK_NAME = 0x3; // 0000 0011
|
||||
static const int META_SMPTE_OFFSET = 0x54;
|
||||
static const int META_TIME_SIG = 0x58; // 0101 1000
|
||||
Type mType;
|
||||
std::string mLabel;
|
||||
int mValue;
|
||||
static const int META_KEY_SIG = 0x59; // 0101 1001
|
||||
|
||||
static const int META_SEQ_CUSTOM = 0x7F;
|
||||
|
||||
public:
|
||||
|
||||
MetaMidiEvent();
|
||||
static std::shared_ptr<MetaMidiEvent> Create();
|
||||
static std::unique_ptr<MetaMidiEvent> Create();
|
||||
|
||||
void SetValue(int value);
|
||||
|
||||
void SetIsTrackName();
|
||||
|
||||
void SetIsSetTempo();
|
||||
|
||||
void SetIsTimeSignature();
|
||||
void SetType(char c);
|
||||
Type GetType() const;
|
||||
|
||||
void SetLabel(const std::string& label);
|
||||
void SetTimeSignature(const MidiTimeSignature& timeSig);
|
||||
void SetTimeCode(const MidiSmtpeTimecode& timeCode);
|
||||
void SetKeySignature(const MidiKeySignature& keySig);
|
||||
|
||||
static bool IsTrackName(char c);
|
||||
|
||||
static bool IsSetTempo(char c);
|
||||
|
||||
static bool IsTimeSignature(char c);
|
||||
private:
|
||||
Type mType {Type::UNSET};
|
||||
char mUnKnownMarker{0};
|
||||
std::string mLabel;
|
||||
int mValue { 0 };
|
||||
MidiTimeSignature mTimeSig;
|
||||
MidiSmtpeTimecode mTimecode;
|
||||
MidiKeySignature mKeySig;
|
||||
};
|
||||
|
||||
using MetaMidiEventPtr = std::shared_ptr<MetaMidiEvent>;
|
||||
using MetaMidiEventPtr = std::unique_ptr<MetaMidiEvent>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue