diff --git a/src/audio/speaker.c b/src/audio/speaker.c index 321f7e9d..17fc969b 100644 --- a/src/audio/speaker.c +++ b/src/audio/speaker.c @@ -465,15 +465,16 @@ void speaker_flush(void) { } } -bool speaker_is_active(void) { +bool speaker_isActive(void) { return speaker_recently_active; } -void speaker_set_volume(int16_t amplitude) { - speaker_amplitude = amplitude; +void speaker_setVolumeZeroToTen(unsigned long goesToTen) { + float samplesScale = goesToTen/10.f; + speaker_data = (int16_t)(SPKR_DATA_INIT * samplesScale); } -double speaker_cycles_per_sample(void) { +double speaker_cyclesPerSample(void) { return cycles_per_sample; } diff --git a/src/audio/speaker.h b/src/audio/speaker.h index 95e5ce7e..eef6e9bf 100644 --- a/src/audio/speaker.h +++ b/src/audio/speaker.h @@ -21,13 +21,13 @@ void speaker_destroy(void); void speaker_reset(void); void speaker_flush(void); void speaker_setVolumeZeroToTen(unsigned long goesToTen); -bool speaker_is_active(void); +bool speaker_isActive(void); /* * returns the machine cycles per sample * - for example, emulator running at normal speed: CLK_6502 / 44.1kHz == ~23 */ -double speaker_cycles_per_sample(void); +double speaker_cyclesPerSample(void); #endif /* whole file */ diff --git a/src/timing.c b/src/timing.c index 02911dca..a45d9908 100644 --- a/src/timing.c +++ b/src/timing.c @@ -141,7 +141,7 @@ static void _timing_initialize(double scale) { } #ifdef AUDIO_ENABLED speaker_reset(); - //TIMING_LOG("ClockRate:%0.2lf ClockCyclesPerSpeakerSample:%0.2lf", cycles_persec_target, speaker_cycles_per_sample()); + //TIMING_LOG("ClockRate:%0.2lf ClockCyclesPerSpeakerSample:%0.2lf", cycles_persec_target, speaker_cyclesPerSample()); #endif } @@ -326,7 +326,7 @@ void *cpu_thread(void *dummyptr) { assert(!negative); if (!is_fullspeed && #ifdef AUDIO_ENABLED - !speaker_is_active() && + !speaker_isActive() && #endif !video_dirty() && (!disk6.motor_off && (disk_motor_time.tv_sec || disk_motor_time.tv_nsec > DISK_MOTOR_QUIET_NSECS)) ) { @@ -387,7 +387,7 @@ void *cpu_thread(void *dummyptr) { if (timing_should_auto_adjust_speed()) { if (is_fullspeed && ( #ifdef AUDIO_ENABLED - speaker_is_active() || + speaker_isActive() || #endif video_dirty() || (disk6.motor_off && (disk_motor_time.tv_sec || disk_motor_time.tv_nsec > DISK_MOTOR_QUIET_NSECS))) ) {