implemented audio decoder and some of the audio node functionality

This commit is contained in:
itsmattkc
2019-10-24 21:33:46 +11:00
parent af702835da
commit 076f2699c5
12 changed files with 98 additions and 43 deletions
+10 -3
View File
@@ -52,7 +52,14 @@ int AudioRenderingParams::time_to_bytes(const rational &time) const
{
Q_ASSERT(is_valid());
return qFloor(time.toDouble() * sample_rate()) * channel_count() * bytes_per_sample();
return qFloor(time.toDouble() * sample_rate()) * channel_count() * bytes_per_sample_per_channel();
}
int AudioRenderingParams::samples_to_bytes(const int &samples) const
{
Q_ASSERT(is_valid());
return samples * channel_count() * bytes_per_sample_per_channel();
}
int AudioRenderingParams::channel_count() const
@@ -60,7 +67,7 @@ int AudioRenderingParams::channel_count() const
return av_get_channel_layout_nb_channels(channel_layout());
}
int AudioRenderingParams::bytes_per_sample() const
int AudioRenderingParams::bytes_per_sample_per_channel() const
{
switch (format_) {
case olive::SAMPLE_FMT_U8:
@@ -83,7 +90,7 @@ int AudioRenderingParams::bytes_per_sample() const
int AudioRenderingParams::bits_per_sample() const
{
return bytes_per_sample() * 8;
return bytes_per_sample_per_channel() * 8;
}
bool AudioRenderingParams::is_valid() const
+2 -1
View File
@@ -29,8 +29,9 @@ public:
AudioRenderingParams(const AudioParams& params, const olive::SampleFormat& format);
int time_to_bytes(const rational& time) const;
int samples_to_bytes(const int& samples) const;
int channel_count() const;
int bytes_per_sample() const;
int bytes_per_sample_per_channel() const;
int bits_per_sample() const;
bool is_valid() const;