| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef DOSBOX_MIXER_H |
| 22 |
#define DOSBOX_MIXER_H |
| 23 |
|
| 24 |
#ifndef DOSBOX_DOSBOX_H |
| 25 |
#include "dosbox.h" |
| 26 |
#endif |
| 27 |
|
| 28 |
typedef void (*MIXER_MixHandler)(Bit8u * sampdate,Bit32u len); |
| 29 |
typedef void (*MIXER_Handler)(Bitu len); |
| 30 |
|
| 31 |
enum BlahModes { |
| 32 |
MIXER_8MONO,MIXER_8STEREO, |
| 33 |
MIXER_16MONO,MIXER_16STEREO |
| 34 |
}; |
| 35 |
|
| 36 |
enum MixerModes { |
| 37 |
M_8M,M_8S, |
| 38 |
M_16M,M_16S |
| 39 |
}; |
| 40 |
|
| 41 |
#define MIXER_BUFSIZE (16*1024) |
| 42 |
#define MIXER_BUFMASK (MIXER_BUFSIZE-1) |
| 43 |
extern Bit8u MixTemp[MIXER_BUFSIZE]; |
| 44 |
|
| 45 |
#define MAX_AUDIO ((1<<(16-1))-1) |
| 46 |
#define MIN_AUDIO -(1<<(16-1)) |
| 47 |
|
| 48 |
class MixerChannel { |
| 49 |
public: |
| 50 |
void SetVolume(float _left,float _right); |
| 51 |
void SetScale( float f ); |
| 52 |
void UpdateVolume(void); |
| 53 |
void SetFreq(Bitu _freq); |
| 54 |
void Mix(Bitu _needed); |
| 55 |
void AddSilence(void); |
| 56 |
|
| 57 |
template<class Type,bool stereo,bool signeddata,bool nativeorder> |
| 58 |
void AddSamples(Bitu len, const Type* data); |
| 59 |
|
| 60 |
void AddSamples_m8(Bitu len, const Bit8u * data); |
| 61 |
void AddSamples_s8(Bitu len, const Bit8u * data); |
| 62 |
void AddSamples_m8s(Bitu len, const Bit8s * data); |
| 63 |
void AddSamples_s8s(Bitu len, const Bit8s * data); |
| 64 |
void AddSamples_m16(Bitu len, const Bit16s * data); |
| 65 |
void AddSamples_s16(Bitu len, const Bit16s * data); |
| 66 |
void AddSamples_m16u(Bitu len, const Bit16u * data); |
| 67 |
void AddSamples_s16u(Bitu len, const Bit16u * data); |
| 68 |
void AddSamples_m32(Bitu len, const Bit32s * data); |
| 69 |
void AddSamples_s32(Bitu len, const Bit32s * data); |
| 70 |
void AddSamples_m16_nonnative(Bitu len, const Bit16s * data); |
| 71 |
void AddSamples_s16_nonnative(Bitu len, const Bit16s * data); |
| 72 |
void AddSamples_m16u_nonnative(Bitu len, const Bit16u * data); |
| 73 |
void AddSamples_s16u_nonnative(Bitu len, const Bit16u * data); |
| 74 |
void AddSamples_m32_nonnative(Bitu len, const Bit32s * data); |
| 75 |
void AddSamples_s32_nonnative(Bitu len, const Bit32s * data); |
| 76 |
|
| 77 |
void AddStretched(Bitu len,Bit16s * data); |
| 78 |
void FillUp(void); |
| 79 |
void Enable(bool _yesno); |
| 80 |
MIXER_Handler handler; |
| 81 |
float volmain[2]; |
| 82 |
float scale; |
| 83 |
Bit32s volmul[2]; |
| 84 |
Bitu freq_add,freq_index; |
| 85 |
Bitu done,needed; |
| 86 |
Bits last[2]; |
| 87 |
const char * name; |
| 88 |
bool enabled; |
| 89 |
MixerChannel * next; |
| 90 |
}; |
| 91 |
|
| 92 |
MixerChannel * MIXER_AddChannel(MIXER_Handler handler,Bitu freq,const char * name); |
| 93 |
MixerChannel * MIXER_FindChannel(const char * name); |
| 94 |
|
| 95 |
void MIXER_DelChannel(MixerChannel* delchan); |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
class MixerObject{ |
| 100 |
private: |
| 101 |
bool installed; |
| 102 |
char m_name[32]; |
| 103 |
public: |
| 104 |
MixerObject():installed(false){}; |
| 105 |
MixerChannel* Install(MIXER_Handler handler,Bitu freq,const char * name); |
| 106 |
~MixerObject(); |
| 107 |
}; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
void PCSPEAKER_SetCounter(Bitu cntr,Bitu mode); |
| 112 |
void PCSPEAKER_SetType(Bitu mode); |
| 113 |
|
| 114 |
#endif |