Annotation of uae/src/sd-af/sound.c, revision 1.1

1.1     ! root        1:  /* 
        !             2:   * UAE - The Un*x Amiga Emulator
        !             3:   * 
        !             4:   * Support for the AF sound system
        !             5:   * 
        !             6:   * Copyright 1996 Marcus Sundberg
        !             7:   */
        !             8: 
        !             9: #include "sysconfig.h"
        !            10: #include "sysdeps.h"
        !            11: 
        !            12: #include "config.h"
        !            13: #include "options.h"
        !            14: #include "memory.h"
        !            15: #include "custom.h"
        !            16: #include "audio.h"
        !            17: #include "gensound.h"
        !            18: #include "sounddep/sound.h"
        !            19: #include "events.h"
        !            20: 
        !            21: AFAudioConn  *aud;
        !            22: AC            ac;
        !            23: long          aftime;
        !            24: int           rate;
        !            25: uae_u16 sndbuffer[44100];
        !            26: uae_u16 *sndbufpt;
        !            27: int sndbufsize;
        !            28: 
        !            29: static int have_sound;
        !            30: 
        !            31: void close_sound(void)
        !            32: {
        !            33: }
        !            34: 
        !            35: int init_sound (void)
        !            36: {
        !            37:     AFSetACAttributes   attributes;
        !            38:     AFDeviceDescriptor *aDev;
        !            39:     int                 device;
        !            40:     
        !            41:     aud = AFOpenAudioConn(NULL);
        !            42:     have_sound = !(aud == NULL);
        !            43:     if (!have_sound) {
        !            44:        return 0;
        !            45:     }
        !            46:     
        !            47:     for(device = 0; device < ANumberOfAudioDevices(aud); device++) {
        !            48:        aDev = AAudioDeviceDescriptor(aud, device);
        !            49:        rate = aDev->playSampleFreq;
        !            50:        sndbufsize = (rate / 8) * 4;
        !            51:        if(aDev->inputsFromPhone == 0
        !            52:           && aDev->outputsToPhone == 0
        !            53:           && aDev->playNchannels == 1)
        !            54:            break;
        !            55:     }
        !            56:     if (device == ANumberOfAudioDevices(aud)) {
        !            57:        return 0;
        !            58:     }
        !            59:     
        !            60:     attributes.type = LIN16;
        !            61:     ac = AFCreateAC(aud, device, ACEncodingType, &attributes);
        !            62:     aftime = AFGetTime(ac);
        !            63: 
        !            64:     init_sound_table16 ();
        !            65:     eventtab[ev_sample].handler = sample16_handler;
        !            66:     sample_evtime = (long)maxhpos * maxvpos * 50 / rate;
        !            67:     
        !            68:     sndbufpt = sndbuffer;
        !            69:     sound_available = 1;
        !            70:     printf ("Sound driver found and configured for %d bits at %d Hz, buffer is %d bytes\n", 16, rate, sndbufsize);
        !            71:     return 1;
        !            72: }

unix.superglobalmegacorp.com

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