mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-24 12:30:17 +00:00
Attempted further to improve latency; added view adjustment for non-4:3 output aspect ratios. The 4:3 is currently hardcoded, so further work will be required.
This commit is contained in:
parent
90eef1df74
commit
956b90e203
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user