Click here to Skip to main content
15,894,017 members
Articles / Desktop Programming / Win32

Play Audio Files with DirectSound and Display its Spectrum in Real Time - Part 3

Rate me:
Please Sign up or sign in to vote.
4.93/5 (21 votes)
24 Dec 2008CPOL3 min read 274.4K   17.7K   86  
An article to show how to play audio file with DirectSound and display its spectrum in real time accurately
#pragma once

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN

#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <math.h>
#include <windows.h>
#include <commdlg.h>
#include <mmreg.h>
#include <mmsystem.h>
#include <dsound.h>
#include <strsafe.h>
#include <wmsdk.h>
#include <msacm.h>

/* libmad support */
#include "mad.h"

/* libogg support */
#include "ogg/ogg.h"

/* libvorbis support */
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"

#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "strsafe.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "wmvcore.lib")
#pragma comment(lib, "msimg32.lib")
#pragma comment(lib, "msacm32.lib")

#define USE_DAUDIO TRUE
#define USE_ERROR
#define USE_TRACE

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)


Written By
Software Developer none
China China
To be, or not to be, this is question. That's are all depend on your decision. What do you think?

Comments and Discussions