Skip to content

Commit

Permalink
Implemented more Volume sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Dec 21, 2020
1 parent 1048b94 commit 8b847c4
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/osdep/ahi_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static int ahi_init_record_win32 (void)
return 0;
}

void setvolume_ahi (LONG vol)
void setvolume_ahi (int vol)
{
#if 0
HRESULT hr;
Expand Down
2 changes: 1 addition & 1 deletion src/osdep/amiberry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,7 @@ void* uaenative_get_uaevar(void)
#ifdef _WIN32
uaevar.amigawnd = mon->hAmigaWnd;
#endif
uaevar.z3offset = (uae_u32)get_real_address(z3fastmem_bank[0].start) - z3fastmem_bank[0].start;
//uaevar.z3offset = uae_u32(get_real_address(z3fastmem_bank[0].start)) - z3fastmem_bank[0].start;
return &uaevar;
}

Expand Down
11 changes: 5 additions & 6 deletions src/osdep/clipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "traps.h"
#ifdef AMIBERRY
#ifndef _WIN32
typedef int HWND;
typedef int HDC;
typedef int HGLOBAL;
typedef unsigned int UINT;
Expand Down Expand Up @@ -48,7 +47,7 @@ static char* clipboard_to_host_text;

int clipboard_debug;

static HWND chwnd;
static int chwnd;
static HDC hdc;
static uaecptr clipboard_data;
static int vdelay, vdelay2;
Expand Down Expand Up @@ -764,7 +763,7 @@ void clipboard_disable(bool disabled)
clip_disabled = disabled;
}

static void clipboard_read(TrapContext* ctx, HWND hwnd, bool keyboardinject)
static void clipboard_read(TrapContext* ctx, int hwnd, bool keyboardinject)
{
HGLOBAL hglb;
UINT f;
Expand Down Expand Up @@ -889,7 +888,7 @@ static void clipboard_free_delayed(void)
clipboard_delayed_size = 0;
}

void clipboard_changed(HWND hwnd)
void clipboard_changed(int hwnd)
{
#if DEBUG_CLIP > 0
write_log (_T("clipboard: windows clipboard changed message\n"));
Expand Down Expand Up @@ -1066,7 +1065,7 @@ int amiga_clipboard_want_data(TrapContext* ctx)
return 1;
}

