Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » DirectX » General » Downloads
 
Add your own
alternative version

Interactive 3D Spectrum Analyzer Visualization for Windows Media Player

, 17 May 2009
Interactive 3D Spectrum Analyzer for Windows Media Player using DirectX 9 and some light GPGPU.
#pragma once
#include "glrendercontext.h"
#include "FreqDataBuff.h"
#include "windef.h"
#include <GL/gl.h>
#include <GL/glu.h>

#define HYTEQ_API_PTR APIENTRY *
#define GL_ARRAY_BUFFER                   0x8892
#define GL_READ_ONLY                      0x88B8
#define GL_WRITE_ONLY                     0x88B9
#define GL_READ_WRITE                     0x88BA
#define GL_BUFFER_ACCESS                  0x88BB
#define GL_BUFFER_MAPPED                  0x88BC
#define GL_BUFFER_MAP_POINTER             0x88BD
#define GL_STREAM_DRAW                    0x88E0
#define GL_STREAM_READ                    0x88E1
#define GL_STREAM_COPY                    0x88E2
#define GL_STATIC_DRAW                    0x88E4
#define GL_STATIC_READ                    0x88E5
#define GL_STATIC_COPY                    0x88E6
#define GL_DYNAMIC_DRAW                   0x88E8
#define GL_DYNAMIC_READ                   0x88E9
#define GL_DYNAMIC_COPY                   0x88EA
#define GL_SAMPLES_PASSED                 0x8914

typedef void (HYTEQ_API_PTR PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (HYTEQ_API_PTR PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (HYTEQ_API_PTR PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef GLboolean (HYTEQ_API_PTR PFNGLISBUFFERARBPROC) (GLuint buffer);
typedef void (HYTEQ_API_PTR PFNGLBUFFERDATAARBPROC) (GLenum target, ptrdiff_t size, const GLvoid *data, GLenum usage);
typedef void (HYTEQ_API_PTR PFNGLBUFFERSUBDATAARBPROC) (GLenum target, ptrdiff_t offset, ptrdiff_t size, const GLvoid *data);
typedef void (HYTEQ_API_PTR PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, ptrdiff_t offset, ptrdiff_t size, GLvoid *data);
typedef GLvoid* (HYTEQ_API_PTR PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
typedef GLboolean (HYTEQ_API_PTR PFNGLUNMAPBUFFERARBPROC) (GLenum target);
typedef void (HYTEQ_API_PTR PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (HYTEQ_API_PTR PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);

class GLSpectrumRender :
	public GLRenderContext
{
public:
	GLSpectrumRender();
	~GLSpectrumRender();

	void Initialize();
	void Destroy();
	void SubmitData(unsigned char* pucLeft, unsigned char* pucRight, HDC dc);

protected:
	void Render(HDC hDC);
	static void Run(void* context);

protected:
	bool	m_bAllowedToRender;
	bool	m_bIsRunning;
	bool	m_bIsInitialized;
	GLuint	m_rgbColors;
	GLuint	m_xyzVertices;

	HANDLE	m_hRenderThread;
	FreqDataBuff m_buffer;

	PFNGLBINDBUFFERARBPROC           glBindBuffer;
	PFNGLDELETEBUFFERSARBPROC        glDeleteBuffers;
	PFNGLGENBUFFERSARBPROC           glGenBuffers;
	PFNGLISBUFFERARBPROC             glIsBuffer;
	PFNGLBUFFERDATAARBPROC           glBufferData;
	PFNGLBUFFERSUBDATAARBPROC        glBufferSubData;
	PFNGLGETBUFFERSUBDATAARBPROC     glGetBufferSubData;
	PFNGLMAPBUFFERARBPROC            glMapBuffer;
	PFNGLUNMAPBUFFERARBPROC          glUnmapBuffer;
	PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameteriv;
	PFNGLGETBUFFERPOINTERVARBPROC    glGetBufferPointerv;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

About the Author

Carlo McWhirter
Software Developer (Senior) Hyteq Systems
United States United States
I have been programming in C/C++ for over 10 years now, and I've programmed in C# since the .NET 1.0 beta was released. I know a lot of other languages, but I find very few languages to be as capable as the C family of languages.
 
I've worked for a few large corporations, but my favorite job was when I worked for ATS (Automation Tooling Systems) as a Control Systems Engineer. Programming PLCs taught me about the core of computing and the currently under-utilized power of concurrent state machines. Programming real-time computer systems for vision guided robotics and multi-axis motion control is just fun.
 
My personal interest are computation for finance, aritificial intelligence, physics, electronics engineering, embedded systems, motion control, and of course Music/Audio.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 17 May 2009
Article Copyright 2009 by Carlo McWhirter
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid