From 4b5a371b65ca829cc169692e6ac1f78574531303 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 30 Jul 2011 16:24:11 +0000 Subject: 3D Audio GSoC: * Fix for sequencer strip IDs, only one strip played. * Fix for PyAPI sample rate. * Enhanced Double Reader to return more data if possible. --- intern/audaspace/FX/AUD_DoubleReader.cpp | 19 ++++++++++++++++++- intern/audaspace/Python/AUD_PyAPI.cpp | 6 +++--- intern/audaspace/intern/AUD_SequencerEntry.cpp | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'intern/audaspace') diff --git a/intern/audaspace/FX/AUD_DoubleReader.cpp b/intern/audaspace/FX/AUD_DoubleReader.cpp index 96352b0963c..e9882743d28 100644 --- a/intern/audaspace/FX/AUD_DoubleReader.cpp +++ b/intern/audaspace/FX/AUD_DoubleReader.cpp @@ -88,7 +88,24 @@ void AUD_DoubleReader::read(int& length, bool& eos, sample_t* buffer) if(!m_finished1) { - m_reader1->read(length, m_finished1, buffer); + int len = length; + + m_reader1->read(len, m_finished1, buffer); + + if(len < length) + { + AUD_Specs specs1, specs2; + specs1 = m_reader1->getSpecs(); + specs2 = m_reader2->getSpecs(); + if(memcmp(&specs1, &specs2, sizeof(AUD_Specs))) + length = len; + else + { + int len2 = length - len; + m_reader2->read(len2, eos, buffer + specs1.channels * len); + length = len + len2; + } + } } else { diff --git a/intern/audaspace/Python/AUD_PyAPI.cpp b/intern/audaspace/Python/AUD_PyAPI.cpp index 12bb19644f0..94e02576ccc 100644 --- a/intern/audaspace/Python/AUD_PyAPI.cpp +++ b/intern/audaspace/Python/AUD_PyAPI.cpp @@ -144,9 +144,9 @@ static PyObject * Factory_sine(PyTypeObject* type, PyObject* args) { float frequency; - int rate = 44100; + double rate = 44100; - if(!PyArg_ParseTuple(args, "f|i:sine", &frequency, &rate)) + if(!PyArg_ParseTuple(args, "f|d:sine", &frequency, &rate)) return NULL; Factory *self; @@ -2313,7 +2313,7 @@ Device_get_rate(Device *self, void* nothing) try { AUD_DeviceSpecs specs = (*reinterpret_cast*>(self->device))->getSpecs(); - return Py_BuildValue("i", specs.rate); + return Py_BuildValue("d", specs.rate); } catch(AUD_Exception& e) { diff --git a/intern/audaspace/intern/AUD_SequencerEntry.cpp b/intern/audaspace/intern/AUD_SequencerEntry.cpp index 110e5c6a931..5ba35955f3c 100644 --- a/intern/audaspace/intern/AUD_SequencerEntry.cpp +++ b/intern/audaspace/intern/AUD_SequencerEntry.cpp @@ -39,7 +39,7 @@ AUD_SequencerEntry::AUD_SequencerEntry(AUD_Reference sound, float m_status(0), m_pos_status(1), m_sound_status(0), - m_id(0), + m_id(id), m_sound(sound), m_begin(begin), m_end(end), -- cgit v1.2.3