void clipboard_active(HWND hwnd, int active)
void clipboard_active(int hwnd, int active)
{
clipactive = active;
if (!initialized || !hwnd)
Expand Down Expand Up @@ -1155,7 +1154,7 @@ void clipboard_reset(void)
#ifdef AMIBERRY
void clipboard_init(void)
{
chwnd = static_cast<HWND>(1); // fake window handle
chwnd = 1; // fake window handle
write_log(_T("clipboard_init\n"));
clipboard_from_host_mutex = SDL_CreateMutex();
clipboard_from_host_text = strdup("");
Expand Down
18 changes: 10 additions & 8 deletions src/osdep/gui/Navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,24 @@ static NavigationMap navMap[] =

// active move left move right move up move down
//PanelSound
{ "sndDisable", "Sound", "sldPaulaVol", "sldFloppySoundDisk", "sndDisEmu" },
{ "sndDisEmu", "Sound", "sldPaulaVol", "sndDisable", "sndEmulate" },
{ "sndEmulate", "Sound", "sldPaulaVol", "sndDisEmu", "sndEmuBest" },
{ "sndEmuBest", "Sound", "sldPaulaVol", "sndEmulate", "cboChannelMode" },
{ "sndDisable", "Sound", "sldMasterVol", "sldFloppySoundDisk", "sndDisEmu" },
{ "sndDisEmu", "Sound", "sldMasterVol", "sndDisable", "sndEmulate" },
{ "sndEmulate", "Sound", "sldMasterVol", "sndDisEmu", "sndEmuBest" },
{ "sndEmuBest", "Sound", "sldMasterVol", "sndEmulate", "cboChannelMode" },
{ "cboChannelMode", "Sound", "cboSeparation", "sndEmuBest", "cboFrequency" },
{ "cboFrequency", "Sound", "cboStereoDelay", "cboChannelMode", "chkFloppySound" },
{ "cboInterpol", "cboSeparation", "Sound", "sldCDVol", "cboFilter" },
{ "cboInterpol", "cboSeparation", "Sound", "sldAHIVol", "cboFilter" },
{ "cboFilter", "cboStereoDelay", "Sound", "cboInterpol", "sldSoundBufferSize" },
{ "cboSeparation", "cboChannelMode", "cboInterpol", "sndEmuBest", "cboStereoDelay" },
{ "cboStereoDelay", "cboFrequency", "cboFilter", "cboSeparation", "chkFloppySound" },
{ "sldPaulaVol", "", "", "sldSoundBufferSize", "sldCDVol" },
{ "sldCDVol", "", "", "sldPaulaVol", "cboInterpol" },
{ "sldMasterVol", "", "", "sldSoundBufferSize", "sldPaulaVol"},
{ "sldPaulaVol", "", "", "sldMasterVol", "sldCDVol" },
{ "sldCDVol", "", "", "sldPaulaVol", "sldAHIVol" },
{ "sldAHIVol", "", "", "sldCDVol", "cboInterpol"},
{ "chkFloppySound", "Sound", "sldSoundBufferSize", "cboFrequency", "sldFloppySoundEmpty"},
{ "sldFloppySoundEmpty", "", "", "chkFloppySound", "sldFloppySoundDisk"},
{ "sldFloppySoundDisk", "", "", "sldFloppySoundEmpty", "sndDisable"},
{ "sldSoundBufferSize", "", "", "cboFilter", "sldPaulaVol"},
{ "sldSoundBufferSize", "", "", "cboFilter", "sldMasterVol"},

// active move left move right move up move down
// PanelInput
Expand Down
108 changes: 87 additions & 21 deletions src/osdep/gui/PanelSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ static gcn::DropDown* cboSeparation;
static gcn::Label* lblStereoDelay;
static gcn::DropDown* cboStereoDelay;
static gcn::Window* grpVolume;
static gcn::Label* lblMasterVol;
static gcn::Label* lblMasterVolInfo;
static gcn::Slider* sldMasterVol;
static gcn::Label* lblPaulaVol;
static gcn::Label* lblPaulaVolInfo;
static gcn::Slider* sldPaulaVol;
static gcn::Label* lblCDVol;
static gcn::Label* lblCDVolInfo;
static gcn::Slider* sldCDVol;
static gcn::Label* lblAHIVol;
static gcn::Label* lblAHIVolInfo;
static gcn::Slider* sldAHIVol;
static gcn::Window* grpFloppySound;
static gcn::CheckBox* chkFloppySound;
static gcn::Label* lblFloppySoundEmpty;
Expand Down Expand Up @@ -331,6 +337,12 @@ class SoundActionListener : public gcn::ActionListener
changed_prefs.sound_mixed_stereo_delay = -1;
}
}
else if (actionEvent.getSource() == sldMasterVol)
{
const auto newvol = 100 - static_cast<int>(sldMasterVol->getValue());
if (changed_prefs.sound_volume_master != newvol)
changed_prefs.sound_volume_master = newvol;
}
else if (actionEvent.getSource() == sldPaulaVol)
{
const auto newvol = 100 - static_cast<int>(sldPaulaVol->getValue());
Expand All @@ -343,7 +355,12 @@ class SoundActionListener : public gcn::ActionListener
if (changed_prefs.sound_volume_cd != newvol)
changed_prefs.sound_volume_cd = newvol;
}

