#include "MetaMidiEvent.h"

MetaMidiEvent::MetaMidiEvent()
    : MidiEvent(),
      mType(Type::UNSET),
      mLabel(),
      mValue(0)
{

}

std::unique_ptr<MetaMidiEvent> MetaMidiEvent::Create()
{
    return std::make_unique<MetaMidiEvent>();
}

void MetaMidiEvent::SetType(char c)
{
    switch (c)
    {
    case META_SEQ_NUM:
        mType = Type::SEQ_NUM;
        break;
    case META_TEXT:
        mType = Type::TEXT;
        break;
    case META_COPYRIGHT:
        mType = Type::COPYRIGHT;
        break;
    case META_TRACK_NAME:
        mType = Type::TRACK_NAME;
        break;
    case META_INSTRUMENT_NAME:
        mType = Type::INSTRUMENT_NAME;
        break;
    case META_LYRIC:
        mType = Type::LYRIC;
        break;
    case META_MARKER:
        mType = Type::MARKER;
        break;
    case META_CUE_POINT:
        mType = Type::CUE_POINT;
        break;
    case META_CHANNEL_PREFIX:
        mType = Type::CHANNEL_PREFIX;
        break;
    case META_END_TRACK:
        mType = Type::END_TRACK;
        break;
    case META_SET_TEMPO:
        mType = Type::SET_TEMPO;
        break;
    case META_SMPTE_OFFSET:
        mType = Type::SMPTE_OFFSET;
        break;
    case META_TIME_SIG:
        mType = Type::TIME_SIG;
        break;
    case META_KEY_SIG:
        mType = Type::KEY_SIG;
        break;
    case META_SEQ_CUSTOM:
        mType = Type::SEQ_CUSTOM;
        break;
    default:
        mType = Type::UNKNOWN;
        mUnKnownMarker = c;
    }
}

MetaMidiEvent::Type MetaMidiEvent::GetType() const
{
    return mType;
}

void MetaMidiEvent::SetValue(int value)
{
    mValue = value;
}

void MetaMidiEvent::SetLabel(const std::string& label)
{
    mLabel = label;
}

void MetaMidiEvent::SetTimeSignature(const MidiTimeSignature& timeSig)
{
    mTimeSig = timeSig;
}

void MetaMidiEvent::SetTimeCode(const MidiSmtpeTimecode& timeCode)
{
    mTimecode = timeCode;
}

void MetaMidiEvent::SetKeySignature(const MidiKeySignature& keySig)
{
    mKeySig = keySig;
}
