forked from bartvdbraak/blender
Small fixes for some float literals.
This commit is contained in:
parent
dff4c87f84
commit
0b673d45e5
@ -44,8 +44,8 @@ AUD_EnvelopeReader::AUD_EnvelopeReader(AUD_IReader* reader, float attack,
|
|||||||
AUD_NEW("buffer")
|
AUD_NEW("buffer")
|
||||||
memset(m_envelopes->getBuffer(), 0, samplesize);
|
memset(m_envelopes->getBuffer(), 0, samplesize);
|
||||||
|
|
||||||
m_bAttack = pow(arthreshold, 1.0/(specs.rate * attack));
|
m_bAttack = pow(arthreshold, 1.0f/(specs.rate * attack));
|
||||||
m_bRelease = pow(arthreshold, 1.0/(specs.rate * release));
|
m_bRelease = pow(arthreshold, 1.0f/(specs.rate * release));
|
||||||
}
|
}
|
||||||
|
|
||||||
AUD_EnvelopeReader::~AUD_EnvelopeReader()
|
AUD_EnvelopeReader::~AUD_EnvelopeReader()
|
||||||
|
@ -51,14 +51,14 @@ public:
|
|||||||
* \param frequency The cutoff frequency.
|
* \param frequency The cutoff frequency.
|
||||||
* \param Q The Q factor.
|
* \param Q The Q factor.
|
||||||
*/
|
*/
|
||||||
AUD_HighpassFactory(AUD_IFactory* factory, float frequency, float Q = 1.0);
|
AUD_HighpassFactory(AUD_IFactory* factory, float frequency, float Q = 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new highpass factory.
|
* Creates a new highpass factory.
|
||||||
* \param frequency The cutoff frequency.
|
* \param frequency The cutoff frequency.
|
||||||
* \param Q The Q factor.
|
* \param Q The Q factor.
|
||||||
*/
|
*/
|
||||||
AUD_HighpassFactory(float frequency, float Q = 1.0);
|
AUD_HighpassFactory(float frequency, float Q = 1.0f);
|
||||||
|
|
||||||
virtual AUD_IReader* createReader();
|
virtual AUD_IReader* createReader();
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ AUD_HighpassReader::AUD_HighpassReader(AUD_IReader* reader, float frequency,
|
|||||||
m_position = 0;
|
m_position = 0;
|
||||||
|
|
||||||
// calculate coefficients
|
// calculate coefficients
|
||||||
float w0 = 2.0 * M_PI * frequency / specs.rate;
|
float w0 = 2 * M_PI * frequency / specs.rate;
|
||||||
float alpha = sin(w0) / (2 * Q);
|
float alpha = sin(w0) / (2 * Q);
|
||||||
float norm = 1 + alpha;
|
float norm = 1 + alpha;
|
||||||
m_coeff[0][0] = 0;
|
m_coeff[0][0] = 0;
|
||||||
|
@ -51,14 +51,14 @@ public:
|
|||||||
* \param frequency The cutoff frequency.
|
* \param frequency The cutoff frequency.
|
||||||
* \param Q The Q factor.
|
* \param Q The Q factor.
|
||||||
*/
|
*/
|
||||||
AUD_LowpassFactory(AUD_IFactory* factory, float frequency, float Q = 1.0);
|
AUD_LowpassFactory(AUD_IFactory* factory, float frequency, float Q = 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new lowpass factory.
|
* Creates a new lowpass factory.
|
||||||
* \param frequency The cutoff frequency.
|
* \param frequency The cutoff frequency.
|
||||||
* \param Q The Q factor.
|
* \param Q The Q factor.
|
||||||
*/
|
*/
|
||||||
AUD_LowpassFactory(float frequency, float Q = 1.0);
|
AUD_LowpassFactory(float frequency, float Q = 1.0f);
|
||||||
|
|
||||||
virtual AUD_IReader* createReader();
|
virtual AUD_IReader* createReader();
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ AUD_LowpassReader::AUD_LowpassReader(AUD_IReader* reader, float frequency,
|
|||||||
m_position = 0;
|
m_position = 0;
|
||||||
|
|
||||||
// calculate coefficients
|
// calculate coefficients
|
||||||
float w0 = 2.0 * M_PI * frequency / specs.rate;
|
float w0 = 2 * M_PI * frequency / specs.rate;
|
||||||
float alpha = sin(w0) / (2 * Q);
|
float alpha = sin(w0) / (2 * Q);
|
||||||
float norm = 1 + alpha;
|
float norm = 1 + alpha;
|
||||||
m_coeff[0][0] = 0;
|
m_coeff[0][0] = 0;
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
* \param factory The input factory.
|
* \param factory The input factory.
|
||||||
* \param pitch The desired pitch.
|
* \param pitch The desired pitch.
|
||||||
*/
|
*/
|
||||||
AUD_PitchFactory(AUD_IFactory* factory = 0, float pitch = 1.0);
|
AUD_PitchFactory(AUD_IFactory* factory = 0, float pitch = 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new pitch factory.
|
* Creates a new pitch factory.
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
* \param factory The input factory.
|
* \param factory The input factory.
|
||||||
* \param volume The desired volume.
|
* \param volume The desired volume.
|
||||||
*/
|
*/
|
||||||
AUD_VolumeFactory(AUD_IFactory* factory = 0, float volume = 1.0);
|
AUD_VolumeFactory(AUD_IFactory* factory = 0, float volume = 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new volume factory.
|
* Creates a new volume factory.
|
||||||
|
@ -868,7 +868,7 @@ bool AUD_OpenALDevice::seek(AUD_Handle* handle, float position)
|
|||||||
|
|
||||||
float AUD_OpenALDevice::getPosition(AUD_Handle* handle)
|
float AUD_OpenALDevice::getPosition(AUD_Handle* handle)
|
||||||
{
|
{
|
||||||
float position = 0.0;
|
float position = 0.0f;
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
@ -1283,7 +1283,7 @@ bool AUD_OpenALDevice::setSourceSetting(AUD_Handle* handle,
|
|||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case AUD_3DSS_IS_RELATIVE:
|
case AUD_3DSS_IS_RELATIVE:
|
||||||
alSourcei(source, AL_SOURCE_RELATIVE, value > 0.0);
|
alSourcei(source, AL_SOURCE_RELATIVE, value > 0.0f);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case AUD_3DSS_MAX_DISTANCE:
|
case AUD_3DSS_MAX_DISTANCE:
|
||||||
@ -1341,7 +1341,7 @@ float AUD_OpenALDevice::getSourceSetting(AUD_Handle* handle,
|
|||||||
{
|
{
|
||||||
ALint i;
|
ALint i;
|
||||||
alGetSourcei(source, AL_SOURCE_RELATIVE, &i);
|
alGetSourcei(source, AL_SOURCE_RELATIVE, &i);
|
||||||
result = i ? 1.0 : 0.0;
|
result = i ? 1.0f : 0.0f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AUD_3DSS_MAX_DISTANCE:
|
case AUD_3DSS_MAX_DISTANCE:
|
||||||
|
@ -108,7 +108,7 @@ void AUD_BandPassReader::read(int & length, sample_t* & buffer)
|
|||||||
|
|
||||||
for(int i = 0; i < m_length / 2 + 1; i++)
|
for(int i = 0; i < m_length / 2 + 1; i++)
|
||||||
{
|
{
|
||||||
frequency = i * specs.rate / (m_length / 2.0 + 1.0);
|
frequency = i * specs.rate / (m_length / 2.0f + 1.0f);
|
||||||
if((frequency < m_low) || (frequency > m_high))
|
if((frequency < m_low) || (frequency > m_high))
|
||||||
complex[i][0] = complex[i][1] = 0.0;
|
complex[i][0] = complex[i][1] = 0.0;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
|
|||||||
{
|
{
|
||||||
info.specs.channels = AUD_CHANNELS_INVALID;
|
info.specs.channels = AUD_CHANNELS_INVALID;
|
||||||
info.specs.rate = AUD_RATE_INVALID;
|
info.specs.rate = AUD_RATE_INVALID;
|
||||||
info.length = 0.0;
|
info.length = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
@ -427,7 +427,7 @@ float AUD_get3DSetting(AUD_3DSetting setting)
|
|||||||
catch(AUD_Exception)
|
catch(AUD_Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
return 0.0;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AUD_update3DSource(AUD_Handle* handle, AUD_3DData* data)
|
int AUD_update3DSource(AUD_Handle* handle, AUD_3DData* data)
|
||||||
@ -483,7 +483,7 @@ float AUD_get3DSourceSetting(AUD_Handle* handle, AUD_3DSourceSetting setting)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0.0;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AUD_setSoundVolume(AUD_Handle* handle, float volume)
|
int AUD_setSoundVolume(AUD_Handle* handle, float volume)
|
||||||
|
@ -49,7 +49,8 @@ AUD_ChannelMapperReader::AUD_ChannelMapperReader(AUD_IReader* reader,
|
|||||||
for(i=0; i < m_rch; i++)
|
for(i=0; i < m_rch; i++)
|
||||||
sum += mapping[channels][i];
|
sum += mapping[channels][i];
|
||||||
for(i=0; i < m_rch; i++)
|
for(i=0; i < m_rch; i++)
|
||||||
m_mapping[channels][i] = sum > 0.0 ? mapping[channels][i]/sum : 0.0;
|
m_mapping[channels][i] = sum > 0.0f ?
|
||||||
|
mapping[channels][i]/sum : 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
@ -29,12 +29,12 @@
|
|||||||
#define AUD_U8_0 0x80
|
#define AUD_U8_0 0x80
|
||||||
#define AUD_S16_MAX 0x7FFF
|
#define AUD_S16_MAX 0x7FFF
|
||||||
#define AUD_S16_MIN 0x8000
|
#define AUD_S16_MIN 0x8000
|
||||||
#define AUD_S16_FLT 32768.0
|
#define AUD_S16_FLT 32768.0f
|
||||||
#define AUD_S32_MAX 0x7FFFFFFF
|
#define AUD_S32_MAX 0x7FFFFFFF
|
||||||
#define AUD_S32_MIN 0x80000000
|
#define AUD_S32_MIN 0x80000000
|
||||||
#define AUD_S32_FLT 2147483648.0
|
#define AUD_S32_FLT 2147483648.0f
|
||||||
#define AUD_FLT_MAX 1.0
|
#define AUD_FLT_MAX 1.0f
|
||||||
#define AUD_FLT_MIN -1.0
|
#define AUD_FLT_MIN -1.0f
|
||||||
|
|
||||||
void AUD_convert_u8_s16(data_t* target, data_t* source, int length)
|
void AUD_convert_u8_s16(data_t* target, data_t* source, int length)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ void AUD_SinusReader::read(int & length, sample_t* & buffer)
|
|||||||
buffer = m_buffer->getBuffer();
|
buffer = m_buffer->getBuffer();
|
||||||
for(int i = 0; i < length; i++)
|
for(int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
buffer[i] = sin((m_position + i) * 2.0 * M_PI * m_frequency /
|
buffer[i] = sin((m_position + i) * 2.0f * M_PI * m_frequency /
|
||||||
(float)m_sampleRate);
|
(float)m_sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ void AUD_SoftwareDevice::create()
|
|||||||
m_playingSounds = new std::list<AUD_SoftwareHandle*>(); AUD_NEW("list")
|
m_playingSounds = new std::list<AUD_SoftwareHandle*>(); AUD_NEW("list")
|
||||||
m_pausedSounds = new std::list<AUD_SoftwareHandle*>(); AUD_NEW("list")
|
m_pausedSounds = new std::list<AUD_SoftwareHandle*>(); AUD_NEW("list")
|
||||||
m_playback = false;
|
m_playback = false;
|
||||||
m_volume = 1.0;
|
m_volume = 1.0f;
|
||||||
m_mixer = new AUD_Mixer(); AUD_NEW("mixer")
|
m_mixer = new AUD_Mixer(); AUD_NEW("mixer")
|
||||||
m_mixer->setSpecs(m_specs);
|
m_mixer->setSpecs(m_specs);
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ AUD_Handle* AUD_SoftwareDevice::play(AUD_IFactory* factory, bool keep)
|
|||||||
AUD_SoftwareHandle* sound = new AUD_SoftwareHandle; AUD_NEW("handle")
|
AUD_SoftwareHandle* sound = new AUD_SoftwareHandle; AUD_NEW("handle")
|
||||||
sound->keep = keep;
|
sound->keep = keep;
|
||||||
sound->reader = reader;
|
sound->reader = reader;
|
||||||
sound->volume = 1.0;
|
sound->volume = 1.0f;
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
m_playingSounds->push_back(sound);
|
m_playingSounds->push_back(sound);
|
||||||
@ -421,10 +421,10 @@ bool AUD_SoftwareDevice::setCapability(int capability, void *value)
|
|||||||
case AUD_CAPS_VOLUME:
|
case AUD_CAPS_VOLUME:
|
||||||
lock();
|
lock();
|
||||||
m_volume = *((float*)value);
|
m_volume = *((float*)value);
|
||||||
if(m_volume > 1.0)
|
if(m_volume > 1.0f)
|
||||||
m_volume = 1.0;
|
m_volume = 1.0f;
|
||||||
else if(m_volume < 0.0)
|
else if(m_volume < 0.0f)
|
||||||
m_volume = 0.0;
|
m_volume = 0.0f;
|
||||||
unlock();
|
unlock();
|
||||||
return true;
|
return true;
|
||||||
case AUD_CAPS_SOURCE_VOLUME:
|
case AUD_CAPS_SOURCE_VOLUME:
|
||||||
@ -435,10 +435,10 @@ bool AUD_SoftwareDevice::setCapability(int capability, void *value)
|
|||||||
{
|
{
|
||||||
AUD_SoftwareHandle* handle = (AUD_SoftwareHandle*)caps->handle;
|
AUD_SoftwareHandle* handle = (AUD_SoftwareHandle*)caps->handle;
|
||||||
handle->volume = caps->value;
|
handle->volume = caps->value;
|
||||||
if(handle->volume > 1.0)
|
if(handle->volume > 1.0f)
|
||||||
handle->volume = 1.0;
|
handle->volume = 1.0f;
|
||||||
else if(handle->volume < 0.0)
|
else if(handle->volume < 0.0f)
|
||||||
handle->volume = 0.0;
|
handle->volume = 0.0f;
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user