int main(int argc, char **argv)
{
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"help", 0, 0, 'h'},
{ 0 , 0 , 0, 0 }
};
}
#else
/** async signal number */
-static int snd_async_signo = SIGIO;
+static const int snd_async_signo = SIGIO;
#endif
static LIST_HEAD(snd_async_handlers);
#endif
/* First table lookup for Ima-ADPCM quantizer */
-static char IndexAdjust[8] = { -1, -1, -1, -1, 2, 4, 6, 8 };
+static const char IndexAdjust[8] = { -1, -1, -1, -1, 2, 4, 6, 8 };
/* Second table lookup for Ima-ADPCM quantizer */
-static short StepSize[89] = {
+static const short StepSize[89] = {
7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
snd_pcm_direct_t *dshare = pcm->private_data;
- static snd_mask_t access = { .bits = {
+ static const snd_mask_t access = { .bits = {
(1<<SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) |
(1<<SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) |
(1<<SNDRV_PCM_ACCESS_RW_INTERLEAVED) |
struct snd_ext_parm sparams[SND_PCM_EXTPLUG_HW_PARAMS];
} extplug_priv_t;
-static int hw_params_type[SND_PCM_EXTPLUG_HW_PARAMS] = {
+static const int hw_params_type[SND_PCM_EXTPLUG_HW_PARAMS] = {
[SND_PCM_EXTPLUG_HW_FORMAT] = SND_PCM_HW_PARAM_FORMAT,
[SND_PCM_EXTPLUG_HW_CHANNELS] = SND_PCM_HW_PARAM_CHANNELS
};
#define is_mask_type(i) (hw_params_type[i] < SND_PCM_HW_PARAM_FIRST_INTERVAL)
-static unsigned int excl_parbits[SND_PCM_EXTPLUG_HW_PARAMS] = {
+static const unsigned int excl_parbits[SND_PCM_EXTPLUG_HW_PARAMS] = {
[SND_PCM_EXTPLUG_HW_FORMAT] = (SND_PCM_HW_PARBIT_FORMAT|
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS),
static int write_wav_header(snd_pcm_t *pcm)
{
snd_pcm_file_t *file = pcm->private_data;
- static char header[] = {
+ static const char header[] = {
'R', 'I', 'F', 'F',
0x24, 0, 0, 0,
'W', 'A', 'V', 'E',
'f', 'm', 't', ' ',
0x10, 0, 0, 0,
};
- static char header2[] = {
+ static const char header2[] = {
'd', 'a', 't', 'a',
0, 0, 0, 0
};
snd_pcm_t *pcm;
snd_pcm_iec958_t *iec;
int err;
- static unsigned char default_status_bits[] = {
+ static const unsigned char default_status_bits[] = {
IEC958_AES0_CON_EMPHASIS_NONE,
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
0,
return 0;
}
-static int hw_params_type[SND_PCM_IOPLUG_HW_PARAMS] = {
+static const int hw_params_type[SND_PCM_IOPLUG_HW_PARAMS] = {
[SND_PCM_IOPLUG_HW_ACCESS] = SND_PCM_HW_PARAM_ACCESS,
[SND_PCM_IOPLUG_HW_FORMAT] = SND_PCM_HW_PARAM_FORMAT,
[SND_PCM_IOPLUG_HW_CHANNELS] = SND_PCM_HW_PARAM_CHANNELS,
static int snd_pcm_ioplug_pause(snd_pcm_t *pcm, int enable)
{
ioplug_priv_t *io = pcm->private_data;
- static snd_pcm_state_t states[2] = {
+ static const snd_pcm_state_t states[2] = {
SND_PCM_STATE_RUNNING, SND_PCM_STATE_PAUSED
};
int prev, err;
return 0;
}
-static int linear_formats[4][2][2] = {
+static const int linear_formats[4][2][2] = {
{ { SNDRV_PCM_FORMAT_S8, SNDRV_PCM_FORMAT_S8 },
{ SNDRV_PCM_FORMAT_U8, SNDRV_PCM_FORMAT_U8 } },
{ { SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_FORMAT_S16_BE },
{ SNDRV_PCM_FORMAT_U32_LE, SNDRV_PCM_FORMAT_U32_BE } }
};
-static int linear24_formats[3][2][2] = {
+static const int linear24_formats[3][2][2] = {
{ { SNDRV_PCM_FORMAT_S24_3LE, SNDRV_PCM_FORMAT_S24_3BE },
{ SNDRV_PCM_FORMAT_U24_3LE, SNDRV_PCM_FORMAT_U24_3BE } },
{ { SNDRV_PCM_FORMAT_S20_3LE, SNDRV_PCM_FORMAT_S20_3BE },
#define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v
-const char *snd_pcm_hw_param_names[] = {
+const char *const snd_pcm_hw_param_names[] = {
HW_PARAM(ACCESS),
HW_PARAM(FORMAT),
HW_PARAM(SUBFORMAT),
typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t;
typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule);
+ const snd_pcm_hw_rule_t *rule);
struct _snd_pcm_hw_rule {
int var;
};
static int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+ const snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_mul(hw_param_interval_c(params, rule->deps[0]),
}
static int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+ const snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_div(hw_param_interval_c(params, rule->deps[0]),
}
static int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+ const snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]),
}
static int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+ const snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]),
}
static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+ const snd_pcm_hw_rule_t *rule)
{
int changed = 0;
snd_pcm_format_t k;
static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+ const snd_pcm_hw_rule_t *rule)
{
unsigned int min, max;
snd_pcm_format_t k;
return changed;
}
-static snd_pcm_hw_rule_t refine_rules[] = {
+static const snd_pcm_hw_rule_t refine_rules[] = {
{
.var = SND_PCM_HW_PARAM_FORMAT,
.func = snd_pcm_hw_rule_format,
#define RULES (sizeof(refine_rules) / sizeof(refine_rules[0]))
-static snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PARAM_FIRST_MASK + 1] = {
+static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PARAM_FIRST_MASK + 1] = {
[SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK] = {
.bits = { 0x1f },
},
},
};
-static snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = {
+static const snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = {
[SND_PCM_HW_PARAM_SAMPLE_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
.min = 1, .max = UINT_MAX,
.openmin = 0, .openmax = 0, .integer = 1, .empty = 0,
do {
again = 0;
for (k = 0; k < RULES; k++) {
- snd_pcm_hw_rule_t *r = &refine_rules[k];
+ const snd_pcm_hw_rule_t *r = &refine_rules[k];
unsigned int d;
int doit = 0;
for (d = 0; r->deps[d] >= 0; d++) {
return 0;
}
-static snd_pcm_format_t linear_preferred_formats[] = {
+static const snd_pcm_format_t linear_preferred_formats[] = {
#ifdef SND_LITTLE_ENDIAN
SND_PCM_FORMAT_S16_LE,
SND_PCM_FORMAT_U16_LE,
#endif
#ifdef BUILD_PCM_NONLINEAR
-static snd_pcm_format_t nonlinear_preferred_formats[] = {
+static const snd_pcm_format_t nonlinear_preferred_formats[] = {
#ifdef BUILD_PCM_PLUGIN_MULAW
SND_PCM_FORMAT_MU_LAW,
#endif
#endif
#ifdef BUILD_PCM_PLUGIN_LFLOAT
-static snd_pcm_format_t float_preferred_formats[] = {
+static const snd_pcm_format_t float_preferred_formats[] = {
#ifdef SND_LITTLE_ENDIAN
SND_PCM_FORMAT_FLOAT_LE,
SND_PCM_FORMAT_FLOAT64_LE,
};
#endif
-static char linear_format_widths[32] = {
+static const char linear_format_widths[32] = {
0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 1,
0, 1, 0, 1, 0, 0, 0, 1,
snd_pcm_plug_params_t *slave)
{
snd_pcm_plug_t *plug = pcm->private_data;
- static int (*funcs[])(snd_pcm_t *_pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = {
+ static int (*const funcs[])(snd_pcm_t *_pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = {
#ifdef BUILD_PCM_PLUGIN_MMAP_EMUL
snd_pcm_plug_change_mmap,
#endif
#define ZERO_DB 0.0
#define MAX_DB_UPPER_LIMIT 50
-static unsigned int preset_dB_value[PRESET_RESOLUTION] = {
+static const unsigned int preset_dB_value[PRESET_RESOLUTION] = {
0x00b8, 0x00bd, 0x00c1, 0x00c5, 0x00ca, 0x00cf, 0x00d4, 0x00d9,
0x00de, 0x00e3, 0x00e8, 0x00ed, 0x00f3, 0x00f9, 0x00fe, 0x0104,
0x010a, 0x0111, 0x0117, 0x011e, 0x0124, 0x012b, 0x0132, 0x0139,
/* set up dB table */
if (min_dB == PRESET_MIN_DB && max_dB == ZERO_DB && resolution == PRESET_RESOLUTION)
- svol->dB_value = preset_dB_value;
+ svol->dB_value = (unsigned int*)preset_dB_value;
else {
#ifndef HAVE_SOFT_FLOAT
svol->dB_value = calloc(resolution, sizeof(unsigned int));
#ifdef CONV_LABELS
/* src_wid src_endswap sign_toggle dst_wid dst_endswap */
-static void *conv_labels[4 * 2 * 2 * 4 * 2] = {
+static void *const conv_labels[4 * 2 * 2 * 4 * 2] = {
&&conv_xxx1_xxx1, /* 8h -> 8h */
&&conv_xxx1_xxx1, /* 8h -> 8s */
&&conv_xxx1_xx10, /* 8h -> 16h */
#ifdef GET16_LABELS
/* src_wid src_endswap sign_toggle */
-static void *get16_labels[4 * 2 * 2 + 4 * 3] = {
+static void *const get16_labels[4 * 2 * 2 + 4 * 3] = {
&&get16_1_10, /* 8h -> 16h */
&&get16_1_90, /* 8h ^> 16h */
&&get16_1_10, /* 8s -> 16h */
#ifdef PUT16_LABELS
/* dst_wid dst_endswap sign_toggle */
-static void *put16_labels[4 * 2 * 2] = {
+static void *const put16_labels[4 * 2 * 2] = {
&&put16_12_1, /* 16h -> 8h */
&&put16_12_9, /* 16h ^> 8h */
&&put16_12_1, /* 16h -> 8s */
#ifdef GET32_LABELS
/* src_wid src_endswap sign_toggle */
-static void *get32_labels[4 * 2 * 2 + 4 * 3] = {
+static void *const get32_labels[4 * 2 * 2 + 4 * 3] = {
&&get32_1_1000, /* 8h -> 32h */
&&get32_1_9000, /* 8h ^> 32h */
&&get32_1_1000, /* 8s -> 32h */
#ifdef PUT32_LABELS
/* dst_wid dst_endswap sign_toggle */
-static void *put32_labels[4 * 2 * 2 + 4 * 3] = {
+static void *const put32_labels[4 * 2 * 2 + 4 * 3] = {
&&put32_1234_1, /* 32h -> 8h */
&&put32_1234_9, /* 32h ^> 8h */
&&put32_1234_1, /* 32h -> 8s */
#ifdef GETU_LABELS
/* width endswap sign_toggle */
-static void *getu_labels[4 * 2 * 2] = {
+static void *const getu_labels[4 * 2 * 2] = {
&&getu_1_1, /* 8h -> 8h */
&&getu_1_9, /* 8h ^> 8h */
&&getu_1_1, /* 8s -> 8h */
#ifdef GETS_LABELS
/* width endswap sign_toggle */
-static void *gets_labels[4 * 2 * 2] = {
+static void *const gets_labels[4 * 2 * 2] = {
&&gets_1_1, /* 8h -> 8h */
&&gets_1_9, /* 8h ^> 8h */
&&gets_1_1, /* 8s -> 8h */
#ifdef PUT_LABELS
/* width endswap sign_toggle */
-static void *put_labels[4 * 2 * 2] = {
+static void *const put_labels[4 * 2 * 2] = {
&&put_1_1, /* 8h -> 8h */
&&put_1_9, /* 8h ^> 8h */
&&put_1_1, /* 8h -> 8s */
#ifdef PUT32F_LABELS
/* type (0 = float, 1 = float64), endswap */
-static void *put32float_labels[2 * 2] = {
+static void *const put32float_labels[2 * 2] = {
&&put32f_1234_1234F, /* 32h -> (float)h */
&&put32f_1234_4321F, /* 32h -> (float)s */
&&put32f_1234_1234D, /* 32h -> (float64)h */
#ifdef GET32F_LABELS
/* type (0 = float, 1 = float64), endswap */
-static void *get32float_labels[2 * 2] = {
+static void *const get32float_labels[2 * 2] = {
&&get32f_1234F_1234, /* (float)h -> 32h */
&&get32f_4321F_1234, /* (float)s -> 32h */
&&get32f_1234D_1234, /* (float64)h -> 32h */
}
/* src_wid dst_sign dst_wid dst_end */
-static void *norms_labels[4 * 2 * 4 * 2] = {
+static void *const norms_labels[4 * 2 * 4 * 2] = {
&&norms_8_u8, /* s8 -> u8 */
&&norms_8_u8, /* s8 -> u8 */
&&norms_8_u16h, /* s8 -> u16h */
* event list
*/
#ifndef DOC_HIDDEN
-static struct status_event_list_t {
+static const struct status_event_list_t {
int event;
int qlen;
event_encode_t encode;
static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int len, const snd_seq_event_t *ev);
static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev);
-static struct extra_event_list_t {
+static const struct extra_event_list_t {
int event;
int (*decode)(snd_midi_event_t *dev, unsigned char *buf, int len, const snd_seq_event_t *ev);
} extra_event[] = {
static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev)
{
unsigned char cmd;
- char *cbytes;
- static char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
+ const char *cbytes;
+ static const char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
MIDI_CTL_NONREG_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
- static char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB,
+ static const char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB,
MIDI_CTL_REGIST_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };