Added output volume control.
This commit is contained in:
parent
ae37557c3d
commit
640c6a61e2
7 changed files with 1055 additions and 926 deletions
2
src/pc.c
2
src/pc.c
|
|
@ -669,6 +669,7 @@ void loadconfig(char *fn)
|
|||
window_remember = config_get_int(CFG_GLOBAL, NULL, "window_remember", 0);
|
||||
|
||||
sound_buf_len = config_get_int(CFG_GLOBAL, NULL, "sound_buf_len", 200);
|
||||
sound_gain = config_get_int(CFG_GLOBAL, NULL, "sound_gain", 0);
|
||||
|
||||
GAMEBLASTER = config_get_int(CFG_MACHINE, NULL, "gameblaster", 0);
|
||||
GUS = config_get_int(CFG_MACHINE, NULL, "gus", 0);
|
||||
|
|
@ -840,6 +841,7 @@ void saveconfig(char *fn)
|
|||
config_set_int(CFG_GLOBAL, NULL, "window_remember", window_remember);
|
||||
|
||||
config_set_int(CFG_GLOBAL, NULL, "sound_buf_len", sound_buf_len);
|
||||
config_set_int(CFG_GLOBAL, NULL, "sound_gain", sound_gain);
|
||||
|
||||
config_set_int(CFG_MACHINE, NULL, "gameblaster", GAMEBLASTER);
|
||||
config_set_int(CFG_MACHINE, NULL, "gus", GUS);
|
||||
|
|
|
|||
44
src/pc.xrc
44
src/pc.xrc
|
|
@ -31,6 +31,7 @@
|
|||
<ids-range name="IDM_VID_SCALE_MODE" start="1300" />
|
||||
<ids-range name="IDM_VID_RENDER_DRIVER" start="1400" />
|
||||
<ids-range name="IDM_SND_BUF" start="2000" />
|
||||
<ids-range name="IDM_SND_GAIN" start="2100" />
|
||||
<ids-range name="IDM_VID_GL3_INPUT_STRETCH" start="3000" />
|
||||
<ids-range name="IDM_VID_GL3_INPUT_SCALE" start="3100" />
|
||||
<ids-range name="IDM_VID_GL3_SHADER_REFRESH_RATE" start="3200" />
|
||||
|
|
@ -394,6 +395,49 @@
|
|||
<radio>1</radio>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxMenu">
|
||||
<label>_Output level</label>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[0]">
|
||||
<label>_Normal</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[1]">
|
||||
<label>+_2 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[2]">
|
||||
<label>+_4 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[3]">
|
||||
<label>+_6 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[4]">
|
||||
<label>+_8 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[5]">
|
||||
<label>+_10 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[6]">
|
||||
<label>+12 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[7]">
|
||||
<label>+14 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[8]">
|
||||
<label>+16 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
<object class="wxMenuItem" name="IDM_SND_GAIN[9]">
|
||||
<label>+18 dB</label>
|
||||
<radio>1</radio>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxMenu">
|
||||
<label>Misc</label>
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ static event_t *sound_cd_event;
|
|||
static unsigned int cd_vol_l, cd_vol_r;
|
||||
|
||||
int sound_buf_len = 48000 / 10;
|
||||
int sound_gain = 0;
|
||||
|
||||
void sound_update_buf_length()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,5 +31,7 @@ void givealbuffer_cd(int16_t *buf);
|
|||
extern int sound_buf_len;
|
||||
void sound_update_buf_length();
|
||||
|
||||
extern int sound_gain;
|
||||
|
||||
extern int SOUNDBUFLEN;
|
||||
#define MAXSOUNDBUFLEN (48000 / 10)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#ifdef USE_OPENAL
|
||||
#ifdef __APPLE__
|
||||
#include <OpenAL/al.h>
|
||||
|
|
@ -180,6 +181,9 @@ void givealbuffer(int32_t *buf)
|
|||
{
|
||||
int c;
|
||||
ALuint buffer;
|
||||
double gain = pow(10.0, (double)sound_gain / 20.0);
|
||||
|
||||
alSourcef(source[0], AL_GAIN, gain);
|
||||
|
||||
alSourceUnqueueBuffers(source[0], 1, &buffer);
|
||||
// printf("U ");
|
||||
|
|
@ -244,6 +248,9 @@ void givealbuffer_cd(int16_t *buf)
|
|||
if (processed>=1)
|
||||
{
|
||||
ALuint buffer;
|
||||
double gain = pow(10.0, (double)sound_gain / 20.0);
|
||||
|
||||
alSourcef(source[1], AL_GAIN, gain);
|
||||
|
||||
alSourceUnqueueBuffers(source[1], 1, &buffer);
|
||||
// printf("U ");
|
||||
|
|
|
|||
2103
src/wx-resources.cpp
2103
src/wx-resources.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -406,7 +406,7 @@ int wx_setupmenu(void* data)
|
|||
sprintf(menuitem, "IDM_SND_BUF[%d]", (int)(log(sound_buf_len/MIN_SND_BUF)/log(2)));
|
||||
wx_checkmenuitem(menu, WX_ID(menuitem), WX_MB_CHECKED);
|
||||
|
||||
sprintf(menuitem, "IDM_SND_BUF[%d]", (int)(log(sound_buf_len/MIN_SND_BUF)/log(2)));
|
||||
sprintf(menuitem, "IDM_SND_GAIN[%d]", (int)(sound_gain / 2));
|
||||
wx_checkmenuitem(menu, WX_ID(menuitem), WX_MB_CHECKED);
|
||||
|
||||
sprintf(menuitem, "IDM_VID_SCALE_MODE[%d]", video_scale_mode);
|
||||
|
|
@ -1030,6 +1030,12 @@ int wx_handle_command(void* hwnd, int wParam, int checked)
|
|||
wx_checkmenuitem(menu, wParam, WX_MB_CHECKED);
|
||||
saveconfig(NULL);
|
||||
}
|
||||
else if (ID_RANGE("IDM_SND_GAIN[start]", "IDM_SND_GAIN[end]"))
|
||||
{
|
||||
sound_gain = 2 * (wParam - wx_xrcid("IDM_SND_GAIN[start]"));
|
||||
wx_checkmenuitem(menu, wParam, WX_MB_CHECKED);
|
||||
saveconfig(NULL);
|
||||
}
|
||||
else if (ID_IS("IDM_CDROM_DISABLED"))
|
||||
{
|
||||
if (cdrom_enabled)
|
||||
|
|
|
|||
Loading…
Reference in a new issue