当前位置: 首页>>代码示例>>C++>>正文


C++ MidiEvent::getChannel方法代码示例

本文整理汇总了C++中MidiEvent::getChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiEvent::getChannel方法的具体用法?C++ MidiEvent::getChannel怎么用?C++ MidiEvent::getChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MidiEvent的用法示例。


在下文中一共展示了MidiEvent::getChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onMidiEvent

void MidiBindingDialog::onMidiEvent(RtMidiInDevice& src, MidiEvent evt) {

	// display info
	ui->lblSrcDev->setText( src.getName().c_str() );
	ui->lblSrcEvt->setText( evt.getTypeString().c_str() );
	ui->lblSrcChan->setText( std::to_string(evt.getChannel()).c_str() );
	ui->lblSrcData->setText( ("d1=" + std::to_string(evt.getData1()) + " d2=" + std::to_string(evt.getData2())).c_str() );

	// setup bindings source
	if (!binding) {return;}
	binding->src.srcName = src.getName();
	binding->src.type = evt.getType();
	binding->src.channel = evt.getChannel();
	binding->src.d1 = evt.getData1();

}
开发者ID:k-a-z-u,项目名称:KSynth,代码行数:16,代码来源:MidiBindingDialog.cpp

示例2: LoadMidiToDB

void PCH_ChartManager::LoadMidiToDB(PCH_CString filePath,PCH_CString fileHash, bool update)
{
    std::ifstream in2(filePath, std::ios::in | std::ios::binary);
    MidiFile midifile(in2);
    if (!midifile.status())
    {
        printf("Error reading MIDI file %s\n",filePath);
        return;
    }

    printf("Loading midi file data...\n");
    if(update)
    {
        printf("Deleting existing data...\n");
        _db->DeleteChart(filePath);
    }

    midifile.absoluteTicks();
    midifile.linkNotePairs();

    midifile.doTimeAnalysis();

    printf("Analysis complete...\n");

    int totalTracks =midifile.size();

    MidiEvent* mev;

    int chartID = _db->AddChart(filePath, fileHash);
    int trackID = 0;
    int trackItemCount = 0;

#ifndef PCH_USE_HEAP
    PCH_ControllerEvent newEvent;
    PCH_ChartInstrument newInst;
    PCH_ChartTrackNote newNote;
    PCH_PitchBend newBend;
#endif

    for (int track=0; track < totalTracks; track++)
    {
        trackItemCount = midifile[track].size();

        if(trackItemCount == 0) continue;

        trackID = _db->AddTrack(chartID,track);
        printf("Track #%d added...\n",trackID);

        _db->BeginTransaction();

        for (int i=0; i<trackItemCount; i++)
        {
            mev = &midifile[track][i];

            if(mev->isTimbre())
            {
#ifdef PCH_USE_HEAP
                PCH_ChartInstrument* newInst = new PCH_ChartInstrument();
                newInst->Channel = mev->getChannel();
                newInst->Seconds = mev->seconds;
                newInst->InstrumentID = mev->getP1();

                _db->AddInstrument(trackID,newInst);

                delete newInst;
                newInst = NULL;
#else
                newInst.Channel = mev->getChannel();
                newInst.Seconds = mev->seconds;
                newInst.InstrumentID = mev->getP1();

                _db->AddInstrument(trackID,&newInst);
#endif
            }

            if(mev->getCommandByte() == 0xFF && mev->getP1() == 0x03)//Title
            {
                printf("Title found\n");
                unsigned char* title = &midifile[track][i][3];//CMD + p1 + p2 are omitted

                int titleSize = mev->getP2();
                if(titleSize > 0)
                {
                    char* strTitle = new char[titleSize+1];

                    memcpy(strTitle,title,titleSize);
                    strTitle[titleSize] = '\0';

                    _db->SetTrackTitle(trackID, strTitle);
                }
                printf("Title end\n");
            }

            if(mev->isNote()) //if(false)
            {
                if(mev->isNoteOn())
                {
#ifdef PCH_USE_HEAP
                    PCH_ChartTrackNote* newNote = new PCH_ChartTrackNote();
                    newNote->Seconds = mev->seconds;
//.........这里部分代码省略.........
开发者ID:ManoShu,项目名称:Champler,代码行数:101,代码来源:PCH_ChartManager.cpp


注:本文中的MidiEvent::getChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。