Skip to content

Commit

Permalink
winmm: disable sound by default
Browse files Browse the repository at this point in the history
Until we flush out the bugs, better to leave this disabled by default
for now.
  • Loading branch information
evmar committed Oct 6, 2024
1 parent 3b66104 commit d08edb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions win32/src/winapi/winmm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::host;
#[derive(Copy, Clone, Debug)]
pub enum MMRESULT {
MMSYSERR_NOERROR = 0,
MMSYSERR_NOTENABLED = 3,
}
impl super::stack_args::ToX86 for MMRESULT {
fn to_raw(&self) -> u32 {
Expand Down
16 changes: 14 additions & 2 deletions win32/src/winapi/winmm/wave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ use crate::machine::Machine;
use bitflags::bitflags;
use memory::Extensions;

/// Set this to true to enable the sound code; disabled while it's still in progress.
const ENABLED: bool = false;

#[win32_derive::dllexport]
pub fn waveOutGetNumDevs(_machine: &mut Machine) -> u32 {
// TODO: set me to 1 to enable sound:
0
if ENABLED {
1
} else {
0
}
}

#[repr(C)]
Expand Down Expand Up @@ -88,6 +94,12 @@ pub fn waveOutOpen(
dwInstance: u32,
fdwOpen: Result<WaveOutOpenFlags, u32>,
) -> MMRESULT {
if !ENABLED {
// Note that pocoman doesn't call waveOutGetNumDevs, but just directly calls
// waveOutOpen and decides whether to do sound based on whether it succeeds.
return MMRESULT::MMSYSERR_NOTENABLED;
}

let flags = fdwOpen.unwrap();
if flags.contains(WaveOutOpenFlags::CALLBACK_FUNCTION) {
log::error!("todo");
Expand Down

0 comments on commit d08edb3

Please sign in to comment.