//////////////////////////////////////////////////////////// // sound.h // // Header file for sound device classes for EDrive, a multiplatform // driving simulator. // // Copyright 2004 by Evan Alexander Weaver // // Despite the copyright, this is free software. See edrive.cpp for details. // // Date last modified: 31 May 2004 #ifndef _edrive_sound_h_ #define _edrive_sound_h_ #include "platform.h" #if ED_DIRECTX_9_AUDIO //*************************************************** #include #include #include #else //******************************************************************** #include #endif //******************************************************************* // A sound effect class sound { #if ED_DIRECTX_9_AUDIO //*********************************************** IDirectMusicSegment8 *seg; // Segment containing the sound IDirectMusicAudioPath8 *path; // Audiopath on which segment is played IDirectSoundBuffer8 *buf; // Sound buffer in the audiopath #else //**************************************************************** ALuint buf; // sound buffer ALuint src; // audio source on which buffer is played #endif //*************************************************************** bool ok; // is the sound playable? public: // sound is initially empty sound(); sound(const sound &); // intentionally omitted... sound &operator=(const sound &); // ...to prevent copies ~sound(); // stop and unload sound void destroy(); // play the sound void play(); // stop playing the sound void stop(); // associate the sound with an audio file #if ED_DIRECTX_9_AUDIO bool create(HWND hwnd, const char *file, bool repeat = true); #else bool create(int *pargc, char **argv, const char *file, bool repeat = true); #endif // return the frequency of the sound unsigned int frequency(); // change the frequency of the sound void frequency(unsigned int); // delete low level sound buffer for the sound void deletebuffer(); }; #endif