Let's Code MS DOS 0x0B: SoundBlaster Autoinit DMA

preview_player
Показать описание
This is the third and last part of the Let's Code MS DOS topic on SoundBlaster PCM programming. We extend the single cycle playback to autoinit DMA playback. This lets you play arbitrarily long sound files.

Be sure to check out the other Let's Code MS DOS videos.

Рекомендации по теме
Комментарии
Автор

Thank you so much sir, this is the stuff I was missing with my ms-dos game programming 👍

shalomraz
Автор

I struggled to get an audio file in the correct format. What I learned is it must be mono, unsigned 8-bit PCM, around 11khz. I used Audacity (3.7.3) to load an MP3 (should work with any audio format).
- Go to File > Export Audio and click the [Export to computer] button
- Enter the filename and folder
- Select "Other uncompressed files" for the Format
- Select Mono for Channels
- Select 11025 Hz for the Sample Rate
- Select "RAW (header-less)" for Header
- Select "Unsigned 8-bit PCM" for Encoding
- Click the [Export] button

tigerleep
Автор

This is an excellent series 👍 Thank you and keep up the good work! Hoping to see more MS-DOS programming videos from you.

teslastellar
Автор

First of all: Thanks for the great video. I enjoyed this very much.

Just a minor correction, though: When setting the DMA mode register (DCM), you mention (and elaborate in your code comment) that the first two bits (01) are there to configure it for block mode transfer, when actually they set up single mode transfer (block mode would be 10 instead).

According to the OS dev wiki, this is the correct mode for transferring sample data to Sound Blasters, so the code is perfectly fine, it's just the comment that is slightly incorrect.

IngomarWesp
Автор

I am trying to switch from single cycle playback to autoinit, so far unsuccessfully because EMM386 crashes the PC instantly when I send 0x58 instead of 0x48 to DMA. Will keep trying, but noticed you are using 0x58 too which is not block transfer, but a single cycle transfer the same as in 0x48. At least every document on DMA I have found says that 01 is single cycle and 10 is block and also that SB needs 01. It is probably just a small mistake in the comment, but it is a bit misleading when someone desperate as me is down to trying everything ;D

WhiteFalconus
Автор

wow indeed very nice series ! is there any change you can show us how to mix two or more sounds programmatically using this mode ? i could mix 8 bit unsigned pcm sounds using sb 'direct mode' but i have no much ideia in dma modes ^^

LeoOno
Автор

Great video - as always! I’m still coding along on my 486SX-33 with TC 2.01, memory model is set to huge. I’ve compared my code (written along with you as you made this video) with your source on GitHub. For some reason, it doesn’t work as it should on my computer. When the interrupt handler switches from auto init playback to single cycle playback, the program crashes. So it played a RAW file but 2 blocks before the end, the computer crashes. Did you try running your code until the end of the RAW file was reached? I’m interested to see if you encountered the same problem

countersurprise
Автор

any plans on protected mode and extended memory and so on?

nihonam
Автор

Conceptually this is different to how I assumed DMA worked: I just assumed you told the card which area of memory you wanted it to access (as DMA) and it went away and played it, regardless of length. The reality you seem to suggest is that you need to keep spoon-feeding the device via the DMA controller periodically

stupossibleify
join shbcf.ru