Ejemplo n.º 1
0
void DeleteBlock_CurrPos(
	struct Tracker_Windows *window
){
	struct WBlocks *wblock=window->wblock;
	NInt blockpos;

	PlayStop();

	if(wblock->l.next==NULL && wblock==window->wblocks) return;

	blockpos=window->wblock->l.num;

	Undo_Block_Delete(blockpos);

	DeleteBlock(blockpos);

	wblock=ListFindElement1_r0(&window->wblocks->l,blockpos);

	if(wblock==NULL){
		wblock=ListLast1(&window->wblocks->l);
	}

	SelectWBlock(window,wblock);

	BS_UpdateBlockList();
	BS_UpdatePlayList();
}
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 InitPEQendnote(
	const struct Blocks *block,
	const struct Tracks *track,
	const struct Notes *note,
	int playlistaddpos
){
	NInt tracknum=track->l.num;
	struct PEventQueue *peq=GetPEQelement();
	int orgplaylistaddpos=playlistaddpos;

	peq->TreatMe=PE_StopNote;
	peq->block=block;
	peq->track=track;
	peq->note=note;

	if(
		note->noend==1 &&
		note->end.line==block->num_lines-1 &&
		note->end.counter==MAX_UINT32-1 &&
		note->end.dividor==MAX_UINT32
	){
		if(PC_isPlayingBlock()) playlistaddpos=0;

		for(;;){
			playlistaddpos++;
			const struct Blocks *block=PC_GetPlayBlock(playlistaddpos);
			if(block==NULL){
				ReturnPEQelement(peq);
				return;
			}
			track=ListFindElement1_r0(&block->tracks->l,tracknum);
			if(track!=NULL){
				if(track->notes!=NULL){
					if(track->stops!=NULL){
						PC_InsertElement2(peq,playlistaddpos,PlaceMin(&track->stops->l.p,&track->notes->l.p));
						break;
					}else{
						PC_InsertElement2(peq,playlistaddpos,&track->notes->l.p);
						break;
					}
				}else{
					if(track->stops!=NULL){
						PC_InsertElement2(peq,playlistaddpos,&track->stops->l.p);
						break;
					}
				}
			}
		}
	}else{
		PC_InsertElement2(peq,playlistaddpos,&note->end);
	}

//A small hack here.
	peq->playpos=orgplaylistaddpos;
}
Ejemplo n.º 4
0
void InsertBlock_IncBlockNums(
	NInt blockpos
){
	struct Tracker_Windows *window=root->song->tracker_windows;
	struct WBlocks *wblock;
	struct Blocks *block=ListFindElement1_r0(&root->song->blocks->l,blockpos);

	while(block!=NULL){
		block->l.num++;
		block=NextBlock(block);
	}
	root->song->num_blocks++;
        g_editor_blocks_generation++;

	while(window!=NULL){
		wblock=ListFindElement1_r0(&window->wblocks->l,blockpos);
		while(wblock!=NULL){
			wblock->l.num++;
			wblock=NextWBlock(wblock);
		}
		window=NextWindow(window);
	}
}
Ejemplo n.º 5
0
int AddFXNodeLine(
                  struct Tracker_Windows *window,
                  struct WBlocks *wblock,
                  struct WTracks *wtrack,
                  int fxnum,
                  int val,
                  const Place *p1
){
	struct FXs *fxs=ListFindElement1_r0(&wtrack->track->fxs->l,fxnum);
	struct FXNodeLines *fxnodeline=talloc(sizeof(struct FXNodeLines));

        int ret;
        
        PLAYER_lock();{
          fxnodeline->val=R_BOUNDARIES(fxs->fx->min, val, fxs->fx->max);
          PlaceCopy(&fxnodeline->l.p,p1);
          ret = ListAddElement3_ns(&fxs->fxnodelines,&fxnodeline->l);
        }PLAYER_unlock();

        return ret;
}
Ejemplo n.º 6
0
static void InitPEQnotesBlock(
	PEQ_UsedTracks **UsedTracks,
	const struct Blocks *block,
	const Place *p,
	int playlistaddpos
){
	PEQ_UsedTracks *peq_usedtrack;

	struct Notes *note;
	struct Tracks *track=block->tracks;

	while(track!=NULL){
		if(
			ListFindElement1_r0(*UsedTracks,track->l.num) == NULL
		){
			note=track->notes;
			if(note!=NULL){

				while(PlaceLessThan(&note->l.p,p)){
					note=NextNote(note);
					if(note==NULL) break;
				}

				if(note!=NULL){
					peq_usedtrack=talloc(sizeof(PEQ_UsedTracks));
					peq_usedtrack->num=track->l.num;
					ListAddElement1(UsedTracks,peq_usedtrack);
					InitPEQnote(block,track,note,playlistaddpos);
				} else{

                                  //PEQ_FindNextNoteAddPlayPos(peq);
                                  
                                }
                        }
		}
		track=NextTrack(track);
	}
}
Ejemplo n.º 7
0
int MoveWTrackBorder_Mouse(
	struct Tracker_Windows *window,
	float x,float y
){
	struct WBlocks *wblock=window->wblock;
	struct WTracks *wtrack=(struct WTracks *)ListFindElement1_r0(&wblock->wtracks->l,(NInt)window->prevaction.eint1);

        if(window->prevaction.action==NOACTION)
          window->must_redraw=true; // fix up slightly skewed gradient caused by the direct blitting. (blitting is wrong, but it's faster)

	if(wtrack==NULL) return 0;

	x=R_BOUNDARIES(wtrack->fxarea.x+3, x, wblock->t.x2-3);

	int oldfxwidth=wtrack->fxwidth;

	wtrack->fxwidth=x - wtrack->fxarea.x;
	wtrack->fxwidth=R_MAX(wtrack->fxwidth,2);

	if(oldfxwidth==wtrack->fxwidth && window->prevaction.action!=NOACTION){
	  return 0;
	}

#if !USE_OPENGL
        NInt oldrighttrack=wblock->right_track;

	GFX_BitBlt(window,wtrack->fxwidth-oldfxwidth,0,
		     wtrack->fxarea.x2-2,wblock->a.y1,
		     wblock->a.x2,wblock->t.y2
		     );
#endif

	UpdateWBlockCoordinates(window,wblock);

	DrawAllWTrackHeaders(window,wblock);

#if !USE_OPENGL
	DrawUpWTrack(window,wblock,wtrack);
	
	struct WTracks *wtrack2;

	if(oldfxwidth>wtrack->fxwidth){
	  wtrack2=ListFindElement1(&wblock->wtracks->l,oldrighttrack);
	  while(wtrack2!=NULL && wtrack2->l.num<=wblock->right_track){
	    DrawUpWTrack(window,wblock,wtrack2);
	    DrawWTrackHeader(window,wblock,wtrack2);
	    wtrack2=NextWTrack(wtrack2);
	  }
	}else{
	  while(GetXSubTrack_B2(wblock,window->curr_track,window->curr_track_sub)+3>=wblock->a.x2){
	    window->curr_track_sub--;
	    if(window->curr_track_sub==-2){
	      wblock->wtrack=ListFindElement1(&wblock->wtracks->l,window->curr_track-1);
	      window->curr_track_sub=wblock->wtrack->num_vel-1;
	      window->curr_track--;
	    }
	  }
	}
	
	wtrack2=ListLast1(&wblock->wtracks->l);
	if(wtrack2->fxarea.x2<wblock->a.x2){
          GFX_FilledBox(window,0,
                        wtrack2->fxarea.x2+1,wblock->a.y1,
                        wblock->a.x2,wblock->t.y1,
                        PAINT_BUFFER);
	  GFX_FilledBox(window,0,wtrack2->fxarea.x2+3,wblock->a.y1,wblock->a.x2,wblock->t.y2,PAINT_BUFFER);
          EraseAllLines(window,wblock,
                        wtrack2->x, wtrack2->x2);
	}

	UpdateBottomSlider(window);
	
	if(wtrack->fxarea.x2<wblock->a.x2){
	  Blt_mark(window,wblock->top_realline,wblock->bot_realline,
		   wtrack->fxarea.x2,wblock->a.x2
		   );
	  Blt_marktrackheader(window,wtrack->l.num,wblock->right_track);
	}

#else
	UpdateBottomSlider(window);
        {
            struct WTracks *wtrack2=wtrack;
	    while(wtrack2!=NULL && wtrack2->l.num<=wblock->right_track){
	      DrawAllWTrackHeaders(window,wblock);
	      wtrack2=NextWTrack(wtrack2);
	    }
	  }

#endif
                   //window->must_redraw=true;
	
	return 0;
}
Ejemplo n.º 8
0
struct Tracks *SWIG_getTrack(int blocknum,int tracknum){
  struct WBlocks *wblock=SWIG_getWBlock(blocknum);
  if(wblock==NULL) return NULL;
  if(tracknum==-1) return wblock->wtrack->track;
  return (struct Tracks *)ListFindElement1_r0(&wblock->block->tracks->l,(NInt)tracknum);
}
Ejemplo n.º 9
0
struct Blocks *SWIG_getBlock(int blocknum){
  if(blocknum==-1) return root->song->tracker_windows->wblock->block;
  return (struct Blocks *)ListFindElement1_r0(&root->song->blocks->l,(NInt)blocknum);
}
Ejemplo n.º 10
0
struct Tracker_Windows *getWindowFromNum(int windownum){
	if(windownum==-1) return root->song->tracker_windows;
	return (struct Tracker_Windows *)ListFindElement1_r0(&root->song->tracker_windows->l,(NInt)windownum);
}