3D Audio GSoC:
authorJoerg Mueller <nexyon@gmail.com>
Sat, 30 Jul 2011 16:24:11 +0000 (16:24 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Sat, 30 Jul 2011 16:24:11 +0000 (16:24 +0000)
* 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
intern/audaspace/Python/AUD_PyAPI.cpp
intern/audaspace/intern/AUD_SequencerEntry.cpp

index 96352b0..e988274 100644 (file)
@@ -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
        {
index 12bb196..94e0257 100644 (file)
@@ -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<AUD_Reference<AUD_IDevice>*>(self->device))->getSpecs();
-               return Py_BuildValue("i", specs.rate);
+               return Py_BuildValue("d", specs.rate);
        }
        catch(AUD_Exception& e)
        {
index 110e5c6..5ba3595 100644 (file)
@@ -39,7 +39,7 @@ AUD_SequencerEntry::AUD_SequencerEntry(AUD_Reference<AUD_IFactory> 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),