1 /* 2 * Copyright 2005, Jérôme Duval. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Inspired by SoundCapture from Be newsletter (Media Kit Basics: Consumers and Producers) 6 */ 7 8 #ifndef SCOPEVIEW_H 9 #define SCOPEVIEW_H 10 11 #include <Bitmap.h> 12 #include <View.h> 13 #include <MediaTrack.h> 14 15 16 class ScopeView : public BView 17 { 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); 28 void RenderTrack(BMediaTrack *track, media_format format); 29 virtual void FrameResized(float width, float height); 30 private: 31 void Run(); 32 void Quit(); 33 static int32 RenderLaunch(void *data); 34 void RenderLoop(); 35 void RenderBitmap(); 36 void InitBitmap(); 37 38 thread_id fThreadId; 39 BBitmap *fBitmap; 40 BView *fBitmapView; 41 sem_id fRenderSem; 42 bool fIsRendering; 43 BMediaTrack *fMediaTrack; 44 media_format fPlayFormat; 45 46 bool fQuitting; 47 bigtime_t fMainTime; 48 bigtime_t fRightTime; 49 bigtime_t fLeftTime; 50 bigtime_t fTotalTime; 51 int32 fPreview[20000]; 52 float fHeight; 53 }; 54 55 #endif /* SCOPEVIEW_H */ 56