Cog/SpectrumWindowController.m
Christopher Snowhill f4712ad219 [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 <kode54@gmail.com>
2022-05-22 17:24:35 -07:00

47 lines
1,016 B
Objective-C

//
// 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