Skip to content

Commit

Permalink
⚡️ limit platform dependencies, reduce binary size
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Nov 16, 2023
1 parent 89bb6f9 commit 687241f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/audio_default.c.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module main

import os

fn play_wav_file() {
$if linux {
os.system('aplay -q "${paths.sound}"')
} $else $if macos {
os.system('afplay -q "${paths.sound}"')
}
}
4 changes: 2 additions & 2 deletions src/audio.v → src/auido_windows.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import miniaudio as ma

fn play_wav_file() {
engine := &ma.Engine{}
result := ma.engine_init(ma.null, engine)
if result != .success {
if ma.engine_init(ma.null, engine) != .success {
panic('failed to initialize audio engine.')
}
defer {
Expand All @@ -18,3 +17,4 @@ fn play_wav_file() {
ma.engine_play_sound(engine, paths.sound.str, ma.null)
time.sleep(140 * time.millisecond)
}

0 comments on commit 687241f

Please sign in to comment.