Skip to content

Commit

Permalink
Add event OnVoiceLost
Browse files Browse the repository at this point in the history
  • Loading branch information
mochi-neko committed Oct 10, 2023
1 parent 93575fc commit d013e7b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public sealed class CumulativeVoiceActivityDetector : IVoiceActivityDetector
private readonly ReactiveProperty<bool> voiceIsActive = new();
IReadOnlyReactiveProperty<bool> IVoiceActivityDetector.VoiceIsActive => voiceIsActive;

private readonly Subject<Unit> onVoiceLost = new();
/// <summary>
/// Event that is raised when short voice is lost.
/// </summary>
public IObservable<Unit> OnVoiceLost => onVoiceLost;

/// <summary>
/// Create a new instance of <see cref="CumulativeVoiceActivityDetector"/>.
/// </summary>
Expand Down Expand Up @@ -257,6 +263,7 @@ public async UniTask<bool> UpdateAsync(
{
// NOTE: Not effective segments are ignored.
Log.Debug("[VAD] Ignored segments: {0}", activeTimeSeconds);
parent.onVoiceLost.OnNext(Unit.Default);
}

// Change to InactivateState
Expand Down
2 changes: 1 addition & 1 deletion Assets/Mochineko/VoiceActivityDetection/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.mochineko.voice-activity-detection",
"version": "0.4.0",
"version": "0.4.1",
"displayName": "Voice Activity Detection",
"description": "A voice activity detection library for Unity.",
"unity": "2022.3",
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.4.1] - 2023-10-10

### Added
- Add event `OnVoiceLost` to `CumulativeVoiceActivityDetector`.

## [0.4.0] - 2023-09-05

### Added
Expand Down

0 comments on commit d013e7b

Please sign in to comment.