Skip to content

Commit

Permalink
Merge pull request #167 from sccn/1.16
Browse files Browse the repository at this point in the history
Version 1.16
  • Loading branch information
cboulay committed Mar 27, 2022
2 parents 6cdcf74 + e505ded commit 5eded5c
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cppcmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
config:
- {name: "ubuntu-20.04", os: "ubuntu-20.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF"}
- {name: "ubuntu-18.04", os: "ubuntu-latest", docker: "ubuntu:18.04" }
- {name: "windows-x64", os: "windows-latest", cmake_extra: "-T v140,host=x86"}
- {name: "windows-32", os: "windows-latest", cmake_extra: "-T v140,host=x86 -A Win32"}
- {name: "windows-x64", os: "windows-2019", cmake_extra: "-T v140,host=x86"}
- {name: "windows-32", os: "windows-2019", cmake_extra: "-T v140,host=x86 -A Win32"}
- {name: "macOS-latest", os: "macOS-latest"}

# runs all steps in the container configured in config.docker or as subprocesses when empty
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.12)
project (liblsl
VERSION 1.15.2
VERSION 1.16.0
LANGUAGES C CXX
DESCRIPTION "Labstreaminglayer C/C++ library"
HOMEPAGE_URL "https://github.com/sccn/liblsl"
Expand Down
2 changes: 1 addition & 1 deletion examples/ReceiveDataInChunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main(int argc, char **argv) {
bool flush = argc > 3;
// resolve the stream of interest & make an inlet
lsl::stream_info inlet_info = lsl::resolve_stream("name", name).at(0);
lsl::stream_inlet inlet(inlet_info, max_buffered);
lsl::stream_inlet inlet(inlet_info, (int32_t)max_buffered);

// Use set_postprocessing to get the timestamps in a common base clock.
// Do not use if this application will record timestamps to disk -- it is better to
Expand Down
2 changes: 1 addition & 1 deletion examples/SendData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
// Create random data for the first 8 channels.
for (int c = 0; c < 8; c++) sample[c] = (float)((rand() % 1500) / 500.0 - 1.5);
// For the remaining channels, fill them with a sample counter (wraps at 1M).
std::fill(sample.begin() + 8, sample.end(), t % 1000000);
std::fill(sample.begin() + 8, sample.end(), (float)(t % 1000000));

// Wait until the next expected sample time.
next_sample_time += std::chrono::microseconds(sample_dur_us);
Expand Down
17 changes: 9 additions & 8 deletions examples/SendDataInChunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ struct fake_device {
*/
std::size_t n_channels;
double srate;
int64_t pattern_samples;
int64_t head;
std::size_t pattern_samples;
std::size_t head;
std::vector<int16_t> pattern;
std::chrono::steady_clock::time_point last_time;

fake_device(const int16_t n_channels, const float srate)
: n_channels(n_channels), srate(srate), head(0) {
pattern_samples = (int64_t)(srate - 0.5) + 1; // truncate OK.
pattern_samples = (std::size_t)(srate - 0.5) + 1; // truncate OK.

// Pre-allocate entire test pattern. The data _could_ be generated on the fly
// for a much smaller memory hit, but we also use this example application
Expand All @@ -47,8 +47,9 @@ struct fake_device {
// sin(2*pi*f*t), where f cycles from 1 Hz to Nyquist: srate / 2
double f = (chan_ix + 1) % (int)(srate / 2);
pattern.emplace_back(
offset_0 + chan_ix * offset_step +
magnitude * static_cast<int16_t>(sin(2 * M_PI * f * sample_ix / srate)));
static_cast<int16_t>(
offset_0 + chan_ix * offset_step +
magnitude * sin(2 * M_PI * f * sample_ix / srate)));
}
}
last_time = std::chrono::steady_clock::now();
Expand All @@ -70,8 +71,8 @@ struct fake_device {
auto now = std::chrono::steady_clock::now();
auto elapsed_nano =
std::chrono::duration_cast<std::chrono::nanoseconds>(now - last_time).count();
int64_t elapsed_samples = std::size_t(elapsed_nano * srate * 1e-9); // truncate OK.
elapsed_samples = std::min(elapsed_samples, (int64_t)(buffer.size() / n_channels));
std::size_t elapsed_samples = std::size_t(elapsed_nano * srate * 1e-9); // truncate OK.
elapsed_samples = std::min(elapsed_samples, (std::size_t)(buffer.size() / n_channels));
if (nodata) {
// The fastest but no patterns.
// memset(&buffer[0], 23, buffer.size() * sizeof buffer[0]);
Expand Down Expand Up @@ -116,7 +117,7 @@ int main(int argc, char **argv) {
chn.append_child_value("unit", "microvolts");
chn.append_child_value("type", type);
}
int32_t buf_samples = max_buffered * samplingrate;
int32_t buf_samples = (int32_t)(max_buffered * samplingrate);
lsl::stream_outlet outlet(info, chunk_samples, buf_samples);
info = outlet.info(); // Refresh info with whatever the outlet captured.
std::cout << "Stream UID: " << info.uid() << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/SendDataSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) {
float sample[nchannels];
while (outlet.have_consumers()) {
// generate random data
for (int c = 0; c < nchannels; c++) sample[c] = (rand() % 1500) / 500.0 - 1.5;
for (int c = 0; c < nchannels; c++) sample[c] = (float)((rand() % 1500) / 500.0 - 1.5);
// send it
outlet.push_sample(sample);
std::this_thread::sleep_for(std::chrono::milliseconds(5));
Expand Down
1 change: 0 additions & 1 deletion examples/SendStringMarkersC.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ void sleep_(int ms) { usleep(ms * 1000); }
int main(int argc, char *argv[]) {
lsl_streaminfo info; /* out stream declaration object */
lsl_outlet outlet; /* stream outlet */
double endtime; /* used for send timing */
const char *mrk; /* marker to send next */

/* declare a new streaminfo (name: "MyEventStream", content type: "Markers", 1 channel,
Expand Down
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern "C" {
const int LSL_PROTOCOL_VERSION = 110;

// the library version
const int LSL_LIBRARY_VERSION = 115;
const int LSL_LIBRARY_VERSION = 116;

/// size of the lsl_last_error() buffer size
const int LAST_ERROR_SIZE = 512;
Expand Down
4 changes: 2 additions & 2 deletions testing/ext/DataType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ TEST_CASE("Flush", "[datatransfer][basic]") {
});

double data_in;
double ts_in = sp.in_.pull_sample(&data_in, 1.);
double ts_in = sp.in_.pull_sample(&data_in, 1);
REQUIRE(ts_in == Approx(data_in));
std::this_thread::sleep_for(std::chrono::milliseconds(700));
auto pulled = sp.in_.flush() + 1;

for(; pulled < n; ++pulled) {
INFO(pulled);
ts_in = sp.in_.pull_sample(&data_in, 1.);
ts_in = sp.in_.pull_sample(&data_in, 1);
REQUIRE(ts_in == Approx(data_in));
}

Expand Down
4 changes: 2 additions & 2 deletions testing/int/samples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TEST_CASE("sample conversion", "[basic]") {
CHECK(values[j] == static_cast<int64_t>(buf[j]));
CHECK(strbuf[j] == std::to_string(buf[j]));
}
values[0] = buf[0] << 1;
values[1] = -buf[0];
values[0] = (double)(buf[0] << 1);
values[1] = (double)(-buf[0]);
}
}

0 comments on commit 5eded5c

Please sign in to comment.