-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpectronics.h
121 lines (92 loc) · 4.09 KB
/
Spectronics.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
// Spectronics.h
// Spectronics
//
// Created by Ivan Wick on 12/20/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#ifndef ITUNESPLUGIN_H
#define ITUNESPLUGIN_H
#include "iTunesVisualAPI.h"
#include <time.h>
#if TARGET_OS_WIN32
#include <Gdiplus.h>
#endif // TARGET_OS_WIN32
//-------------------------------------------------------------------------------------------------
// build flags
//-------------------------------------------------------------------------------------------------
#define USE_SUBVIEW (TARGET_OS_MAC && 1) // use a custom NSView subview on the Mac
//-------------------------------------------------------------------------------------------------
// typedefs, structs, enums, etc.
//-------------------------------------------------------------------------------------------------
#define kTVisualPluginCreator 'hook'
#define kTVisualPluginMajorVersion 2
#define kTVisualPluginMinorVersion 0
#define kTVisualPluginReleaseStage developStage
#define kTVisualPluginNonFinalRelease 0
struct VisualPluginData;
#if TARGET_OS_MAC
#import <Cocoa/Cocoa.h>
// "namespace" our ObjC classname to avoid load conflicts between multiple visualizer plugins
#define VisualView OrgIntfoundSpectronics_VisualView
@class VisualView;
@class SettingsController;
#endif
#define kInfoTimeOutInSeconds 10 // draw info/artwork for N seconds when it changes or playback starts
#define kPlayingPulseRateInHz 60 // when iTunes is playing, draw N times a second
#define kStoppedPulseRateInHz 0 // when iTunes is not playing, draw N times a second
struct VisualPluginData
{
void * appCookie;
ITAppProcPtr appProc;
#if TARGET_OS_MAC
NSView* destView;
NSRect destRect;
#if USE_SUBVIEW
VisualView* subview; // custom subview
#endif
NSImage * currentArtwork;
SettingsController *settingsController;
#else
HWND destView;
RECT destRect;
Gdiplus::Bitmap* currentArtwork;
long int lastDrawTime;
#endif
OptionBits destOptions;
RenderVisualData renderData;
UInt32 renderTimeStampID;
ITTrackInfo trackInfo;
ITStreamInfo streamInfo;
// Plugin-specific data
Boolean playing; // is iTunes currently playing audio?
Boolean padding[3];
time_t drawInfoTimeOut; // when should we stop showing info/artwork?
UInt8 minLevel[kVisualMaxDataChannels]; // 0-128
UInt8 maxLevel[kVisualMaxDataChannels]; // 0-128
// ivan- originally was gBandFlag
Boolean biasNormFlag;
};
typedef struct VisualPluginData VisualPluginData;
void GetVisualName( ITUniStr255 name );
OptionBits GetVisualOptions( void );
OSStatus RegisterVisualPlugin( PluginMessageInfo * messageInfo );
OSStatus ActivateVisual( VisualPluginData * visualPluginData, VISUAL_PLATFORM_VIEW destView, OptionBits options );
OSStatus MoveVisual( VisualPluginData * visualPluginData, OptionBits newOptions );
OSStatus DeactivateVisual( VisualPluginData * visualPluginData );
OSStatus ResizeVisual( VisualPluginData * visualPluginData );
void ProcessRenderData( VisualPluginData * visualPluginData, UInt32 timeStampID, const RenderVisualData * renderData );
void ResetRenderData( VisualPluginData * visualPluginData );
void UpdateInfoTimeOut( VisualPluginData * visualPluginData );
void UpdateTrackInfo( VisualPluginData * visualPluginData, ITTrackInfo * trackInfo, ITStreamInfo * streamInfo );
void UpdateArtwork( VisualPluginData * visualPluginData, VISUAL_PLATFORM_DATA coverArt, UInt32 coverArtSize, UInt32 coverArtFormat );
void UpdatePulseRate( VisualPluginData * visualPluginData, UInt32 * ioPulseRate );
void DrawVisual( VisualPluginData * visualPluginData );
void PulseVisual( VisualPluginData * visualPluginData, UInt32 timeStampID, const RenderVisualData * renderData, UInt32 * ioPulseRate );
void InvalidateVisual( VisualPluginData * visualPluginData );
OSStatus ConfigureVisual( VisualPluginData * visualPluginData );
/* Platform-specific Init and Cleanup */
void InitPlugin( VisualPluginData * visualPluginData );
void CleanupPlugin( VisualPluginData * visualPluginData );
void InternalizeRenderData( VisualPluginData * visualPluginData );
#endif