vfs: check userland buffers before reading them.
[haiku.git] / src / apps / soundrecorder / VUView.h
blob84f01462ad16902ffa686048c3bd447f22fa8b30
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:
6 * Consumers and Producers)
7 */
9 #ifndef VUVIEW_H
10 #define VUVIEW_H
12 #include <Bitmap.h>
13 #include <View.h>
16 class VUView : public BView
18 public:
19 VUView(BRect rect, uint32 resizeFlags);
20 ~VUView();
21 void AttachedToWindow();
22 void DetachedFromWindow();
23 void Draw(BRect updateRect);
24 void ComputeLevels(const void* data, size_t size, uint32 format);
26 private:
27 void _Run();
28 void _Quit();
29 static int32 _RenderLaunch(void *data);
30 void _RenderLoop();
31 template<typename T> T _ComputeNextLevel(const void *data,
32 size_t size, uint32 format, int32 channel);
34 thread_id fThreadId;
35 BBitmap *fBitmap;
36 BView *fBitmapView;
37 bool fQuitting;
38 int32 fLevelCount;
39 int32 *fCurrentLevels;
40 int32 fChannels;
43 #endif /* VUVIEW_H */