1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2021 Joël Krähemann
3  *
4  * This file is part of GSequencer.
5  *
6  * GSequencer is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSequencer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __AGS_FFPLAYER_H__
21 #define __AGS_FFPLAYER_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gtk/gtk.h>
27 
28 #include <ags/libags.h>
29 #include <ags/libags-audio.h>
30 
31 #include <ags/libags-gui.h>
32 
33 #include <ags/X/ags_machine.h>
34 
35 G_BEGIN_DECLS
36 
37 #define AGS_TYPE_FFPLAYER                (ags_ffplayer_get_type())
38 #define AGS_FFPLAYER(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_FFPLAYER, AgsFFPlayer))
39 #define AGS_FFPLAYER_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_FFPLAYER, AgsFFPlayerClass))
40 #define AGS_IS_FFPLAYER(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_FFPLAYER))
41 #define AGS_IS_FFPLAYER_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_FFPLAYER))
42 #define AGS_FFPLAYER_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS (obj, AGS_TYPE_FFPLAYER, AgsFFPlayerClass))
43 
44 #define AGS_FFPLAYER_DEFAULT_CONTROL_WIDTH (12)
45 #define AGS_FFPLAYER_DEFAULT_CONTROL_HEIGHT (40)
46 
47 typedef struct _AgsFFPlayer AgsFFPlayer;
48 typedef struct _AgsFFPlayerClass AgsFFPlayerClass;
49 
50 typedef enum{
51   AGS_FFPLAYER_NO_LOAD          = 1,
52 }AgsFFPlayerFlags;
53 
54 struct _AgsFFPlayer
55 {
56   AgsMachine machine;
57 
58   guint flags;
59 
60   guint mapped_output_pad;
61   guint mapped_input_pad;
62 
63   gchar *name;
64   gchar *xml_type;
65 
66   AgsRecallContainer *playback_play_container;
67   AgsRecallContainer *playback_recall_container;
68 
69   AgsRecallContainer *notation_play_container;
70   AgsRecallContainer *notation_recall_container;
71 
72   AgsRecallContainer *two_pass_aliase_play_container;
73   AgsRecallContainer *two_pass_aliase_recall_container;
74 
75   AgsRecallContainer *volume_play_container;
76   AgsRecallContainer *volume_recall_container;
77 
78   AgsRecallContainer *envelope_play_container;
79   AgsRecallContainer *envelope_recall_container;
80 
81   AgsRecallContainer *buffer_play_container;
82   AgsRecallContainer *buffer_recall_container;
83 
84   AgsAudioContainer *audio_container;
85 
86   GtkEntry *filename;
87   GtkButton *open;
88 
89   AgsSF2Loader *sf2_loader;
90 
91   gchar *load_preset;
92   gchar *load_instrument;
93 
94   gint position;
95   GtkLabel *loading;
96 
97   guint control_width;
98   guint control_height;
99 
100   GtkDrawingArea *drawing_area;
101   GtkScrollbar *hscrollbar;
102   GtkAdjustment *hadjustment;
103 
104   GtkComboBox *preset;
105   GtkComboBox *instrument;
106 
107   GtkCheckButton *enable_synth_generator;
108 
109   GtkComboBox *pitch_function;
110 
111   GtkSpinButton *lower;
112   GtkSpinButton *key_count;
113 
114   GtkButton *update;
115 
116   GtkCheckButton *enable_aliase;
117 
118   AgsDial *aliase_a_amount;
119   AgsDial *aliase_a_phase;
120 
121   AgsDial *aliase_b_amount;
122   AgsDial *aliase_b_phase;
123 
124   GtkScale *volume;
125 
126   GtkWidget *open_dialog;
127 };
128 
129 struct _AgsFFPlayerClass
130 {
131   AgsMachineClass machine;
132 };
133 
134 GType ags_ffplayer_get_type(void);
135 
136 void ags_ffplayer_paint(AgsFFPlayer *ffplayer);
137 // char* ags_ffplayer_sound_string();
138 
139 void ags_ffplayer_open_filename(AgsFFPlayer *ffplayer,
140 				gchar *filename);
141 
142 void ags_ffplayer_load_preset(AgsFFPlayer *ffplayer);
143 void ags_ffplayer_load_instrument(AgsFFPlayer *ffplayer);
144 
145 void ags_ffplayer_update(AgsFFPlayer *ffplayer);
146 
147 gboolean ags_ffplayer_sf2_loader_completed_timeout(AgsFFPlayer *ffplayer);
148 
149 AgsFFPlayer* ags_ffplayer_new(GObject *soundcard);
150 
151 G_END_DECLS
152 
153 #endif /*__AGS_FFPLAYER_H__*/
154