LMMS
Loading...
Searching...
No Matches
VuPartMeter.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 VuPartMeter.h - OSC Controlled VU Meter
5 Copyright (C) 2016 Mark McCurry
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11*/
12#include "VuMeter.h"
13#define MIN_DB (-48)
14
15class VuPartMeter: public VuMeter
16{
17 public:
18 VuPartMeter(int x,int y, int w, int h, const char *label=0)
19 :VuMeter(x,y,w,h,label), db(0.0f)
20 {}
21
22 void draw(void)
23 {
24 const int X = x(), Y = y(), W = w(), H = h();
25
26 //XXX perhaps re-enable this later on
27 //if (!active_r()){
28 // int fakedb=master->fakepeakpart[npart];
29 // fl_rectf(X,Y,W,H,140,140,140);
30 // if (fakedb>0){
31 // fakedb=(int)(fakedb/255.0*H)+4;
32 // fl_rectf(X+2,Y+H-fakedb,W-4,fakedb,0,0,0);
33 // }
34 // return;
35 //}
36
37 //draw the vu lines
38 const int idb = db*(H-2);
39
40 fl_rectf(X,Y+H-idb,W,idb,0,200,255);
41 fl_rectf(X,Y,W,H-idb,0,0,0);
42
43 //draw the scales
44 const float tmp=H*1.0/MIN_DB;
45 for (int i = 1; i < 1 - MIN_DB; i++) {
46 const int ty = H+(int) (tmp*i);
47 if(i%5 == 0) fl_rectf(X, Y+H-ty, W, 1,0, 160, 200);
48 if(i%10 == 0) fl_rectf(X, Y+H-ty, W, 1,0, 230, 240);
49 }
50 }
51
52 void update(float x)
53 {
54 const float _db = limit((MIN_DB-rap2dB(x))/MIN_DB);
55
56 if(db != _db) {
57 db = _db;
58 damage(FL_DAMAGE_USER1);
59 }
60 }
61
62 private:
63 float db;
64};
#define rap2dB(rap)
Definition globals.h:222
#define MIN_DB
Definition VuPartMeter.h:13
float limit(float x)
Definition VuMeter.h:25
VuMeter(int x, int y, int w, int h, const char *label=0)
Definition VuMeter.h:20
void update(float x)
Definition VuPartMeter.h:52
float db
Definition VuPartMeter.h:63
void draw(void)
Definition VuPartMeter.h:22
VuPartMeter(int x, int y, int w, int h, const char *label=0)
Definition VuPartMeter.h:18
UINT_D64 w
Definition inflate.c:942
int y
Definition inflate.c:1588
register unsigned i
Definition inflate.c:1575
unsigned x[BMAX+1]
Definition inflate.c:1586
#define X(str)
Definition juce_LV2Common.h:197
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
typedef int(UZ_EXP MsgFn)()