sound.h 909 Bytes
Newer Older
RobLoach's avatar
RobLoach committed
1
2
#ifndef SRC_LOVE_SOUND_H_
#define SRC_LOVE_SOUND_H_
RobLoach's avatar
RobLoach committed
3

RobLoach's avatar
RobLoach committed
4
#include "Types/Audio/SoundData.h"
RobLoach's avatar
Updates    
RobLoach committed
5
#include <vector>
6
#include "libretro.h"
RobLoach's avatar
RobLoach committed
7

RobLoach's avatar
RobLoach committed
8
namespace love {
RobLoach's avatar
RobLoach committed
9
10

/**
RobLoach's avatar
RobLoach committed
11
 * This module is responsible for decoding sound files. It can't play the sounds, see love.audio for that.
RobLoach's avatar
RobLoach committed
12
13
14
15
 */
class sound {
	public:
	bool load();
16
	bool isLoaded();
RobLoach's avatar
RobLoach committed
17
18
	bool hasAudio();
	void unload();
19
	void update();
RobLoach's avatar
RobLoach committed
20
	~sound();
RobLoach's avatar
RobLoach committed
21

22
23
24

	// void convert_float_to_s16(int16_t *out, const float *in, size_t samples);

RobLoach's avatar
RobLoach committed
25
	/**
RobLoach's avatar
RobLoach committed
26
	 * Creates a new SoundData.
RobLoach's avatar
RobLoach committed
27
28
29
	 *
	 * @param filename The file name of the file to load.
	 *
RobLoach's avatar
RobLoach committed
30
	 * @return A new SoundData object, NULL if loading failed.
RobLoach's avatar
RobLoach committed
31
	 */
RobLoach's avatar
RobLoach committed
32
	Types::Audio::SoundData* newSoundData(const std::string& filename);
RobLoach's avatar
RobLoach committed
33
34

	std::vector<Types::Audio::SoundData*> sounds;
35
36
37
38
39

	bool m_loaded = false;

	retro_audio_sample_t audio_cb = NULL;
	retro_audio_sample_batch_t audio_batch_cb = NULL;
RobLoach's avatar
RobLoach committed
40
41
};

RobLoach's avatar
RobLoach committed
42
}  // namespace love
RobLoach's avatar
Updates    
RobLoach committed
43

RobLoach's avatar
RobLoach committed
44
#endif  // SRC_LOVE_SOUND_H_