Click here to Skip to main content
Click here to Skip to main content

Skinned Form Playing Audio and OpenGL Altogether

By , 17 Oct 2006
 
Sample Image - BLACK_BOX_II.jpg

Introduction

The project exclusively uses the features found in VISUAL C# 2005 Express Edition.

The ZIP file content:

  • Project source code for .NET 2.0+
  • Skinned form in 9-image mode using variable opacity on NT platforms
  • Visual effects based on OpenGL
  • Playing MP3 audio using BASS.DLL
  • PNG graphic components specifically designed for the project
  • One free MP3 audio file

Apart of the MAIN_Form class, the project uses 4 specific classes:

  1. Audio.cs (BASS.dll interface)
  2. OpenGL.cs (OpenGL interface)
  3. Win32.cs (Flat API encapsulation)
  4. SkinEngine (properties and methods of the Skin Engine).

Note: The MP3 file and BASS.dll are located in the project folder named "\bin\debug".
BASS.dll from Ian Luck (www.un4seen.com) is a prerequisite for playing audio.

Very Important

The code must take over the WinProc, to handle the very important WM_NCHITTEST message, to mimic the behavior of a standard window.

Drag & Drop

You can use it between Explorer and BlackBox to play MP3 files!

SETUP Parameters

private void SETUP_parameters()
{
    // Setup default Skin colors
    SK.ColorLayerBackground = Color.FromArgb(255, 64, 64, 64);
    SK.ColorCaptionEnabled = Color.FromArgb(255, 220, 220, 220);
    SK.ColorCaptionDisabled = Color.FromArgb(255, 92, 92, 92); 
    // Skin opacity in the range 0-255
    SK.Alpha = 204; // 80 % default transparency level 
    // OpenGL
    InitOpenGL(OPENGL_Container.Handle);
    StartAnimation();
    // Try playing with these parameters
    Pulsating = true; // Rem this out to disable pulsating effect
    Velocity = true; // Rem this out to disable velocity effect 
    // BASS.dll
    BASS.Init(hFORM_Main);
    // Default audio file (Edit to use yours)
    BASS.FileToPlay = @"BlackBox.mp3"; 
    // Drag & drop 
    // It accepts only MP3 files dragged from Windows Explorer
    Api.DragAcceptFiles(hFORM_Main, true); 
} 

Last, But Not the Least

For those who may wonder why I am not using exclusively managed code, suffice to say that because I am working with different languages, it is easier for me (when writing demo) to use the only common denominator to all of them, the Flat Win32 API.

You can check for the latest demo version here in the "C# corner" section.

History

  • 18th October, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

zapsolution
Software Developer zapsolution
France France
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5membermanoj kumar choubey26-Feb-12 20:02 
Generalquestionmemberhossein_6322-Dec-08 1:32 
GeneralBassBox supersede the BlackBox projectmemberzapsolution14-Feb-08 21:22 
QuestionHow to make some areas opaque?memberJaguar3626-Sep-07 5:04 
AnswerRe: How to make some areas opaque?memberzapsolution26-Sep-07 8:17 
GeneralFlickeringmemberHoss Fly10-Sep-07 20:08 
AnswerRe: Flickeringmemberdawmail33314-Sep-07 1:31 
QuestionBass Dllmemberja.gooding22-Feb-07 14:50 
AnswerRe: Bass Dllmemberzapsolution22-Feb-07 18:39 
GeneralCool project, question about usagememberBurningToad24-Oct-06 12:07 
AnswerRe: Cool project, question about usagememberShady-Potter17-Nov-06 0:00 
GeneralRe: Cool project, question about usagememberBurningToad17-Nov-06 0:06 
GeneralRe: Cool project, question about usagememberzapsolution17-Nov-06 0:45 
GeneralRe: Cool project, question about usagememberspacekim231-Jul-07 4:14 
GeneralCool!membernick_journals18-Oct-06 20:43 
GeneralRe: Cool!memberzapsolution19-Oct-06 5:29 
GeneralRe: Cool!membernewspicy22-Jan-09 10:57 
GeneralRe: Cool!memberzapsolution22-Jan-09 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130617.1 | Last Updated 18 Oct 2006
Article Copyright 2006 by zapsolution
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid