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


C++ MIDITimedBigMessage::SetTime方法代码示例

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


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

示例1:

GenePool::MIDIEventList *GenePool::getEvents(void)
{
	list<MIDITimedBigMessage*> *events = new list<MIDITimedBigMessage*>;

    for (EventPool::iterator i = pool_.begin(); i != pool_.end(); ++i)
    {
		for (BreadNoteCluster::iterator j = (*i)->begin(); j != (*i)->end(); ++j)
		{
            BreadNote *e = (*j);
			
            u_int8_t pitch = e->pitch();
            u_int32_t ontime = e->ontime();
            u_int32_t duration = e->duration();
            u_int8_t channel = e->channel();
            u_int8_t dynamic = e->dynamic();

			MIDITimedBigMessage *m = new MIDITimedBigMessage;
			m->SetTime(ontime);
			m->SetNoteOn(channel, pitch, dynamic);
			events->push_back(m);
			m = new MIDITimedBigMessage;
			m->SetTime(ontime+duration);
			m->SetNoteOff(channel, pitch, dynamic);
			events->push_back(m);

//            printf("(%d %d %d %d %d) ", ontime, pitch, duration, channel,
//                   dynamic);
        }
	}

	return events;
}
开发者ID:mishan,项目名称:quickhacks,代码行数:32,代码来源:GenePool.cpp

示例2: CompressStartPause

void CompressStartPause( const MIDIMultiTrack &src, MIDIMultiTrack &dst, int ignore_channel )
{
    dst.ClearAndResize( src.GetNumTracks() );
    dst.SetClksPerBeat( src.GetClksPerBeat() );

    MIDIClockTime ev_time = 0;
    MIDISequencer seq( &src );
    seq.GoToTime( 0 );
    if ( !seq.GetNextEventTime ( &ev_time ) )
        return; // empty src multitrack

    MIDITimedBigMessage ev;
    int ev_track;
    bool compress = true;
    MIDIClockTime old_ev_time = 0, delta_ev_time = 0, ev_time0 = 0;

    while ( seq.GetNextEvent( &ev_track, &ev ) )
    {
        if ( ev.IsServiceMsg() || ev.IsNoOp() )
            continue;

        if ( ev.IsChannelEvent() && ev.GetChannel() == ignore_channel )
            continue;

        ev_time = ev.GetTime();
        if ( compress )
        {
            // compress time intervals between adjacent messages to 1 tick
            if (ev_time > old_ev_time)
                ++delta_ev_time;

            old_ev_time = ev_time;

            ev.SetTime( delta_ev_time );

            if ( ev.ImplicitIsNoteOn() )
            {
                compress = false;
                ev_time0 = ev_time - delta_ev_time;
            }
        }
        else
        {
            ev.SetTime( ev_time - ev_time0 );
        }

        dst.GetTrack(ev_track)->PutEvent(ev);
    }
}
开发者ID:bonzehan,项目名称:stm32-projects,代码行数:49,代码来源:jdksmidi_utils.cpp

示例3: AddEndingPause

bool AddEndingPause( MIDIMultiTrack &tracks, int track_num, MIDIClockTime pause_ticks )
{
    MIDIClockTime t = tracks.GetTrack( track_num )->GetLastEventTime();
    MIDITimedBigMessage msg;
    msg.SetTime( t + pause_ticks );
    // add lowest "note on" in channel 0 with velocity 0 (i.e. "note off")
    msg.SetNoteOn( 0, 0, 0 );
    return tracks.GetTrack( track_num )->PutEvent( msg );
}
开发者ID:bonzehan,项目名称:stm32-projects,代码行数:9,代码来源:jdksmidi_utils.cpp

示例4: LastEventsProlongation

void LastEventsProlongation( MIDIMultiTrack &tracks, int track_num, MIDIClockTime add_ticks )
{
    MIDITrack *track = tracks.GetTrack( track_num );
    int index = track->GetNumEvents() - 1;
    if ( add_ticks == 0 || index < 0 )
        return;

    MIDITimedBigMessage *msg = track->GetEvent( index );
    MIDIClockTime tmax = msg->GetTime();

    while ( msg->GetTime() == tmax )
    {
        msg->SetTime( tmax + add_ticks );
        if ( --index < 0 )
            break;
        msg = track->GetEvent( index );
    }
}
开发者ID:bonzehan,项目名称:stm32-projects,代码行数:18,代码来源:jdksmidi_utils.cpp

示例5: Clear


//.........这里部分代码省略.........
     }
     
     // skip any NOPs on track 2
     
     if( has_ev2 && ev2->IsNoOp() )
     {
       cur_trk2ev++;
       continue;
     }
     
     // skip all data end
     
     if( has_ev1 && ev1->IsDataEnd() )
     {
       if( ev1->GetTime() > last_data_end_time )
       {
         last_data_end_time = ev1->GetTime();
       }
       cur_trk1ev++;
       continue;
     }
     
     if( has_ev2 && ev2->IsDataEnd() )
     {
       if( ev2->GetTime() > last_data_end_time )
       {
         last_data_end_time = ev2->GetTime();
       }
       cur_trk2ev++;
       continue;
     }
     
     if( (has_ev1 && !has_ev2) )
     {
       // nothing left on trk 2
       
       if( !ev1->IsNoOp())
       {
         if( ev1->GetTime() > last_data_end_time )
         {
           last_data_end_time = ev1->GetTime();
         }
         
         PutEvent( *ev1 );
         ++cur_trk1ev;
       }
     } else if( (!has_ev1 && has_ev2) )
     {
       // nothing left on trk 1
       if( !ev2->IsNoOp() )
       {
         PutEvent( *ev2 );
         ++cur_trk2ev;
       }
     } else if( has_ev1 && has_ev2 )
     {
       int trk=1;
       
       if( (ev1->GetTime() <= ev2->GetTime()) )
       {
         trk=1;
       }
       else
       {
         trk=2;
       }
       
       if( trk==1 )
       {
         if( ev1->GetTime() > last_data_end_time )
         {
           last_data_end_time = ev1->GetTime();
         }
         
         PutEvent( *ev1 );
         
         ++cur_trk1ev;
       }
       else
       {
         if( ev2->GetTime() > last_data_end_time )
         {
           last_data_end_time = ev2->GetTime();
         }
         
         PutEvent( *ev2 );
         ++cur_trk2ev;
       }
     }
   }
   
   // put single final data end event
   
   MIDITimedBigMessage dataend;
   
   dataend.SetTime( last_data_end_time );
   dataend.SetDataEnd();
   
   PutEvent( dataend );
 }
开发者ID:MisterZeus,项目名称:SNES-Tracker,代码行数:101,代码来源:jdkmidi_track.cpp


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