repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / soundrecorder / ScopeView.h
blobfd76bde7a920b42ba2225e8ab86dcc4b77842f97
1 /*
2 * Copyright 2005, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Inspired by SoundCapture from Be newsletter (Media Kit Basics: Consumers and Producers)
6 */
8 #ifndef SCOPEVIEW_H
9 #define SCOPEVIEW_H
11 #include <Bitmap.h>
12 #include <View.h>
13 #include <MediaTrack.h>
16 class ScopeView : public BView
18 public:
19 ScopeView(BRect rect, uint32 resizeFlags);
20 ~ScopeView();
21 void AttachedToWindow();
22 void DetachedFromWindow();
23 void Draw(BRect updateRect);
24 void SetMainTime(bigtime_t timestamp);
25 void SetLeftTime(bigtime_t timestamp);
26 void SetRightTime(bigtime_t timestamp);
27 void SetTotalTime(bigtime_t timestamp, bool reset);
28 void RenderTrack(BMediaTrack *track, const media_format &format);
29 void CancelRendering();
30 virtual void FrameResized(float width, float height);
31 virtual void MouseDown(BPoint position);
32 private:
33 void Run();
34 void Quit();
35 static int32 RenderLaunch(void *data);
36 void RenderLoop();
37 template<typename T, typename U> void ComputeRendering();
38 void RenderBitmap();
39 void InitBitmap();
41 thread_id fThreadId;
42 BBitmap *fBitmap;
43 BView *fBitmapView;
44 sem_id fRenderSem;
45 bool fIsRendering;
46 BMediaTrack *fMediaTrack;
47 media_format fPlayFormat;
49 bigtime_t fMainTime;
50 bigtime_t fRightTime;
51 bigtime_t fLeftTime;
52 bigtime_t fTotalTime;
53 int32 fPreview[20000];
54 float fHeight;
57 #endif /* SCOPEVIEW_H */