src/audio/mint/SDL_mintaudio.h
changeset 644 594422ab8f9f
parent 398 d219b0e02f5f
child 704 c4803992e09c
equal deleted inserted replaced
643:564716cfb502 644:594422ab8f9f
     1 /*
     1 /*
     2  * MiNT audio driver
     2     SDL - Simple DirectMedia Layer
     3  * 
     3     Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     4  * Patrice Mandin
     4 
     5  */
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public
       
    16     License along with this library; if not, write to the Free
       
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18 
       
    19     Sam Lantinga
       
    20     slouken@libsdl.org
       
    21 */
       
    22 
       
    23 /*
       
    24 	MiNT audio driver
       
    25 
       
    26 	Patrice Mandin
       
    27 */
     6 
    28 
     7 #ifndef _SDL_mintaudio_h
    29 #ifndef _SDL_mintaudio_h
     8 #define _SDL_mintaudio_h
    30 #define _SDL_mintaudio_h
     9 
    31 
    10 #include "SDL_sysaudio.h"
    32 #include "SDL_sysaudio.h"
       
    33 #include "SDL_mintaudio_stfa.h"
    11 
    34 
    12 /* Hidden "this" pointer for the audio functions */
    35 /* Hidden "this" pointer for the audio functions */
    13 #define _THIS	SDL_AudioDevice *this
    36 #define _THIS	SDL_AudioDevice *this
    14 
    37 
       
    38 struct SDL_PrivateAudioData {
       
    39 	Uint32	hardfreq[16];	/* Array of replay freqs of the hardware */
       
    40 	int		sfreq;			/* First number of freq to use in the array */
       
    41 	int 	nfreq;			/* Number of freqs to use in the array */
       
    42 	int		numfreq;		/* Number of selected frequency */
       
    43 };
       
    44 
       
    45 /* Old variable names */
       
    46 #define MINTAUDIO_hardfreq		(this->hidden->hardfreq)
       
    47 #define MINTAUDIO_sfreq			(this->hidden->sfreq)
       
    48 #define MINTAUDIO_nfreq			(this->hidden->nfreq)
       
    49 #define MINTAUDIO_numfreq		(this->hidden->numfreq)
       
    50 
       
    51 /* _MCH cookie (values>>16) */
       
    52 enum {
       
    53 	MCH_ST=0,
       
    54 	MCH_STE,
       
    55 	MCH_TT,
       
    56 	MCH_F30
       
    57 };
       
    58 
       
    59 /* Master clocks for replay frequencies */
       
    60 #define MASTERCLOCK_STE		8010666		/* Not sure of this one */
       
    61 #define MASTERCLOCK_TT		16107953	/* Not sure of this one */
       
    62 #define MASTERCLOCK_FALCON1	25175000
       
    63 #define MASTERCLOCK_FALCON2	32000000	/* Only usable for DSP56K */
       
    64 #define MASTERCLOCK_FALCONEXT	-1		/* Clock on DSP56K port, unknown */
       
    65 #define MASTERCLOCK_44K		22579200	/* Standard clock for 44.1 Khz */
       
    66 #define MASTERCLOCK_48K		24576000	/* Standard clock for 48 Khz */
       
    67 
       
    68 /* Master clock predivisors */
       
    69 #define MASTERPREDIV_STE	160
       
    70 #define MASTERPREDIV_TT		320
       
    71 #define MASTERPREDIV_FALCON	256
       
    72 #define MASTERPREDIV_MILAN	256
       
    73 
       
    74 /* MFP 68901 interrupt sources */
       
    75 enum {
       
    76 	MFP_PARALLEL=0,
       
    77 	MFP_DCD,
       
    78 	MFP_CTS,
       
    79 	MFP_BITBLT,
       
    80 	MFP_TIMERD,
       
    81 	MFP_BAUDRATE=MFP_TIMERD,
       
    82 	MFP_TIMERC,
       
    83 	MFP_200HZ=MFP_TIMERC,
       
    84 	MFP_ACIA,
       
    85 	MFP_DISK,
       
    86 	MFP_TIMERB,
       
    87 	MFP_HBLANK=MFP_TIMERB,
       
    88 	MFP_TERR,
       
    89 	MFP_TBE,
       
    90 	MFP_RERR,
       
    91 	MFP_RBF,
       
    92 	MFP_TIMERA,
       
    93 	MFP_DMASOUND=MFP_TIMERA,
       
    94 	MFP_RING,
       
    95 	MFP_MONODETECT
       
    96 };
       
    97 
       
    98 /* Xbtimer() timers */
       
    99 enum {
       
   100 	XB_TIMERA=0,
       
   101 	XB_TIMERB,
       
   102 	XB_TIMERC,
       
   103 	XB_TIMERD
       
   104 };
       
   105 
       
   106 /* Variables */
       
   107 extern SDL_AudioDevice *SDL_MintAudio_device;
       
   108 extern Uint8 *SDL_MintAudio_audiobuf[2];	/* Pointers to buffers */
       
   109 extern long SDL_MintAudio_audiosize;		/* Length of audio buffer=spec->size */
       
   110 extern long SDL_MintAudio_numbuf;		/* Buffer to play */
       
   111 extern long SDL_MintAudio_mutex;
       
   112 extern cookie_stfa_t *SDL_MintAudio_stfa;
       
   113 
       
   114 /* Functions */
       
   115 void SDL_MintAudio_Callback(void);
       
   116 int SDL_MintAudio_SearchFrequency(_THIS, int falcon_codec, int desired_freq);
       
   117 
       
   118 /* ASM interrupt functions */
       
   119 void SDL_MintAudio_GsxbInterrupt(void);
       
   120 void SDL_MintAudio_EmptyGsxbInterrupt(void);
       
   121 void SDL_MintAudio_XbiosInterrupt(void);
       
   122 void SDL_MintAudio_Dma8Interrupt(void);
       
   123 void SDL_MintAudio_StfaInterrupt(void);
       
   124 
    15 #endif /* _SDL_mintaudio_h */
   125 #endif /* _SDL_mintaudio_h */