bool QtSystemTrayIcon::eventFilter(QObject* object, QEvent* event) {
    if (QObject::eventFilter(object, event)) return true;

    if (object != tray_) return false;

    if (event->type() == QEvent::Wheel) {
        QWheelEvent* e = static_cast<QWheelEvent*>(event);
        if (e->modifiers() == Qt::ShiftModifier) {
            if (e->delta() > 0) {
                emit SeekForward();
            } else {
                emit SeekBackward();
            }
        } else if (e->modifiers() == Qt::ControlModifier) {
            if (e->delta() < 0) {
                emit NextTrack();
            } else {
                emit PreviousTrack();
            }
        } else {
            emit ChangeVolume(e->delta());
        }
        return true;
    }

    return false;
}
Exemple #2
0
static void Scroll_play_down3(
                      struct WBlocks *wblock,
                      const Place *p1,
                      const Place *p2
){
  struct Tracks *track = wblock->block->tracks;

  while(track != NULL){
    struct Patch *patch=track->patch;
    if (patch != NULL){
      struct Notes *note = track->notes;
      while(note != NULL){
        if (PlaceIsBetween2(&note->l.p, p1, p2))
          PATCH_play_note(patch, note->note, note->id, VELOCITY_get(note->velocity), TRACK_get_pan(track));
        
        if (PlaceIsBetween2(&note->end, p1, p2))
          PATCH_stop_note(patch, note->note, note->id);
        
        note = NextNote(note);
      }
    }
    
    track = NextTrack(track);
  }
}
//
// Poll
//
// Poll for track advancement
//
Bool TrackPlayer::Poll()
{
  // Do we need to play the next stream
  if (requested && !Playing())
  {
    return (NextTrack());
  }

  return (FALSE);
}
Exemple #4
0
static void EditNextTrack(GtkWidget *widget,gpointer data)
{
  GripInfo *ginfo;

  ginfo=(GripInfo *)data;

  NextTrack(ginfo);
  /*  gtk_editable_select_region(GTK_EDITABLE(track_edit_entry),0,-1);*/
  gtk_widget_grab_focus(GTK_WIDGET(ginfo->gui_info.track_edit_entry));
}
Exemple #5
0
void InvertBlock(
	struct Blocks *block
){
	struct Tracks *track=block->tracks;

	while(track!=NULL){
		InvertTrack(block,track);
		track=NextTrack(track);
	}
}
Exemple #6
0
void TransposeBlock(
	struct Blocks *block,
	int trans
){
	struct Tracks *track=block->tracks;

	while(track!=NULL){
		TransposeTrack(track,trans);
		track=NextTrack(track);
	}
}
static bool patch_used_in_current_editor_block(struct Patch *patch){
  if(root==NULL || root->song==NULL || root->song->tracker_windows==NULL || root->song->tracker_windows->wblock==NULL || root->song->tracker_windows->wblock->block==NULL){
    R_ASSERT_NON_RELEASE(false);
    return false;
  }
  
  struct Tracks *track = root->song->tracker_windows->wblock->block->tracks;
  while(track != NULL){
    if(track->patch==patch)
      return true;
    track = NextTrack(track);
  }
  return false;
}
Exemple #8
0
static void Scroll_play_down3(
                      struct WBlocks *wblock,
                      const Place *p1,
                      const Place *p2
){
  struct Tracks *track = wblock->block->tracks;

  while(track != NULL){
    
    if (track->onoff==1){
      
      struct Patch *patch=track->patch;
      
      if (patch != NULL){
        
        struct Notes *note = track->notes;
        
        while(note != NULL){
          if (PlaceIsBetween2(&note->l.p, p1, p2))
            PATCH_play_note(patch, 
                            create_note_t(NULL,
                                          note->id,
                                          note->note,
                                          VELOCITY_get(note->velocity),
                                          TRACK_get_pan(track),
                                          ATOMIC_GET(track->midi_channel),
                                          0)
                            );
          
          if (PlaceIsBetween2(&note->end, p1, p2))
            PATCH_stop_note(patch,
                            create_note_t(NULL,
                                          note->id,
                                          note->note,
                                          0,
                                          TRACK_get_pan(track),
                                          ATOMIC_GET(track->midi_channel),
                                          0
                                          )
                            );
          
          note = NextNote(note);
        }
      }
    }
    
    track = NextTrack(track);
  }
}
Exemple #9
0
// Called after loading and undo. Can be called at any time.
void FX_update_all_slider_automation_visuals(void){
  struct Blocks *block = root->song->blocks;
  while(block!=NULL){
    struct Tracks *track = block->tracks;
    while(track!=NULL){
      struct FXs *fxs=track->fxs;
      while(fxs!=NULL){
        fxs->fx->slider_automation_value = OS_SLIDER_obtain_automation_value_pointer(track->patch,fxs->fx->effect_num);
        fxs->fx->slider_automation_color = OS_SLIDER_obtain_automation_color_pointer(track->patch,fxs->fx->effect_num);
        
        fxs = NextFX(fxs);
      }
      track = NextTrack(track);
    }
    block = NextBlock(block);
  }
}
Exemple #10
0
void InitPEQBlockfxs(
	const struct Blocks *block,
	const Place *p
){
	struct Tracks *track=block->tracks;
	struct FXs *fxs;

	while(track!=NULL){
		fxs=track->fxs;

		while(fxs!=NULL){
			InitPEQfxs(block,track,fxs);
			fxs=NextFX(fxs);
		}
		track=NextTrack(track);
	}
}
Exemple #11
0
void InvertRange(
	struct WBlocks *wblock
){
	struct Tracks *track;
	int lokke;
	Place *p1,*p2;

	if( ! wblock->isranged) return;

	p1=getRangeStartPlace(wblock);
	p2=getRangeEndPlace(wblock);

	track=ListFindElement1(&wblock->block->tracks->l,wblock->rangex1);

	for(lokke=0;lokke<=wblock->rangex2-wblock->rangex1;lokke++){
		Invert_notes(track->notes,p1,p2,true,0);
		track=NextTrack(track);
	}

}
Exemple #12
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);
}
Exemple #13
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);
	}
}
Exemple #14
0
void FX_min_max_have_changed_for_patch(struct Patch *patch, NInt fxnum, float old_min, float old_max, float new_min, float new_max){
  struct Blocks *block = root->song->blocks;

  while(block!=NULL){
    struct Tracks *track = block->tracks;

    while(track!=NULL){

      if (track->patch == patch) {
        struct FXs *fxs=track->fxs;
        while(fxs!=NULL){
          if (fxs->l.num == fxnum) {
            struct FX *fx = fxs->fx;
            int fx_min = fx->min;
            int fx_max = fx->max;

            struct FXNodeLines *fxnode = fxs->fxnodelines;

            Undo_FXs(root->song->tracker_windows, block, track, 0);

            while(fxnode != NULL) {
              double real_val = scale_double(fxnode->val, fx_min,  fx_max,  old_min, old_max);
              fxnode->val     = scale_double(real_val,    new_min, new_max, fx_min,  fx_max);
              fxnode = NextFXNodeLine(fxnode);
            }

            block->is_dirty=true;
          }

          fxs = NextFX(fxs);
        }
      }
      track = NextTrack(track);
    }
    block = NextBlock(block);
  }
}
Exemple #15
0
/* 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);
}
Exemple #16
0
void Block_Set_num_lines(
	struct Blocks *block,
	int num_lines
){
	Place lastplace1,lastplace;
	struct Tracker_Windows *window=root->song->tracker_windows;
	struct WBlocks *wblock;
	struct LocalZooms *localzoom;
	struct Tracks *track=block->tracks;
	struct Notes *note;
	struct FXs *fxs;
	int org_num_lines=block->num_lines;
	int lokke;

	if(org_num_lines==num_lines || num_lines<2) return;

	PlaceSetLastPos(block,&lastplace1);

	block->num_lines=num_lines;

	PlaceSetLastPos(block,&lastplace);

	if(num_lines<org_num_lines){

		CutListAt_a(&block->lpbs,&lastplace);
		CutListAt_a(&block->tempos,&lastplace);
		CutListAt_a(&block->temponodes,&lastplace);
		PlaceSetLastPos(block,&block->lasttemponode->l.p);
		ListAddElement3(&block->temponodes,&block->lasttemponode->l);

		while(track!=NULL){
			CutListAt_a(&track->notes,&lastplace);
			note=track->notes;
			while(note!=NULL){
				CutListAt(&note->velocities,&lastplace);
				CutListAt(&note->pitches,&lastplace);
				if(PlaceEqual(&note->end,&lastplace1) && note->noend==1){
					PlaceCopy(&note->end,&lastplace);
				}
				note=NextNote(note);
			}
			LegalizeNotes(block,track);

			CutListAt_a(&track->stops,&lastplace);

			fxs=track->fxs;
			while(fxs!=NULL){
				CutListAt_a(&fxs->fxnodelines,&lastplace);
				fxs=NextFX(fxs);
			}
			LegalizeFXlines(block,track);
			track=NextTrack(track);
		}
		while(window!=NULL){
			wblock=ListFindElement1(&window->wblocks->l,block->l.num);
			CutListAt_a(&wblock->localzooms,&lastplace);
			window=NextWindow(window);
		}
	}else{

		PlaceSetLastPos(block,&block->lasttemponode->l.p);

		while(track!=NULL){
			note=track->notes;
			while(note!=NULL){
				if(PlaceEqual(&note->end,&lastplace1) && note->noend==1){
					PlaceSetLastPos(block,&note->end);
				}
				note=NextNote(note);
			}
			LegalizeNotes(block,track);
			track=NextTrack(track);
		}
		while(window!=NULL){
			wblock=ListFindElement1(&window->wblocks->l,block->l.num);
			for(lokke=org_num_lines;lokke<num_lines;lokke++){
				localzoom=talloc(sizeof(struct LocalZooms));
				localzoom->Tline=lokke;
				localzoom->Tdividor=1;
				localzoom->zoomline=lokke;
				ListAddElement3(&wblock->localzooms,&localzoom->l);
			}
			window=NextWindow(window);
		}

	}


	window=root->song->tracker_windows;

	while(window!=NULL){
		wblock=ListFindElement1(&window->wblocks->l,block->l.num);
                UpdateWBlockWidths(window,wblock);
		UpdateRealLines(window,wblock);
		window=NextWindow(window);
	}

	UpdateSTimes(block);
        UpdateBeats(block);
}