Skip to content

Commit 0e6f90c

Browse files
committed
MeasuringStream setReportBytes
1 parent c81db96 commit 0e6f90c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/AudioTools/AudioStreams.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,11 @@ class MeasuringStream : public ModifyingStream {
747747
frame_size = size;
748748
}
749749

750+
/// Report in bytes instead of samples
751+
void setReportBytes(bool flag){
752+
report_bytes = flag;
753+
}
754+
750755
protected:
751756
int max_count=0;
752757
int count=0;
@@ -758,6 +763,7 @@ class MeasuringStream : public ModifyingStream {
758763
int frame_size = 0;
759764
NullStream null;
760765
Print *p_logout=nullptr;
766+
bool report_bytes = false;
761767

762768
size_t measure(size_t len) {
763769
count--;
@@ -779,7 +785,7 @@ class MeasuringStream : public ModifyingStream {
779785

780786
void printResult() {
781787
char msg[70];
782-
if (frame_size==0){
788+
if (report_bytes || frame_size==0){
783789
snprintf(msg, 70, "==> Bytes per second: %d", bytes_per_second);
784790
} else {
785791
snprintf(msg, 70, "==> Samples per second: %d", bytes_per_second/frame_size);

0 commit comments

Comments
 (0)