コード例 #1
0
InstrumentScreen::InstrumentScreen(Tracker *p_tracker,bool p_mini) {
	
	mini_tabbox = p_mini?add(new TabBox,1):0;

	tracker=p_tracker;
	
	MarginGroup *mg=p_mini?mini_tabbox->add("List",new MarginGroup("Inst. List")):add(new MarginGroup("Instrument List"),3);
	
	mg->get_label_hb()->add( new Widget,1);
	edit = mg->get_label_hb()->add( new MenuBox("File.."));
	edit->add_item( "Clear" );
	edit->add_item( "Clear (With Samples)" );
	edit->add_separator();
	edit->add_item( "Load" );
	edit->add_item( "Save" );
	edit->add_separator();
	edit->add_item( "Copy" );
	edit->add_item( "Cut" );
	edit->add_item( "Paste" );
	edit->add_separator();
	edit->add_item( "Remap (separate samples)" );
	edit->add_item( "Remap All" );
	edit->item_selected_signal.connect( this, &InstrumentScreen::instrument_file_action_callback );
	
	HBoxContainer *slit_hb=mg->add(new HBoxContainer,1);
	
	instrument_list=slit_hb->add( new List, 1 );
	slit_hb->add( new VScrollBar, 0 )->set_range( instrument_list->get_range() );
	
	for (int i=0;i<Song::MAX_INSTRUMENTS;i++)
		instrument_list->add_string( "" );
	
	instrument_list->set_number_elements( 1 );
	instrument_list->set_number_min_integers( 2 );
	instrument_list->set_editable( true );
	instrument_list->set_max_string_length( 25 );
	instrument_list->set_incremental_search(false);	
	/* Instrument Global Tab */
	
	mg=p_mini?mini_tabbox->add("Edit",new MarginGroup("")):add(new MarginGroup("Parameters:"),5);
	
	
	sections=mg->add(new TabBox,1);
		
	HBoxContainer *mi_hb=sections->add( "General", new HBoxContainer );
	
	MarginGroup *mi_mg_table=mi_hb->add( new MarginGroup("Sample Table"),0 );
	
	HBoxContainer *st_hb=mi_mg_table->add( new HBoxContainer,1);
	sample_table=st_hb->add( new SampleInstrumentTable(tracker->editor),1);
	sample_table->set_range( st_hb->add( new VScrollBar, 0)->get_range() );
	
	
	VBoxContainer *mi_nna_vb = mi_hb->add( new VBoxContainer, 1);
	
	MarginGroup *mi_mg_nna=mi_nna_vb->add( new MarginGroup("New Note Action"),1);
	CenterContainer *mi_nna_cc=mi_mg_nna->add( new CenterContainer );
	
	VBoxContainer *mi_nna_vb_buttons = new VBoxContainer;
	
	mi_nna_cc->set_frame(mi_nna_vb_buttons);
	
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Cut"),0 ) );
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Continue"),0 ) );
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Off"),0 ) );
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Fade"),0 ) );
	nna_group.current_button_changed_signal.connect(this, &InstrumentScreen::parameter_changed_i );
	
	
	HBoxContainer *mi_nna_hb=mi_nna_vb->add( new HBoxContainer,1);
	
	MarginGroup *mi_nna_mg_dct=mi_nna_hb->add( new MarginGroup("Dup. Check"), 1 );
	
	CenterContainer *mi_dct_cc=mi_nna_mg_dct->add( new CenterContainer );
		
	VBoxContainer *mi_dct_vb_buttons = new VBoxContainer;
	
	mi_dct_cc->set_frame(mi_dct_vb_buttons);
	
	dct_group.add( mi_dct_vb_buttons->add( new Button("Disabled"),0 ) );
	dct_group.add( mi_dct_vb_buttons->add( new Button("Note"),0 ) );
	dct_group.add( mi_dct_vb_buttons->add( new Button("Sample"),0 ) );
	dct_group.add( mi_dct_vb_buttons->add( new Button("Instrument"),0 ) );
	dct_group.current_button_changed_signal.connect(this, &InstrumentScreen::parameter_changed_i );
	

	MarginGroup *mi_nna_mg_dca=mi_nna_hb->add( new MarginGroup("Dup. Action"), 1 );
	
	CenterContainer *mi_dca_cc=mi_nna_mg_dca->add( new CenterContainer );
		
	VBoxContainer *mi_dca_vb_buttons = new VBoxContainer;
	
	mi_dca_cc->set_frame(mi_dca_vb_buttons);
	
	dca_group.add( mi_dca_vb_buttons->add( new Button("Note Cut"),0 ) );
	dca_group.add( mi_dca_vb_buttons->add( new Button("Note Off"),0 ) );
	dca_group.add( mi_dca_vb_buttons->add( new Button("Note Fade"),0 ) );
	dca_group.current_button_changed_signal.connect(this, &InstrumentScreen::parameter_changed_i );
	
	/* Volume Section */
	
	VBoxContainer *vol_vb=sections->add( "Volume", new VBoxContainer );
	
	vol_envelope=vol_vb->add( new EnvelopeEditor(p_tracker->editor,p_mini) ,1 );
	
	mg=vol_vb->add( new MarginGroup("Volume Parameters"),0);
	GridContainer * gr = mg->add( new GridContainer(6), 1 );
	
	gr->add( new Label("Global"), false, false );
	
	
	vol_global_send = gr->add( new HSlider, true, false );
	vol_global_send->get_range()->set_max( 128 );
	vol_global_send->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );

	gr->add( new ValueLabel,false,false)->set_range(vol_global_send->get_range());
	
	
	
	gr->add( new Label("Fade"), false, false );
	
	vol_fadeout = gr->add( new HSlider, true, false );
	vol_fadeout->get_range()->set_max( 256 );
	vol_fadeout->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	
	gr->add( new ValueLabel,false,false)->set_range(vol_fadeout->get_range());
	
	gr->add( new Label("Random"), false, false );
	
	vol_random_send = gr->add( new HSlider, true, false );
	vol_random_send->get_range()->set_max( 100 );
	vol_random_send->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(vol_random_send->get_range());
	
	/* Pan Section */
	
	VBoxContainer *pan_vb=sections->add( "Pan", new VBoxContainer );
	
	pan_envelope=pan_vb->add( new EnvelopeEditor(p_tracker->editor,p_mini),1 );
	
	
	mg=pan_vb->add( new MarginGroup("Panning Parameters"),0);
	gr = mg->add( new GridContainer(6), 1 );
	
	pan_use_default = gr->add( new CheckButton("Default"), false, false );
	pan_use_default->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	pan_default = gr->add( new HSlider, true, false );
	pan_default->get_range()->set_min(-32);	
	pan_default->get_range()->set_max(32);	
	pan_default->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(pan_default->get_range());
	
	gr->add( new Label("PPan Sep"), false, false );
	
	pan_ppsep = gr->add( new HSlider, true, false );

	pan_ppsep->get_range()->set_min(-32);	
	pan_ppsep->get_range()->set_max(32);	
	pan_ppsep->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(pan_ppsep->get_range());
	
	gr->add( new Label("Random"), false, false );
	
	pan_random = gr->add( new HSlider, true, false );
	pan_random->get_range()->set_max(64);	
	pan_random->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(pan_random->get_range());
	
	gr->add( new Label("  Center"), false, false );
	
	pan_ppcenter = gr->add( new HSlider, true, false );
	pan_ppcenter->get_range()->set_max(Note::NOTES-1);	
	pan_ppcenter->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );	
	gr->add( new ValueLabel,false,false)->set_range(pan_ppcenter->get_range());
	
	VBoxContainer *pitch_filter_vb=sections->add( "Pitch/Filter", new VBoxContainer );
	
	pitch_filter_envelope=pitch_filter_vb->add( new EnvelopeEditor(p_tracker->editor,p_mini),1 );
	
	mg=pitch_filter_vb->add( new MarginGroup("Filter"),0);
	gr = mg->add( new GridContainer(6), 1 );
	
	filter_cutoff_default = gr->add( new CheckButton("Cutoff"), false, false );
	filter_cutoff_default->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	filter_cutoff=gr->add( new HSlider, true, false );
	filter_cutoff->get_range()->set_max( 127 );
	filter_cutoff->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );	
	gr->add( new ValueLabel,false,false )->set_range( filter_cutoff->get_range() );
	
	filter_reso_default = gr->add( new CheckButton("Resonance"), false, false );
	filter_reso_default->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	filter_reso=gr->add( new HSlider, true, false );
	filter_reso->get_range()->set_max( 127 );
	filter_reso->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );		
	gr->add( new ValueLabel,false,false )->set_range( filter_reso->get_range() );
	
	env_use_as_filter = pitch_filter_envelope->get_control_box()->add( new CheckButton("Use as Filter"), 1 );
	env_use_as_filter->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	
	
	
	
	/* Final */
	
	instrument_list->selected_signal.connect( this, &InstrumentScreen::instrument_selected );
	instrument_list->item_edited_signal.connect( this, &InstrumentScreen::instrument_name_edited );

	/* File Dialog */
	
	
	updating=true;
	selected=0;
	instrument_selected(0);
	
	file_dialog=0;
}
コード例 #2
0
SampleScreen::SampleScreen(Tracker *p_tracker,bool p_mini) {

	
	mini_tabbox = p_mini?add(new TabBox,1):0;

	tracker=p_tracker;

	MarginGroup *mg=p_mini?mini_tabbox->add("List",new MarginGroup("Sample List")):add(new MarginGroup("Sample List"),3);
	
	mg->get_label_hb()->add( new Widget, 1);
	edit = mg->get_label_hb()->add( new MenuBox("File.."));
	edit->add_item( "Clear" );
	edit->add_separator();
	edit->add_item( "Load" );
	edit->add_item( "Save" );
	edit->add_separator();
	edit->add_item( "Copy" );
	edit->add_item( "Cut" );
	edit->add_item( "Paste" );
	edit->add_separator();
	edit->add_item( "Make Instrument" );
	edit->item_selected_signal.connect( this, &SampleScreen::sample_file_action_callback );
	
	HBoxContainer *slit_hb=mg->add(new HBoxContainer,1);
	
	sample_status=slit_hb->add( new SampleStatusList(p_tracker),0);
	sample_list=slit_hb->add( new List, 1 );
	slit_hb->add( new VScrollBar, 0 )->set_range( sample_list->get_range() );
	sample_status->set_range( sample_list->get_range() );
	
	for (int i=0;i<Song::MAX_SAMPLES;i++)
		sample_list->add_string( "" );
	
	sample_list->set_number_elements( 1 );
	sample_list->set_number_min_integers( 2 );
	sample_list->set_editable( true );
	sample_list->set_max_string_length( 25 );
	sample_list->set_incremental_search(false);
	
	mg=p_mini?mini_tabbox->add("Edit",new MarginGroup("Edit:")):add(new MarginGroup("Parameters:"),5);
	
	mg->get_label_hb()->add( new Widget, 1);
	
//	mg->get_label_hb()->add( new Widget, 1);
	sample_edit = mg->get_label_hb()->add( new MenuBox("Edit"));
	sample_edit->add_item("Copy",SampleEditorEffects::CMD_COPY);
	sample_edit->add_item("Cut",SampleEditorEffects::CMD_CUT);
	sample_edit->add_item("Paste",SampleEditorEffects::CMD_PASTE);
	sample_edit->add_item("Trim",SampleEditorEffects::CMD_TRIM);
	sample_edit->add_separator();
	sample_edit->add_item("PreLoop Cut",SampleEditorEffects::CMD_PRELOOP_CUT);
	sample_edit->add_item("PostLoop Cut",SampleEditorEffects::CMD_POSTLOOP_CUT);
	sample_edit->add_separator();
	sample_edit->add_item("Selection->Loop",SampleEditorEffects::CMD_SEL_TO_LOOP);
	sample_edit->add_item("Align Loop by Resizing",SampleEditorEffects::CMD_LOOP_TO_BOUNDARY);
	sample_edit->add_separator();
	sample_edit->add_item("Unroll Loop",SampleEditorEffects::CMD_LOOP_UNROLL);
	
	sample_edit->item_selected_signal.connect(this,&SampleScreen::sample_data_edit_menu_callback);
	sample_edit->add_separator();
	sample_edit->add_item("Insert Silence at End",SampleEditorEffects::CMD_ADD_SILENCE_AT_END);
	sample_edit->add_separator();
	sample_edit->add_item("Align Loop (ALL SAMPLES)",SampleEditor::CMD_ALIGN_SALL_SAMPLES);
	sample_edit->add_item("Unroll Loop (ALL SAMPLES)",SampleEditor::CMD_UNROLL_ALL_LOOPS);
	sample_edit->add_item("Convert to 16 (ALL SAMPLES)",SampleEditor::CMD_CONVERT_ALL_TO_16);
	sample_edit->add_item("Amplify All (ALL SAMPLES)",SampleEditor::CMD_AMPLIFY_ALL);
	
	
	sample_fx = mg->get_label_hb()->add( new MenuBox("FX"));
	sample_fx->add_item("Toggle Sign",SampleEditorEffects::CMD_TOGGLE_SIGN);
	sample_fx->add_item("Toggle Depth",SampleEditorEffects::CMD_TOGGLE_DEPTH);
	sample_fx->add_item("Toggle Stereo",SampleEditorEffects::CMD_TOGGLE_STEREO);
	sample_fx->add_item("Swap Stereo Chans",SampleEditorEffects::CMD_SWAP_STEREO_CHANS);
	sample_fx->add_separator();
	sample_fx->add_item("Amplify",SampleEditorEffects::CMD_AMPLIFY);
	sample_fx->add_item("Punch Envelope",SampleEditorEffects::CMD_PUNCH_ENVELOPE);
	sample_fx->add_item("Fade In",SampleEditorEffects::CMD_FADE_IN);
	sample_fx->add_item("Fade Out",SampleEditorEffects::CMD_FADE_OUT);
	sample_fx->add_separator();
	sample_fx->add_item("Center",SampleEditorEffects::CMD_CENTER);
	sample_fx->add_item("Reverse",SampleEditorEffects::CMD_REVERSE);
	sample_fx->add_separator();
	sample_fx->add_item("Fix Looping",SampleEditorEffects::CMD_FIX_LOOPING);
	sample_fx->add_item("Resample (Frames)",SampleEditorEffects::CMD_RESAMPLE);
	sample_fx->add_item("Resample (hz)",SampleEditorEffects::CMD_RESAMPLE_FREQ);
	sample_fx->add_item("Delay Left Channel",SampleEditorEffects::CMD_LEFT_CHAN_DELAY);
	sample_fx->add_item("Match Loop End",SampleEditorEffects::CMD_MATCH_LOOP_END_BY_NOTE);
	sample_fx->add_separator();
	sample_fx->add_item("Reverb",SampleEditor::CMD_REVERB);
	
	sample_fx->item_selected_signal.connect(this,&SampleScreen::sample_data_edit_menu_callback);
	
	sample_properties =mg->add( new VBoxContainer, 1 );
	
	sample_list->selected_signal.connect( this, &SampleScreen::list_sample_selected );
	sample_list->item_edited_signal.connect( this, &SampleScreen::sample_name_edited );
	
	sample_editor =  sample_properties->add( new SampleEditor(tracker->editor, tracker->mixer,p_mini), 1);
	
	if (!p_mini)
		sample_properties->add( new HSeparator,0 );
	/* Sample stuff */
	
	HBoxContainer *hbc = p_mini?sample_editor->get_mini_tabbox()->add("Vol/Pan/Vib",new HBoxContainer):sample_properties->add( new HBoxContainer, 0 );
	
	mg = hbc->add( new MarginGroup("Volume"),1);
	
	GridContainer *gc = mg->add( new GridContainer(3), 1);
	
	gc->add( new Label("Global"), false, false );
	
	global_volume=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( global_volume->get_range() );
	
	global_volume->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	gc->add( new Label("Default"), false, false );
	
	default_volume=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( default_volume->get_range() );
	default_volume->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	use_default_pan=gc->add( new CheckButton("Pan"), false, false );
	
	use_default_pan->pressed_signal.connect( this , &SampleScreen::parameter_changed );
	
	default_pan=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( default_pan->get_range() );
	
	default_pan->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	mg = hbc->add( new MarginGroup("Vibrato"),1);
	
	gc = mg->add( new GridContainer(3), 1);
	
	gc->add( new Label("Wave"), false, false );
	
	vibrato_type=gc->add( new ComboBox, true, false );
	
	vibrato_type->add_string( "Sine" );
	vibrato_type->add_string( "Saw" );
	vibrato_type->add_string( "Square" );
	vibrato_type->add_string( "Random" );
	
	vibrato_type->selected_signal.connect( this, &SampleScreen::parameter_changed_c );
	
	gc->add( new Widget, false, false );
	gc->add( new Label("Speed"), false, false );
	
	vibrato_speed=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( vibrato_speed->get_range() );
	
	vibrato_speed->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	gc->add( new Label("Depth"), false, false );
	
	vibrato_depth=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( vibrato_depth->get_range() );
	
	vibrato_depth->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	gc->add( new Label("Rate"), false, false );
	
	vibrato_rate=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( vibrato_rate->get_range() );
	
	vibrato_rate->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	global_volume->get_range()->set_max(64);
	default_volume->get_range()->set_max(64);
	default_pan->get_range()->set_min(-32);
	default_pan->get_range()->set_max(32);
	vibrato_speed->get_range()->set_max(64);
	vibrato_depth->get_range()->set_max(32);
	vibrato_rate->get_range()->set_max(64);
	
	selecting_outside=false;
	updating=false;	
	selected=0;	
	
	sample_file_dialog=0;
	file_dialog=0;
}