loops - Dr-Racket 中的背景声音 [lang #r5rs]
问题描述
我正在尝试在游戏中使用一些背景声音。如果我使用我目前拥有的循环,它不会返回或者它会分层声音。有没有办法测试 ui 中是否有声音播放,或者 Rsound 是声音的必备工具?
(define play-asynchronously #f)
(define sound-test #t)
(define (sound-test!)
(if sound-test
#f
#t))
(define (in-game-loop)
(if sound-test
(if (play-sound "flight_of_the_bumblebee.mp3" play-asynchronously)
;Geschreven in 1899-1900 door Nikolaj Rimski-Korsakov
;Gedownload op 16/05/2018 van https://ia802606.us.archive.org/19/items/FlightOfTheBumblebee/flight_of_the_bumblebee_2.mp3
(in-game-loop)
'done)
(begin
(in-menu-loop)
(set! sound-test #t))))
(define (in-menu-loop)
(if sound-test
(if (play-sound "Gymnopedie-No-1.mp3" play-asynchronously)
;Geschreven in 1888 door Erik Satie
;Gedownload op 16/05/018 van https://incompetech.com/music/royalty-free/?keywords=gymnopedie
(in-menu-loop)
'done)
(begin
(in-game-loop)
(set! sound-test #t))))
解决方案
推荐阅读
- unit-testing - 允许 jest 模拟从测试文件外部调用的函数的幕后发生了什么?
- unicode - Microsoft Keyboard Layout Creator:安装后显示的变音符号错误
- python - ModuleNotFoundError:在heroku上部署django项目期间没有名为“jinja2”的模块
- identityserver4 - 使用外部提供程序时如何为 IdentityServer4 设置显示名称
- r - 如何用dendextend标记层次聚类树中的一个观察?
- python - 无法从 ArcGIS REST API 获取形状数据
- angular - Angular 8 .htaccess 允许直接访问子文件夹
- java - Forge Mod Development 需要手动导入
- sql - 如何从包含行数据的列标题中提取月份中的某一天?
- angular - 刷新页面时无法收集 - AngularFire