Debian Codegraph @

include/mixer.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: mixer.h,v 1.19 2009-04-28 21:48:24 harekiet Exp $ */
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); //Fill up until needed
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); //Strech block up into needed 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 /* Find the device you want to delete with findchannel "delchan gets deleted" */
95 void MIXER_DelChannel(MixerChannel* delchan);
96
97 /* Object to maintain a mixerchannel; As all objects it registers itself with create
98 * and removes itself when destroyed. */
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 /* PC Speakers functions, tightly related to the timer functions */
111 void PCSPEAKER_SetCounter(Bitu cntr,Bitu mode);
112 void PCSPEAKER_SetType(Bitu mode);
113
114 #endif