Oscilloscope object |
|
The Oscilloscope object, accessible through the control's Oscilloscope property, is internally implemented as a COM interface called IOscilloscope and contains information needed to render the embedded Oscilloscope visual feedback.
It can be used at Run-time in order to create the embedded Oscilloscope and to change its graphic settings. For details about using Visual Feedbacks refer to the How to use the embedded Visual Feedbacks section
The Oscilloscope 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 (Line 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 Oscilloscope object is defined by the control wrapper class COscilloscope contained inside the oscilloscope.cpp and oscilloscope.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 "oscilloscope.h"
Here follows the code needed to perform the requested operation of initialising the Oscilloscope object and changing some of its properties.
// declare a Oscilloscope object COscilloscope oscilloscope;
// init the object with the control's oscilloscope reference oscilloscope = MyPlayer.GetOscilloscope ();
// create the oscilloscope for player 0 oscilloscope.Create (0, (OLE_HANDLE) GetDlgItem(IDC_PICTURE)->GetSafeHwnd ());
// again for player 0, set the oscilloscope line color to blue and background color to white oscilloscope.SetColorLine (0, RGB (0, 0, 255)); oscilloscope.SetColorBackground (0, RGB (255, 255, 255));
As you can see the access to the Oscilloscope properties ColorLine and ColorBackground are wrapped by the SetColorLine and SetColorBackground functions declared inside the wrapper class COscilloscope.
Microsoft Visual Basic (5.0 and 6.0)
Here follows the code needed to perform the requested operations
' create the Oscilloscope on player 0 over an existing control MyPlayer.Oscilloscope.Create 0, Picture1.hWnd
' set the blue color for Oscilloscope line of player 0 MyPlayer.Oscilloscope.ColorLine(0) = RGB(0, 0, 255)
' set the white color for Oscilloscope background of player 0 MyPlayer.Oscilloscope.ColorBackground(0) = RGB(255, 255, 255)
Here follows the code needed to perform the requested operations
' create the Oscilloscope on player 0 over an existing control MyPlayer.Oscilloscope.Create(0, PictureBox1.Handle.ToInt32())
' set the blue color for Oscilloscope line of player 0 MyPlayer.Oscilloscope.ColorLine(0) = Convert.ToUInt32(RGB(0, 0, 255))
' set the white color for Oscilloscope background of player 0 MyPlayer.Oscilloscope.ColorBackground(0) = Convert.ToUInt32(RGB(255, 255, 255))
Here follows the code needed to perform the requested operations
// create the Oscilloscope on player 0 over an existing control MyPlayer.Oscilloscope.Create(0, pictureBox1.Handle.ToInt32());
// set the blue color for Oscilloscope line of player 0 MyPlayer.Oscilloscope.set_ColorLine (0, Convert.ToUInt32 (ColorTranslator.ToWin32 (Color.Blue)));
// set the white color for Oscilloscope background of player 0 MyPlayer.Oscilloscope.set_ColorBackground(0, Convert.ToUInt32 (ColorTranslator.ToWin32 (Color.White)));
Here follows the code needed to perform the requested operations
// create the Oscilloscope on player 0 over an existing control MyPlayer.get_Oscilloscope ().Create ((short) 0, (int) pictureBox1.get_Handle().ToInt32());
// set the blue color for Oscilloscope line of player 0 System.UInt32 colorBlue = (System.UInt32) ColorTranslator.ToWin32 (Color.get_Blue ()); MyPlayer.get_Oscilloscope ().set_ColorLine ((short) 0, colorBlue);
// set the white color for Oscilloscope background of player 0 System.UInt32 colorWhite = (System.UInt32) ColorTranslator.ToWin32 (Color.get_White ()); MyPlayer.get_Oscilloscope ().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.
|