Click here to Skip to main content
Licence CPOL
First Posted 17 Oct 2006
Views 54,074
Downloads 952
Bookmarked 48 times

Skinned Form Playing Audio and OpenGL Altogether

By | 17 Oct 2006 | Article
OpenGL + BASS Audio + AERO-GLASS style on XP
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

Member



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

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 Pinmembermanoj kumar choubey20:02 26 Feb '12  
Generalquestion Pinmemberhossein_631:32 22 Dec '08  
GeneralBassBox supersede the BlackBox project Pinmemberzapsolution21:22 14 Feb '08  
QuestionHow to make some areas opaque? PinmemberJaguar365:04 26 Sep '07  
AnswerRe: How to make some areas opaque? Pinmemberzapsolution8:17 26 Sep '07  
GeneralFlickering PinmemberHoss Fly20:08 10 Sep '07  
AnswerRe: Flickering Pinmemberdawmail3331:31 14 Sep '07  
QuestionBass Dll Pinmemberja.gooding14:50 22 Feb '07  
AnswerRe: Bass Dll Pinmemberzapsolution18:39 22 Feb '07  
GeneralCool project, question about usage PinmemberBurningToad12:07 24 Oct '06  
AnswerRe: Cool project, question about usage PinmemberShady-Potter0:00 17 Nov '06  
GeneralRe: Cool project, question about usage PinmemberBurningToad0:06 17 Nov '06  
GeneralRe: Cool project, question about usage Pinmemberzapsolution0:45 17 Nov '06  
GeneralRe: Cool project, question about usage Pinmemberspacekim24:14 31 Jul '07  
GeneralCool! Pinmembernick_journals20:43 18 Oct '06  
GeneralRe: Cool! Pinmemberzapsolution5:29 19 Oct '06  
GeneralRe: Cool! Pinmembernewspicy10:57 22 Jan '09  
GeneralRe: Cool! Pinmemberzapsolution11:10 22 Jan '09  

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

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