mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-07 23:29:06 +00:00
Removes assumption that all machines produce audio.
This commit is contained in:
parent
5f7b3ae313
commit
26b019a4d4
@ -832,11 +832,14 @@ int main(int argc, char *argv[]) {
|
||||
} else if(volume < 0.0 || volume > 1.0) {
|
||||
std::cerr << "Cannot run with volume " << volume_string << "; volumes must be between 0.0 and 1.0." << std::endl;
|
||||
} else {
|
||||
const auto audio_producer = machine->audio_producer();
|
||||
if(audio_producer) {
|
||||
const auto speaker = machine->audio_producer()->get_speaker();
|
||||
if(speaker) speaker->set_output_volume(volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether a 'logical' keyboard has been requested, or the machine would prefer one anyway.
|
||||
const bool logical_keyboard =
|
||||
@ -907,7 +910,9 @@ int main(int argc, char *argv[]) {
|
||||
machine->scan_producer()->set_scan_target(&scan_target);
|
||||
|
||||
// For now, lie about audio output intentions.
|
||||
auto speaker = machine->audio_producer()->get_speaker();
|
||||
const auto audio_producer = machine->audio_producer();
|
||||
if(audio_producer) {
|
||||
auto speaker = audio_producer->get_speaker();
|
||||
if(speaker) {
|
||||
// Create an audio pipe.
|
||||
SDL_AudioSpec desired_audio_spec;
|
||||
@ -928,6 +933,7 @@ int main(int argc, char *argv[]) {
|
||||
speaker->set_delegate(&speaker_delegate);
|
||||
SDL_PauseAudioDevice(speaker_delegate.audio_device, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
If the machine offers anything for activity observation,
|
||||
|
Loading…
Reference in New Issue
Block a user