diff --git a/public/static/sound/cn/0_point.mp3 b/public/static/sound/cn/0_point.mp3 index ededb95e..90136dec 100644 Binary files a/public/static/sound/cn/0_point.mp3 and b/public/static/sound/cn/0_point.mp3 differ diff --git a/public/static/sound/cn/1_point.mp3 b/public/static/sound/cn/1_point.mp3 index e07c6c74..f9b60658 100644 Binary files a/public/static/sound/cn/1_point.mp3 and b/public/static/sound/cn/1_point.mp3 differ diff --git a/public/static/sound/cn/2_point.mp3 b/public/static/sound/cn/2_point.mp3 index 854237a1..c19cab41 100644 Binary files a/public/static/sound/cn/2_point.mp3 and b/public/static/sound/cn/2_point.mp3 differ diff --git a/public/static/sound/cn/3_point.mp3 b/public/static/sound/cn/3_point.mp3 index dd6f482f..e92053cf 100644 Binary files a/public/static/sound/cn/3_point.mp3 and b/public/static/sound/cn/3_point.mp3 differ diff --git a/public/static/sound/cn/4_point.mp3 b/public/static/sound/cn/4_point.mp3 index 7de33558..cece10f7 100644 Binary files a/public/static/sound/cn/4_point.mp3 and b/public/static/sound/cn/4_point.mp3 differ diff --git a/public/static/sound/cn/5_point.mp3 b/public/static/sound/cn/5_point.mp3 index 382bbc1f..4651b1fd 100644 Binary files a/public/static/sound/cn/5_point.mp3 and b/public/static/sound/cn/5_point.mp3 differ diff --git a/public/static/sound/cn/6_point.mp3 b/public/static/sound/cn/6_point.mp3 index 06b7efa4..978f6eea 100644 Binary files a/public/static/sound/cn/6_point.mp3 and b/public/static/sound/cn/6_point.mp3 differ diff --git a/public/static/sound/cn/7_point.mp3 b/public/static/sound/cn/7_point.mp3 index 304fd8fc..6b3c39ca 100644 Binary files a/public/static/sound/cn/7_point.mp3 and b/public/static/sound/cn/7_point.mp3 differ diff --git a/public/static/sound/cn/8_point.mp3 b/public/static/sound/cn/8_point.mp3 index f5b49351..37389081 100644 Binary files a/public/static/sound/cn/8_point.mp3 and b/public/static/sound/cn/8_point.mp3 differ diff --git a/public/static/sound/cn/9_point.mp3 b/public/static/sound/cn/9_point.mp3 index 1e8410f2..d7339148 100644 Binary files a/public/static/sound/cn/9_point.mp3 and b/public/static/sound/cn/9_point.mp3 differ diff --git a/public/static/sound/cn/baccarat/b_draw.mp3 b/public/static/sound/cn/baccarat/b_draw.mp3 index c8665374..fc583230 100644 Binary files a/public/static/sound/cn/baccarat/b_draw.mp3 and b/public/static/sound/cn/baccarat/b_draw.mp3 differ diff --git a/public/static/sound/cn/baccarat/b_pair.mp3 b/public/static/sound/cn/baccarat/b_pair.mp3 index 2c3ccc8b..8cbaf105 100644 Binary files a/public/static/sound/cn/baccarat/b_pair.mp3 and b/public/static/sound/cn/baccarat/b_pair.mp3 differ diff --git a/public/static/sound/cn/baccarat/b_win.mp3 b/public/static/sound/cn/baccarat/b_win.mp3 index 7d5f3b10..a760ce81 100644 Binary files a/public/static/sound/cn/baccarat/b_win.mp3 and b/public/static/sound/cn/baccarat/b_win.mp3 differ diff --git a/public/static/sound/cn/baccarat/banker.mp3 b/public/static/sound/cn/baccarat/banker.mp3 index bb34c4fb..da5eb065 100644 Binary files a/public/static/sound/cn/baccarat/banker.mp3 and b/public/static/sound/cn/baccarat/banker.mp3 differ diff --git a/public/static/sound/cn/baccarat/p_draw.mp3 b/public/static/sound/cn/baccarat/p_draw.mp3 index f536ca6f..78e6823a 100644 Binary files a/public/static/sound/cn/baccarat/p_draw.mp3 and b/public/static/sound/cn/baccarat/p_draw.mp3 differ diff --git a/public/static/sound/cn/baccarat/p_pair.mp3 b/public/static/sound/cn/baccarat/p_pair.mp3 index 3684567f..84430997 100644 Binary files a/public/static/sound/cn/baccarat/p_pair.mp3 and b/public/static/sound/cn/baccarat/p_pair.mp3 differ diff --git a/public/static/sound/cn/baccarat/p_win.mp3 b/public/static/sound/cn/baccarat/p_win.mp3 index a2740b04..d0949020 100644 Binary files a/public/static/sound/cn/baccarat/p_win.mp3 and b/public/static/sound/cn/baccarat/p_win.mp3 differ diff --git a/public/static/sound/cn/baccarat/player.mp3 b/public/static/sound/cn/baccarat/player.mp3 index 0d901fc1..b8ce9475 100644 Binary files a/public/static/sound/cn/baccarat/player.mp3 and b/public/static/sound/cn/baccarat/player.mp3 differ diff --git a/public/static/sound/cn/baccarat/tie.mp3 b/public/static/sound/cn/baccarat/tie.mp3 index d6bfec0c..4e0b418f 100644 Binary files a/public/static/sound/cn/baccarat/tie.mp3 and b/public/static/sound/cn/baccarat/tie.mp3 differ diff --git a/public/static/sound/cn/baccarat/w_p1.mp3 b/public/static/sound/cn/baccarat/w_p1.mp3 index 08e175ab..70040846 100644 Binary files a/public/static/sound/cn/baccarat/w_p1.mp3 and b/public/static/sound/cn/baccarat/w_p1.mp3 differ diff --git a/public/static/sound/cn/baccarat/w_p2.mp3 b/public/static/sound/cn/baccarat/w_p2.mp3 index e6d1fadb..70040846 100644 Binary files a/public/static/sound/cn/baccarat/w_p2.mp3 and b/public/static/sound/cn/baccarat/w_p2.mp3 differ diff --git a/public/static/sound/cn/baccarat/w_p3.mp3 b/public/static/sound/cn/baccarat/w_p3.mp3 index 6bc4a6f7..70040846 100644 Binary files a/public/static/sound/cn/baccarat/w_p3.mp3 and b/public/static/sound/cn/baccarat/w_p3.mp3 differ diff --git a/public/static/sound/cn/baccarat/w_p5.mp3 b/public/static/sound/cn/baccarat/w_p5.mp3 index c9297505..70040846 100644 Binary files a/public/static/sound/cn/baccarat/w_p5.mp3 and b/public/static/sound/cn/baccarat/w_p5.mp3 differ diff --git a/public/static/sound/cn/baccarat/w_p6.mp3 b/public/static/sound/cn/baccarat/w_p6.mp3 index e279a8fb..70040846 100644 Binary files a/public/static/sound/cn/baccarat/w_p6.mp3 and b/public/static/sound/cn/baccarat/w_p6.mp3 differ diff --git a/public/static/sound/cn/baccarat/w_p7.mp3 b/public/static/sound/cn/baccarat/w_p7.mp3 index 84ef9c01..70040846 100644 Binary files a/public/static/sound/cn/baccarat/w_p7.mp3 and b/public/static/sound/cn/baccarat/w_p7.mp3 differ diff --git a/public/static/sound/cn/check.mp3 b/public/static/sound/cn/check.mp3 index 66bb4190..17fafa6f 100644 Binary files a/public/static/sound/cn/check.mp3 and b/public/static/sound/cn/check.mp3 differ diff --git a/public/static/sound/cn/dice/w_p1.mp3 b/public/static/sound/cn/dice/w_p1.mp3 index 96c9678e..4a45e95a 100644 Binary files a/public/static/sound/cn/dice/w_p1.mp3 and b/public/static/sound/cn/dice/w_p1.mp3 differ diff --git a/public/static/sound/cn/dice/w_p2.mp3 b/public/static/sound/cn/dice/w_p2.mp3 index 2d6e2da7..4a45e95a 100644 Binary files a/public/static/sound/cn/dice/w_p2.mp3 and b/public/static/sound/cn/dice/w_p2.mp3 differ diff --git a/public/static/sound/cn/dice/w_p3.mp3 b/public/static/sound/cn/dice/w_p3.mp3 index 63b67067..4a45e95a 100644 Binary files a/public/static/sound/cn/dice/w_p3.mp3 and b/public/static/sound/cn/dice/w_p3.mp3 differ diff --git a/public/static/sound/cn/dice/w_p5.mp3 b/public/static/sound/cn/dice/w_p5.mp3 index b1b7808e..4a45e95a 100644 Binary files a/public/static/sound/cn/dice/w_p5.mp3 and b/public/static/sound/cn/dice/w_p5.mp3 differ diff --git a/public/static/sound/cn/dice/w_p6.mp3 b/public/static/sound/cn/dice/w_p6.mp3 index d0c64acc..4a45e95a 100644 Binary files a/public/static/sound/cn/dice/w_p6.mp3 and b/public/static/sound/cn/dice/w_p6.mp3 differ diff --git a/public/static/sound/cn/dice/w_p7.mp3 b/public/static/sound/cn/dice/w_p7.mp3 index 77f6d106..4a45e95a 100644 Binary files a/public/static/sound/cn/dice/w_p7.mp3 and b/public/static/sound/cn/dice/w_p7.mp3 differ diff --git a/public/static/sound/cn/last_10_seconds.mp3 b/public/static/sound/cn/last_10_seconds.mp3 index 6f68ce91..e5c30c45 100644 Binary files a/public/static/sound/cn/last_10_seconds.mp3 and b/public/static/sound/cn/last_10_seconds.mp3 differ diff --git a/public/static/sound/cn/lh/dragon.mp3 b/public/static/sound/cn/lh/dragon.mp3 index 37986e4b..10b84e47 100644 Binary files a/public/static/sound/cn/lh/dragon.mp3 and b/public/static/sound/cn/lh/dragon.mp3 differ diff --git a/public/static/sound/cn/lh/dragon_win.mp3 b/public/static/sound/cn/lh/dragon_win.mp3 index cfd844cb..05d8829b 100644 Binary files a/public/static/sound/cn/lh/dragon_win.mp3 and b/public/static/sound/cn/lh/dragon_win.mp3 differ diff --git a/public/static/sound/cn/lh/tie.mp3 b/public/static/sound/cn/lh/tie.mp3 index d6bfec0c..f02ec9a6 100644 Binary files a/public/static/sound/cn/lh/tie.mp3 and b/public/static/sound/cn/lh/tie.mp3 differ diff --git a/public/static/sound/cn/lh/tiger.mp3 b/public/static/sound/cn/lh/tiger.mp3 index bfd5a1dd..512dced0 100644 Binary files a/public/static/sound/cn/lh/tiger.mp3 and b/public/static/sound/cn/lh/tiger.mp3 differ diff --git a/public/static/sound/cn/lh/tiger_win.mp3 b/public/static/sound/cn/lh/tiger_win.mp3 index 36675bac..32dbc363 100644 Binary files a/public/static/sound/cn/lh/tiger_win.mp3 and b/public/static/sound/cn/lh/tiger_win.mp3 differ diff --git a/public/static/sound/cn/lh/w_p1.mp3 b/public/static/sound/cn/lh/w_p1.mp3 index f3fde14a..70040846 100644 Binary files a/public/static/sound/cn/lh/w_p1.mp3 and b/public/static/sound/cn/lh/w_p1.mp3 differ diff --git a/public/static/sound/cn/lh/w_p2.mp3 b/public/static/sound/cn/lh/w_p2.mp3 index 771fb94e..70040846 100644 Binary files a/public/static/sound/cn/lh/w_p2.mp3 and b/public/static/sound/cn/lh/w_p2.mp3 differ diff --git a/public/static/sound/cn/lh/w_p3.mp3 b/public/static/sound/cn/lh/w_p3.mp3 index 2f5168b2..70040846 100644 Binary files a/public/static/sound/cn/lh/w_p3.mp3 and b/public/static/sound/cn/lh/w_p3.mp3 differ diff --git a/public/static/sound/cn/lh/w_p5.mp3 b/public/static/sound/cn/lh/w_p5.mp3 index 1a7a2811..70040846 100644 Binary files a/public/static/sound/cn/lh/w_p5.mp3 and b/public/static/sound/cn/lh/w_p5.mp3 differ diff --git a/public/static/sound/cn/lh/w_p6.mp3 b/public/static/sound/cn/lh/w_p6.mp3 index 3851c892..70040846 100644 Binary files a/public/static/sound/cn/lh/w_p6.mp3 and b/public/static/sound/cn/lh/w_p6.mp3 differ diff --git a/public/static/sound/cn/lh/w_p7.mp3 b/public/static/sound/cn/lh/w_p7.mp3 index f962d7ce..70040846 100644 Binary files a/public/static/sound/cn/lh/w_p7.mp3 and b/public/static/sound/cn/lh/w_p7.mp3 differ diff --git a/public/static/sound/cn/nn/banker.mp3 b/public/static/sound/cn/nn/banker.mp3 index bb34c4fb..728ea6ef 100644 Binary files a/public/static/sound/cn/nn/banker.mp3 and b/public/static/sound/cn/nn/banker.mp3 differ diff --git a/public/static/sound/cn/nn/bull_1.mp3 b/public/static/sound/cn/nn/bull_1.mp3 index 1b3bcd3b..091eb696 100644 Binary files a/public/static/sound/cn/nn/bull_1.mp3 and b/public/static/sound/cn/nn/bull_1.mp3 differ diff --git a/public/static/sound/cn/nn/bull_2.mp3 b/public/static/sound/cn/nn/bull_2.mp3 index 35c9aeeb..a7d45080 100644 Binary files a/public/static/sound/cn/nn/bull_2.mp3 and b/public/static/sound/cn/nn/bull_2.mp3 differ diff --git a/public/static/sound/cn/nn/bull_3.mp3 b/public/static/sound/cn/nn/bull_3.mp3 index ddcd9efa..03550efe 100644 Binary files a/public/static/sound/cn/nn/bull_3.mp3 and b/public/static/sound/cn/nn/bull_3.mp3 differ diff --git a/public/static/sound/cn/nn/bull_4.mp3 b/public/static/sound/cn/nn/bull_4.mp3 index ce8707cd..d4e6f017 100644 Binary files a/public/static/sound/cn/nn/bull_4.mp3 and b/public/static/sound/cn/nn/bull_4.mp3 differ diff --git a/public/static/sound/cn/nn/bull_5.mp3 b/public/static/sound/cn/nn/bull_5.mp3 index c36f40ce..47baafd9 100644 Binary files a/public/static/sound/cn/nn/bull_5.mp3 and b/public/static/sound/cn/nn/bull_5.mp3 differ diff --git a/public/static/sound/cn/nn/bull_6.mp3 b/public/static/sound/cn/nn/bull_6.mp3 index db751516..2a5f832e 100644 Binary files a/public/static/sound/cn/nn/bull_6.mp3 and b/public/static/sound/cn/nn/bull_6.mp3 differ diff --git a/public/static/sound/cn/nn/bull_7.mp3 b/public/static/sound/cn/nn/bull_7.mp3 index 6a26dfd5..ed6090fb 100644 Binary files a/public/static/sound/cn/nn/bull_7.mp3 and b/public/static/sound/cn/nn/bull_7.mp3 differ diff --git a/public/static/sound/cn/nn/bull_8.mp3 b/public/static/sound/cn/nn/bull_8.mp3 index 7bf95bfe..01fad51f 100644 Binary files a/public/static/sound/cn/nn/bull_8.mp3 and b/public/static/sound/cn/nn/bull_8.mp3 differ diff --git a/public/static/sound/cn/nn/bull_9.mp3 b/public/static/sound/cn/nn/bull_9.mp3 index 87742387..79aec8ec 100644 Binary files a/public/static/sound/cn/nn/bull_9.mp3 and b/public/static/sound/cn/nn/bull_9.mp3 differ diff --git a/public/static/sound/cn/nn/bull_bull.mp3 b/public/static/sound/cn/nn/bull_bull.mp3 index 97507e48..85473b49 100644 Binary files a/public/static/sound/cn/nn/bull_bull.mp3 and b/public/static/sound/cn/nn/bull_bull.mp3 differ diff --git a/public/static/sound/cn/nn/five_pictur_bull.mp3 b/public/static/sound/cn/nn/five_pictur_bull.mp3 index 125039c5..28d666b6 100644 Binary files a/public/static/sound/cn/nn/five_pictur_bull.mp3 and b/public/static/sound/cn/nn/five_pictur_bull.mp3 differ diff --git a/public/static/sound/cn/nn/no_bull.mp3 b/public/static/sound/cn/nn/no_bull.mp3 index 1976caec..7c3fad09 100644 Binary files a/public/static/sound/cn/nn/no_bull.mp3 and b/public/static/sound/cn/nn/no_bull.mp3 differ diff --git a/public/static/sound/cn/nn/player_1.mp3 b/public/static/sound/cn/nn/player_1.mp3 index 09ea9b6f..b2dd0660 100644 Binary files a/public/static/sound/cn/nn/player_1.mp3 and b/public/static/sound/cn/nn/player_1.mp3 differ diff --git a/public/static/sound/cn/nn/player_2.mp3 b/public/static/sound/cn/nn/player_2.mp3 index 6ba6fc9e..90daaca9 100644 Binary files a/public/static/sound/cn/nn/player_2.mp3 and b/public/static/sound/cn/nn/player_2.mp3 differ diff --git a/public/static/sound/cn/nn/player_3.mp3 b/public/static/sound/cn/nn/player_3.mp3 index 15146027..fa2556df 100644 Binary files a/public/static/sound/cn/nn/player_3.mp3 and b/public/static/sound/cn/nn/player_3.mp3 differ diff --git a/public/static/sound/cn/nn/w_p1.mp3 b/public/static/sound/cn/nn/w_p1.mp3 index 898ff821..70040846 100644 Binary files a/public/static/sound/cn/nn/w_p1.mp3 and b/public/static/sound/cn/nn/w_p1.mp3 differ diff --git a/public/static/sound/cn/nn/w_p2.mp3 b/public/static/sound/cn/nn/w_p2.mp3 index 9501fa8e..70040846 100644 Binary files a/public/static/sound/cn/nn/w_p2.mp3 and b/public/static/sound/cn/nn/w_p2.mp3 differ diff --git a/public/static/sound/cn/nn/w_p3.mp3 b/public/static/sound/cn/nn/w_p3.mp3 index 67812e88..70040846 100644 Binary files a/public/static/sound/cn/nn/w_p3.mp3 and b/public/static/sound/cn/nn/w_p3.mp3 differ diff --git a/public/static/sound/cn/nn/w_p5.mp3 b/public/static/sound/cn/nn/w_p5.mp3 index 33a02cfe..70040846 100644 Binary files a/public/static/sound/cn/nn/w_p5.mp3 and b/public/static/sound/cn/nn/w_p5.mp3 differ diff --git a/public/static/sound/cn/nn/w_p6.mp3 b/public/static/sound/cn/nn/w_p6.mp3 index 7ca4eb61..70040846 100644 Binary files a/public/static/sound/cn/nn/w_p6.mp3 and b/public/static/sound/cn/nn/w_p6.mp3 differ diff --git a/public/static/sound/cn/nn/w_p7.mp3 b/public/static/sound/cn/nn/w_p7.mp3 index 4e8fe131..70040846 100644 Binary files a/public/static/sound/cn/nn/w_p7.mp3 and b/public/static/sound/cn/nn/w_p7.mp3 differ diff --git a/public/static/sound/cn/push.mp3 b/public/static/sound/cn/push.mp3 index c67bd1bc..70040846 100644 Binary files a/public/static/sound/cn/push.mp3 and b/public/static/sound/cn/push.mp3 differ diff --git a/public/static/sound/cn/show_card.mp3 b/public/static/sound/cn/show_card.mp3 index 54aacade..228c2dc9 100644 Binary files a/public/static/sound/cn/show_card.mp3 and b/public/static/sound/cn/show_card.mp3 differ diff --git a/public/static/sound/cn/start_betting.mp3 b/public/static/sound/cn/start_betting.mp3 index bef5f882..3dbc02b2 100644 Binary files a/public/static/sound/cn/start_betting.mp3 and b/public/static/sound/cn/start_betting.mp3 differ diff --git a/public/static/sound/cn/stop_betting.mp3 b/public/static/sound/cn/stop_betting.mp3 index 9e408c33..a45b310c 100644 Binary files a/public/static/sound/cn/stop_betting.mp3 and b/public/static/sound/cn/stop_betting.mp3 differ diff --git a/public/static/sound/cn/time.mp3 b/public/static/sound/cn/time.mp3 index 3be682ea..9af3ca69 100644 Binary files a/public/static/sound/cn/time.mp3 and b/public/static/sound/cn/time.mp3 differ diff --git a/public/static/sound/cn/toning/w_p1.mp3 b/public/static/sound/cn/toning/w_p1.mp3 index 70602e45..4a45e95a 100644 Binary files a/public/static/sound/cn/toning/w_p1.mp3 and b/public/static/sound/cn/toning/w_p1.mp3 differ diff --git a/public/static/sound/cn/toning/w_p2.mp3 b/public/static/sound/cn/toning/w_p2.mp3 index 3119bb3b..4a45e95a 100644 Binary files a/public/static/sound/cn/toning/w_p2.mp3 and b/public/static/sound/cn/toning/w_p2.mp3 differ diff --git a/public/static/sound/cn/toning/w_p3.mp3 b/public/static/sound/cn/toning/w_p3.mp3 index 2347764d..4a45e95a 100644 Binary files a/public/static/sound/cn/toning/w_p3.mp3 and b/public/static/sound/cn/toning/w_p3.mp3 differ diff --git a/public/static/sound/cn/toning/w_p5.mp3 b/public/static/sound/cn/toning/w_p5.mp3 index 055e79c1..4a45e95a 100644 Binary files a/public/static/sound/cn/toning/w_p5.mp3 and b/public/static/sound/cn/toning/w_p5.mp3 differ diff --git a/public/static/sound/cn/toning/w_p6.mp3 b/public/static/sound/cn/toning/w_p6.mp3 index d7ae5e3a..4a45e95a 100644 Binary files a/public/static/sound/cn/toning/w_p6.mp3 and b/public/static/sound/cn/toning/w_p6.mp3 differ diff --git a/public/static/sound/cn/toning/w_p7.mp3 b/public/static/sound/cn/toning/w_p7.mp3 index 407c3df3..4a45e95a 100644 Binary files a/public/static/sound/cn/toning/w_p7.mp3 and b/public/static/sound/cn/toning/w_p7.mp3 differ diff --git a/public/static/sound/en/0_point.mp3 b/public/static/sound/en/0_point.mp3 index d2eac80e..07b52f68 100644 Binary files a/public/static/sound/en/0_point.mp3 and b/public/static/sound/en/0_point.mp3 differ diff --git a/public/static/sound/en/1_point.mp3 b/public/static/sound/en/1_point.mp3 index 7a4fb1f0..a85bdc5a 100644 Binary files a/public/static/sound/en/1_point.mp3 and b/public/static/sound/en/1_point.mp3 differ diff --git a/public/static/sound/en/2_point.mp3 b/public/static/sound/en/2_point.mp3 index 7e989b51..281383b8 100644 Binary files a/public/static/sound/en/2_point.mp3 and b/public/static/sound/en/2_point.mp3 differ diff --git a/public/static/sound/en/3_point.mp3 b/public/static/sound/en/3_point.mp3 index 51185e50..d7dc1b89 100644 Binary files a/public/static/sound/en/3_point.mp3 and b/public/static/sound/en/3_point.mp3 differ diff --git a/public/static/sound/en/4_point.mp3 b/public/static/sound/en/4_point.mp3 index 968b5f53..59d1428a 100644 Binary files a/public/static/sound/en/4_point.mp3 and b/public/static/sound/en/4_point.mp3 differ diff --git a/public/static/sound/en/5_point.mp3 b/public/static/sound/en/5_point.mp3 index 4bd3b340..f545f143 100644 Binary files a/public/static/sound/en/5_point.mp3 and b/public/static/sound/en/5_point.mp3 differ diff --git a/public/static/sound/en/6_point.mp3 b/public/static/sound/en/6_point.mp3 index 7073fe36..d5fb2030 100644 Binary files a/public/static/sound/en/6_point.mp3 and b/public/static/sound/en/6_point.mp3 differ diff --git a/public/static/sound/en/7_point.mp3 b/public/static/sound/en/7_point.mp3 index 780be95a..d3940acd 100644 Binary files a/public/static/sound/en/7_point.mp3 and b/public/static/sound/en/7_point.mp3 differ diff --git a/public/static/sound/en/8_point.mp3 b/public/static/sound/en/8_point.mp3 index 8ef74e74..cec14dfa 100644 Binary files a/public/static/sound/en/8_point.mp3 and b/public/static/sound/en/8_point.mp3 differ diff --git a/public/static/sound/en/9_point.mp3 b/public/static/sound/en/9_point.mp3 index afca2f0b..4bf0a35d 100644 Binary files a/public/static/sound/en/9_point.mp3 and b/public/static/sound/en/9_point.mp3 differ diff --git a/public/static/sound/en/baccarat/b_draw.mp3 b/public/static/sound/en/baccarat/b_draw.mp3 index b0e9b471..b58935f0 100644 Binary files a/public/static/sound/en/baccarat/b_draw.mp3 and b/public/static/sound/en/baccarat/b_draw.mp3 differ diff --git a/public/static/sound/en/baccarat/b_pair.mp3 b/public/static/sound/en/baccarat/b_pair.mp3 index 3789d033..202f0092 100644 Binary files a/public/static/sound/en/baccarat/b_pair.mp3 and b/public/static/sound/en/baccarat/b_pair.mp3 differ diff --git a/public/static/sound/en/baccarat/b_win.mp3 b/public/static/sound/en/baccarat/b_win.mp3 index f74f53d7..5d13d38a 100644 Binary files a/public/static/sound/en/baccarat/b_win.mp3 and b/public/static/sound/en/baccarat/b_win.mp3 differ diff --git a/public/static/sound/en/baccarat/banker.mp3 b/public/static/sound/en/baccarat/banker.mp3 index 13298d63..66b2ce26 100644 Binary files a/public/static/sound/en/baccarat/banker.mp3 and b/public/static/sound/en/baccarat/banker.mp3 differ diff --git a/public/static/sound/en/baccarat/p_draw.mp3 b/public/static/sound/en/baccarat/p_draw.mp3 index 559f8eb0..56fbb7ea 100644 Binary files a/public/static/sound/en/baccarat/p_draw.mp3 and b/public/static/sound/en/baccarat/p_draw.mp3 differ diff --git a/public/static/sound/en/baccarat/p_pair.mp3 b/public/static/sound/en/baccarat/p_pair.mp3 index ae365fc2..7df97780 100644 Binary files a/public/static/sound/en/baccarat/p_pair.mp3 and b/public/static/sound/en/baccarat/p_pair.mp3 differ diff --git a/public/static/sound/en/baccarat/p_win.mp3 b/public/static/sound/en/baccarat/p_win.mp3 index 1d3ebbf6..95ae5e82 100644 Binary files a/public/static/sound/en/baccarat/p_win.mp3 and b/public/static/sound/en/baccarat/p_win.mp3 differ diff --git a/public/static/sound/en/baccarat/player.mp3 b/public/static/sound/en/baccarat/player.mp3 index 3f3d96f6..a0759bd2 100644 Binary files a/public/static/sound/en/baccarat/player.mp3 and b/public/static/sound/en/baccarat/player.mp3 differ diff --git a/public/static/sound/en/baccarat/tie.mp3 b/public/static/sound/en/baccarat/tie.mp3 index 0869e3e5..8f2a5e83 100644 Binary files a/public/static/sound/en/baccarat/tie.mp3 and b/public/static/sound/en/baccarat/tie.mp3 differ diff --git a/public/static/sound/en/baccarat/w_p1.mp3 b/public/static/sound/en/baccarat/w_p1.mp3 index d5921120..fa1cfd4f 100644 Binary files a/public/static/sound/en/baccarat/w_p1.mp3 and b/public/static/sound/en/baccarat/w_p1.mp3 differ diff --git a/public/static/sound/en/baccarat/w_p2.mp3 b/public/static/sound/en/baccarat/w_p2.mp3 index cfa1ac41..fa1cfd4f 100644 Binary files a/public/static/sound/en/baccarat/w_p2.mp3 and b/public/static/sound/en/baccarat/w_p2.mp3 differ diff --git a/public/static/sound/en/baccarat/w_p3.mp3 b/public/static/sound/en/baccarat/w_p3.mp3 index 306b3a03..fa1cfd4f 100644 Binary files a/public/static/sound/en/baccarat/w_p3.mp3 and b/public/static/sound/en/baccarat/w_p3.mp3 differ diff --git a/public/static/sound/en/baccarat/w_p5.mp3 b/public/static/sound/en/baccarat/w_p5.mp3 index 9f3323b2..fa1cfd4f 100644 Binary files a/public/static/sound/en/baccarat/w_p5.mp3 and b/public/static/sound/en/baccarat/w_p5.mp3 differ diff --git a/public/static/sound/en/baccarat/w_p6.mp3 b/public/static/sound/en/baccarat/w_p6.mp3 index c137cd8d..fa1cfd4f 100644 Binary files a/public/static/sound/en/baccarat/w_p6.mp3 and b/public/static/sound/en/baccarat/w_p6.mp3 differ diff --git a/public/static/sound/en/baccarat/w_p7.mp3 b/public/static/sound/en/baccarat/w_p7.mp3 index cbaeff74..fa1cfd4f 100644 Binary files a/public/static/sound/en/baccarat/w_p7.mp3 and b/public/static/sound/en/baccarat/w_p7.mp3 differ diff --git a/public/static/sound/en/check.mp3 b/public/static/sound/en/check.mp3 index 66bb4190..9fe854d1 100644 Binary files a/public/static/sound/en/check.mp3 and b/public/static/sound/en/check.mp3 differ diff --git a/public/static/sound/en/dice/w_p1.mp3 b/public/static/sound/en/dice/w_p1.mp3 index 0e18e7c1..5ed94b9f 100644 Binary files a/public/static/sound/en/dice/w_p1.mp3 and b/public/static/sound/en/dice/w_p1.mp3 differ diff --git a/public/static/sound/en/dice/w_p2.mp3 b/public/static/sound/en/dice/w_p2.mp3 index ceea406c..5ed94b9f 100644 Binary files a/public/static/sound/en/dice/w_p2.mp3 and b/public/static/sound/en/dice/w_p2.mp3 differ diff --git a/public/static/sound/en/dice/w_p3.mp3 b/public/static/sound/en/dice/w_p3.mp3 index 6ab785ad..5ed94b9f 100644 Binary files a/public/static/sound/en/dice/w_p3.mp3 and b/public/static/sound/en/dice/w_p3.mp3 differ diff --git a/public/static/sound/en/dice/w_p5.mp3 b/public/static/sound/en/dice/w_p5.mp3 index 4c0a3850..5ed94b9f 100644 Binary files a/public/static/sound/en/dice/w_p5.mp3 and b/public/static/sound/en/dice/w_p5.mp3 differ diff --git a/public/static/sound/en/dice/w_p6.mp3 b/public/static/sound/en/dice/w_p6.mp3 index d89cdce5..5ed94b9f 100644 Binary files a/public/static/sound/en/dice/w_p6.mp3 and b/public/static/sound/en/dice/w_p6.mp3 differ diff --git a/public/static/sound/en/dice/w_p7.mp3 b/public/static/sound/en/dice/w_p7.mp3 index b11229f2..5ed94b9f 100644 Binary files a/public/static/sound/en/dice/w_p7.mp3 and b/public/static/sound/en/dice/w_p7.mp3 differ diff --git a/public/static/sound/en/last_10_seconds.mp3 b/public/static/sound/en/last_10_seconds.mp3 index 9c489467..51d991e0 100644 Binary files a/public/static/sound/en/last_10_seconds.mp3 and b/public/static/sound/en/last_10_seconds.mp3 differ diff --git a/public/static/sound/en/lh/dragon.mp3 b/public/static/sound/en/lh/dragon.mp3 index 5f054386..1c80b6ea 100644 Binary files a/public/static/sound/en/lh/dragon.mp3 and b/public/static/sound/en/lh/dragon.mp3 differ diff --git a/public/static/sound/en/lh/dragon_win.mp3 b/public/static/sound/en/lh/dragon_win.mp3 index b0bacd6a..1f8e021d 100644 Binary files a/public/static/sound/en/lh/dragon_win.mp3 and b/public/static/sound/en/lh/dragon_win.mp3 differ diff --git a/public/static/sound/en/lh/tie.mp3 b/public/static/sound/en/lh/tie.mp3 index 0869e3e5..4cbb8129 100644 Binary files a/public/static/sound/en/lh/tie.mp3 and b/public/static/sound/en/lh/tie.mp3 differ diff --git a/public/static/sound/en/lh/tiger.mp3 b/public/static/sound/en/lh/tiger.mp3 index 9a6e8ff4..50d0c033 100644 Binary files a/public/static/sound/en/lh/tiger.mp3 and b/public/static/sound/en/lh/tiger.mp3 differ diff --git a/public/static/sound/en/lh/tiger_win.mp3 b/public/static/sound/en/lh/tiger_win.mp3 index 4af2cda3..c222cda1 100644 Binary files a/public/static/sound/en/lh/tiger_win.mp3 and b/public/static/sound/en/lh/tiger_win.mp3 differ diff --git a/public/static/sound/en/lh/w_p1.mp3 b/public/static/sound/en/lh/w_p1.mp3 index 9b26ed56..fa1cfd4f 100644 Binary files a/public/static/sound/en/lh/w_p1.mp3 and b/public/static/sound/en/lh/w_p1.mp3 differ diff --git a/public/static/sound/en/lh/w_p2.mp3 b/public/static/sound/en/lh/w_p2.mp3 index 1350f3eb..fa1cfd4f 100644 Binary files a/public/static/sound/en/lh/w_p2.mp3 and b/public/static/sound/en/lh/w_p2.mp3 differ diff --git a/public/static/sound/en/lh/w_p3.mp3 b/public/static/sound/en/lh/w_p3.mp3 index 6b9cfa90..fa1cfd4f 100644 Binary files a/public/static/sound/en/lh/w_p3.mp3 and b/public/static/sound/en/lh/w_p3.mp3 differ diff --git a/public/static/sound/en/lh/w_p5.mp3 b/public/static/sound/en/lh/w_p5.mp3 index 1f342fba..fa1cfd4f 100644 Binary files a/public/static/sound/en/lh/w_p5.mp3 and b/public/static/sound/en/lh/w_p5.mp3 differ diff --git a/public/static/sound/en/lh/w_p6.mp3 b/public/static/sound/en/lh/w_p6.mp3 index add53c1f..fa1cfd4f 100644 Binary files a/public/static/sound/en/lh/w_p6.mp3 and b/public/static/sound/en/lh/w_p6.mp3 differ diff --git a/public/static/sound/en/lh/w_p7.mp3 b/public/static/sound/en/lh/w_p7.mp3 index 8d7461d8..fa1cfd4f 100644 Binary files a/public/static/sound/en/lh/w_p7.mp3 and b/public/static/sound/en/lh/w_p7.mp3 differ diff --git a/public/static/sound/en/nn/banker.mp3 b/public/static/sound/en/nn/banker.mp3 index 13298d63..326f65f8 100644 Binary files a/public/static/sound/en/nn/banker.mp3 and b/public/static/sound/en/nn/banker.mp3 differ diff --git a/public/static/sound/en/nn/bull_1.mp3 b/public/static/sound/en/nn/bull_1.mp3 index 26d1aade..fcdca1c9 100644 Binary files a/public/static/sound/en/nn/bull_1.mp3 and b/public/static/sound/en/nn/bull_1.mp3 differ diff --git a/public/static/sound/en/nn/bull_2.mp3 b/public/static/sound/en/nn/bull_2.mp3 index c8c2b656..bb2b6beb 100644 Binary files a/public/static/sound/en/nn/bull_2.mp3 and b/public/static/sound/en/nn/bull_2.mp3 differ diff --git a/public/static/sound/en/nn/bull_3.mp3 b/public/static/sound/en/nn/bull_3.mp3 index 31840404..3c699cef 100644 Binary files a/public/static/sound/en/nn/bull_3.mp3 and b/public/static/sound/en/nn/bull_3.mp3 differ diff --git a/public/static/sound/en/nn/bull_4.mp3 b/public/static/sound/en/nn/bull_4.mp3 index 600958f0..956d76ef 100644 Binary files a/public/static/sound/en/nn/bull_4.mp3 and b/public/static/sound/en/nn/bull_4.mp3 differ diff --git a/public/static/sound/en/nn/bull_5.mp3 b/public/static/sound/en/nn/bull_5.mp3 index 43ebf917..87c43236 100644 Binary files a/public/static/sound/en/nn/bull_5.mp3 and b/public/static/sound/en/nn/bull_5.mp3 differ diff --git a/public/static/sound/en/nn/bull_6.mp3 b/public/static/sound/en/nn/bull_6.mp3 index 035d876c..ce13ec76 100644 Binary files a/public/static/sound/en/nn/bull_6.mp3 and b/public/static/sound/en/nn/bull_6.mp3 differ diff --git a/public/static/sound/en/nn/bull_7.mp3 b/public/static/sound/en/nn/bull_7.mp3 index 97b644be..fb844394 100644 Binary files a/public/static/sound/en/nn/bull_7.mp3 and b/public/static/sound/en/nn/bull_7.mp3 differ diff --git a/public/static/sound/en/nn/bull_8.mp3 b/public/static/sound/en/nn/bull_8.mp3 index 53a7f21c..b02c4c4a 100644 Binary files a/public/static/sound/en/nn/bull_8.mp3 and b/public/static/sound/en/nn/bull_8.mp3 differ diff --git a/public/static/sound/en/nn/bull_9.mp3 b/public/static/sound/en/nn/bull_9.mp3 index 89b064e1..664482c3 100644 Binary files a/public/static/sound/en/nn/bull_9.mp3 and b/public/static/sound/en/nn/bull_9.mp3 differ diff --git a/public/static/sound/en/nn/bull_bull.mp3 b/public/static/sound/en/nn/bull_bull.mp3 index 19a5754f..dc0d2f66 100644 Binary files a/public/static/sound/en/nn/bull_bull.mp3 and b/public/static/sound/en/nn/bull_bull.mp3 differ diff --git a/public/static/sound/en/nn/five_pictur_bull.mp3 b/public/static/sound/en/nn/five_pictur_bull.mp3 index 3adcb4be..f3f8452f 100644 Binary files a/public/static/sound/en/nn/five_pictur_bull.mp3 and b/public/static/sound/en/nn/five_pictur_bull.mp3 differ diff --git a/public/static/sound/en/nn/no_bull.mp3 b/public/static/sound/en/nn/no_bull.mp3 index 776cd818..b29cce9c 100644 Binary files a/public/static/sound/en/nn/no_bull.mp3 and b/public/static/sound/en/nn/no_bull.mp3 differ diff --git a/public/static/sound/en/nn/player_1.mp3 b/public/static/sound/en/nn/player_1.mp3 index 306da92f..2cf74822 100644 Binary files a/public/static/sound/en/nn/player_1.mp3 and b/public/static/sound/en/nn/player_1.mp3 differ diff --git a/public/static/sound/en/nn/player_2.mp3 b/public/static/sound/en/nn/player_2.mp3 index cc1e5927..3c5e6c13 100644 Binary files a/public/static/sound/en/nn/player_2.mp3 and b/public/static/sound/en/nn/player_2.mp3 differ diff --git a/public/static/sound/en/nn/player_3.mp3 b/public/static/sound/en/nn/player_3.mp3 index 86509547..d96ab11b 100644 Binary files a/public/static/sound/en/nn/player_3.mp3 and b/public/static/sound/en/nn/player_3.mp3 differ diff --git a/public/static/sound/en/nn/w_p1.mp3 b/public/static/sound/en/nn/w_p1.mp3 index ae445d98..fa1cfd4f 100644 Binary files a/public/static/sound/en/nn/w_p1.mp3 and b/public/static/sound/en/nn/w_p1.mp3 differ diff --git a/public/static/sound/en/nn/w_p2.mp3 b/public/static/sound/en/nn/w_p2.mp3 index 76428ed9..fa1cfd4f 100644 Binary files a/public/static/sound/en/nn/w_p2.mp3 and b/public/static/sound/en/nn/w_p2.mp3 differ diff --git a/public/static/sound/en/nn/w_p3.mp3 b/public/static/sound/en/nn/w_p3.mp3 index 1b309b7d..fa1cfd4f 100644 Binary files a/public/static/sound/en/nn/w_p3.mp3 and b/public/static/sound/en/nn/w_p3.mp3 differ diff --git a/public/static/sound/en/nn/w_p5.mp3 b/public/static/sound/en/nn/w_p5.mp3 index a62afb79..fa1cfd4f 100644 Binary files a/public/static/sound/en/nn/w_p5.mp3 and b/public/static/sound/en/nn/w_p5.mp3 differ diff --git a/public/static/sound/en/nn/w_p6.mp3 b/public/static/sound/en/nn/w_p6.mp3 index d126b025..fa1cfd4f 100644 Binary files a/public/static/sound/en/nn/w_p6.mp3 and b/public/static/sound/en/nn/w_p6.mp3 differ diff --git a/public/static/sound/en/nn/w_p7.mp3 b/public/static/sound/en/nn/w_p7.mp3 index c8e388e2..fa1cfd4f 100644 Binary files a/public/static/sound/en/nn/w_p7.mp3 and b/public/static/sound/en/nn/w_p7.mp3 differ diff --git a/public/static/sound/en/push.mp3 b/public/static/sound/en/push.mp3 index c67bd1bc..fa1cfd4f 100644 Binary files a/public/static/sound/en/push.mp3 and b/public/static/sound/en/push.mp3 differ diff --git a/public/static/sound/en/show_card.mp3 b/public/static/sound/en/show_card.mp3 index 54aacade..bbb268c8 100644 Binary files a/public/static/sound/en/show_card.mp3 and b/public/static/sound/en/show_card.mp3 differ diff --git a/public/static/sound/en/start_betting.mp3 b/public/static/sound/en/start_betting.mp3 index cbfbc76f..75187aac 100644 Binary files a/public/static/sound/en/start_betting.mp3 and b/public/static/sound/en/start_betting.mp3 differ diff --git a/public/static/sound/en/stop_betting.mp3 b/public/static/sound/en/stop_betting.mp3 index c33f5ec0..20b8394b 100644 Binary files a/public/static/sound/en/stop_betting.mp3 and b/public/static/sound/en/stop_betting.mp3 differ diff --git a/public/static/sound/en/toning/w_p1.mp3 b/public/static/sound/en/toning/w_p1.mp3 index 29a7419a..5ed94b9f 100644 Binary files a/public/static/sound/en/toning/w_p1.mp3 and b/public/static/sound/en/toning/w_p1.mp3 differ diff --git a/public/static/sound/en/toning/w_p2.mp3 b/public/static/sound/en/toning/w_p2.mp3 index a51ccfa7..5ed94b9f 100644 Binary files a/public/static/sound/en/toning/w_p2.mp3 and b/public/static/sound/en/toning/w_p2.mp3 differ diff --git a/public/static/sound/en/toning/w_p3.mp3 b/public/static/sound/en/toning/w_p3.mp3 index 1fe9e2f3..5ed94b9f 100644 Binary files a/public/static/sound/en/toning/w_p3.mp3 and b/public/static/sound/en/toning/w_p3.mp3 differ diff --git a/public/static/sound/en/toning/w_p5.mp3 b/public/static/sound/en/toning/w_p5.mp3 index 59d8280f..5ed94b9f 100644 Binary files a/public/static/sound/en/toning/w_p5.mp3 and b/public/static/sound/en/toning/w_p5.mp3 differ diff --git a/public/static/sound/en/toning/w_p6.mp3 b/public/static/sound/en/toning/w_p6.mp3 index ea3b86a5..5ed94b9f 100644 Binary files a/public/static/sound/en/toning/w_p6.mp3 and b/public/static/sound/en/toning/w_p6.mp3 differ diff --git a/public/static/sound/en/toning/w_p7.mp3 b/public/static/sound/en/toning/w_p7.mp3 index e4f78acf..5ed94b9f 100644 Binary files a/public/static/sound/en/toning/w_p7.mp3 and b/public/static/sound/en/toning/w_p7.mp3 differ diff --git a/src/assets/js/sound.js b/src/assets/js/sound.js index c10947eb..a4af1d38 100644 --- a/src/assets/js/sound.js +++ b/src/assets/js/sound.js @@ -1,100 +1,345 @@ /* eslint-disable */ import $store from "@/store" -const volume = $store.state.config.volume -let Mp3List = [], - num = 0 -function getBlob(key) { +// --------------------------------------------------------------------------- +// Priority levels: higher number = higher priority = cannot be interrupted +// --------------------------------------------------------------------------- +const PRIORITY = { + UI: 1, // chip clicks, push, check + COUNTDOWN: 2, // time, last_10_seconds + RESULT: 3 // game result announcement chains +} + +// Keywords that determine priority tier for a given sound key list +const RESULT_KEYS = [ + "baccarat_b_win", "baccarat_p_win", "baccarat_tie", + "baccarat_b_pair", "baccarat_p_pair", "baccarat_banker", "baccarat_player", + "lh_dragon_win", "lh_tiger_win", "lh_tie", "lh_dragon", "lh_tiger", + "nn_banker", "nn_player_1", "nn_player_2", "nn_player_3", + "toning_4_white", "toning_4_red", "toning_3_w_1_r", "toning_2_w_2_r", + "toning_1_w_3_r", "toning_even", "toning_odd", "toning_big", "toning_small", + "dice_any_triple", + "start_betting", "stop_betting", + "tc_banker_stop", "tc_start_banker", "tc_banker_success" +] +const COUNTDOWN_KEYS = ["time", "last_10_seconds"] + +function inferPriority(keyList) { + if (!keyList || !keyList.length) return PRIORITY.UI + for (const key of keyList) { + if (RESULT_KEYS.some(rk => key.includes(rk))) return PRIORITY.RESULT + // _point keys are part of result chains (e.g. "3_point") + if (/_point$/.test(key)) return PRIORITY.RESULT + // w_p keys are welcome phrases (result-tier) + if (/_w_p\d/.test(key)) return PRIORITY.RESULT + // nn/tc bull results + if (/_(bull_|no_bull|five_pictur|any_triple|straight_flush|royal_flush)/.test(key)) return PRIORITY.RESULT + if (/dice_num_/.test(key)) return PRIORITY.RESULT + } + for (const key of keyList) { + if (COUNTDOWN_KEYS.includes(key)) return PRIORITY.COUNTDOWN + } + return PRIORITY.UI +} + +// --------------------------------------------------------------------------- +// AudioBuffer cache: decode blob -> AudioBuffer once, reuse forever +// --------------------------------------------------------------------------- +const bufferCache = new Map() // key -> AudioBuffer +let audioCtx = null + +function getAudioContext() { + if (!audioCtx) { + const AudioContext = window.AudioContext || window.webkitAudioContext + if (AudioContext) { + audioCtx = new AudioContext() + } + } + return audioCtx +} + +// Resume AudioContext after user gesture (mobile autoplay restriction) +function ensureResumed() { + const ctx = getAudioContext() + if (ctx && ctx.state === "suspended") { + ctx.resume().catch(() => {}) + } +} + +// One-time listener to unlock AudioContext on first user interaction +let unlockBound = false +function bindUnlock() { + if (unlockBound) return + unlockBound = true + const unlock = () => { + ensureResumed() + document.removeEventListener("touchstart", unlock, true) + document.removeEventListener("touchend", unlock, true) + document.removeEventListener("click", unlock, true) + } + document.addEventListener("touchstart", unlock, true) + document.addEventListener("touchend", unlock, true) + document.addEventListener("click", unlock, true) +} +bindUnlock() + +/** + * Decode a Blob into an AudioBuffer and cache it. + * Returns null if the key doesn't exist or decoding fails. + */ +async function getBuffer(key) { + if (bufferCache.has(key)) return bufferCache.get(key) + + const ctx = getAudioContext() + if (!ctx) return null + const soundList = $store.state.config.soundList const language = - $store.state.config.$Type == "cn" || $store.state.config.$Type == "tw" + $store.state.config.$Type === "cn" || $store.state.config.$Type === "tw" ? "cn" : "en" - let blob = "" + const fullKey = `${language}_${key}` + const blob = soundList[fullKey] + if (!blob) return null + try { - blob = soundList[`${language}_${key}`] - blob = window.webkitURL.createObjectURL(blob) || URL.createObjectURL(blob) - } catch (err) { - console.warn(err, key) - } - return blob -} - -let audio = null -const audioElement = document.getElementById("Audio") -const sourceElement = document.getElementById("audioSourceAside") -audio = audioElement -audio.addEventListener("ended", () => { - nextAudio(audio, sourceElement) -}) - -function audioMp3(mp3List) { - const effectsVolume = $store.state.config.effectsVolume - // const audioElement = document.createElement("audio") - // const sourceElement = document.createElement("source") - // audio.appendChild(sourceElement) - // audio.volume = volume.effects / 100 - audio.muted = !effectsVolume - - Mp3List = mp3List - var mp3 = new Object() - mp3.mp3List = mp3List - mp3.auto_play = false - mp3.loop = false - mp3.Play = function () { - num = 0 - if (this.mp3List[0]) { - sourceElement.src = getBlob(this.mp3List[0]) - sourceElement.type = "audio/mpeg" - audio.pause() - audio.load() - setTimeout(() => { - audio.play().catch((err) => { - console.log(err) - }, 200) + // Blob.arrayBuffer() may not exist on older mobile browsers; fallback to FileReader + let arrayBuffer + if (typeof blob.arrayBuffer === "function") { + arrayBuffer = await blob.arrayBuffer() + } else { + arrayBuffer = await new Promise((resolve, reject) => { + const reader = new FileReader() + reader.onload = () => resolve(reader.result) + reader.onerror = reject + reader.readAsArrayBuffer(blob) }) } - } - mp3.Pause = function () { - audio.pause() - } - mp3.Muted = function () { - audio.muted ? (audio.muted = false) : (audio.muted = true) - } - mp3.volumeAdd = function () { - if (audio.volume.toFixed(1) >= 1) { - audio.volume = 1 - } else { - audio.volume = audio.volume + 0.1 - } - } - mp3.volumeMinus = function () { - if (audio.volume.toFixed(1) <= 0) { - audio.volume = 0 - } else { - audio.volume = audio.volume - 0.1 - } - } - return mp3 -} -function nextAudio(audio, sourceElement) { - num += 1 - // console.log(Mp3List, num) - if (Mp3List && num < Mp3List.length) { - sourceElement.src = getBlob(Mp3List[num]) - sourceElement.type = "audio/mpeg" - audio.load() - setTimeout(() => { - audio.play().catch((err) => { - console.log(err) - }, 500) + // decodeAudioData: some older browsers only support callback form + const audioBuffer = await new Promise((resolve, reject) => { + ctx.decodeAudioData(arrayBuffer, resolve, reject) }) - } else { - audio.pause() - audio.currentTime = 0.0 - num = 0 - audio.removeEventListener("ended", () => {}) + bufferCache.set(key, audioBuffer) + return audioBuffer + } catch (err) { + console.warn("[sound] decode failed:", key, err) + return null } } +// --------------------------------------------------------------------------- +// Fallback: HTMLAudio pool for browsers where Web Audio API is unavailable +// --------------------------------------------------------------------------- +const HTML_POOL_SIZE = 4 +const htmlPool = [] + +function getHtmlAudio() { + // Try to reuse an idle element + for (const el of htmlPool) { + if (el.paused || el.ended) return el + } + // Create new if pool not full + if (htmlPool.length < HTML_POOL_SIZE) { + const el = new Audio() + el.preload = "auto" + htmlPool.push(el) + return el + } + // All busy: steal the oldest + return htmlPool[0] +} + +/** + * Play a single sound key using HTMLAudioElement (fallback path). + * Creates and revokes blob URL to prevent memory leaks. + */ +function playHtmlFallback(key) { + return new Promise((resolve) => { + const soundList = $store.state.config.soundList + const language = + $store.state.config.$Type === "cn" || $store.state.config.$Type === "tw" + ? "cn" + : "en" + const fullKey = `${language}_${key}` + const blob = soundList[fullKey] + if (!blob) { + resolve() + return + } + + const blobUrl = URL.createObjectURL(blob) + const el = getHtmlAudio() + const effectsVolume = $store.state.config.effectsVolume + el.muted = !effectsVolume + + const cleanup = () => { + URL.revokeObjectURL(blobUrl) + el.removeEventListener("ended", onEnd) + el.removeEventListener("error", onErr) + } + const onEnd = () => { cleanup(); resolve() } + const onErr = () => { cleanup(); resolve() } + + el.addEventListener("ended", onEnd, { once: true }) + el.addEventListener("error", onErr, { once: true }) + el.src = blobUrl + el.load() + el.play().catch(() => { cleanup(); resolve() }) + }) +} + +// --------------------------------------------------------------------------- +// Active chain tracking for priority-based interruption +// --------------------------------------------------------------------------- +let activeChainId = 0 +let activeChainPriority = 0 + +// --------------------------------------------------------------------------- +// Public API: audioMp3(mp3List) => { Play(), Pause() } +// --------------------------------------------------------------------------- +function audioMp3(mp3List) { + // Handle no-args call: audioMp3().Pause() for global stop + if (!mp3List || !mp3List.length) { + return { + Play() {}, + Pause() { stopAll() } + } + } + + const myList = [...mp3List] // snapshot, no shared mutable state + const myPriority = inferPriority(myList) + let cancelled = false + let myId = 0 + let currentSource = null // Web Audio source node, if playing + + const chain = { + Play() { + ensureResumed() + + // Priority check: if something equal or higher priority is playing, and + // we are UI-tier, skip (don't interrupt results with clicks). + // If we are higher or equal priority, we take over. + if (activeChainPriority > myPriority) { + // Higher priority chain already playing -- don't interrupt + return + } + + // Generate unique chain ID; any older chain with lower/equal priority + // is implicitly superseded + myId = ++activeChainId + activeChainPriority = myPriority + cancelled = false + + playSequence(myList, 0) + }, + Pause() { + cancelled = true + if (currentSource) { + try { currentSource.stop() } catch (_) {} + currentSource = null + } + // If this chain is the active one, clear active state + if (myId === activeChainId) { + activeChainPriority = 0 + } + } + } + + /** + * Recursively play sounds in sequence via Web Audio API. + * Falls back to HTMLAudio if Web Audio is unavailable. + */ + async function playSequence(list, idx) { + if (cancelled) return + if (myId !== activeChainId) return // superseded by a newer chain + if (idx >= list.length) { + // Chain finished + if (myId === activeChainId) { + activeChainPriority = 0 + } + return + } + + const key = list[idx] + const ctx = getAudioContext() + + if (ctx) { + // --- Web Audio path --- + const buffer = await getBuffer(key) + if (cancelled || myId !== activeChainId) return + + if (!buffer) { + // Key missing: skip and continue chain + playSequence(list, idx + 1) + return + } + + const effectsVolume = $store.state.config.effectsVolume + const source = ctx.createBufferSource() + source.buffer = buffer + + // Gain node for mute control + const gain = ctx.createGain() + gain.gain.value = effectsVolume ? 1 : 0 + source.connect(gain) + gain.connect(ctx.destination) + + currentSource = source + + source.onended = () => { + currentSource = null + if (!cancelled && myId === activeChainId) { + playSequence(list, idx + 1) + } + } + + try { + source.start(0) + } catch (err) { + console.warn("[sound] play error:", key, err) + currentSource = null + // Skip this sound and continue + playSequence(list, idx + 1) + } + } else { + // --- HTMLAudio fallback path --- + await playHtmlFallback(key) + if (!cancelled && myId === activeChainId) { + playSequence(list, idx + 1) + } + } + } + + return chain +} + +/** + * Stop all playback globally. Used for cleanup on unmount. + */ +function stopAll() { + activeChainId++ + activeChainPriority = 0 + // Stop any Web Audio sources + const ctx = getAudioContext() + if (ctx && ctx.state === "running") { + // Suspending and resuming is the cleanest way to halt all sources + ctx.suspend().then(() => ctx.resume()).catch(() => {}) + } + // Stop HTML pool elements + for (const el of htmlPool) { + try { + el.pause() + el.currentTime = 0 + } catch (_) {} + } + // Also pause the legacy