BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
bseloopfuncs.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BSE_LOOPFUNCS_H__
3 #define __BSE_LOOPFUNCS_H__
4 
5 #include <bse/gsldatautils.hh>
6 #include <bse/gslcommon.hh>
7 
8 G_BEGIN_DECLS
9 
10 
11 typedef struct {
12  /* block containing loop */
13  GslLong block_start;
14  GslLong block_length;
15  /* performance/quality parameters */
16  GslLong analysis_points;
17  /* assumed repetitions within block */
18  GslLong repetitions;
19  GslLong min_loop;
20  /* resulting loop */
21  gdouble score;
22  GslLong loop_start;
23  GslLong loop_length;
24  /* score details */
25  guint n_details;
26  const char *detail_names[64];
27  double detail_scores[64];
29 
30 /* mem-cached loop position and size finder. tests through all possible
31  * loop sizes around center points determined by block/(analysis_points+1).
32  * uses full-block comparisons (centering comparison area around the
33  * loop) and tight neighbourhood comparisons. the full-block and
34  * neighbourhood compraisons are normalized by the sample count to produce
35  * a single error score. the progress counter is slightly off and will
36  * often count to values lesser than 100%.
37  */
38 gboolean gsl_data_find_loop5 (GslDataHandle *dhandle,
39  GslDataLoopConfig *config,
40  gpointer pdata,
41  GslProgressFunc pfunc);
42 /* mem-cached loop position and size finder. tests through all possible
43  * loop sizes around center points determined by block/(analysis_points+1).
44  * uses full-block comparisons (centering comparison area around the
45  * loop) and can produce non-acceptable results. looping 6 seconds in
46  * 61 samples runs roughly 6 hours on 2500MHz.
47  */
48 gboolean gsl_data_find_loop4 (GslDataHandle *dhandle,
49  GslDataLoopConfig *config,
50  gpointer pdata,
51  GslProgressFunc pfunc);
52 /* fully mem-cached loop position/size finder.
53  * attempts to determine optimum loop position and size by trying all
54  * possible combinations (n^2) and doing a full block comparison on
55  * each (*n). performance is n^3 and not suitable for practical
56  * application. (and even then, full block comparisons are not a good
57  * enough criterion to always reveal acceptable loop transitions).
58  * 44100*3=132300, 132300*132300=17503290000
59  */
60 gboolean gsl_data_find_loop3 (GslDataHandle *dhandle,
61  GslDataLoopConfig *config,
62  gpointer pdata,
63  GslProgressFunc pfunc);
64 /* quick hack to dump gnuplot file with diffenrent loop
65  * positions or loop sizes
66  */
67 gboolean gsl_data_find_loop2 (GslDataHandle *dhandle,
68  GslDataLoopConfig *config,
69  gpointer pdata,
70  GslProgressFunc pfunc);
71 /* dcache based head-compare loop finder,
72  * 1) finds optimum loop length
73  * 2) find optimum loop position
74  * 3) reruns loop length finder around positions
75  * with shrinking neighbourhood comparisons
76  */
77 gboolean gsl_data_find_loop1 (GslDataHandle *dhandle,
78  GslDataLoopConfig *config,
79  gpointer pdata,
80  GslProgressFunc pfunc);
81 
82 
83 typedef enum
84 {
85  GSL_DATA_TAIL_LOOP_CMP_LEAST_SQUARE,
86  GSL_DATA_TAIL_LOOP_CMP_CORRELATION,
87 } GslDataTailLoopCmpType;
88 typedef struct {
89  GslLong min_loop; /* minimum size */
90  GslLong max_loop; /* maximum size (-1 for n_values) */
91  GslLong pre_loop_compare; /* area size */
92  GslDataTailLoopCmpType cmp_strategy;
93  /* |-----|----------------|-------------------------------|
94  * pre_loop_compare loop area (min_loop..max_loop)
95  * ^ ^
96  * loop_start loop_end
97  */
99 /* dcache based tail loop finder derived from code from stefan */
100 gdouble gsl_data_find_loop0 (GslDataHandle *dhandle,
101  const GslDataTailLoop *cfg,
102  GslLong *loop_start_p,
103  GslLong *loop_end_p);
104 /* gsl_data_find_loop0(): good loops, bad size:
105  * # Tail Loop Finding
106  * # --loop <cfg> loop finder configuration, consisting of ':'-seperated values:
107  * # n_samples indicating minimum loop size [4410]
108  * # n_samples indicating maximum loop size [-1]
109  * # n_samples compare area size (ahead of loop start) [8820]
110  * TL_CFG="--loop=5000:-1:5000"
111  */
112 
113 G_END_DECLS
114 
115 #endif /* __BSE_LOOPFUNCS_H__ */
Definition: bseloopfuncs.hh:88
Definition: bseloopfuncs.hh:11