Lua: Renamed DMC "frequency" to "sampleRate" and added clockRate to getState() table.

This commit is contained in:
Sour 2017-12-21 15:37:57 -05:00
parent 6717520cb3
commit e227697531
3 changed files with 4 additions and 3 deletions

View file

@ -216,11 +216,11 @@ ApuDmcState DeltaModulationChannel::GetState()
{
ApuDmcState state;
state.BytesRemaining = _bytesRemaining;
state.Frequency = CPU::GetClockRate(GetNesModel()) / 32.0 / (_period + 1);
state.IrqEnabled = _irqEnabled;
state.Loop = _loopFlag;
state.OutputVolume = _lastOutput;
state.Period = _period;
state.SampleRate = CPU::GetClockRate(GetNesModel()) / (_period + 1);
state.SampleAddr = _sampleAddr;
state.SampleLength = _sampleLength;
return state;

View file

@ -744,6 +744,7 @@ int LuaApi::GetState(lua_State *lua)
lua_newtable(lua);
lua_pushintvalue(region, state.Model);
lua_pushintvalue(clockRate, CPU::GetClockRate(Console::GetModel()));
lua_starttable("cpu");
lua_pushintvalue(a, state.CPU.A);
@ -858,7 +859,7 @@ int LuaApi::GetState(lua_State *lua)
lua_starttable("dmc");
lua_pushintvalue(bytesRemaining, state.APU.Dmc.BytesRemaining);
lua_pushdoublevalue(frequency, state.APU.Dmc.Frequency);
lua_pushdoublevalue(sampleRate, state.APU.Dmc.SampleRate);
lua_pushboolvalue(irqEnabled, state.APU.Dmc.IrqEnabled);
lua_pushboolvalue(loop, state.APU.Dmc.Loop);
lua_pushintvalue(outputVolume, state.APU.Dmc.OutputVolume);

View file

@ -202,6 +202,7 @@ struct ApuNoiseState
struct ApuDmcState
{
double SampleRate;
uint16_t SampleAddr;
uint16_t SampleLength;
@ -210,7 +211,6 @@ struct ApuDmcState
uint16_t Period;
uint16_t BytesRemaining;
double Frequency;
uint8_t OutputVolume;
};