else if (actionEvent.getSource() == sldAHIVol)
{
const auto newvol = 100 - static_cast<int>(sldAHIVol->getValue());
if (changed_prefs.sound_volume_board != newvol)
changed_prefs.sound_volume_board = newvol;
}
else if (actionEvent.getSource() == chkFloppySound)
{
for (auto& floppyslot : changed_prefs.floppyslots)
Expand Down Expand Up @@ -462,6 +479,17 @@ void InitPanelSound(const struct _ConfigCategory& category)
cboStereoDelay->setId("cboStereoDelay");
cboStereoDelay->addActionListener(sound_action_listener);

lblMasterVol = new gcn::Label("Master Volume:");
lblMasterVol->setAlignment(gcn::Graphics::RIGHT);
sldMasterVol = new gcn::Slider(0, 100);
sldMasterVol->setSize(150, SLIDER_HEIGHT);
sldMasterVol->setBaseColor(gui_baseCol);
sldMasterVol->setMarkerLength(20);
sldMasterVol->setStepLength(10);
sldMasterVol->setId("sldMasterVol");
sldMasterVol->addActionListener(sound_action_listener);
lblMasterVolInfo = new gcn::Label("100 %");

lblPaulaVol = new gcn::Label("Paula Volume:");
lblPaulaVol->setAlignment(gcn::Graphics::RIGHT);
sldPaulaVol = new gcn::Slider(0, 100);
Expand All @@ -484,6 +512,17 @@ void InitPanelSound(const struct _ConfigCategory& category)
sldCDVol->addActionListener(sound_action_listener);
lblCDVolInfo = new gcn::Label("80 %");

lblAHIVol = new gcn::Label("AHI Volume:");
lblAHIVol->setAlignment(gcn::Graphics::RIGHT);
sldAHIVol = new gcn::Slider(0, 100);
sldAHIVol->setSize(150, SLIDER_HEIGHT);
sldAHIVol->setBaseColor(gui_baseCol);
sldAHIVol->setMarkerLength(20);
sldAHIVol->setStepLength(10);
sldAHIVol->setId("sldAHIVol");
sldAHIVol->addActionListener(sound_action_listener);
lblAHIVolInfo = new gcn::Label("100 %");

chkFloppySound = new gcn::CheckBox("Enable floppy drive sound");
chkFloppySound->setId("chkFloppySound");
chkFloppySound->addActionListener(sound_action_listener);
Expand Down Expand Up @@ -528,12 +567,18 @@ void InitPanelSound(const struct _ConfigCategory& category)
grpSound->setBaseColor(gui_baseCol);

grpVolume = new gcn::Window("Volume");
grpVolume->add(lblPaulaVol, 10, 10);
grpVolume->add(sldPaulaVol, lblPaulaVol->getX() + lblPaulaVol->getWidth() + 10, lblPaulaVol->getY());
grpVolume->add(lblMasterVol, 10, 10);
grpVolume->add(sldMasterVol, lblMasterVol->getX() + lblMasterVol->getWidth() + 8, lblMasterVol->getY());
grpVolume->add(lblMasterVolInfo, sldMasterVol->getX() + sldMasterVol->getWidth() + 8, sldMasterVol->getY());
grpVolume->add(lblPaulaVol, lblMasterVol->getX(), lblMasterVol->getY() + lblMasterVol->getHeight() + DISTANCE_NEXT_Y);
grpVolume->add(sldPaulaVol, sldMasterVol->getX(), lblPaulaVol->getY());
grpVolume->add(lblPaulaVolInfo, sldPaulaVol->getX() + sldPaulaVol->getWidth() + 10, sldPaulaVol->getY());
grpVolume->add(lblCDVol, lblPaulaVol->getX(), lblPaulaVol->getY() + lblPaulaVol->getHeight() + DISTANCE_NEXT_Y);
grpVolume->add(sldCDVol, sldPaulaVol->getX(), lblCDVol->getY());
grpVolume->add(lblCDVolInfo, sldCDVol->getX() + sldCDVol->getWidth() + 10, sldCDVol->getY());
grpVolume->add(lblCDVol, lblMasterVol->getX(), lblPaulaVol->getY() + lblPaulaVol->getHeight() + DISTANCE_NEXT_Y);
grpVolume->add(sldCDVol, sldMasterVol->getX(), lblCDVol->getY());
grpVolume->add(lblCDVolInfo, sldCDVol->getX() + sldCDVol->getWidth() + 8, sldCDVol->getY());
grpVolume->add(lblAHIVol, lblMasterVol->getX(), lblCDVol->getY() + lblCDVol->getHeight() + DISTANCE_NEXT_Y);
grpVolume->add(sldAHIVol, sldMasterVol->getX(), lblAHIVol->getY());
grpVolume->add(lblAHIVolInfo, sldAHIVol->getX() + sldAHIVol->getWidth() + 8, sldAHIVol->getY());
grpVolume->setMovable(false);
grpVolume->setSize(category.panel->getWidth() - DISTANCE_BORDER * 2 - grpSound->getWidth() - DISTANCE_NEXT_X, grpSound->getHeight());
grpVolume->setTitleBarHeight(TITLEBAR_HEIGHT);
Expand Down Expand Up @@ -596,12 +641,18 @@ void ExitPanelSound()
delete optSoundEmulated;
delete optSoundEmulatedBest;
delete grpSound;
delete lblMasterVol;
delete lblMasterVolInfo;
delete sldMasterVol;
delete lblPaulaVol;
delete lblPaulaVolInfo;
delete sldPaulaVol;
delete lblCDVol;
delete lblCDVolInfo;
delete sldCDVol;
delete lblAHIVol;
delete lblAHIVolInfo;
delete sldAHIVol;
delete grpVolume;
delete lblChannelMode;
delete cboChannelMode;
Expand Down Expand Up @@ -721,6 +772,10 @@ void RefreshPanelSound()
cboStereoDelay->setSelected(curr_stereodelay_idx);
cboStereoDelay->setEnabled(changed_prefs.sound_stereo >= 1);

sldMasterVol->setValue(100 - changed_prefs.sound_volume_master);
snprintf(tmp, sizeof tmp - 1, "%d %%", 100 - changed_prefs.sound_volume_master);
lblMasterVolInfo->setCaption(tmp);

sldPaulaVol->setValue(100 - changed_prefs.sound_volume_paula);
snprintf(tmp, sizeof tmp - 1, "%d %%", 100 - changed_prefs.sound_volume_paula);
lblPaulaVolInfo->setCaption(tmp);
Expand All @@ -733,6 +788,10 @@ void RefreshPanelSound()
snprintf(tmp, sizeof tmp - 1, "%d %%", 100 - changed_prefs.sound_volume_cd);
lblCDVolInfo->setCaption(tmp);

sldAHIVol->setValue(100 - changed_prefs.sound_volume_board);
snprintf(tmp, sizeof tmp - 1, "%d %%", 100 - changed_prefs.sound_volume_board);
lblAHIVolInfo->setCaption(tmp);

chkFloppySound->setSelected(changed_prefs.floppyslots[0].dfxclick == 1);

sldFloppySoundEmpty->setValue(100 - changed_prefs.dfxclickvolume_empty[0]);
Expand All @@ -755,21 +814,28 @@ void RefreshPanelSound()
lblSoundBufferSize->setCaption(tmp);
sldSoundBufferSize->setValue(bufsize);
}

