void ags_drum_input_line_connect(AgsConnectable *connectable) { AgsDrum *drum; AgsDrumInputLine *drum_input_line; GList *line_member; drum_input_line = AGS_DRUM_INPUT_LINE(connectable); if((AGS_LINE_CONNECTED & (AGS_LINE(drum_input_line)->flags)) != 0){ return; } ags_drum_input_line_parent_connectable_interface->connect(connectable); /* AgsDrumInputLine */ drum = AGS_DRUM(gtk_widget_get_ancestor((GtkWidget *) AGS_LINE(drum_input_line)->pad, AGS_TYPE_DRUM)); /* AgsAudio */ g_signal_connect_after(G_OBJECT(AGS_MACHINE(drum)->audio), "set_pads\0", G_CALLBACK(ags_drum_input_line_audio_set_pads_callback), drum_input_line); /* AgsDrumInputLine */ }
void ags_drum_output_line_add_default_recall(AgsDrumOutputLine *drum_output_line) { AgsDrum *drum; AgsLine *line; AgsAudio *audio; AgsChannel *output; AgsDelayAudio *recall_delay_audio; AgsCountBeatsAudioRun *recall_count_beats_audio_run; GList *list; printf("ags_drum_output_line_map_recall\n\0"); line = AGS_LINE(drum_output_line); line->flags |= AGS_LINE_MAPPED_RECALL; output = AGS_LINE(drum_output_line)->channel; audio = AGS_AUDIO(output->audio); drum = AGS_DRUM(audio->machine); /* get some recalls */ list = ags_recall_find_type(audio->play, AGS_TYPE_DELAY_AUDIO); if(list != NULL){ recall_delay_audio = AGS_DELAY_AUDIO(list->data); }else{ recall_delay_audio = NULL; } list = ags_recall_find_type(audio->play, AGS_TYPE_COUNT_BEATS_AUDIO_RUN); if(list != NULL){ recall_count_beats_audio_run = AGS_COUNT_BEATS_AUDIO_RUN(list->data); }else{ recall_count_beats_audio_run = NULL; } /* ags-stream */ ags_recall_factory_create(audio, NULL, NULL, "ags-stream\0", output->audio_channel, output->audio_channel + 1, output->pad, output->pad + 1, (AGS_RECALL_FACTORY_OUTPUT | AGS_RECALL_FACTORY_PLAY | AGS_RECALL_FACTORY_RECALL | AGS_RECALL_FACTORY_ADD), 0); }
void ags_synth_input_line_show_all(GtkWidget *line) { GTK_WIDGET_CLASS(ags_synth_input_line_parent_class)->show_all(line); gtk_widget_hide(GTK_WIDGET(AGS_LINE(line)->group)); }
void ags_add_line_member_launch(AgsTask *task) { AgsAddLineMember *add_line_member; add_line_member = AGS_ADD_LINE_MEMBER(task); if(AGS_IS_LINE(add_line_member->line)) { ags_expander_add(AGS_LINE(add_line_member->line)->expander, add_line_member->line_member, add_line_member->x, add_line_member->y, add_line_member->width, add_line_member->height); } else if(AGS_IS_EFFECT_LINE(add_line_member->line)) { gtk_table_attach(AGS_EFFECT_LINE(add_line_member->line)->table, add_line_member->line_member, add_line_member->x, add_line_member->x + add_line_member->width, add_line_member->y, add_line_member->y + add_line_member->height, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show_all(AGS_EFFECT_LINE(add_line_member->line)->table); } else { g_warning("ags_add_line_member.c - unknow line type"); } ags_line_member_find_port(add_line_member->line_member); // gtk_widget_set_child_visible(GTK_BIN(add_line_member->line->expander)->child, // TRUE); }
void ags_synth_input_line_resolve_line(AgsFileLookup *file_lookup, AgsSynthInputLine *synth_input_line) { ags_expander_add(AGS_LINE(synth_input_line)->expander, GTK_WIDGET(synth_input_line->oscillator), 0, 0, 1, 1); }
void ags_drum_set_pattern(AgsDrum *drum) { AgsLine *selected_line; GList *list, *line; guint index0, index1, offset; gboolean set_active; guint i; if(drum->selected_pad == NULL){ g_message("no selected pad\n\0"); return; } for(i = 0; i < 4 && drum->selected0 != drum->index0[i]; i++); index0 = i; for(i = 0; i < 12 && drum->selected1 != drum->index1[i]; i++); index1 = i; list = gtk_container_get_children((GtkContainer *) drum->offset); for(i = 0; i < 4 && ! GTK_TOGGLE_BUTTON(list->data)->active; i++) list = list->next; offset = i * 16; list = gtk_container_get_children((GtkContainer *) drum->pattern); drum->flags |= AGS_DRUM_BLOCK_PATTERN; for(i = 0; i < 16; i++){ set_active = TRUE; line = gtk_container_get_children(GTK_CONTAINER(AGS_PAD(drum->selected_pad)->expander_set)); while((line = ags_line_find_next_grouped(line)) != NULL){ selected_line = AGS_LINE(line->data); if(!ags_pattern_get_bit((AgsPattern *) selected_line->channel->pattern->data, index0, index1, offset + i)){ set_active = FALSE; break; } line = line->next; } gtk_toggle_button_set_active((GtkToggleButton *) list->data, set_active); list = list->next; } drum->flags &= (~AGS_DRUM_BLOCK_PATTERN); }
int ags_pad_group_clicked_callback(GtkWidget *widget, AgsPad *pad) { AgsLine *line; GtkContainer *container; GList *list; if(gtk_toggle_button_get_active(pad->group)){ container = (GtkContainer *) pad->expander_set; list = gtk_container_get_children(container); while(list != NULL){ line = AGS_LINE(list->data); if(!gtk_toggle_button_get_active(line->group)){ gtk_toggle_button_set_active(line->group, TRUE); } list = list->next; } }else{ container = (GtkContainer *) pad->expander_set; list = gtk_container_get_children(container); while(list != NULL){ line = AGS_LINE(list->data); if(!gtk_toggle_button_get_active(line->group)){ return(0); } list = list->next; } gtk_toggle_button_set_active(pad->group, TRUE); } return(0); }
void ags_drum_output_line_connect(AgsConnectable *connectable) { AgsDrumOutputLine *drum_output_line; drum_output_line = AGS_DRUM_OUTPUT_LINE(connectable); if((AGS_LINE_CONNECTED & (AGS_LINE(drum_output_line)->flags)) != 0){ return; } ags_drum_output_line_parent_connectable_interface->connect(connectable); /* empty */ }
void ags_panel_input_line_connect(AgsConnectable *connectable) { AgsPanelInputLine *panel_input_line; panel_input_line = AGS_PANEL_INPUT_LINE(connectable); if((AGS_LINE_CONNECTED & (AGS_LINE(panel_input_line)->flags)) != 0){ return; } ags_panel_input_line_parent_connectable_interface->connect(connectable); //TODO:JK: implement me }
void ags_panel_input_line_init(AgsPanelInputLine *panel_input_line) { AgsLineMember *line_member; line_member = (AgsLineMember *) g_object_new(AGS_TYPE_LINE_MEMBER, "widget-type\0", GTK_TYPE_CHECK_BUTTON, "widget-label\0", "mute\0", "plugin-name\0", "ags-play\0", "specifier\0", "./muted[0]\0", "control-port\0", "2/2\0", NULL); ags_expander_add(AGS_LINE(panel_input_line)->expander, GTK_WIDGET(line_member), 0, 0, 1, 1); }
void ags_synth_input_line_connect(AgsConnectable *connectable) { AgsSynthInputLine *synth_input_line; synth_input_line = AGS_SYNTH_INPUT_LINE(connectable); if((AGS_LINE_CONNECTED & (AGS_LINE(synth_input_line)->flags)) != 0){ return; } ags_synth_input_line_parent_connectable_interface->connect(connectable); ags_connectable_connect(AGS_CONNECTABLE(synth_input_line->oscillator)); g_signal_connect_after((GObject *) synth_input_line->oscillator, "control-changed", G_CALLBACK(ags_synth_input_line_oscillator_control_changed_callback), (gpointer) synth_input_line); }
void ags_synth_input_line_init(AgsSynthInputLine *synth_input_line) { AgsOscillator *oscillator; synth_input_line->name = NULL; synth_input_line->xml_type = "ags-synth-input-line"; /* oscillator */ oscillator = ags_oscillator_new(); synth_input_line->oscillator = oscillator; ags_expander_add(AGS_LINE(synth_input_line)->expander, GTK_WIDGET(oscillator), 0, 0, 1, 1); g_signal_connect((GObject *) synth_input_line, "samplerate-changed", G_CALLBACK(ags_synth_input_line_samplerate_changed_callback), NULL); }
void ags_drum_input_line_init(AgsDrumInputLine *drum_input_line) { AgsLineMember *line_member; GtkWidget *widget; g_signal_connect_after((GObject *) drum_input_line, "parent_set\0", G_CALLBACK(ags_drum_input_line_parent_set_callback), (gpointer) drum_input_line); line_member = (AgsLineMember *) g_object_new(AGS_TYPE_LINE_MEMBER, "widget-type\0", GTK_TYPE_VSCALE, "plugin-name\0", "ags-volume\0", "specifier\0", "./volume[0]\0", "control-port\0", "1/1\0", NULL); ags_expander_add(AGS_LINE(drum_input_line)->expander, GTK_WIDGET(line_member), 0, 0, 1, 1); widget = gtk_bin_get_child(GTK_BIN(line_member)); gtk_scale_set_digits(GTK_SCALE(widget), 3); gtk_range_set_range(GTK_RANGE(widget), 0.0, 2.00); gtk_range_set_increments(GTK_RANGE(widget), 0.025, 0.1); gtk_range_set_value(GTK_RANGE(widget), 1.0); gtk_range_set_inverted(GTK_RANGE(widget), TRUE); gtk_widget_set_size_request(widget, -1, 100); g_object_set(G_OBJECT(line_member), "port-data\0", (gpointer) &(GTK_RANGE(widget)->adjustment->value), NULL); }
int ags_drum_output_line_parent_set_callback(GtkWidget *widget, GtkObject *old_parent, gpointer data) { AgsDrumOutputLine *drum_output_line; if(old_parent != NULL) return(0); drum_output_line = AGS_DRUM_OUTPUT_LINE(widget); if(AGS_LINE(drum_output_line)->channel != NULL){ /* AgsDrum *drum; AgsChannel *channel; AgsAudioSignal *audio_signal; AgsDelaySharedAudio *delay_shared_audio; GList *recall_shared; guint stop; drum = (AgsDrum *) gtk_widget_get_ancestor(widget, AGS_TYPE_DRUM); channel = AGS_LINE(drum_output_line)->channel; recall_shared = ags_recall_shared_find_type(AGS_AUDIO(channel->audio)->recall_shared, AGS_TYPE_DELAY_SHARED_AUDIO); if(recall_shared != NULL){ delay_shared_audio = (AgsDelaySharedAudio *) recall_shared->data; stop = ((guint) drum->length_spin->adjustment->value) * (delay_shared_audio->delay + 1); }else{ stop = 1; } audio_signal = ags_audio_signal_get_template(channel->first_recycling->audio_signal); ags_audio_signal_stream_resize(audio_signal, stop); */ } return(0); }
void ags_drum_pad_callback(GtkWidget *toggle_button, AgsDrum *drum) { AgsLine *selected_line; AgsPattern *pattern; AgsTogglePatternBit *toggle_pattern_bit; GList *list, *line; GList *tasks; guint i, index0, index1, offset; if(drum->selected_pad == NULL){ return; } if((AGS_DRUM_BLOCK_PATTERN & (drum->flags)) != 0){ #ifdef AGS_DEBUG g_message("AgsDrum pattern is blocked\n\0"); #endif return; } list = gtk_container_get_children((GtkContainer *) drum->pattern); for(i = 0; i < 16 && toggle_button != list->data; i++) list = list->next; offset = i; for(i = 0; i < 4 && drum->selected0 != drum->index0[i]; i++); index0 = i; for(i = 0; i < 12 && drum->selected1 != drum->index1[i]; i++); index1 = i; list = gtk_container_get_children((GtkContainer *) drum->offset); for(i = 0; i < 4 && ! GTK_TOGGLE_BUTTON(list->data)->active; i++) list = list->next; offset += (i * 16); line = gtk_container_get_children(GTK_CONTAINER(AGS_PAD(drum->selected_pad)->expander_set)); tasks = NULL; while((line = ags_line_find_next_grouped(line)) != NULL){ selected_line = AGS_LINE(line->data); toggle_pattern_bit = ags_toggle_pattern_bit_new(selected_line->channel->pattern->data, selected_line->channel->line, index0, index1, offset); tasks = g_list_prepend(tasks, toggle_pattern_bit); line = line->next; } /* append AgsTogglePatternBit */ ags_task_thread_append_tasks(AGS_TASK_THREAD(AGS_AUDIO_LOOP(AGS_MAIN(AGS_DEVOUT(AGS_MACHINE(drum)->audio->devout)->ags_main)->main_loop)->task_thread), tasks); }
void ags_drum_input_pad_open_response_callback(GtkWidget *widget, gint response, AgsDrumInputPad *drum_input_pad) { AgsWindow *window; GtkFileChooserDialog *file_chooser; GtkSpinButton *spin_button; AgsAudioFile *audio_file; AgsOpenSingleFile *open_single_file; AgsThread *gui_thread; AgsApplicationContext *application_context; GList *task; char *name0, *name1; pthread_mutex_t *application_mutex; window = (AgsWindow *) gtk_widget_get_ancestor((GtkWidget *) drum_input_pad, AGS_TYPE_WINDOW); file_chooser = drum_input_pad->file_chooser; application_context = (AgsApplicationContext *) window->application_context; gui_thread = ags_ui_provider_get_gui_thread(AGS_UI_PROVIDER(application_context)); if(response == GTK_RESPONSE_ACCEPT){ name0 = gtk_file_chooser_get_filename((GtkFileChooser *) file_chooser); name1 = (char *) g_object_get_data((GObject *) file_chooser, AGS_DRUM_INPUT_PAD_OPEN_AUDIO_FILE_NAME); spin_button = (GtkSpinButton *) g_object_get_data((GObject *) file_chooser, AGS_DRUM_INPUT_PAD_OPEN_SPIN_BUTTON); /* open audio file and read audio signal */ if(g_strcmp0(name0, name1)){ if(name1 != NULL){ audio_file = (AgsAudioFile *) g_object_get_data((GObject *) file_chooser, g_type_name(AGS_TYPE_AUDIO_FILE)); g_object_unref(G_OBJECT(audio_file)); } } /* task */ task = NULL; if(AGS_PAD(drum_input_pad)->group->active){ AgsChannel *current, *next_pad, *next_current; guint i; current = AGS_PAD(drum_input_pad)->channel; if(current != NULL) { g_object_ref(current); } next_pad = ags_channel_next_pad(current); next_current = NULL; for(i = 0; current != next_pad; i++){ open_single_file = ags_open_single_file_new(current, name0, i); task = g_list_prepend(task, open_single_file); /* iterate */ next_current = ags_channel_next(current); g_object_unref(current); current = next_current; } if(next_pad != NULL){ g_object_unref(next_pad); } if(next_current != NULL){ g_object_unref(next_current); } }else{ AgsLine *line; GList *list; list = gtk_container_get_children(GTK_CONTAINER(AGS_PAD(drum_input_pad)->expander_set)); line = AGS_LINE(ags_line_find_next_grouped(list)->data); open_single_file = ags_open_single_file_new(line->channel, name0, (guint) spin_button->adjustment->value); task = g_list_prepend(task, open_single_file); g_list_free(list); } ags_gui_thread_schedule_task_list((AgsGuiThread *) gui_thread, task); gtk_widget_destroy((GtkWidget *) file_chooser); }else if(response == GTK_RESPONSE_CANCEL){ audio_file = (AgsAudioFile *) g_object_get_data((GObject *) file_chooser, g_type_name(AGS_TYPE_AUDIO_FILE)); if(audio_file != NULL){ g_object_unref(G_OBJECT(audio_file)); } gtk_widget_destroy((GtkWidget *) file_chooser); } drum_input_pad->file_chooser = NULL; }
void ags_drum_input_line_map_recall(AgsDrumInputLine *drum_input_line, guint output_pad_start) { AgsDrum *drum; AgsLine *line; AgsLineMember *line_member; AgsAudio *audio; AgsChannel *source; AgsChannel *current, *destination; AgsCopyChannel *copy_channel; AgsCopyChannelRun *copy_channel_run; GList *list; guint i; line = AGS_LINE(drum_input_line); line->flags |= AGS_LINE_MAPPED_RECALL; audio = AGS_AUDIO(line->channel->audio); drum = AGS_DRUM(audio->machine); source = line->channel; /* ags-play */ // ags_recall_factory_create(audio, // "ags-play\0", // 0, audio->audio_channels, // source->pad, source->pad + 1, // FALSE, // FALSE); /* ags-volume */ ags_recall_factory_create(audio, NULL, NULL, "ags-volume\0", source->audio_channel, source->audio_channel + 1, source->pad, source->pad + 1, (AGS_RECALL_FACTORY_INPUT | AGS_RECALL_FACTORY_RECALL | AGS_RECALL_FACTORY_ADD), 0); /* ags-copy */ ags_recall_factory_create(audio, NULL, NULL, "ags-copy\0", source->audio_channel, source->audio_channel + 1, source->pad, source->pad + 1, (AGS_RECALL_FACTORY_INPUT | AGS_RECALL_FACTORY_RECALL | AGS_RECALL_FACTORY_ADD), 0); current = source; destination = ags_channel_nth(audio->output, current->audio_channel); while(destination != NULL){ /* recall */ list = current->recall; while((list = ags_recall_find_type(list, AGS_TYPE_COPY_CHANNEL)) != NULL){ copy_channel = AGS_COPY_CHANNEL(list->data); g_object_set(G_OBJECT(copy_channel), "destination\0", destination, NULL); list = list->next; } list = current->recall; while((list = ags_recall_find_type(list, AGS_TYPE_COPY_CHANNEL_RUN)) != NULL){ copy_channel_run = AGS_COPY_CHANNEL_RUN(list->data); g_object_set(G_OBJECT(copy_channel_run), "destination\0", destination, NULL); list = list->next; } destination = destination->next_pad; } /* ags-stream */ ags_recall_factory_create(audio, NULL, NULL, "ags-stream\0", source->audio_channel, source->audio_channel + 1, source->pad, source->pad + 1, (AGS_RECALL_FACTORY_INPUT | AGS_RECALL_FACTORY_PLAY | AGS_RECALL_FACTORY_RECALL | AGS_RECALL_FACTORY_ADD), 0); }
/** * ags_port_selection_load_ports: * @selection: * * */ void ags_port_selection_load_ports(AgsPortSelection *selection) { AgsAutomationEditor *automation_editor; AgsMachine *machine; AgsAudio *audio; GtkMenu *menu; GtkMenuItem *item; AgsChannel *channel; GList *port; auto GList* ags_port_selection_list_ports(GType type); GList* ags_port_selection_list_ports(GType type){ GList *pad, *pad_start; GList *line, *line_start; GList *line_member, *line_member_start; GList *port; pad_start = pad = gtk_container_get_children(((type == AGS_TYPE_OUTPUT) ? machine->output: machine->input)); port = NULL; while(pad != NULL){ line_start = line = gtk_container_get_children(AGS_PAD(pad->data)->expander_set); while(line != NULL){ channel = AGS_LINE(line->data)->channel; line_member_start = line_member = gtk_container_get_children(AGS_LINE(line->data)->expander->table); while(line_member != NULL){ if(AGS_IS_LINE_MEMBER(line_member->data)){ /* fill list */ port = g_list_prepend(port, AGS_LINE_MEMBER(line_member->data)->port); /* add menu item */ item = gtk_check_menu_item_new_with_label(g_strdup_printf("[%d] %s: %s\0", channel->line, AGS_PORT(port->data)->plugin_name, AGS_PORT(port->data)->specifier)); g_object_set_data(G_OBJECT(item), AGS_PORT_SELECTION_DATA_CHANNEL, channel); g_object_set_data(G_OBJECT(item), AGS_PORT_SELECTION_DATA_PORT, port->data); gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item)); g_signal_connect(item, "toggled\0", G_CALLBACK(ags_port_selection_ports_toggled_callback), selection); } line_member = line_member->next; } g_list_free(line_member_start); line = line->next; } g_list_free(line_start); pad = pad->next; } g_list_free(pad_start); port = g_list_reverse(port); return(port); }