[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31005] branches/soc-2010-nexyon/intern/ audaspace: Audaspace:

Joerg Mueller nexyon at gmail.com
Tue Aug 3 10:45:04 CEST 2010


Revision: 31005
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31005
Author:   nexyon
Date:     2010-08-03 10:45:03 +0200 (Tue, 03 Aug 2010)

Log Message:
-----------
Audaspace:
* Py API: Renamed Sound to Factory to match the C++ classes and make it possible to add Readers when necessary to the API.
* Py API docs: Added the filter example.
* Fixed a crash for sounds without stop callback.

Modified Paths:
--------------
    branches/soc-2010-nexyon/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
    branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp
    branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.h
    branches/soc-2010-nexyon/intern/audaspace/Python/doc/examples/aud.py
    branches/soc-2010-nexyon/intern/audaspace/Python/doc/examples/tetris.py
    branches/soc-2010-nexyon/intern/audaspace/intern/AUD_SoftwareDevice.cpp

Added Paths:
-----------
    branches/soc-2010-nexyon/intern/audaspace/Python/doc/examples/aud.Factory.filter.py

Modified: branches/soc-2010-nexyon/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- branches/soc-2010-nexyon/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2010-08-03 08:30:49 UTC (rev 31004)
+++ branches/soc-2010-nexyon/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2010-08-03 08:45:03 UTC (rev 31005)
@@ -545,6 +545,8 @@
 				sound->isBuffered = true;
 				sound->data_end = true;
 				sound->loopcount = 0;
+				sound->stop = NULL;
+				sound->stop_data = NULL;
 
 				alcSuspendContext(m_context);
 
@@ -614,6 +616,8 @@
 	sound->isBuffered = false;
 	sound->data_end = false;
 	sound->loopcount = 0;
+	sound->stop = NULL;
+	sound->stop_data = NULL;
 
 	valid &= getFormat(sound->format, specs.specs);
 

Modified: branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp
===================================================================
--- branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp	2010-08-03 08:30:49 UTC (rev 31004)
+++ branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp	2010-08-03 08:45:03 UTC (rev 31005)
@@ -85,7 +85,7 @@
 // ====================================================================
 
 static void
-Sound_dealloc(Sound* self)
+Factory_dealloc(Factory* self)
 {
 	if(self->factory)
 		delete self->factory;
@@ -94,17 +94,17 @@
 }
 
 static PyObject *
-Sound_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+Factory_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-	Sound *self;
+	Factory *self;
 
