/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+
#+     Internet Radio Automation & Encoding Toolkit
#+
#+     Copyright (C) 2018 - 2025 by Kevin C. O'Kane
#+
#+     Kevin C. O'Kane
#+     kc.okane@gmail.com
#+     https://www.cs.uni.edu/~okane
#+     https://threadsafebooks.com/
#+
#+ This program is free software; you can redistribute it and/or modify
#+ it under the terms of the GNU General Public License as published by
#+ the Free Software Foundation; either version 2 of the License, or
#+ (at your option) any later version.
#+
#+ This program is distributed in the hope that it will be useful,
#+ but WITHOUT ANY WARRANTY; without even the implied warranty of
#+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#+ GNU General Public License for more details.
#+
#+ You should have received a copy of the GNU General Public License
#+ along with this program; if not, write to the Free Software
#+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#+
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

// Sept 29, 2025

#ifndef COMMON_EXTERNS_H
#define COMMON_EXTERNS_H

#include "includes.h"

#include "structures.h"
#include "defines.h"
#include "common-fcn-headers.h"

extern double TOWER_CIRCLE_FACTOR;
extern int ALBUM_MAX;
extern double DRAW_HEIGHT;
extern double rayRotate;
extern int video_file;
extern int no_microphone;
extern int band_width;
extern int firstTime;
extern int mpv_socket_running;
extern int band_start;
extern int decorate_flag;
extern int clip_changed;
extern int windows_audio;
extern int which_meters;
extern int micmute;
extern int sprinkleCount;
extern int lastDir;
extern int scan_in_progress;
extern int randomize_flg;
extern int slide_timer;
extern int show_covers;
extern int     ALBUM_COVER_UPDATE_TIME;
extern int talk_button;
extern int talk_button1;
extern int reCenter;
extern int slide_time;
extern int Topgain;
extern int timer_res;
extern int search_again_flag;
extern int haltProgram_flg;
extern float Eq_Vol;
extern libvlc_media_player_t *mediaPlayer;
extern libvlc_instance_t *inst;
extern libvlc_media_t *media;
extern libvlc_equalizer_t *equalizer;
extern int PROGRAM_MAX;
extern int AlbumBegin;
extern int redraw;
extern int source_channels;
extern int sink_channels;
extern int copyClipRow;
extern int AGC1;
extern int AGC;
extern int MaxAudioSample;
extern char directories[5][1024];
extern char **ProgramArray;
extern char **AlbumArray;
extern char session_type[32];
extern struct ST **programData;
extern struct shared_memory *SP;
extern int *programPlayed;
extern int *programTime;
extern int open_view;
extern char time_string[128];
extern char top1[];
extern char top2[];
extern char top3[];
extern char cutRow[];
extern char Web_Page[4096];
extern char            BackgroundColorString[64];
extern char    Music_Home_Directory[2048];
extern char    Program_List[1024];
extern char    Album_List[2048];
extern double cairo_bg_red;
extern double mic_volume;
extern double cairo_bg_green;
extern double cairo_bg_blue;
extern char Code_Home[];
extern GtkWidget *window;
extern GtkWidget *programMode1;
extern GtkWidget *TopBG;
extern GtkWidget *radial_start;
extern GtkWidget       *micThreshold1;
extern GtkWidget *egg_image;
extern GtkWidget *sock1;
extern GtkWidget *video_bg;
extern GtkWidget *video_bg1;
extern GtkWidget *mini_mode;
extern GtkWidget *solid_digital_arcs;
extern GtkWidget *radial_decay;
extern GtkWidget *sprinkleDamp;
extern GtkWidget *sprinkle_count;
extern GtkWidget *TimeToHour;
extern GtkWidget *webkit;
extern GtkWidget *web2_clear;
extern GtkWidget *mpv_player;
extern GtkWidget *vlcX;
extern GtkWidget *web_panel;
extern GtkWidget *video_panel;
extern GtkWidget *pg_edit;
extern GtkWidget *pg8_fixed;
extern GtkWidget *pg8;
extern GtkWidget *ed_fixed;
extern GtkWidget *ct_fixed;
extern GtkWidget *pg_fixed;
extern GtkWidget *au_fixed;
extern GtkWidget *audio;
extern GtkWidget *radio_bars, *radio_vu, *radio_digital, *radio_fans;

extern WebKitSettings *web_settings;

extern GtkWidget *current_stack;
extern GtkWidget *save3;
extern GtkWidget *art_metadata;
extern GtkWidget *web_entry;
extern GtkWidget *web_playlist;
extern GtkWidget *web_button;
extern char web_url[4096];
extern char web_url1[4096];
extern GtkWidget *no_graphs;
// extern GtkWidget *large462;
extern GtkWidget *agcLbl1;
extern GtkWidget *switcher1;
extern GtkWidget *zoom_level;
extern GtkWidget *antenna;
extern GtkWidget *d1mask;
extern GtkWidget *pg;
extern GtkWidget *noBackPic;
extern GtkWidget *stack1;
extern GtkWidget *agc_gain;
extern GtkWidget *bandwidth;
extern GtkWidget *bandstart;
extern GtkWidget *show_video;
extern GtkWidget *tile_box;
extern GtkWidget *seamless_button;
extern GtkWidget *agcLbl2;
extern GtkWidget *camdraw;
extern GtkWidget *ray_rotate;
extern GtkWidget *Cam0;
extern GtkWidget *cam0_image;
extern GtkWidget *SlidesImage;
extern GtkWidget *tooltips;
extern GtkWidget *time_of_day;
extern GtkWidget *masterVolLevel;
extern GtkWidget *pauseAtEnd;
extern GtkWidget *g_btn_play2;
extern GtkWidget *stk1;
extern GtkWidget *visual;
extern GtkWidget *meters;
extern GtkWidget *tower;
extern GtkWidget *traces;
extern GtkWidget *randColors;
extern GtkWidget *covers;
extern GtkWidget *tower_rays;
extern GtkWidget *tower_circles;
extern GtkWidget *SideSlidePanel;
extern GtkWidget *pg2;
extern GtkWidget *p1;
extern GtkWidget *p10;
extern GtkWidget *p10Time;
extern GtkWidget *p10TimeEnd;
extern GtkWidget *p10TimeLength;
extern GtkWidget *p11;
extern GtkWidget *p11Time;
extern GtkWidget *p11TimeEnd;
extern GtkWidget *p11TimeLength;
extern GtkWidget *p12;
extern GtkWidget *p12Time;
extern GtkWidget *p12TimeEnd;
extern GtkWidget *p12TimeLength;
extern GtkWidget *p13;
extern GtkWidget *p14;
extern GtkWidget *p15;
extern GtkWidget *p16;
extern GtkWidget *p17;
extern GtkWidget *p18;
extern GtkWidget *p19;
extern GtkWidget *p1Time;
extern GtkWidget *p1TimeEnd;
extern GtkWidget *p1TimeLength;
extern GtkWidget *p2;
extern GtkWidget *p20;
extern GtkWidget *p21;
extern GtkWidget *p22, *p23, *p24, *p25;
extern GtkWidget *p2Time;
extern GtkWidget *p2TimeEnd;
extern GtkWidget *p2TimeLength;
extern GtkWidget *p3;
extern GtkWidget *p3Time;
extern GtkWidget *p3TimeEnd;
extern GtkWidget *p3TimeLength;
extern GtkWidget *p4;
extern GtkWidget *p4Time;
extern GtkWidget *p4TimeEnd;
extern GtkWidget *p4TimeLength;
extern GtkWidget *p5;
extern GtkWidget *p5Time;
extern GtkWidget *p5TimeEnd;
extern GtkWidget *p5TimeLength;
extern GtkWidget *p6;
extern GtkWidget *p6Time;
extern GtkWidget *p6TimeEnd;
extern GtkWidget *p6TimeLength;
extern GtkWidget *p7;
extern GtkWidget *p7Time;
extern GtkWidget *p7TimeEnd;
extern GtkWidget *p7TimeLength;
extern GtkWidget *p8;
extern GtkWidget *p8Time;
extern GtkWidget *p8TimeEnd;
extern GtkWidget *p8TimeLength;
extern GtkWidget *p9;
extern GtkWidget *p9Time;
extern GtkWidget *p9TimeEnd;
extern GtkWidget *p9TimeLength;
extern GtkWidget *preampLbl;
extern GtkWidget *g_dbox1;
extern GtkWidget *openView;
extern GtkWidget *Top1;
extern GtkWidget *TopTop;
extern GtkWidget *micMute;
extern GtkWidget *sw1;
extern GtkWidget *finish_pgm;
extern GtkWidget *finish_pgm1;
extern GtkWidget *programMode;
extern GtkWidget *fixed1;
extern GtkWidget *draw2;
extern GtkWidget *video_draw;
extern GtkWidget *all_settings;
extern GtkWidget *edit_window_button;
extern GtkWidget *slides_window_button;
extern GtkWidget *float_program;
extern GtkWidget *vumeter;
extern GtkWidget *vumeter1;
extern GtkWidget *pauseVideo;
extern GtkWidget *pauseVideo1;
extern GtkWidget *haltProgram;
extern GtkWidget *skipThis;
extern GtkWidget *skipNext;
extern GtkWidget *vlcPosition;
extern GtkWidget *posLbl;
extern GtkWidget *nextPlay;
extern GtkWidget *currentFile;
extern GtkWidget *slides_window;
extern GtkWidget *edit_window;
extern GtkWidget *settings_window;
extern GtkWidget *pgm_window;
extern GtkWidget *controls;
extern GtkWidget *movie;
extern GtkWidget *draw4;
extern GtkWidget *draw1;
extern GtkWidget *drawV;
extern GtkWidget *agc;
extern GtkWidget *agcMod;
extern GtkWidget *decorations;
extern GtkWidget *recenter1;
extern GtkWidget *noMove1;
extern GtkWidget *albumScroll;
extern GtkWidget *albumBack;
extern GtkWidget *albumForward;
extern GtkWidget *showCovers;
extern GtkWidget *mediaGain;
extern GtkWidget *micThreshold1;
extern GtkWidget *about;
extern GtkWidget *above_bars;
extern GtkWidget *addEntry1;
extern GtkWidget *audioCalibrate;
extern GtkWidget *barWidth;
extern GtkWidget *bullseye;
extern GtkWidget *button10;
extern GtkWidget *button11;
extern GtkWidget *button12;
extern GtkWidget *button13;
extern GtkWidget *button14;
extern GtkWidget *button15;
extern GtkWidget *button1;
extern GtkWidget *button2;
extern GtkWidget *button3;
extern GtkWidget *button5;
extern GtkWidget *button6;
extern GtkWidget *button8;
extern GtkWidget *button9;
extern GtkWidget *check1;
extern GtkWidget *check10;
extern GtkWidget *check11;
extern GtkWidget *check12;
extern GtkWidget *check2;
extern GtkWidget *check3;
extern GtkWidget *check4;
extern GtkWidget *check5;
extern GtkWidget *check6;
extern GtkWidget *check7;
extern GtkWidget *check8;
extern GtkWidget *check9;
extern GtkWidget *choose1;
extern GtkWidget *circular;
extern GtkWidget *classical;
extern GtkWidget *clevel;
extern GtkWidget *clipThreshold;
extern GtkWidget *clrPgm;
extern GtkWidget *clrPgm1;
extern GtkWidget *club;
extern GtkWidget *connectGraph;
extern GtkWidget *currentFile;
extern GtkWidget *dance;
extern GtkWidget *del10;
extern GtkWidget *del11;
extern GtkWidget *del12;
extern GtkWidget *del13;
extern GtkWidget *del14;
extern GtkWidget *del15;
extern GtkWidget *del2;
extern GtkWidget *del3;
extern GtkWidget *del4;
extern GtkWidget *del7;
extern GtkWidget *del8;
extern GtkWidget *del9;
extern GtkWidget *displayBars;
extern GtkEntry  *entry1;
extern GtkEntry  *entry10;
extern GtkEntry  *entry11;
extern GtkEntry  *entry12;
extern GtkEntry  *entry13;
extern GtkEntry  *entry14;
extern GtkEntry  *entry15;
extern GtkEntry  *entry2;
extern GtkEntry  *entry3;
extern GtkEntry  *entry4;
extern GtkEntry  *entry7;
extern GtkEntry  *entry8;
extern GtkEntry  *entry9;
extern GtkWidget *eqReset;
extern GtkWidget *masterVolLevel;
extern GtkWidget *masterVolume;
extern GtkWidget *maxGain;
extern GtkWidget *mediaGain;
extern GtkWidget *nextPlay;
extern GtkWidget *Playerx;
extern GtkWidget *Playerx1;
extern GtkWidget *rampDown;
extern GtkWidget *rampSpeedDown;
extern GtkWidget *rampSpeedUp;
extern GtkWidget *rampUp;
extern GtkWidget *randomize;
extern GtkWidget *randomize1;
extern GtkWidget *rayCount;
extern GtkWidget *recenter;
extern GtkWidget *save1;
extern GtkWidget *save2;
extern GtkWidget *save4;
extern GtkWidget *scan_times;
extern GtkWidget *scan_times1;
extern GtkWidget *scroll2;
extern GtkWidget *scroll;
extern GtkWidget *search_again1;
extern GtkWidget *search_again;
extern GtkWidget *search_scroll;
extern GtkWidget *sgrStudio;
extern GtkWidget *shadow_offset;
extern GtkWidget *showCurrent;
extern GtkWidget *showCurrent1;
extern GtkWidget *slideTime;
extern GtkWidget *sort;
extern GtkWidget *sort1;
extern GtkWidget *spec12;
extern GtkWidget *spec20;
extern GtkWidget *spec7;
extern GtkWidget *spikes1;
extern GtkWidget *spikes;
extern GtkWidget *timeNext;
extern GtkWidget *timer;
extern GtkWidget *up1;
extern GtkWidget *up10;
extern GtkWidget *up11;
extern GtkWidget *up12;
extern GtkWidget *up2;
extern GtkWidget *up3;
extern GtkWidget *up4;
extern GtkWidget *up5;
extern GtkWidget *up6;
extern GtkWidget *up7;
extern GtkWidget *up8;
extern GtkWidget *up9;
extern GtkWidget *vlcSpinRate;
extern GtkWidget *image13;
extern GtkWidget *image14;
extern GtkWidget *image15;
extern GtkWidget *image16;
extern GtkWidget *image17;
extern GtkWidget *image18;
extern GtkWidget *image19;
extern GtkWidget *image20;
extern GtkWidget *image21;
extern GtkWidget *lbl1;
extern GtkWidget *lbl10;
extern GtkWidget *lbl11;
extern GtkWidget *lbl12;
extern GtkWidget *lbl13;
extern GtkWidget *lbl14;
extern GtkWidget *lbl15;
extern GtkWidget *lbl16;
extern GtkWidget *lbl17;
extern GtkWidget *lbl18;
extern GtkWidget *lbl19;
extern GtkWidget *lbl2;
extern GtkWidget *lbl20;
extern GtkWidget *lbl21;
extern GtkWidget *lbl22;
extern GtkWidget *lbl23;
extern GtkWidget *L1;
extern GtkWidget *L10;
extern GtkWidget *L1000;
extern GtkWidget *L12000;
extern GtkWidget *L14000;
extern GtkWidget *L16000;
extern GtkWidget *L170;
extern GtkWidget *L2;
extern GtkWidget *L3;
extern GtkWidget *L3000;
extern GtkWidget *L310;
extern GtkWidget *L4;
extern GtkWidget *L5;
extern GtkWidget *L6;
extern GtkWidget *L60;
extern GtkWidget *L600;
extern GtkWidget *L6000;
extern GtkWidget *L7;
extern GtkWidget *L8;
extern GtkWidget *L9;
extern GtkWidget *flat;
extern GtkWidget *fullBass;
extern GtkWidget *fullBassTreble;
extern GtkWidget *fullTreble;
extern GtkWidget *lbl1;
extern GtkWidget *lbl10;
extern GtkWidget *lbl11;
extern GtkWidget *lbl12;
extern GtkWidget *lbl14;
extern GtkWidget *lbl15;
extern GtkWidget *lbl16;
extern GtkWidget *lbl17;
extern GtkWidget *lbl18;
extern GtkWidget *lbl19;
extern GtkWidget *lbl2;
extern GtkWidget *lbl20;
extern GtkWidget *lbl21;
extern GtkWidget *lbl22;
extern GtkWidget *lbl23;
extern GtkWidget *lbl24;
extern GtkWidget *lbl25;
extern GtkWidget *lbl3;
extern GtkWidget *lbl4;
extern GtkWidget *lbl5;
extern GtkWidget *lbl6;
extern GtkWidget *lbl7;
extern GtkWidget *lbl8;
extern GtkWidget *lbl9;
extern GtkWidget *pg0;
extern GtkEntry  *alt_search;
extern GtkEntry  *alt_search1;
extern GtkEntry  *g_dbox1Entry;
extern GtkWidget *PlayPgm;
extern GtkWidget *PlayPgm1;
extern GtkCssProvider  *cssProvider_entry1;
extern GtkCssProvider  *cssProvider_entry2;
extern GtkCssProvider  *cssProvider_entry3;
extern GtkCssProvider  *cssProvider_entry4;
extern libvlc_equalizer_t *equalizer;
extern libvlc_instance_t *inst;
extern GtkAdjustment   *adjustment8;
extern GtkAdjustment   *adjustment10;
extern GtkAdjustment   *adjustment32;
extern GtkAdjustment   *adjustment33;
extern GtkAdjustment   *adjustment35;
extern GtkAdjustment   *adjustment11;
extern GtkAdjustment   *adjustment12;
extern GtkAdjustment   *adjustment13;
extern GtkAdjustment   *adjustment14;
extern GtkAdjustment   *adjustment15;
extern GtkAdjustment   *adjustment16;
extern GtkAdjustment   *adjustment17;
extern GtkAdjustment   *adjustment18;
extern GtkAdjustment   *adjustment19;
extern GtkAdjustment   *adjustment20;
extern GtkAdjustment   *adjustment45;
extern GtkAdjustment   *adjustment49;
extern GdkColor		webplay, notplayable, cover, unplayed, played, playing, low_tray;
extern GdkWindow *gdk_window;
extern GError *err;
extern GdkPixbuf *pixbuf;
extern GdkPixbuf *cambuf;
extern int bx1, bx2, bx3, bx4, bx5, bx6, bx7, bx8, bx9, bx10, bx11, bx12;
extern int PlayPgm_flg;
extern int skipThis_flg;
extern int showCurrent_flg;
extern int Playerx_flg;
extern int LeftFlg;
extern int bar_spots;
extern int graph_type;
extern int super_bars;
extern int rand_colors;
extern int ray_count;
extern int connect_graph;
extern int AGC;
extern int SaveFlg;
extern int save_flg;
extern int bulls_eye, bulls_eye1;
extern int circular_graph;
extern int show_spikes;
extern int display_bars;
extern int show_spikes1;
extern int draw_mode;
extern int style;
extern int no_move;
extern int e7Row,e8Row,e9Row,e10Row,e11Row,e12Row,e13Row,e14Row,e2Row,e3Row,e4Row,e15Row;
extern int showArc;
extern int showFan;
extern int drag_source;
extern int drag_target;
extern int c1state;
extern int c2state;
extern int c3state;
extern int c4state;
extern int c5state;
extern int c6state;
extern int c7state;
extern int c8state;
extern int c9state;
extern int c10state;
extern int c11state;
extern int c12state;
extern int L_Clipping, R_Clipping;
extern int MLr, MRr;
extern int MMr;
extern int cutPlay;
extern int video_init;
extern int cutPlayed;
extern int AlbumButton[];
extern int exchange;
extern double  G_OFF, G_OFF1, G_OFF_FREQ;
extern double master_volume;
extern double mic_max;
extern double SHADOW;
extern double GRAPH_BAR_WIDTH;
extern double bar_space;
extern double Lx, Rx;
extern double MaxLM;
extern double ML, MR;
extern double MaxRM, MaxLM;
extern double MLx, MRx;
extern double MaxMM;
extern double RAMP_SPEED_UP;
extern double RAMP_SPEED_DOWN;
extern double Balance;
extern double second, hour, minute;
extern double radialStart;
extern double radialDecay;
extern double AudioCalibrate;
extern double MaxL[], MaxR[], MaxM[];
extern double srchan[100], rchan[100];
extern double slchan[100], lchan[100];
extern double lastR1[100];
extern double lastR2[100];
extern double lastR3[100];
extern double lastR4[100];
extern double lastR5[100];
extern double lastR6[100];
extern double lastR7[100];
extern double lastR8[100];
extern double lastR9[100];
extern double lastRA[100];
extern double SWEEPER_REDUCE;
extern double curLevel;
extern float ClipLevel;
extern float exchangeBuf[];
extern time_t timeRemaining ;
extern struct APW     *widgets;