cboChannelMode->setEnabled(changed_prefs.produce_sound > 0);
lblFrequency->setEnabled(changed_prefs.produce_sound > 0);
cboFrequency->setEnabled(changed_prefs.produce_sound > 0);
lblInterpolation->setEnabled(changed_prefs.produce_sound > 0);
cboInterpolation->setEnabled(changed_prefs.produce_sound > 0);
lblFilter->setEnabled(changed_prefs.produce_sound > 0);
cboFilter->setEnabled(changed_prefs.produce_sound > 0);
lblSeparation->setEnabled(changed_prefs.produce_sound > 0);
cboSeparation->setEnabled(changed_prefs.produce_sound > 0);
lblStereoDelay->setEnabled(changed_prefs.produce_sound > 0);
cboStereoDelay->setEnabled(changed_prefs.produce_sound > 0);
lblPaulaVol->setEnabled(changed_prefs.produce_sound > 0);
lblPaulaVolInfo->setEnabled(changed_prefs.produce_sound > 0);
sldPaulaVol->setEnabled(changed_prefs.produce_sound > 0);

const auto enabled = changed_prefs.produce_sound > 0;
cboChannelMode->setEnabled(enabled);
lblFrequency->setEnabled(enabled);
cboFrequency->setEnabled(enabled);
lblInterpolation->setEnabled(enabled);
cboInterpolation->setEnabled(enabled);
lblFilter->setEnabled(enabled);
cboFilter->setEnabled(enabled);
lblSeparation->setEnabled(enabled);
cboSeparation->setEnabled(enabled);
lblStereoDelay->setEnabled(enabled);
cboStereoDelay->setEnabled(enabled);
lblPaulaVol->setEnabled(enabled);
lblPaulaVolInfo->setEnabled(enabled);
sldPaulaVol->setEnabled(enabled);
lblMasterVol->setEnabled(enabled);
lblMasterVolInfo->setEnabled(enabled);
sldMasterVol->setEnabled(enabled);
lblAHIVol->setEnabled(enabled);
lblAHIVolInfo->setEnabled(enabled);
sldAHIVol->setEnabled(enabled);
}

