mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-04 01:57:54 +00:00
Attempt to avoid off-by-one buffer reads, add modulation.
This commit is contained in:
parent
066e4421e8
commit
2b0415d552
@ -96,14 +96,17 @@ bool Audio::advance_dma(int channel) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_data<false>(channel, ram_[channels_[channel].data_address & ram_mask_]);
|
|
||||||
++channels_[channel].data_address;
|
|
||||||
|
|
||||||
if(channels_[channel].should_reload_address) {
|
if(channels_[channel].should_reload_address) {
|
||||||
channels_[channel].data_address = pointer_[size_t(channel)];
|
channels_[channel].data_address = pointer_[size_t(channel)];
|
||||||
channels_[channel].should_reload_address = false;
|
channels_[channel].should_reload_address = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_data<false>(channel, ram_[channels_[channel].data_address & ram_mask_]);
|
||||||
|
|
||||||
|
if(channels_[channel].state != Channel::State::WaitingForDummyDMA) {
|
||||||
|
++channels_[channel].data_address;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +271,7 @@ void Audio::output() {
|
|||||||
-> State::PlayingHigh (010)
|
-> State::PlayingHigh (010)
|
||||||
if: perfin and (AUDxON or not AUDxIP)
|
if: perfin and (AUDxON or not AUDxIP)
|
||||||
action:
|
action:
|
||||||
1. pbufld
|
1. pbufld1
|
||||||
2. percntrld
|
2. percntrld
|
||||||
3. if napnav and AUDxON, then AUDxDR
|
3. if napnav and AUDxON, then AUDxDR
|
||||||
4. if napnav and AUDxON and intreq2, AUDxIR
|
4. if napnav and AUDxON and intreq2, AUDxIR
|
||||||
@ -371,6 +374,7 @@ template <> bool Audio::Channel::transit<
|
|||||||
// pbufld1
|
// pbufld1
|
||||||
data_latch = data;
|
data_latch = data;
|
||||||
wants_data = true;
|
wants_data = true;
|
||||||
|
if(moduland && attach_volume) moduland->volume = uint8_t(data_latch);
|
||||||
|
|
||||||
// AUDxIR.
|
// AUDxIR.
|
||||||
return true;
|
return true;
|
||||||
@ -463,6 +467,7 @@ template <> bool Audio::Channel::transit<
|
|||||||
|
|
||||||
// pbufld1
|
// pbufld1
|
||||||
data_latch = data;
|
data_latch = data;
|
||||||
|
if(moduland && attach_volume) moduland->volume = uint8_t(data_latch);
|
||||||
|
|
||||||
// if napnav
|
// if napnav
|
||||||
if(attach_volume || !(attach_volume || attach_period)) {
|
if(attach_volume || !(attach_volume || attach_period)) {
|
||||||
@ -518,6 +523,7 @@ template <> bool Audio::Channel::transit<
|
|||||||
if(attach_period) {
|
if(attach_period) {
|
||||||
// pbufld2
|
// pbufld2
|
||||||
data_latch = data;
|
data_latch = data;
|
||||||
|
if(moduland) moduland->period = data_latch;
|
||||||
|
|
||||||
// [if AUDxAP] and AUDxON
|
// [if AUDxAP] and AUDxON
|
||||||
if(dma_enabled) {
|
if(dma_enabled) {
|
||||||
@ -596,6 +602,7 @@ template <> bool Audio::Channel::transit<
|
|||||||
|
|
||||||
// pbufld1
|
// pbufld1
|
||||||
data_latch = data;
|
data_latch = data;
|
||||||
|
if(moduland && attach_volume) moduland->volume = uint8_t(data_latch);
|
||||||
|
|
||||||
// if napnav
|
// if napnav
|
||||||
if(attach_volume || !(attach_volume || attach_period)) {
|
if(attach_volume || !(attach_volume || attach_period)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user