-
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.
Adds an audio engine abstraction (implemented with miniaudio) in Rive. We can selectively replace it with other abstractions later if we find miniaudio isn't well suited everywhere but I'm confident it will be based on flexibility with getting it working in the recorder. Adds audio support in: - packages/rive_common - WASM: rive_audio_wasm.dart - FFI: rive_audio_ffi.dart - packages/runtime - packages/recorder Subsequent PR will add support in: - packages/rive_unity - This is getting meaty enough... - packages/rive_flutter - This requires publishing rive_common so I want to make sure this is reviewed and accepted before publishing - I'd also prefer to merge layout constraints into rive_common before this lands. Editor features: - Updated preview window: <img width="248" alt="CleanShot 2024-01-15 at 14 44 31@2x" src="https://github.com/rive-app/rive/assets/454182/a9588be6-8370-4e22-ab32-af1e9ed71183"> - Preview waveforms in the timeline: <img width="651" alt="CleanShot 2024-01-15 at 14 44 53@2x" src="https://github.com/rive-app/rive/assets/454182/2710667f-838f-483d-9647-e2bcb9e0237a"> - Subsequent PR will also use threads in web editor build (currently uses a time/frame based decoder to offload ui). I can't do that until I can verify the Shared Memory access is granted once rive_common lands in pub.dev and then we can push to UAT. Diffs= 73bf11db3 Audio engine (#6454) Co-authored-by: Luigi Rosso <[email protected]>
- Loading branch information
1 parent
916b050
commit 80c037c
Showing
52 changed files
with
1,199 additions
and
75 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 @@ | ||
b098ad23a15cc7b11f144e407374c83d5db0fee0 | ||
73bf11db39230e7a6d302da9a27414d35bcbee99 |
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,2 @@ | ||
local dependency = require 'dependency' | ||
miniaudio = dependency.github('rive-app/miniaudio', 'rive') |
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,8 @@ | ||
{ | ||
"name": "AudioAsset", | ||
"key": { | ||
"int": 406, | ||
"string": "audioasset" | ||
}, | ||
"extends": "assets/file_asset.json" | ||
} |
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,21 @@ | ||
{ | ||
"name": "AudioEvent", | ||
"key": { | ||
"int": 407, | ||
"string": "audioevent" | ||
}, | ||
"extends": "event.json", | ||
"properties": { | ||
"assetId": { | ||
"type": "Id", | ||
"typeRuntime": "uint", | ||
"initialValue": "Core.missingId", | ||
"initialValueRuntime": "-1", | ||
"key": { | ||
"int": 408, | ||
"string": "assetid" | ||
}, | ||
"description": "Audio asset to play when event fires" | ||
} | ||
} | ||
} |
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,29 @@ | ||
#ifndef _RIVE_AUDIO_ASSET_HPP_ | ||
#define _RIVE_AUDIO_ASSET_HPP_ | ||
#include "rive/generated/assets/audio_asset_base.hpp" | ||
#include "rive/audio/audio_source.hpp" | ||
|
||
namespace rive | ||
{ | ||
class AudioAsset : public AudioAssetBase | ||
{ | ||
public: | ||
AudioAsset(); | ||
~AudioAsset() override; | ||
bool decode(SimpleArray<uint8_t>&, Factory*) override; | ||
std::string fileExtension() const override; | ||
|
||
#ifdef WITH_RIVE_AUDIO | ||
#ifdef TESTING | ||
bool hasAudioSource() { return m_audioSource != nullptr; } | ||
#endif | ||
|
||
rcp<AudioSource> audioSource() { return m_audioSource; } | ||
|
||
private: | ||
rcp<AudioSource> m_audioSource; | ||
#endif | ||
}; | ||
} // 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
Oops, something went wrong.