Solved a bug that could cause to save the waveform data with a wrong samplefrequency.

merge-requests/1/head
Teuniz 2016-02-08 11:48:53 +01:00
rodzic ccd346faf3
commit fce1a5b47f
4 zmienionych plików z 64 dodań i 2 usunięć

Wyświetl plik

@ -3792,6 +3792,58 @@ int edf_set_number_of_annotation_signals(int handle, int annot_signals)
}
int edf_set_datarecord_us_duration(int handle, int duration)
{
if(handle<0)
{
return(-1);
}
if(handle>=EDFLIB_MAXFILES)
{
return(-1);
}
if(hdrlist[handle]==NULL)
{
return(-1);
}
if(!(hdrlist[handle]->writemode))
{
return(-1);
}
if(hdrlist[handle]->datarecords)
{
return(-1);
}
if((duration < 1) || (duration > 6000000))
{
return(-1);
}
hdrlist[handle]->long_data_record_duration = (long long)duration * 10LL;
if(hdrlist[handle]->long_data_record_duration < (EDFLIB_TIME_DIMENSION * 10LL))
{
hdrlist[handle]->long_data_record_duration /= 10LL;
hdrlist[handle]->long_data_record_duration *= 10LL;
}
else
{
hdrlist[handle]->long_data_record_duration /= 100LL;
hdrlist[handle]->long_data_record_duration *= 100LL;
}
hdrlist[handle]->data_record_duration = ((double)(hdrlist[handle]->long_data_record_duration)) / EDFLIB_TIME_DIMENSION;
return(0);
}
int edf_set_datarecord_duration(int handle, int duration)
{
if(handle<0)

Wyświetl plik

@ -605,6 +605,12 @@ int edf_set_datarecord_duration(int handle, int duration);
/* or set the samplefrequency to 1 Hz and the datarecord duration to 2 seconds. */
/* Do not use this function, except when absolutely necessary! */
int edf_set_datarecord_us_duration(int handle, int duration);
/* Sets the datarecord duration. The default value is 1 second. */
/* ATTENTION: the argument "duration" is expressed in units of 1 microSecond! */
int edf_set_number_of_annotation_signals(int handle, int annot_signals);
/* Sets the number of annotation signals. The default value is 1 */

Wyświetl plik

@ -35,7 +35,7 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.32_1602061510"
#define PROGRAM_VERSION "0.32_1602081148"
#define MAX_PATHLEN 4096

Wyświetl plik

@ -494,12 +494,16 @@ void UI_Mainwindow::save_memory_waveform()
goto OUT_ERROR;
}
if(edf_set_datarecord_duration(hdl, (rec_len / 100LL) / datrecs))
if(edf_set_datarecord_us_duration(hdl, (rec_len / 10LL) / datrecs))
{
strcpy(str, "Can not set datarecord duration of EDF file.");
goto OUT_ERROR;
}
printf("smps_per_record: %i datrecs: %i rec_len: %lli\n", smps_per_record, datrecs, rec_len);
j = 0;
for(chn=0; chn<MAX_CHNS; chn++)