#include "gui.h"
#include "xwin.h"
#include "debug.h"
+#include "sndboard.h"
#ifdef AVIOUTPUT
#include "avioutput.h"
#endif
float sample_evtime;
float scaled_sample_evtime;
+int sound_cd_volume[2];
+int sound_paula_volume[2];
+
static unsigned long last_cycles;
static float next_sample_evtime;
#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0)
#define SBASEVAL16(logn) ((logn) == 1 ? SOUND16_BASE_VAL >> 1 : SOUND16_BASE_VAL)
-STATIC_INLINE int FINISH_DATA (int data, int bits)
+STATIC_INLINE int FINISH_DATA (int data, int bits, int ch)
{
if (bits == 16) {
return data;
int shift = 16 - bits;
data <<= shift;
}
+ data = data * sound_paula_volume[ch] / 32768;
return data;
}
samplexx_sinc_handler (datas);
data1 = datas[0] + datas[3] + datas[1] + datas[2];
- data1 = FINISH_DATA (data1, 18);
+ data1 = FINISH_DATA (data1, 18, 0);
do_filter(&data1, 0);
data0 += data2;
data0 += data3;
data = SBASEVAL16(2) + data0;
- data = FINISH_DATA (data, 16);
+ data = FINISH_DATA (data, 16, 0);
do_filter(&data, 0);
samplexx_anti_handler (datas);
data1 = datas[0] + datas[3] + datas[1] + datas[2];
- data1 = FINISH_DATA (data1, 16);
+ data1 = FINISH_DATA (data1, 16, 0);
do_filter(&data1, 0);
ratio = ((audio_channel[3].evtime % delta) << 8) / delta;
data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8;
data = SBASEVAL16(2) + data0;
- data = FINISH_DATA (data, 16);
+ data = FINISH_DATA (data, 16, 0);
do_filter(&data, 0);
data0 += data3;
data0 += data1;
data = SBASEVAL16(2) + data0;
- data = FINISH_DATA (data, 16);
+ data = FINISH_DATA (data, 16, 0);
do_filter(&data, 0);
data2 &= audio_channel[2].adk_mask;
data3 &= audio_channel[3].adk_mask;
- data0 = FINISH_DATA (data0, 14);
- data1 = FINISH_DATA (data1, 14);
- data2 = FINISH_DATA (data2, 14);
- data3 = FINISH_DATA (data3, 14);
+ data0 = FINISH_DATA (data0, 14, 0);
+ data1 = FINISH_DATA (data1, 14, 0);
+ data2 = FINISH_DATA (data2, 14, 1);
+ data3 = FINISH_DATA (data3, 14, 1);
do_filter(&data0, 0);
do_filter(&data1, 1);
int datas[AUDIO_CHANNELS_PAULA];
samplexx_anti_handler (datas);
- data0 = FINISH_DATA (datas[0], 14);
- data1 = FINISH_DATA (datas[1], 14);
- data2 = FINISH_DATA (datas[2], 14);
- data3 = FINISH_DATA (datas[3], 14);
+ data0 = FINISH_DATA (datas[0], 14, 0);
+ data1 = FINISH_DATA (datas[1], 14, 0);
+ data2 = FINISH_DATA (datas[2], 14, 1);
+ data3 = FINISH_DATA (datas[3], 14, 1);
do_filter(&data0, 0);
do_filter(&data1, 1);
samplexx_anti_handler (datas);
data1 = datas[0] + datas[3];
data2 = datas[1] + datas[2];
- data1 = FINISH_DATA (data1, 15);
- data2 = FINISH_DATA (data2, 15);
+ data1 = FINISH_DATA (data1, 15, 0);
+ data2 = FINISH_DATA (data2, 15, 1);
do_filter(&data1, 0);
do_filter(&data2, 1);
int datas[AUDIO_CHANNELS_PAULA];
samplexx_sinc_handler (datas);
- data0 = FINISH_DATA (datas[0], 16);
- data1 = FINISH_DATA (datas[1], 16);
- data2 = FINISH_DATA (datas[2], 16);
- data3 = FINISH_DATA (datas[3], 16);
+ data0 = FINISH_DATA (datas[0], 16, 0);
+ data1 = FINISH_DATA (datas[1], 16, 0);
+ data2 = FINISH_DATA (datas[2], 16, 1);
+ data3 = FINISH_DATA (datas[3], 16, 1);
do_filter(&data0, 0);
do_filter(&data1, 1);
samplexx_sinc_handler (datas);
data1 = datas[0] + datas[3];
data2 = datas[1] + datas[2];
- data1 = FINISH_DATA (data1, 17);
- data2 = FINISH_DATA (data2, 17);
+ data1 = FINISH_DATA (data1, 17, 0);
+ data2 = FINISH_DATA (data2, 17, 1);
do_filter(&data1, 0);
do_filter(&data2, 1);
data0 += data3;
data1 += data2;
data2 = SBASEVAL16(1) + data0;
- data2 = FINISH_DATA (data2, 15);
+ data2 = FINISH_DATA (data2, 15, 0);
data3 = SBASEVAL16(1) + data1;
- data3 = FINISH_DATA (data3, 15);
+ data3 = FINISH_DATA (data3, 15, 1);
do_filter(&data2, 0);
do_filter(&data3, 1);
data1 += data2;
data0 += data3;
data2 = SBASEVAL16(1) + data0;
- data2 = FINISH_DATA (data2, 15);
+ data2 = FINISH_DATA (data2, 15, 0);
data3 = SBASEVAL16(1) + data1;
- data3 = FINISH_DATA (data3, 15);
+ data3 = FINISH_DATA (data3, 15, 1);
do_filter(&data2, 0);
do_filter(&data3, 1);
ratio = ((audio_channel[3].evtime % delta) << 8) / delta;
data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8;
data2 = SBASEVAL16(1) + data0;
- data2 = FINISH_DATA (data2, 15);
+ data2 = FINISH_DATA (data2, 15, 0);
data3 = SBASEVAL16(1) + data1;
- data3 = FINISH_DATA (data3, 15);
+ data3 = FINISH_DATA (data3, 15, 1);
do_filter(&data2, 0);
do_filter(&data3, 1);
if (changed_prefs.sound_stereo_separation != currprefs.sound_stereo_separation
|| changed_prefs.sound_mixed_stereo_delay != currprefs.sound_mixed_stereo_delay
|| changed_prefs.sound_interpol != currprefs.sound_interpol
- || changed_prefs.sound_volume != currprefs.sound_volume
+ || changed_prefs.sound_volume_paula != currprefs.sound_volume_paula
+ || changed_prefs.sound_volume_cd != currprefs.sound_volume_cd
+ || changed_prefs.sound_volume_master != currprefs.sound_volume_master
+ || changed_prefs.sound_volume_board != currprefs.sound_volume_board
|| changed_prefs.sound_stereo_swap_paula != currprefs.sound_stereo_swap_paula
|| changed_prefs.sound_stereo_swap_ahi != currprefs.sound_stereo_swap_ahi
|| changed_prefs.sound_cdaudio != currprefs.sound_cdaudio
currprefs.sound_interpol = changed_prefs.sound_interpol;
currprefs.sound_filter = changed_prefs.sound_filter;
currprefs.sound_filter_type = changed_prefs.sound_filter_type;
- currprefs.sound_volume = changed_prefs.sound_volume;
+ currprefs.sound_volume_paula = changed_prefs.sound_volume_paula;
+ currprefs.sound_volume_master = changed_prefs.sound_volume_master;
+ currprefs.sound_volume_board = changed_prefs.sound_volume_board;
+ currprefs.sound_volume_cd = changed_prefs.sound_volume_cd;
currprefs.sound_cdaudio = changed_prefs.sound_cdaudio;
currprefs.sound_stereo_swap_paula = changed_prefs.sound_stereo_swap_paula;
currprefs.sound_stereo_swap_ahi = changed_prefs.sound_stereo_swap_ahi;
+ sound_cd_volume[0] = sound_cd_volume[1] = (100 - (currprefs.sound_volume_cd < 0 ? 0 : currprefs.sound_volume_cd)) * 32768 / 100;
+ sound_paula_volume[0] = sound_paula_volume[1] = (100 - currprefs.sound_volume_paula) * 32768 / 100;
+ sndboard_ext_volume();
+
if (ch >= 0) {
if (currprefs.produce_sound >= 2) {
if (!init_audio ()) {
cda_evt = clk * CYCLE_UNIT / 44100;
}
-void audio_cda_volume(int master, int left, int right)
+void audio_cda_volume(int left, int right)
{
for (int j = 0; j < 2; j++) {
cda_volume[j] = j == 0 ? left : right;
- cda_volume[j] = (100 - master) * cda_volume[j] / 100;
+ cda_volume[j] = sound_cd_volume[j] * cda_volume[j] / 32768;
if (cda_volume[j])
cda_volume[j]++;
if (cda_volume[j] >= 32768)
{
if (!config_changed)
return;
- currprefs.sound_volume_cd = changed_prefs.sound_volume_cd;
}
static void check_changes (int unitnum)
cda_bufon[bufnum] = 1;
next_cd_audio_buffer_callback(1 - bufnum);
}
- audio_cda_volume(currprefs.sound_volume_cd >= 0 ? currprefs.sound_volume_cd : currprefs.sound_volume, cdu->cdda_volume[0], cdu->cdda_volume[1]);
+ audio_cda_volume(cdu->cdda_volume[0], cdu->cdda_volume[1]);
cda_bufon[bufnum] = 1;
} else {
cda_bufon[bufnum] = 1;
- cda->setvolume (currprefs.sound_volume_cd >= 0 ? currprefs.sound_volume_cd : currprefs.sound_volume, cdu->cdda_volume[0], cdu->cdda_volume[1]);
+ cda->setvolume (cdu->cdda_volume[0], cdu->cdda_volume[1]);
if (!cda->play (bufnum)) {
if (cdu->cdda_play > 0)
setstate (cdu, AUDIO_STATUS_PLAY_ERROR);
write_log(_T("L64111 mute %d\n"), volume ? 0 : 1);
if (cda) {
if (audio_mode) {
- audio_cda_volume(currprefs.sound_volume_cd >= 0 ? currprefs.sound_volume_cd : currprefs.sound_volume, volume, volume);
+ audio_cda_volume(volume, volume);
} else {
- cda->setvolume(currprefs.sound_volume_cd >= 0 ? currprefs.sound_volume_cd : currprefs.sound_volume, volume, volume);
+ cda->setvolume(volume, volume);
}
}
}
cfgfile_write_str (f, _T("sound_interpol"), interpolmode[p->sound_interpol]);
cfgfile_write_str (f, _T("sound_filter"), soundfiltermode1[p->sound_filter]);
cfgfile_write_str (f, _T("sound_filter_type"), soundfiltermode2[p->sound_filter_type]);
- cfgfile_write (f, _T("sound_volume"), _T("%d"), p->sound_volume);
+ cfgfile_write (f, _T("sound_volume"), _T("%d"), p->sound_volume_master);
+ cfgfile_write (f, _T("sound_volume_paula"), _T("%d"), p->sound_volume_paula);
if (p->sound_volume_cd >= 0)
cfgfile_write (f, _T("sound_volume_cd"), _T("%d"), p->sound_volume_cd);
+ if (p->sound_volume_board >= 0)
+ cfgfile_write (f, _T("sound_volume_ahi"), _T("%d"), p->sound_volume_board);
cfgfile_write_bool (f, _T("sound_auto"), p->sound_auto);
cfgfile_write_bool (f, _T("sound_cdaudio"), p->sound_cdaudio);
cfgfile_write_bool (f, _T("sound_stereo_swap_paula"), p->sound_stereo_swap_paula);
else
cfgfile_dwrite (f, _T("catweasel"), _T("%d"), p->catweasel);
cfgfile_write_bool(f, _T("toccata"), p->sound_toccata);
-
+ if (p->sound_toccata_mixer)
+ cfgfile_write_bool(f, _T("toccata_mixer"), p->sound_toccata_mixer);
cfgfile_write_str (f, _T("kbd_lang"), (p->keyboard_lang == KBD_LANG_DE ? _T("de")
: p->keyboard_lang == KBD_LANG_DK ? _T("dk")
|| cfgfile_intval (option, value, _T("state_replay_buffers"), &p->statecapturebuffersize, 1)
|| cfgfile_yesno (option, value, _T("state_replay_autoplay"), &p->inprec_autoplay)
|| cfgfile_intval (option, value, _T("sound_frequency"), &p->sound_freq, 1)
- || cfgfile_intval (option, value, _T("sound_volume"), &p->sound_volume, 1)
+ || cfgfile_intval (option, value, _T("sound_volume"), &p->sound_volume_master, 1)
+ || cfgfile_intval (option, value, _T("sound_volume_paula"), &p->sound_volume_paula, 1)
|| cfgfile_intval (option, value, _T("sound_volume_cd"), &p->sound_volume_cd, 1)
+ || cfgfile_intval (option, value, _T("sound_volume_ahi"), &p->sound_volume_board, 1)
|| cfgfile_intval (option, value, _T("sound_stereo_separation"), &p->sound_stereo_separation, 1)
|| cfgfile_intval (option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1)
|| cfgfile_intval (option, value, _T("sampler_frequency"), &p->sampler_freq, 1)
|| cfgfile_yesno (option, value, _T("floppy_write_protect"), &p->floppy_read_only)
|| cfgfile_yesno (option, value, _T("uae_hide_autoconfig"), &p->uae_hide_autoconfig)
|| cfgfile_yesno (option, value, _T("toccata"), &p->sound_toccata)
+ || cfgfile_yesno (option, value, _T("toccata_mixer"), &p->sound_toccata_mixer)
|| cfgfile_yesno (option, value, _T("uaeserial"), &p->uaeserial))
return 1;
p->maprom = 0;
p->cachesize = 0;
p->socket_emu = 0;
- p->sound_volume = 0;
+ p->sound_volume_master = 0;
+ p->sound_volume_paula = 0;
p->sound_volume_cd = 0;
p->clipboard_sharing = false;
p->ppc_mode = 0;
typedef void (*CDA_CALLBACK)(int);
extern void audio_cda_new_buffer(uae_s16 *buffer, int length, int userdata, CDA_CALLBACK next_cd_audio_buffer_callback);
-extern void audio_cda_volume(int master, int left, int right);
+extern void audio_cda_volume(int left, int right);
+
+extern int sound_cd_volume[2];
+extern int sound_paula_volume[2];
#define AUDIO_CHANNELS_PAULA 4
#define AUDIO_CHANNELS_MAX 8
int sound_interpol;
int sound_filter;
int sound_filter_type;
- int sound_volume;
+ int sound_volume_master;
+ int sound_volume_paula;
int sound_volume_cd;
+ int sound_volume_board;
bool sound_stereo_swap_paula;
bool sound_stereo_swap_ahi;
bool sound_auto;
bool uae_hide_autoconfig;
int z3_mapping_mode;
bool sound_toccata;
+ bool sound_toccata_mixer;
int mountitems;
struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE];
void sndboard_rethink(void);
void update_sndboard_sound(double);
void sndboard_reset(void);
+void sndboard_ext_volume(void);
+
cda_bufon[bufnum] = 1;
ioctl_next_cd_audio_buffer_callback(1 - bufnum);
}
- audio_cda_volume(currprefs.sound_volume_cd >= 0 ? currprefs.sound_volume_cd : currprefs.sound_volume, ciw->cdda_volume[0], ciw->cdda_volume[1]);
+ audio_cda_volume(ciw->cdda_volume[0], ciw->cdda_volume[1]);
cda_bufon[bufnum] = 1;
} else {
cda_bufon[bufnum] = 1;
- cda->setvolume (currprefs.sound_volume_cd >= 0 ? currprefs.sound_volume_cd : currprefs.sound_volume, ciw->cdda_volume[0], ciw->cdda_volume[1]);
+ cda->setvolume (ciw->cdda_volume[0], ciw->cdda_volume[1]);
if (!cda->play (bufnum)) {
setstate (ciw, AUDIO_STATUS_PLAY_ERROR);
goto end; // data track?
#include "options.h"
#include "dxwrap.h"
+#include "audio.h"
#include <dsound.h>
#include <mmreg.h>
#endif
}
-void cda_audio::setvolume(int master, int left, int right)
+void cda_audio::setvolume(int left, int right)
{
for (int j = 0; j < 2; j++) {
volume[j] = j == 0 ? left : right;
- volume[j] = (100 - master) * volume[j] / 100;
+ volume[j] = sound_cd_volume[j] * volume[j] / 32768;
if (volume[j])
volume[j]++;
+ volume[j] = volume[j] * (100 - currprefs.sound_volume_master) / 100;
if (volume[j] >= 32768)
volume[j] = 32768;
}
cda_audio(int num_sectors, int sectorsize, int samplerate);
~cda_audio();
- void setvolume(int master, int left, int right);
+ void setvolume(int left, int right);
bool play(int bufnum);
void wait(void);
void wait(int bufnum);
#define IDC_SOUNDSTYLE1 1245
#define IDC_SOUNDINTERPOLATION 1248
#define IDC_INTERPOLATION0 1249
+#define IDC_SOUNDVOLUMESELECT 1249
#define IDC_INTERPOLATION1 1250
#define IDC_INTERPOLATION2 1251
#define IDC_STEREOMODE 1252
#define IDC_SOUNDBUFFERMEM 1577
#define IDC_HARDFLUSH 1578
#define IDC_SOUNDADJUSTNUM 1578
-#define IDC_SOUNDVOLUMECD 1578
+#define IDC_SOUNDVOLUMEEXT 1578
#define IDC_CONSTJUMP 1579
#define IDC_SOUNDDRIVEVOLUME 1579
#define IDC_JITFPU 1580
#define IDC_NOFLAGS 1581
#define IDC_SOUNDDRIVEVOLUME2 1581
#define IDC_CS_CACHE_TEXT 1582
-#define IDC_SOUNDVOLUMECD2 1582
+#define IDC_SOUNDVOLUMEEXT2 1582
#define IDC_CS_CACHE_TEXT2 1583
#define IDC_COLLISIONS 1584
#define IDC_JITENABLE 1584
#define IDC_CS_TOCCATA 1773
#define IDC_DF1ENABLE 1774
#define IDC_FS_SELECT_DIR 1774
+#define IDC_CS_TOCCATAMIXER 1774
#define IDC_FS_SELECT_FILE 1775
#define IDC_FLOPPY_FFS 1775
#define IDC_DF2ENABLE 1776
CONTROL "Disabled, but emulated",IDC_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,53,107,10
CONTROL "Enabled",IDC_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,71,108,10
CONTROL "Automatic switching",IDC_SOUND_AUTO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,13,92,108,10
- GROUPBOX "Master Volume",IDC_STATIC,139,19,255,69
- RTEXT "Paula/AHI",IDC_STATIC,152,38,51,10,SS_CENTERIMAGE
- CONTROL "",IDC_SOUNDVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,32,105,20
- EDITTEXT IDC_SOUNDVOLUME2,329,35,48,12,ES_CENTER | ES_READONLY
- RTEXT "CD",IDC_STATIC,152,67,51,10,SS_CENTERIMAGE
- CONTROL "",IDC_SOUNDVOLUMECD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,61,105,20
- EDITTEXT IDC_SOUNDVOLUMECD2,329,64,48,12,ES_CENTER | ES_READONLY
+ GROUPBOX "Volume",IDC_STATIC,139,19,255,69
+ RTEXT "Master",IDC_STATIC,160,38,51,10,SS_CENTERIMAGE
+ CONTROL "",IDC_SOUNDVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,215,32,105,20
+ EDITTEXT IDC_SOUNDVOLUME2,337,35,48,12,ES_CENTER | ES_READONLY
+ CONTROL "",IDC_SOUNDVOLUMEEXT,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,215,61,105,20
+ EDITTEXT IDC_SOUNDVOLUMEEXT2,337,64,48,12,ES_CENTER | ES_READONLY
GROUPBOX "Sound Buffer Size",IDC_STATIC,140,90,254,42
CONTROL "Slider1",IDC_SOUNDBUFFERRAM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,106,105,20
EDITTEXT IDC_SOUNDBUFFERMEM,329,109,48,12,ES_CENTER | ES_READONLY
CONTROL "OpenAL",IDC_SOUND_OPENAL,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,253,98,10
CONTROL "PortAudio",IDC_SOUND_PORTAUDIO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,266,98,10
CONTROL "Include CD and FMV audio",IDC_SOUND_CDPAULAMIX,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,13,108,108,10
+ COMBOBOX IDC_SOUNDVOLUMESELECT,147,65,64,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_LOADSAVE DIALOGEX 0, 0, 396, 318
COMBOBOX IDC_NETDEVICE,202,256,178,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "CD32 Full Motion Video cartridge",IDC_CS_CD32FMV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,242,151,11
CONTROL "Toccata Z2 sound card emulation",IDC_CS_TOCCATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,255,151,11
+ CONTROL "Toccata Paula audio mix",IDC_CS_TOCCATAMIXER,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,268,151,11
END
IDD_INPUTMAP DIALOGEX 0, 0, 421, 341
}
return 1;
case RP_IPC_TO_GUEST_VOLUME:
- currprefs.sound_volume = changed_prefs.sound_volume = 100 - wParam;
+ currprefs.sound_volume_master = changed_prefs.sound_volume_master = 100 - wParam;
currprefs.sound_volume_cd = changed_prefs.sound_volume_cd = 100 - wParam;
- set_volume (currprefs.sound_volume, 0);
+ set_volume (currprefs.sound_volume_master, 0);
return TRUE;
case RP_IPC_TO_GUEST_ESCAPEKEY:
rp_rpescapekey = wParam;
{
if (!cando ())
return;
- RPSendMessagex (RP_IPC_TO_HOST_VOLUME, (WPARAM)(100 - p->sound_volume), 0, NULL, 0, &guestinfo, NULL);
+ RPSendMessagex (RP_IPC_TO_HOST_VOLUME, (WPARAM)(100 - p->sound_volume_master), 0, NULL, 0, &guestinfo, NULL);
}
void rp_pause (int paused)
if (ch != sdp->channels)
currprefs.sound_stereo = changed_prefs.sound_stereo = get_audio_stereomode (sdp->channels);
- set_volume (currprefs.sound_volume, sdp->mute);
+ set_volume (currprefs.sound_volume_master, sdp->mute);
if (get_audio_amigachannels (currprefs.sound_stereo) == 4)
sample_handler = sample16ss_handler;
else
sdp->mute = sdp->mute ? 0 : 1;
else
sdp->mute = newmute;
- set_volume (currprefs.sound_volume, sdp->mute);
+ set_volume (currprefs.sound_volume_master, sdp->mute);
config_changed = 1;
}
void sound_volume (int dir)
{
- currprefs.sound_volume -= dir * 10;
+ currprefs.sound_volume_master -= dir * 10;
currprefs.sound_volume_cd -= dir * 10;
- if (currprefs.sound_volume < 0)
- currprefs.sound_volume = 0;
- if (currprefs.sound_volume > 100)
- currprefs.sound_volume = 100;
- changed_prefs.sound_volume = currprefs.sound_volume;
+ if (currprefs.sound_volume_master < 0)
+ currprefs.sound_volume_master = 0;
+ if (currprefs.sound_volume_master > 100)
+ currprefs.sound_volume_master = 100;
+ changed_prefs.sound_volume_master = currprefs.sound_volume_master;
if (currprefs.sound_volume_cd < 0)
currprefs.sound_volume_cd = 0;
if (currprefs.sound_volume_cd > 100)
currprefs.sound_volume_cd = 100;
changed_prefs.sound_volume_cd = currprefs.sound_volume_cd;
- set_volume (currprefs.sound_volume, sdp->mute);
+ set_volume (currprefs.sound_volume_master, sdp->mute);
config_changed = 1;
}
void master_sound_volume (int dir)
ShowWindow (GetDlgItem(hDlg, IDC_CS_SCSIMODE), SW_HIDE);
ew(hDlg, IDC_CS_CD32FMV, en);
ew(hDlg, IDC_CS_TOCCATA, en);
+ ew(hDlg, IDC_CS_TOCCATAMIXER, en && workprefs.sound_toccata);
ew (hDlg, IDC_CS_SCSIMODE, FALSE);
}
CheckDlgButton (hDlg, IDC_A2065, workprefs.a2065name[0] ? 1 : 0);
CheckDlgButton(hDlg, IDC_CS_CD32FMV, workprefs.cs_cd32fmv);
CheckDlgButton(hDlg, IDC_CS_TOCCATA, workprefs.sound_toccata);
+ CheckDlgButton(hDlg, IDC_CS_TOCCATAMIXER, workprefs.sound_toccata_mixer);
CheckDlgButton(hDlg, IDC_CS_SCSIMODE, workprefs.scsi == 2);
SendDlgItemMessage (hDlg, IDC_RTG_BUFFERCNT, CB_SETCURSEL, workprefs.gfx_apmode[1].gfx_backbuffers == 0 ? 0 : workprefs.gfx_apmode[1].gfx_backbuffers - 1, 0);
cw = catweasel_detect ();
break;
case IDC_CS_TOCCATA:
workprefs.sound_toccata = ischecked(hDlg, IDC_CS_TOCCATA) ? 1 : 0;
+ if (!workprefs.sound_toccata)
+ workprefs.sound_toccata_mixer = false;
+ enable_for_expansiondlg(hDlg);
+ break;
+ case IDC_CS_TOCCATAMIXER:
+ workprefs.sound_toccata_mixer = ischecked(hDlg, IDC_CS_TOCCATAMIXER) ? 1 : 0;
break;
}
if (HIWORD (wParam) == CBN_SELENDOK || HIWORD (wParam) == CBN_KILLFOCUS || HIWORD (wParam) == CBN_EDITCHANGE) {
ew (hDlg, IDC_SOUNDINTERPOLATION, workprefs.produce_sound);
ew (hDlg, IDC_SOUNDVOLUME, workprefs.produce_sound);
ew (hDlg, IDC_SOUNDVOLUME2, workprefs.produce_sound);
- ew (hDlg, IDC_SOUNDVOLUMECD, workprefs.produce_sound);
- ew (hDlg, IDC_SOUNDVOLUMECD2, workprefs.produce_sound);
+ ew (hDlg, IDC_SOUNDVOLUMEEXT, workprefs.produce_sound);
+ ew (hDlg, IDC_SOUNDVOLUMEEXT2, workprefs.produce_sound);
ew (hDlg, IDC_SOUNDSTEREOSEP, workprefs.sound_stereo > 0 && workprefs.produce_sound);
ew (hDlg, IDC_SOUNDSTEREOMIX, workprefs.sound_stereo > 0 && workprefs.produce_sound);
extern int soundpercent;
static const int sndbufsizes[] = { 1024, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 32768, 65536, -1 };
+static int *volumeselection, volumeselectionindex;
static int getsoundbufsizeindex (int size)
{
_stprintf (txt, _T("%d"), bufsize);
SetDlgItemText (hDlg, IDC_SOUNDBUFFERMEM, txt);
- SendDlgItemMessage (hDlg, IDC_SOUNDVOLUME, TBM_SETPOS, TRUE, 100 - workprefs.sound_volume);
- _stprintf (txt, _T("%d%%"), 100 - workprefs.sound_volume);
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUME, TBM_SETPOS, TRUE, 100 - workprefs.sound_volume_master);
+ _stprintf (txt, _T("%d%%"), 100 - workprefs.sound_volume_master);
SetDlgItemText (hDlg, IDC_SOUNDVOLUME2, txt);
- SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMECD, TBM_SETPOS, TRUE, 100 - workprefs.sound_volume_cd);
- _stprintf (txt, _T("%d%%"), 100 - workprefs.sound_volume_cd);
- SetDlgItemText (hDlg, IDC_SOUNDVOLUMECD2, txt);
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMEEXT, TBM_SETPOS, TRUE, 100 - (*volumeselection));
+ _stprintf (txt, _T("%d%%"), 100 - (*volumeselection));
+ SetDlgItemText (hDlg, IDC_SOUNDVOLUMEEXT2, txt);
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVEVOLUME, TBM_SETPOS, TRUE, 100 - workprefs.dfxclickvolume);
_stprintf (txt, _T("%d%%"), 100 - workprefs.dfxclickvolume);
SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETPOS, TRUE, getsoundbufsizeindex (workprefs.sound_maxbsiz));
SendDlgItemMessage (hDlg, IDC_SOUNDVOLUME, TBM_SETPOS, TRUE, 0);
- SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMECD, TBM_SETPOS, TRUE, 0);
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMEEXT, TBM_SETPOS, TRUE, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVEVOLUME, TBM_SETPOS, TRUE, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDCARDLIST, CB_SETCURSEL, workprefs.win32_soundcard, 0);
workprefs.sound_stereo_swap_paula = (SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_GETCURSEL, 0, 0) & 1) ? 1 : 0;
workprefs.sound_stereo_swap_ahi = (SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_GETCURSEL, 0, 0) & 2) ? 1 : 0;
+ idx = SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMESELECT, CB_GETCURSEL, 0, 0);
+ if (idx != volumeselectionindex) {
+ volumeselectionindex = idx;
+ if (volumeselectionindex < 0 || volumeselectionindex > 2)
+ volumeselectionindex = 0;
+ if (volumeselectionindex == 1)
+ volumeselection = &workprefs.sound_volume_cd;
+ else if (volumeselectionindex == 2)
+ volumeselection = &workprefs.sound_volume_board;
+ else
+ volumeselection = &workprefs.sound_volume_paula;
+ update_soundgui (hDlg);
+ }
+
for (i = 0; sounddrivers[i]; i++) {
int old = sounddrivermask;
sounddrivermask &= ~(1 << i);
SendDlgItemMessage (hDlg, IDC_SOUNDVOLUME, TBM_SETRANGE, TRUE, MAKELONG (0, 100));
SendDlgItemMessage (hDlg, IDC_SOUNDVOLUME, TBM_SETPAGESIZE, 0, 1);
- SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMECD, TBM_SETRANGE, TRUE, MAKELONG (0, 100));
- SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMECD, TBM_SETPAGESIZE, 0, 1);
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMEEXT, TBM_SETRANGE, TRUE, MAKELONG (0, 100));
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMEEXT, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVEVOLUME, TBM_SETRANGE, TRUE, MAKELONG (0, 100));
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVEVOLUME, TBM_SETPAGESIZE, 0, 1);
CheckDlgButton (hDlg, sounddrivers[i], (sounddrivermask & (1 << i)) ? TRUE : FALSE);
}
+ if (!volumeselection) {
+ volumeselection = &workprefs.sound_volume_paula;
+ volumeselectionindex = 0;
+ }
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMESELECT, CB_RESETCONTENT, 0, 0L);
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMESELECT, CB_ADDSTRING, 0, (LPARAM)_T("Paula"));
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMESELECT, CB_ADDSTRING, 0, (LPARAM)_T("CD"));
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMESELECT, CB_ADDSTRING, 0, (LPARAM)_T("AHI"));
+ SendDlgItemMessage (hDlg, IDC_SOUNDVOLUMESELECT, CB_SETCURSEL, volumeselectionindex, 0);
+
SendDlgItemMessage (hDlg, IDC_SOUNDCARDLIST, CB_RESETCONTENT, 0, 0L);
numdevs = enumerate_sound_devices ();
for (card = 0; card < numdevs; card++) {
if (v >= 0)
workprefs.sound_maxbsiz = sndbufsizes[v];
}
- workprefs.sound_volume = 100 - SendMessage (GetDlgItem (hDlg, IDC_SOUNDVOLUME), TBM_GETPOS, 0, 0);
- workprefs.sound_volume_cd = 100 - SendMessage (GetDlgItem (hDlg, IDC_SOUNDVOLUMECD), TBM_GETPOS, 0, 0);
+ workprefs.sound_volume_master = 100 - SendMessage (GetDlgItem (hDlg, IDC_SOUNDVOLUME), TBM_GETPOS, 0, 0);
+ (*volumeselection) = 100 - SendMessage (GetDlgItem (hDlg, IDC_SOUNDVOLUMEEXT), TBM_GETPOS, 0, 0);
workprefs.dfxclickvolume = 100 - SendMessage (GetDlgItem (hDlg, IDC_SOUNDDRIVEVOLUME), TBM_GETPOS, 0, 0);
update_soundgui (hDlg);
break;
fifo_read_index = fifo_read_index % FIFO_SIZE;
}
- ch_sample[0] = ch_sample[0] * left_volume / 64;
- ch_sample[1] = ch_sample[1] * right_volume / 64;
+ ch_sample[0] = ch_sample[0] * left_volume / 32768;
+ ch_sample[1] = ch_sample[1] * right_volume / 32768;
if (data_in_fifo < FIFO_SIZE_HALF && prev_data_in_fifo >= FIFO_SIZE_HALF)
fifo_half |= STATUS_FIFO_PLAY;
static int get_volume(uae_u8 v)
{
+ int out;
if (v & 0x80) // Mute bit
return 0;
- v &= 63;
- v = 64 - v;
- return v;
+ out = v & 63;
+ out = 64 - out;
+ out *= 32768 / 64;
+ return out;
+}
+
+static int get_volume_in(uae_u8 v)
+{
+ int out;
+ if (v & 0x80) // Mute bit
+ return 0;
+ out = v & 31;
+ out = 32 - out;
+ out *= 32768 / 32;
+ return out;
}
static void calculate_volume(void)
{
left_volume = get_volume(ad1848_regs[6]);
right_volume = get_volume(ad1848_regs[7]);
+ left_volume = (100 - currprefs.sound_volume_board) * 32768 / 100;
+ right_volume = (100 - currprefs.sound_volume_board) * 32768 / 100;
+
+ if (currprefs.sound_toccata_mixer) {
+ sound_paula_volume[0] = get_volume_in(ad1848_regs[4]);
+ sound_paula_volume[1] = get_volume_in(ad1848_regs[5]);
+ }
+}
+
+void sndboard_ext_volume(void)
+{
+ calculate_volume();
}
static const int freq_crystals[] = {
void sndboard_vsync(void)
{
+ if (toccata_active)
+ calculate_volume();
}
static void toccata_put(uaecptr addr, uae_u8 v)
else if ((old & 3) && !(v & 3))
codec_stop();
break;
+
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
case 7:
case 8:
calculate_volume();