コード例 #1
0
ファイル: atts_midi.cpp プロジェクト: avorio/verovio
bool Att::SetMidi( Object *element, std::string attrType, std::string attrValue ) {
    if (dynamic_cast<AttChannelized*>(element) ) {
        AttChannelized *att = dynamic_cast<AttChannelized*>(element);
        if (attrType == "midiChannel") {
            att->SetMidiChannel(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiDuty") {
            att->SetMidiDuty(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiPort") {
            att->SetMidiPort(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiTrackInt") {
            att->SetMidiTrack(att->StrToInt(attrValue));
            return true;
        }
    }
    if (dynamic_cast<AttMidiinstrument*>(element) ) {
        AttMidiinstrument *att = dynamic_cast<AttMidiinstrument*>(element);
        if (attrType == "midiInstrnum") {
            att->SetMidiInstrnum(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiInstrname") {
            att->SetMidiInstrname(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiPan") {
            att->SetMidiPan(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiVolume") {
            att->SetMidiVolume(att->StrToStr(attrValue));
            return true;
        }
    }
    if (dynamic_cast<AttMidinumber*>(element) ) {
        AttMidinumber *att = dynamic_cast<AttMidinumber*>(element);
        if (attrType == "numInt") {
            att->SetNum(att->StrToInt(attrValue));
            return true;
        }
    }
    if (dynamic_cast<AttMiditempo*>(element) ) {
        AttMiditempo *att = dynamic_cast<AttMiditempo*>(element);
        if (attrType == "midiTempo") {
            att->SetMidiTempo(att->StrToStr(attrValue));
            return true;
        }
    }
    if (dynamic_cast<AttMidivalue*>(element) ) {
        AttMidivalue *att = dynamic_cast<AttMidivalue*>(element);
        if (attrType == "val") {
            att->SetVal(att->StrToStr(attrValue));
            return true;
        }
    }
    if (dynamic_cast<AttTimebase*>(element) ) {
        AttTimebase *att = dynamic_cast<AttTimebase*>(element);
        if (attrType == "ppqInt") {
            att->SetPpq(att->StrToInt(attrValue));
            return true;
        }
    }

    return false;
}
コード例 #2
0
ファイル: atts_midi.cpp プロジェクト: maximumspatium/verovio
bool Att::SetMidi( Object *element, std::string attrType, std::string attrValue ) {
    if (element->HasAttClass( ATT_CHANNELIZED ) ) {
        AttChannelized *att = dynamic_cast<AttChannelized*>(element);
        assert( att );
        if (attrType == "midiChannel") {
            att->SetMidiChannel(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiDuty") {
            att->SetMidiDuty(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiPort") {
            att->SetMidiPort(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiTrackInt") {
            att->SetMidiTrack(att->StrToInt(attrValue));
            return true;
        }
    }
    if (element->HasAttClass( ATT_MIDIINSTRUMENT ) ) {
        AttMidiinstrument *att = dynamic_cast<AttMidiinstrument*>(element);
        assert( att );
        if (attrType == "midiInstrnum") {
            att->SetMidiInstrnum(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiInstrname") {
            att->SetMidiInstrname(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiPan") {
            att->SetMidiPan(att->StrToStr(attrValue));
            return true;
        }
        if (attrType == "midiVolume") {
            att->SetMidiVolume(att->StrToStr(attrValue));
            return true;
        }
    }
    if (element->HasAttClass( ATT_MIDINUMBER ) ) {
        AttMidinumber *att = dynamic_cast<AttMidinumber*>(element);
        assert( att );
        if (attrType == "numInt") {
            att->SetNum(att->StrToInt(attrValue));
            return true;
        }
    }
    if (element->HasAttClass( ATT_MIDITEMPO ) ) {
        AttMiditempo *att = dynamic_cast<AttMiditempo*>(element);
        assert( att );
        if (attrType == "midiTempo") {
            att->SetMidiTempo(att->StrToStr(attrValue));
            return true;
        }
    }
    if (element->HasAttClass( ATT_MIDIVALUE ) ) {
        AttMidivalue *att = dynamic_cast<AttMidivalue*>(element);
        assert( att );
        if (attrType == "val") {
            att->SetVal(att->StrToStr(attrValue));
            return true;
        }
    }
    if (element->HasAttClass( ATT_TIMEBASE ) ) {
        AttTimebase *att = dynamic_cast<AttTimebase*>(element);
        assert( att );
        if (attrType == "ppqInt") {
            att->SetPpq(att->StrToInt(attrValue));
            return true;
        }
    }

    return false;
}