static struct Velocities *add_velocity( int velocityvelocity, const Place *placement, struct Notes *note, int *pos ) { *pos = -1; if(PlaceLessOrEqual(placement, ¬e->l.p)) return NULL; if(PlaceGreaterOrEqual(placement, ¬e->end)) return NULL; struct Velocities *velocity=(struct Velocities*)talloc(sizeof(struct Velocities)); PlaceCopy(&velocity->l.p,placement); velocity->velocity=R_BOUNDARIES(0,velocityvelocity,MAX_VELOCITY); /* ListAddElement3_ns returns -1 (and doesnt do anything else) if there allready is an element with the same placement. */ PLAYER_lock();{ *pos = ListAddElement3_ns(¬e->velocities,&velocity->l); }PLAYER_unlock(); if (*pos==-1) return NULL; else return velocity; }
static void InsertStop( struct Tracker_Windows *window, struct WBlocks *wblock, struct WTracks *wtrack, Place *placement ){ struct Stops *stop; stop = (struct Stops*)talloc(sizeof(struct Stops)); PlaceCopy(&stop->l.p,placement); PLAYER_lock();{ StopAllNotesAtPlace(wblock->block,wtrack->track,placement); ListAddElement3_ns(&wtrack->track->stops,&stop->l); }PLAYER_unlock(); }
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(¬e->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; }
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; }
struct TempoNodes *AddTempoNode( struct Tracker_Windows *window, struct WBlocks *wblock, Place *p, float reltempo ){ struct Blocks *block=wblock->block; struct TempoNodes *temponode; temponode=talloc(sizeof(struct TempoNodes)); temponode->reltempo=reltempo; PlaceCopy(&temponode->l.p,p); Undo_TempoNodes_CurrPos(window); if(ListAddElement3_ns(&block->temponodes,&temponode->l)==-1) { Undo_CancelLastUndo(); return NULL; } else return temponode; }