extern int	display_bars;

extern pa_glib_mainloop        *m_sink;        // internal audio - sink
extern pa_glib_mainloop        *m_source;      // pulse audio microphone - source

extern pa_context       *context_source;
extern pa_context       *context_sink;
extern pa_stream        *stream_sink;
extern pa_stream        *stream_source;
extern char             *device_name_source;
extern char             *device_name_sink;
extern char             *device_description_source;
extern char             *device_description_sink;

extern FILE *s1, *s2;

// extern GtkWidget       *window;
// extern GtkWidget       *fixed1;
// extern GtkWidget       *draw1;
// extern GtkWidget       *draw2;
// extern GtkWidget       *Bars;
// extern GtkWidget       *Spectrum;
// extern GtkWidget       *meters;
// extern GtkWidget       *balance;
// extern GtkBuilder      *builder;

// extern int samp1,samp2;
// extern int showArc;
// extern int showB2;
// extern int connect_graph; // whether to connect the bar graph bars
// extern int spectrum_width;
// extern int display_cover;
// extern int no_graph;
// extern int legacy_vumeters;
// extern int mono_graph;
// extern int timer_res;
// extern int no_meters;

// extern int LAT;
// extern int rand_colors;
// extern char bg_color[256];
// extern int  L_Clipping, R_Clipping;
// extern int  style;

