Exemplo n.º 1
0
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;
	}

}
Exemplo n.º 2
0
int addNote2(float notenum,int velocity,
             int line,int counter,int dividor,
             int end_line,int end_counter,int end_dividor, 
             int windownum, int blocknum, int tracknum)
{
  struct Tracker_Windows *window;
  struct WBlocks *wblock=getWBlockFromNumA(-1,&window,blocknum);
  struct WTracks *wtrack=getWTrackFromNum(windownum,blocknum,tracknum);
  if(wblock==NULL || wtrack==NULL) {
    GFX_Message(NULL, "unknown wblock(%p) or wtrack(%p) %d/%d/%d\n",wblock,wtrack,windownum,blocknum,tracknum);
    return -1;
  }

  Place *place = PlaceCreate(line,counter,dividor);

  ValidatePlace(place);

  if (!PlaceLegal(wblock->block, place)) {
    GFX_Message(NULL, "Place %d + %d/%d is not legal", line, counter, dividor);
    return -1;
  }

  Place *end_place = end_line==-1 ? NULL : PlaceCreate(end_line,end_counter,end_dividor);

  ValidatePlace(end_place);

  if (end_place != NULL && !PlaceLegal(wblock->block, end_place)) {
    GFX_Message(NULL, "Place %d + %d/%d is not legal", end_line, end_counter, end_dividor);
    return -1;
  }

  struct Notes *note = InsertNote(wblock,
                                  wtrack,
                                  place,
                                  end_place,
                                  notenum,
                                  velocity,
                                  true);

  window->must_redraw=true;

  return ListFindElementPos3(&wtrack->track->notes->l,&note->l);
}
Exemplo n.º 3
0
void setNoteEndPlace(int line,int counter,int dividor,int windownum,int blocknum,int tracknum,int notenum){
  struct Tracker_Windows *window;
  struct WBlocks *wblock;
  struct WTracks *wtrack;
  struct Notes *note = getNoteFromNumA(windownum, &window, blocknum, &wblock, tracknum, &wtrack, notenum);
  if (note==NULL)
    return;

  Place *place = PlaceCreate(line,counter,dividor);

  if (!PlaceLegal(wblock->block, place)) {
    GFX_Message(NULL, "Place %d + %d/%d is not legal", line, counter, dividor);
    return;
  }

  PlaceCopy(&note->end, place);
}
Exemplo n.º 4
0
int addBPM(int bpm,
           Place place,
           int blocknum)
{
  struct Tracker_Windows *window;
  struct WBlocks *wblock=getWBlockFromNumA(-1,&window,blocknum);
  if(wblock==NULL)
    return -1;

  if (!PlaceLegal(wblock->block, &place)) {
    GFX_Message(NULL, "Place %s is not legal", PlaceToString(&place));
    return -1;
  }

  ADD_UNDO(Tempos_CurrPos(window));

  struct Tempos *tempo = SetTempo(wblock->block,&place,bpm);

  window->must_redraw=true;

  return ListFindElementPos3(&wblock->block->tempos->l,&tempo->l);
}
Exemplo n.º 5
0
int addLPB(int lpb_value,
           Place place,
           int blocknum)
{
  struct Tracker_Windows *window;
  struct WBlocks *wblock=getWBlockFromNumA(-1,&window,blocknum);
  if(wblock==NULL)
    return -1;

  if (!PlaceLegal(wblock->block, &place)) {
    GFX_Message(NULL, "Place %s is not legal", PlaceToString(&place));
    return -1;
  }

  ADD_UNDO(LPBs_CurrPos(window));
  
  struct LPBs *lpb = SetLPB(wblock->block,&place,lpb_value);

  window->must_redraw=true;

  return ListFindElementPos3(&wblock->block->lpbs->l,&lpb->l);
}
Exemplo n.º 6
0
int addSignature(int numerator, int denominator,
                 Place place,
                 int blocknum)
{
  struct Tracker_Windows *window;
  struct WBlocks *wblock=getWBlockFromNumA(-1,&window,blocknum);
  if(wblock==NULL) {
    GFX_Message(NULL, "unknown block(%p)",blocknum);
    return -1;
  }

  if (!PlaceLegal(wblock->block, &place)) {
    GFX_Message(NULL, "Place %s is not legal", PlaceToString(&place));
    return -1;
  }

  ADD_UNDO(Signatures_CurrPos(window));
        
  struct Signatures *signature = SetSignature(wblock->block,&place,ratio(numerator, denominator));

  window->must_redraw=true;

  return ListFindElementPos3(&wblock->block->signatures->l,&signature->l);
}