VLSI Solution Oy / MegaLib Documentation

audio.h

Go to the documentation of this file.
00001 
00004 #ifndef __AUDIO_H__
00005 #define __AUDIO_H__
00006 
00007 #include "vs1000.h"
00008 
00009 #define WITH_EARSPEAKER
00010 #define DIRECT_VORBIS_BLOCKSIZE
00011 
00012 #define USE_TIMER
00013 #ifdef USE_TIMER
00014 #define TIMER_TICKS 100 /* 100Hz */
00015 #ifndef ASM
00016 
00017 extern __y volatile u_int32 timeCount;
00021 u_int32 ReadTimeCount(void);
00022 #endif
00023 #endif
00024 
00025 #define DEFAULT_AUDIO_BUFFER_SAMPLES 2048
00026 #define DAC_DEFAULT_SAMPLERATE 8000
00027 #define DAC_DRIVER_ON_DELAY (DAC_DEFAULT_SAMPLERATE/10) /* 100ms In samples */
00028 
00029 #define APPL_RESET       0
00030 #define APPL_AUDIO       1
00031 #define APPL_BITSTREAM  10
00032 
00033 
00034 #ifdef ASM
00035         .import _audioPtr
00036 #define AUDIOPTR_WR 0
00037 #define AUDIOPTR_RD 1
00038 #define AUDIOPTR_FORWARD_MODULO 2
00039 #define AUDIOPTR_LEFTVOL 3
00040 #define AUDIOPTR_RIGHTVOL 4
00041 #define AUDIOPTR_UNDERFLOW 5
00042 #else
00043 
00052 extern s_int16 (*applAddr)(s_int16 register __i0 **d,
00053                            s_int16 register __a1 mode,
00054                            s_int16 register __a0 n);
00060 extern __y s_int16 audioBuffer[2*DEFAULT_AUDIO_BUFFER_SAMPLES];
00061 struct AUDIOPTR {
00062     __y s_int16 *wr;       /* 0: write pointer */
00063     __y s_int16 *rd;       /* 1: read pointer */
00064     u_int16 forwardModulo; /* 2: 0x8000 + size - 1 */
00065     s_int16 leftVol;       /* 3: left volume,  default     -32768 =  1.0 */
00066     s_int16 rightVol;      /* 4: right volume, differential 32767 = -1.0 */
00067     s_int16 underflow;     /* 5: set if underflow in dac interrupt */
00068 };
00076 extern __y struct AUDIOPTR audioPtr;
00077 
00078 extern u_int16 earSpeakerReg; 
00079 extern __y u_int16 earSpeakerDisable; 
00080 extern u_int16 volumeReg; 
00081 extern u_int16 bassReg;   
00082 extern __y u_int16 extClock4KHz; 
00083 extern __y u_int16 clockX; 
00084 extern u_int32 __y curFctl; 
00085 extern __y u_int16 hwSampleRate; 
00086 extern __y u_int16 uiTime; 
00087 extern __y u_int16 uiTrigger; 
00088 extern s_int16 __y timeToRemovePDown2; 
00089 extern u_int32 __y haltTime; 
00090 extern __y u_int16 uartByteSpeed; 
00092 extern __y struct EARSPEAKER {
00093     u_int16 Freq;
00094     u_int16 Disable;
00095     u_int16 Setting;
00096     s_int16 Old;
00097     u_int16 longFrames;
00098 } earSpeaker;
00099 
00100 
00103 void InitAudio(void);
00114 auto void StereoCopy(register __i2 s_int16 *s, register __a0 u_int16 n);
00117 s_int16 AudioBufFill(void); /* how many STEREO samples to play */
00122 s_int16 AudioBufFree(void); /* how many STEREO samples fit */
00123 
00127 auto void SetRate(register __c1 u_int16 rate);
00131 auto void RealSetRate(register __c1 u_int16 rate);
00134 auto void SetVolume(void);
00137 auto void RealSetVolume(void);
00144 auto void AudioOutputSamples(s_int16 *p, s_int16 samples);
00145 
00151 u_int16 UartDiv(void);
00152 
00153 #endif
00156 #endif/*__AUDIO_H__*/
00157 

All software copyright 2005-2006 VLSI Solution OY. Redistribution of this software is strictly forbidden.