Ejemplo n.º 1
0
static void reschedule_reallines_because_num_reallines_have_changed_in_wblock3(struct SeqTrack *seqtrack, struct SeqBlock *seqblock, struct WBlocks *wblock, int64_t curr_seqtrack_time){  
  R_ASSERT_NON_RELEASE(seqblock->block != NULL);

  struct Blocks *block = wblock->block;

  if (seqblock->block == block && curr_seqtrack_time < seqblock->t.time2) {
    
    PLAYER_lock();{
      
      curr_seqtrack_time = seqtrack->start_time; // Get accurate seqtrack time, and also update it.
      
      if (curr_seqtrack_time >= seqblock->t.time) {
        if (curr_seqtrack_time < seqblock->t.time2) {
          
          STime stime = seqtime_to_blocktime(seqblock, curr_seqtrack_time - seqblock->t.time);
          Place place = STime2Place(block, stime);
          
          int realline=FindRealLineFor(wblock,0,&place);

          setit(wblock, realline);
            
          realline++;
          
          //printf("    Rescheduling block %d. Realline: %d. Place: %d + %d/%d\n", wblock->l.num, realline, place.line,place.counter,place.dividor);
          RT_schedule_reallines_in_block2(seqtrack, seqblock, wblock, realline);
        }
      }
      
      
    }PLAYER_unlock();
  }
  
}
Ejemplo n.º 2
0
static void AddFXNodeLineCurrPosInternal(struct Tracker_Windows *window, struct WBlocks *wblock, struct WTracks *wtrack, struct FX *fx, const Place *place, float val){

	Undo_FXs_CurrPos(window);

        struct FXs *fxs=ListFindElement1_r0(&wtrack->track->fxs->l,fx->num);
        if (fxs==NULL){
          Place p2;

          int realline=FindRealLineFor(wblock,0,place);
          if(realline>=wblock->num_reallines-5){
            PlaceSetLastPos(wblock->block,&p2);
          }else{
            PlaceCopy(&p2,&wblock->reallines[wblock->curr_realline+3]->l.p);
          }

          AddNewTypeOfFxNodeLine(wblock, wtrack, fx, &p2, val);
        }

	AddFXNodeLine(
                      window,wblock,wtrack,
                      fx->num,
                      val,
                      place
                      );

#if !USE_OPENGL
	UpdateFXNodeLines(window,wblock,wtrack);

	ClearTrack(window,wblock,wtrack,wblock->top_realline,wblock->bot_realline);
	UpdateWTrack(window,wblock,wtrack,wblock->top_realline,wblock->bot_realline);
#endif
}
Ejemplo n.º 3
0
void AddStopsElements(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack
){
	int realline = 0;
	struct Stops *stop=wtrack->track->stops;

	while(stop!=NULL){
		realline=FindRealLineFor(wblock,R_MAX(stop->Tline,realline),&stop->l.p);

		int subrealline=FindSubRealLine(window,wblock,realline,&stop->l.p);
		InsertTRLElementS(
			wtrack,
                        NULL,
			realline,
			TRE_STOPLINE,0,
			(float)subrealline,(float)subrealline,0.0f,(float)(wtrack->fxwidth-2),
			stop
		);

		if(wtrack->trackreallines[realline].note!=0){
			wtrack->trackreallines[realline].note=NOTE_MUL;
		}else{
			wtrack->trackreallines[realline].note=NOTE_STP;
		}
                wtrack->trackreallines[realline].dasnote=NULL;
		stop=NextStop(stop);
	}

}
Ejemplo n.º 4
0
void AddPitchElements(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack
){

  float min_pitch = 10000.0f;
  float max_pitch = -10000.0f;

  TRACK_get_min_and_max_pitches(wtrack->track,&min_pitch, &max_pitch);

  struct Notes *note=wtrack->track->notes;

  while(note!=NULL){
    struct Pitches *pitch=note->pitches;
    int realline = 0;

    while(pitch!=NULL){

      realline=FindRealLineFor(wblock,R_MAX(pitch->Tline,realline),&pitch->l.p);
      int subrealline=FindSubRealLine(window,wblock,realline,&pitch->l.p);

      InsertTRLElementS(
			wtrack,
                        note,
			realline,
                        TRE_THISPITCHLINES,0,
			(float)subrealline,(float)subrealline,0.0f,(float)(wtrack->fxwidth-2),
			pitch
                        );
      
      if (wtrack->trackreallines[realline].note!=0) {
        wtrack->trackreallines[realline].note=NOTE_MUL;
	wtrack->trackreallines[realline].dasnote=NULL;
      } else {
        wtrack->trackreallines[realline].note=pitch->note;
        wtrack->trackreallines[realline].daspitch=pitch;
      }

      pitch=NextPitch(pitch);
    }

    #if !USE_OPENGL
    UpdateWPitches(window, wblock, wtrack, note, min_pitch, max_pitch);
    #endif
    
    note=NextNote(note);
  }
}
Ejemplo n.º 5
0
static bool is_at_last_line_of_note(const struct WBlocks *wblock, const struct Notes *note, int realline){  
  int last_note_line = FindRealLineFor(wblock, 0, &note->end);
  //printf("last_note_line/realline: %d %d\n",last_note_line,realline);

  if (last_note_line == realline)
    return true;

  if (realline>=wblock->num_reallines-1) // Shouldn't happen, but just for safety.
    return false;
  
  struct LocalZooms *realline_plus1 = wblock->reallines[realline+1];
  if (realline_plus1->l.p.counter==0 && last_note_line == realline+1)
    return true;

  return false;
}
Ejemplo n.º 6
0
static void add_fxtext(const struct WBlocks *wblock, FXText_trss &fxtexts, const struct FX *fx, struct FXNodeLines *fxnodeline){

  int realline = FindRealLineFor(wblock, 0, &fxnodeline->l.p);      
  FXText_trs &v = fxtexts[realline];

  FXText fxtext = {0};

  fxtext.p = fxnodeline->l.p;
  fxtext.fx = fx;
  fxtext.fxnodeline = fxnodeline;
  
  fxtext.value = round(scale_double(fxnodeline->val, fx->min, fx->max, 0, 0x100));
  if (fxtext.value==0x100)
    fxtext.value=0xff;
  fxtext.logtype = fxnodeline->logtype;

  TRS_INSERT_PLACE(v, fxtext);
}
Ejemplo n.º 7
0
static void add_tr(const struct WBlocks *wblock, vector_t *trs, const TrackRealline2 *tr){
  int realline = FindRealLineFor(wblock, 0, &tr->p);
  vector_t *v = &trs[realline];
  VECTOR_insert_place(v, &tr->p);
}
Ejemplo n.º 8
0
struct WSignatures *WSignatures_get(
                                    const struct Tracker_Windows *window,
                                    const struct WBlocks *wblock
                                    )
{
        struct WSignatures *wsignatures = (struct WSignatures *)talloc_atomic_clean(sizeof(struct WSignatures)*wblock->num_reallines);

	int realline=0;
        int last_written_realline = -1;
        int last_written_new_bar_realline = -1;
        
        struct Beats *beat = wblock->block->beats;

	while(beat!=NULL){

		realline=FindRealLineFor(wblock,realline,&beat->l.p);
                bool is_new_bar = beat->beat_num==1;
                
                if(PlaceNotEqual(&wblock->reallines[realline]->l.p,&beat->l.p)) {
                  wsignatures[realline].type=SIGNATURE_BELOW;
                  float *f = (float*)talloc_atomic(sizeof(float));
                  float y1 = p_float(wblock->reallines[realline]->l.p);
                  float y2 = realline==wblock->num_reallines-1 ? wblock->num_reallines : p_float(wblock->reallines[realline+1]->l.p);
                  *f = scale( p_float(beat->l.p),
                              y1, y2,
                              0,1);
                  VECTOR_push_back(&wsignatures[realline].how_much_below, f);
                }

                /*
                if (realline==1) {
                  printf("1: %s %d %d %s\n",
                         ratio_to_string(beat->signature),
                         beat->bar_num,
                         beat->beat_num,
                         wsignatures[realline].type != SIGNATURE_MUL ? "true" : "false"
                         );
                }
                */
                
                if (is_new_bar && realline != last_written_new_bar_realline) {  // Unlike the multi-behavior for other wxxx-types, we show the first element, and not the last.
                  
                  wsignatures[realline].signature = beat->signature;
                  wsignatures[realline].bar_num  = beat->bar_num;
                  wsignatures[realline].beat_num  = beat->beat_num;
                  
                } else if (realline != last_written_realline) {
                  
                  wsignatures[realline].signature = beat->signature;
                  wsignatures[realline].bar_num  = beat->bar_num;
                  wsignatures[realline].beat_num  = beat->beat_num;
                  
                } else {
                  
                  wsignatures[realline].type=SIGNATURE_MUL;
                  
		}
        
        
                last_written_realline = realline;
                if (is_new_bar)
                  last_written_new_bar_realline = realline;
		beat = NextBeat(beat);
	}

        return wsignatures;
}
Ejemplo n.º 9
0
void MakeNodeLines(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
        struct WTracks *wtrack,
	Place *p1,
	Place *p2,
	float x1,float x2,
	float minx,float maxx,
	void *extrainfo,
	void (*ReturnNodeLineData)(
		struct Tracker_Windows *window,
		struct WBlocks *wblock,
                struct WTracks *wtrack,
		void *extrainfo,
		int firstlast,
		int realline,
		float u_y1,float u_y2,
		float u_x1,float u_x2
	)
){

  float y1=GetFloatFromPlace(p1);
  float y2=GetFloatFromPlace(p2);

  int realline1=FindRealLineFor(wblock,p1->line,p1);
  int realline2=FindRealLineFor(wblock,R_MAX(realline1,p2->line),p2);

  float ry1,ry2;

  //printf("x1: %f, x2: %f, minx: %f, maxx: %f\n", x1,x2,minx,maxx);

  /* Get rid of minx. */
  x1-=minx;
  x2-=minx;
  maxx-=minx;

  /* Get rid of maxx. */
  x1/=maxx;
  x2/=maxx;

  if(realline2==realline1){
    ry1=GetFloatFromPlace(&(wblock->reallines[realline1]->l.p));
    if(realline1==wblock->num_reallines-1){
      ry2=wblock->block->num_lines;
    }else{
      ry2=GetFloatFromPlace(&(wblock->reallines[realline1+1]->l.p));
    }

    FillInLineRealLine(
		       window,
		       wblock,
                       wtrack,
		       realline1,
		       
		       x1,(float)((y1-ry1)/(ry2-ry1)),
		       x2,(float)((y2-ry1)/(ry2-ry1)),

		       extrainfo,
		       ReturnNodeLineData,
		       NODELINE_FIRSTANDLAST
		       );		

  }else{

    int lokke;
    float direction=(x2-x1)/(y2-y1);

    ry1=GetFloatFromPlace(&(wblock->reallines[realline1]->l.p));
    if(realline1==wblock->num_reallines-1){
      ry2=wblock->block->num_lines;
    }else{
      ry2=GetFloatFromPlace(&(wblock->reallines[realline1+1]->l.p));
    }

    //printf("direction: %f, ry1: %f, ry2: %f\n",direction,ry1,ry2);

    FillInLineRealLine(
		       window,
		       wblock,
                       wtrack,
		       realline1,
		       
		       x1,(float)((y1-ry1)/(ry2-ry1)),
		       (float)((direction*(ry2-y1))+x1),
		       1.0f,
		       
		       extrainfo,
		       ReturnNodeLineData,
		       NODELINE_FIRST
		       );
    
    
    for(lokke=realline1+1;lokke<realline2;lokke++){
      ry1=ry2;
      if(lokke==wblock->num_reallines-1){
	ry2=wblock->block->num_lines;
      }else{
	ry2=GetFloatFromPlace(&(wblock->reallines[lokke+1]->l.p));
      }

      FillInLineRealLine(
			 window,
			 wblock,
                         wtrack,
			 lokke,
			 
			 (float)((direction*(ry1-y1))+x1),
			 0.0f,
			 (float)((direction*(ry2-y1))+x1),
			 1.0f,
			 
			 extrainfo,
			 ReturnNodeLineData,
			 NODELINE_NOTFIRSTORLAST
			 );
    }


    ry1=ry2;

    if(realline2==wblock->num_reallines-1){
      ry2=wblock->block->num_lines;
    }else{
      ry2=GetFloatFromPlace(&(wblock->reallines[realline2+1]->l.p));
    }

    FillInLineRealLine(
		       window,
		       wblock,
                       wtrack,
		       realline2,
		       
		       (float)((direction*(ry1-y1))+x1),
		       0.0f,
		       x2,
		       (float)((y2-ry1)/(ry2-ry1)),
		       
		       extrainfo,
		       ReturnNodeLineData,
		       NODELINE_LAST
		       );
  }
}
Ejemplo n.º 10
0
void RT_schedule_reallines_in_block(struct SeqTrack *seqtrack, struct SeqBlock *seqblock, const Place place){
  struct WBlocks *wblock = (struct WBlocks *)ListFindElement1(&root->song->tracker_windows->wblocks->l,seqblock->block->l.num);
  int realline=FindRealLineFor(wblock,0,&place);

  RT_schedule_reallines_in_block2(seqtrack, seqblock, wblock, realline);
}