danoniplus 41.4.14 → 41.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/js/danoni_main.js +34 -20
  2. package/package.json +1 -1
package/js/danoni_main.js CHANGED
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Source by tickle
6
6
  * Created : 2018/10/08
7
- * Revised : 2026/01/25
7
+ * Revised : 2026/01/31
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 41.4.14`;
12
- const g_revisedDate = `2026/01/25`;
11
+ const g_version = `Ver 41.4.16`;
12
+ const g_revisedDate = `2026/01/31`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -223,7 +223,7 @@ const g_wordObj = {
223
223
 
224
224
  // オーディオ設定・タイマー管理
225
225
  let g_audio = new Audio();
226
- let g_audioForMS = new Audio();
226
+ let g_audioForMS = null;
227
227
  let g_timeoutEvtId = 0;
228
228
  let g_timeoutEvtTitleId = 0;
229
229
  let g_timeoutEvtResultId = 0;
@@ -5060,7 +5060,9 @@ const titleInit = (_initFlg = false) => {
5060
5060
  const setBGMVolume = (_num = 1) => {
5061
5061
  g_settings.bgmVolumeNum = nextPos(g_settings.bgmVolumeNum, _num, g_settings.volumes.length);
5062
5062
  g_stateObj.bgmVolume = g_settings.volumes[g_settings.bgmVolumeNum];
5063
- g_audioForMS.volume = g_stateObj.bgmVolume / 100;
5063
+ if (g_audioForMS) {
5064
+ g_audioForMS.volume = g_stateObj.bgmVolume / 100;
5065
+ }
5064
5066
  btnBgmVolume.textContent = `${g_stateObj.bgmVolume}${g_lblNameObj.percent}`;
5065
5067
  };
5066
5068
 
@@ -5076,7 +5078,6 @@ const titleInit = (_initFlg = false) => {
5076
5078
  createCss2Button(`btnStart`,
5077
5079
  `>`, () => {
5078
5080
  clearTimeout(g_timeoutEvtTitleId);
5079
- pauseBGM();
5080
5081
  g_handler.removeListener(wheelHandler);
5081
5082
  g_keyObj.prevKey = `Dummy${g_settings.musicIdxNum}`;
5082
5083
  g_langStorage.bgmVolume = g_stateObj.bgmVolume;
@@ -5137,7 +5138,9 @@ const titleInit = (_initFlg = false) => {
5137
5138
 
5138
5139
  // 初期表示用 (2秒後に選曲画面を表示)
5139
5140
  if (_initFlg && !g_headerObj.customTitleUse) {
5140
- g_audioForMS.muted = true;
5141
+ if (g_audioForMS) {
5142
+ g_audioForMS.muted = true;
5143
+ }
5141
5144
  const mSelectTitleSprite = createEmptySprite(divRoot, `mSelectTitleSprite`,
5142
5145
  g_windowObj.mSelectTitleSprite, g_cssObj.settings_DifSelector);
5143
5146
  multiAppend(mSelectTitleSprite,
@@ -5156,7 +5159,7 @@ const titleInit = (_initFlg = false) => {
5156
5159
  if (_opacity <= 0) {
5157
5160
  clearTimeout(fadeOpacity);
5158
5161
  mSelectTitleSprite.style.display = C_DIS_NONE;
5159
- if (!g_stateObj.bgmMuteFlg) {
5162
+ if (!g_stateObj.bgmMuteFlg && g_audioForMS) {
5160
5163
  g_audioForMS.muted = false;
5161
5164
  g_audioForMS.currentTime = g_headerObj.musicStarts[g_headerObj.musicIdxList[g_settings.musicIdxNum]] ?? 0;
5162
5165
  if (g_audioForMS instanceof AudioPlayer) {
@@ -5636,7 +5639,7 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5636
5639
 
5637
5640
  /**
5638
5641
  * BGMのループ処理 (base64エンコード時用)
5639
- * - base64エンコード時はtimeupdateイベントが発火しないため、setIntervalで時間を取得する
5642
+ * - base64エンコード時はtimeupdateイベントが発火しないため、監視しながらループ処理を行う
5640
5643
  */
5641
5644
  const repeatBGM = () => {
5642
5645
  const numAtStart = g_settings.musicIdxNum;
@@ -5665,22 +5668,36 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5665
5668
  );
5666
5669
  };
5667
5670
 
5671
+ /**
5672
+ * 既存のAudio/AudioPlayerをクローズ
5673
+ */
5674
+ const closeExistingAudio = () => {
5675
+ if (g_stateObj.bgmTimeupdateEvtId !== null && g_stateObj.bgmTimeupdateEvtId !== undefined) {
5676
+ g_handler.removeListener(g_stateObj.bgmTimeupdateEvtId);
5677
+ g_stateObj.bgmTimeupdateEvtId = null;
5678
+ }
5679
+ if (g_audioForMS instanceof AudioPlayer) {
5680
+ g_musicdata = ``;
5681
+ g_audioForMS.close();
5682
+ }
5683
+ };
5684
+
5668
5685
  if (encodeFlg) {
5669
5686
  try {
5670
5687
  // base64エンコードは読込に時間が掛かるため、曲変更時のみ読込
5671
5688
  if (!hasVal(g_musicdata) || Math.abs(_num) % g_headerObj.musicIdxList.length !== 0) {
5672
- if (g_audioForMS instanceof AudioPlayer) {
5673
- g_audioForMS.close();
5674
- }
5689
+ closeExistingAudio();
5675
5690
  await loadScript2(url);
5676
5691
  musicInit();
5677
5692
  if (!isTitle()) {
5693
+ g_musicdata = ``;
5678
5694
  return;
5679
5695
  }
5680
5696
  const tmpAudio = new AudioPlayer();
5681
5697
  const array = Uint8Array.from(atob(g_musicdata), v => v.charCodeAt(0));
5682
5698
  await tmpAudio.init(array.buffer);
5683
5699
  if (!isTitle()) {
5700
+ g_musicdata = ``;
5684
5701
  tmpAudio.close();
5685
5702
  return;
5686
5703
  }
@@ -5699,13 +5716,7 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5699
5716
 
5700
5717
  } else {
5701
5718
  // 既存の監視を解除し、AudioPlayer を確実にクローズ
5702
- if (g_stateObj.bgmTimeupdateEvtId) {
5703
- g_handler.removeListener(g_stateObj.bgmTimeupdateEvtId);
5704
- g_stateObj.bgmTimeupdateEvtId = null;
5705
- }
5706
- if (g_audioForMS instanceof AudioPlayer) {
5707
- g_audioForMS.close();
5708
- }
5719
+ closeExistingAudio();
5709
5720
  g_audioForMS = new Audio();
5710
5721
  g_audioForMS.src = url;
5711
5722
  g_audioForMS.autoplay = false;
@@ -5923,6 +5934,7 @@ const setWindowStyle = (_text, _bkColor, _textColor, _align = C_ALIGN_LEFT, { _x
5923
5934
 
5924
5935
  const dataMgtInit = () => {
5925
5936
  clearWindow(true);
5937
+ pauseBGM();
5926
5938
  const prevPage = g_currentPage;
5927
5939
  g_currentPage = `dataMgt`;
5928
5940
  let selectedKey = g_keyObj.currentKey;
@@ -6154,6 +6166,7 @@ const dataMgtInit = () => {
6154
6166
 
6155
6167
  const preconditionInit = () => {
6156
6168
  clearWindow(true);
6169
+ pauseBGM();
6157
6170
  const prevPage = g_currentPage;
6158
6171
  g_currentPage = `precondition`;
6159
6172
 
@@ -6321,6 +6334,7 @@ const makePlayButton = _func => createCss2Button(`btnPlay`, g_lblNameObj.b_play,
6321
6334
  const optionInit = () => {
6322
6335
 
6323
6336
  clearWindow(true);
6337
+ pauseBGM();
6324
6338
  const divRoot = document.getElementById(`divRoot`);
6325
6339
  g_currentPage = `option`;
6326
6340
  g_stateObj.filterKeys = ``;
@@ -9341,7 +9355,7 @@ const changeShuffleConfigColor = (_keyCtrlPtn, _vals, _j = -1) => {
9341
9355
  const loadMusic = () => {
9342
9356
 
9343
9357
  clearWindow(true);
9344
- g_audioForMS.pause();
9358
+ pauseBGM();
9345
9359
  g_currentPage = `loading`;
9346
9360
 
9347
9361
  const musicUrl = getMusicUrl(g_stateObj.scoreId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "41.4.14",
3
+ "version": "41.4.16",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {