Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/bensch/orxonox_gui_audio.c @ 1824

Last change on this file since 1824 was 1822, checked in by bensch, 21 years ago

orxonox/branches/bensch: hmm… little typo… it simply was too late for me

File size: 2.6 KB
Line 
1#include "orxonox_gui.h"
2
3void audio_check_button_change(GtkWidget *widget, int* data)
4{
5  *data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)); 
6  orxonox_flags_update ();
7  if (verbose >=1)
8    printf ("%s changed to %i.\n", gtk_button_get_label(GTK_BUTTON(widget)), *data);
9  return;
10}
11
12void audio_slider_change(GtkWidget *widget, int* data)
13{
14  *data = gtk_range_get_value ( GTK_RANGE (widget));
15  orxonox_flags_update ();
16  if (verbose >=1)
17    printf ("Changed slider to %i.\n", *data);
18  return;
19}
20
21GtkWidget *orxonox_gui_audio_frame (struct settings *orxonox_settings)
22{
23  GtkWidget *frame;
24  GtkWidget *enable_sound_button;
25  GtkWidget *label;
26  GtkWidget *music_volume_slider;
27  GtkWidget *effects_volume_slider;
28
29  frame = gtk_frame_new ( "Audio-Options:");
30  gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
31  {
32    GtkWidget *orxonox_gui_audio_vbox;
33    orxonox_gui_audio_vbox = gtk_vbox_new (FALSE, 0);
34    {
35
36        enable_sound_button = gtk_check_button_new_with_label ("Enable Sound");
37        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable_sound_button), orxonox_settings->audio_enable_sound);
38        g_signal_connect(GTK_TOGGLE_BUTTON(enable_sound_button), "clicked", G_CALLBACK(audio_check_button_change), &(orxonox_settings->audio_enable_sound));
39
40        gtk_box_pack_start(GTK_BOX (orxonox_gui_audio_vbox), enable_sound_button, TRUE, TRUE, 0);
41
42        label=gtk_label_new ("Music Volume");
43        gtk_box_pack_start (GTK_BOX(orxonox_gui_audio_vbox), label, TRUE, TRUE, 0);
44        music_volume_slider = gtk_hscale_new_with_range (0,100,5);
45        gtk_range_set_value ( GTK_RANGE (music_volume_slider), orxonox_settings->audio_music_volume);
46        gtk_range_set_update_policy ( GTK_RANGE (music_volume_slider), GTK_UPDATE_DISCONTINUOUS);
47        g_signal_connect (GTK_RANGE (music_volume_slider), "value_changed", G_CALLBACK (audio_slider_change), &(orxonox_settings->audio_music_volume) );
48        gtk_box_pack_start ( GTK_BOX (orxonox_gui_audio_vbox), music_volume_slider, TRUE, TRUE, 0);
49
50        label=gtk_label_new ("Effects Volume");
51        gtk_box_pack_start (GTK_BOX(orxonox_gui_audio_vbox), label, TRUE, TRUE, 0);
52        effects_volume_slider = gtk_hscale_new_with_range (0,100,5);
53        gtk_range_set_value ( GTK_RANGE (effects_volume_slider), orxonox_settings->audio_effects_volume);
54        gtk_range_set_update_policy ( GTK_RANGE (effects_volume_slider), GTK_UPDATE_DISCONTINUOUS);
55        g_signal_connect (GTK_RANGE (effects_volume_slider), "value_changed", G_CALLBACK (audio_slider_change), &(orxonox_settings->audio_effects_volume) );
56        gtk_box_pack_start ( GTK_BOX (orxonox_gui_audio_vbox), effects_volume_slider, TRUE, TRUE, 0);
57
58    }
59    gtk_container_add(GTK_CONTAINER(frame), orxonox_gui_audio_vbox);
60  }
61  return frame;
62}
63
Note: See TracBrowser for help on using the repository browser.