MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / get_sample_timestamp

Method get_sample_timestamp

src/board_controller/muse/muse_athena.cpp:889–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

887}
888
889double MuseAthena::get_sample_timestamp (double last_timestamp, double current_timestamp,
890 int sample_index, int n_samples, double sampling_rate)
891{
892 if ((n_samples <= 0) || (sampling_rate <= 0.0))
893 {
894 return current_timestamp;
895 }
896
897 if (last_timestamp <= 0.0)
898 {
899 return current_timestamp - (double)(n_samples - sample_index - 1) / sampling_rate;
900 }
901
902 if (current_timestamp <= last_timestamp)
903 {
904 return current_timestamp;
905 }
906
907 double sample_timestamp = last_timestamp + (double)(sample_index + 1) / sampling_rate;
908 if (sample_timestamp <= current_timestamp)
909 {
910 return sample_timestamp;
911 }
912
913 double step = (current_timestamp - last_timestamp) / (double)n_samples;
914 return last_timestamp + step * (double)(sample_index + 1);
915}
916
917std::string MuseAthena::bytes_to_string (const uint8_t *data, size_t size)
918{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected