Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

99 lines (68 sloc) 1.25 kb
#ifndef slelib_win32_soundwave_h
#define slelib_win32_soundwave_h
// XXX
// This really should be rolled into sndfx.cpp somehow.
// j.h.
// XXX
#if defined(linux) || (defined(__APPLE__) && defined(__GNUC__))
struct SoundWave
{
SoundWave(const char *f)
{
}
~SoundWave()
{
}
// Plays a raw .wav file image from memory.
// Returns true if successful.
void play()
{
}
void loop()
{
}
void stop()
{
}
};
#endif
////////////////////////////////////////////////////////////
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff
#include <windows.h>
#include <mmsystem.h>
#include "file.cpp"
struct SoundWave
{
File *file;
const unsigned char *mem;
SoundWave(const char *f)
{
file = 0;
mem = 0;
file = new File(f);
if(file)
mem = file->getBytes();
}
~SoundWave()
{
if(file)
delete file;
}
// Plays a raw .wav file image from memory.
// Returns true if successful.
void play()
{
PlaySound((const char *)mem, NULL, SND_NOSTOP | SND_MEMORY | SND_NODEFAULT | SND_ASYNC);
}
void loop()
{
PlaySound((const char *)mem, NULL, SND_LOOP | SND_NOSTOP | SND_MEMORY | SND_NODEFAULT | SND_ASYNC);
}
void stop()
{
PlaySound(0, NULL, SND_PURGE);
}
};
#endif
#endif
Jump to Line
Something went wrong with that request. Please try again.