summaryrefslogtreecommitdiffstats
path: root/nebu/include/audio/nebu_SourceMusic.h
blob: 71695ad33259aa80b57754f21f14bba3dc2b286d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef NEBU_Sound_SourceMusic_H
#define NEBU_Sound_SourceMusic_H

#include "nebu_Sound.h"

#include "nebu_Source.h"
#include "nebu_SoundSystem.h"

namespace Sound {
  class SourceMusic : public Source {
  public:
    SourceMusic(System *system);
    virtual ~SourceMusic();
    void Load(char *filename);
    virtual int Mix(Uint8 *data, int len);
		virtual void Idle(void);

  protected:
    virtual void Reset(void) { 
      if(_sample != NULL) {
				CleanUp();
				CreateSample();
				// fprintf(stderr, "sample resetted\n");
      };
    };
    void CleanUp(void);
    void CreateSample(void);

  private:
    Sound_Sample* _sample;
		int _sample_buffersize;
		
		Uint8* _buffer;
    int _buffersize;
    int _read;
    int _decoded;

		char *_filename;
    SDL_RWops *_rwops;
  };
}
#endif