Ejemplo n.º 1
0
void
ags_drum_input_pad_read(AgsFile *file, xmlNode *node, AgsPlugin *plugin)
{
  AgsDrumInputPad *gobject;
  AgsFileLaunch *file_launch;

  gobject = AGS_DRUM_INPUT_PAD(plugin);

  ags_file_add_id_ref(file,
		      g_object_new(AGS_TYPE_FILE_ID_REF,
				   "application-context", file->application_context,
				   "file", file,
				   "node", node,
				   "xpath", g_strdup_printf("xpath=//*[@id='%s']", xmlGetProp(node, AGS_FILE_ID_PROP)),
				   "reference", gobject,
				   NULL));
  
  /*  */
  file_launch = (AgsFileLaunch *) g_object_new(AGS_TYPE_FILE_LAUNCH,
					       "node", node,
					       "file", file,
					       NULL);
  g_signal_connect(G_OBJECT(file_launch), "start",
		   G_CALLBACK(ags_drum_input_pad_launch_task), gobject);
  ags_file_add_launch(file,
		      (GObject *) file_launch);
}
Ejemplo n.º 2
0
void
ags_drum_set_pads(AgsAudio *audio, GType type,
		  guint pads, guint pads_old,
		  AgsDrum *drum)
{
  AgsChannel *channel;
  GList *list, *list_next;
  guint i, j;

  if(type == AGS_TYPE_INPUT){
    AgsDrumInputPad *drum_input_pad;

    if(pads_old < pads){
      /* reset edit button */
      if(pads_old == 0){
	GtkToggleButton *selected_edit_button;

	drum->selected_pad = AGS_DRUM_INPUT_PAD(gtk_container_get_children((GtkContainer *) drum->input_pad)->data);
	drum->selected_edit_button = drum->selected_pad->edit;
	gtk_toggle_button_set_active((GtkToggleButton *) drum->selected_edit_button, TRUE);
      }
    }else{
      /* destroy AgsPad's */
      if(pads == 0){
	drum->selected_pad = NULL;
	drum->selected_edit_button = NULL;
      }else{
	drum_input_pad = AGS_DRUM_INPUT_PAD(gtk_widget_get_ancestor(GTK_WIDGET(drum->selected_edit_button), AGS_TYPE_PAD));

	if(drum_input_pad->pad.channel->pad > pads){
	  drum->selected_pad = AGS_DRUM_INPUT_PAD(gtk_container_get_children((GtkContainer *) drum->input_pad)->data);
	  drum->selected_edit_button = drum->selected_pad->edit;
	  gtk_toggle_button_set_active((GtkToggleButton *) drum->selected_edit_button, TRUE);
	}
      }
    }
  }  
}
Ejemplo n.º 3
0
static void
ags_drum_input_pad_finalize(GObject *gobject)
{
  AgsDrumInputPad *drum_input_pad;

  drum_input_pad = AGS_DRUM_INPUT_PAD(gobject);

  //FIXME:JK: won't be called
  //NOTE:JK: work-around in ags_drum.c
  if(drum_input_pad->file_chooser != NULL){
    //    gtk_widget_destroy(drum_input_pad->file_chooser);
  }
  
  G_OBJECT_CLASS(ags_drum_input_pad_parent_class)->finalize(gobject);
}
Ejemplo n.º 4
0
void
ags_drum_input_line_set_channel(AgsLine *line, AgsChannel *channel)
{
  AgsDrumInputLine *drum_input_line;

  AGS_LINE_CLASS(ags_drum_input_line_parent_class)->set_channel(line, channel);

  drum_input_line = AGS_DRUM_INPUT_LINE(line);

#ifdef AGS_DEBUG
  g_message("ags_drum_input_line_set_channel - channel: %u\0",
	    channel->line);
#endif

  if(line->channel != NULL){
    line->flags &= (~AGS_LINE_MAPPED_RECALL);
  }

  if(channel != NULL){
    if(channel->pattern == NULL){
      channel->pattern = g_list_alloc();
      channel->pattern->data = (gpointer) ags_pattern_new();
      ags_pattern_set_dim((AgsPattern *) channel->pattern->data, 4, 12, 64);
    }

    if((AGS_LINE_PREMAPPED_RECALL & (line->flags)) == 0){
      ags_drum_input_line_map_recall(drum_input_line, 0);
      ags_line_find_port(line);
    }else{
      //TODO:JK: make it advanced
      /* reset edit button */
      if(line->channel->line == 0){
	AgsDrum *drum;
	GtkToggleButton *selected_edit_button;

	drum = (AgsDrum *) gtk_widget_get_ancestor(GTK_WIDGET(line),
						   AGS_TYPE_DRUM);

	drum->selected_pad = AGS_DRUM_INPUT_PAD(gtk_container_get_children((GtkContainer *) drum->input_pad)->data);
	drum->selected_edit_button = drum->selected_pad->edit;
	gtk_toggle_button_set_active((GtkToggleButton *) drum->selected_edit_button, TRUE);
      }
    }
  }
}
Ejemplo n.º 5
0
xmlNode*
ags_drum_input_pad_write(AgsFile *file, xmlNode *parent, AgsPlugin *plugin)
{
  AgsDrumInputPad *drum_input_pad;
  xmlNode *node;
  gchar *id;

  drum_input_pad = AGS_DRUM_INPUT_PAD(plugin);
  node = NULL;

  if(gtk_toggle_button_get_active(drum_input_pad->edit)){
    id = ags_id_generator_create_uuid();
  
    node = xmlNewNode(NULL,
		      "ags-drum-input-pad");
    xmlNewProp(node,
	       AGS_FILE_ID_PROP,
	       id);

    ags_file_add_id_ref(file,
			g_object_new(AGS_TYPE_FILE_ID_REF,
				     "application-context", file->application_context,
				     "file", file,
				     "node", node,
				     "xpath", g_strdup_printf("xpath=//*[@id='%s']", id),
				     "reference", drum_input_pad,
				     NULL));

    xmlNewProp(node,
	       "edit",
	       g_strdup_printf("%s", AGS_FILE_TRUE));

    xmlAddChild(parent,
		node);  
  }

  return(node);
}
Ejemplo n.º 6
0
void
ags_drum_input_pad_connect(AgsConnectable *connectable)
{
  AgsDrumInputPad *drum_input_pad;

  drum_input_pad = AGS_DRUM_INPUT_PAD(connectable);

  if((AGS_PAD_CONNECTED & (AGS_PAD(drum_input_pad)->flags)) != 0){
    return;
  }

  ags_drum_input_pad_parent_connectable_interface->connect(connectable);

  /* AgsDrumInputPad */
  g_signal_connect(G_OBJECT(drum_input_pad->open), "clicked",
		   G_CALLBACK(ags_drum_input_pad_open_callback), (gpointer) drum_input_pad);

  g_signal_connect_after(G_OBJECT(drum_input_pad->play), "toggled",
			 G_CALLBACK(ags_drum_input_pad_play_callback), (gpointer) drum_input_pad);

  g_signal_connect(G_OBJECT(drum_input_pad->edit), "clicked",
		   G_CALLBACK(ags_drum_input_pad_edit_callback), (gpointer) drum_input_pad);
}
Ejemplo n.º 7
0
void
ags_drum_input_pad_set_xml_type(AgsPlugin *plugin, gchar *xml_type)
{
  AGS_DRUM_INPUT_PAD(plugin)->xml_type = xml_type;
}
Ejemplo n.º 8
0
gchar*
ags_drum_input_pad_get_xml_type(AgsPlugin *plugin)
{
  return(AGS_DRUM_INPUT_PAD(plugin)->xml_type);
}
Ejemplo n.º 9
0
void
ags_drum_input_pad_set_name(AgsPlugin *plugin, gchar *name)
{
  AGS_DRUM_INPUT_PAD(plugin)->name = name;
}
Ejemplo n.º 10
0
gchar*
ags_drum_input_pad_get_name(AgsPlugin *plugin)
{
  return(AGS_DRUM_INPUT_PAD(plugin)->name);
}