mdelibs/include/MDE/Sound/Sound.h
2025-11-24 19:49:08 +09:00

54 lines
1 KiB
C

#ifndef __MDE_SOUND_SOUND_H__
#define __MDE_SOUND_SOUND_H__
#include <MDE/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _MDESoundDriver MDESoundDriverRec, *MDESoundDriver;
typedef struct _MDESoundContext* MDESoundContext;
typedef struct _MDESound* MDESound;
struct _MDESoundContext {
int sample_rate;
int channels;
int frames;
void* opaque;
char* title;
char* album;
char* artist;
char* genre;
};
struct _MDESoundDriver {
MDESoundContext (*open)(const char* path);
void (*close)(MDESoundContext context);
int (*read)(MDESoundContext context, short* out, int frames);
void (*seek)(MDESoundContext context, int frames);
};
struct _MDESound {
MDESoundContext context;
MDESoundDriver driver;
};
extern MDESoundDriver MDESoundDriverMP3;
MDESound MDESoundOpen(const char* path);
int MDESoundRead(MDESound sound, short* out, int frames);
int MDESoundReadFloat(MDESound sound, float* out, int frames);
void MDESoundSeek(MDESound sound, int frames);
void MDESoundClose(MDESound sound);
#ifdef __cplusplus
}
#endif
#endif