From 4256803084e926de8d4a4e8560511e6b8c5e466f Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Mon, 1 Sep 2025 17:20:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E8=87=B30.2.2=E5=B9=B6=E6=94=B9=E8=BF=9B=E5=BC=80?= =?UTF-8?q?=E6=9C=BA=E9=9F=B3=E4=B9=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将installer.lua和bios.lua中的版本号从0.2.1更新至0.2.2 - 改进50_audio.lua中的开机音乐实现,使用更精确的乐器音高参数 --- data/computercraft/lua/bios.lua | 4 ++-- .../lua/rom/startup/50_audio.lua | 20 ++++++++++--------- installer.lua | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/data/computercraft/lua/bios.lua b/data/computercraft/lua/bios.lua index 41fb4fb..104adbd 100644 --- a/data/computercraft/lua/bios.lua +++ b/data/computercraft/lua/bios.lua @@ -1,4 +1,4 @@ -_G._HOST = _G._HOST .. " (LeonOS 0.2.1)" +_G._HOST = _G._HOST .. " (LeonOS 0.2.2)" local fs = rawget(_G, "fs") _G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom" @@ -32,7 +32,7 @@ local rc = { _VERSION = { major = 0, minor = 2, - patch = 1 + patch = 2 }, queueEvent = pull(os, "queueEvent"), startTimer = pull(os, "startTimer"), diff --git a/data/computercraft/lua/rom/startup/50_audio.lua b/data/computercraft/lua/rom/startup/50_audio.lua index 73fe1aa..66ca3f4 100644 --- a/data/computercraft/lua/rom/startup/50_audio.lua +++ b/data/computercraft/lua/rom/startup/50_audio.lua @@ -6,20 +6,22 @@ local speaker = peripheral.find("speaker") -- 检查是否连接了扬声器 if speaker then -- 简单的开机音乐(C大调音阶) + -- 格式: {instrument = 乐器, pitch = 音高(半音), duration = 持续时间} local notes = { - {note = "C4", duration = 0.25}, - {note = "D4", duration = 0.25}, - {note = "E4", duration = 0.25}, - {note = "F4", duration = 0.25}, - {note = "G4", duration = 0.25}, - {note = "A4", duration = 0.25}, - {note = "B4", duration = 0.25}, - {note = "C5", duration = 0.5} + {instrument = "harp", pitch = 6, duration = 0.25}, -- C4 + {instrument = "harp", pitch = 8, duration = 0.25}, -- D4 + {instrument = "harp", pitch = 10, duration = 0.25}, -- E4 + {instrument = "harp", pitch = 11, duration = 0.25}, -- F4 + {instrument = "harp", pitch = 13, duration = 0.25}, -- G4 + {instrument = "harp", pitch = 15, duration = 0.25}, -- A4 + {instrument = "harp", pitch = 17, duration = 0.25}, -- B4 + {instrument = "harp", pitch = 18, duration = 0.5} -- C5 } -- 播放音乐 for _, note_info in ipairs(notes) do - speaker.playNote(note_info.note) + -- 播放音符,使用默认音量1.0 + speaker.playNote(note_info.instrument, 1.0, note_info.pitch) rc.sleep(note_info.duration) end end \ No newline at end of file diff --git a/installer.lua b/installer.lua index f0c90a9..56b0651 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- LeonOS installer -local INSTALLER_VERSION = "0.2.1" +local INSTALLER_VERSION = "0.2.2" local DEFAULT_ROM_DIR = "/leonos" print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")