1 
2 /*
3  * The Real SoundTracker - sample editor (header)
4  *
5  * Copyright (C) 1998-2019 Michael Krause
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef _SAMPLE_EDITOR_H
23 #define _SAMPLE_EDITOR_H
24 
25 #include "driver.h"
26 #include "sample-display.h"
27 #include "xm.h"
28 #include <gtk/gtk.h>
29 
30 typedef enum {
31     SAMPLE_EDITOR_DISPLAY_EDITOR = 0,
32     SAMPLE_EDITOR_DISPLAY_SAMPLING
33 } SampleEditorDisplay;
34 
35 typedef enum {
36     SAMPLE_EDITOR_VOLUME = 0,
37     SAMPLE_EDITOR_PANNING,
38     SAMPLE_EDITOR_FINETUNE,
39     SAMPLE_EDITOR_RELNOTE,
40     SAMPLE_EDITOR_SPIN_LAST
41 } SampleEditorSpin;
42 
43 typedef struct _STSampleChain STSampleChain;
44 struct _STSampleChain {
45     STSampleChain* next;
46     guint length;
47     void* data;
48 };
49 
50 void sample_editor_page_create(GtkNotebook* nb);
51 
52 gboolean sample_editor_handle_keys(int shift,
53     int ctrl,
54     int alt,
55     guint32 keyval,
56     gboolean pressed);
57 
58 void sample_editor_set_sample(STSample*);
59 void sample_editor_update(void);
60 
61 void sample_editor_stop_sampling(void);
62 void sample_editor_clear_buffers(STSampleChain* bufs);
63 void sample_editor_chain_to_sample(STSampleChain *bufs,
64     guint32 rlen,
65     STMixerFormat fmt,
66     guint32 srate,
67     const gboolean data_present,
68     const gchar* samplename,
69     const gchar* action,
70     const gchar* log_name);
71 
72 void sample_editor_start_updating(void);
73 void sample_editor_stop_updating(void);
74 
75 void sample_editor_copy_cut_common(gboolean copy, gboolean spliceout);
76 void sample_editor_paste_clicked(void);
77 void sample_editor_xcopy_samples(STSample* src_smp,
78     STSample* dest_smp,
79     const gboolean xchg);
80 
81 gboolean sample_editor_check_and_log_sample(STSample* sample,
82     const gchar* title,
83     const gint flags,
84     const gsize data_length);
85 
86 extern st_driver* sampling_driver;
87 extern void* sampling_driver_object;
88 
89 void sample_editor_set_mode(SampleEditorDisplay, SampleDisplayMode);
90 GtkAdjustment* sample_editor_get_adjustment(SampleEditorSpin);
91 void sample_editor_update_status(void);
92 
93 gboolean
94 sample_editor_sampled(void* src,
95     guint32 count,
96     gint mixfreq,
97     gint mixformat);
98 
99 #endif /* _SAMPLE_EDITOR_H */
100