@@ -25,14 +25,14 @@ struct fake_device {
2525 */
2626 std::size_t n_channels;
2727 double srate;
28- int64_t pattern_samples;
29- int64_t head;
28+ std:: size_t pattern_samples;
29+ std:: size_t head;
3030 std::vector<int16_t > pattern;
3131 std::chrono::steady_clock::time_point last_time;
3232
3333 fake_device (const int16_t n_channels, const float srate)
3434 : 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.
3636
3737 // Pre-allocate entire test pattern. The data _could_ be generated on the fly
3838 // for a much smaller memory hit, but we also use this example application
@@ -47,8 +47,9 @@ struct fake_device {
4747 // sin(2*pi*f*t), where f cycles from 1 Hz to Nyquist: srate / 2
4848 double f = (chan_ix + 1 ) % (int )(srate / 2 );
4949 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)));
5253 }
5354 }
5455 last_time = std::chrono::steady_clock::now ();
@@ -70,8 +71,8 @@ struct fake_device {
7071 auto now = std::chrono::steady_clock::now ();
7172 auto elapsed_nano =
7273 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));
7576 if (nodata) {
7677 // The fastest but no patterns.
7778 // memset(&buffer[0], 23, buffer.size() * sizeof buffer[0]);
@@ -126,7 +127,7 @@ int main(int argc, char **argv) {
126127 chn.append_child_value (" unit" , " microvolts" );
127128 chn.append_child_value (" type" , type);
128129 }
129- int32_t buf_samples = max_buffered * samplingrate;
130+ int32_t buf_samples = ( int32_t )( max_buffered * samplingrate) ;
130131 auto flags = static_cast <lsl_transport_options_t >(
131132 (do_sync ? transp_sync_blocking : transp_default) | transp_bufsize_samples);
132133 lsl::stream_outlet outlet (info, chunk_samples, buf_samples, flags);
0 commit comments