From 6cd77bb283439258463bfd87e94bf569c52a7e0d Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Tue, 6 Dec 2022 09:08:54 -0500 Subject: [PATCH] add duration member --- wav.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wav.d b/wav.d index 9936c39..3a93b3f 100644 --- a/wav.d +++ b/wav.d @@ -219,6 +219,8 @@ struct WavReader(Range) { const ushort bitsPerSample; int dataLength; // don't modify plz + float duration; // in seconds, added nov 26 2022 + private uint remainingDataLength; private Range underlying; @@ -318,6 +320,8 @@ struct WavReader(Range) { } this.dataLength = this.remainingDataLength; + + this.duration = cast(float) this.dataLength / header.bytesPerSeconds; } @property const(ubyte)[] front() {