void sb_start(int rate, int nchan)
{
+ int seg, pmsel;
uint32_t addr;
int size;
_go32_dpmi_seginfo intr;
- /* for now just use the are after boot2. it's only used by the second stage
- * loader and the VBE init code, none of which should overlap with audio playback.
- * It's not necessary to use low memory. We can use up to the first 16mb for this,
- * so if this becomes an issue, I'll make a DMA buffer allocator over 1mb.
- * start the buffer from the next 64k boundary.
- */
- addr = ((uint32_t)low_mem_buffer + 0xffff) & 0xffff0000;
- buffer = (void*)addr;
+ if(!buffer) {
+ /* allocate a 64k-aligned 64k buffer in low memory */
+ if((seg = __dpmi_allocate_dos_memory(65536 * 2 / 16, &pmsel)) <= 0) {
+ fprintf(stderr, "sb_start: failed to allocate DMA buffer\n");
+ return;
+ }
+
+ addr = ((uint32_t)(seg << 4) + 0xffff) & 0xffff0000;
+ buffer = (void*)addr;
+ } else {
+ addr = (uint32_t)buffer;
+ }
xfer_mode = CMD_MODE_SIGNED;
if(nchan > 1) {
--- /dev/null
+ .data
+ .global _snd_click
+ .global _snd_click_size
+_snd_click:
+ .incbin "click-s8_mono.pcm"
+_snd_click_size: .long . - _snd_click
static int au_callback(void *buffer, int size, void *cls);
-/* defined in sndsamples.s */
+/* defined in ausamples.s */
extern signed char snd_click[];
extern int snd_click_size;