gboolean
ags_note_edit_drawing_area_expose_event(GtkWidget *widget, GdkEventExpose *event, AgsNoteEdit *note_edit)
{
  AgsEditor *editor;

  editor = (AgsEditor *) gtk_widget_get_ancestor(GTK_WIDGET(note_edit),
						 AGS_TYPE_EDITOR);

  if(editor->selected_machine != NULL){
    AgsMachine *machine;

    machine = editor->selected_machine;

    if(machine != NULL){
      cairo_t *cr;

      cr = gdk_cairo_create(widget->window);
      cairo_push_group(cr);

      if(AGS_IS_PANEL(machine)){
      }else if(AGS_IS_MIXER(machine)){
      }else if(AGS_IS_DRUM(machine)){
	ags_note_edit_draw_segment(note_edit, cr);
	ags_note_edit_draw_notation(note_edit, cr);
      }else if(AGS_IS_MATRIX(machine)){
	ags_note_edit_draw_segment(note_edit, cr);
	ags_note_edit_draw_notation(note_edit, cr);
      }else if(AGS_IS_SYNTH(machine)){
	ags_note_edit_draw_segment(note_edit, cr);
	ags_note_edit_draw_notation(note_edit, cr);
      }else if(AGS_IS_FFPLAYER(machine)){
	ags_note_edit_draw_segment(note_edit, cr);
	ags_note_edit_draw_notation(note_edit, cr);
      }

      if(editor->toolbar->selected_edit_mode == editor->toolbar->position){
	ags_note_edit_draw_position(note_edit, cr);
      }

      cairo_pop_group_to_source(cr);
      cairo_paint(cr);
    }
  }

  return(TRUE);
}
void
ags_functional_ffplayer_test_resize_audio_channels()
{
  GtkDialog *properties;

  AgsXorgApplicationContext *xorg_application_context;
  
  AgsFFPlayer *ffplayer;

  GList *list_start, *list;

  guint nth_machine;
  guint resize_tab;
  gboolean success;

  /* add ffplayer */
  success = ags_functional_test_util_add_machine(NULL,
						 "FPlayer");

  CU_ASSERT(success == TRUE);

  /*  */
  ags_test_enter();
  
  xorg_application_context = ags_application_context_get_instance();

  /* retrieve ffplayer */
  nth_machine = 0;

  list_start = gtk_container_get_children(xorg_application_context->window->machines);
  list = g_list_nth(list_start,
		    nth_machine);

  ags_test_leave();

  if(list != NULL &&
     AGS_IS_FFPLAYER(list->data)){
    ffplayer = list->data;
  }else{
    ffplayer = NULL;
  }
  
  CU_ASSERT(ffplayer != NULL);

  /*
   * resize audio channels
   */
  
  /* open properties */
  ags_functional_test_util_machine_properties_open(nth_machine);

  /* click tab */
  resize_tab = 4;
  
  ags_functional_test_util_machine_properties_click_tab(nth_machine,
							resize_tab);
  
  /* click enable */
  ags_functional_test_util_machine_properties_click_enable(nth_machine);

  /* set output audio_channels */
  ags_functional_test_util_machine_properties_resize_audio_channels(nth_machine,
								    AGS_FUNCTIONAL_FFPLAYER_TEST_RESIZE_AUDIO_CHANNELS);

  /* response ok */
  ags_test_enter();

  properties = AGS_MACHINE(ffplayer)->properties;
  
  ags_test_leave();

  ags_functional_test_util_dialog_ok(properties);

  /* destroy ffplayer */
  success = ags_functional_test_util_machine_destroy(0);
}
void
ags_functional_ffplayer_test_open_sf2()
{
  AgsXorgApplicationContext *xorg_application_context;

  AgsFFPlayer *ffplayer;

  GList *list_start, *list;

  guint nth_machine;
  gboolean success;

  /* add ffplayer */
  success = ags_functional_test_util_add_machine(NULL,
						 "FPlayer");

  CU_ASSERT(success == TRUE);

  /*  */
  ags_test_enter();
  
  xorg_application_context = ags_application_context_get_instance();

  /* retrieve ffplayer */
  nth_machine = 0;

  list_start = gtk_container_get_children(xorg_application_context->window->machines);
  list = g_list_nth(list_start,
		    nth_machine);

  ags_test_leave();

  if(list != NULL &&
     AGS_IS_FFPLAYER(list->data)){
    ffplayer = list->data;
  }else{
    ffplayer = NULL;
  }
  
  CU_ASSERT(ffplayer != NULL);

  /* open dialog */
  success = ags_functional_test_util_ffplayer_open(0);

  CU_ASSERT(success == TRUE);

  /* open path */
  CU_ASSERT(g_file_test(AGS_FUNCTIONAL_FFPLAYER_TEST_OPEN_SF2_PATH,
			G_FILE_TEST_EXISTS));
  
  success = ags_functional_test_util_file_chooser_open_path(GTK_FILE_CHOOSER(ffplayer->open_dialog),
							    AGS_FUNCTIONAL_FFPLAYER_TEST_OPEN_SF2_PATH);
  CU_ASSERT(success == TRUE);

  /* select sf2 */
  success = ags_functional_test_util_file_chooser_select_filename(GTK_FILE_CHOOSER(ffplayer->open_dialog),
								  AGS_FUNCTIONAL_FFPLAYER_TEST_OPEN_SF2_FILENAME);

  CU_ASSERT(success == TRUE);

  /* response ok */
  success = ags_functional_test_util_dialog_ok(GTK_DIALOG(ffplayer->open_dialog));

  CU_ASSERT(success == TRUE);

  /* destroy ffplayer */
  sleep(AGS_FUNCTIONAL_FFPLAYER_TEST_OPEN_SF2_DELAY);
  
  success = ags_functional_test_util_machine_destroy(0);
  
  CU_ASSERT(success == TRUE);
}