From 73c874f7f20263f088a1643e30faff935fa5e12b Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:00:35 +0530 Subject: [PATCH] audio chapter export verse order issue . fixed --- renderer/src/components/AudioRecorder/core/audioUtils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/renderer/src/components/AudioRecorder/core/audioUtils.js b/renderer/src/components/AudioRecorder/core/audioUtils.js index d62251a70..7e82974ef 100644 --- a/renderer/src/components/AudioRecorder/core/audioUtils.js +++ b/renderer/src/components/AudioRecorder/core/audioUtils.js @@ -75,11 +75,16 @@ async function fetchAndCombineAudio(audioArr, path) { }); } +function sortingLogic(a, b) { + // expected format : '1_10_1_default.mp3', + return a.split('_')[1] - b.split('_')[1]; +} + export async function mergeAudio(audioArr, dirPath, path, book, chapter) { logger.debug('audioUtils.js', 'In Merge Audio fucntion'); // const audio = new ConcatAudio(window); return new Promise((resolve) => { - audioArr.sort(); + audioArr.sort(sortingLogic); for (let i = 0; i < audioArr.length; i++) { audioArr[i] = path.join(dirPath, audioArr[i]); }