// extern void                    bar_graph(int lower, double[], int, cairo_t *, int, int);
// extern void                    color_bars(cairo_t *cr, int, int, int);
// extern void                    frequency_marks(cairo_t *);
// extern void                    draw_bars_only(cairo_t *cr, int lower, int i, double chan[]);
// extern void                    connecting_lines(cairo_t *, int , int , double []);
// extern gboolean                on_draw1_draw (GtkDrawingArea *, cairo_t *) ;
// extern gboolean                on_draw2_draw (GtkDrawingArea *widget, cairo_t *cr);
// extern int                     style; // narrow
// extern double                  FACTOR, LeftChan, RightChan, Lx, Rx;
// extern double                  rUtil, srchan[100], rchan[100];
// extern double                  lUtil, slchan[100], lchan[100];
extern char                    default_source[1024];
extern char                    default_sink[1024];
// extern int                     no_microphone;
// extern float                   exchangeBuf[SAMPLE_SIZE];
// extern int                     exchange;
// extern int                     sink_channels, source_channels;
// extern int                     super_bars;         // bars above graphs

// #define RMX 5
// extern double                  MaxR[RMX], MaxL[RMX], MaxM[RMX];
// extern double                  MaxRM, MaxLM, MaxMM;
// extern int                     MRr, MLr, MMr;
//
// extern double                  ML, MR, Balance;
// extern double                  MLx, MRx;







#endif
