aucat, sndiod: const-ify lookup tables

From naddy@
This commit is contained in:
Alexandre Ratchov 2021-01-13 17:30:19 +01:00
parent 21580f56b5
commit b1c2df5d9c
7 changed files with 28 additions and 28 deletions

View File

@ -131,28 +131,28 @@ struct au_hdr {
/* followed by optional desc[] continuation */
};
char wav_id_riff[4] = {'R', 'I', 'F', 'F'};
char wav_id_wave[4] = {'W', 'A', 'V', 'E'};
char wav_id_data[4] = {'d', 'a', 't', 'a'};
char wav_id_fmt[4] = {'f', 'm', 't', ' '};
char wav_guid[14] = {
const char wav_id_riff[4] = {'R', 'I', 'F', 'F'};
const char wav_id_wave[4] = {'W', 'A', 'V', 'E'};
const char wav_id_data[4] = {'d', 'a', 't', 'a'};
const char wav_id_fmt[4] = {'f', 'm', 't', ' '};
const char wav_guid[14] = {
0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x80, 0x00,
0x00, 0xAA, 0x00, 0x38,
0x9B, 0x71
};
char aiff_id_form[4] = {'F', 'O', 'R', 'M'};
char aiff_id_aiff[4] = {'A', 'I', 'F', 'F'};
char aiff_id_aifc[4] = {'A', 'I', 'F', 'C'};
char aiff_id_data[4] = {'S', 'S', 'N', 'D'};
char aiff_id_comm[4] = {'C', 'O', 'M', 'M'};
char aiff_id_none[4] = {'N', 'O', 'N', 'E'};
char aiff_id_fl32[4] = {'f', 'l', '3', '2'};
char aiff_id_ulaw[4] = {'u', 'l', 'a', 'w'};
char aiff_id_alaw[4] = {'a', 'l', 'a', 'w'};
const char aiff_id_form[4] = {'F', 'O', 'R', 'M'};
const char aiff_id_aiff[4] = {'A', 'I', 'F', 'F'};
const char aiff_id_aifc[4] = {'A', 'I', 'F', 'C'};
const char aiff_id_data[4] = {'S', 'S', 'N', 'D'};
const char aiff_id_comm[4] = {'C', 'O', 'M', 'M'};
const char aiff_id_none[4] = {'N', 'O', 'N', 'E'};
const char aiff_id_fl32[4] = {'f', 'l', '3', '2'};
const char aiff_id_ulaw[4] = {'u', 'l', 'a', 'w'};
const char aiff_id_alaw[4] = {'a', 'l', 'a', 'w'};
char au_id[4] = {'.', 's', 'n', 'd'};
const char au_id[4] = {'.', 's', 'n', 'd'};
static inline unsigned int
le16_get(le16_t *p)

View File

@ -132,8 +132,8 @@ struct slot *slot_list = NULL;
/*
* length of voice and common MIDI messages (status byte included)
*/
unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
const unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
const unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
char usagestr[] = "usage: aucat [-dn] [-b size] "
"[-c min:max] [-e enc] [-f device] [-g position]\n\t"

View File

@ -18,7 +18,7 @@
#include "dsp.h"
#include "utils.h"
int aparams_ctltovol[128] = {
const int aparams_ctltovol[128] = {
0,
256, 266, 276, 287, 299, 310, 323, 335,
348, 362, 376, 391, 406, 422, 439, 456,
@ -38,7 +38,7 @@ int aparams_ctltovol[128] = {
26008, 27029, 28090, 29193, 30339, 31530, 32768
};
short dec_ulawmap[256] = {
const short dec_ulawmap[256] = {
-32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
-23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
-15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
@ -73,7 +73,7 @@ short dec_ulawmap[256] = {
56, 48, 40, 32, 24, 16, 8, 0
};
short dec_alawmap[256] = {
const short dec_alawmap[256] = {
-5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
-7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
-2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
@ -108,7 +108,7 @@ short dec_alawmap[256] = {
944, 912, 1008, 976, 816, 784, 880, 848
};
int resamp_filt[RESAMP_LENGTH / RESAMP_STEP + 1] = {
const int resamp_filt[RESAMP_LENGTH / RESAMP_STEP + 1] = {
0, 0, 3, 9, 22, 42, 73, 116,
174, 248, 341, 454, 589, 749, 934, 1148,
1392, 1666, 1974, 2316, 2693, 3107, 3560, 4051,
@ -842,7 +842,7 @@ dec_do_ulaw(struct conv *p, unsigned char *in,
unsigned int f;
unsigned char *idata;
adata_t *odata;
short *map;
const short *map;
#ifdef DEBUG
if (log_level >= 4) {

View File

@ -165,7 +165,7 @@ struct cmap {
};
#define MIDI_TO_ADATA(m) (aparams_ctltovol[m] << (ADATA_BITS - 16))
extern int aparams_ctltovol[128];
extern const int aparams_ctltovol[128];
void aparams_init(struct aparams *);
void aparams_log(struct aparams *);

View File

@ -18,7 +18,7 @@
#include "dsp.h"
#include "utils.h"
int aparams_ctltovol[128] = {
const int aparams_ctltovol[128] = {
0,
256, 266, 276, 287, 299, 310, 323, 335,
348, 362, 376, 391, 406, 422, 439, 456,
@ -38,7 +38,7 @@ int aparams_ctltovol[128] = {
26008, 27029, 28090, 29193, 30339, 31530, 32768
};
int resamp_filt[RESAMP_LENGTH / RESAMP_STEP + 1] = {
const int resamp_filt[RESAMP_LENGTH / RESAMP_STEP + 1] = {
0, 0, 3, 9, 22, 42, 73, 116,
174, 248, 341, 454, 589, 749, 934, 1148,
1392, 1666, 1974, 2316, 2693, 3107, 3560, 4051,

View File

@ -164,7 +164,7 @@ struct cmap {
};
#define MIDI_TO_ADATA(m) (aparams_ctltovol[m] << (ADATA_BITS - 16))
extern int aparams_ctltovol[128];
extern const int aparams_ctltovol[128];
void aparams_init(struct aparams *);
void aparams_log(struct aparams *);

View File

@ -55,8 +55,8 @@ struct midithru {
/*
* length of voice and common messages (status byte included)
*/
unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
const unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
const unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
void
midi_log(struct midi *ep)