@@ -25,14 +25,14 @@ struct fake_device {
25
25
*/
26
26
std::size_t n_channels;
27
27
double srate;
28
- int64_t pattern_samples;
29
- int64_t head;
28
+ std:: size_t pattern_samples;
29
+ std:: size_t head;
30
30
std::vector<int16_t > pattern;
31
31
std::chrono::steady_clock::time_point last_time;
32
32
33
33
fake_device (const int16_t n_channels, const float srate)
34
34
: n_channels(n_channels), srate(srate), head(0 ) {
35
- pattern_samples = (int64_t )(srate - 0.5 ) + 1 ; // truncate OK.
35
+ pattern_samples = (std:: size_t )(srate - 0.5 ) + 1 ; // truncate OK.
36
36
37
37
// Pre-allocate entire test pattern. The data _could_ be generated on the fly
38
38
// for a much smaller memory hit, but we also use this example application
@@ -47,8 +47,9 @@ struct fake_device {
47
47
// sin(2*pi*f*t), where f cycles from 1 Hz to Nyquist: srate / 2
48
48
double f = (chan_ix + 1 ) % (int )(srate / 2 );
49
49
pattern.emplace_back (
50
- offset_0 + chan_ix * offset_step +
51
- magnitude * static_cast <int16_t >(sin (2 * M_PI * f * sample_ix / srate)));
50
+ static_cast <int16_t >(
51
+ offset_0 + chan_ix * offset_step +
52
+ magnitude * sin (2 * M_PI * f * sample_ix / srate)));
52
53
}
53
54
}
54
55
last_time = std::chrono::steady_clock::now ();
@@ -70,8 +71,8 @@ struct fake_device {
70
71
auto now = std::chrono::steady_clock::now ();
71
72
auto elapsed_nano =
72
73
std::chrono::duration_cast<std::chrono::nanoseconds>(now - last_time).count ();
73
- int64_t elapsed_samples = std::size_t (elapsed_nano * srate * 1e-9 ); // truncate OK.
74
- elapsed_samples = std::min (elapsed_samples, (int64_t )(buffer.size () / n_channels));
74
+ std:: size_t elapsed_samples = std::size_t (elapsed_nano * srate * 1e-9 ); // truncate OK.
75
+ elapsed_samples = std::min (elapsed_samples, (std:: size_t )(buffer.size () / n_channels));
75
76
if (nodata) {
76
77
// The fastest but no patterns.
77
78
// memset(&buffer[0], 23, buffer.size() * sizeof buffer[0]);
@@ -126,7 +127,7 @@ int main(int argc, char **argv) {
126
127
chn.append_child_value (" unit" , " microvolts" );
127
128
chn.append_child_value (" type" , type);
128
129
}
129
- int32_t buf_samples = max_buffered * samplingrate;
130
+ int32_t buf_samples = ( int32_t )( max_buffered * samplingrate) ;
130
131
auto flags = static_cast <lsl_transport_options_t >(
131
132
(do_sync ? transp_sync_blocking : transp_default) | transp_bufsize_samples);
132
133
lsl::stream_outlet outlet (info, chunk_samples, buf_samples, flags);
0 commit comments