Code: Select all
module audiere;
private import std.c.windows.com;
extern (Windows)
{
interface RefCounted
{
void ref(); // int
void unref(); // int
}
interface File: RefCounted, IUnknown
{
int read(int pbuffer, int size); // int
bool seek(int position, int SeekMode); // bool
int tell(); // int
}
interface SampleBuffer: RefCounted, IUnknown
{
void getFormat(int channel_count,int sample_rate,int lsample_format); // void
int getLength(); // int
int getSamples(); // int
SampleSource openStream(); // pSampleSource
}
interface SampleSource: RefCounted, IUnknown
{
void getFormat(int v,int v); // void
int Read(int v, int v); // int
void reset(); // void
bool isSeekable(); // bool
int getLength(); // int
void setPosition(int v); // void
int getPosition(); // int
bool getRepeat(); // bool
void setRepeat(int v); // void
}
interface LoopPointSource: SampleSource, IUnknown
{
void addLoopPoint(int location,int target, int loopCount); // void
void removeLoopPoint(int index); // void
int getLoopPointCount(); // int
bool getLoopPoint(int index,int plocation,int ptarget,int ploopCount); // bool
}
interface OutputStream: RefCounted, IUnknown
{
bool play();
bool stop(); // bool
bool isPlaying(); // bool
void reset(); // void
void setRepeat(int v); // void
bool getRepeat(); // bool
void setVolume(float v); // void
float getVolume(); // float
void setPan(float v); // void
float getPan(); // float
void setPitchShift(float v); // void
float getPitchShift(); // float
bool isSeekable(); // bool
int getLength(); // int
void setPosition(int v); // void
int getPosition(); // int
}
interface AudioDevice: RefCounted, IUnknown
{
void update(); // void
OutputStream openStream(SampleSource pSampleSource); // pAudOutputStream
OutputStream openBuffer(void* pSamples,int frame_count,int channel_count,int sample_rate,int sample_format);// pAudOutputStream
char* getName(); // char.l
}
interface SoundEffect: RefCounted, IUnknown
{
void play(); // void
void stop(); // void
void setVolume(float volume); // void
float getVolume(); // float
void setPan(float pan); // void
float getPan(); // float
void setPitchShift(float shift); // void
float getPitchShift(); // float
}
}//End of extern(Windows)
enum SampleFormat
{
SF_U8, // unsigned 8-bit integer [0,255]
SF_S16 // signed 16-bit integer in host endianness [-32768,32767]
}
enum FileFormat
{
FF_AUTODETECT,
FF_WAV,
FF_OGG,
FF_FLAC,
FF_MP3,
FF_MOD,
FF_AIFF
}
enum SoundEffectType
{
SINGLE,
MULTIPLE
}
enum SeekMode
{
begin,
current,
end
}
extern(Windows)
{
char* AdrGetVersion();
alias AdrGetVersion GetVersion;
/**
* Returns a formatted string that lists the file formats that Audiere
* supports. This function is DLL-safe.
*
* It is formatted in the following way:
*
* description1:ext1,ext2,ext3;description2:ext1,ext2,ext3
*/
char* AdrGetSupportedFileFormats();
alias AdrGetSupportedFileFormats GetSupportedFileFormats;
/**
* Returns a formatted string that lists the audio devices Audiere
* supports. This function is DLL-safe.
*
* It is formatted in the following way:
*
* name1:description1;name2:description2;...
*/
char* AdrGetSupportedAudioDevices();
alias AdrGetSupportedAudioDevices GetSupportedAudioDevices;
int AdrGetSampleSize(SampleFormat format);
alias AdrGetSampleSize GetSampleSize;
AudioDevice AdrOpenDevice(char* name = null, char* parameters = null);
alias AdrOpenDevice OpenDevice;
SampleSource AdrOpenSampleSource(char* filename, FileFormat file_format);
alias AdrOpenSampleSource OpenSampleSource;
SampleSource AdrOpenSampleSourceFromFile(File file, FileFormat file_format);
alias AdrOpenSampleSourceFromFile OpenSampleSourceFromFile;
SampleSource AdrCreateTone(double frequency);
alias AdrCreateTone CreateTone;
SampleSource AdrCreateSquareWave(double frequency);
alias AdrCreateSquareWave CreateSquareWave;
SampleSource AdrCreateWhiteNoise();
alias AdrCreateWhiteNoise CreateWhiteNoise;
SampleSource AdrCreatePinkNoise();
alias AdrCreatePinkNoise CreatePinkNoise;
LoopPointSource AdrCreateLoopPointSource(SampleSource source);
alias AdrCreateLoopPointSource CreateLoopPointSource;
OutputStream AdrOpenSound(AudioDevice device, SampleSource source, bool streaming);
alias AdrOpenSound OpenSound;
SampleBuffer AdrCreateSampleBuffer(void* samples, int frame_count, int channel_count,
int sample_rate,
SampleFormat sample_format);
alias AdrCreateSampleBuffer CreateSampleBuffer;
SampleBuffer AdrCreateSampleBufferFromSource(SampleSource source);
alias AdrCreateSampleBufferFromSource CreateSampleBufferFromSource;
SoundEffect AdrOpenSoundEffect(AudioDevice device, SampleSource source, SoundEffectType type);
alias AdrOpenSoundEffect OpenSoundEffect;
File AdrOpenFile(char* name, bool writeable);
alias AdrOpenFile OpenFile;
File AdrCreateMemoryFile(void* buffer, int size);
alias AdrCreateMemoryFile CreateMemoryFile;
}//End extern(Windows)