danoniplus 43.6.2 → 43.6.4

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 43.6.2`;
12
- const g_revisedDate = `2026/01/25`;
11
+ const g_version = `Ver 43.6.4`;
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;
@@ -5177,7 +5177,9 @@ const titleInit = (_initFlg = false) => {
5177
5177
  const setBGMVolume = (_num = 1) => {
5178
5178
  g_settings.bgmVolumeNum = nextPos(g_settings.bgmVolumeNum, _num, g_settings.volumes.length);
5179
5179
  g_stateObj.bgmVolume = g_settings.volumes[g_settings.bgmVolumeNum];
5180
- g_audioForMS.volume = g_stateObj.bgmVolume / 100;
5180
+ if (g_audioForMS) {
5181
+ g_audioForMS.volume = g_stateObj.bgmVolume / 100;
5182
+ }
5181
5183
  btnBgmVolume.textContent = `${g_stateObj.bgmVolume}${g_lblNameObj.percent}`;
5182
5184
  };
5183
5185
 
@@ -5193,7 +5195,6 @@ const titleInit = (_initFlg = false) => {
5193
5195
  createCss2Button(`btnStart`,
5194
5196
  `>`, () => {
5195
5197
  clearTimeout(g_timeoutEvtTitleId);
5196
- pauseBGM();
5197
5198
  g_handler.removeListener(wheelHandler);
5198
5199
  g_keyObj.prevKey = `Dummy${g_settings.musicIdxNum}`;
5199
5200
  g_langStorage.bgmVolume = g_stateObj.bgmVolume;
@@ -5257,7 +5258,9 @@ const titleInit = (_initFlg = false) => {
5257
5258
 
5258
5259
  // 初期表示用 (2秒後に選曲画面を表示)
5259
5260
  if (_initFlg && !g_headerObj.customTitleUse) {
5260
- g_audioForMS.muted = true;
5261
+ if (g_audioForMS) {
5262
+ g_audioForMS.muted = true;
5263
+ }
5261
5264
  const mSelectTitleSprite = createEmptySprite(divRoot, `mSelectTitleSprite`,
5262
5265
  g_windowObj.mSelectTitleSprite, g_cssObj.settings_DifSelector);
5263
5266
  multiAppend(mSelectTitleSprite,
@@ -5276,7 +5279,7 @@ const titleInit = (_initFlg = false) => {
5276
5279
  if (_opacity <= 0) {
5277
5280
  clearTimeout(fadeOpacity);
5278
5281
  mSelectTitleSprite.style.display = C_DIS_NONE;
5279
- if (!g_stateObj.bgmMuteFlg) {
5282
+ if (!g_stateObj.bgmMuteFlg && g_audioForMS) {
5280
5283
  g_audioForMS.muted = false;
5281
5284
  g_audioForMS.currentTime = g_headerObj.musicStarts[g_headerObj.musicIdxList[g_settings.musicIdxNum]] ?? 0;
5282
5285
  if (g_audioForMS instanceof AudioPlayer) {
@@ -5757,7 +5760,7 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5757
5760
 
5758
5761
  /**
5759
5762
  * BGMのループ処理 (base64エンコード時用)
5760
- * - base64エンコード時はtimeupdateイベントが発火しないため、setIntervalで時間を取得する
5763
+ * - base64エンコード時はtimeupdateイベントが発火しないため、監視しながらループ処理を行う
5761
5764
  */
5762
5765
  const repeatBGM = () => {
5763
5766
  const numAtStart = g_settings.musicIdxNum;
@@ -5786,22 +5789,36 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5786
5789
  );
5787
5790
  };
5788
5791
 
5792
+ /**
5793
+ * 既存のAudio/AudioPlayerをクローズ
5794
+ */
5795
+ const closeExistingAudio = () => {
5796
+ if (g_stateObj.bgmTimeupdateEvtId !== null && g_stateObj.bgmTimeupdateEvtId !== undefined) {
5797
+ g_handler.removeListener(g_stateObj.bgmTimeupdateEvtId);
5798
+ g_stateObj.bgmTimeupdateEvtId = null;
5799
+ }
5800
+ if (g_audioForMS instanceof AudioPlayer) {
5801
+ g_musicdata = ``;
5802
+ g_audioForMS.close();
5803
+ }
5804
+ };
5805
+
5789
5806
  if (encodeFlg) {
5790
5807
  try {
5791
5808
  // base64エンコードは読込に時間が掛かるため、曲変更時のみ読込
5792
5809
  if (!hasVal(g_musicdata) || Math.abs(_num) % g_headerObj.musicIdxList.length !== 0) {
5793
- if (g_audioForMS instanceof AudioPlayer) {
5794
- g_audioForMS.close();
5795
- }
5810
+ closeExistingAudio();
5796
5811
  await loadScript2(url);
5797
5812
  musicInit();
5798
5813
  if (!isTitle()) {
5814
+ g_musicdata = ``;
5799
5815
  return;
5800
5816
  }
5801
5817
  const tmpAudio = new AudioPlayer();
5802
5818
  const array = Uint8Array.from(atob(g_musicdata), v => v.charCodeAt(0));
5803
5819
  await tmpAudio.init(array.buffer);
5804
5820
  if (!isTitle()) {
5821
+ g_musicdata = ``;
5805
5822
  tmpAudio.close();
5806
5823
  return;
5807
5824
  }
@@ -5820,13 +5837,7 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5820
5837
 
5821
5838
  } else {
5822
5839
  // 既存の監視を解除し、AudioPlayer を確実にクローズ
5823
- if (g_stateObj.bgmTimeupdateEvtId) {
5824
- g_handler.removeListener(g_stateObj.bgmTimeupdateEvtId);
5825
- g_stateObj.bgmTimeupdateEvtId = null;
5826
- }
5827
- if (g_audioForMS instanceof AudioPlayer) {
5828
- g_audioForMS.close();
5829
- }
5840
+ closeExistingAudio();
5830
5841
  g_audioForMS = new Audio();
5831
5842
  g_audioForMS.src = url;
5832
5843
  g_audioForMS.autoplay = false;
@@ -6047,6 +6058,7 @@ const setWindowStyle = (_text, _bkColor, _textColor, _align = C_ALIGN_LEFT, { _x
6047
6058
 
6048
6059
  const dataMgtInit = () => {
6049
6060
  clearWindow(true);
6061
+ pauseBGM();
6050
6062
  const prevPage = g_currentPage;
6051
6063
  g_currentPage = `dataMgt`;
6052
6064
  let selectedKey = g_keyObj.currentKey;
@@ -6278,6 +6290,7 @@ const dataMgtInit = () => {
6278
6290
 
6279
6291
  const preconditionInit = () => {
6280
6292
  clearWindow(true);
6293
+ pauseBGM();
6281
6294
  const prevPage = g_currentPage;
6282
6295
  g_currentPage = `precondition`;
6283
6296
 
@@ -6445,6 +6458,7 @@ const makePlayButton = _func => createCss2Button(`btnPlay`, g_lblNameObj.b_play,
6445
6458
  const optionInit = () => {
6446
6459
 
6447
6460
  clearWindow(true);
6461
+ pauseBGM();
6448
6462
  const divRoot = document.getElementById(`divRoot`);
6449
6463
  g_currentPage = `option`;
6450
6464
  g_stateObj.filterKeys = ``;
@@ -9594,7 +9608,7 @@ const changeShuffleConfigColor = (_keyCtrlPtn, _vals, _j = -1) => {
9594
9608
  const loadMusic = () => {
9595
9609
 
9596
9610
  clearWindow(true);
9597
- g_audioForMS.pause();
9611
+ pauseBGM();
9598
9612
  g_currentPage = `loading`;
9599
9613
 
9600
9614
  const musicUrl = getMusicUrl(g_stateObj.scoreId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "43.6.2",
3
+ "version": "43.6.4",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {