⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtkanal.c

📁 音频编码
💻 C
📖 第 1 页 / 共 4 页
字号:
    gtk_widget_set_usize(box,350,260);    sprintf(text,"frames processed so far: %i \n",Pinfo[0].frameNum+1);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"granules processed so far: %i \n\n",4*(Pinfo[0].frameNum+1));    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"mean bits/frame (approximate): %i\n",	    gtkinfo.approxbits);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"mean bits/frame (from LAME): %i\n",	    4*Pinfo[0].mean_bits);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"bitsize of largest frame: %i \n",gtkinfo.maxbits);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"average bits/frame: %3.1f \n\n",gtkinfo.avebits);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"ms_stereo frames: %i \n",gtkinfo.totms);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"i_stereo frames: %i \n",gtkinfo.totis);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"de-emphasis frames: %i \n",gtkinfo.totemph);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"short block granules: %i \n",gtkinfo.totshort);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"mixed block granules: %i \n",gtkinfo.totmix);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    sprintf(text,"preflag granules: %i \n",gtkinfo.totpreflag);    gtk_text_insert(GTK_TEXT(box),NULL,NULL,NULL,text,-1);    break;  }  gtk_widget_show (vscrollbar);  gtk_widget_show (box);  gtk_widget_show (vbox);  gtk_widget_show (hbox);  gtk_widget_show (button);  gtk_box_pack_start (GTK_BOX(hbox), box, FALSE, TRUE, 0);  gtk_box_pack_start(GTK_BOX(hbox), vscrollbar, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);  gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, TRUE, 0);  gtk_container_add (GTK_CONTAINER (textwindow), vbox);   gtk_widget_show(textwindow);}/* #include <strings.h>*//* This is the GtkItemFactoryEntry structure used to generate new menus.   Item 1: The menu path. The letter after the underscore indicates an           accelerator key once the menu is open.   Item 2: The accelerator key for the entry   Item 3: The callback function.   Item 4: The callback action.  This changes the parameters with           which the function is called.  The default is 0.   Item 5: The item type, used to define what kind of an item it is.           Here are the possible values:           NULL               -> "<Item>"           ""                 -> "<Item>"           "<Title>"          -> create a title item           "<Item>"           -> create a simple item           "<CheckItem>"      -> create a check item           "<ToggleItem>"     -> create a toggle item           "<RadioItem>"      -> create a radio item           <path>             -> path of a radio item to link against           "<Separator>"      -> create a separator           "<Branch>"         -> create an item to hold sub items           "<LastBranch>"     -> create a right justified branch */#define C(chr)	     "<control>" #chr#define func(name)   (GtkItemFactoryCallback) (name)static const GtkItemFactoryEntry menu_items [] = {    { "/_File"                      , NULL, NULL                , 0, "<Branch>" },#if 0    { "/File/_New"                  , C(N), func(print_hello)   , 0, NULL },    { "/File/_Open"                 , C(O), func(print_hello)   , 0, NULL },    { "/File/_Save"                 , C(S), func(print_hello)   , 0, NULL },    { "/File/Save _As"              , NULL, NULL                , 0, NULL },    { "/File/sep1"                  , NULL, NULL                , 0, "<Separator>" },    { "/File/Quit"                  , C(Q), func(gtk_main_quit) , 0, NULL }, #endif    { "/File/_Quit"                 , C(Q), func(delete_event)  , 0, NULL },     { "/_Plotting"                  , NULL, NULL                , 0, "<Branch>" },    { "/Plotting/_While advancing"  , NULL, func(spec_option)   , 5, NULL },    { "/Plotting/_After advancing"  , NULL, func(spec_option)   , 6, NULL },    { "/Plotting/Toggle SFB lines"  , NULL, func(spec_option)   , 7, NULL },    { "/Plotting/Toggle orig-diff"  , NULL, func(spec_option)   , 8, NULL },      { "/_Channel"                   , NULL, NULL                , 0, "<Branch>" },    { "/Channel/show _Left"         , NULL, func(channel_option), 1, NULL },    { "/Channel/show _Right"        , NULL, func(channel_option), 2, NULL },    { "/Channel/show _Mid"          , NULL, func(channel_option), 3, NULL },    { "/Channel/show _Side"         , NULL, func(channel_option), 4, NULL },    { "/_Spectrum"                  , NULL, NULL                , 0, "<Branch>" },    { "/Spectrum/_Scalefactor bands", NULL, func(spec_option)   , 1, NULL },    { "/Spectrum/_Wave number"      , NULL, func(spec_option)   , 2, NULL },     { "/_MDCT"                      , NULL, NULL                , 0, "<Branch>" },    { "/MDCT/_Original"             , NULL, func(spec_option)   , 3, NULL },    { "/MDCT/_Compressed"           , NULL, func(spec_option)   , 4, NULL },    { "/MDCT/_Toggle SFB lines"     , NULL, func(spec_option)   , 7, NULL },     { "/_Stats"                     , NULL, NULL                , 0, "<Branch>" },    { "/Stats/_Show"                , NULL, func(text_window)   , 2, NULL },    { "/_Help"                      , NULL, NULL                , 0, "<LastBranch>" },    { "/_Help/_Documentation"       , NULL, func(text_window)   , 0, NULL },    { "/_Help/_About"               , NULL, func(text_window)   , 1, NULL },};#undef C#undef funcstatic void get_main_menu(GtkWidget *windows, GtkWidget ** menubar) {  unsigned int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);  GtkItemFactory *item_factory;  GtkAccelGroup *accel_group;  accel_group = gtk_accel_group_new();  /* This function initializes the item factory.     Param 1: The type of menu - can be GTK_TYPE_MENU_BAR, GTK_TYPE_MENU,              or GTK_TYPE_OPTION_MENU.     Param 2: The path of the menu.     Param 3: A pointer to a gtk_accel_group.  The item factory sets up              the accelerator table while generating menus.  */  item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", 				       accel_group);  /* This function generates the menu items. Pass the item factory,     the number of items in the array, the array itself, and any     callback data for the the menu items. */  gtk_item_factory_create_items(item_factory, nmenu_items, (GtkItemFactoryEntry*)menu_items, NULL);  /* Attach the new accelerator group to the window. */  gtk_accel_group_attach (accel_group, GTK_OBJECT (windows));  if (menubar)    /* Finally, return the actual menu bar created by the item factory. */     *menubar = gtk_item_factory_get_widget(item_factory, "<main>");}int gtkcontrol(lame_global_flags *gfp2,char *inPath){    /* GtkWidget is the storage type for widgets */    GtkWidget *button;    GtkAdjustment *adj;    GtkWidget *mbox;        /* main box */    GtkWidget *box1;        /* frame control buttons go */    GtkWidget *box2;        /* frame counters */    GtkWidget *box3;        /* frame header info */    GtkWidget *table;       /* table for all the plotting areas */    GtkWidget *menubar;    gint tableops,graphx,graphy;    char frameinfo[80];    graphx = 600;  /* minimum allowed size of pixmap */    graphy = 95;    gfp=gfp2;    gfc=gfp->internal_flags;    /* set some global defaults/variables */    gtkinfo.filetype = (input_format == sf_mp1 ||                        input_format == sf_mp2 ||                        input_format == sf_mp3);    gtkinfo.msflag=0;    gtkinfo.chflag=0;    gtkinfo.kbflag=0;    gtkinfo.flag123 = (input_format == sf_mp1 ||                       input_format == sf_mp2 ||                       input_format == sf_mp3); /* MP3 file=use mpg123 output */    gtkinfo.pupdate=0;    gtkinfo.avebits = 0;    gtkinfo.maxbits = 0;    gtkinfo.approxbits = 0;    gtkinfo.totemph = 0;    gtkinfo.totms = 0;    gtkinfo.totis = 0;    gtkinfo.totshort = 0;    gtkinfo.totmix = 0;    gtkinfo.sfblines= 1;    gtkinfo.difference= 0;    gtkinfo.totalframes = 0;    memset((char *) Pinfo, 0, sizeof(Pinfo));    pplot = &Pinfo[READ_AHEAD];    strcpy(frameinfo,"MP3x: ");    strncat(frameinfo,inPath,70);    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);    gtk_window_set_title (GTK_WINDOW (window), frameinfo);    gtk_signal_connect (GTK_OBJECT (window), "delete_event",			GTK_SIGNAL_FUNC (delete_event), NULL);    gtk_signal_connect_object (GTK_OBJECT (window), "key_press_event",		      GTK_SIGNAL_FUNC(key_press_event),		      GTK_OBJECT (window));    gtk_container_set_border_width (GTK_CONTAINER (window), 0);    mbox = gtk_vbox_new(FALSE, 0);    /* layout of mbox */    box1 = gtk_hbox_new(FALSE, 0);    box2 = gtk_hbox_new(FALSE, 0);    box3 = gtk_hbox_new(FALSE, 0);    table = gtk_table_new (5, 2, FALSE);    tableops = GTK_FILL | GTK_EXPAND | GTK_SHRINK;    get_main_menu(window, &menubar);    gtk_box_pack_start(GTK_BOX(mbox), menubar, FALSE, TRUE, 0);    gtk_box_pack_end (GTK_BOX (mbox), box1, FALSE, TRUE, 0);    gtk_box_pack_end(GTK_BOX (mbox),box2, FALSE, TRUE, 0);    gtk_box_pack_start(GTK_BOX (mbox),box3, FALSE, TRUE, 0);    gtk_box_pack_start (GTK_BOX (mbox), table, TRUE, TRUE, 0);    gtk_container_add (GTK_CONTAINER (window), mbox);     /*********************************************************************/    /* stuff in box3  frame header info */    /*********************************************************************/    /*    headerbox = gtk_label_new(" ");    gtk_label_set_justify(GTK_LABEL(headerbox),GTK_JUSTIFY_LEFT);     */    headerbox = gtk_text_new (NULL, NULL);    gtk_text_set_editable (GTK_TEXT (headerbox), FALSE);    gtk_widget_set_usize(headerbox,200,20);    gtk_widget_show (headerbox);    gtk_box_pack_start(GTK_BOX (box3),headerbox, TRUE, TRUE, 0);        /*********************************************************************/    /* stuff in box2   frame counters  */    /*********************************************************************/    framecounter = gtk_label_new("");    gtk_widget_show(framecounter);    gtk_box_pack_start(GTK_BOX (box2),framecounter, FALSE, TRUE, 0);    adj = (GtkAdjustment *) gtk_adjustment_new (0, 0,(gint) lame_get_totalframes(gfp)-1, 0, 0, 0);    frameprogress = gtk_progress_bar_new_with_adjustment (adj);    /* Set the format of the string that can be displayed in the     * trough of the progress bar:     * %p - percentage     * %v - value     * %l - lower range value     * %u - upper range value */    gtk_progress_set_format_string (GTK_PROGRESS (frameprogress), "%p%%");    gtk_progress_set_value (GTK_PROGRESS (frameprogress), (gdouble) 0);    gtk_progress_set_show_text (GTK_PROGRESS (frameprogress),TRUE);    gtk_widget_show (frameprogress);    gtk_box_pack_end (GTK_BOX (box2), frameprogress, FALSE, TRUE, 0);    /*********************************************************************/    /* stuff in box1  buttons along bottom */    /*********************************************************************/    button = gtk_button_new_with_label ("-1");    gtk_signal_connect (GTK_OBJECT (button), "clicked",			GTK_SIGNAL_FUNC (frameadv), (gpointer) "-1");    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);    gtk_widget_show(button);    button = gtk_button_new_with_label ("+1");    gtk_signal_connect (GTK_OBJECT (button), "clicked",			GTK_SIGNAL_FUNC (frameadv), (gpointer) "1");    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);    gtk_widget_show(button);    button = gtk_button_new_with_label ("+10");    gtk_signal_connect (GTK_OBJECT (button), "clicked",			GTK_SIGNAL_FUNC (frameadv), (gpointer) "10");    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);    gtk_widget_show(button);    button = gtk_button_new_with_label ("+100");    gtk_signal_connect (GTK_OBJECT (button), "clicked",			GTK_SIGNAL_FUNC (frameadv), (gpointer) "100");    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);    gtk_widget_show(button);    button = gtk_button_new_with_label ("last frame");    gtk_signal_connect (GTK_OBJECT (button), "clicked",			GTK_SIGNAL_FUNC (frameadv), (gpointer) "finish");    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);    gtk_widget_show(button);    button = gtk_button_new_with_label ("stop/plot");    gtk_signal_connect (GTK_OBJECT (button), "clicked",			GTK_SIGNAL_FUNC (plotclick), NULL);    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);    gtk_widget_show(button);    /*********************************************************************/    /* stuff in table.  all the plotting windows */    /*********************************************************************/    pcmbox = gpk_plot_new(graphx,graphy);    gtk_table_attach (GTK_TABLE(table),pcmbox,0,2,0,1,tableops,tableops,2,2 );    gtk_widget_show (pcmbox);    winbox = gpk_plot_new(graphy,graphy);    gtk_table_attach(GTK_TABLE(table),winbox,0,2,1,2,tableops,tableops,2,2);    gtk_widget_show (winbox);    mdctbox[0] = gpk_plot_new(graphy,graphy);    gtk_table_attach(GTK_TABLE(table),mdctbox[0],0,1,2,3,tableops,tableops,2,2);    gtk_widget_show (mdctbox[0]);    mdctbox[1] = gpk_plot_new(graphy,graphy);    gtk_table_attach (GTK_TABLE(table),mdctbox[1],1,2,2,3,tableops,tableops,2,2);    gtk_widget_show (mdctbox[1]);    enerbox[0] = gpk_plot_new(graphy,graphy);    gtk_table_attach(GTK_TABLE(table),enerbox[0],0,1,3,4,tableops,tableops,2,2);    gtk_widget_show (enerbox[0]);    enerbox[1] = gpk_plot_new(graphy,graphy);    gtk_table_attach (GTK_TABLE(table),enerbox[1],1,2,3,4,tableops,tableops,2,2);    gtk_widget_show (enerbox[1]);    sfbbox[0] = gpk_plot_new(graphy,graphy);    gtk_table_attach(GTK_TABLE(table),sfbbox[0],0,1,4,5,tableops,tableops,2,2);    gtk_widget_show (sfbbox[0]);    sfbbox[1] = gpk_plot_new(graphy,graphy);    gtk_table_attach (GTK_TABLE(table),sfbbox[1],1,2,4,5,tableops,tableops,2,2);    gtk_widget_show (sfbbox[1]);    gtk_idle_add((GtkFunction) frameadv1, NULL);    gtk_widget_show(menubar);     gtk_widget_show(box2);     gtk_widget_show(box3);     gtk_widget_show(table);    gtk_widget_show(box1);    gtk_widget_show (mbox);    gtk_widget_show (window);     /* show smallest allowed window */    /* make window bigger.   */     /* now the user will be able to shrink it, if desired */    /* gtk_widget_set_usize(mbox,500,500);  */    /* gtk_widget_show (window); */     /* show smallest allowed window */        idle_keepgoing=1;             /* processing of frames is ON */    idle_count_max=READ_AHEAD+1;  /* number of frames to process before plotting */    idle_count=0;                 /* pause & plot when idle_count=idle_count_max */    gtk_main ();    assert(mp3done);    return(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -