audiomonitor: rewrote to handle audio independently of output
This gives the AudioMonitor more control over its own timing and appearance and also reduces the load on the audio processing threads.
This commit is contained in:
@@ -70,6 +70,13 @@ AudioRenderingParams::AudioRenderingParams(const AudioParams ¶ms, const Samp
|
||||
{
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_bytes(const double &time) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return time_to_samples(time) * channel_count() * bytes_per_sample_per_channel();
|
||||
}
|
||||
|
||||
const SampleFormat::Format &AudioRenderingParams::format() const
|
||||
{
|
||||
return format_;
|
||||
@@ -90,17 +97,20 @@ bool AudioRenderingParams::operator!=(const AudioRenderingParams &other) const
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_bytes(const rational &time) const
|
||||
{
|
||||
return time_to_bytes(time.toDouble());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_samples(const double &time) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return time_to_samples(time) * channel_count() * bytes_per_sample_per_channel();
|
||||
return qFloor(time * sample_rate());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_samples(const rational &time) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return qFloor(time.toDouble() * sample_rate());
|
||||
return time_to_samples(time.toDouble());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::samples_to_bytes(const int &samples) const
|
||||
|
||||
Reference in New Issue
Block a user