iMackshun

AudioManager.h

Jan 3rd, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #ifndef AUDIOMANAGER_H
  2. #define AUDIOMANAGER_H
  3.  
  4. /**DESCRIPTION: The platform-dependent class used to manage audio playback.**/
  5.  
  6. /**C INCLUDES**/
  7. #include "stdio.h"
  8. #include "stdlib.h"
  9. #include "string.h"
  10. #include "math.h"
  11.  
  12. /**C++ INCLUDES**/
  13. #include <vector>
  14.  
  15. /**PLATFORM INCLUDES**/
  16. #include <PortAudio\portaudio.h>
  17.  
  18. /**ENGINE INCLUDES**/
  19. #include "AudioInstance.h"
  20.  
  21. /*DEFINITIONS*/
  22. #define SAMPLE_RATE 44100
  23. #define FRAMES_PER_BUFFER 1
  24. #define SAMPLES_PER_BUFFER (FRAMES_PER_BUFFER * 2)
  25.  
  26. class AudioManager{
  27. public:
  28.     //Constructor
  29.     AudioManager();
  30.     //Destructor
  31.     ~AudioManager();
  32.     //Functions
  33.     //Initializes the platform's audio library.
  34.     void Init();
  35.     //Updates the AudioManager. Used to get rid of audio that has completed playback.
  36.     void Update();
  37.     //Plays an Audio file.
  38.     void PlayAudio(AudioInstance* audioObject);
  39.     //Pauses an Audio file.
  40.     void PauseAudio();
  41.     //Stops an Audio file, essentially a pause and reset.
  42.     void StopAudio();
  43.     //Shuts down the platform's audio library and releases memory.
  44.     void Destroy();
  45.     //Members
  46.     //The audio data that is to be output to the speakers.
  47.     PaStream* outputStream = NULL; 
  48.     //A pointer to memory allocated to store audio data.
  49.     short* audioData = NULL;
  50. };
  51.  
  52. #endif
Advertisement
Add Comment
Please, Sign In to add comment