Annotation of quake1/dmasim~1.c, revision 1.1.1.1

1.1       root        1: // =======================================================================
                      2: // Sound client does nothing but walk a circular sound buffer
                      3: // =======================================================================
                      4: 
                      5: //#include <fcntl.h>
                      6: #include <sys/types.h>
                      7: //#include <sys/ioctl.h>
                      8: #include <stdio.h>
                      9: #include <audio.h>
                     10: 
                     11: #include "quakedef.h"
                     12: 
                     13: extern int     samplewidth;
                     14: extern int     numfragments;
                     15: extern int     fragmentsize;
                     16: 
                     17: extern dma_t   *shm;
                     18: 
                     19: void I_Error(char *, ...);
                     20: void I_Warn(char *, ...);
                     21: int log2(int);
                     22: 
                     23: // =======================================================================
                     24: // System-specific data
                     25: // =======================================================================
                     26: 
                     27: static ALconfig        al_config;
                     28: static ALport          al_outport;
                     29: 
                     30: // =======================================================================
                     31: // Initializes DMA-like sound device
                     32: // =======================================================================
                     33: 
                     34: void I_InitDMASound(void)
                     35: {
                     36: 
                     37:        long paramset[2];
                     38: 
                     39:        // open & setup audio device
                     40: 
                     41:        ALseterrorhandler(0);   // turn off audio library error handler
                     42:        al_config = ALnewconfig();
                     43: 
                     44:        ALsetchannels(al_config, AL_STEREO);
                     45:        ALsetsampfmt(al_config, AL_SAMPFMT_TWOSCOMP);
                     46:        ALsetwidth(al_config, samplewidth);
                     47:        ALsetqueuesize(al_config, fragmentsize * 2);
                     48: 
                     49:        al_outport = ALopenport("iddigout2", "w", al_config);
                     50: 
                     51:        if (!al_outport)
                     52:                I_Error("Could not open audio port");
                     53: 
                     54:        paramset[0] = AL_OUTPUT_RATE;
                     55:        paramset[1] = shm->speed;
                     56:        ALsetparams(AL_DEFAULT_DEVICE, paramset, 2);
                     57: 
                     58: }
                     59: 
                     60: // =======================================================================
                     61: // Submits data to DMA-like sound device
                     62: // =======================================================================
                     63: 
                     64: void I_SubmitDMABuffer(void *buffer, int size)
                     65: {
                     66:        ALwritesamps(al_outport, buffer, size);
                     67: }
                     68: 
                     69: // =======================================================================
                     70: // Shuts down DMA-like sound device
                     71: // =======================================================================
                     72: 
                     73: void I_ShutdownDMASound(void)
                     74: {
                     75:        ALfreeconfig(al_config);
                     76:        ALcloseport(al_outport);
                     77: }
                     78: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.