コード例 #1
0
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);
}
コード例 #2
0
ファイル: api_noteedit.c プロジェクト: onukore/radium
void setMainBPM(int bpm_value){
  if (bpm_value <=1)
    return;
  if (bpm_value == root->tempo)
    return;

  struct Tracker_Windows *window = root->song->tracker_windows;
  struct WBlocks *wblock = window->wblock;
  
  ADD_UNDO(MainTempo(window,wblock));

  PC_Pause();{
    root->tempo=bpm_value;
    UpdateAllSTimes();
  }PC_StopPause(window);
}
コード例 #3
0
ファイル: track_insert.c プロジェクト: onukore/radium
void InsertTracks(
                  struct Tracker_Windows *window,
                  struct WBlocks *wblock,
                  NInt tracknum,
                  NInt toinsert
){
	NInt lokke;
	NInt num_tracks;
	struct Blocks *block=wblock->block;
	struct WTracks *wtrack;
	struct Tracks *track;

	if(tracknum>=block->num_tracks+1 || tracknum<0) return;

	if(toinsert<=0){
          if(toinsert<0) DeleteTracks(window,wblock,tracknum,-toinsert);
          return;
	}

	num_tracks=block->num_tracks+toinsert;

        PC_Pause();{
          Block_Set_num_tracks(block,num_tracks);

          for(lokke=num_tracks-1;lokke>=tracknum+toinsert;lokke--){
            wtrack=CB_CopyTrack(
                                wblock,
                                ListFindElement1(&wblock->wtracks->l,lokke-toinsert)
                                );
            co_CB_PasteTrack(
                             wblock,
                             wtrack,
                             ListFindElement1(&wblock->wtracks->l,lokke)
                             );
          }
          
          for(lokke=tracknum;lokke<tracknum+toinsert;lokke++){
            wtrack=ListFindElement1(&wblock->wtracks->l,lokke);
            track=wtrack->track;
            
            track->notes=NULL;
            track->stops=NULL;
            VECTOR_clean(&track->fxs);
            track->patch=NULL;
          }
        }PC_StopPause(NULL);
}
コード例 #4
0
ファイル: track_insert.c プロジェクト: onukore/radium
void DeleteTracks(
                  struct Tracker_Windows *window,
                  struct WBlocks *wblock,
                  NInt tracknum,
                  NInt todelete
                  )
{
	NInt lokke;
	NInt num_tracks;
	struct Blocks *block=wblock->block;
	struct WTracks *wtrack;

        if(tracknum>=block->num_tracks+1 || tracknum<0) return;
                
	if(tracknum-todelete>=block->num_tracks){
	  todelete=block->num_tracks-tracknum;
	}

        PC_Pause();
          
	if(block->num_tracks==1){
          CB_CutTrack_CurrPos(window);
          goto exit;
        }

	num_tracks=block->num_tracks-todelete;
	
	fprintf(stderr,"delete track. Curr: %d, num_tracks: %d, todelete: %d\n",tracknum,num_tracks,todelete);

	for(lokke=tracknum ; lokke<num_tracks-1+todelete;lokke++){
	  wtrack=CB_CopyTrack(
			      wblock,
			      ListFindElement1(&wblock->wtracks->l,lokke+todelete)
			      );
	  co_CB_PasteTrack(
                           wblock,
                           wtrack,
                           ListFindElement1(&wblock->wtracks->l,lokke)
                           );
	}
	
	Block_Set_num_tracks(block,num_tracks);

 exit:
        PC_StopPause(NULL);
}
コード例 #5
0
ファイル: api_noteedit.c プロジェクト: onukore/radium
void setMainSignature(int numerator, int denominator){
  if (numerator<=0 || denominator<=0)
    return;
  if (numerator==root->signature.numerator && denominator==root->signature.denominator)
    return;
  
  struct Tracker_Windows *window = root->song->tracker_windows;
  struct WBlocks *wblock = window->wblock;

  ADD_UNDO(MainTempo(window,wblock));

  PC_Pause();{
    root->signature = ratio(numerator, denominator);
    UpdateAllBeats();
  }PC_StopPause(window);
  
  window->must_redraw = true;
}
コード例 #6
0
ファイル: pitches.c プロジェクト: jakobvonrotz/radium
struct Pitches *AddPitch(struct Tracker_Windows *window, struct WBlocks *wblock, struct WTracks *wtrack, struct Notes *note, Place *place, float notenum){
  struct Pitches *pitch = talloc(sizeof(struct Pitches));
  PlaceCopy(&pitch->l.p,place);
  pitch->note = notenum;
  //pitch->note_note = note;

