Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
AUDIOSYSTEM.H
Package: openglsystem.rar [view]
Upload User: nthssl
Upload Date: 2022-04-05
Package Size: 25357k
Code Size: 3k
Category:
OpenCV
Development Platform:
Visual C++
- #ifndef __AUDIOSYSTEM_H
- #define __AUDIOSYSTEM_H
- #include <dmusicc.h> // DirectMusic includes
- #include <dmusici.h>
- #include <d3d8types.h> // for D3DVECTOR
- #include <cguid.h> // for GUID_NULL
- /*
- The CAudio class
- */
- class CAudio
- {
- private:
- IDirectMusicSegment8 *dmusicSegment; // the segment
- // The 3D buffer might not be used (e.g. background music).
- // It should only be used for 3D positional sounds.
- IDirectSound3DBuffer *ds3DBuffer;
- bool is3DSound; // true if this is a 3D sound
- protected:
- public:
- CAudio() { dmusicSegment = NULL; ds3DBuffer = NULL; is3DSound = false; }
- ~CAudio()
- {
- if (dmusicSegment != NULL)
- {
- dmusicSegment->Release();
- dmusicSegment = NULL;
- }
- if (ds3DBuffer != NULL)
- {
- ds3DBuffer->Release();
- ds3DBuffer = NULL;
- }
- }
- void SetSegment(IDirectMusicSegment8 *seg) { dmusicSegment = seg; }
- IDirectMusicSegment8 *GetSegment() { return dmusicSegment; }
- void Set3DBuffer(IDirectSound3DBuffer *dsBuff);
- IDirectSound3DBuffer *Get3DBuffer() { return ds3DBuffer; }
- bool Is3DSound() { return is3DSound; }
- void Set3DSound(bool b) { is3DSound = b; }
- void Set3DParams(float minDistance, float maxDistance);
- void Set3DPos(float x, float y, float z);
- };
- class CAudioSystem
- {
- private:
- IDirectMusicLoader8 *dmusicLoader; // the loader
- IDirectMusicPerformance8 *dmusicPerformance; // the performance
- IDirectMusicAudioPath8 *dmusic3DAudioPath; // the audiopath
- IDirectSound3DListener8 *ds3DListener; // 3d listener
- DS3DLISTENER dsListenerParams; // 3d listener properties
- public:
- CAudioSystem();
- ~CAudioSystem();
- bool InitDirectXAudio(HWND hwnd);
- IDirectSound3DBuffer8 *Create3DBuffer();
- CAudio *Create(char *filename, bool is3DSound);
- IDirectMusicSegment8 *CreateSegment(char *filename, bool is3DSound);
- void Play(CAudio *audio, DWORD numRepeats);
- void Stop(CAudio *audio);
- void PlaySegment(IDirectMusicSegment8 *dmSeg, bool is3DSound, DWORD numRepeats);
- void StopSegment(IDirectMusicSegment8 *dmSeg);
- void Shutdown();
- void SetListenerPos(float cameraX, float cameraY, float cameraZ);
- void SetListenerRolloff(float rolloff);
- void SetListenerOrientation(float forwardX, float forwardY, float forwardZ,
- float topX, float topY, float topZ)
- {
- ds3DListener->SetOrientation(forwardX, forwardY, -forwardZ, topX, topY, topZ, DS3D_IMMEDIATE);
- }
- IDirectMusicPerformance8 *GetPerformance() { return dmusicPerformance; }
- };
- #endif