-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Visualization]: Add Spectrum window
Add a dedicated spectrum visualization window, and add the necessary hooks to start its event timer if playback is already running when it is first opened. Signed-off-by: Christopher Snowhill <[email protected]>
- Loading branch information
Showing
8 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> | ||
<dependencies> | ||
<deployment identifier="macosx"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<objects> | ||
<customObject id="-2" userLabel="File's Owner" customClass="SpectrumWindow"> | ||
<connections> | ||
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/> | ||
</connections> | ||
</customObject> | ||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> | ||
<customObject id="-3" userLabel="Application" customClass="NSObject"/> | ||
<window title="Spectrum" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" appearanceType="darkAqua" animationBehavior="default" titlebarAppearsTransparent="YES" id="F0z-JX-Cv5"> | ||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="196" y="240" width="480" height="270"/> | ||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/> | ||
<view key="contentView" id="se5-gp-TjO"> | ||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
</view> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/> | ||
</connections> | ||
<point key="canvasLocation" x="139" y="110"/> | ||
</window> | ||
</objects> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// SpectrumWindowController.h | ||
// Cog | ||
// | ||
// Created by Christopher Snowhill on 5/22/22. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
#import "PlaybackController.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SpectrumWindowController : NSWindowController { | ||
IBOutlet PlaybackController *playbackController; | ||
} | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// SpectrumWindowController.m | ||
// Cog | ||
// | ||
// Created by Christopher Snowhill on 5/22/22. | ||
// | ||
|
||
#import "SpectrumWindowController.h" | ||
|
||
#import "SpectrumView.h" | ||
|
||
@interface SpectrumWindowController () | ||
@property SpectrumView *spectrumView; | ||
@end | ||
|
||
@implementation SpectrumWindowController | ||
|
||
- (id)init { | ||
return [super initWithWindowNibName:@"SpectrumWindow"]; | ||
} | ||
|
||
- (void)windowDidLoad { | ||
[super windowDidLoad]; | ||
|
||
self.spectrumView = [[SpectrumView alloc] initWithFrame:[[self window] frame]]; | ||
[[self window] setContentView:self.spectrumView]; | ||
|
||
[self.spectrumView enableCameraControl]; | ||
|
||
if(playbackController.playbackStatus == CogStatusPlaying) | ||
[self.spectrumView startPlayback]; | ||
} | ||
|
||
- (IBAction)toggleWindow:(id)sender { | ||
if([[self window] isVisible]) | ||
[[self window] orderOut:self]; | ||
else | ||
[self showWindow:self]; | ||
} | ||
|
||
- (IBAction)showWindow:(id)sender { | ||
if(self.spectrumView && playbackController.playbackStatus == CogStatusPlaying) | ||
[self.spectrumView startPlayback]; | ||
return [super showWindow:sender]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters