fishbowl/engine/include/fishbone/sound.h

54 lines
914 B
C
Raw Normal View History

2026-05-25 07:25:59 +09:00
#ifndef __FISHBONE_SOUND_H__
#define __FISHBONE_SOUND_H__
namespace fishbone {
class SoundDriver;
class SoundLoader;
2026-05-25 12:39:31 +09:00
class Sound;
2026-05-25 12:12:03 +09:00
}; // namespace fishbone
2026-05-25 07:25:59 +09:00
2026-05-25 12:39:31 +09:00
#include <fishbone/machdep.h>
2026-05-25 07:25:59 +09:00
#include <fishbone/mixer.h>
2026-05-27 16:03:38 +09:00
#ifdef _FISHBONE
#if defined(FISHBONE_SOUND_USE_SDL2)
typedef size_t FISHBONE_SOUNDDRV_HANDLE;
#endif
#else
typedef void* FISHBONE_SOUNDDRV_HANDLE;
#endif
2026-05-25 07:25:59 +09:00
namespace fishbone {
class SoundDriver {
2026-05-27 16:03:38 +09:00
FISHBONE_SOUNDDRV_HANDLE sound;
public:
SoundDriver();
~SoundDriver();
2026-05-25 07:25:59 +09:00
fishbone::Mixer mixer;
};
2026-05-27 16:03:38 +09:00
2026-05-25 07:25:59 +09:00
class SoundLoader {
2026-05-27 16:03:38 +09:00
public:
SoundLoader();
~SoundLoader();
virtual Sound* open(void* buffer, size_t size);
virtual int read(Sound* sound, short* buffer, size_t frames);
2026-05-25 07:25:59 +09:00
};
2026-05-27 16:03:38 +09:00
2026-05-25 12:39:31 +09:00
class Sound {
2026-05-27 16:03:38 +09:00
SoundLoader* loader;
public:
Sound(SoundLoader* loader);
int read(short* buffer, size_t frames);
int rate;
int channels;
2026-05-25 12:39:31 +09:00
};
2026-05-25 12:12:03 +09:00
}; // namespace fishbone
2026-05-25 07:25:59 +09:00
#endif