On 29 Jun 1997, somebody wrote: > You can also end auto-initialized mode by reprogrammering the DSP for > single-cycle mode. The card then switches from A/I mode to S/C mode after the > next interrupt. It will then continue to play or record for the length > specified, generate an interrupt and stop. I've never tried this method myself, but it it listed in the Creative Labs SDK, so I'm assuming it will work if done correctly. I usually just fill the rest of the last buffer with silence and let it run out. > First a question, what do you mean with "reprogrammering"? The > SoundBlaster seems to ignore the command "start single cycle" ($B0) mode, > if one have not given command "stop at end" ($D9) AND waited till stop. > (Sorry for my bad english). "The card then switches from A/I ... ", do > you mean the card itself, or my interrupt-routine? After the last A/I > interrupt (if i've give stop command earlier) i could use a normal single > cycle mode to play the rest of data, but as you know it makes a click to > reprogram the card "on the fly". Can the SB16 card itself switch from a/i > to single-cycle mode on the interrupt after i programmed it? How?.. I've never really thought about how to do it. Here's what the SDK says: There are two ways to terminate auto-initialize DMA mode transfer: 1. Program the DSP to switch to single-cycle DMA mode transfer. At the end of the current block transfer, the DSP will exit from the auto-initialize DMA mode and continue to transfer using the specified single-ylce DMA mode. 2. Send the exit auto-initialize command; the DSP will exit auto-initialize DMA mode and the end of the current block and terminate the transfer. What I get from this is that, since you know ahead of time when you will run out of data, you can program the sound card for single-cycle two blocks ahead of time. When you load the final block of data (this should be happening as the next-to-last block of data begins to play), you reprogram it for single-cycle. It finishes playing the next-to-last block with a/i, then switches to s/c to play the last block. The DMA controller remains in a/i mode, but that doesn't matter, since the sound card isn't asking for samples any more. > Or, is the best method to always stop at end of block and fill the rest > with silence? I don't mean if the user press escape and i use the PAUSE > command, but i mean if i'm at the ens of the soundfile etc.. I think this is the best way to do it. If you're using auto-initialized DMA, it's likely that you have a pretty small buffer, probably lasting only 1/10, 1/100 second, or less. The main use for the switch to s/c method, as I see it, is to reduce long delays of you try to play a sound of size n*64k+5 with a DMA buffer of 64k. Then, instead of waiting for 64k-5 samples of silence to play, you can get it to stop immediately. When there are only a few hundred or thousand samples of silence to play, it isn't a problem. Ethan Brodsky ---- Ethan Brodsky