android/ringlibsdl/project/jni/libmodplug-0.8.8.4/src/load_abc.cpp
static void abc_synchronise_tracks(ABCHANDLE *h)
{
	ABCTRACK *tp;
	uint32_t tm;	// tracktime in master
	ABCEVENT *em, *es, *et, *ec;	// events in master, slave, slave temporary and copied event
	if( !h || !h->track ) return;
	abc_remove_unnecessary_events(h);
	for( tp = h->track->next; tp; tp = tp->next ) {
		for( em=h->track->head; em; em=em->next ) {
			if( em->flg == 1 ) { // some kind of control event
				switch( em->cmd ) {
					case cmdchord:
					case cmdhide:
					case cmdtempo:
					case cmdsync:
						break;
					default:	// check to see if copy is necessary
						ec = abc_copy_event(h, em);
						tm = em->tracktick;
						es = tp->head; // allways search from the begin...
						for( et=es; et && et->tracktick <= tm; et=et->next )
							es = et;
						if( es == NULL || es->tracktick > tm ) {	// special case: head of track
							ec->next = es;
							tp->head = ec;
						}
						else {
							ec->next = es->next;
							es->next = ec;
						}
						break;
				}
			}
		}
	}
	abc_retick_events(h);
}
// make sure every track has the control events it needs, this way it is not
// necessary to have redundant +segno+ +D.C.+ etc in the voices, the first voice
// is the master, it is pointed to by the member 'track' in the ABCHANDLE
make sure every track has the control events it needs, this way it is not
necessary to have redundant +segno+ +D.C.+ etc in the voices, the first voice
is the master, it is pointed to by the member 'track' in the ABCHANDLE
make sure every track has the control events it needs this way it is not necessary to have redundant + segno + + D . C . + etc in the voices the first voice is the master it is pointed to by the member ' track ' in the ABCHANDLE
static void abc_synchronise_tracks(ABCHANDLE *h)
{
	ABCTRACK *tp;
	uint32_t tm;	
	ABCEVENT *em, *es, *et, *ec;	
	if( !h || !h->track ) return;
	abc_remove_unnecessary_events(h);
	for( tp = h->track->next; tp; tp = tp->next ) {
		for( em=h->track->head; em; em=em->next ) {
			if( em->flg == 1 ) { 
				switch( em->cmd ) {
					case cmdchord:
					case cmdhide:
					case cmdtempo:
					case cmdsync:
						break;
					default:	
						ec = abc_copy_event(h, em);
						tm = em->tracktick;
						es = tp->head; 
						for( et=es; et && et->tracktick <= tm; et=et->next )
							es = et;
						if( es == NULL || es->tracktick > tm ) {	
							ec->next = es;
							tp->head = ec;
						}
						else {
							ec->next = es->next;
							es->next = ec;
						}
						break;
				}
			}
		}
	}
	abc_retick_events(h);
}
static void abc_synchronise_tracks ( ABCHANDLE * h ) { ABCTRACK * tp ; uint32_t tm ; ABCEVENT * em , * es , * et , * ec ; if ( ! h || ! h -> track ) return ; abc_remove_unnecessary_events ( h ) ; for ( tp = h -> track -> next ; tp ; tp = tp -> next ) { for ( em = h -> track -> head ; em ; em = em -> next ) { if ( em -> flg == 1 ) { switch ( em -> cmd ) { case cmdchord : case cmdhide : case cmdtempo : case cmdsync : break ; default : ec = abc_copy_event ( h , em ) ; tm = em -> tracktick ; es = tp -> head ; for ( et = es ; et && et -> tracktick <= tm ; et = et -> next ) es = et ; if ( es == NULL || es -> tracktick > tm ) { ec -> next = es ; tp -> head = ec ; } else { ec -> next = es -> next ; es -> next = ec ; } break ; } } } } abc_retick_events ( h ) ; }
make sure every track has the control events it needs, this way it is not
necessary to have redundant +segno+ +D.C.+ etc in the voices, the first voice
is the master, it is pointed to by the member 'track' in the ABCHANDLE
make sure every track has the control events it needs this way it is not necessary to have redundant + segno + + D . C . + etc in the voices the first voice is the master it is pointed to by the member ' track ' in the ABCHANDLE
// tracktime in master // events in master, slave, slave temporary and copied event // some kind of control event // check to see if copy is necessary // allways search from the begin... // special case: head of track