1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-08-23 17:28:58 +00:00

Minor factoring up: the audio queue is now pushed universally by MachineDocument.

This commit is contained in:
Thomas Harte 2016-05-31 22:36:53 -04:00
parent c773c3a66c
commit 50543e9676
2 changed files with 9 additions and 3 deletions

View File

@ -18,18 +18,21 @@ class ElectronDocument: MachineDocument {
override func windowControllerDidLoadNib(aController: NSWindowController) { override func windowControllerDidLoadNib(aController: NSWindowController) {
super.windowControllerDidLoadNib(aController) super.windowControllerDidLoadNib(aController)
self.intendedCyclesPerSecond = 2000000
aController.window?.contentAspectRatio = NSSize(width: 11.0, height: 10.0) aController.window?.contentAspectRatio = NSSize(width: 11.0, height: 10.0)
self.intendedCyclesPerSecond = 2000000
if let osPath = NSBundle.mainBundle().pathForResource("os", ofType: "rom") { if let osPath = NSBundle.mainBundle().pathForResource("os", ofType: "rom") {
self.electron.setOSROM(NSData(contentsOfFile: osPath)!) self.electron.setOSROM(NSData(contentsOfFile: osPath)!)
} }
if let basicPath = NSBundle.mainBundle().pathForResource("basic", ofType: "rom") { if let basicPath = NSBundle.mainBundle().pathForResource("basic", ofType: "rom") {
self.electron.setBASICROM(NSData(contentsOfFile: basicPath)!) self.electron.setBASICROM(NSData(contentsOfFile: basicPath)!)
} }
openGLView.performWithGLContext({ openGLView.performWithGLContext({
self.electron.setView(self.openGLView, aspectRatio: 11.0 / 10.0) self.electron.setView(self.openGLView, aspectRatio: 11.0 / 10.0)
}) })
self.electron.audioQueue = self.audioQueue
establishStoredOptions() establishStoredOptions()
} }

View File

@ -34,8 +34,11 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe
override func windowControllerDidLoadNib(aController: NSWindowController) { override func windowControllerDidLoadNib(aController: NSWindowController) {
super.windowControllerDidLoadNib(aController) super.windowControllerDidLoadNib(aController)
// bind the content aspect ratio to remain 4:3 from now on // bind the content aspect ratio to remain 4:3 from now on as a default
aController.window?.contentAspectRatio = NSSize(width: 4.0, height: 3.0) aController.window?.contentAspectRatio = NSSize(width: 4.0, height: 3.0)
// provide the audio queue
self.machine().audioQueue = self.audioQueue
} }
override func close() { override func close() {