-
Notifications
You must be signed in to change notification settings - Fork 0
/
VisualView.h
85 lines (68 loc) · 2.49 KB
/
VisualView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// VisualView.h
// Spectronics
//
// Created by Ivan Wick on 12/23/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <AppKit/AppKit.h>
#import "SettingsController.h"
#import "Spectronics.h"
// Width = frequency resolution (should be 256)
#define SG_TEXWIDTH 256
// Larger textures make glCopyTexSubImage2D slower. 256*128 seems close to
// the point where improvement becomes negligible.
#define SG_TEXHEIGHT 128
// Number of textures to allocate, must be such that SG_NTEXTURES*SG_TEXHEIGHT
// is as wide as the widest possible display. 4096 pixels seems reasonable...
#define SG_NTEXTURES 32
// Maximum number of lines per update (must be power of 2). 4 seems the maximum,
// above this the graph starts showing obvious bands.
#define SG_MAXCHUNK 4
@interface VisualView : NSOpenGLView //<NSKeyValueObserving> // Cannot find protocol declaration?
{
VisualPluginData * _visualPluginData;
/* the first time a drawFrame is requested from the view, it has to make sure its OpenGL
context is initialized.
*/
BOOL m_glContextInitialized;
// ivan- from SpectroGraph, moved from static vars to instance vars
GLuint *pnTextureID; // Array with IDs
UInt8 gnTexID; // current texture index
UInt32 gnPosition; // position inside texture
UInt8 gnLPU; // number of lines per update
BOOL _scroll;
BOOL _orientation;
UInt32 gDelay;
struct timeval gLineTimeStamp;
struct timeval gFrameTimeStamp;
#ifdef SG_DEBUG
struct timeval gFPSTimeStamp;
#endif
UInt8 freshPixels[SG_TEXWIDTH*4*SG_MAXCHUNK];
int nStored;
UInt16 nTimePixels;
int nNumTiles;
BOOL _needsReshape;
}
@property (nonatomic, assign) VisualPluginData * visualPluginData;
// ivan- from SpectroGraph, moved from static vars to instance vars
@property (readwrite, assign) BOOL color;
@property (readwrite, assign) BOOL invertColors;
@property (readwrite, assign) BOOL scroll;
@property (readwrite, assign) BOOL linear;
@property (readwrite, assign) BOOL orientation; // YES:vert NO:horiz
@property (readwrite, retain) SettingsController* settingsController;
- (void)drawRect:(NSRect)dirtyRect;
- (BOOL)acceptsFirstResponder;
- (BOOL)becomeFirstResponder;
- (BOOL)resignFirstResponder;
- (void)keyDown:(NSEvent *)theEvent;
- (void)setupTextures;
- (void)saveRenderData:(RenderVisualData*)rvd;
- (void)DrawVisual;
- (void)initGL;
- (void)addObserversForSettings:(SettingsController*)sc;
- (void)removeObserversForSettings;
- (void)rewindDisplay;
@end