Renamed some speaker API methods

This commit is contained in:
Aaron Culliney 2015-07-12 13:00:39 -07:00
parent 5f4bf6b1a7
commit 432d2fb563
3 changed files with 10 additions and 9 deletions

View File

@ -465,15 +465,16 @@ void speaker_flush(void) {
} }
} }
bool speaker_is_active(void) { bool speaker_isActive(void) {
return speaker_recently_active; return speaker_recently_active;
} }
void speaker_set_volume(int16_t amplitude) { void speaker_setVolumeZeroToTen(unsigned long goesToTen) {
speaker_amplitude = amplitude; 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; return cycles_per_sample;
} }

View File

@ -21,13 +21,13 @@ void speaker_destroy(void);
void speaker_reset(void); void speaker_reset(void);
void speaker_flush(void); void speaker_flush(void);
void speaker_setVolumeZeroToTen(unsigned long goesToTen); void speaker_setVolumeZeroToTen(unsigned long goesToTen);
bool speaker_is_active(void); bool speaker_isActive(void);
/* /*
* returns the machine cycles per sample * returns the machine cycles per sample
* - for example, emulator running at normal speed: CLK_6502 / 44.1kHz == ~23 * - 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 */ #endif /* whole file */

View File

@ -141,7 +141,7 @@ static void _timing_initialize(double scale) {
} }
#ifdef AUDIO_ENABLED #ifdef AUDIO_ENABLED
speaker_reset(); 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 #endif
} }
@ -326,7 +326,7 @@ void *cpu_thread(void *dummyptr) {
assert(!negative); assert(!negative);
if (!is_fullspeed && if (!is_fullspeed &&
#ifdef AUDIO_ENABLED #ifdef AUDIO_ENABLED
!speaker_is_active() && !speaker_isActive() &&
#endif #endif
!video_dirty() && (!disk6.motor_off && (disk_motor_time.tv_sec || disk_motor_time.tv_nsec > DISK_MOTOR_QUIET_NSECS)) ) !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 (timing_should_auto_adjust_speed()) {
if (is_fullspeed && ( if (is_fullspeed && (
#ifdef AUDIO_ENABLED #ifdef AUDIO_ENABLED
speaker_is_active() || speaker_isActive() ||
#endif #endif
video_dirty() || (disk6.motor_off && (disk_motor_time.tv_sec || disk_motor_time.tv_nsec > DISK_MOTOR_QUIET_NSECS))) ) video_dirty() || (disk6.motor_off && (disk_motor_time.tv_sec || disk_motor_time.tv_nsec > DISK_MOTOR_QUIET_NSECS))) )
{ {