-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This also fixes a bug where multiple sounds would play at the same time making clipping even worse... Some more details here: https://2dimensions.slack.com/archives/CHMAP278R/p1712443028936919 Diffs= f832e2617 Audio asset volume + VU (#6985) Co-authored-by: Luigi Rosso <[email protected]>
- Loading branch information
1 parent
40cc4f8
commit a96799e
Showing
17 changed files
with
506 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
522a31bc24b4f8179b9a4f27d9a8154af385767a | ||
f832e26172cfbd11d52114ebb667e13418a5b1cd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "ExportAudio", | ||
"key": { | ||
"int": 422, | ||
"string": "exportaudio" | ||
}, | ||
"abstract": true, | ||
"extends": "assets/file_asset.json", | ||
"properties": { | ||
"exportFormatValue": { | ||
"type": "uint", | ||
"initialValue": "0", | ||
"key": { | ||
"int": 527, | ||
"string": "formatvalue" | ||
}, | ||
"description": "Start seconds of this clip", | ||
"runtime": false | ||
}, | ||
"exportQualityValue": { | ||
"type": "uint", | ||
"initialValue": "0", | ||
"key": { | ||
"int": 528, | ||
"string": "qualityvalue" | ||
}, | ||
"description": "Start seconds of this clip", | ||
"runtime": false | ||
}, | ||
"volume": { | ||
"type": "double", | ||
"initialValue": "1", | ||
"key": { | ||
"int": 530, | ||
"string": "volume" | ||
}, | ||
"description": "Volume applied to all instances of this audio asset." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef _RIVE_EXPORT_AUDIO_HPP_ | ||
#define _RIVE_EXPORT_AUDIO_HPP_ | ||
#include "rive/generated/assets/export_audio_base.hpp" | ||
#include <stdio.h> | ||
namespace rive | ||
{ | ||
class ExportAudio : public ExportAudioBase | ||
{ | ||
public: | ||
}; | ||
} // namespace rive | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ifndef _RIVE_EXPORT_AUDIO_BASE_HPP_ | ||
#define _RIVE_EXPORT_AUDIO_BASE_HPP_ | ||
#include "rive/assets/file_asset.hpp" | ||
#include "rive/core/field_types/core_double_type.hpp" | ||
namespace rive | ||
{ | ||
class ExportAudioBase : public FileAsset | ||
{ | ||
protected: | ||
typedef FileAsset Super; | ||
|
||
public: | ||
static const uint16_t typeKey = 422; | ||
|
||
/// Helper to quickly determine if a core object extends another without RTTI | ||
/// at runtime. | ||
bool isTypeOf(uint16_t typeKey) const override | ||
{ | ||
switch (typeKey) | ||
{ | ||
case ExportAudioBase::typeKey: | ||
case FileAssetBase::typeKey: | ||
case AssetBase::typeKey: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
uint16_t coreType() const override { return typeKey; } | ||
|
||
static const uint16_t volumePropertyKey = 530; | ||
|
||
private: | ||
float m_Volume = 1.0f; | ||
|
||
public: | ||
inline float volume() const { return m_Volume; } | ||
void volume(float value) | ||
{ | ||
if (m_Volume == value) | ||
{ | ||
return; | ||
} | ||
m_Volume = value; | ||
volumeChanged(); | ||
} | ||
|
||
void copy(const ExportAudioBase& object) | ||
{ | ||
m_Volume = object.m_Volume; | ||
FileAsset::copy(object); | ||
} | ||
|
||
bool deserialize(uint16_t propertyKey, BinaryReader& reader) override | ||
{ | ||
switch (propertyKey) | ||
{ | ||
case volumePropertyKey: | ||
m_Volume = CoreDoubleType::deserialize(reader); | ||
return true; | ||
} | ||
return FileAsset::deserialize(propertyKey, reader); | ||
} | ||
|
||
protected: | ||
virtual void volumeChanged() {} | ||
}; | ||
} // namespace rive | ||
|
||
#endif |
Oops, something went wrong.