Example #1
0
void Keyboard::updateChannels(char side) {

	Fl_Group *group;
	gClick   *add;

	if (side == 0)	{
		group = gChannelsL;
		add   = addChannelL;
	}
	else {
		group = gChannelsR;
		add   = addChannelR;
	}

	//printf("[keyboard::updateChannels] side %d has %d widgets\n", side, group->children());

	for (int i=0; i<group->children(); i++) {
		gChannel *gch = (gChannel*) group->child(i);
		gch->position(gch->x(), group->y()+(i*24));
	}
	group->size(group->w(), group->children()*24);
	add->position(add->x(), group->y()+group->h());

	redraw();
}
Example #2
0
gdSampleEditor::gdSampleEditor(m::SampleChannel* ch)
  : gdWindow(640, 480),
    ch(ch)
{
  using namespace giada::m;

  Fl_Group* upperBar = createUpperBar();
  
  waveTools = new geWaveTools(G_GUI_OUTER_MARGIN, upperBar->y()+upperBar->h()+G_GUI_OUTER_MARGIN, 
    w()-16, h()-128, ch);
  
  Fl_Group* bottomBar = createBottomBar(G_GUI_OUTER_MARGIN, waveTools->y()+waveTools->h()+G_GUI_OUTER_MARGIN, 
  	h()-waveTools->h()-upperBar->h()-32);

  add(upperBar);
  add(waveTools);
  add(bottomBar);

  resizable(waveTools);

  u::gui::setFavicon(this);
  set_non_modal();
  copy_label(ch->name.c_str());

  size_range(720, 480);
  if (conf::sampleEditorX)
    resize(conf::sampleEditorX, conf::sampleEditorY, conf::sampleEditorW, 
    	conf::sampleEditorH);
  
  show();
}
Example #3
0
Fl_Group* gdSampleEditor::createPreviewBox(int x, int y, int h)
{
  Fl_Group* g = new Fl_Group(x, y, 110, h);
  g->begin();
    rewind = new geButton(g->x(), g->y()+(g->h()/2)-12, 25, 25, "", rewindOff_xpm, rewindOn_xpm);
    play   = new geButton(rewind->x()+rewind->w()+4, g->y()+(g->h()/2)-12, 25, 25, "", play_xpm, pause_xpm);
    loop   = new geCheck(play->x()+play->w()+6, g->y()+(g->h()/2)-6, 12, 12, "Loop");
  g->end();

  play->callback(cb_togglePreview, (void*)this);
  rewind->callback(cb_rewindPreview, (void*)this);

  ch->onPreviewEnd = [this] { 
  	play->value(0);
  };

  return g;
}
Example #4
0
Fl_Group* gdSampleEditor::createBottomBar(int x, int y, int h)
{
  Fl_Group* g = new Fl_Group(8, waveTools->y()+waveTools->h()+8, w()-16, h);
  g->begin();
    Fl_Group* previewBox = createPreviewBox(g->x(), g->y(), g->h());

    geBox* divisor1 = new geBox(previewBox->x()+previewBox->w()+8, g->y(), 1, g->h());
    divisor1->box(FL_BORDER_BOX);

    Fl_Group* opTools = createOpTools(divisor1->x()+divisor1->w()+12, g->y(), g->h());

    geBox* divisor2 = new geBox(opTools->x()+opTools->w()+8, g->y(), 1, g->h());
    divisor2->box(FL_BORDER_BOX);

    createInfoBox(divisor2->x()+divisor2->w()+8, g->y(), g->h());

  g->end();
  g->resizable(0);

  return g;
}
Example #5
0
Fl_Group* gdSampleEditor::createInfoBox(int x, int y, int h)
{
  Fl_Group* g = new Fl_Group(x, y, 400, h);
  g->begin();
    info = new geBox(g->x(), g->y(), g->w(), g->h());
  g->end();	

  info->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_TOP);
  
  updateInfo();

  return g;
}
Example #6
0
Fl_Group* gdSampleEditor::createUpperBar()
{
  using namespace giada::m;

  Fl_Group* g = new Fl_Group(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, w()-16, G_GUI_UNIT);
  g->begin();
    grid    = new geChoice(g->x(), g->y(), 50, G_GUI_UNIT);
    snap    = new geCheck(grid->x()+grid->w()+4, g->y()+3, 12, 12, "Snap");
    sep1    = new geBox(snap->x()+snap->w()+4, g->y(), 506, G_GUI_UNIT);
    zoomOut = new geButton(sep1->x()+sep1->w()+4, g->y(), G_GUI_UNIT, G_GUI_UNIT, "", zoomOutOff_xpm, zoomOutOn_xpm);
    zoomIn  = new geButton(zoomOut->x()+zoomOut->w()+4, g->y(), G_GUI_UNIT, G_GUI_UNIT, "", zoomInOff_xpm, zoomInOn_xpm);
  g->end();
  g->resizable(sep1);

  grid->add("(off)");
  grid->add("2");
  grid->add("3");
  grid->add("4");
  grid->add("6");
  grid->add("8");
  grid->add("16");
  grid->add("32");
  grid->add("64");
  if (conf::sampleEditorGridVal == 0)
    grid->value(0);
  else 
    grid->value(grid->find_item(u::string::iToString(conf::sampleEditorGridVal).c_str()));
  grid->callback(cb_changeGrid, (void*)this);

  snap->value(conf::sampleEditorGridOn);
  snap->callback(cb_enableSnap, (void*)this);

  /* TODO - redraw grid if != (off) */

  zoomOut->callback(cb_zoomOut, (void*)this);
  zoomIn->callback(cb_zoomIn, (void*)this);

  return g;
}
Example #7
0
gChannel *Keyboard::addChannel(char side, Channel *ch) {
	Fl_Group *group;
	gClick   *add;

	if (side == 0) {
		group = gChannelsL;
		add   = addChannelL;
	}
	else {
		group = gChannelsR;
		add   = addChannelR;
	}

	gChannel *gch = NULL;

	if (ch->type == CHANNEL_SAMPLE)
		gch = (gSampleChannel*) new gSampleChannel(
				group->x(),
				group->y() + group->children() * 24,
				group->w(),
				20,
				(SampleChannel*) ch);
	else
		gch = (gMidiChannel*) new gMidiChannel(
				group->x(),
				group->y() + group->children() * 24,
				group->w(),
				20,
				(MidiChannel*) ch);

	group->add(gch);
	group->size(group->w(), group->children() * 24);
	add->position(group->x(), group->y()+group->h());
	fixRightColumn();
	redraw();

	return gch;
}
Example #8
0
Fl_Group* gdSampleEditor::createOpTools(int x, int y, int h)
{
  Fl_Group* g = new Fl_Group(x, y, 572, h);
  g->begin();
  g->resizable(0);
    volumeTool = new geVolumeTool(g->x(), g->y(), ch);
    boostTool  = new geBoostTool(volumeTool->x()+volumeTool->w()+4, g->y(), ch);
    panTool    = new gePanTool(boostTool->x()+boostTool->w()+4, g->y(), ch);
   
    pitchTool = new gePitchTool(g->x(), panTool->y()+panTool->h()+8, ch);

    rangeTool = new geRangeTool(g->x(), pitchTool->y()+pitchTool->h()+8, ch);
    shiftTool = new geShiftTool(rangeTool->x()+rangeTool->w()+4, pitchTool->y()+pitchTool->h()+8, ch);
    reload    = new geButton(g->x()+g->w()-70, shiftTool->y(), 70, 20, "Reload");
  g->end();

  if (ch->wave->isLogical()) // Logical samples (aka takes) cannot be reloaded.
    reload->deactivate();

  reload->callback(cb_reload, (void*)this);

  return g;
}
Example #9
0
uiBasis:: uiBasis( Fl_Group &tabs, const BasisInfo  &bi ) :
name( bi.name ),
group( new Fl_Group( tabs.x(), tabs.y()+24, tabs.w(), tabs.h()-24, bi.name.c_str() ) ),
input()
{
    //--------------------------------------------------------------------------
    // record the new tab
    //--------------------------------------------------------------------------
    tabs.add(group);
    group->labelfont( FL_COURIER );
    group->labelsize( 14 );
  
    
    
    static const int bh = 23;
    
    //--------------------------------------------------------------------------
    // create the parameters
    //--------------------------------------------------------------------------
    const int    h     = group->h();
    const size_t nb    = bi.param.size();
    const int    hfree = h - nb * bh;
    const int    hskip = hfree/(nb+1);
    
    int       y = group->y();
    const int x = group->x() + 8;

    for( size_t i=1; i <= nb; ++i )
    {
        y += hskip;
        const string &param = bi.param[i];
        Fl_Input *box = new Fl_Input(x,y,100,bh,param.c_str());
        box->input_type(FL_FLOAT_INPUT);
        box->labeltype( FL_NORMAL_LABEL );
        box->align(FL_ALIGN_RIGHT);
        box->labelfont(FL_HELVETICA);
        box->labelsize(12);
        box->textsize(12);
        box->textfont(FL_HELVETICA);
        group->add(box);
        box->value("0.0");
        y += bh;
        input.push_back(box);
        box->callback(ChangeCB);
        box->when(FL_WHEN_RELEASE);
    }
    
    
    
}
Example #10
0
gdEditor::gdEditor(SampleChannel *ch)
  : gWindow(640, 480),
    ch(ch)
{
  set_non_modal();

  if (G_Conf.sampleEditorX)
    resize(G_Conf.sampleEditorX, G_Conf.sampleEditorY, G_Conf.sampleEditorW, G_Conf.sampleEditorH);

  /* top bar: grid and zoom tools */

  Fl_Group *bar = new Fl_Group(8, 8, w()-16, 20);
  bar->begin();
    grid    = new gChoice(bar->x(), bar->y(), 50, 20);
    snap    = new gCheck(grid->x()+grid->w()+4, bar->y()+4, 12, 12);
    zoomOut = new gClick(bar->x()+bar->w()-20, bar->y(), 20, 20, "", zoomOutOff_xpm, zoomOutOn_xpm);
    zoomIn  = new gClick(zoomOut->x()-24, bar->y(), 20, 20, "", zoomInOff_xpm, zoomInOn_xpm);
  bar->end();
  bar->resizable(new gBox(grid->x()+grid->w()+4, bar->y(), 80, bar->h()));

  /* waveform */

  waveTools = new gWaveTools(8, 36, w()-16, h()-120, ch);
  waveTools->end();

  /* other tools */

  Fl_Group *tools = new Fl_Group(8, waveTools->y()+waveTools->h()+8, w()-16, 130);
  tools->begin();
    volume        = new gDial (tools->x()+50,                    tools->y(), 20, 20, "Volume");
    volumeNum     = new gInput(volume->x()+volume->w()+4,        tools->y(), 46, 20, "dB");

    boost         = new gDial (volumeNum->x()+volumeNum->w()+108, tools->y(), 20, 20, "Boost");
    boostNum      = new gInput(boost->x()+boost->w()+4,           tools->y(), 44, 20, "dB");

    normalize     = new gClick(boostNum->x()+boostNum->w()+54,   tools->y(), 70, 20, "Normalize");
    pan           = new gDial (normalize->x()+normalize->w()+40, tools->y(), 20, 20, "Pan");
    panNum        = new gInput(pan->x()+pan->w()+4,              tools->y(), 45, 20, "%");

    pitch         = new gDial (tools->x()+50,                       volume->y()+volume->h()+4, 20, 20, "Pitch");
    pitchNum      = new gInput(pitch->x()+pitch->w()+4,             volume->y()+volume->h()+4, 46, 20);
    pitchToBar    = new gClick(pitchNum->x()+pitchNum->w()+4,       volume->y()+volume->h()+4, 60, 20, "To bar");
    pitchToSong   = new gClick(pitchToBar->x()+pitchToBar->w()+4,   volume->y()+volume->h()+4, 60, 20, "To song");
    pitchHalf     = new gClick(pitchToSong->x()+pitchToSong->w()+4, volume->y()+volume->h()+4, 20, 20, "", divideOff_xpm, divideOn_xpm);
    pitchDouble   = new gClick(pitchHalf->x()+pitchHalf->w()+4,     volume->y()+volume->h()+4, 20, 20, "", multiplyOff_xpm, multiplyOn_xpm);
    pitchReset    = new gClick(pitchDouble->x()+pitchDouble->w()+4, volume->y()+volume->h()+4, 46, 20, "Reset");
    reload        = new gClick(pitchReset->x()+pitchReset->w()+4,   volume->y()+volume->h()+4, 70, 20, "Reload");

    chanStart     = new gInput(tools->x()+60,                   pitch->y()+pitch->h()+4, 60, 20, "Range");
    chanEnd       = new gInput(chanStart->x()+chanStart->w()+4, pitch->y()+pitch->h()+4, 60, 20, "");
    resetStartEnd = new gClick(chanEnd->x()+chanEnd->w()+4,     pitch->y()+pitch->h()+4, 60, 20, "Reset");

  tools->end();
  tools->resizable(new gBox(panNum->x()+panNum->w()+4, tools->y(), 80, tools->h()));

  /* grid tool setup */

  grid->add("(off)");
  grid->add("2");
  grid->add("3");
  grid->add("4");
  grid->add("6");
  grid->add("8");
  grid->add("16");
  grid->add("32");
  grid->add("64");
  grid->value(G_Conf.sampleEditorGridVal);
  grid->callback(cb_changeGrid, (void*)this);

  snap->value(G_Conf.sampleEditorGridOn);
  snap->callback(cb_enableSnap, (void*)this);

  /* TODO - redraw grid if != (off) */

  char buf[16];
  sprintf(buf, "%d", ch->begin / 2); // divided by 2 because stereo
  chanStart->value(buf);
  chanStart->type(FL_INT_INPUT);
  chanStart->callback(cb_setChanPos, this);

  /* inputs callback: fire when they lose focus or Enter is pressed. */

  chanStart->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
  chanEnd  ->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);

  sprintf(buf, "%d", ch->end / 2);  // divided by 2 because stereo
  chanEnd->value(buf);
  chanEnd->type(FL_INT_INPUT);
  chanEnd->callback(cb_setChanPos, this);

  resetStartEnd->callback(cb_resetStartEnd, this);

  volume->callback(cb_setVolume, (void*)this);
  volume->value(ch->guiChannel->vol->value());

  float dB = 20*log10(ch->volume);   // dB = 20*log_10(linear value)
  if (dB > -INFINITY) sprintf(buf, "%.2f", dB);
  else                sprintf(buf, "-inf");
  volumeNum->value(buf);
  volumeNum->align(FL_ALIGN_RIGHT);
  volumeNum->callback(cb_setVolumeNum, (void*)this);

  boost->range(1.0f, 10.0f);
  boost->callback(cb_setBoost, (void*)this);
  if (ch->boost > 10.f)
    boost->value(10.0f);
  else
    boost->value(ch->boost);
  boost->when(FL_WHEN_CHANGED | FL_WHEN_RELEASE);

  float boost = 20*log10(ch->boost); // dB = 20*log_10(linear value)
  sprintf(buf, "%.2f", boost);
  boostNum->value(buf);
  boostNum->align(FL_ALIGN_RIGHT);
  boostNum->callback(cb_setBoostNum, (void*)this);

  normalize->callback(cb_normalize, (void*)this);

  pan->range(0.0f, 2.0f);
  pan->callback(cb_panning, (void*)this);

  pitch->range(0.01f, 4.0f);
  pitch->value(ch->pitch);
  pitch->callback(cb_setPitch, (void*)this);
  pitch->when(FL_WHEN_RELEASE);

  sprintf(buf, "%.4f", ch->pitch); // 4 digits
  pitchNum->value(buf);
  pitchNum->align(FL_ALIGN_RIGHT);
  pitchNum->callback(cb_setPitchNum, (void*)this);
  pitchNum->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);

  pitchToBar->callback(cb_setPitchToBar, (void*)this);
  pitchToSong->callback(cb_setPitchToSong, (void*)this);
  pitchHalf->callback(cb_setPitchHalf, (void*)this);
  pitchDouble->callback(cb_setPitchDouble, (void*)this);
  pitchReset->callback(cb_resetPitch, (void*)this);

  reload->callback(cb_reload, (void*)this);

  zoomOut->callback(cb_zoomOut, (void*)this);
  zoomIn->callback(cb_zoomIn, (void*)this);

  /* logical samples (aka takes) cannot be reloaded. So far. */

  if (ch->wave->isLogical)
    reload->deactivate();

  if (ch->panRight < 1.0f) {
    char buf[8];
    sprintf(buf, "%d L", (int) std::abs((ch->panRight * 100.0f) - 100));
    pan->value(ch->panRight);
    panNum->value(buf);
  }
  else if (ch->panRight == 1.0f && ch->panLeft == 1.0f) {
    pan->value(1.0f);
    panNum->value("C");
  }
  else {
    char buf[8];
    sprintf(buf, "%d R", (int) std::abs((ch->panLeft * 100.0f) - 100));
    pan->value(2.0f - ch->panLeft);
    panNum->value(buf);
  }

  panNum->align(FL_ALIGN_RIGHT);
  panNum->readonly(1);
  panNum->cursor_color(FL_WHITE);

  gu_setFavicon(this);
  size_range(640, 480);
  resizable(waveTools);

  label(ch->wave->name.c_str());

  show();
}
Example #11
0
gdEditor::gdEditor(SampleChannel *ch)
	: gWindow(640, 480),
		ch(ch)
{
	set_non_modal();

	if (G_Conf.sampleEditorX)
		resize(G_Conf.sampleEditorX, G_Conf.sampleEditorY, G_Conf.sampleEditorW, G_Conf.sampleEditorH);

	Fl_Group *bar = new Fl_Group(8, 8, w()-16, 20);
	bar->begin();
		reload  = new gClick(bar->x(), bar->y(), 50, 20, "Reload");
		zoomOut = new gClick(bar->x()+bar->w()-20, bar->y(), 20, 20, "-");
		zoomIn  = new gClick(zoomOut->x()-24, bar->y(), 20, 20, "+");
	bar->end();
	bar->resizable(new gBox(reload->x()+reload->w()+4, bar->y(), 80, bar->h()));

	waveTools = new gWaveTools(8, 36, w()-16, h()-120, ch);
	waveTools->end();

	Fl_Group *tools = new Fl_Group(8, waveTools->y()+waveTools->h()+8, w()-16, 130);
	tools->begin();
		volume        = new gDial (tools->x()+42,	                   tools->y(), 20, 20, "Volume");
		volumeNum     = new gInput(volume->x()+volume->w()+4,        tools->y(), 46, 20, "dB");

		boost         = new gDial (volumeNum->x()+volumeNum->w()+80, tools->y(), 20, 20, "Boost");
		boostNum      = new gInput(boost->x()+boost->w()+4,          tools->y(), 46, 20, "dB");

		normalize     = new gClick(boostNum->x()+boostNum->w()+40,   tools->y(), 70, 20, "Normalize");
		pan 				  = new gDial (normalize->x()+normalize->w()+40, tools->y(), 20, 20, "Pan");
		panNum    	  = new gInput(pan->x()+pan->w()+4,              tools->y(), 45, 20, "%");

		pitch				  = new gDial  (tools->x()+42,	                     volume->y()+volume->h()+4, 20, 20, "Pitch");
		pitchNum		  = new gInput (pitch->x()+pitch->w()+4,	           volume->y()+volume->h()+4, 46, 20);
		pitchToBar    = new gClick (pitchNum->x()+pitchNum->w()+4,       volume->y()+volume->h()+4, 46, 20, "To bar");
		pitchToSong   = new gClick (pitchToBar->x()+pitchToBar->w()+4,   volume->y()+volume->h()+4, 46, 20, "To song");
		pitchReset    = new gClick (pitchToSong->x()+pitchToSong->w()+4, volume->y()+volume->h()+4, 46, 20, "Reset");

		chanStart     = new gInput(tools->x()+52,                    pitch->y()+pitch->h()+4, 60, 20, "Start");
		chanEnd       = new gInput(chanStart->x()+chanStart->w()+40, pitch->y()+pitch->h()+4, 60, 20, "End");
		resetStartEnd = new gClick(chanEnd->x()+chanEnd->w()+4,      pitch->y()+pitch->h()+4, 46, 20, "Reset");

	tools->end();
	tools->resizable(new gBox(chanStart->x()+chanStart->w()+4, tools->y(), 80, tools->h()));

	char buf[16];
	///sprintf(buf, "%d", ch->beginTrue / 2); // divided by 2 because stereo
	sprintf(buf, "%d", ch->begin / 2); // divided by 2 because stereo
	chanStart->value(buf);
	chanStart->type(FL_INT_INPUT);
	chanStart->callback(cb_setChanPos, this);

	/* inputs callback: fire when they lose focus or Enter is pressed. */

	chanStart->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
	chanEnd  ->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);

	///sprintf(buf, "%d", ch->endTrue / 2);	// divided by 2 because stereo
	sprintf(buf, "%d", ch->end / 2);  // divided by 2 because stereo
	chanEnd->value(buf);
	chanEnd->type(FL_INT_INPUT);
	chanEnd->callback(cb_setChanPos, this);

	resetStartEnd->callback(cb_resetStartEnd, this);

	volume->callback(cb_setVolume, (void*)this);
	volume->value(ch->guiChannel->vol->value());

	float dB = 20*log10(ch->volume);   // dB = 20*log_10(linear value)
	if (dB > -INFINITY)	sprintf(buf, "%.2f", dB);
	else            		sprintf(buf, "-inf");
	volumeNum->value(buf);
	volumeNum->align(FL_ALIGN_RIGHT);
	volumeNum->callback(cb_setVolumeNum, (void*)this);

	boost->range(1.0f, 10.0f);
	boost->callback(cb_setBoost, (void*)this);
	if (ch->boost > 10.f)
		boost->value(10.0f);
	else
		boost->value(ch->boost);
	boost->when(FL_WHEN_CHANGED | FL_WHEN_RELEASE);

	float boost = 20*log10(ch->boost); // dB = 20*log_10(linear value)
	sprintf(buf, "%.2f", boost);
	boostNum->value(buf);
	boostNum->align(FL_ALIGN_RIGHT);
	boostNum->callback(cb_setBoostNum, (void*)this);

	normalize->callback(cb_normalize, (void*)this);

	pan->range(0.0f, 2.0f);
	pan->callback(cb_panning, (void*)this);

	pitch->range(0.01f, 4.0f);
	pitch->value(ch->pitch);
	pitch->callback(cb_setPitch, (void*)this);
	pitch->when(FL_WHEN_RELEASE);

	sprintf(buf, "%.4f", ch->pitch); // 4 digits
	pitchNum->value(buf);
	pitchNum->align(FL_ALIGN_RIGHT);
	pitchNum->callback(cb_setPitchNum, (void*)this);
	pitchNum->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);

	pitchToBar->callback(cb_setPitchToBar, (void*)this);
	pitchToSong->callback(cb_setPitchToSong, (void*)this);
	pitchReset->callback(cb_resetPitch, (void*)this);

	reload->callback(cb_reload, (void*)this);

	zoomOut->callback(cb_zoomOut, (void*)this);
	zoomIn->callback(cb_zoomIn, (void*)this);

	/* logical samples (aka takes) cannot be reloaded. So far. */

	if (ch->wave->isLogical)
		reload->deactivate();

	if (ch->panRight < 1.0f) {
		char buf[8];
		sprintf(buf, "%d L", abs((ch->panRight * 100.0f) - 100));
		pan->value(ch->panRight);
		panNum->value(buf);
	}
	else if (ch->panRight == 1.0f && ch->panLeft == 1.0f) {
	  pan->value(1.0f);
	  panNum->value("C");
	}
	else {
		char buf[8];
		sprintf(buf, "%d R", abs((ch->panLeft * 100.0f) - 100));
		pan->value(2.0f - ch->panLeft);
		panNum->value(buf);
	}

	panNum->align(FL_ALIGN_RIGHT);
	panNum->readonly(1);
	panNum->cursor_color(FL_WHITE);

	gu_setFavicon(this);
	size_range(640, 480);
	resizable(waveTools);

	label(ch->wave->name.c_str());

	show();
}
Example #12
0
gdMidiInputMaster::gdMidiInputMaster()
	: gdMidiInputBase(0, 0, 300, 284, "MIDI Input Setup (global)")
{
	set_modal();

	Fl_Group* groupHeader = new Fl_Group(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, w(), 20);
	groupHeader->begin();

		enable = new geCheck(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, 120, G_GUI_UNIT, 
			"enable MIDI input");
		channel = new geChoice(enable->x()+enable->w()+44, G_GUI_OUTER_MARGIN, 120, G_GUI_UNIT);

	groupHeader->resizable(nullptr);
	groupHeader->end();

	Fl_Pack* pack = new Fl_Pack(G_GUI_OUTER_MARGIN, groupHeader->y()+groupHeader->h()+G_GUI_OUTER_MARGIN, 
		LEARNER_WIDTH, 212);
	pack->spacing(G_GUI_INNER_MARGIN);
	pack->begin();

		new geMidiLearner(0, 0, LEARNER_WIDTH, "rewind",           &cb_learn, &conf::midiInRewind, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "play/stop",        &cb_learn, &conf::midiInStartStop, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "action recording", &cb_learn, &conf::midiInActionRec, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "input recording",  &cb_learn, &conf::midiInInputRec, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "metronome",        &cb_learn, &conf::midiInMetronome, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "input volume",     &cb_learn, &conf::midiInVolumeIn, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "output volume",    &cb_learn, &conf::midiInVolumeOut, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "sequencer ×2",     &cb_learn, &conf::midiInBeatDouble, nullptr);
		new geMidiLearner(0, 0, LEARNER_WIDTH, "sequencer ÷2",     &cb_learn, &conf::midiInBeatHalf, nullptr);

	pack->end();

	ok = new geButton(w()-88, pack->y()+pack->h()+G_GUI_OUTER_MARGIN, 80, G_GUI_UNIT, "Close");

	end();

	ok->callback(cb_close, (void*)this);

	enable->value(conf::midiIn);
	enable->callback(cb_enable, (void*)this);

	channel->add("Channel (any)");
	channel->add("Channel 1");
	channel->add("Channel 2");
	channel->add("Channel 3");
	channel->add("Channel 4");
	channel->add("Channel 5");
	channel->add("Channel 6");
	channel->add("Channel 7");
	channel->add("Channel 8");
	channel->add("Channel 9");
	channel->add("Channel 10");
	channel->add("Channel 11");
	channel->add("Channel 12");
	channel->add("Channel 13");
	channel->add("Channel 14");
	channel->add("Channel 15");
	channel->add("Channel 16");
	channel->value(conf::midiInFilter -1 ? 0 : conf::midiInFilter + 1);
	channel->callback(cb_setChannel, (void*)this);

	u::gui::setFavicon(this);
	show();
}
Example #13
0
gdActionEditor::gdActionEditor(channel *chan)
: gWindow(640, 284), chan(chan), zoom(100)
{

	if (G_Conf.actionEditorW) {
		resize(G_Conf.actionEditorX, G_Conf.actionEditorY, G_Conf.actionEditorW, G_Conf.actionEditorH);
		zoom = G_Conf.actionEditorZoom;
	}

	/* compute values */

	calc();

	/* container with zoom buttons and the action type selector. Scheme of
	 * the resizable boxes: |[--b1--][actionType][--b2--][+][-]| */

	Fl_Group *upperArea = new Fl_Group(8, 8, w()-16, 20);
	upperArea->begin();
	if (chan->type == CHANNEL_SAMPLE) {
	  actionType = new gChoice(8, 8, 80, 20);
	  gridTool   = new gGridTool(actionType->x()+actionType->w()+4, 8, this);
	}
	else
		gridTool   = new gGridTool(8, 8, this);

		gBox *b1   = new gBox(gridTool->x()+gridTool->w()+4, 8, 300, 20);    // padding actionType - zoomButtons
		zoomIn     = new gClick(w()-8-40-4, 8, 20, 20, "+");
		zoomOut    = new gClick(w()-8-20,   8, 20, 20, "-");
	upperArea->end();
	upperArea->resizable(b1);

	if (chan->type == CHANNEL_SAMPLE) {
		actionType->add("key press");
		actionType->add("key release");
		actionType->add("kill chan");
		actionType->value(0);
	}

	gridTool->init(G_Conf.actionEditorGridVal, G_Conf.actionEditorGridOn);
	gridTool->calc();

	if (chan->type == CHANNEL_SAMPLE &&
	   (chan->mode == SINGLE_PRESS   ||
			chan->mode & LOOP_ANY))
		actionType->deactivate();

	zoomIn->callback(cb_zoomIn, (void*)this);
	zoomOut->callback(cb_zoomOut, (void*)this);

	/* main scroller: contains all widgets */

	scroller = new gScroll(8, 36, this->w()-16, this->h()-44);

	if (chan->type == CHANNEL_SAMPLE) {
		ac = new gActionChannel     (scroller->x(), upperArea->y()+upperArea->h()+8, this);
		mc = new gMuteChannel       (scroller->x(), ac->y()+ac->h()+8, this);
		vc = new gEnvelopeChannel   (scroller->x(), mc->y()+mc->h()+8, this, ACTION_VOLUME, RANGE_FLOAT, "volume");
		scroller->add(ac);
		//scroller->add(new gResizerBar(ac->x(), ac->y()+ac->h(), scroller->w(), 8));
		scroller->add(mc);
		//scroller->add(new gResizerBar(mc->x(), mc->y()+mc->h(), scroller->w(), 8));
		scroller->add(vc);
		//scroller->add(new gResizerBar(vc->x(), vc->y()+vc->h(), scroller->w(), 8));

		/* fill volume envelope with actions from recorder */

		vc->fill();

		/* if channel is LOOP_ANY, deactivate it: a loop mode channel cannot
		 * hold keypress/keyrelease actions */

		if (chan->mode & LOOP_ANY)
			ac->deactivate();
	}
	else {
		pr = new gPianoRollContainer(scroller->x(), upperArea->y()+upperArea->h()+8, this);
		scroller->add(pr);
		scroller->add(new gResizerBar(pr->x(), pr->y()+pr->h(), scroller->w(), 8));
	}

	end();

	gu_setFavicon(this);

	char buf[256];
	sprintf(buf, "Edit Actions in Channel %d", chan->index+1);
	label(buf);

	set_non_modal();
	size_range(640, 284);
	resizable(scroller);

	show();
}
Example #14
0
Fl_Double_Window* ResonanceUI::make_window() {
  { resonancewindow = new Fl_Double_Window(780, 305, "Resonance");
    resonancewindow->user_data((void*)(this));
    { khzvalue = new Fl_Value_Output(415, 264, 45, 18, "kHz");
      khzvalue->labelsize(12);
      khzvalue->minimum(0.001);
      khzvalue->maximum(48);
      khzvalue->step(0.01);
      khzvalue->textfont(1);
      khzvalue->textsize(12);
      khzvalue->align(FL_ALIGN_RIGHT);
      //this widget must be before the calling widgets
    } // Fl_Value_Output* khzvalue
    { dbvalue = new Fl_Value_Output(415, 282, 45, 18, "dB");
      dbvalue->labelsize(12);
      dbvalue->minimum(-150);
      dbvalue->maximum(150);
      dbvalue->step(0.1);
      dbvalue->textfont(1);
      dbvalue->textsize(12);
      dbvalue->align(FL_ALIGN_RIGHT);
      //this widget must be before the calling widgets
    } // Fl_Value_Output* dbvalue
    { Fl_Group* o = new Fl_Group(6, 5, 768, 256);
      o->box(FL_BORDER_BOX);
      rg=new ResonanceGraph(o->x(),o->y(),o->w(),o->h(),"");
      rg->init(respar,khzvalue,dbvalue);
      rg->show();
      o->end();
    } // Fl_Group* o
    { Fl_Button* o = new Fl_Button(690, 283, 84, 17, "Close");
      o->box(FL_THIN_UP_BOX);
      o->callback((Fl_Callback*)cb_Close);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(491, 264, 66, 15, "Zero");
      o->tooltip("Clear the resonance function");
      o->box(FL_THIN_UP_BOX);
      o->labelfont(1);
      o->labelsize(12);
      o->callback((Fl_Callback*)cb_Zero);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(491, 282, 66, 18, "Smooth");
      o->tooltip("Smooth the resonance function");
      o->box(FL_THIN_UP_BOX);
      o->labelfont(1);
      o->labelsize(12);
      o->callback((Fl_Callback*)cb_Smooth);
    } // Fl_Button* o
    { Fl_Check_Button* o = enabled = new Fl_Check_Button(6, 270, 78, 27, "Enable");
      enabled->box(FL_THIN_UP_BOX);
      enabled->down_box(FL_DOWN_BOX);
      enabled->callback((Fl_Callback*)cb_enabled);
      o->value(respar->Penabled);
    } // Fl_Check_Button* enabled
    { maxdb = new Fl_Roller(90, 282, 84, 15);
      maxdb->type(1);
      maxdb->minimum(1);
      maxdb->maximum(90);
      maxdb->step(1);
      maxdb->value(30);
      maxdb->callback((Fl_Callback*)cb_maxdb);
    } // Fl_Roller* maxdb
    { Fl_Value_Output* o = maxdbvo = new Fl_Value_Output(126, 264, 24, 18, "Max.");
      maxdbvo->tooltip("The Maximum amplitude (dB)");
      maxdbvo->labelsize(12);
      maxdbvo->minimum(1);
      maxdbvo->maximum(127);
      maxdbvo->step(1);
      maxdbvo->value(30);
      maxdbvo->textfont(1);
      maxdbvo->textsize(12);
      maxdbvo->callback((Fl_Callback*)cb_maxdbvo);
      o->value(respar->PmaxdB);
    } // Fl_Value_Output* maxdbvo
    { new Fl_Box(150, 264, 24, 18, "dB");
    } // Fl_Box* o
    { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(210, 264, 33, 18, "C.f.");
      centerfreqvo->tooltip("Center Frequency (kHz)");
      centerfreqvo->labelsize(12);
      centerfreqvo->minimum(1);
      centerfreqvo->maximum(10);
      centerfreqvo->step(0.01);
      centerfreqvo->value(1);
      centerfreqvo->textfont(1);
      centerfreqvo->textsize(12);
      centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo);
      centerfreqvo->when(3);
      o->value(respar->getcenterfreq()/1000.0);
    } // Fl_Value_Output* centerfreqvo
    { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(210, 282, 33, 18, "Oct.");
      octavesfreqvo->tooltip("No. of octaves");
      octavesfreqvo->labelsize(12);
      octavesfreqvo->minimum(1);
      octavesfreqvo->maximum(127);
      octavesfreqvo->step(1);
      octavesfreqvo->value(30);
      octavesfreqvo->textfont(1);
      octavesfreqvo->textsize(12);
      octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo);
      octavesfreqvo->when(3);
      o->value(respar->getoctavesfreq());
    } // Fl_Value_Output* octavesfreqvo
    { Fl_Button* o = new Fl_Button(566, 276, 42, 12, "RND2");
      o->tooltip("Randomize the resonance function");
      o->box(FL_THIN_UP_BOX);
      o->labelfont(1);
      o->labelsize(10);
      o->callback((Fl_Callback*)cb_RND2);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(566, 264, 42, 12, "RND1");
      o->tooltip("Randomize the resonance function");
      o->box(FL_THIN_UP_BOX);
      o->labelfont(1);
      o->labelsize(10);
      o->callback((Fl_Callback*)cb_RND1);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(566, 288, 42, 12, "RND3");
      o->tooltip("Randomize the resonance function");
      o->box(FL_THIN_UP_BOX);
      o->labelfont(1);
      o->labelsize(10);
      o->callback((Fl_Callback*)cb_RND3);
    } // Fl_Button* o
    { Fl_Check_Button* o = p1st = new Fl_Check_Button(365, 285, 45, 15, "P.1st");
      p1st->tooltip("Protect the fundamental frequency (do not damp the first harmonic)");
      p1st->down_box(FL_DOWN_BOX);
      p1st->labelsize(10);
      p1st->callback((Fl_Callback*)cb_p1st);
      o->value(respar->Pprotectthefundamental);
    } // Fl_Check_Button* p1st
    { Fl_Button* o = new Fl_Button(365, 265, 46, 15, "InterpP");
      o->tooltip("Interpolate the peaks");
      o->box(FL_THIN_UP_BOX);
      o->labelfont(1);
      o->labelsize(10);
      o->callback((Fl_Callback*)cb_InterpP);
    } // Fl_Button* o
    { WidgetPDial* o = centerfreq = new WidgetPDial(master, 245, 265, 30, 30, "C.f.");
      centerfreq->box(FL_ROUND_UP_BOX);
      centerfreq->color(FL_BACKGROUND_COLOR);
      centerfreq->selection_color(FL_INACTIVE_COLOR);
      centerfreq->labeltype(FL_NORMAL_LABEL);
      centerfreq->labelfont(0);
      centerfreq->labelsize(10);
      centerfreq->labelcolor(FL_FOREGROUND_COLOR);
      centerfreq->maximum(127);
      centerfreq->step(1);
      centerfreq->callback((Fl_Callback*)cb_centerfreq);
      centerfreq->align(FL_ALIGN_BOTTOM);
      centerfreq->when(FL_WHEN_CHANGED);
      o->value(respar->Pcenterfreq);
    } // WidgetPDial* centerfreq
    { WidgetPDial* o = octavesfreq = new WidgetPDial(master, 280, 265, 30, 30, "Oct.");
      octavesfreq->box(FL_ROUND_UP_BOX);
      octavesfreq->color(FL_BACKGROUND_COLOR);
      octavesfreq->selection_color(FL_INACTIVE_COLOR);
      octavesfreq->labeltype(FL_NORMAL_LABEL);
      octavesfreq->labelfont(0);
      octavesfreq->labelsize(10);
      octavesfreq->labelcolor(FL_FOREGROUND_COLOR);
      octavesfreq->maximum(127);
      octavesfreq->step(1);
      octavesfreq->callback((Fl_Callback*)cb_octavesfreq);
      octavesfreq->align(FL_ALIGN_BOTTOM);
      octavesfreq->when(FL_WHEN_CHANGED);
      o->value(respar->Poctavesfreq);
    } // WidgetPDial* octavesfreq
    { Fl_Button* o = new Fl_Button(625, 275, 25, 15, "C");
      o->box(FL_THIN_UP_BOX);
      o->color((Fl_Color)179);
      o->labelfont(1);
      o->labelsize(11);
      o->labelcolor(FL_BACKGROUND2_COLOR);
      o->callback((Fl_Callback*)cb_C);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(655, 275, 25, 15, "P");
      o->box(FL_THIN_UP_BOX);
      o->color((Fl_Color)179);
      o->labelfont(1);
      o->labelsize(11);
      o->labelcolor(FL_BACKGROUND2_COLOR);
      o->callback((Fl_Callback*)cb_P);
    } // Fl_Button* o
    { applybutton = new Fl_Button(690, 265, 85, 15, "Apply");
      applybutton->box(FL_THIN_UP_BOX);
      applybutton->labelfont(1);
      applybutton->labelsize(11);
      applybutton->callback((Fl_Callback*)cb_applybutton);
    } // Fl_Button* applybutton
    resonancewindow->end();
  } // Fl_Double_Window* resonancewindow
  return resonancewindow;
}
Example #15
0
ClusterView2D::ClusterView2D(int x, int y, int w, int h, int inResolution, cxVolume * pVolume) : Fl_Gl_Window(x, y, w, h-COLOR_CHOOSER_HEIGHT){

	//mode(FL_ALPHA | FL_DEPTH | FL_DOUBLE | FL_RGB8 );
	//	Fl::add_idle(&idle_cp, (void*)this);
	opacityDisp = 0;
	histogram1D = 0;
	m_dataPts = NULL;
	m_cluster = NULL;
	m_ctrs = NULL;
	m_pVolume = pVolume;
	
	m_percentHeight = (float)COLOR_CHOOSER_HEIGHT / (float) h;
	m_percentWidth = (float)COLOR_CHOOSER_WIDTH / (float) w;
	ClusterView2D *ihateptrs = this; // this is necessary because &this doesnt work.
		
	//m_buttonA = new Fl_Button(x+MARGIN+COLOR_CHOOSER_WIDTH, y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN, BUTTON_WIDTH,BUTTON_HEIGHT, "Reset");
	//m_buttonA->callback((Fl_Callback*)cb_buttonA, this);
	//m_buttonA->resizable(0);
	

	Fl_Group* o = new Fl_Group(	2,
								y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN,
								COLOR_CHOOSER_WIDTH*3,
								COLOR_CHOOSER_HEIGHT*4,"K-Means settings");
    o->box(FL_ENGRAVED_FRAME);
    o->align(FL_ALIGN_TOP_LEFT);

	m_pInputA = new Fl_Input(	o->x()+3,
								o->y()+MARGIN,
								BUTTON_WIDTH*2 + 3*2,
								BUTTON_HEIGHT,"Filename");
    m_pInputA->value("");
	m_pInputA->align(FL_ALIGN_RIGHT);
	
	m_pButtonChooser = new Fl_Button(	(m_pInputA->x()+m_pInputA->w()),
										o->y()+ MARGIN, 
										BUTTON_WIDTH, BUTTON_HEIGHT,"Browse..");
    m_pButtonChooser->callback((Fl_Callback *)cb_ButtonChooser, this);
	
	m_pFileChooser = NULL;
	
	m_inp_tch = new Fl_Input(o->x() + 3, m_pInputA->y()+ BUTTON_HEIGHT*2, BUTTON_WIDTH, BUTTON_HEIGHT, "timesteps intervals");
	m_inp_tch->align(FL_ALIGN_TOP_LEFT);
	m_inp_tch->value("12");
	
	m_inp_t = new Fl_Input(o->x() + 3, m_pInputA->y()+ BUTTON_HEIGHT*3 + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT, "algorithm");
    m_inp_t->align(FL_ALIGN_TOP_LEFT);
	m_inp_t->value("0");
	
	m_inp_k = new Fl_Input(m_inp_tch->x()+m_inp_tch->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*2, BUTTON_WIDTH, BUTTON_HEIGHT, "clusters");
	m_inp_k->align(FL_ALIGN_TOP_LEFT);
	m_inp_k->value("3");
	
	m_inp_s = new Fl_Input(m_inp_t->x()+m_inp_t->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*3 + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT, "stages");
	m_inp_s->align(FL_ALIGN_TOP_LEFT);
	m_inp_s->value("300");
	
	m_inp_start_time = new Fl_Input(m_inp_k->x()+m_inp_k->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*2, 
									BUTTON_WIDTH, BUTTON_HEIGHT, "start timestep");
	m_inp_start_time->align(FL_ALIGN_TOP_LEFT);
	m_inp_start_time->value("0");

	m_inp_total_time = new Fl_Input(m_inp_s->x()+m_inp_s->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*3 + 
									MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT, "number of timesteps");
	m_inp_total_time->align(FL_ALIGN_TOP_LEFT);
	m_inp_total_time->value("120");


	Fl_Button* bt_save = new Fl_Button(	m_inp_tch->x()+m_inp_tch->w() + 3,
										m_pInputA->y()+ BUTTON_HEIGHT*5 + MARGIN*3, 
										BUTTON_WIDTH, BUTTON_HEIGHT,"Create new cluster");
	bt_save->callback((Fl_Callback *)cb_ButtonSave, this);

	Fl_Button* bt_load = new Fl_Button(	bt_save->x()+bt_save->w()+3,
										m_pInputA->y()+ BUTTON_HEIGHT*5 + MARGIN*3, 
										BUTTON_WIDTH, BUTTON_HEIGHT,"Load cluster");
	bt_load->callback((Fl_Callback *)cb_ButtonLoad, this);	

	
	o->end();
	m_pLB = new Fl_Light_Button(o->x() + o->w() + 3,
			 	    (y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN), 
				    BUTTON_WIDTH,BUTTON_HEIGHT, "Show all clusters");
    //m_pLB->labelsize(TEXTSIZE);
    m_pLB->callback((Fl_Callback *)cb_LB, this);
	m_pLB->set();
	m_bshowall = true; 

	m_pButtonNext = new Fl_Button(	o->x() + o->w() + 3,
									(y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN + BUTTON_HEIGHT + 3),
									BUTTON_WIDTH, BUTTON_HEIGHT,"Next Cluster");
    m_pButtonNext->callback((Fl_Callback *)cb_ButtonNext, this);

#ifdef CHANGES
	m_pButtonClear = new Fl_Light_Button(	o->x() + o->w() + 3,
									(y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN + BUTTON_HEIGHT*2 + 6),
									BUTTON_WIDTH, BUTTON_HEIGHT,"Clear Cluster");
    m_pButtonClear->callback((Fl_Callback *)cb_ButtonClear, this);
	m_pButtonClear->set();
	m_bClear = true;
#endif	
/*
	int tch     = 0;        // use all timesteps in calculating KMeans (use only 1 chunk) -tch
int alg     = 0;        // use Lloyd by default  -t option
int	k		= 4;		// number of centers     -k option
int	dim		= 2;		// dimension            
int	stages		= 1000;		// number of stages  -s option

	strcpy(params[0],"");
	strcpy(params[1],"-t");
	strcpy(params[2],"3");
	strcpy(params[3],"-tch");
	strcpy(params[4],"12");
	strcpy(params[5],"-tac");
	strcpy(params[6],filename);
	strcpy(params[7],"-k");
	strcpy(params[8],"3");
	strcpy(params[9],"-s");
	strcpy(params[10],"300");
	main_cluster(nparams, params);
	*/

	m_total_size = 0;
	m_dim = 0;
	m_selcluster = 0;
	m_bInit = false;
	m_nClusters = 0;

	m_xblock = 1;
	m_yblock = 1;
	m_zblock = 1;

	m_datamin = -100;
	m_datamax = 100;
#ifdef SHOW_CLUSTER
	pVolume->SetClusterView(this);
#endif

	srand((unsigned)time( NULL ));
}