handling "Index" column in prn files
This commit is contained in:
parent
36537366f6
commit
5fb34a3741
@ -39,6 +39,7 @@ void spicestream_construct( SpiceStream *ss, char *filename, char *format, WaveT
|
|||||||
spicestream_read_rows, spicestream_destroy );
|
spicestream_read_rows, spicestream_destroy );
|
||||||
ss->filename = filename;
|
ss->filename = filename;
|
||||||
ss->format = format;
|
ss->format = format;
|
||||||
|
ss->idxcol = -1;
|
||||||
|
|
||||||
/* open file */
|
/* open file */
|
||||||
ss->linebuf = fdbuf_new ( filename, "r", 0);
|
ss->linebuf = fdbuf_new ( filename, "r", 0);
|
||||||
|
@ -71,6 +71,7 @@ struct _SpiceStream {
|
|||||||
int currow;
|
int currow;
|
||||||
/* some more variables for .wav */
|
/* some more variables for .wav */
|
||||||
int bps; /* bit per sample */
|
int bps; /* bit per sample */
|
||||||
|
int idxcol; // throw away any index column
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,6 +150,16 @@ ascii_process_header(SpiceStream *ss, char *line, VarType ivtype )
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (app_strcasestr(signam, "index") ) {
|
||||||
|
ss->idxcol = 0;
|
||||||
|
// Skip to next token in header
|
||||||
|
signam = strtok(NULL, " \t\n");
|
||||||
|
if ( ! signam) {
|
||||||
|
msg_error(_("line %d: syntax error in header"), fdbuf_get_lineno(ss->linebuf));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ivtype == UNKNOWN) {
|
if ( ivtype == UNKNOWN) {
|
||||||
if (app_strcasestr(signam, "time") ) {
|
if (app_strcasestr(signam, "time") ) {
|
||||||
ivtype = TIME;
|
ivtype = TIME;
|
||||||
@ -202,6 +212,14 @@ int sf_readrow_ascii(SpiceStream *ss)
|
|||||||
return -2; /* blank line can indicate end of data */
|
return -2; /* blank line can indicate end of data */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip index column
|
||||||
|
if (ss->idxcol >= 0) {
|
||||||
|
tok = strtok(NULL, " \t\n");
|
||||||
|
if ( ! tok) {
|
||||||
|
return -2; /* blank line can indicate end of data */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check to see if it is numeric: ascii format is so loosly defined
|
* check to see if it is numeric: ascii format is so loosly defined
|
||||||
* that we might read a load of garbage otherwise.
|
* that we might read a load of garbage otherwise.
|
||||||
|
Loading…
Reference in New Issue
Block a user