effective volume to audio widget added

fixed parser return value for "$a"
This commit is contained in:
thrust26 2017-12-01 20:57:14 +01:00
parent 6c210a9f43
commit b6fa51d97b
5 changed files with 44 additions and 8 deletions

View File

@ -806,11 +806,13 @@ reflecting this result.</p>
<br>
<h2><u>(D)</u> Audio Tab</h2>
<p>This tab lets you view the contents of the TIA audio registers. This tab
will grow some features in a future release.</p>
<p>This tab lets you view the contents of the TIA audio registers and the effective
volume resulting from the two channel volumes.</p>
<p><img src="graphics/debugger_audiotab.png"></p>
<p>This tab will grow some features in a future release.</p>
<!-- ///////////////////////////////////////////////////////////////////////// -->
<br>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -234,7 +234,7 @@ int DebuggerParser::decipher_arg(const string& str)
// Special cases (registers):
const CpuState& state = static_cast<const CpuState&>(debugger.cpuDebug().getState());
if(arg == "a") result = state.A;
if(arg == "a" && str != "$a") result = state.A;
else if(arg == "x") result = state.X;
else if(arg == "y") result = state.Y;
else if(arg == "p") result = state.PS;

View File

@ -22,6 +22,8 @@
#include "Debugger.hxx"
#include "TIADebug.hxx"
#include "Widget.hxx"
#include "Base.hxx"
using Common::Base;
#include "AudioWidget.hxx"
@ -50,7 +52,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
for(int col = 0; col < 2; ++col)
{
new StaticTextWidget(boss, lfont, xpos + col * myAudF->colWidth() + (int)(myAudF->colWidth() / 2.5),
new StaticTextWidget(boss, lfont, xpos + col * myAudF->colWidth() + (int)(myAudF->colWidth() / 2.75),
ypos - lineHeight, fontWidth, fontHeight,
Common::Base::toString(col, Common::Base::F_16_1),
kTextAlignLeft);
@ -61,8 +63,8 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight,
"AUDC", kTextAlignLeft);
xpos += lwidth;
myAudC = new DataGridWidget(boss, nfont, xpos, ypos,
2, 1, 2, 4, Common::Base::F_16);
myAudC = new DataGridWidget(boss, nfont, xpos + (int)(myAudF->colWidth() / 2.75), ypos,
2, 1, 1, 4, Common::Base::F_16_1);
myAudC->setTarget(this);
myAudC->setID(kAUDCID);
addFocusWidget(myAudC);
@ -72,11 +74,14 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight,
"AUDV", kTextAlignLeft);
xpos += lwidth;
myAudV = new DataGridWidget(boss, nfont, xpos, ypos,
2, 1, 2, 4, Common::Base::F_16);
myAudV = new DataGridWidget(boss, nfont, xpos + (int)(myAudF->colWidth() / 2.75), ypos,
2, 1, 1, 4, Common::Base::F_16_1);
myAudV->setTarget(this);
myAudV->setID(kAUDVID);
addFocusWidget(myAudV);
myAudEffV = new StaticTextWidget(boss, lfont, myAudV->getRight() + fontWidth, myAudV->getTop() + 2,
"100% (eff. volume)");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -120,6 +125,17 @@ void AudioWidget::loadConfig()
changed.push_back(state.aud[i] != oldstate.aud[i]);
}
myAudV->setList(alist, vlist, changed);
handleVolume();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioWidget::handleVolume()
{
stringstream s;
s << getEffectiveVolume() << "% (eff. volume)";
myAudEffV->setLabel(s.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -202,4 +218,18 @@ void AudioWidget::changeVolumeRegs()
instance().debugger().tiaDebug().audV1(value);
break;
}
handleVolume();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 AudioWidget::getEffectiveVolume()
{
const int EFF_VOL[] = {
0, 6, 13, 18, 24, 29, 33, 38,
42, 46, 50, 54, 57, 60, 64, 67,
70, 72, 75, 78, 80, 82, 85, 87,
89, 91, 93, 95, 97, 98,100};
return EFF_VOL[instance().debugger().tiaDebug().audV0() +
instance().debugger().tiaDebug().audV1()];
}

View File

@ -43,6 +43,7 @@ class AudioWidget : public Widget, public CommandSender
DataGridWidget* myAudF;
DataGridWidget* myAudC;
DataGridWidget* myAudV;
StaticTextWidget* myAudEffV;
// Audio channels
enum
@ -58,6 +59,9 @@ class AudioWidget : public Widget, public CommandSender
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void loadConfig() override;
void handleVolume();
uInt32 getEffectiveVolume();
// Following constructors and assignment operators not supported
AudioWidget() = delete;
AudioWidget(const AudioWidget&) = delete;