mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Slightly shuffled to avoid a race condition on the best-effort updater.
This commit is contained in:
parent
38f944bc34
commit
a86a6367b5
@ -31,24 +31,14 @@ class MachineDocument:
|
|||||||
return NSSize(width: 4.0, height: 3.0)
|
return NSSize(width: 4.0, height: 3.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBOutlet weak var openGLView: CSOpenGLView! {
|
@IBOutlet weak var openGLView: CSOpenGLView!
|
||||||
didSet {
|
|
||||||
openGLView.delegate = self
|
|
||||||
openGLView.responderDelegate = self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBOutlet var optionsPanel: MachinePanel!
|
@IBOutlet var optionsPanel: MachinePanel!
|
||||||
@IBAction func showOptions(_ sender: AnyObject!) {
|
@IBAction func showOptions(_ sender: AnyObject!) {
|
||||||
optionsPanel?.setIsVisible(true)
|
optionsPanel?.setIsVisible(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate var audioQueue: CSAudioQueue! = nil
|
fileprivate var audioQueue: CSAudioQueue! = nil
|
||||||
fileprivate lazy var bestEffortUpdater: CSBestEffortUpdater = {
|
fileprivate var bestEffortUpdater: CSBestEffortUpdater!
|
||||||
let updater = CSBestEffortUpdater()
|
|
||||||
updater.delegate = self
|
|
||||||
return updater
|
|
||||||
}()
|
|
||||||
|
|
||||||
override var windowNibName: String? {
|
override var windowNibName: String? {
|
||||||
return "MachineDocument"
|
return "MachineDocument"
|
||||||
@ -64,8 +54,16 @@ class MachineDocument:
|
|||||||
self.machine.setView(self.openGLView, aspectRatio: Float(displayAspectRatio.width / displayAspectRatio.height))
|
self.machine.setView(self.openGLView, aspectRatio: Float(displayAspectRatio.width / displayAspectRatio.height))
|
||||||
})
|
})
|
||||||
|
|
||||||
setupClockRate()
|
|
||||||
self.machine.delegate = self
|
self.machine.delegate = self
|
||||||
|
self.bestEffortUpdater = CSBestEffortUpdater()
|
||||||
|
self.bestEffortUpdater.delegate = self
|
||||||
|
|
||||||
|
// callbacks from the OpenGL may come on a different thread, immediately following the .delegate set;
|
||||||
|
// hence the full setup of the best-effort updater prior to setting self as a delegate
|
||||||
|
self.openGLView.delegate = self
|
||||||
|
self.openGLView.responderDelegate = self
|
||||||
|
|
||||||
|
setupClockRate()
|
||||||
self.optionsPanel?.establishStoredOptions()
|
self.optionsPanel?.establishStoredOptions()
|
||||||
|
|
||||||
// bring OpenGL view-holding window on top of the options panel
|
// bring OpenGL view-holding window on top of the options panel
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
*/
|
*/
|
||||||
@interface CSOpenGLView : NSOpenGLView
|
@interface CSOpenGLView : NSOpenGLView
|
||||||
|
|
||||||
@property (nonatomic, weak, nullable) id <CSOpenGLViewDelegate> delegate;
|
@property (atomic, weak, nullable) id <CSOpenGLViewDelegate> delegate;
|
||||||
@property (nonatomic, weak, nullable) id <CSOpenGLViewResponderDelegate> responderDelegate;
|
@property (nonatomic, weak, nullable) id <CSOpenGLViewResponderDelegate> responderDelegate;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user