Fixed kokoro loading process.
This commit is contained in:
@@ -13,6 +13,7 @@ class AudioManagerModule extends BaseModule {
|
||||
this.masterVolume = 1.0;
|
||||
this.musicVolume = 1.0;
|
||||
this.sfxVolume = 1.0;
|
||||
this.ttsVolume = 1.0;
|
||||
|
||||
// Add persistence-manager as a dependency
|
||||
this.dependencies = ['persistence-manager'];
|
||||
@@ -193,7 +194,19 @@ class AudioManagerModule extends BaseModule {
|
||||
this.masterVolume = Math.max(0, Math.min(1, volume));
|
||||
this.updateVolumes();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the speech volume
|
||||
* @param {number} volume - The volume level (0.0 to 1.0)
|
||||
*/
|
||||
setTtsVolume(volume) {
|
||||
this.ttsVolume = Math.max(0, Math.min(1, volume));
|
||||
// Apply to current non-loop audio if it exists
|
||||
if (this.currentAudio) {
|
||||
this.currentAudio.volume = this.masterVolume * this.ttsVolume;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the music volume
|
||||
* @param {number} volume - The volume level (0.0 to 1.0)
|
||||
@@ -318,7 +331,7 @@ class AudioManagerModule extends BaseModule {
|
||||
}
|
||||
|
||||
// Apply master volume and speech volume
|
||||
audio.volume = this.masterVolume * speechVolume;
|
||||
audio.volume = this.masterVolume * speechVolume * this._ttsVolume;
|
||||
|
||||
// Set up cleanup
|
||||
audio.onended = () => {
|
||||
|
||||
Reference in New Issue
Block a user