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

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

unix.superglobalmegacorp.com

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