style cleanup
This commit is contained in:
@@ -99,7 +99,7 @@ typedef AUD_Reference<AUD_SequencerEntry> AUD_SEntry;
|
||||
#include "AUD_C-API.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
# define NULL (void *)0
|
||||
#endif
|
||||
|
||||
static AUD_Reference<AUD_IDevice> AUD_device;
|
||||
@@ -116,13 +116,12 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
|
||||
{
|
||||
AUD_Reference<AUD_IDevice> dev;
|
||||
|
||||
if(!AUD_device.isNull())
|
||||
if (!AUD_device.isNull()) {
|
||||
AUD_exit();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch(device)
|
||||
{
|
||||
try {
|
||||
switch(device) {
|
||||
case AUD_NULL_DEVICE:
|
||||
dev = new AUD_NULLDevice();
|
||||
break;
|
||||
@@ -140,8 +139,7 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
|
||||
case AUD_JACK_DEVICE:
|
||||
#ifdef __APPLE__
|
||||
struct stat st;
|
||||
if(stat("/Library/Frameworks/Jackmp.framework", &st) != 0)
|
||||
{
|
||||
if (stat("/Library/Frameworks/Jackmp.framework", &st) != 0) {
|
||||
printf("Warning: Jack Framework not installed\n");
|
||||
// No break, fall through to default, to return false
|
||||
}
|
||||
@@ -178,11 +176,9 @@ void AUD_exit()
|
||||
#ifdef WITH_PYTHON
|
||||
static PyObject *AUD_getCDevice(PyObject *self)
|
||||
{
|
||||
if(!AUD_device.isNull())
|
||||
{
|
||||
if (!AUD_device.isNull()) {
|
||||
Device *device = (Device *)Device_empty();
|
||||
if(device != NULL)
|
||||
{
|
||||
if (device != NULL) {
|
||||
device->device = new AUD_Reference<AUD_IDevice>(AUD_device);
|
||||
return (PyObject *)device;
|
||||
}
|
||||
@@ -191,11 +187,13 @@ static PyObject* AUD_getCDevice(PyObject* self)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyMethodDef meth_getcdevice[] = {{ "device", (PyCFunction)AUD_getCDevice, METH_NOARGS,
|
||||
static PyMethodDef meth_getcdevice[] = {
|
||||
{"device", (PyCFunction)AUD_getCDevice, METH_NOARGS,
|
||||
"device()\n\n"
|
||||
"Returns the application's :class:`Device`.\n\n"
|
||||
":return: The application's :class:`Device`.\n"
|
||||
":rtype: :class:`Device`"}};
|
||||
":rtype: :class:`Device`"}
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
extern void *sound_get_factory(void *sound);
|
||||
@@ -205,17 +203,13 @@ static PyObject* AUD_getSoundFromPointer(PyObject* self, PyObject* args)
|
||||
{
|
||||
long int lptr;
|
||||
|
||||
if(PyArg_Parse(args, "l:_sound_from_pointer", &lptr))
|
||||
{
|
||||
if(lptr)
|
||||
{
|
||||
if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
|
||||
if (lptr) {
|
||||
AUD_Reference<AUD_IFactory>* factory = (AUD_Reference<AUD_IFactory>*) sound_get_factory((void *) lptr);
|
||||
|
||||
if(factory)
|
||||
{
|
||||
if (factory) {
|
||||
Factory *obj = (Factory *)Factory_empty();
|
||||
if(obj)
|
||||
{
|
||||
if (obj) {
|
||||
obj->factory = new AUD_Reference<AUD_IFactory>(*factory);
|
||||
return (PyObject *) obj;
|
||||
}
|
||||
@@ -226,13 +220,15 @@ static PyObject* AUD_getSoundFromPointer(PyObject* self, PyObject* args)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyMethodDef meth_sound_from_pointer[] = {{ "_sound_from_pointer", (PyCFunction)AUD_getSoundFromPointer, METH_O,
|
||||
static PyMethodDef meth_sound_from_pointer[] = {
|
||||
{"_sound_from_pointer", (PyCFunction)AUD_getSoundFromPointer, METH_O,
|
||||
"_sound_from_pointer(pointer)\n\n"
|
||||
"Returns the corresponding :class:`Factory` object.\n\n"
|
||||
":arg pointer: The pointer to the bSound object as long.\n"
|
||||
":type pointer: long\n"
|
||||
":return: The corresponding :class:`Factory` object.\n"
|
||||
":rtype: :class:`Factory`"}};
|
||||
":rtype: :class:`Factory`"}
|
||||
};
|
||||
|
||||
PyObject *AUD_initPython()
|
||||
{
|
||||
@@ -246,11 +242,9 @@ PyObject* AUD_initPython()
|
||||
|
||||
void *AUD_getPythonFactory(AUD_Sound *sound)
|
||||
{
|
||||
if(sound)
|
||||
{
|
||||
if (sound) {
|
||||
Factory *obj = (Factory *) Factory_empty();
|
||||
if(obj)
|
||||
{
|
||||
if (obj) {
|
||||
obj->factory = new AUD_Reference<AUD_IFactory>(*sound);
|
||||
return (PyObject *) obj;
|
||||
}
|
||||
@@ -290,12 +284,10 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
|
||||
info.specs.rate = AUD_RATE_INVALID;
|
||||
info.length = 0.0f;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_Reference<AUD_IReader> reader = (*sound)->createReader();
|
||||
|
||||
if(!reader.isNull())
|
||||
{
|
||||
if (!reader.isNull()) {
|
||||
info.specs = reader->getSpecs();
|
||||
info.length = reader->getLength() / (float) info.specs.rate;
|
||||
}
|
||||
@@ -323,8 +315,7 @@ AUD_Sound* AUD_bufferSound(AUD_Sound* sound)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Sound(new AUD_StreamBufferFactory(*sound));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -337,8 +328,7 @@ AUD_Sound* AUD_monoSound(AUD_Sound* sound)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_DeviceSpecs specs;
|
||||
specs.channels = AUD_CHANNELS_MONO;
|
||||
specs.rate = AUD_RATE_INVALID;
|
||||
@@ -355,8 +345,7 @@ AUD_Sound* AUD_delaySound(AUD_Sound* sound, float delay)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Sound(new AUD_DelayFactory(*sound, delay));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -369,8 +358,7 @@ AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Sound(new AUD_LimiterFactory(*sound, start, end));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -383,8 +371,7 @@ AUD_Sound* AUD_pingpongSound(AUD_Sound* sound)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Sound(new AUD_PingPongFactory(*sound));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -397,8 +384,7 @@ AUD_Sound* AUD_loopSound(AUD_Sound* sound)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Sound(new AUD_LoopFactory(*sound));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -411,8 +397,7 @@ int AUD_setLoop(AUD_Handle* handle, int loops)
|
||||
{
|
||||
assert(handle);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return (*handle)->setLoopCount(loops);
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -426,8 +411,7 @@ AUD_Sound* AUD_rectifySound(AUD_Sound* sound)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Sound(new AUD_RectifyFactory(*sound));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -445,12 +429,12 @@ void AUD_unload(AUD_Sound* sound)
|
||||
AUD_Handle *AUD_play(AUD_Sound *sound, int keep)
|
||||
{
|
||||
assert(sound);
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_Handle handle = AUD_device->play(*sound, keep);
|
||||
if(!handle.isNull())
|
||||
if (!handle.isNull()) {
|
||||
return new AUD_Handle(handle);
|
||||
}
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
{
|
||||
}
|
||||
@@ -501,10 +485,9 @@ AUD_Status AUD_getStatus(AUD_Handle* handle)
|
||||
return (*handle)->getStatus();
|
||||
}
|
||||
|
||||
int AUD_setListenerLocation(const float* location)
|
||||
{
|
||||
if(AUD_3ddevice)
|
||||
int AUD_setListenerLocation(const float location[3])
|
||||
{
|
||||
if (AUD_3ddevice) {
|
||||
AUD_Vector3 v(location[0], location[1], location[2]);
|
||||
AUD_3ddevice->setListenerLocation(v);
|
||||
return true;
|
||||
@@ -513,10 +496,9 @@ int AUD_setListenerLocation(const float* location)
|
||||
return false;
|
||||
}
|
||||
|
||||
int AUD_setListenerVelocity(const float* velocity)
|
||||
{
|
||||
if(AUD_3ddevice)
|
||||
int AUD_setListenerVelocity(const float velocity[3])
|
||||
{
|
||||
if (AUD_3ddevice) {
|
||||
AUD_Vector3 v(velocity[0], velocity[1], velocity[2]);
|
||||
AUD_3ddevice->setListenerVelocity(v);
|
||||
return true;
|
||||
@@ -525,10 +507,9 @@ int AUD_setListenerVelocity(const float* velocity)
|
||||
return false;
|
||||
}
|
||||
|
||||
int AUD_setListenerOrientation(const float* orientation)
|
||||
{
|
||||
if(AUD_3ddevice)
|
||||
int AUD_setListenerOrientation(const float orientation[4])
|
||||
{
|
||||
if (AUD_3ddevice) {
|
||||
AUD_Quaternion q(orientation[3], orientation[0], orientation[1], orientation[2]);
|
||||
AUD_3ddevice->setListenerOrientation(q);
|
||||
return true;
|
||||
@@ -539,8 +520,7 @@ int AUD_setListenerOrientation(const float* orientation)
|
||||
|
||||
int AUD_setSpeedOfSound(float speed)
|
||||
{
|
||||
if(AUD_3ddevice)
|
||||
{
|
||||
if (AUD_3ddevice) {
|
||||
AUD_3ddevice->setSpeedOfSound(speed);
|
||||
return true;
|
||||
}
|
||||
@@ -550,8 +530,7 @@ int AUD_setSpeedOfSound(float speed)
|
||||
|
||||
int AUD_setDopplerFactor(float factor)
|
||||
{
|
||||
if(AUD_3ddevice)
|
||||
{
|
||||
if (AUD_3ddevice) {
|
||||
AUD_3ddevice->setDopplerFactor(factor);
|
||||
return true;
|
||||
}
|
||||
@@ -561,8 +540,7 @@ int AUD_setDopplerFactor(float factor)
|
||||
|
||||
int AUD_setDistanceModel(AUD_DistanceModel model)
|
||||
{
|
||||
if(AUD_3ddevice)
|
||||
{
|
||||
if (AUD_3ddevice) {
|
||||
AUD_3ddevice->setDistanceModel(model);
|
||||
return true;
|
||||
}
|
||||
@@ -570,13 +548,12 @@ int AUD_setDistanceModel(AUD_DistanceModel model)
|
||||
return false;
|
||||
}
|
||||
|
||||
int AUD_setSourceLocation(AUD_Handle* handle, const float* location)
|
||||
int AUD_setSourceLocation(AUD_Handle *handle, const float location[3])
|
||||
{
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
AUD_Vector3 v(location[0], location[1], location[2]);
|
||||
return h->setSourceLocation(v);
|
||||
}
|
||||
@@ -584,13 +561,12 @@ int AUD_setSourceLocation(AUD_Handle* handle, const float* location)
|
||||
return false;
|
||||
}
|
||||
|
||||
int AUD_setSourceVelocity(AUD_Handle* handle, const float* velocity)
|
||||
int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3])
|
||||
{
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
AUD_Vector3 v(velocity[0], velocity[1], velocity[2]);
|
||||
return h->setSourceVelocity(v);
|
||||
}
|
||||
@@ -598,13 +574,12 @@ int AUD_setSourceVelocity(AUD_Handle* handle, const float* velocity)
|
||||
return false;
|
||||
}
|
||||
|
||||
int AUD_setSourceOrientation(AUD_Handle* handle, const float* orientation)
|
||||
int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4])
|
||||
{
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
AUD_Quaternion q(orientation[3], orientation[0], orientation[1], orientation[2]);
|
||||
return h->setSourceOrientation(q);
|
||||
}
|
||||
@@ -617,8 +592,7 @@ int AUD_setRelative(AUD_Handle* handle, int relative)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setRelative(relative);
|
||||
}
|
||||
|
||||
@@ -630,8 +604,7 @@ int AUD_setVolumeMaximum(AUD_Handle* handle, float volume)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setVolumeMaximum(volume);
|
||||
}
|
||||
|
||||
@@ -643,8 +616,7 @@ int AUD_setVolumeMinimum(AUD_Handle* handle, float volume)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setVolumeMinimum(volume);
|
||||
}
|
||||
|
||||
@@ -656,8 +628,7 @@ int AUD_setDistanceMaximum(AUD_Handle* handle, float distance)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setDistanceMaximum(distance);
|
||||
}
|
||||
|
||||
@@ -669,8 +640,7 @@ int AUD_setDistanceReference(AUD_Handle* handle, float distance)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setDistanceReference(distance);
|
||||
}
|
||||
|
||||
@@ -682,8 +652,7 @@ int AUD_setAttenuation(AUD_Handle* handle, float factor)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setAttenuation(factor);
|
||||
}
|
||||
|
||||
@@ -695,8 +664,7 @@ int AUD_setConeAngleOuter(AUD_Handle* handle, float angle)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setConeAngleOuter(angle);
|
||||
}
|
||||
|
||||
@@ -708,8 +676,7 @@ int AUD_setConeAngleInner(AUD_Handle* handle, float angle)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setConeAngleInner(angle);
|
||||
}
|
||||
|
||||
@@ -721,8 +688,7 @@ int AUD_setConeVolumeOuter(AUD_Handle* handle, float volume)
|
||||
assert(handle);
|
||||
AUD_Reference<AUD_I3DHandle> h(*handle);
|
||||
|
||||
if(!h.isNull())
|
||||
{
|
||||
if (!h.isNull()) {
|
||||
return h->setConeVolumeOuter(volume);
|
||||
}
|
||||
|
||||
@@ -732,8 +698,7 @@ int AUD_setConeVolumeOuter(AUD_Handle* handle, float volume)
|
||||
int AUD_setSoundVolume(AUD_Handle *handle, float volume)
|
||||
{
|
||||
assert(handle);
|
||||
try
|
||||
{
|
||||
try {
|
||||
return (*handle)->setVolume(volume);
|
||||
}
|
||||
catch(AUD_Exception&) {}
|
||||
@@ -743,8 +708,7 @@ int AUD_setSoundVolume(AUD_Handle* handle, float volume)
|
||||
int AUD_setSoundPitch(AUD_Handle *handle, float pitch)
|
||||
{
|
||||
assert(handle);
|
||||
try
|
||||
{
|
||||
try {
|
||||
return (*handle)->setPitch(pitch);
|
||||
}
|
||||
catch(AUD_Exception&) {}
|
||||
@@ -753,8 +717,7 @@ int AUD_setSoundPitch(AUD_Handle* handle, float pitch)
|
||||
|
||||
AUD_Device *AUD_openReadDevice(AUD_DeviceSpecs specs)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
return new AUD_Device(new AUD_ReadDevice(specs));
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -768,11 +731,9 @@ AUD_Handle* AUD_playDevice(AUD_Device* device, AUD_Sound* sound, float seek)
|
||||
assert(device);
|
||||
assert(sound);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_Handle handle = (*device)->play(*sound);
|
||||
if(!handle.isNull())
|
||||
{
|
||||
if (!handle.isNull()) {
|
||||
handle->seek(seek);
|
||||
return new AUD_Handle(handle);
|
||||
}
|
||||
@@ -787,8 +748,7 @@ int AUD_setDeviceVolume(AUD_Device* device, float volume)
|
||||
{
|
||||
assert(device);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
(*device)->setVolume(volume);
|
||||
return true;
|
||||
}
|
||||
@@ -802,8 +762,7 @@ int AUD_readDevice(AUD_Device* device, data_t* buffer, int length)
|
||||
assert(device);
|
||||
assert(buffer);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
return (*device)->read(buffer, length);
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -816,8 +775,7 @@ void AUD_closeReadDevice(AUD_Device* device)
|
||||
{
|
||||
assert(device);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
delete device;
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
@@ -840,8 +798,7 @@ float* AUD_readSoundBuffer(const char* filename, float low, float high,
|
||||
|
||||
int position = 0;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_Reference<AUD_IReader> reader = file->createReader();
|
||||
|
||||
AUD_SampleRate rate = reader->getSpecs().rate;
|
||||
@@ -903,11 +860,9 @@ AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds)
|
||||
|
||||
AUD_device->lock();
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_Handle handle2 = AUD_device->play(limiter);
|
||||
if(!handle2.isNull())
|
||||
{
|
||||
if (!handle2.isNull()) {
|
||||
handle2->setStopCallback((stopCallback)pauseSound, handle);
|
||||
AUD_device->unlock();
|
||||
return new AUD_Handle(handle2);
|
||||
@@ -987,26 +942,27 @@ void AUD_updateSequenceSound(AUD_SEntry* entry, AUD_Sound* sound)
|
||||
void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
|
||||
{
|
||||
AUD_AnimateableProperty *prop = (*entry)->getAnimProperty(type);
|
||||
if(animated)
|
||||
{
|
||||
if (animated) {
|
||||
if (frame >= 0)
|
||||
prop->write(data, frame, 1);
|
||||
}
|
||||
else
|
||||
else {
|
||||
prop->write(data);
|
||||
}
|
||||
}
|
||||
|
||||
void AUD_setSequencerAnimData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
|
||||
{
|
||||
AUD_AnimateableProperty *prop = dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->getAnimProperty(type);
|
||||
if(animated)
|
||||
{
|
||||
if(frame >= 0)
|
||||
if (animated) {
|
||||
if (frame >= 0) {
|
||||
prop->write(data, frame, 1);
|
||||
}
|
||||
else
|
||||
}
|
||||
else {
|
||||
prop->write(data);
|
||||
}
|
||||
}
|
||||
|
||||
void AUD_updateSequenceData(AUD_SEntry *entry, float volume_max, float volume_min,
|
||||
float distance_max, float distance_reference, float attenuation,
|
||||
@@ -1039,8 +995,9 @@ void AUD_seekSequencer(AUD_Handle* handle, float time)
|
||||
{
|
||||
#ifdef WITH_JACK
|
||||
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
|
||||
if(device)
|
||||
if (device) {
|
||||
device->seekPlayback(time);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -1053,8 +1010,9 @@ float AUD_getSequencerPosition(AUD_Handle* handle)
|
||||
{
|
||||
#ifdef WITH_JACK
|
||||
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
|
||||
if(device)
|
||||
if (device) {
|
||||
return device->getPlaybackPosition();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -1067,8 +1025,9 @@ void AUD_startPlayback()
|
||||
{
|
||||
#ifdef WITH_JACK
|
||||
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
|
||||
if(device)
|
||||
if (device) {
|
||||
device->startPlayback();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1076,8 +1035,9 @@ void AUD_stopPlayback()
|
||||
{
|
||||
#ifdef WITH_JACK
|
||||
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
|
||||
if(device)
|
||||
if (device) {
|
||||
device->stopPlayback();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1085,17 +1045,19 @@ void AUD_stopPlayback()
|
||||
void AUD_setSyncCallback(AUD_syncFunction function, void *data)
|
||||
{
|
||||
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
|
||||
if(device)
|
||||
if (device) {
|
||||
device->setSyncCallback(function, data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int AUD_doesPlayback()
|
||||
{
|
||||
#ifdef WITH_JACK
|
||||
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
|
||||
if(device)
|
||||
if (device) {
|
||||
return device->doesPlayback();
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@@ -1120,8 +1082,7 @@ int AUD_readSound(AUD_Sound* sound, sample_t* buffer, int length, int samples_pe
|
||||
|
||||
overallmax = 0;
|
||||
|
||||
for(int i = 0; i < length; i++)
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
len = floor(samplejump * (i+1)) - floor(samplejump * i);
|
||||
|
||||
aBuffer.assureSize(len * AUD_SAMPLE_SIZE(specs));
|
||||
@@ -1131,8 +1092,7 @@ int AUD_readSound(AUD_Sound* sound, sample_t* buffer, int length, int samples_pe
|
||||
|
||||
max = min = *buf;
|
||||
power = *buf * *buf;
|
||||
for(int j = 1; j < len; j++)
|
||||
{
|
||||
for (int j = 1; j < len; j++) {
|
||||
if (buf[j] < min)
|
||||
min = buf[j];
|
||||
if (buf[j] > max)
|
||||
@@ -1149,17 +1109,14 @@ int AUD_readSound(AUD_Sound* sound, sample_t* buffer, int length, int samples_pe
|
||||
if (overallmax < -min)
|
||||
overallmax = -min;
|
||||
|
||||
if(eos)
|
||||
{
|
||||
if (eos) {
|
||||
length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(overallmax > 1.0f)
|
||||
{
|
||||
for(int i = 0; i < length * 3; i++)
|
||||
{
|
||||
if (overallmax > 1.0f) {
|
||||
for (int i = 0; i < length * 3; i++) {
|
||||
buffer[i] /= overallmax;
|
||||
}
|
||||
}
|
||||
@@ -1202,11 +1159,9 @@ void AUD_addSet(void* set, void* entry)
|
||||
|
||||
void *AUD_getSet(void *set)
|
||||
{
|
||||
if(set)
|
||||
{
|
||||
if (set) {
|
||||
std::set<void *>* rset = reinterpret_cast<std::set<void *>*>(set);
|
||||
if(!rset->empty())
|
||||
{
|
||||
if (!rset->empty()) {
|
||||
std::set<void *>::iterator it = rset->begin();
|
||||
void *result = *it;
|
||||
rset->erase(it);
|
||||
@@ -1219,8 +1174,7 @@ void* AUD_getSet(void* set)
|
||||
|
||||
const char *AUD_mixdown(AUD_Sound *sound, unsigned int start, unsigned int length, unsigned int buffersize, const char *filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sound->get());
|
||||
|
||||
f->setSpecs(specs.specs);
|
||||
@@ -1239,8 +1193,7 @@ const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int lengt
|
||||
|
||||
const char *AUD_mixdown_per_channel(AUD_Sound *sound, unsigned int start, unsigned int length, unsigned int buffersize, const char *filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sound->get());
|
||||
|
||||
f->setSpecs(specs.specs);
|
||||
@@ -1250,19 +1203,22 @@ const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsign
|
||||
int channels = specs.channels;
|
||||
specs.channels = AUD_CHANNELS_MONO;
|
||||
|
||||
for(int i = 0; i < channels; i++)
|
||||
{
|
||||
for (int i = 0; i < channels; i++) {
|
||||
std::stringstream stream;
|
||||
std::string fn = filename;
|
||||
size_t index = fn.find_last_of('.');
|
||||
size_t index_slash = fn.find_last_of('/');
|
||||
size_t index_backslash = fn.find_last_of('\\');
|
||||
|
||||
if ((index == std::string::npos) ||
|
||||
((index < index_slash) && (index_slash != std::string::npos)) ||
|
||||
((index < index_backslash) && (index_backslash != std::string::npos)))
|
||||
{
|
||||
stream << filename << "_" << (i + 1);
|
||||
else
|
||||
}
|
||||
else {
|
||||
stream << fn.substr(0, index) << "_" << (i + 1) << fn.substr(index);
|
||||
}
|
||||
writers.push_back(AUD_FileWriter::createWriter(stream.str(), specs, format, codec, bitrate));
|
||||
}
|
||||
|
||||
@@ -1280,8 +1236,7 @@ const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsign
|
||||
|
||||
AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, float volume, float start)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
AUD_ReadDevice *device = new AUD_ReadDevice(specs);
|
||||
device->setQuality(true);
|
||||
device->setVolume(volume);
|
||||
@@ -1289,8 +1244,9 @@ AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, f
|
||||
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setSpecs(specs.specs);
|
||||
|
||||
AUD_Handle handle = device->play(*sequencer);
|
||||
if(!handle.isNull())
|
||||
if (!handle.isNull()) {
|
||||
handle->seek(start);
|
||||
}
|
||||
|
||||
return new AUD_Device(device);
|
||||
}
|
||||
|
@@ -243,19 +243,19 @@ extern AUD_Status AUD_getStatus(AUD_Handle* handle);
|
||||
* Sets the listener location.
|
||||
* \param location The new location.
|
||||
*/
|
||||
extern int AUD_setListenerLocation(const float* location);
|
||||
extern int AUD_setListenerLocation(const float location[3]);
|
||||
|
||||
/**
|
||||
* Sets the listener velocity.
|
||||
* \param velocity The new velocity.
|
||||
*/
|
||||
extern int AUD_setListenerVelocity(const float* velocity);
|
||||
extern int AUD_setListenerVelocity(const float velocity[3]);
|
||||
|
||||
/**
|
||||
* Sets the listener orientation.
|
||||
* \param orientation The new orientation as quaternion.
|
||||
*/
|
||||
extern int AUD_setListenerOrientation(const float* orientation);
|
||||
extern int AUD_setListenerOrientation(const float orientation[4]);
|
||||
|
||||
/**
|
||||
* Sets the speed of sound.
|
||||
@@ -284,7 +284,7 @@ extern int AUD_setDistanceModel(AUD_DistanceModel model);
|
||||
* \param location The new location.
|
||||
* \return Whether the action succeeded.
|
||||
*/
|
||||
extern int AUD_setSourceLocation(AUD_Handle* handle, const float* location);
|
||||
extern int AUD_setSourceLocation(AUD_Handle *handle, const float location[3]);
|
||||
|
||||
/**
|
||||
* Sets the velocity of a source.
|
||||
@@ -292,7 +292,7 @@ extern int AUD_setSourceLocation(AUD_Handle* handle, const float* location);
|
||||
* \param velocity The new velocity.
|
||||
* \return Whether the action succeeded.
|
||||
*/
|
||||
extern int AUD_setSourceVelocity(AUD_Handle* handle, const float* velocity);
|
||||
extern int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3]);
|
||||
|
||||
/**
|
||||
* Sets the orientation of a source.
|
||||
@@ -300,7 +300,7 @@ extern int AUD_setSourceVelocity(AUD_Handle* handle, const float* velocity);
|
||||
* \param orientation The new orientation as quaternion.
|
||||
* \return Whether the action succeeded.
|
||||
*/
|
||||
extern int AUD_setSourceOrientation(AUD_Handle* handle, const float* orientation);
|
||||
extern int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4]);
|
||||
|
||||
/**
|
||||
* Sets whether the source location, velocity and orientation are relative
|
||||
@@ -703,7 +703,10 @@ extern void* AUD_getSet(void* set);
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \return An error message or NULL in case of success.
|
||||
*/
|
||||
extern const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
|
||||
extern const char *AUD_mixdown(AUD_Sound *sound, unsigned int start, unsigned int length,
|
||||
unsigned int buffersize, const char *filename,
|
||||
AUD_DeviceSpecs specs, AUD_Container format,
|
||||
AUD_Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Mixes a sound down into multiple files.
|
||||
@@ -718,7 +721,10 @@ extern const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned in
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \return An error message or NULL in case of success.
|
||||
*/
|
||||
extern const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
|
||||
extern const char *AUD_mixdown_per_channel(AUD_Sound *sound, unsigned int start, unsigned int length,
|
||||
unsigned int buffersize, const char *filename,
|
||||
AUD_DeviceSpecs specs, AUD_Container format,
|
||||
AUD_Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Opens a read device and prepares it for mixdown of the sound scene.
|
||||
|
@@ -182,7 +182,8 @@ bool OSLRenderServices::get_array_attribute(void *renderstate, bool derivatives,
|
||||
static void set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
if (type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
|
||||
type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor) {
|
||||
type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor)
|
||||
{
|
||||
float3 *fval = (float3 *)val;
|
||||
fval[0] = f[0];
|
||||
if (derivatives) {
|
||||
@@ -203,7 +204,8 @@ static void set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, v
|
||||
static void set_attribute_float(float f[3], TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
if (type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
|
||||
type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor) {
|
||||
type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor)
|
||||
{
|
||||
float3 *fval = (float3 *)val;
|
||||
fval[0] = make_float3(f[0], f[0], f[0]);
|
||||
if (derivatives) {
|
||||
@@ -232,7 +234,8 @@ static bool get_mesh_attribute(KernelGlobals *kg, const ShaderData *sd, const OS
|
||||
return true;
|
||||
}
|
||||
else if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector ||
|
||||
attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor) {
|
||||
attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor)
|
||||
{
|
||||
/* todo: this won't work when float3 has w component */
|
||||
float3 fval[3];
|
||||
fval[0] = triangle_attribute_float3(kg, sd, attr.elem, attr.offset,
|
||||
@@ -419,7 +422,8 @@ bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, void *renderst
|
||||
}
|
||||
|
||||
int OSLRenderServices::pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 ¢er,
|
||||
float radius, int max_points, bool sort, size_t *out_indices, float *out_distances, int derivs_offset)
|
||||
float radius, int max_points, bool sort,
|
||||
size_t *out_indices, float *out_distances, int derivs_offset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user