home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ST-Computer Leser-CD 2000 January
/
LCD_01_2000.iso
/
games
/
doom
/
pmdoom
/
src
/
sound
/
ataridma.c
next >
Wrap
C/C++ Source or Header
|
1999-12-17
|
4KB
|
152 lines
/* Emacs style mode select -*- C++ -*- */
/* ----------------------------------------------------------------------------- */
/* */
/* $Id:$ */
/* */
/* Copyright (C) 1993-1996 by id Software, Inc. */
/* */
/* This source is available for distribution and/or modification */
/* only under the terms of the DOOM Source Code License as */
/* published by id Software. All rights reserved. */
/* */
/* The source is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License */
/* for more details. */
/* */
/* $Log:$ */
/* */
/* DESCRIPTION: */
/* System interface for sound. */
/* */
/* ----------------------------------------------------------------------------- */
#include <osbind.h>
#include <falcon.h>
#include "z_zone.h"
#include "i_system.h"
#include "i_sound.h"
#include "i_cookies.h"
#include "sound/ataridma.h"
char *atari_dmabuffer;
int atari_sndcoef;
int atari_sndlength;
int DmaSoundInited=0;
/* */
/* Starting a sound means adding it */
/* to the current list of active sounds */
/* in the internal channels. */
/* As the SFX info struct contains */
/* e.g. a pointer to the raw data, */
/* it is ignored. */
/* As our sound handling does not handle */
/* priority, it is ignored. */
/* Pitching (that is, increased speed of playback) */
/* is set, but currently not used by mixing. */
/* */
int
I_StartSound_atari
( int id,
int vol,
int sep,
int pitch,
int priority )
{
/* Debug. */
/* fprintf( stderr, "starting sound %d", id ); */
/* Returns a handle (not used). */
id = addsfx( id, vol, 0 /* steptable[pitch]*/ , sep );
/* fprintf( stderr, "/handle is %d\n", id ); */
return id;
}
void I_ShutdownSound_atari(void)
{
if (!DmaSoundInited)
return;
/* Stop Timer A */
Supexec(I_Atari_StopDmaSound);
Mfree(atari_dmabuffer);
}
void
I_InitSound_atari()
{
int i;
/* Configure sound matrix */
if (cookie_snd & (1<<SND_DMAREC))
{
Devconnect(DMAPLAY,DAC+DMAREC,CLK25M,CLKOLD,1);
Setinterrupt(SI_NONE,SI_PLAY);
Settracks(0,0);
Setmontracks(0);
Setmode(STEREO8);
Soundcmd(SETPRESCALE,PRE640);
}
switch(cookie_mch)
{
case MCH_TT:
atari_sndcoef=(11025<<16)/DMAFREQ_TT;
atari_sndlength=(DMAFREQ_TT/TIMERA_FREQ);
break;
case MCH_F30:
atari_sndcoef=(11025<<16)/DMAFREQ_F30;
atari_sndlength=(DMAFREQ_F30/TIMERA_FREQ);
break;
}
/* Initialize external data (all sounds) at start, keep static. */
fprintf( stderr, "I_InitSound: ");
for (i=1 ; i<NUMSFX ; i++)
{
sfxinfo_t *sfx=&S_sfx[i];
sfx->nbusing=0;
/* Alias? Example is the chaingun sound linked to pistol. */
if (!sfx->link)
{
/* Load data from WAD file. */
sfx->data = getsfx( sfx->name, &lengths[i] );
Z_ChangeTag ( (sfx->data)-8, PU_CACHE);
}
}
fprintf( stderr, " pre-cached all sound data\n");
/* Now initialize mixbuffer with zero. */
/*
for ( i = 0; i< MIXBUFFERSIZE; i++ )
mixbuffer[i] = 0;
*/
/* Finished initialization. */
fprintf(stderr, "I_InitSound: sound module ready\n");
/* Run Timer A interrupt */
Supexec(I_Atari_InitDmaSound);
DmaSoundInited=1;
}
void I_SndInit_atari(void)
{
/* Allocate DMA sound buffer */
atari_dmabuffer=Mxalloc(512*4*2,0);
memset(atari_dmabuffer,0,512*4*2);
}