Ejemplo n.º 1
0
	SoundStream *WavLoader::open(std::string name, DataSource *source)
	{
		WavStream *stream = new WavStream();
		if (!stream->load(name, source))
		{
			delete stream;
			return 0;
		}
		return stream;
	}
Ejemplo n.º 2
0
/*
 * in  - wav file stream to play.  Claims ownership and will delete it.
 * vol - volume/panning
 *
 * return: 1 on success, 0 on failure
 */
int OpenALAudio::play_long_wav(InputStream *in, const DsVolume &vol)
{
   const int BUFFER_COUNT = 4;

   StreamContext *sc = NULL;
   WavStream *ws = NULL;
   int id;

   assert(this->wav_init_flag);

   ws = new WavStream;
   if (!ws->open(in))
   {
      delete in;
      goto err;
   }

   sc = new StreamContext;

   if (!sc->init(ws))
      goto err;

   set_source_panning(sc->source, vol.ds_pan);
   set_source_volume(sc->source, vol.ds_vol + this->wav_volume);

   if (!check_al())
      goto err;

   sc->stream_data(BUFFER_COUNT);

   id = unused_key(&this->streams);
   this->streams[id] = sc;

   return id;

err:
   delete sc;
   delete ws;
   return 0;
}
Ejemplo n.º 3
0
void WavStream_set3dDistanceDelay(void * aClassPtr, int aDistanceDelay)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dDistanceDelay(!!aDistanceDelay);
}
Ejemplo n.º 4
0
void WavStream_set3dListenerRelative(void * aClassPtr, int aListenerRelative)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dListenerRelative(!!aListenerRelative);
}
Ejemplo n.º 5
0
void WavStream_set3dProcessing(void * aClassPtr, int aDo3dProcessing)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dProcessing(!!aDo3dProcessing);
}
Ejemplo n.º 6
0
void WavStream_set3dDopplerFactor(void * aClassPtr, float aDopplerFactor)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dDopplerFactor(aDopplerFactor);
}
Ejemplo n.º 7
0
void WavStream_setFilter(void * aClassPtr, unsigned int aFilterId, Filter * aFilter)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->setFilter(aFilterId, aFilter);
}
Ejemplo n.º 8
0
void WavStream_set3dAttenuator(void * aClassPtr, AudioAttenuator * aAttenuator)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dAttenuator(aAttenuator);
}
Ejemplo n.º 9
0
void WavStream_setVolume(void * aClassPtr, float aVolume)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->setVolume(aVolume);
}
Ejemplo n.º 10
0
double WavStream_getLength(void * aClassPtr)
{
	WavStream * cl = (WavStream *)aClassPtr;
	return cl->getLength();
}
Ejemplo n.º 11
0
int WavStream_loadFileToMem(void * aClassPtr, File * aFile)
{
	WavStream * cl = (WavStream *)aClassPtr;
	return cl->loadFileToMem(aFile);
}
Ejemplo n.º 12
0
int WavStream_loadToMem(void * aClassPtr, const char * aFilename)
{
	WavStream * cl = (WavStream *)aClassPtr;
	return cl->loadToMem(aFilename);
}
Ejemplo n.º 13
0
int WavStream_loadMemEx(void * aClassPtr, unsigned char * aData, unsigned int aDataLen, int aCopy, int aTakeOwnership)
{
	WavStream * cl = (WavStream *)aClassPtr;
	return cl->loadMem(aData, aDataLen, !!aCopy, !!aTakeOwnership);
}
Ejemplo n.º 14
0
int WavStream_loadMem(void * aClassPtr, unsigned char * aData, unsigned int aDataLen)
{
	WavStream * cl = (WavStream *)aClassPtr;
	return cl->loadMem(aData, aDataLen);
}
Ejemplo n.º 15
0
void WavStream_set3dCollider(void * aClassPtr, AudioCollider * aCollider)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dCollider(aCollider);
}
Ejemplo n.º 16
0
void WavStream_set3dColliderEx(void * aClassPtr, AudioCollider * aCollider, int aUserData)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dCollider(aCollider, aUserData);
}
Ejemplo n.º 17
0
void WavStream_setLooping(void * aClassPtr, int aLoop)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->setLooping(!!aLoop);
}
Ejemplo n.º 18
0
void WavStream_setInaudibleBehavior(void * aClassPtr, int aMustTick, int aKill)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->setInaudibleBehavior(!!aMustTick, !!aKill);
}
Ejemplo n.º 19
0
void WavStream_set3dMinMaxDistance(void * aClassPtr, float aMinDistance, float aMaxDistance)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dMinMaxDistance(aMinDistance, aMaxDistance);
}
Ejemplo n.º 20
0
void WavStream_stop(void * aClassPtr)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->stop();
}
Ejemplo n.º 21
0
void WavStream_set3dAttenuation(void * aClassPtr, unsigned int aAttenuationModel, float aAttenuationRolloffFactor)
{
	WavStream * cl = (WavStream *)aClassPtr;
	cl->set3dAttenuation(aAttenuationModel, aAttenuationRolloffFactor);
}