Annotation of uae/src/od-amiga/sound.h, revision 1.1

1.1     ! root        1:  /* 
        !             2:   * UAE - The Un*x Amiga Emulator
        !             3:   * 
        !             4:   * Support for Amiga audio.device sound
        !             5:   * 
        !             6:   * Copyright 1996, 1997 Samuel Devulder
        !             7:   */
        !             8: 
        !             9: #include <proto/exec.h>
        !            10: #include <proto/dos.h>
        !            11: #ifndef __SASC
        !            12: #include <proto/alib.h>
        !            13: #endif
        !            14: 
        !            15: #include <exec/memory.h>
        !            16: #include <exec/devices.h>
        !            17: #include <exec/io.h>
        !            18: 
        !            19: #include <graphics/gfxbase.h>
        !            20: #include <devices/timer.h>
        !            21: #include <devices/audio.h>
        !            22: 
        !            23: extern char whichchannel[];
        !            24: extern struct IOAudio *AudioIO;
        !            25: extern struct MsgPort *AudioMP;
        !            26: extern struct Message *AudioMSG;
        !            27: 
        !            28: extern unsigned char *buffers[2];
        !            29: extern uae_u16 *sndbuffer, *sndbufpt;
        !            30: extern int bufidx, devopen;
        !            31: extern int sndbufsize;
        !            32: 
        !            33: extern int have_sound, clockval, oldledstate, period;
        !            34: 
        !            35: extern ULONG AUDIO_FILE;
        !            36: 
        !            37: static __inline__ void flush_sound_buffer(void)
        !            38: {
        !            39:     if(AUDIO_FILE) {
        !            40:         Write(AUDIO_FILE, buffers[bufidx], sndbufsize);
        !            41:     } else {
        !            42:        static char IOSent = 0;
        !            43: 
        !            44:        AudioIO->ioa_Request.io_Command = CMD_WRITE;
        !            45:        AudioIO->ioa_Request.io_Flags   = ADIOF_PERVOL|IOF_QUICK;
        !            46:        AudioIO->ioa_Data               = (uae_s8 *)buffers[bufidx];
        !            47:        AudioIO->ioa_Length             = sndbufsize;
        !            48:        AudioIO->ioa_Period             = period;
        !            49:        AudioIO->ioa_Volume             = 64;
        !            50:        AudioIO->ioa_Cycles             = 1;
        !            51: 
        !            52:        if(IOSent) WaitIO((void*)AudioIO); else IOSent=1;
        !            53:        BeginIO((void*)AudioIO);
        !            54: 
        !            55:        /* double buffering */
        !            56:        bufidx = 1 - bufidx;
        !            57:        sndbuffer = sndbufpt = (uae_u16*)buffers[bufidx];
        !            58:     }
        !            59: }
        !            60: 
        !            61: static __inline__ void check_sound_buffers (void)
        !            62: {
        !            63:     if ((char *)sndbufpt - (char *)sndbuffer >= sndbufsize) {
        !            64:        flush_sound_buffer();
        !            65:     }
        !            66: }
        !            67: 
        !            68: #define PUT_SOUND_BYTE(b) do { *(uae_u8 *)sndbufpt = b; sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 1); } while (0)
        !            69: #define PUT_SOUND_WORD(b) do { *(uae_u16 *)sndbufpt = b; sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 2); } while (0)
        !            70: #define SOUND16_BASE_VAL 0
        !            71: #define SOUND8_BASE_VAL 0
        !            72: 
        !            73: #define DEFAULT_SOUND_MAXB 8192
        !            74: #define DEFAULT_SOUND_MINB 8192
        !            75: #define DEFAULT_SOUND_BITS 16
        !            76: #define DEFAULT_SOUND_FREQ 11025
        !            77: 
        !            78: #define UNSUPPORTED_OPTION_b
        !            79: 
        !            80: #undef DONT_WANT_SOUND

unix.superglobalmegacorp.com

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