Include an extra scale factor in the mixer volume to be set by a device
Set the adlib device scale at 2.0 Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3377
This commit is contained in:
parent
1975a129cc
commit
f6def87e34
3 changed files with 14 additions and 19 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: mixer.h,v 1.18 2009-04-25 16:25:03 harekiet Exp $ */
|
||||
/* $Id: mixer.h,v 1.19 2009-04-28 21:48:24 harekiet Exp $ */
|
||||
|
||||
#ifndef DOSBOX_MIXER_H
|
||||
#define DOSBOX_MIXER_H
|
||||
|
@ -48,6 +48,7 @@ extern Bit8u MixTemp[MIXER_BUFSIZE];
|
|||
class MixerChannel {
|
||||
public:
|
||||
void SetVolume(float _left,float _right);
|
||||
void SetScale( float f );
|
||||
void UpdateVolume(void);
|
||||
void SetFreq(Bitu _freq);
|
||||
void Mix(Bitu _needed);
|
||||
|
@ -78,6 +79,7 @@ public:
|
|||
void Enable(bool _yesno);
|
||||
MIXER_Handler handler;
|
||||
float volmain[2];
|
||||
float scale;
|
||||
Bit32s volmul[2];
|
||||
Bitu freq_add,freq_index;
|
||||
Bitu done,needed;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: adlib.cpp,v 1.37 2009-04-26 18:24:36 qbix79 Exp $ */
|
||||
/* $Id: adlib.cpp,v 1.38 2009-04-28 21:48:24 harekiet Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -732,6 +732,7 @@ Module::Module( Section* configuration ) : Module_base(configuration) {
|
|||
std::string oplemu( section->Get_string( "oplemu" ) );
|
||||
|
||||
mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
|
||||
mixerChan->SetScale( 2.0 );
|
||||
if (oplemu == "old") {
|
||||
if ( oplmode == OPL_opl2 ) {
|
||||
handler = new old_OPL2::Handler();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: mixer.cpp,v 1.52 2009-04-26 18:24:36 qbix79 Exp $ */
|
||||
/* $Id: mixer.cpp,v 1.53 2009-04-28 21:48:24 harekiet Exp $ */
|
||||
|
||||
/*
|
||||
Remove the sdl code from here and have it handeld in the sdlmain.
|
||||
|
@ -62,20 +62,6 @@ static INLINE Bit16s MIXER_CLIP(Bits SAMP) {
|
|||
} else return MAX_AUDIO;
|
||||
}
|
||||
|
||||
struct MIXER_Channel {
|
||||
double vol_main[2];
|
||||
Bits vol_mul[2];
|
||||
Bit8u mode;
|
||||
Bitu freq;
|
||||
char * name;
|
||||
MIXER_MixHandler handler;
|
||||
Bitu sample_add;
|
||||
Bitu sample_left;
|
||||
Bitu remain;
|
||||
bool playing;
|
||||
MIXER_Channel * next;
|
||||
};
|
||||
|
||||
static struct {
|
||||
Bit32s work[MIXER_BUFSIZE][2];
|
||||
Bitu pos,done;
|
||||
|
@ -92,6 +78,7 @@ Bit8u MixTemp[MIXER_BUFSIZE];
|
|||
|
||||
MixerChannel * MIXER_AddChannel(MIXER_Handler handler,Bitu freq,const char * name) {
|
||||
MixerChannel * chan=new MixerChannel();
|
||||
chan->scale = 1.0;
|
||||
chan->handler=handler;
|
||||
chan->name=name;
|
||||
chan->SetFreq(freq);
|
||||
|
@ -126,8 +113,8 @@ void MIXER_DelChannel(MixerChannel* delchan) {
|
|||
}
|
||||
|
||||
void MixerChannel::UpdateVolume(void) {
|
||||
volmul[0]=(Bits)((1 << MIXER_VOLSHIFT)*volmain[0]*mixer.mastervol[0]);
|
||||
volmul[1]=(Bits)((1 << MIXER_VOLSHIFT)*volmain[1]*mixer.mastervol[1]);
|
||||
volmul[0]=(Bits)((1 << MIXER_VOLSHIFT)*scale*volmain[0]*mixer.mastervol[0]);
|
||||
volmul[1]=(Bits)((1 << MIXER_VOLSHIFT)*scale*volmain[1]*mixer.mastervol[1]);
|
||||
}
|
||||
|
||||
void MixerChannel::SetVolume(float _left,float _right) {
|
||||
|
@ -136,6 +123,11 @@ void MixerChannel::SetVolume(float _left,float _right) {
|
|||
UpdateVolume();
|
||||
}
|
||||
|
||||
void MixerChannel::SetScale( float f ) {
|
||||
scale = f;
|
||||
UpdateVolume();
|
||||
}
|
||||
|
||||
void MixerChannel::Enable(bool _yesno) {
|
||||
if (_yesno==enabled) return;
|
||||
enabled=_yesno;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue