Beispiel #1
0
void InsertTracks_CurrPos(
	struct Tracker_Windows *window,
	NInt toinsert
){
	struct WBlocks *wblock;
	NInt curr_track;

	curr_track=window->curr_track;
	if(curr_track<0) return;

	ADD_UNDO(Block_CurrPos(window));

	wblock=window->wblock;

	InsertTracks(window,wblock,curr_track,toinsert);

	if(curr_track>=wblock->block->num_tracks){
		curr_track=wblock->block->num_tracks-1;
	}

	SetCursorPosConcrete(window,wblock,0,-1);

#if !USE_OPENGL
	UpdateAllFXNodeLines(window,wblock);
#endif
	SetCursorPosConcrete(window,wblock,curr_track,-1);

	window->must_redraw = true;

}
void CB_PasteBlock_CurrPos(
	struct Tracker_Windows *window
){
	if(cb_wblock==NULL) return;

        PC_Pause();{

          ADD_UNDO(Block_CurrPos(window));

          CB_PasteBlock(window,cb_wblock,window->wblock);
          SelectWBlock(window,window->wblock);
          
        }PC_StopPause(window);
}
Beispiel #3
0
void IncreaseVelocityCurrPos(struct Tracker_Windows *window,int inc){

        inc = inc * MAX_VELOCITY / 100;

	struct WBlocks *wblock=window->wblock;
	struct WTracks *wtrack=wblock->wtrack;
        
        if(is_track_ranged(wblock,wtrack) && is_realline_ranged(wblock,wblock->curr_realline)){

          vector_t *notes = get_all_ranged_notes(wblock);
          //printf("num_elements: %d\n",notes->num_elements);

          if(notes->num_elements==0)
            return;

          ADD_UNDO(Block_CurrPos(window));

          VECTOR_FOR_EACH(struct Notes *, note, notes){
            increase_note_velocity(note, inc);
          }END_VECTOR_FOR_EACH;
Beispiel #4
0
void InsertLines_CurrPos(
                         struct Tracker_Windows *window,
                         int toinsert
){
	struct WBlocks *wblock=window->wblock;
	int curr_realline=wblock->curr_realline;
	int curr_line=wblock->reallines[curr_realline]->Tline;
	int num_lines=wblock->block->num_lines;

        if(toinsert==0)
	  toinsert=GFX_GetInteger(window,NULL,"Number of lines to insert\n(number can be negative): ",-(num_lines-curr_line),10000);

	if(toinsert==-(num_lines-curr_line)-1) return;

	ADD_UNDO(Block_CurrPos(window));

	InsertLines(window->wblock->block,curr_line,toinsert);

	window=root->song->tracker_windows;
	while(window!=NULL){
		window->must_redraw = true;
		window=NextWindow(window);
	}
}
Beispiel #5
0
void TRACK_split_into_monophonic_tracks(struct Tracker_Windows *window, struct WBlocks *wblock, struct WTracks *wtrack){
  
  PlayStop(); // This function is too chaotic. Don't bother pausing player.

  vector_t notesvector = {0};
  
  struct Tracks *track = wtrack->track;

  struct Notes *notes = track->notes;
  struct Notes *notes_nexttrack = NULL;

  bool have_made_undo = false;

  if (NOTES_sorted_by_pitch_questionmark(track->notes)==false) {
    ADD_UNDO(Block_CurrPos(window));    
    have_made_undo = true;
    notes = NOTES_sort_by_pitch(notes);
  }
  
  while(notes != NULL){

    struct Notes *notes_root = notes;
    
    while(notes != NULL) {

      struct Notes *next = NextNote(notes);
      if (next==NULL)
        break;

      if (PlaceGreaterThan(&notes->end, &next->l.p)){

        if (have_made_undo==false) {
            have_made_undo=true;
        }
        
        ListRemoveElement3(&notes, &next->l);                           
        ListAddElement3_a(&notes_nexttrack, &next->l);

      } else
        notes = next;
    }

    VECTOR_push_back(&notesvector, notes_root);

    notes = notes_nexttrack;
    notes_nexttrack = NULL;
  }

  if (have_made_undo==false){
    GFX_Message(NULL, "Track is already monophonic");
    return;
  }

  int num_tracks = notesvector.num_elements;

  track->notes = NULL;

  struct WTracks *wtrack_copy = CB_CopyTrack(wblock,wtrack);
  VECTOR_clean(&wtrack_copy->track->fxs);

  InsertTracks(window, wblock, wtrack->l.num+1, num_tracks-1);

  printf("Vector length: %d\n",num_tracks);
  int i;
  for(i=0;i<num_tracks;i++){
    struct Notes *notes = notesvector.elements[i];
    printf("  %d: %d\n", i, ListFindNumElements3(&notes->l));
    while(notes != NULL){
      printf("    %s\n",NotesTexts3[(int)notes->note]);
      notes = NextNote(notes);
    }
    
    struct WTracks *towtrack = ListFindElement1(&wblock->wtracks->l, wtrack->l.num+i);
    
    if (i>0)
      co_CB_PasteTrack(wblock, wtrack_copy, towtrack);

    towtrack->track->notes = notesvector.elements[i];
  }

  window->must_redraw = true;
}