bool HelpPanelSound(std::vector<std::string>& helptext)
Expand Down
2 changes: 0 additions & 2 deletions src/osdep/sysconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,6 @@ typedef int32_t uae_atomic;
#define M68K_SPEED_14MHZ_CYCLES 1024
#define M68K_SPEED_25MHZ_CYCLES 128

typedef unsigned int WPARAM;
typedef int LPARAM;
typedef int SOCKET;
#define INVALID_SOCKET -1

Expand Down
15 changes: 6 additions & 9 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ void parallel_exit(void)
#endif
}

#if 0

static void freepsbuffers (void)
{
}
Expand All @@ -179,12 +177,14 @@ static int openprinter_ps (void)
static void *prt_thread (void *p)
{
}
#endif

static int doflushprinter (void)
{
return 0;
}

#if 0
static void openprinter (void);

static void flushprtbuf (void)
Expand All @@ -200,8 +200,6 @@ static void DoSomeWeirdPrintingStuff (uae_char val)
{
}

#endif

int isprinter (void)
{
if (parallel_mode == PARALLEL_MODE_TCP_PRINTER) {
Expand All @@ -215,8 +213,6 @@ int isprinter (void)
return 0;
}

#if 0

int isprinteropen (void)
{
return 0;
Expand All @@ -236,14 +232,15 @@ static void openprinter (void)
{
STUB("");
}
#endif

void flushprinter (void)
{
STUB("");
if (!doflushprinter())
return;
}

#endif

#if 0
void doprinter (uae_u8 val)
{
if (parallel_mode == PARALLEL_MODE_TCP_PRINTER) {
Expand Down
4 changes: 3 additions & 1 deletion src/sounddep/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ static void close_audio_sdl2(struct sound_data* sd)
}
}

extern void setvolume_ahi(int);

void set_volume_sound_device(struct sound_data* sd, int volume, int mute)
{
//todo
Expand All @@ -265,7 +267,7 @@ void set_volume_sound_device(struct sound_data* sd, int volume, int mute)
void set_volume(int volume, int mute)
{
set_volume_sound_device(sdp, volume, mute);
//setvolume_ahi(volume);
setvolume_ahi(volume);
config_changed = 1;
}

Expand Down

0 comments on commit 8b847c4

Please # to comment.