- /* move to the next largest power of two. Hack from stanford bithacks page. */
-
- chunk_size_for_read--;
- chunk_size_for_read |= chunk_size_for_read >> 1;
- chunk_size_for_read |= chunk_size_for_read >> 2;
- chunk_size_for_read |= chunk_size_for_read >> 4;
- chunk_size_for_read |= chunk_size_for_read >> 8;
- chunk_size_for_read |= chunk_size_for_read >> 16;
- chunk_size_for_read++;
-
- /* go back to previous power */
-
- chunk_size_for_read >>= 1;
- }
+ framecnt_t samples_to_read = byte_size_for_read / (bits_per_sample / 8);
+
+ //cerr << name() << " will read " << byte_size_for_read << " out of total bytes " << total_bytes << " in buffer of "
+ // << c->front()->playback_buf->bufsize() * bits_per_sample / 8 << " bps = " << bits_per_sample << endl;
+ // cerr << name () << " read samples = " << samples_to_read << " out of total space " << total_space << " in buffer of " << c->front()->playback_buf->bufsize() << " samples\n";
+
+ // uint64_t before = g_get_monotonic_time ();
+ // uint64_t elapsed;