| 1 |
#ifndef HEADER_SDLMUSICLOOPER_H |
| 2 |
#define HEADER_SDLMUSICLOOPER_H |
| 3 |
|
| 4 |
class Path; |
| 5 |
|
| 6 |
#include "SDL.h" |
| 7 |
#include "SDL_mixer.h" |
| 8 |
|
| 9 |
/** |
| 10 |
* Playing music in a loop. |
| 11 |
*/ |
| 12 |
class SDLMusicLooper { |
| 13 |
private: |
| 14 |
int m_volume; |
| 15 |
int m_position; |
| 16 |
|
| 17 |
Mix_Chunk *m_music; |
| 18 |
int m_startLoop, m_endLoop; |
| 19 |
|
| 20 |
private: |
| 21 |
void lookupLoopData(const Path &file, int multiplier); |
| 22 |
static void musicOutput(void *udata, Uint8 *stream, int length); |
| 23 |
|
| 24 |
public: |
| 25 |
SDLMusicLooper(const Path &file); |
| 26 |
virtual ~SDLMusicLooper(); |
| 27 |
void setVolume(int volume); |
| 28 |
void start(); |
| 29 |
void stop(); |
| 30 |
}; |
| 31 |
|
| 32 |
|
| 33 |
#endif |