Skip to content

TimedStream: recalculate ByteLimits when setting values #1407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/AudioTools/AudioIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,17 @@ class TimedStream : public AudioStream {

/// Defines the start time in seconds. The audio before the start time will be
/// skipped
void setStartSec(uint32_t startSeconds) { start_ms = startSeconds*1000; }
void setStartSec(uint32_t startSeconds) { start_ms = startSeconds*1000; calculateByteLimits(); }

/// Defines the start time in milliseconds
void setStartMs(uint32_t ms) { start_ms = ms; }
void setStartMs(uint32_t ms) { start_ms = ms; calculateByteLimits(); }

/// Defines (an optional) the end time in seconds. After the end time no audio
/// is played and available() will return 0
void setEndSec(uint32_t endSeconds) { end_ms = endSeconds*1000; }
void setEndSec(uint32_t endSeconds) { end_ms = endSeconds*1000; calculateByteLimits(); }

/// Defines the (optional) end time in milliseconds
void setEndMs(uint32_t ms) { end_ms = ms; }
void setEndMs(uint32_t ms) { end_ms = ms; calculateByteLimits(); }

/// Returns true if we are in a valid time range and are still playing sound
bool isPlaying() {
Expand Down