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

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: 
                     20: AFAudioConn  *aud;
                     21: AC            ac;
                     22: long          aftime;
                     23: int           rate;
                     24: uae_u16 sndbuffer[44100];
                     25: uae_u16 *sndbufpt;
                     26: int sndbufsize;
                     27: 
                     28: static int have_sound;
                     29: 
                     30: void close_sound(void)
                     31: {
                     32: }
                     33: 
                     34: int init_sound (void)
                     35: {
                     36:     AFSetACAttributes   attributes;
                     37:     AFDeviceDescriptor *aDev;
                     38:     int                 device;
                     39:     
                     40:     aud = AFOpenAudioConn(NULL);
                     41:     have_sound = !(aud == NULL);
                     42:     if (!have_sound) {
                     43:        return 0;
                     44:     }
                     45:     
                     46:     for(device = 0; device < ANumberOfAudioDevices(aud); device++) {
                     47:        aDev = AAudioDeviceDescriptor(aud, device);
                     48:        rate = aDev->playSampleFreq;
                     49:        sndbufsize = (rate / 8) * 4;
                     50:        if(aDev->inputsFromPhone == 0
                     51:           && aDev->outputsToPhone == 0
                     52:           && aDev->playNchannels == 1)
                     53:            break;
                     54:     }
                     55:     if (device == ANumberOfAudioDevices(aud)) {
                     56:        return 0;
                     57:     }
                     58:     
                     59:     attributes.type = LIN16;
                     60:     ac = AFCreateAC(aud, device, ACEncodingType, &attributes);
                     61:     aftime = AFGetTime(ac);
                     62: 
                     63:     init_sound_table16 ();
1.1.1.2 ! root       64:     sample_handler = sample16_handler;
1.1       root       65:     sample_evtime = (long)maxhpos * maxvpos * 50 / rate;
                     66:     
                     67:     sndbufpt = sndbuffer;
                     68:     sound_available = 1;
                     69:     printf ("Sound driver found and configured for %d bits at %d Hz, buffer is %d bytes\n", 16, rate, sndbufsize);
                     70:     return 1;
                     71: }

unix.superglobalmegacorp.com

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