本文整理汇总了C++中AUD_Reference::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ AUD_Reference::isNull方法的具体用法?C++ AUD_Reference::isNull怎么用?C++ AUD_Reference::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AUD_Reference
的用法示例。
在下文中一共展示了AUD_Reference::isNull方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AUD_getInfo
AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
{
assert(sound);
AUD_SoundInfo info;
info.specs.channels = AUD_CHANNELS_INVALID;
info.specs.rate = AUD_RATE_INVALID;
info.length = 0.0f;
try
{
AUD_Reference<AUD_IReader> reader = (*sound)->createReader();
if(!reader.isNull())
{
info.specs = reader->getSpecs();
info.length = reader->getLength() / (float) info.specs.rate;
}
}
catch(AUD_Exception&)
{
}
return info;
}
示例2: AUD_init
int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
{
AUD_Reference<AUD_IDevice> dev;
if(!AUD_device.isNull())
AUD_exit();
try
{
switch(device)
{
case AUD_NULL_DEVICE:
dev = new AUD_NULLDevice();
break;
#ifdef WITH_SDL
case AUD_SDL_DEVICE:
dev = new AUD_SDLDevice(specs, buffersize);
break;
#endif
#ifdef WITH_OPENAL
case AUD_OPENAL_DEVICE:
dev = new AUD_OpenALDevice(specs, buffersize);
break;
#endif
#ifdef WITH_JACK
case AUD_JACK_DEVICE:
#ifdef __APPLE__
struct stat st;
if(stat("/Library/Frameworks/Jackmp.framework", &st) != 0)
{
printf("Warning: Jack Framework not installed\n");
// No break, fall through to default, to return false
}
else
{
#endif
dev = new AUD_JackDevice("Blender", specs, buffersize);
break;
#ifdef __APPLE__
}
#endif
#endif
default:
return false;
}
AUD_device = dev;
AUD_3ddevice = dynamic_cast<AUD_I3DDevice*>(AUD_device.get());
return true;
}
catch(AUD_Exception&)
{
return false;
}
}
示例3: AUD_readSoundBuffer
float* AUD_readSoundBuffer(const char* filename, float low, float high,
float attack, float release, float threshold,
int accumulate, int additive, int square,
float sthreshold, double samplerate, int* length)
{
AUD_Buffer buffer;
AUD_DeviceSpecs specs;
specs.channels = AUD_CHANNELS_MONO;
specs.rate = (AUD_SampleRate)samplerate;
AUD_Reference<AUD_IFactory> sound;
AUD_Reference<AUD_IFactory> file = new AUD_FileFactory(filename);
AUD_Reference<AUD_IReader> reader = file->createReader();
AUD_SampleRate rate = reader->getSpecs().rate;
sound = new AUD_ChannelMapperFactory(file, specs);
if(high < rate)
sound = new AUD_LowpassFactory(sound, high);
if(low > 0)
sound = new AUD_HighpassFactory(sound, low);
sound = new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f);
sound = new AUD_LinearResampleFactory(sound, specs);
if(square)
sound = new AUD_SquareFactory(sound, sthreshold);
if(accumulate)
sound = new AUD_AccumulatorFactory(sound, additive);
else if(additive)
sound = new AUD_SumFactory(sound);
reader = sound->createReader();
if(reader.isNull())
return NULL;
int len;
int position = 0;
bool eos;
do
{
len = samplerate;
buffer.resize((position + len) * sizeof(float), true);
reader->read(len, eos, buffer.getBuffer() + position);
position += len;
} while(!eos);
float* result = (float*)malloc(position * sizeof(float));
memcpy(result, buffer.getBuffer(), position * sizeof(float));
*length = position;
return result;
}
示例4: AUD_getCDevice
static PyObject* AUD_getCDevice(PyObject* self)
{
if(!AUD_device.isNull())
{
Device* device = (Device*)Device_empty();
if(device != NULL)
{
device->device = new AUD_Reference<AUD_IDevice>(AUD_device);
return (PyObject*)device;
}
}
Py_RETURN_NONE;
}
示例5: AUD_init
int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
{
AUD_Reference<AUD_IDevice> dev;
if(!AUD_device.isNull())
AUD_exit();
try
{
switch(device)
{
case AUD_NULL_DEVICE:
dev = new AUD_NULLDevice();
break;
#ifdef WITH_SDL
case AUD_SDL_DEVICE:
dev = new AUD_SDLDevice(specs, buffersize);
break;
#endif
#ifdef WITH_OPENAL
case AUD_OPENAL_DEVICE:
dev = new AUD_OpenALDevice(specs, buffersize);
break;
#endif
#ifdef WITH_JACK
case AUD_JACK_DEVICE:
dev = new AUD_JackDevice("Blender", specs, buffersize);
break;
#endif
default:
return false;
}
AUD_device = dev;
AUD_3ddevice = dynamic_cast<AUD_I3DDevice*>(AUD_device.get());
return true;
}
catch(AUD_Exception&)
{
return false;
}
}
示例6:
AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
{
// prepare the reader
// pitch
AUD_Reference<AUD_PitchReader> pitch = new AUD_PitchReader(reader, 1);
reader = AUD_Reference<AUD_IReader>(pitch);
AUD_Reference<AUD_ResampleReader> resampler;
// resample
if(m_quality)
resampler = new AUD_JOSResampleReader(reader, m_specs.specs);
else
resampler = new AUD_LinearResampleReader(reader, m_specs.specs);
reader = AUD_Reference<AUD_IReader>(resampler);
// rechannel
AUD_Reference<AUD_ChannelMapperReader> mapper = new AUD_ChannelMapperReader(reader, m_specs.channels);
reader = AUD_Reference<AUD_IReader>(mapper);
if(reader.isNull())
return AUD_Reference<AUD_IHandle>();
// play sound
AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, pitch, resampler, mapper, keep);
lock();
m_playingSounds.push_back(sound);
if(!m_playback)
playing(m_playback = true);
unlock();
return AUD_Reference<AUD_IHandle>(sound);
}