mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-21 17:16:44 +00:00
Adds Super Game Module support for the ColecoVision.
This commit is contained in:
@@ -108,7 +108,6 @@ void AY38910::get_samples(std::size_t number_of_samples, int16_t *target) {
|
||||
}
|
||||
|
||||
evaluate_output_volume();
|
||||
printf("%d ", output_volume_);
|
||||
|
||||
for(int ic = 0; ic < 8 && c < number_of_samples; ic++) {
|
||||
target[c] = output_volume_;
|
||||
@@ -157,6 +156,11 @@ void AY38910::evaluate_output_volume() {
|
||||
);
|
||||
}
|
||||
|
||||
bool AY38910::is_zero_level() {
|
||||
// Confirm that the AY is trivially at the zero level if all three volume controls are set to fixed zero.
|
||||
return output_registers_[0x8] == 0 && output_registers_[0x9] == 0 && output_registers_[0xa] == 0;
|
||||
}
|
||||
|
||||
// MARK: - Register manipulation
|
||||
|
||||
void AY38910::select_register(uint8_t r) {
|
||||
|
||||
@@ -85,6 +85,7 @@ class AY38910: public ::Outputs::Speaker::SampleSource {
|
||||
|
||||
// to satisfy ::Outputs::Speaker (included via ::Outputs::Filter; not for public consumption
|
||||
void get_samples(std::size_t number_of_samples, int16_t *target);
|
||||
bool is_zero_level();
|
||||
|
||||
private:
|
||||
Concurrency::DeferringAsyncTaskQueue &task_queue_;
|
||||
|
||||
@@ -15,12 +15,12 @@ using namespace Konami;
|
||||
SCC::SCC(Concurrency::DeferringAsyncTaskQueue &task_queue) :
|
||||
task_queue_(task_queue) {}
|
||||
|
||||
bool SCC::is_silent() {
|
||||
bool SCC::is_zero_level() {
|
||||
return !(channel_enable_ & 0x1f);
|
||||
}
|
||||
|
||||
void SCC::get_samples(std::size_t number_of_samples, std::int16_t *target) {
|
||||
if(is_silent()) {
|
||||
if(is_zero_level()) {
|
||||
std::memset(target, 0, sizeof(std::int16_t) * number_of_samples);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class SCC: public ::Outputs::Speaker::SampleSource {
|
||||
SCC(Concurrency::DeferringAsyncTaskQueue &task_queue);
|
||||
|
||||
/// As per ::SampleSource; provides a broadphase test for silence.
|
||||
bool is_silent();
|
||||
bool is_zero_level();
|
||||
|
||||
/// As per ::SampleSource; provides audio output.
|
||||
void get_samples(std::size_t number_of_samples, std::int16_t *target);
|
||||
|
||||
@@ -82,6 +82,10 @@ void SN76489::set_register(uint8_t value) {
|
||||
});
|
||||
}
|
||||
|
||||
bool SN76489::is_zero_level() {
|
||||
return channels_[0].volume == 0xf && channels_[1].volume == 0xf && channels_[2].volume == 0xf && channels_[3].volume == 0xf;
|
||||
}
|
||||
|
||||
void SN76489::evaluate_output_volume() {
|
||||
output_volume_ = static_cast<int16_t>(
|
||||
channels_[0].level * volumes_[channels_[0].volume] +
|
||||
|
||||
@@ -30,6 +30,7 @@ class SN76489: public Outputs::Speaker::SampleSource {
|
||||
|
||||
// As per SampleSource.
|
||||
void get_samples(std::size_t number_of_samples, std::int16_t *target);
|
||||
bool is_zero_level();
|
||||
|
||||
private:
|
||||
int master_divider_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user