-	self = (Sound*)type->tp_alloc(type, 0);
+	self = (Factory*)type->tp_alloc(type, 0);
 	if(self != NULL)
 	{
 		static const char *kwlist[] = {"filename", NULL};
 		const char* filename = NULL;
 
-		if(!PyArg_ParseTupleAndKeywords(args, kwds, "s:Sound", const_cast<char**>(kwlist), &filename))
+		if(!PyArg_ParseTupleAndKeywords(args, kwds, "s:Factory", const_cast<char**>(kwlist), &filename))
 		{
 			Py_DECREF(self);
 			return NULL;
@@ -125,18 +125,18 @@
 	return (PyObject *)self;
 }
 
-PyDoc_STRVAR(M_aud_Sound_sine_doc,
+PyDoc_STRVAR(M_aud_Factory_sine_doc,
 			 "sine(frequency[, rate])\n\n"
 			 "Creates a sine sound wave.\n\n"
 			 ":arg frequency: The frequency of the sine wave in Hz.\n"
 			 ":type frequency: float\n"
 			 ":arg rate: The sampling rate in Hz.\n"
 			 ":type rate: int\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound");
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory");
 
 static PyObject *
-Sound_sine(PyTypeObject* type, PyObject* args)
+Factory_sine(PyTypeObject* type, PyObject* args)
 {
 	float frequency;
 	int rate = 44100;
@@ -144,9 +144,9 @@
 	if(!PyArg_ParseTuple(args, "f|i:sine", &frequency, &rate))
 		return NULL;
 
-	Sound *self;
+	Factory *self;
 
-	self = (Sound*)type->tp_alloc(type, 0);
+	self = (Factory*)type->tp_alloc(type, 0);
 	if(self != NULL)
 	{
 		try
@@ -164,25 +164,25 @@
 	return (PyObject *)self;
 }
 
-PyDoc_STRVAR(M_aud_Sound_file_doc,
+PyDoc_STRVAR(M_aud_Factory_file_doc,
 			 "file(filename)\n\n"
 			 "Creates a sound object of a sound file.\n\n"
 			 ":arg filename: Path of the file.\n"
 			 ":type filename: string\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound");
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory");
 
 static PyObject *
-Sound_file(PyTypeObject* type, PyObject* args)
+Factory_file(PyTypeObject* type, PyObject* args)
 {
 	const char* filename = NULL;
 
 	if(!PyArg_ParseTuple(args, "s:file", &filename))
 		return NULL;
 
-	Sound *self;
+	Factory *self;
 
-	self = (Sound*)type->tp_alloc(type, 0);
+	self = (Factory*)type->tp_alloc(type, 0);
 	if(self != NULL)
 	{
 		try
@@ -200,18 +200,18 @@
 	return (PyObject *)self;
 }
 
-PyDoc_STRVAR(M_aud_Sound_lowpass_doc,
+PyDoc_STRVAR(M_aud_Factory_lowpass_doc,
 			 "lowpass(frequency[, Q])\n\n"
 			 "Creates a second order lowpass filter.\n\n"
 			 ":arg frequency: The cut off trequency of the lowpass.\n"
 			 ":type frequency: float\n"
 			 ":arg Q: Q factor of the lowpass.\n"
 			 ":type Q: float\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound");
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory");
 
 static PyObject *
-Sound_lowpass(Sound* self, PyObject* args)
+Factory_lowpass(Factory* self, PyObject* args)
 {
 	float frequency;
 	float Q = 0.5;
@@ -220,7 +220,7 @@
 		return NULL;
 
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
-	Sound *parent = (Sound*)type->tp_alloc(type, 0);
+	Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
 	if(parent != NULL)
 	{
@@ -242,16 +242,16 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_delay_doc,
+PyDoc_STRVAR(M_aud_Factory_delay_doc,
 			 "delay(time)\n\n"
 			 "Delays a sound by playing silence before the sound starts.\n\n"
 			 ":arg time: How many seconds of silence should be added before the sound.\n"
 			 ":type time: float\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound");
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory");
 
 static PyObject *
-Sound_delay(Sound* self, PyObject* args)
+Factory_delay(Factory* self, PyObject* args)
 {
 	float delay;
 
@@ -259,7 +259,7 @@
 		return NULL;
 
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
-	Sound *parent = (Sound*)type->tp_alloc(type, 0);
+	Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
 	if(parent != NULL)
 	{
@@ -281,31 +281,31 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_join_doc,
+PyDoc_STRVAR(M_aud_Factory_join_doc,
 			 "join(sound)\n\n"
 			 "Plays two sounds in sequence.\n\n"
 			 ":arg sound: The sound to play second.\n"
-			 ":type sound: aud.Sound\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound\n\n"
+			 ":type sound: aud.Factory\n"
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory\n\n"
 			 ".. note:: The two sounds have to have the same specifications "
 			 "(channels and samplerate).");
 
 static PyObject *
-Sound_join(Sound* self, PyObject* object)
+Factory_join(Factory* self, PyObject* object)
 {
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
 
 	if(!PyObject_TypeCheck(object, type))
 	{
-		PyErr_SetString(PyExc_TypeError, "Object has to be of type aud.Sound!");
+		PyErr_SetString(PyExc_TypeError, "Object has to be of type aud.Factory!");
 		return NULL;
 	}
 
-	Sound *parent;
-	Sound *child = (Sound*)object;
+	Factory *parent;
+	Factory *child = (Factory*)object;
 
-	parent = (Sound*)type->tp_alloc(type, 0);
+	parent = (Factory*)type->tp_alloc(type, 0);
 	if(parent != NULL)
 	{
 		parent->child_list = Py_BuildValue("(OO)", self, object);
@@ -325,18 +325,18 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_highpass_doc,
+PyDoc_STRVAR(M_aud_Factory_highpass_doc,
 			 "highpass(frequency[, Q])\n\n"
 			 "Creates a second order highpass filter.\n\n"
 			 ":arg frequency: The cut off trequency of the highpass.\n"
 			 ":type frequency: float\n"
 			 ":arg Q: Q factor of the lowpass.\n"
 			 ":type Q: float\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound");
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory");
 
 static PyObject *
-Sound_highpass(Sound* self, PyObject* args)
+Factory_highpass(Factory* self, PyObject* args)
 {
 	float frequency;
 	float Q = 0.5;
@@ -345,7 +345,7 @@
 		return NULL;
 
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
-	Sound *parent = (Sound*)type->tp_alloc(type, 0);
+	Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
 	if(parent != NULL)
 	{
@@ -367,18 +367,18 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_limit_doc,
+PyDoc_STRVAR(M_aud_Factory_limit_doc,
 			 "limit(start, end)\n\n"
 			 "Limits a sound within a specific start and end time.\n\n"
 			 ":arg start: Start time in seconds.\n"
 			 ":type start: float\n"
 			 ":arg end: End time in seconds.\n"
 			 ":type end: float\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound");
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory");
 
 static PyObject *
-Sound_limit(Sound* self, PyObject* args)
+Factory_limit(Factory* self, PyObject* args)
 {
 	float start, end;
 
@@ -386,7 +386,7 @@
 		return NULL;
 
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
-	Sound *parent = (Sound*)type->tp_alloc(type, 0);
+	Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
 	if(parent != NULL)
 	{
@@ -408,19 +408,19 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_pitch_doc,
+PyDoc_STRVAR(M_aud_Factory_pitch_doc,
 			 "pitch(factor)\n\n"
 			 "Changes the pitch of a sound with a specific factor.\n\n"
 			 ":arg factor: The factor to change the pitch with.\n"
 			 ":type factor: float\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound\n\n"
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory\n\n"
 			 ".. note:: This is done by changing the sample rate of the "
 			 "underlying sound, which has to be an integer, so the factor "
 			 "value rounded and the factor may not be 100 % accurate.");
 
 static PyObject *
-Sound_pitch(Sound* self, PyObject* args)
+Factory_pitch(Factory* self, PyObject* args)
 {
 	float factor;
 
@@ -428,7 +428,7 @@
 		return NULL;
 
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
-	Sound *parent = (Sound*)type->tp_alloc(type, 0);
+	Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
 	if(parent != NULL)
 	{
@@ -450,19 +450,19 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_volume_doc,
+PyDoc_STRVAR(M_aud_Factory_volume_doc,
 			 "volume(volume)\n\n"
 			 "Changes the volume of a sound.\n\n"
 			 ":arg volume: The new volume..\n"
 			 ":type volume: float\n"
-			 ":return: The created aud.Sound object.\n"
-			 ":rtype: aud.Sound\n\n"
+			 ":return: The created aud.Factory object.\n"
+			 ":rtype: aud.Factory\n\n"
 			 ".. note:: Should be in the range [0, 1] to avoid clipping.\n\n"
 			 ".. note:: This is a filter function, you might consider using "
 			 "aud.Handle.pitch instead.");
 
 static PyObject *
-Sound_volume(Sound* self, PyObject* args)
+Factory_volume(Factory* self, PyObject* args)
 {
 	float volume;
 
@@ -470,7 +470,7 @@
 		return NULL;
 
 	PyTypeObject* type = ((PyObject*)self)->ob_type;
-	Sound *parent = (Sound*)type->tp_alloc(type, 0);
+	Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
 	if(parent != NULL)
 	{
@@ -492,20 +492,20 @@
 	return (PyObject *)parent;
 }
 
-PyDoc_STRVAR(M_aud_Sound_fadein_doc,

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list