案例
DirectMusic:微软音乐 API 的开源重新实现
以可移植的 C11 库重新实现 DirectMusic,即 Microsoft 随早期 DirectX 提供的自适应配乐 API;它载入游戏的段落(segment)、风格(style)和 DLS 音色文件,并将音乐渲染为 PCM。README 只列出 Gothic 与 Gothic II(含 Night of the Raven)的配乐经过测试,且只是“大致”正确;项目自称尚不完整、仍在大力开发中。乐器经 DLS 转 SoundFont 后由内置的 TinySoundFont 合成器发声。
- 目标
- 游戏
- 类别
- 独立重建案例
- 关联
- 独立重建项目
- 来源复核于
- 星标
- 63
- 最近提交
- 2026-03-02
- 主要语言
- C
GitHub 数据,截至 2026-11-09
使用条件与局限
- 该 C11 库提供自己的 DmLoader、DmSegment 和 DmPerformance API。“结尾加前奏”装饰及部分曲线和消息类型尚未实现。
- 使用者需通过解析回调提供自己游戏数据中的 .sgt 段落、.sty 风格和 .dls 音色集;仓库不附带这些文件。
- 构建需要 C11 编译器和 CMake 3.10+。支持 Linux、macOS 和 Windows。play-segment 示例需要 <unistd.h> 和 <sys/stat.h>。
- README 报告 Gothic 与 Gothic II 配乐运行“大致”正确。CI 为 Linux、Android、macOS 和 Windows 构建库;未列出测试套件或与 Microsoft 运行时输出的比较。
- LICENSE.md 对项目代码采用 MIT 许可证(现代变体)。TinySoundFont、miniaudio 和 Gothic II 主题曲渲染有各自权利;游戏音乐保留原有权利。
引用
BibTeX
@misc{dmusic-directmusic-reimplementation-case,
title = {{DirectMusic: an open reimplementation of Microsoft’s music API}},
howpublished = {\url{https://github.com/GothicKit/dmusic}},
url = {https://github.com/GothicKit/dmusic},
urldate = {2026-10-19},
note = {Awesome REA entry: \url{https://awesomerea.org/zh/resources/dmusic-directmusic-reimplementation-case/}}
}纯文本
DirectMusic: an open reimplementation of Microsoft’s music API。https://github.com/GothicKit/dmusic(访问于 2026-10-19)。Awesome REA 条目:https://awesomerea.org/zh/resources/dmusic-directmusic-reimplementation-case/
有帮助?在 GitHub 上为 Awesome REA 加星2.4k
关于此条目
说明已依据一手来源复核。
一手来源
- README.md GitHub · GothicKit/dmusic · 修订 b73b270
- include/dmusic.h GitHub · GothicKit/dmusic · 修订 b73b270
- CMakeLists.txt GitHub · GothicKit/dmusic · 修订 b73b270
- src/util/Tsf.c GitHub · GothicKit/dmusic · 修订 b73b270
- src/Performance.c GitHub · GothicKit/dmusic · 修订 b73b270
- src/_Internal.h GitHub · GothicKit/dmusic · 修订 b73b270
- examples/play-segment.c GitHub · GothicKit/dmusic · 修订 b73b270
- .github/workflows/build.yml GitHub · GothicKit/dmusic · 修订 b73b270
- LICENSE.md GitHub · GothicKit/dmusic · 修订 b73b270
- https://dm.gothickit.dev/