コード例 #1
0
ファイル: list.c プロジェクト: jakobvonrotz/radium
void List_InsertPlaceLen3(
	struct Blocks *block,
	void *to,
	struct ListHeader3 *l,
	float place,
	float toplace,
	void (*Insert_PlaceLen_extra)(struct Blocks *block,void *to,struct ListHeader3 *l,float place,float toplace)
){

	while(l!=NULL){
                struct ListHeader3 *next = l->next;

		if(Insert_PlaceLen_extra!=NULL){
			(*Insert_PlaceLen_extra)(block,to,l,place,toplace);
		}
		if(GetfloatFromPlacement(&l->p)>=place){
			if(GetfloatFromPlacement(&l->p)<place-toplace){
				ListRemoveElement3(to,l);
			}else{
				PlaceAddfloat(&l->p,toplace);
				if( ! PlaceLegal(block,&l->p)){
					ListRemoveElement3(to,l);
				}
			}
		}
                
		l = next;
	}

}
コード例 #2
0
void CutNoteAt(struct Blocks *block, struct Tracks *track,struct Notes *note, Place *place){

  R_ASSERT(PLAYER_current_thread_has_lock() || is_playing()==false);
          
  if (PlaceGreaterOrEqual(place, &note->end)){
    RError("Illegal argument for CutNoteAt 1. %f >= %f\n",GetfloatFromPlacement(place),GetfloatFromPlacement(&note->end));
    return;
  }
  
  if (PlaceLessOrEqual(place, &note->l.p)){
    RError("Illegal argument for CutNoteAt 2. %f <= %f\n",GetfloatFromPlacement(place),GetfloatFromPlacement(&note->l.p));
    return;
  }
  
  CutListAt(&note->velocities,place);
  CutListAt(&note->pitches,place);
  PlaceCopy(&note->end,place);

}
コード例 #3
0
ファイル: glissando.c プロジェクト: kmatheussen/radium
static void Glissando(
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	struct Notes *note1
){
//	struct Notes *note;
	struct Notes *note2=NextNote(note1);
	float f1,f,f2;
	Place p;
	int notenote;
	int notediff;

	if(note2==NULL) return;

	notediff=R_ABS(note2->note-note1->note);
	if(notediff==0 || notediff==1) return;

	f1=GetfloatFromPlacement(&note1->l.p);
	f2=GetfloatFromPlacement(&note2->l.p);

        bool up = note2->note > note1->note;

	for(notenote=note1->note;;){

          if (up)
            notenote++;
          else
            notenote--;
          
                if (up){
                  if (notenote>=note2->note)
                    break;
                } else {
                  if (notenote<=note2->note)
                    break;
                }

		f=f1+(
				R_ABS(note1->note-notenote)*(f2-f1)
				/
				notediff
				);
                if (f<0)
                  f=0;
                  
                if (f>=wblock->block->num_lines)
                  break;
                
                Float2Placement(f,&p);                  
                  
		InsertNote(
                           wblock,
                           wtrack,
                           &p,NULL,
                           notenote,
                           (int)(note1->velocity+(
                                                  ((f-f1)*(note2->velocity-note1->velocity))/(f2-f1)
                                                  )),
                           false
                           );

	}

}