Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-08-11 15:41:24 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-08-11 15:41:24 +0400
commitfee7337249342c3d5a332358883af9afe961f38d (patch)
treed7374f582cec6ca6d204c923d325c4db53d699cd /intern
parent2c2fa877be6a1e7f6f1abbb131d3706948368248 (diff)
3D Audio GSoC:
Adding a mono flag to mixdown non-mono sounds for 3D audio. * Added mono sound loading. * Bugfix: AUD_COMPARE_SPECS usage was wrong. * Bugfix: JOS resampler = instead of ==. * Bugfix: Change of a sound should apply settings in AUD_SequencerHandle. * Bugfix: Memory leak when canceling open sound operator.
Diffstat (limited to 'intern')
-rw-r--r--intern/audaspace/FX/AUD_DoubleReader.cpp4
-rw-r--r--intern/audaspace/FX/AUD_SuperposeReader.cpp2
-rw-r--r--intern/audaspace/intern/AUD_C-API.cpp18
-rw-r--r--intern/audaspace/intern/AUD_C-API.h7
-rw-r--r--intern/audaspace/intern/AUD_JOSResampleReader.cpp2
-rw-r--r--intern/audaspace/intern/AUD_ReadDevice.cpp2
-rw-r--r--intern/audaspace/intern/AUD_SequencerHandle.cpp2
7 files changed, 32 insertions, 5 deletions
diff --git a/intern/audaspace/FX/AUD_DoubleReader.cpp b/intern/audaspace/FX/AUD_DoubleReader.cpp
index 178240fa23b..3b1d105954c 100644
--- a/intern/audaspace/FX/AUD_DoubleReader.cpp
+++ b/intern/audaspace/FX/AUD_DoubleReader.cpp
@@ -98,13 +98,13 @@ void AUD_DoubleReader::read(int& length, bool& eos, sample_t* buffer)
specs1 = m_reader1->getSpecs();
specs2 = m_reader2->getSpecs();
if(AUD_COMPARE_SPECS(specs1, specs2))
- length = len;
- else
{
int len2 = length - len;
m_reader2->read(len2, eos, buffer + specs1.channels * len);
length = len + len2;
}
+ else
+ length = len;
}
}
else
diff --git a/intern/audaspace/FX/AUD_SuperposeReader.cpp b/intern/audaspace/FX/AUD_SuperposeReader.cpp
index b332a854a5d..c07b7a9febf 100644
--- a/intern/audaspace/FX/AUD_SuperposeReader.cpp
+++ b/intern/audaspace/FX/AUD_SuperposeReader.cpp
@@ -81,7 +81,7 @@ void AUD_SuperposeReader::read(int& length, bool& eos, sample_t* buffer)
{
AUD_Specs specs = m_reader1->getSpecs();
AUD_Specs s2 = m_reader2->getSpecs();
- if(AUD_COMPARE_SPECS(specs, s2))
+ if(!AUD_COMPARE_SPECS(specs, s2))
AUD_THROW(AUD_ERROR_SPECS, specs_error);
int samplesize = AUD_SAMPLE_SIZE(specs);
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 85a053238d0..e64ca1af9e7 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -321,6 +321,24 @@ AUD_Sound* AUD_bufferSound(AUD_Sound* sound)
}
}
+AUD_Sound* AUD_monoSound(AUD_Sound* sound)
+{
+ assert(sound);
+
+ try
+ {
+ AUD_DeviceSpecs specs;
+ specs.channels = AUD_CHANNELS_MONO;
+ specs.rate = AUD_RATE_INVALID;
+ specs.format = AUD_FORMAT_INVALID;
+ return new AUD_Sound(new AUD_ChannelMapperFactory(*sound, specs));
+ }
+ catch(AUD_Exception&)
+ {
+ return NULL;
+ }
+}
+
AUD_Sound* AUD_delaySound(AUD_Sound* sound, float delay)
{
assert(sound);
diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h
index 2cd24551dd9..8e347c73675 100644
--- a/intern/audaspace/intern/AUD_C-API.h
+++ b/intern/audaspace/intern/AUD_C-API.h
@@ -123,6 +123,13 @@ extern AUD_Sound* AUD_loadBuffer(unsigned char* buffer, int size);
extern AUD_Sound* AUD_bufferSound(AUD_Sound* sound);
/**
+ * Rechannels the sound to be mono.
+ * \param sound The sound to rechannel.
+ * \return The mono sound.
+ */
+extern AUD_Sound* AUD_monoSound(AUD_Sound* sound);
+
+/**
* Delays a sound.
* \param sound The sound to dealy.
* \param delay The delay in seconds.
diff --git a/intern/audaspace/intern/AUD_JOSResampleReader.cpp b/intern/audaspace/intern/AUD_JOSResampleReader.cpp
index e7eefb30c54..fcd96c3959a 100644
--- a/intern/audaspace/intern/AUD_JOSResampleReader.cpp
+++ b/intern/audaspace/intern/AUD_JOSResampleReader.cpp
@@ -306,7 +306,7 @@ void AUD_JOSResampleReader::read(int& length, bool& eos, sample_t* buffer)
m_n = m_cache_valid;
}
- eos = eos && ((m_n == m_cache_valid) || (length = 0));
+ eos = eos && ((m_n == m_cache_valid) || (length == 0));
}
// kaiser windowed (beta = 10) sinc lowpass with a cutt-off of 0.9
diff --git a/intern/audaspace/intern/AUD_ReadDevice.cpp b/intern/audaspace/intern/AUD_ReadDevice.cpp
index a1495b31ed0..8ab858901b9 100644
--- a/intern/audaspace/intern/AUD_ReadDevice.cpp
+++ b/intern/audaspace/intern/AUD_ReadDevice.cpp
@@ -70,7 +70,7 @@ bool AUD_ReadDevice::read(data_t* buffer, int length)
void AUD_ReadDevice::changeSpecs(AUD_Specs specs)
{
- if(AUD_COMPARE_SPECS(specs, m_specs.specs))
+ if(!AUD_COMPARE_SPECS(specs, m_specs.specs))
setSpecs(specs);
}
diff --git a/intern/audaspace/intern/AUD_SequencerHandle.cpp b/intern/audaspace/intern/AUD_SequencerHandle.cpp
index 978439d3174..c9cf46ccdc3 100644
--- a/intern/audaspace/intern/AUD_SequencerHandle.cpp
+++ b/intern/audaspace/intern/AUD_SequencerHandle.cpp
@@ -88,6 +88,8 @@ void AUD_SequencerHandle::update(float position, float frame)
}
m_sound_status = m_entry->m_sound_status;
+ m_pos_status--;
+ m_status--;
}
if(m_pos_status != m_entry->m_pos_status)