  int pos;
  PC_Pause(); {
    pos=ListAddElement3_ns(&note->pitches, &pitch->l);
  }PC_StopPause();

  if(pos==-1)
    return NULL;
  
#if !USE_OPENGL
  ClearTrack(window,wblock,wtrack,wblock->top_realline,wblock->bot_realline);
  UpdateWTrack(window,wblock,wtrack,wblock->top_realline,wblock->bot_realline);
#endif
  return pitch;
}
コード例 #7
0
ファイル: api_noteedit.c プロジェクト: onukore/radium
void setMainLPB(int lpb_value){
  if (lpb_value <=1)
    return;
  if (lpb_value == root->lpb)
    return;
  
  struct Tracker_Windows *window = root->song->tracker_windows;
  struct WBlocks *wblock = window->wblock;

  printf("Undo MainTempo lpb: %d\n",lpb_value);
  ADD_UNDO(MainTempo(window,wblock));

  PC_Pause();{
    root->lpb=lpb_value;
    UpdateAllSTimes();
    UpdateAllBeats();
  }PC_StopPause(window);
  
  //UpdateAllWLPBs(window);
  window->must_redraw = true;
}
コード例 #8
0
void CutRange(
	struct Blocks *block,
	NInt starttrack,
	NInt endtrack,
	Place *p1,
	Place *p2
){
	struct Tracks *track;
	int lokke;

        endtrack = R_MIN(block->num_tracks-1, endtrack);
        if (endtrack < starttrack)
          return;
        
	track=ListFindElement1(&block->tracks->l,starttrack);

        PC_Pause();{

          for(lokke=0;lokke<=endtrack-starttrack;lokke++){
            CutRange_notes(&track->notes,track->notes,p1,p2);
            CutRange_stops(&track->stops,track->stops,p1,p2);
            track=NextTrack(track);
            if(track==NULL) break;
          }
          
          Place *startplace = p1;
          Place *endplace = p2;

          SCHEME_eval(
                      talloc_format("(cut-fx-range! %d %d %d (+ %d (/ %d %d)) (+ %d (/ %d %d)))",
                                    block->l.num,
                                    starttrack,
                                    endtrack,
                                    startplace->line, startplace->counter, startplace->dividor,
                                    endplace->line, endplace->counter, endplace->dividor
                                  )
                      );
          
        }PC_StopPause(NULL);
}
コード例 #9
0
ファイル: block_insert.c プロジェクト: kmatheussen/radium
struct Blocks *InsertBlock_CurrPos(
                                   struct Tracker_Windows *window
                                   )
{
	struct WBlocks *wblock=window->wblock;
	NInt blockpos=wblock->l.num;

	ADD_UNDO(Block_Insert(blockpos));

        struct Blocks *ret;
        
        PC_Pause();{
          ret = InsertBlock(blockpos,wblock->block->num_tracks,wblock->block->num_lines,"NN");

          SelectWBlock(window,(struct WBlocks *)ListFindElement1(&window->wblocks->l,blockpos));

          BS_UpdateBlockList();
          BS_UpdatePlayList();

        }PC_StopPause(window);

        return ret;
}
コード例 #10
0
ファイル: time.c プロジェクト: onukore/radium
void UpdateSTimes(struct Blocks *block){
	STimePlace stp;

	STP_Constructor(&stp,block);

	do{
		STP_fillinSTimeTempos(&stp);
	}while(STP_getNextTimePlace(&stp));

        PC_Pause();{
          block->times = (const struct STimes*)stp.times;
          block->num_time_lines = block->num_lines;
        }PC_StopPause(NULL);

        STP_fillinLastSTimeTempos(&stp);


        //update_is_beat(block, stp.times);

#if 0
	PrintSTimes(block);
#endif

}
コード例 #11
0
void CB_PasteTrack_CurrPos(struct Tracker_Windows *window){
	struct WBlocks *wblock=window->wblock;
	struct Blocks *block=wblock->block;
	struct WTracks *wtrack=wblock->wtrack;
	Place lastplace;

	PlaceSetLastPos(wblock->block,&lastplace);

        PC_Pause();
                  
	switch(window->curr_track){
		case SIGNATURETRACK:
                  if(cb_signature==NULL) goto exit;
			ADD_UNDO(Signatures_CurrPos(window));
			block->signatures=CB_CopySignatures(cb_signature);
			CutListAt_a(&block->signatures,&lastplace);
                        UpdateWBlockWidths(window, wblock);
                        UpdateBeats(block);
			//UpdateSTimes(block);
			//UpdateWLPBs(window,wblock);
			break;
		case LPBTRACK:
			if(cb_lpb==NULL) goto exit;
			ADD_UNDO(LPBs_CurrPos(window));
			block->lpbs=CB_CopyLPBs(cb_lpb);
			CutListAt_a(&block->lpbs,&lastplace);
			UpdateSTimes(block);
			//UpdateWLPBs(window,wblock);
                        UpdateBeats(block);
#if !USE_OPENGL
			DrawUpLPBs(window,wblock);
#endif
			break;
		case TEMPOTRACK:
			if(cb_tempo==NULL) goto exit;
			ADD_UNDO(Tempos_CurrPos(window));
			block->tempos=CB_CopyTempos(cb_tempo);
			CutListAt_a(&block->tempos,&lastplace);
			//UpdateWTempos(window,wblock);
#if !USE_OPENGL
			DrawUpTempos(window,wblock);
#endif
			UpdateSTimes(block);
			break;
		case TEMPONODETRACK:
			if(cb_temponode==NULL) goto exit;
			ADD_UNDO(TempoNodes_CurrPos(window));
			block->temponodes=CB_CopyTempoNodes(cb_temponode);
			CutListAt_a(&block->temponodes,&lastplace);
			LegalizeTempoNodes(block);
#if !USE_OPENGL
			///UpdateWTempoNodes(window,wblock);
			DrawUpWTempoNodes(window,wblock);
#endif
			UpdateSTimes(block);
			break;
		default:
			if(cb_wtrack==NULL) goto exit;

                        Undo_Open_rec();{
                          printf("curr_track_sub: %d\n",window->curr_track_sub);
                          ADD_UNDO(Track_CurrPos(window));
                          
                          if(window->curr_track_sub==-1 && cb_wtrack_only_contains_one_fxs==false){

                            // copy all
                            
                            printf("aaa\n");
                            if(co_CB_PasteTrack(wblock,cb_wtrack,wtrack)){
#if !USE_OPENGL
                              UpdateFXNodeLines(window,wblock,wtrack);
#endif
                              window->must_redraw = true;
                            }else{
#if !USE_OPENGL
                              UpdateAndClearSomeTrackReallinesAndGfxWTracks(
                                                                            window,
                                                                            wblock,
                                                                            window->curr_track,
                                                                            window->curr_track
                                                                            );
#endif
                            }
                          }else{
                            printf("bbb\n");

                            // only copy fx
                            
                            struct WTracks *fromwtrack = cb_wtrack;
                                                                                    
                            if (cb_wtrack_only_contains_one_fxs==true){

                              // only copy one fx
                              
                              R_ASSERT(cb_wtrack->track->fxs.num_elements==1);

                              struct FXs *fxs = cb_wtrack->track->fxs.elements[0];
                              
                              vector_t *fxss = VECTOR_copy(&wtrack->track->fxs);
                              remove_fxs_from_fxss(fxss, fxs);
                              
                              VECTOR_push_back(fxss, fxs);
                              
                              fromwtrack = CB_CopyTrack(wblock, cb_wtrack);
                              fromwtrack->track->fxs = *VECTOR_copy(fxss);
                            }
                            
                            if(co_CB_PasteTrackFX(wblock,fromwtrack,wtrack)){
#if !USE_OPENGL
                              UpdateFXNodeLines(window,wblock,wtrack);
#endif
                              window->must_redraw = true;
                            }else{
#if !USE_OPENGL
                              UpdateAndClearSomeTrackReallinesAndGfxWTracks(
                                                                            window,
                                                                            wblock,
                                                                            window->curr_track,
                                                                            window->curr_track
                                                                            );
#endif
                            }
                          }

                        }Undo_Close();
                        
			break;
	}

        SetNotePolyphonyAttributes(wtrack->track);
        ValidateCursorPos(window);


 exit:
        PC_StopPause(window);
}
コード例 #12
0
ファイル: lines.c プロジェクト: onukore/radium
/* Argh. This one was difficult, I don`t think it works correctly
   in all situations yet either.
*/
void InsertLines(
	struct Blocks *block,
	int line,
	int toinsert
){
	int lokke;
	struct LocalZooms *localzoom;
	struct Tracker_Windows *window=root->song->tracker_windows;
	struct WBlocks *wblock;
	struct Tracks *track=block->tracks;

	int num_lines=block->num_lines;

	if(line>num_lines+toinsert){
		toinsert=line-num_lines;
	}

        if (line==num_lines-1) { // special case
          Block_Properties(block, block->num_tracks, block->num_lines + toinsert);
          return;
        }
        
	if( line<0 || line>=num_lines) return;

	if(toinsert==0 || num_lines+toinsert<2 || num_lines+toinsert>=MAX_UINT32) return;

        
        PC_Pause();{
        
          blocktobelongtoforinsertlines_notes_a_terrible_hack=block;
          
          block->num_lines=num_lines+toinsert;
          
          List_InsertLines3(&block->temponodes,block->temponodes->l.next,line,toinsert,NULL);
          LegalizeTempoNodes(block);
          List_InsertLines3(&block->signatures,&block->signatures->l,line,toinsert,NULL);
          List_InsertLines3(&block->lpbs,&block->lpbs->l,line,toinsert,NULL);
          List_InsertLines3(&block->tempos,&block->tempos->l,line,toinsert,NULL);
          
          UpdateSTimes(block);
          UpdateBeats(block);

          while(track!=NULL){
            List_InsertLines3(&track->notes,&track->notes->l,line,toinsert,InsertLines_notes);
            LegalizeNotes(block,track);
            List_InsertLines3(&track->stops,&track->stops->l,line,toinsert,NULL);
            VECTOR_FOR_EACH(struct FXs *fxs, &track->fxs){
              List_InsertLines3(&fxs->fxnodelines,&fxs->fxnodelines->l,line,toinsert,NULL);
            }END_VECTOR_FOR_EACH;
            LegalizeFXlines(block,track);
            track=NextTrack(track);
          }

          while(window!=NULL){
            wblock=ListFindElement1(&window->wblocks->l,block->l.num);
            List_InsertLines3(
                              &wblock->localzooms,
                              &wblock->localzooms->l,
                              line,
                              toinsert,
                              InsertLines_localzooms
                              //			NULL
                              );
            for(lokke=line;lokke<line+toinsert;lokke++){
              localzoom=talloc(sizeof(struct LocalZooms));
              localzoom->Tline=lokke;
              localzoom->Tdividor=1;
              localzoom->zoomline=lokke;
              ListAddElement3(&wblock->localzooms,&localzoom->l);
            }
            UpdateWBlockWidths(window,wblock);
            wblock->reallines = NULL; // We changed the localzooms, which is used to set new curr_realline. We don't need to set new curr_realline, so just set reallines to NULL.
            UpdateRealLines(window,wblock);
            UpdateReallinesDependens(window,wblock);
            if(wblock->curr_realline>=wblock->num_reallines){
              wblock->curr_realline=wblock->num_reallines-1;
            }
            window=NextWindow(window);
          }
          
          blocktobelongtoforinsertlines_notes_a_terrible_hack=NULL;

        }PC_StopPause(window);
}
コード例 #13
0
void Scroll_scroll(
                   struct Tracker_Windows *window,
                   int num_lines
){

  bool dopause = (ATOMIC_GET(root->play_cursor_onoff)==false);
  
  if (dopause)
    PC_Pause();
  
//  int lokke;
	struct WBlocks *wblock=window->wblock;

#if !USE_OPENGL

	int top_realline=wblock->top_realline;
	int bot_realline=wblock->bot_realline;

	/*
	if(num_lines<0){
		Scroll_freePixMapLines(window,bot_realline+num_lines+1,bot_realline);
	}else{
		Scroll_freePixMapLines(window,top_realline,top_realline+num_lines-1);
	}

//	printf("scroll1:\n");
//  for(lokke=0;lokke<window->wblock->num_visiblelines;lokke++)
//    printf("vis: %d, val: %d\n",lokke,window->pixmapdefs[lokke]);

	*/

	//	Scroll_scrollPixMapDefs(window,num_lines);

	PixMap_scrollDefs(
		window,
		num_lines
	);
#endif

//	printf("scroll2:\n");
//  for(lokke=0;lokke<window->wblock->num_visiblelines;lokke++)
//    printf("vis: %d, val: %d\n",lokke,window->pixmapdefs[lokke]);

	wblock->top_realline+=num_lines;
	wblock->curr_realline+=num_lines;
	wblock->bot_realline+=num_lines;

        //printf("scroll: Set realline to %d (%d)\n",wblock->curr_realline,num_lines);
        GE_set_curr_realline(wblock->curr_realline);

#if !USE_OPENGL
	if(num_lines<0){
		Scroll_makePixMapLines(window,top_realline+num_lines,top_realline-1);
	}else{
		Scroll_makePixMapLines(window,bot_realline+1,bot_realline+num_lines);
	}
#endif

        if (dopause)
          PC_StopPause(window);

        
//	printf("scroll3: n: %d\n",num_lines);
//  for(lokke=0;lokke<window->wblock->num_visiblelines;lokke++)
//    printf("vis: %d, val: %d\n",lokke,window->pixmapdefs[lokke]);

	/*
	Scroll_drawPixMaps(window,wblock->top_realline,wblock->bot_realline);
	*/
}