commit 14/10/2025
Soundbank Menu beres
This commit is contained in:
@@ -98,8 +98,9 @@ function fill_soundbanktablebody(vv) {
|
||||
* @param {String} language
|
||||
* @param {String} category
|
||||
* @param {String} voiceType
|
||||
* @param {Function} cb callback function when done
|
||||
*/
|
||||
function reloadSoundbankFiles(language, category, voiceType) {
|
||||
function reloadSoundbankFiles(language, category, voiceType, cb=null) {
|
||||
window.select2data = [];
|
||||
$('#modalpath').empty().trigger('change');
|
||||
if (language && language.length > 0) {
|
||||
@@ -117,6 +118,7 @@ function reloadSoundbankFiles(language, category, voiceType) {
|
||||
width: '100%',
|
||||
dropdownParent: $('#soundbankmodal')
|
||||
});
|
||||
if (cb) cb();
|
||||
}
|
||||
}, (errdata) => {
|
||||
alert("Error loading soundbank files : " + errdata.message);
|
||||
@@ -278,6 +280,7 @@ $(document).ready(function () {
|
||||
* @type {SoundBank}
|
||||
*/
|
||||
let nsb = {
|
||||
index: 0,
|
||||
Description: description,
|
||||
TAG: tag,
|
||||
Category: category,
|
||||
@@ -302,7 +305,7 @@ $(document).ready(function () {
|
||||
let cells = window.selectedsoundrow.find('td');
|
||||
/** @type {SoundBank} */
|
||||
let sb = {
|
||||
index: cells.eq(0).text(),
|
||||
index: Number(cells.eq(0).text()),
|
||||
description: cells.eq(1).text(),
|
||||
tag: cells.eq(2).text(),
|
||||
category: cells.eq(3).text(),
|
||||
@@ -325,7 +328,7 @@ $(document).ready(function () {
|
||||
let cells = window.selectedsoundrow.find('td');
|
||||
/** @type {SoundBank} */
|
||||
let sb = {
|
||||
index: cells.eq(0).text(),
|
||||
index: Number(cells.eq(0).text()),
|
||||
Description: cells.eq(1).text(),
|
||||
TAG: cells.eq(2).text(),
|
||||
Category: cells.eq(3).text(),
|
||||
@@ -336,16 +339,24 @@ $(document).ready(function () {
|
||||
if (confirm(`Are you sure to edit soundbank [${sb.index}] Description=${sb.Description} Tag=${sb.TAG}?`)) {
|
||||
$modal.modal('show');
|
||||
clearSoundbankModal();
|
||||
SetupEventForCategoryLanguageVoiceType();
|
||||
$modalindex.val(sb.index).prop('disabled', true);
|
||||
$modaldescription.val(sb.Description);
|
||||
$modaltag.val(sb.TAG);
|
||||
$modalcategory.val(sb.Category);
|
||||
selected_category = sb.Category;
|
||||
$modallanguage.val(sb.Language);
|
||||
selected_language = sb.Language;
|
||||
$modalvoicetype.val(sb.VoiceType);
|
||||
$('#modalpath').val(sb.Path).trigger('change');
|
||||
selected_voicetype = sb.VoiceType;
|
||||
// load soundbank files for selected language, category, voiceType
|
||||
reloadSoundbankFiles(selected_language, selected_category, selected_voicetype, () => {
|
||||
// set selected path
|
||||
$('#modalpath').val(getFilenameFromPath(sb.Path)).trigger('change');
|
||||
});
|
||||
|
||||
|
||||
SetupEventForCategoryLanguageVoiceType();
|
||||
|
||||
// event on Click save button
|
||||
$modal.off('click.soundbanksave').on('click.soundbanksave', '#soundbanksave', function () {
|
||||
let description = $modaldescription.val().trim();
|
||||
@@ -388,7 +399,7 @@ $(document).ready(function () {
|
||||
sb.Language = language;
|
||||
sb.VoiceType = voiceType;
|
||||
sb.Path = path;
|
||||
fetchAPI(APIURL + "UpdateByIndex/" + sb.index, "PUT", {}, sb, (okdata) => {
|
||||
fetchAPI(APIURL + "UpdateByIndex/" + sb.index, "PATCH", {}, sb, (okdata) => {
|
||||
reloadSoundBank(APIURL);
|
||||
alert("Success update soundbank : " + okdata.message);
|
||||
}, (errdata) => {
|
||||
|
||||
Reference in New Issue
Block a user