kopia lustrzana https://github.com/rs1729/RS
rs92,rs41,dfm,m10: select stereo channel
rodzic
630dee9a8b
commit
09502c8ae8
|
@ -167,6 +167,7 @@ int getCorrDFT(int abs, int K, unsigned int pos, float *maxv, unsigned int *maxv
|
||||||
|
|
||||||
static int sample_rate = 0, bits_sample = 0, channels = 0;
|
static int sample_rate = 0, bits_sample = 0, channels = 0;
|
||||||
static float samples_per_bit = 0;
|
static float samples_per_bit = 0;
|
||||||
|
static int wav_ch = 0; // 0: links bzw. mono; 1: rechts
|
||||||
|
|
||||||
static int findstr(char *buff, char *str, int pos) {
|
static int findstr(char *buff, char *str, int pos) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -176,7 +177,7 @@ static int findstr(char *buff, char *str, int pos) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
float read_wav_header(FILE *fp, float baudrate) {
|
float read_wav_header(FILE *fp, float baudrate, int wav_channel) {
|
||||||
char txt[4+1] = "\0\0\0\0";
|
char txt[4+1] = "\0\0\0\0";
|
||||||
unsigned char dat[4];
|
unsigned char dat[4];
|
||||||
int byte, p=0;
|
int byte, p=0;
|
||||||
|
@ -224,6 +225,10 @@ float read_wav_header(FILE *fp, float baudrate) {
|
||||||
fprintf(stderr, "bits : %d\n", bits_sample);
|
fprintf(stderr, "bits : %d\n", bits_sample);
|
||||||
fprintf(stderr, "channels : %d\n", channels);
|
fprintf(stderr, "channels : %d\n", channels);
|
||||||
|
|
||||||
|
if (wav_channel >= 0 && wav_channel < channels) wav_ch = wav_channel;
|
||||||
|
else wav_ch = 0;
|
||||||
|
fprintf(stderr, "channel-In : %d\n", wav_ch+1);
|
||||||
|
|
||||||
if ((bits_sample != 8) && (bits_sample != 16)) return -1;
|
if ((bits_sample != 8) && (bits_sample != 16)) return -1;
|
||||||
|
|
||||||
samples_per_bit = sample_rate/baudrate;
|
samples_per_bit = sample_rate/baudrate;
|
||||||
|
@ -241,7 +246,7 @@ static int f32read_sample(FILE *fp, float *s) {
|
||||||
|
|
||||||
if (fread( &b, bits_sample/8, 1, fp) != 1) return EOF;
|
if (fread( &b, bits_sample/8, 1, fp) != 1) return EOF;
|
||||||
|
|
||||||
if (i == 0) { // i = 0: links bzw. mono
|
if (i == wav_ch) { // i = 0: links bzw. mono
|
||||||
//if (bits_sample == 8) sint = b-128; // 8bit: 00..FF, centerpoint 0x80=128
|
//if (bits_sample == 8) sint = b-128; // 8bit: 00..FF, centerpoint 0x80=128
|
||||||
//if (bits_sample == 16) sint = (short)b;
|
//if (bits_sample == 16) sint = (short)b;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
float read_wav_header(FILE*, float);
|
float read_wav_header(FILE*, float, int);
|
||||||
int f32buf_sample(FILE*, int, int);
|
int f32buf_sample(FILE*, int, int);
|
||||||
int read_sbit(FILE*, int, int*, int, int, int, int);
|
int read_sbit(FILE*, int, int*, int, int, int, int);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_ptu = 0,
|
option_ptu = 0,
|
||||||
option_ths = 0,
|
option_ths = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
|
|
||||||
|
@ -642,6 +643,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
else if ( (strcmp(*argv, "--ecc") == 0) ) { option_ecc = 1; }
|
else if ( (strcmp(*argv, "--ecc") == 0) ) { option_ecc = 1; }
|
||||||
else if ( (strcmp(*argv, "--ptu") == 0) ) { option_ptu = 1; }
|
else if ( (strcmp(*argv, "--ptu") == 0) ) { option_ptu = 1; }
|
||||||
|
else if ( (strcmp(*argv, "--ch2") == 0) ) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else if ( (strcmp(*argv, "--ths") == 0) ) {
|
else if ( (strcmp(*argv, "--ths") == 0) ) {
|
||||||
++argv;
|
++argv;
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
|
@ -662,7 +664,7 @@ int main(int argc, char **argv) {
|
||||||
if (!wavloaded) fp = stdin;
|
if (!wavloaded) fp = stdin;
|
||||||
|
|
||||||
|
|
||||||
spb = read_wav_header(fp, (float)BAUD_RATE);
|
spb = read_wav_header(fp, (float)BAUD_RATE, wav_channel);
|
||||||
if ( spb < 0 ) {
|
if ( spb < 0 ) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fprintf(stderr, "error: wav header\n");
|
fprintf(stderr, "error: wav header\n");
|
||||||
|
|
|
@ -50,6 +50,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_ptu = 0,
|
option_ptu = 0,
|
||||||
option_dc = 0,
|
option_dc = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/*
|
/*
|
||||||
|
@ -825,7 +826,8 @@ int main(int argc, char **argv) {
|
||||||
else if ( (strcmp(*argv, "--dc") == 0) ) {
|
else if ( (strcmp(*argv, "--dc") == 0) ) {
|
||||||
option_dc = 1;
|
option_dc = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp(*argv, "--ths") == 0) {
|
else if ( (strcmp(*argv, "--ch2") == 0) ) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
|
else if ( (strcmp(*argv, "--ths") == 0) ) {
|
||||||
++argv;
|
++argv;
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
thres = atof(*argv);
|
thres = atof(*argv);
|
||||||
|
@ -845,7 +847,7 @@ int main(int argc, char **argv) {
|
||||||
if (!wavloaded) fp = stdin;
|
if (!wavloaded) fp = stdin;
|
||||||
|
|
||||||
|
|
||||||
spb = read_wav_header(fp, (float)BAUD_RATE);
|
spb = read_wav_header(fp, (float)BAUD_RATE, wav_channel);
|
||||||
if ( spb < 0 ) {
|
if ( spb < 0 ) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fprintf(stderr, "error: wav header\n");
|
fprintf(stderr, "error: wav header\n");
|
||||||
|
|
|
@ -70,6 +70,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_ptu = 0,
|
option_ptu = 0,
|
||||||
option_ths = 0,
|
option_ths = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
|
|
||||||
|
|
||||||
#define BITS 8
|
#define BITS 8
|
||||||
|
@ -1191,6 +1192,7 @@ int main(int argc, char *argv[]) {
|
||||||
else if (strcmp(*argv, "--std2") == 0) { frmlen = 518; } // NDATA_LEN+XDATA_LEN
|
else if (strcmp(*argv, "--std2") == 0) { frmlen = 518; } // NDATA_LEN+XDATA_LEN
|
||||||
else if (strcmp(*argv, "--sat") == 0) { option_sat = 1; }
|
else if (strcmp(*argv, "--sat") == 0) { option_sat = 1; }
|
||||||
else if (strcmp(*argv, "--ptu") == 0) { option_ptu = 1; }
|
else if (strcmp(*argv, "--ptu") == 0) { option_ptu = 1; }
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else if (strcmp(*argv, "--ths") == 0) {
|
else if (strcmp(*argv, "--ths") == 0) {
|
||||||
++argv;
|
++argv;
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
|
@ -1211,7 +1213,7 @@ int main(int argc, char *argv[]) {
|
||||||
if (!wavloaded) fp = stdin;
|
if (!wavloaded) fp = stdin;
|
||||||
|
|
||||||
|
|
||||||
spb = read_wav_header(fp, (float)BAUD_RATE);
|
spb = read_wav_header(fp, (float)BAUD_RATE, wav_channel);
|
||||||
if ( spb < 0 ) {
|
if ( spb < 0 ) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fprintf(stderr, "error: wav header\n");
|
fprintf(stderr, "error: wav header\n");
|
||||||
|
|
|
@ -80,6 +80,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_der = 0, // linErr
|
option_der = 0, // linErr
|
||||||
option_ths = 0,
|
option_ths = 0,
|
||||||
rawin = 0;
|
rawin = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
double dop_limit = 9.9;
|
double dop_limit = 9.9;
|
||||||
double d_err = 10000;
|
double d_err = 10000;
|
||||||
|
|
||||||
|
@ -1327,6 +1328,7 @@ int main(int argc, char *argv[]) {
|
||||||
else if (strcmp(*argv, "-g2") == 0) { option_vergps = 2; } // verbose2 GPS (bancroft)
|
else if (strcmp(*argv, "-g2") == 0) { option_vergps = 2; } // verbose2 GPS (bancroft)
|
||||||
else if (strcmp(*argv, "-gg") == 0) { option_vergps = 8; } // vverbose GPS
|
else if (strcmp(*argv, "-gg") == 0) { option_vergps = 8; } // vverbose GPS
|
||||||
else if (strcmp(*argv, "--ecc") == 0) { option_ecc = 1; }
|
else if (strcmp(*argv, "--ecc") == 0) { option_ecc = 1; }
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else if (strcmp(*argv, "--ths") == 0) {
|
else if (strcmp(*argv, "--ths") == 0) {
|
||||||
++argv;
|
++argv;
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
|
@ -1371,7 +1373,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
spb = read_wav_header(fp, (float)BAUD_RATE);
|
spb = read_wav_header(fp, (float)BAUD_RATE, wav_channel);
|
||||||
if ( spb < 0 ) {
|
if ( spb < 0 ) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fprintf(stderr, "error: wav header\n");
|
fprintf(stderr, "error: wav header\n");
|
||||||
|
|
|
@ -58,6 +58,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_ecc = 0,
|
option_ecc = 0,
|
||||||
option_ptu = 0,
|
option_ptu = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
|
|
||||||
|
@ -143,18 +144,18 @@ int movAvg[LEN_movAvg];
|
||||||
unsigned long sample_count = 0;
|
unsigned long sample_count = 0;
|
||||||
|
|
||||||
int read_signed_sample(FILE *fp) { // int = i32_t
|
int read_signed_sample(FILE *fp) { // int = i32_t
|
||||||
int byte, i, sample, s=0; // EOF -> 0x1000000
|
int byte, i, sample=0, s=0; // EOF -> 0x1000000
|
||||||
|
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
// i = 0: links bzw. mono
|
// i = 0: links bzw. mono
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample = byte;
|
if (i == wav_channel) sample = byte;
|
||||||
|
|
||||||
if (bits_sample == 16) {
|
if (bits_sample == 16) {
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample += byte << 8;
|
if (i == wav_channel) sample += byte << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -965,6 +966,7 @@ int main(int argc, char **argv) {
|
||||||
else if ( (strcmp(*argv, "--ptu") == 0) ) {
|
else if ( (strcmp(*argv, "--ptu") == 0) ) {
|
||||||
option_ptu = 1;
|
option_ptu = 1;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else {
|
else {
|
||||||
fp = fopen(*argv, "rb");
|
fp = fopen(*argv, "rb");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_b = 0,
|
option_b = 0,
|
||||||
option_color = 0,
|
option_color = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -117,18 +118,18 @@ unsigned long sample_count = 0;
|
||||||
double bitgrenze = 0;
|
double bitgrenze = 0;
|
||||||
|
|
||||||
int read_signed_sample(FILE *fp) { // int = i32_t
|
int read_signed_sample(FILE *fp) { // int = i32_t
|
||||||
int byte, i, sample, s=0; // EOF -> 0x1000000
|
int byte, i, sample=0, s=0; // EOF -> 0x1000000
|
||||||
|
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
// i = 0: links bzw. mono
|
// i = 0: links bzw. mono
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample = byte;
|
if (i == wav_channel) sample = byte;
|
||||||
|
|
||||||
if (bits_sample == 16) {
|
if (bits_sample == 16) {
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample += byte << 8;
|
if (i == wav_channel) sample += byte << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -785,6 +786,7 @@ int main(int argc, char **argv) {
|
||||||
else if (strcmp(*argv, "--res") == 0) { option_res = 1; }
|
else if (strcmp(*argv, "--res") == 0) { option_res = 1; }
|
||||||
else if (strcmp(*argv, "-b" ) == 0) { option_b = 1; }
|
else if (strcmp(*argv, "-b" ) == 0) { option_b = 1; }
|
||||||
else if (strcmp(*argv, "-b2") == 0) { option_b = 2; }
|
else if (strcmp(*argv, "-b2") == 0) { option_b = 2; }
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else {
|
else {
|
||||||
fp = fopen(*argv, "rb");
|
fp = fopen(*argv, "rb");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
|
|
10
m10/m10ptu.c
10
m10/m10ptu.c
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* big endian forest
|
/* big endian forest
|
||||||
*
|
*
|
||||||
* gcc -o m10x m10x.c -lm
|
* gcc m10ptu.c -lm -o m10ptu
|
||||||
* M10 w/ trimble GPS
|
* M10 w/ trimble GPS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_color = 0,
|
option_color = 0,
|
||||||
option_ptu = 0,
|
option_ptu = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -158,18 +159,18 @@ unsigned long sample_count = 0;
|
||||||
double bitgrenze = 0;
|
double bitgrenze = 0;
|
||||||
|
|
||||||
int read_signed_sample(FILE *fp) { // int = i32_t
|
int read_signed_sample(FILE *fp) { // int = i32_t
|
||||||
int byte, i, sample, s=0; // EOF -> 0x1000000
|
int byte, i, sample=0, s=0; // EOF -> 0x1000000
|
||||||
|
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
// i = 0: links bzw. mono
|
// i = 0: links bzw. mono
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample = byte;
|
if (i == wav_channel) sample = byte;
|
||||||
|
|
||||||
if (bits_sample == 16) {
|
if (bits_sample == 16) {
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample += byte << 8;
|
if (i == wav_channel) sample += byte << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1155,6 +1156,7 @@ int main(int argc, char **argv) {
|
||||||
else if ( (strcmp(*argv, "--ptu") == 0) ) {
|
else if ( (strcmp(*argv, "--ptu") == 0) ) {
|
||||||
option_ptu = 1;
|
option_ptu = 1;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else {
|
else {
|
||||||
fp = fopen(*argv, "rb");
|
fp = fopen(*argv, "rb");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
|
|
|
@ -80,6 +80,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_ptu = 0,
|
option_ptu = 0,
|
||||||
option_len = 0,
|
option_len = 0,
|
||||||
wavloaded = 0;
|
wavloaded = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
int rawin = 0;
|
int rawin = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,19 +207,19 @@ int movAvg[LEN_movAvg];
|
||||||
unsigned long sample_count = 0;
|
unsigned long sample_count = 0;
|
||||||
|
|
||||||
int read_signed_sample(FILE *fp) { // int = i32_t
|
int read_signed_sample(FILE *fp) { // int = i32_t
|
||||||
int byte, i, sample, s=0; // EOF -> 0x1000000
|
int byte, i, sample=0, s=0; // EOF -> 0x1000000
|
||||||
float x=0, x0=0;
|
float x=0, x0=0;
|
||||||
|
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
// i = 0: links bzw. mono
|
// i = 0: links bzw. mono
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample = byte;
|
if (i == wav_channel) sample = byte;
|
||||||
|
|
||||||
if (bits_sample == 16) {
|
if (bits_sample == 16) {
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample += byte << 8;
|
if (i == wav_channel) sample += byte << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1426,6 +1427,7 @@ int main(int argc, char *argv[]) {
|
||||||
else if (strcmp(*argv, "--std2") == 0) { option_len = 2; frmlen = 518; } // NDATA_LEN+XDATA_LEN
|
else if (strcmp(*argv, "--std2") == 0) { option_len = 2; frmlen = 518; } // NDATA_LEN+XDATA_LEN
|
||||||
else if (strcmp(*argv, "--sat") == 0) { option_sat = 1; }
|
else if (strcmp(*argv, "--sat") == 0) { option_sat = 1; }
|
||||||
else if (strcmp(*argv, "--ptu") == 0) { option_ptu = 1; }
|
else if (strcmp(*argv, "--ptu") == 0) { option_ptu = 1; }
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else if (strcmp(*argv, "--rawin1") == 0) { rawin = 2; } // raw_txt input1
|
else if (strcmp(*argv, "--rawin1") == 0) { rawin = 2; } // raw_txt input1
|
||||||
else if (strcmp(*argv, "--rawin2") == 0) { rawin = 3; } // raw_txt input2
|
else if (strcmp(*argv, "--rawin2") == 0) { rawin = 3; } // raw_txt input2
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -111,6 +111,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_aux = 0, // Aux/Ozon
|
option_aux = 0, // Aux/Ozon
|
||||||
option_der = 0, // linErr
|
option_der = 0, // linErr
|
||||||
rawin = 0;
|
rawin = 0;
|
||||||
|
int wav_channel = 0; // audio channel: left
|
||||||
double dop_limit = 9.9;
|
double dop_limit = 9.9;
|
||||||
double d_err = 10000;
|
double d_err = 10000;
|
||||||
|
|
||||||
|
@ -244,18 +245,18 @@ unsigned long sample_count = 0;
|
||||||
double bitgrenze = 0;
|
double bitgrenze = 0;
|
||||||
|
|
||||||
int read_signed_sample(FILE *fp) { // int = i32_t
|
int read_signed_sample(FILE *fp) { // int = i32_t
|
||||||
int byte, i, sample, s=0; // EOF -> 0x1000000
|
int byte, i, sample=0, s=0; // EOF -> 0x1000000
|
||||||
|
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
// i = 0: links bzw. mono
|
// i = 0: links bzw. mono
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample = byte;
|
if (i == wav_channel) sample = byte;
|
||||||
|
|
||||||
if (bits_sample == 16) {
|
if (bits_sample == 16) {
|
||||||
byte = fgetc(fp);
|
byte = fgetc(fp);
|
||||||
if (byte == EOF) return EOF_INT;
|
if (byte == EOF) return EOF_INT;
|
||||||
if (i == 0) sample += byte << 8;
|
if (i == wav_channel) sample += byte << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1561,6 +1562,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
else if (strcmp(*argv, "-b") == 0) { option_b = 1; }
|
else if (strcmp(*argv, "-b") == 0) { option_b = 1; }
|
||||||
else if (strcmp(*argv, "--ecc") == 0) { option_ecc = 1; }
|
else if (strcmp(*argv, "--ecc") == 0) { option_ecc = 1; }
|
||||||
|
else if (strcmp(*argv, "--ch2") == 0) { wav_channel = 1; } // right channel (default: 0=left)
|
||||||
else {
|
else {
|
||||||
if (!rawin) fp = fopen(*argv, "rb");
|
if (!rawin) fp = fopen(*argv, "rb");
|
||||||
else fp = fopen(*argv, "r");
|
else fp = fopen(*argv, "r");
|
||||||
|
|
Ładowanie…
Reference in New Issue