Example #1
0
void InitSliderValues(struct Tracker_Windows *window){
  window->leftslider.show=1;
  window->bottomslider.show=1;

  //	twindow->bottomslider.width=twindow->fontwidth;
  window->bottomslider.width = SETTINGS_read_int("bottom_slider_height",window->fontheight*2/3);
  window->leftslider.width   = SETTINGS_read_int("left_slider_width",8);
}
Example #2
0
int MIDI_initInstrumentPlugIn(struct Instruments *instrument){

  MIDI_set_use_0x90_for_note_off(SETTINGS_read_int("use_0x90_for_note_off",0)==0?false:true);

  if(MIDI_New(instrument)==false){
    GFX_Message(NULL, "Unable to open MIDI");
    return INSTRUMENT_FAILED;
  }

  instrument->instrumentname   = "MIDI instrument";
  //instrument->getMaxVelocity = &MIDIgetMaxVelocity;
  instrument->getFxNames       = MIDI_getFxNames;
  instrument->createFX         = MIDI_createFX;
  instrument->getFX            = &MIDIgetFX;
  instrument->getPatch         = &MIDIgetPatch;
  instrument->CloseInstrument  = MIDICloseInstrument;
  instrument->StopPlaying      = MIDIStopPlaying;

  instrument->CopyInstrumentData = MIDI_CopyInstrumentData;
  instrument->PlayFromStartHook  = MIDIPlayFromStartHook;
  instrument->LoadFX             = MIDILoadFX;

  instrument->PP_Update = MIDI_PP_Update;

  instrument->handle_fx_when_theres_a_new_patch_for_track = MIDI_handle_fx_when_theres_a_new_patch_for_track;
  instrument->remove_patch                                = MIDI_remove_patch;

  instrument->setPatchData = MIDISetPatchData;
  instrument->getPatchData = MIDIGetPatchData;

  return INSTRUMENT_SUCCESS;
  
}
Example #3
0
static void create_background_realline(const struct Tracker_Windows *window, const struct WBlocks *wblock, const struct WSignatures *wsignature, int realline){

  const struct WTracks *last_wtrack = (const struct WTracks*)ListLast1(&wblock->wtracks->l);
  const struct LocalZooms *localzoom = wblock->reallines[realline];
  
  //int x1 = wblock->linenumarea.x;
  int x1 = wblock->tempocolorarea.x;
  int x2 = last_wtrack->x2;
  int y1 = get_realline_y1(window, realline);
  int y2 = get_realline_y2(window, realline);

  // background
  {
    if(beat_opacity == -1)
      beat_opacity = SETTINGS_read_int("beat_opacity", 950);

    if(first_beat_opacity == -1)
      first_beat_opacity = SETTINGS_read_int("first_beat_opacity", 870);
    
    GE_Context *c;
 
    if (WSIGNATURE_is_first_beat(wsignature))
      c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), first_beat_opacity, Z_BACKGROUND | Z_STATIC_X);
    else if (wsignature->beat_num>0)
      c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), beat_opacity, Z_BACKGROUND | Z_STATIC_X);
    else {
      if(localzoom->level>0 && localzoom->zoomline>0 && localzoom->autogenerated==false)
        c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(2), 925, Z_BACKGROUND | Z_STATIC_X); // manually splitted line
      else
        c = GE_color_z(15, Z_BACKGROUND | Z_STATIC_X);
    }
    GE_filledBox(c,x1,y1,x2,y2);
  }

  float line_width = 0.6f;

  // realline separator line
  if(1){
    //if(line_opacity == -1)
    //  line_opacity = SETTINGS_read_int("line_opacity", R_MAX(50, beat_opacity-500));
    line_opacity = 900;
    
    if(line_opacity != 1000) {
      GE_Context *c;

      if (WSIGNATURE_is_first_beat(wsignature))
        c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), first_beat_opacity-250, Z_ABOVE(Z_BACKGROUND) | Z_STATIC_X);
      else if (wsignature->beat_num>0)
        c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), beat_opacity-250, Z_ABOVE(Z_BACKGROUND) | Z_STATIC_X);
      else
        c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), line_opacity, Z_ABOVE(Z_BACKGROUND) | Z_STATIC_X);

      if (true) {
        GE_line(c,x1,y1,x2,y1,line_width);

        VECTOR_FOR_EACH(float*, f_pointer, &wsignature->how_much_below){
          float f = *f_pointer;
          if (fabs(f) > 0.1) {
            float y_ = scale(f, 0, 1, y1, y2);
            float x1_ = wblock->linenumarea.x;
            float x2_ = wblock->linenumarea.x2;
            GE_line(c,x1_,y_,x2_,y_,line_width);
          }
        }END_VECTOR_FOR_EACH;

      } else {
Example #4
0
void P2MUpdateSongPosCallBack(void){
	struct Tracker_Windows *window=root->song->tracker_windows;
	bool setfirstpos=ATOMIC_GET(root->setfirstpos);
	NInt curr_block=ATOMIC_GET(root->curr_blocknum);
	struct WBlocks *wblock;
	int till_curr_realline;

        if(scrolls_per_second==-1)
          scrolls_per_second = SETTINGS_read_int("scrolls_per_second", default_scrolls_per_second);

	if(pc->playtype==PLAYSONG)
          BS_SelectPlaylistPos(root->curr_playlist);

	while(window!=NULL){
		if(window->playalong==true){

                  DO_GFX({
                        wblock=ListFindElement1(&window->wblocks->l,curr_blocknum);
			till_curr_realline=ATOMIC_GET(wblock->till_curr_realline);
                        
			if(window->curr_block!=curr_block){
				if(setfirstpos){
					wblock->curr_realline=0;
					SetWBlock_Top_And_Bot_Realline(window,wblock);
				}
				SelectWBlock(
					window,
					wblock
				);
			}

			if(setfirstpos){			// The player routine (PEQblock.c) sets this one.
                          ATOMIC_SET(wblock->till_curr_realline, 0);
                          till_curr_realline=0;
			}

			//fprintf(stderr,"tilline: %d\n",till_curr_realline);
#if 0
                        if(wblock->curr_realline != till_curr_realline)
                          ScrollEditorToRealLine(window,wblock,till_curr_realline);
#else
                        {
                          bool do_scrolling = false;

                          if(wblock != last_wblock)
                            do_scrolling = true;
                          
                          else if (last_time > ATOMIC_GET(pc->therealtime))
                            do_scrolling = true;
                          
                          else if(till_curr_realline < wblock->curr_realline)
                            do_scrolling = true;
                          
                          else if(till_curr_realline > wblock->curr_realline){
                            STime from_time = (STime) ((double)Place2STime(wblock->block, &wblock->reallines[wblock->curr_realline]->l.p) / wblock->block->reltempo);
                            STime to_time   = (STime) ((double)Place2STime(wblock->block, &wblock->reallines[till_curr_realline]->l.p) / wblock->block->reltempo);
                            
                            STime time = to_time - from_time;
                            
                            STime time_necessary_to_scroll = pc->pfreq / scrolls_per_second;
                            
                            if(time>=time_necessary_to_scroll)
                              do_scrolling = true;
                          }

                          if(do_scrolling==true) {
                            ScrollEditorToRealLine(window,wblock,till_curr_realline);
                            last_time = ATOMIC_GET(pc->therealtime);
                            last_wblock = wblock;
                          }
                        }
#endif

                    });
        }