Skip to content

Commit

Permalink
Add midi player
Browse files Browse the repository at this point in the history
Converts to wav form and sends to sound-daemon

doom lvl 1 midi file provided.
  • Loading branch information
rafalmiel committed Oct 2, 2024
1 parent 3dbca65 commit 33c093e
Show file tree
Hide file tree
Showing 12 changed files with 306 additions and 190 deletions.
52 changes: 42 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ endif
debug: $(disk)
#qemu-system-x86_64 -drive format=raw,file=$(iso) -serial stdio -no-reboot -s -S -smp cpus=4 -no-shutdown -netdev tap,helper=/usr/lib/qemu/qemu-bridge-helper,id=ck_net0 -device e1000,netdev=ck_net0,id=ck_nic0
#qemu-system-x86_64 -serial stdio -no-reboot -s -S -m 5811 -smp cpus=4 -no-shutdown -netdev user,id=mynet0,net=192.168.1.0/24,dhcpstart=192.168.1.128,hostfwd=tcp::4444-:80 -device e1000e,netdev=mynet0,id=ck_nic0 -drive format=raw,file=disk.img,if=none,id=test-img -device ich9-ahci,id=ahci -device ide-hd,drive=test-img,bus=ahci.0 -monitor /dev/stdout
qemu-system-x86_64 -serial stdio -no-reboot -s -S -m 5811 -smp cpus=4 -no-shutdown -netdev tap,helper=/usr/lib/qemu/qemu-bridge-helper,id=hn0 -device e1000,netdev=hn0,id=nic1 -drive format=raw,file=disk.img,if=none,id=test-img -device ich9-ahci,id=ahci -device ide-hd,drive=test-img,bus=ahci.0 -audio driver=pipewire,model=hda -monitor /dev/stdout -enable-kvm
qemu-system-x86_64 -serial stdio -no-reboot -s -S -m 5811 -smp cpus=4 -no-shutdown -netdev tap,helper=/usr/lib/qemu/qemu-bridge-helper,id=hn0 -device e1000,netdev=hn0,id=nic1 -drive format=raw,file=disk.img,if=none,id=test-img -device ich9-ahci,id=ahci -device ide-hd,drive=test-img,bus=ahci.0 -audio driver=pipewire,model=hda -monitor /dev/stdout

gdb:
@rust-gdb "$(kernel)" -ex "target remote :1234"
Expand Down
4 changes: 3 additions & 1 deletion disk-scripts/install_os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
sudo umount mnt

PROGS="test testcpp hello stack nyancat ttytest fork poweroff stat fbdoom doom1.wad open_sleep"
RUST_PROGS="init shell mount umount unixsocket-server unixsocket-client forktest mprotecttest playwav threads sound-daemon"
RUST_PROGS="init shell mount umount unixsocket-server unixsocket-client forktest mprotecttest playwav playmidi threads sound-daemon"

sudo mount /dev/loop0p2 mnt
sudo chown -R $USER:$USER mnt
Expand All @@ -47,6 +47,8 @@ for prog in $RUST_PROGS; do
done

cp sysroot/assets/imperial.wav mnt/
cp sysroot/assets/D_E1M1.mid mnt/
cp sysroot/assets/FluidR3_GM.sf2 mnt/

rsync -a sysroot/cykusz/usr mnt/
rsync -a sysroot/cykusz/etc mnt/
Expand Down
Binary file added sysroot/assets/D_E1M1.mid
Binary file not shown.
93 changes: 90 additions & 3 deletions userspace/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion userspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = ["init", "shell", "mount", "umount", "syscall-user", "unixsockets", "testprogs", "playwav", "sound-daemon"]
members = ["init", "shell", "mount", "umount", "syscall-user", "unixsockets", "testprogs", "playaudio", "sound-daemon"]
26 changes: 26 additions & 0 deletions userspace/playaudio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "playaudio"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "playwav"
test = false
bench = false
path = "src/playwav/bin/main.rs"

[[bin]]
name = "playmidi"
test = false
bench = false
path = "src/playmidi/bin/main.rs"

[dependencies]
rustysynth = "*"
wavers = "*"

[dependencies.syscall-defs]
path = "../../syscall-defs"

[dependencies.syscall-user]
path = "../syscall-user"
Loading

0 comments on commit 33c093e

Please sign in to comment.