diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index cd48d9f57..ee5d4bf44 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -248,6 +248,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin switch(_frameCycles) { case 64*128: + case 196*128: update_audio(); break; @@ -256,10 +257,6 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin signal_interrupt(InterruptRealTimeClock); break; - case 196*128: - update_audio(); - break; - case 284*128: update_audio(); signal_interrupt(InterruptDisplayEnd); diff --git a/OSBindings/Mac/Clock Signal/Views/CSCathodeRayView.m b/OSBindings/Mac/Clock Signal/Views/CSCathodeRayView.m index 3fea768ab..f8ef0992c 100644 --- a/OSBindings/Mac/Clock Signal/Views/CSCathodeRayView.m +++ b/OSBindings/Mac/Clock Signal/Views/CSCathodeRayView.m @@ -37,6 +37,8 @@ CSCathodeRayViewSignalType _signalType; int32_t _signalDecoderGeneration; int32_t _compiledSignalDecoderGeneration; + + CGRect _aspectRatioCorrectedBounds; } - (GLuint)textureForImageNamed:(NSString *)name @@ -155,14 +157,23 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt { if(_shaderProgram) { + NSPoint viewSize = [self backingViewSize]; if(_windowSizeUniform >= 0) { - NSPoint viewSize = [self backingViewSize]; glUniform2f(_windowSizeUniform, (GLfloat)viewSize.x, (GLfloat)viewSize.y); } - if(_boundsOriginUniform >= 0) glUniform2f(_boundsOriginUniform, (GLfloat)_frameBounds.origin.x, (GLfloat)_frameBounds.origin.y); - if(_boundsSizeUniform >= 0) glUniform2f(_boundsSizeUniform, (GLfloat)_frameBounds.size.width, (GLfloat)_frameBounds.size.height); + CGFloat outputAspectRatioMultiplier = (viewSize.x / viewSize.y) / (4.0 / 3.0); + +// NSLog(@"%0.2f v %0.2f", outputAspectRatio, desiredOutputAspectRatio); + _aspectRatioCorrectedBounds = _frameBounds; + + CGFloat bonusWidth = (outputAspectRatioMultiplier - 1.0f) * _frameBounds.size.width; + _aspectRatioCorrectedBounds.origin.x -= bonusWidth * 0.5f * _aspectRatioCorrectedBounds.size.width; + _aspectRatioCorrectedBounds.size.width *= outputAspectRatioMultiplier; + + if(_boundsOriginUniform >= 0) glUniform2f(_boundsOriginUniform, (GLfloat)_aspectRatioCorrectedBounds.origin.x, (GLfloat)_aspectRatioCorrectedBounds.origin.y); + if(_boundsSizeUniform >= 0) glUniform2f(_boundsSizeUniform, (GLfloat)_aspectRatioCorrectedBounds.size.width, (GLfloat)_aspectRatioCorrectedBounds.size.height); } } diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm index a7b47dbb0..eaf1c4cac 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm @@ -54,7 +54,7 @@ } - (BOOL)setSpeakerDelegate:(Outputs::Speaker::Delegate *)delegate sampleRate:(int)sampleRate { - _electron.get_speaker()->set_output_rate(sampleRate, 512); + _electron.get_speaker()->set_output_rate(sampleRate, 256); _electron.get_speaker()->set_output_quality(15); _electron.get_speaker()->set_delegate(delegate); return YES;