VUMeter object |
|
The VUMeter object, accessible through the control's VUMeter property, is internally implemented as a COM interface called IVUMeter and contains information needed to render the embedded VU-Meter visual feedback.
It can be used at Run-time in order to create the embedded VU-Meter and to change its graphic settings. For details about using Visual Feedbacks refer to the How to use the embedded Visual Feedbacks section
The VUMeter object is implemented through the following methods and properties:
Methods
Properties
The following code snippets show how to create and change this object in your code. These examples assume that you have placed a control named MyPlayer on a form or dialog and that you want to change a couple of graphic settings (Bands and Background colors). Microsoft Visual C++ (4.0, 5.0 and 6.0) Microsoft Visual Basic (5.0 and 6.0)
Microsoft Visual C++ (4.0, 5.0 and 6.0)
Properties and methods of the control are accessible through the control wrapper class CAmp3dj contained inside the amp3dj.cpp and amp3dj.h files: these wrapper files are automatically generated when you insert the control inside your project so, in order to access the wrapper functions, you will have to insert the following line of code somewhere in your code.
#include "amp3dj.h"
The VUMeter object is defined by the control wrapper class CVUMeter contained inside the vumeter.cpp and vumeter.h files: also these wrapper files are automatically generated when you insert the control inside your project so, in order to access this object, you will have to insert the following line of code somewhere in your code.
#include "vumeter.h"
Here follows the code needed to perform the requested operation of initialising the VU-Meter object and changing some of its properties.
// declare a VUMeter object CVUMeter vumeter;
// init the object with the control's VUMeter reference vumeter = MyPlayer.GetVUMeter ();
// create the VU-meter for player 0 over an existing control vumeter.Create (0, (OLE_HANDLE) GetDlgItem (IDC_PICTURE)->GetSafeHwnd ());
// again for player 0, set the VU-meter bands color to blue and background color to white vumeter.SetColorBands (0, RGB (0, 0, 255)); vumeter.SetColorBackground (0, RGB (255, 255, 255));
As you can see the access to the VUMeter properties ColorBands and ColorBackground are wrapped by the SetColorBands and SetColorBackground functions declared inside the wrapper class CVUMeter.
Microsoft Visual Basic (5.0 and 6.0)
Here follows the code needed to perform the requested operations
' create the VU-meter on player 0 over an existing control MyPlayer.VUMeter.Create 0, Picture1.hWnd
' set the blue color for VU-meter bands of player 0 MyPlayer.VUMeter.ColorBands(0) = RGB(0, 0, 255)
' set the white color for VU-meter background of player 0 MyPlayer.VUMeter.ColorBackground(0) = RGB(255, 255, 255)
Here follows the code needed to perform the requested operations
' create the VU-meter on player 0 over an existing control MyPlayer.VUMeter.Create(0, PictureBox1.Handle.ToInt32())
' set the blue color for VU-meter bands of player 0 MyPlayer.VUMeter.ColorBands(0) = Convert.ToUInt32(RGB(0, 0, 255))
' set the white color for VU-meter background of player 0 MyPlayer.VUMeter.ColorBackground(0) = Convert.ToUInt32(RGB(255, 255, 255))
Here follows the code needed to perform the requested operations
// create the VU-meter on player 0 over an existing control MyPlayer.VUMeter.Create(0, pictureBox1.Handle.ToInt32());
// set the blue color for VU-meter bands of player 0 MyPlayer.VUMeter.set_ColorBands (0, Convert.ToUlong (ColorTranslator.ToWin32 (Color.Blue)));
// set the white color for VU-meter background of player 0 MyPlayer.VUMeter.set_ColorBackground(0, Convert.ToUlong (ColorTranslator.ToWin32 (Color.White)));
Here follows the code needed to perform the requested operations
// create the VU-meter on player 0 over an existing control MyPlayer.get_VUMeter ().Create ((short) 0, (int) pictureBox1.get_Handle().ToInt32());
// set the blue color for VU-meter bands of player 0 System.Ulong colorBlue = (System.UInt32) ColorTranslator.ToWin32 (Color.get_Blue ()); MyPlayer.get_VUMeter ().set_ColorBands ((short) 0, colorBlue);
// set the white color for VU-meter background of player 0 System.Ulong colorWhite = (System.UInt32) ColorTranslator.ToWin32 (Color.get_White ()); MyPlayer.get_VUMeter ().set_ColorBackground((short) 0, colorWhite);
As you can see, in J#.NET the access to the control properties is made through the use of wrapper functions (automatically generated when you insert the control inside your project) with the "get_" and "set_" prefixes. Intellisense will help you finding the right wrapper function.
|