Skip to content

Commit

Permalink
Force precision to 16 in audio drivers (fixes #63)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Feb 17, 2025
1 parent 51cb2d4 commit f6158e0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/audio/alsa/audiodrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ bool Audio_ALSA::open(AudioConfig &cfg)
throw error("Unable to allocate memory for sample buffers.");
}

// Force precision
cfg.precision = 16;
// Setup internal Config
_settings = cfg;
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/audio/directx/audiodrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ bool Audio_DirectX::open (AudioConfig &cfg, HWND hwnd)
throw error("Unable to set play position to start of buffer.");
}

// Force precision
cfg.precision = 16;
// Update the users settings
m_frameSize = wfm.nBlockAlign;
_settings = cfg;
Expand Down
2 changes: 2 additions & 0 deletions src/audio/mmsystem/audiodrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ bool Audio_MMSystem::open(AudioConfig &cfg)
m_frameSize = wfm.nBlockAlign;
blockNum = 0;
_sampleBuffer = blocks[blockNum];
// Force precision
cfg.precision = 16;
return true;
}
catch(error const &e)
Expand Down
4 changes: 3 additions & 1 deletion src/audio/oss/audiodrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ bool Audio_OSS::open (AudioConfig &cfg)
throw error("Unable to allocate memory for sample buffers.");
}

// Setup internal Config
m_frameSize = 2 * cfg.channels;
// Force precision
cfg.precision = 16;
// Setup internal Config
_settings = cfg;
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/audio/out123/audiodrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ bool Audio_OUT123::open(AudioConfig &cfg)
throw error("Unable to allocate memory for sample buffers.");
}

// Force precision
cfg.precision = 16;
// Setup internal Config
_settings = cfg;
return true;
Expand Down
4 changes: 3 additions & 1 deletion src/audio/pulse/audiodrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ bool Audio_Pulse::open(AudioConfig &cfg)
}

m_frameSize = 2 * cfg.channels;
_settings = cfg;

// Force precision
cfg.precision = 16;
_settings = cfg;
return true;
}
catch(error const &e)
Expand Down

1 comment on commit f6158e0

@ruby-R53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so now it does work for the PulseAudio driver, but not for the out123 one

if i run it with out123 i don't get any sound and the display updates really fast as if i was recording to a file instead of actually playing the tune

couldn't figure out how to disable the Pulse driver so dunno how it behaves with ALSA

Please sign in to comment.