History

Wrap SRC_ERR_XXX valus to SRC_ERR enum

evpobr committed 6 years ago

Commit 09d00861 parent 00629284 files · +34 −33Browse files

Unified · Split

4 files
  1. src/common.h +11 −10
  2. src/src_linear.c +5 −5
  3. src/src_sinc.c +13 −13
  4. src/src_zoh.c +5 −5
src/common.h+11−10
@@ -74,8 +74,9 @@ enum SRC_MODE · 73 unmodified lines
74 SRC_MODE_CALLBACK = 174 SRC_MODE_CALLBACK = 1
75} ;75} ;
76 76
77enum77enum SRC_ERR
78{ SRC_ERR_NO_ERROR = 0,78{
79 SRC_ERR_NO_ERROR = 0,
79 80
80 SRC_ERR_MALLOC_FAILED,81 SRC_ERR_MALLOC_FAILED,
81 SRC_ERR_BAD_STATE,82 SRC_ERR_BAD_STATE,
@@ -107,7 +108,7 @@ enum · 25 unmodified lines
107struct SRC_STATE_tag108struct SRC_STATE_tag
108{ double last_ratio, last_position ;109{ double last_ratio, last_position ;
109 110
110 int error ;111 enum SRC_ERR error ;
111 int channels ;112 int channels ;
112 113
113 /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */114 /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */
@@ -117,16 +118,16 @@ struct SRC_STATE_tag · 3 unmodified lines
117 void *private_data ;118 void *private_data ;
118 119
119 /* Varispeed process function. */120 /* Varispeed process function. */
120 int (*vari_process) (SRC_STATE *state, SRC_DATA *data) ;121 enum SRC_ERR (*vari_process) (SRC_STATE *state, SRC_DATA *data) ;
121 122
122 /* Constant speed process function. */123 /* Constant speed process function. */
123 int (*const_process) (SRC_STATE *state, SRC_DATA *data) ;124 enum SRC_ERR (*const_process) (SRC_STATE *state, SRC_DATA *data) ;
124 125
125 /* State reset. */126 /* State reset. */
126 void (*reset) (SRC_STATE *state) ;127 void (*reset) (SRC_STATE *state) ;
127 128
128 /* State clone. */129 /* State clone. */
129 int (*copy) (SRC_STATE *from, SRC_STATE *to) ;130 enum SRC_ERR (*copy) (SRC_STATE *from, SRC_STATE *to) ;
130 131
131 /* Data specific to SRC_MODE_CALLBACK. */132 /* Data specific to SRC_MODE_CALLBACK. */
132 src_callback_t callback_func ;133 src_callback_t callback_func ;
@@ -139,19 +140,19 @@ struct SRC_STATE_tag · 6 unmodified lines
139const char* sinc_get_name (int src_enum) ;140const char* sinc_get_name (int src_enum) ;
140const char* sinc_get_description (int src_enum) ;141const char* sinc_get_description (int src_enum) ;
141 142
142int sinc_set_converter (SRC_STATE *state, int src_enum) ;143enum SRC_ERR sinc_set_converter (SRC_STATE *state, int src_enum) ;
143 144
144/* In src_linear.c */145/* In src_linear.c */
145const char* linear_get_name (int src_enum) ;146const char* linear_get_name (int src_enum) ;
146const char* linear_get_description (int src_enum) ;147const char* linear_get_description (int src_enum) ;
147 148
148int linear_set_converter (SRC_STATE *state, int src_enum) ;149enum SRC_ERR linear_set_converter (SRC_STATE *state, int src_enum) ;
149 150
150/* In src_zoh.c */151/* In src_zoh.c */
151const char* zoh_get_name (int src_enum) ;152const char* zoh_get_name (int src_enum) ;
152const char* zoh_get_description (int src_enum) ;153const char* zoh_get_description (int src_enum) ;
153 154
154int zoh_set_converter (SRC_STATE *state, int src_enum) ;155enum SRC_ERR zoh_set_converter (SRC_STATE *state, int src_enum) ;
155 156
156/*----------------------------------------------------------157/*----------------------------------------------------------
157** Common static inline functions.158** Common static inline functions.
src/src_linear.c+5−5
@@ -14,9 +14,9 @@ · 13 unmodified lines
14#include "src_config.h"14#include "src_config.h"
15#include "common.h"15#include "common.h"
16 16
17static int linear_vari_process (SRC_STATE *state, SRC_DATA *data) ;17static enum SRC_ERR linear_vari_process (SRC_STATE *state, SRC_DATA *data) ;
18static void linear_reset (SRC_STATE *state) ;18static void linear_reset (SRC_STATE *state) ;
19static int linear_copy (SRC_STATE *from, SRC_STATE *to) ;19static enum SRC_ERR linear_copy (SRC_STATE *from, SRC_STATE *to) ;
20 20
21/*========================================================================================21/*========================================================================================
22*/22*/
@@ -37,7 +37,7 @@ typedef struct · 14 unmodified lines
37/*----------------------------------------------------------------------------------------37/*----------------------------------------------------------------------------------------
38*/38*/
39 39
40static int40static enum SRC_ERR
41linear_vari_process (SRC_STATE *state, SRC_DATA *data)41linear_vari_process (SRC_STATE *state, SRC_DATA *data)
42{ LINEAR_DATA *priv ;42{ LINEAR_DATA *priv ;
43 double src_ratio, input_index, rem ;43 double src_ratio, input_index, rem ;
@@ -158,7 +158,7 @@ linear_get_description (int src_enum) · 114 unmodified lines
158 return NULL ;158 return NULL ;
159} /* linear_get_descrition */159} /* linear_get_descrition */
160 160
161int161enum SRC_ERR
162linear_set_converter (SRC_STATE *state, int src_enum)162linear_set_converter (SRC_STATE *state, int src_enum)
163{ LINEAR_DATA *priv = NULL ;163{ LINEAR_DATA *priv = NULL ;
164 164
@@ -209,7 +209,7 @@ linear_reset (SRC_STATE *state) · 44 unmodified lines
209 return ;209 return ;
210} /* linear_reset */210} /* linear_reset */
211 211
212static int212static enum SRC_ERR
213linear_copy (SRC_STATE *from, SRC_STATE *to)213linear_copy (SRC_STATE *from, SRC_STATE *to)
214{214{
215 if (from->private_data == NULL)215 if (from->private_data == NULL)
src/src_sinc.c+13−13
@@ -58,16 +58,16 @@ typedef struct · 57 unmodified lines
58 float buffer [] ;58 float buffer [] ;
59} SINC_FILTER ;59} SINC_FILTER ;
60 60
61static int sinc_multichan_vari_process (SRC_STATE *state, SRC_DATA *data) ;61static enum SRC_ERR sinc_multichan_vari_process (SRC_STATE *state, SRC_DATA *data) ;
62static int sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data) ;62static enum SRC_ERR sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data) ;
63static int sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data) ;63static enum SRC_ERR sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data) ;
64static int sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data) ;64static enum SRC_ERR sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data) ;
65static int sinc_mono_vari_process (SRC_STATE *state, SRC_DATA *data) ;65static enum SRC_ERR sinc_mono_vari_process (SRC_STATE *state, SRC_DATA *data) ;
66 66
67static int prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len) WARN_UNUSED ;67static int prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len) WARN_UNUSED ;
68 68
69static void sinc_reset (SRC_STATE *state) ;69static void sinc_reset (SRC_STATE *state) ;
70static int sinc_copy (SRC_STATE *from, SRC_STATE *to) ;70static enum SRC_ERR sinc_copy (SRC_STATE *from, SRC_STATE *to) ;
71 71
72static inline increment_t72static inline increment_t
73double_to_fp (double x)73double_to_fp (double x)
@@ -142,7 +142,7 @@ sinc_get_description (int src_enum) · 68 unmodified lines
142 return NULL ;142 return NULL ;
143} /* sinc_get_descrition */143} /* sinc_get_descrition */
144 144
145int145enum SRC_ERR
146sinc_set_converter (SRC_STATE *state, int src_enum)146sinc_set_converter (SRC_STATE *state, int src_enum)
147{ SINC_FILTER *filter, temp_filter ;147{ SINC_FILTER *filter, temp_filter ;
148 increment_t count ;148 increment_t count ;
@@ -262,7 +262,7 @@ sinc_reset (SRC_STATE *state) · 113 unmodified lines
262 memset (filter->buffer + filter->b_len, 0xAA, filter->channels * sizeof (filter->buffer [0])) ;262 memset (filter->buffer + filter->b_len, 0xAA, filter->channels * sizeof (filter->buffer [0])) ;
263} /* sinc_reset */263} /* sinc_reset */
264 264
265static int265static enum SRC_ERR
266sinc_copy (SRC_STATE *from, SRC_STATE *to)266sinc_copy (SRC_STATE *from, SRC_STATE *to)
267{267{
268 if (from->private_data == NULL)268 if (from->private_data == NULL)
@@ -345,7 +345,7 @@ calc_output_single (SINC_FILTER *filter, increment_t increment, increment_t star · 76 unmodified lines
345 return (left + right) ;345 return (left + right) ;
346} /* calc_output_single */346} /* calc_output_single */
347 347
348static int348static enum SRC_ERR
349sinc_mono_vari_process (SRC_STATE *state, SRC_DATA *data)349sinc_mono_vari_process (SRC_STATE *state, SRC_DATA *data)
350{ SINC_FILTER *filter ;350{ SINC_FILTER *filter ;
351 double input_index, src_ratio, count, float_increment, terminate, rem ;351 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -501,7 +501,7 @@ calc_output_stereo (SINC_FILTER *filter, increment_t increment, increment_t star · 149 unmodified lines
501 output [ch] = (float) (scale * (left [ch] + right [ch])) ;501 output [ch] = (float) (scale * (left [ch] + right [ch])) ;
502} /* calc_output_stereo */502} /* calc_output_stereo */
503 503
504static int504static enum SRC_ERR
505sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data)505sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data)
506{ SINC_FILTER *filter ;506{ SINC_FILTER *filter ;
507 double input_index, src_ratio, count, float_increment, terminate, rem ;507 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -657,7 +657,7 @@ calc_output_quad (SINC_FILTER *filter, increment_t increment, increment_t start_ · 149 unmodified lines
657 output [ch] = (float) (scale * (left [ch] + right [ch])) ;657 output [ch] = (float) (scale * (left [ch] + right [ch])) ;
658} /* calc_output_quad */658} /* calc_output_quad */
659 659
660static int660static enum SRC_ERR
661sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data)661sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data)
662{ SINC_FILTER *filter ;662{ SINC_FILTER *filter ;
663 double input_index, src_ratio, count, float_increment, terminate, rem ;663 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -812,7 +812,7 @@ calc_output_hex (SINC_FILTER *filter, increment_t increment, increment_t start_f · 148 unmodified lines
812 output [ch] = (float) (scale * (left [ch] + right [ch])) ;812 output [ch] = (float) (scale * (left [ch] + right [ch])) ;
813} /* calc_output_hex */813} /* calc_output_hex */
814 814
815static int815static enum SRC_ERR
816sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data)816sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data)
817{ SINC_FILTER *filter ;817{ SINC_FILTER *filter ;
818 double input_index, src_ratio, count, float_increment, terminate, rem ;818 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -977,7 +977,7 @@ calc_output_multi (SINC_FILTER *filter, increment_t increment, increment_t start · 158 unmodified lines
977 return ;977 return ;
978} /* calc_output_multi */978} /* calc_output_multi */
979 979
980static int980static enum SRC_ERR
981sinc_multichan_vari_process (SRC_STATE *state, SRC_DATA *data)981sinc_multichan_vari_process (SRC_STATE *state, SRC_DATA *data)
982{ SINC_FILTER *filter ;982{ SINC_FILTER *filter ;
983 double input_index, src_ratio, count, float_increment, terminate, rem ;983 double input_index, src_ratio, count, float_increment, terminate, rem ;
src/src_zoh.c+5−5
@@ -14,9 +14,9 @@ · 13 unmodified lines
14#include "src_config.h"14#include "src_config.h"
15#include "common.h"15#include "common.h"
16 16
17static int zoh_vari_process (SRC_STATE *state, SRC_DATA *data) ;17static enum SRC_ERR zoh_vari_process (SRC_STATE *state, SRC_DATA *data) ;
18static void zoh_reset (SRC_STATE *state) ;18static void zoh_reset (SRC_STATE *state) ;
19static int zoh_copy (SRC_STATE *from, SRC_STATE *to) ;19static enum SRC_ERR zoh_copy (SRC_STATE *from, SRC_STATE *to) ;
20 20
21/*========================================================================================21/*========================================================================================
22*/22*/
@@ -35,7 +35,7 @@ typedef struct · 12 unmodified lines
35/*----------------------------------------------------------------------------------------35/*----------------------------------------------------------------------------------------
36*/36*/
37 37
38static int38static enum SRC_ERR
39zoh_vari_process (SRC_STATE *state, SRC_DATA *data)39zoh_vari_process (SRC_STATE *state, SRC_DATA *data)
40{ ZOH_DATA *priv ;40{ ZOH_DATA *priv ;
41 double src_ratio, input_index, rem ;41 double src_ratio, input_index, rem ;
@@ -149,7 +149,7 @@ zoh_get_description (int src_enum) · 107 unmodified lines
149 return NULL ;149 return NULL ;
150} /* zoh_get_descrition */150} /* zoh_get_descrition */
151 151
152int152enum SRC_ERR
153zoh_set_converter (SRC_STATE *state, int src_enum)153zoh_set_converter (SRC_STATE *state, int src_enum)
154{ ZOH_DATA *priv = NULL ;154{ ZOH_DATA *priv = NULL ;
155 155
@@ -200,7 +200,7 @@ zoh_reset (SRC_STATE *state) · 44 unmodified lines
200 return ;200 return ;
201} /* zoh_reset */201} /* zoh_reset */
202 202
203static int203static enum SRC_ERR
204zoh_copy (SRC_STATE *from, SRC_STATE *to)204zoh_copy (SRC_STATE *from, SRC_STATE *to)
205{205{
206 if (from->private_data == NULL)206 if (from->private_data == NULL)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t