mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00:00
SB16: Send (sample count, less 1) to the DSP, not the number of bytes.
This worked fine when we were using 8-bit samples but broke on 16-bit.
This commit is contained in:
parent
781a28f3ed
commit
d63b6e624e
1 changed files with 8 additions and 3 deletions
|
@ -174,14 +174,19 @@ ssize_t SB16::write(FileDescription&, const u8* data, ssize_t length)
|
||||||
dma_start(length);
|
dma_start(length);
|
||||||
|
|
||||||
u8 command = 0x06;
|
u8 command = 0x06;
|
||||||
|
|
||||||
// Send 16-bit samples.
|
// Send 16-bit samples.
|
||||||
command |= 0xb0;
|
command |= 0xb0;
|
||||||
|
|
||||||
|
u16 sample_count = length / sizeof(i16);
|
||||||
|
if (mode & (u8)SampleFormat::Stereo)
|
||||||
|
sample_count /= 2;
|
||||||
|
|
||||||
|
sample_count -= 1;
|
||||||
|
|
||||||
dsp_write(command);
|
dsp_write(command);
|
||||||
dsp_write(mode);
|
dsp_write(mode);
|
||||||
dsp_write((u8)length);
|
dsp_write((u8)sample_count);
|
||||||
dsp_write((u8)(length >> 8));
|
dsp_write((u8)(sample_count >> 8));
|
||||||
|
|
||||||
enable_irq();
|
enable_irq();
|
||||||
wait_for_irq();
|
wait_for_irq();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue