[SCM] python-pyo/master: New upstream release.

tiago at users.alioth.debian.org tiago at users.alioth.debian.org
Thu Nov 16 15:28:39 UTC 2017


The following commit has been merged in the master branch:
commit 43e09e0ac6bff11b9e5fe0b752f03450b9bd0d48
Author: Tiago Bortoletto Vaz <tiago at debian.org>
Date:   Thu Nov 16 10:00:27 2017 -0500

    New upstream release.

diff --git a/ChangeLog b/ChangeLog
index 2146a38..21d9093 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,17 +1,90 @@
+2017-1-07 belangeo <belangeo at gmail.com>
+
+    * Upgraded version number to 0.8.8.
+
+2017-11-07 belangeo <belangeo at gmail.com>
+
+    * E-Pyo: fixed tempfile encoding on windows.
+
+2017-11-07 belangeo <belangeo at gmail.com>
+
+    * Fixed path encoding on windows for python 3.6.
+
+2017-11-06 belangeo <belangeo at gmail.com>
+
+    * Properly incref and decref server references inside pyo objects.
+
+2017-11-06 belangeo <belangeo at gmail.com>
+
+    * Added missing objects in server's garbage collecting process.
+
+2017-11-06 belangeo <belangeo at gmail.com>
+
+    * Fixed audio and midi backends memory allocation.
+
+2017-11-05 belangeo <belangeo at gmail.com>
+
+    * Don't try to deactivate jack if it is stopped externally (ex. from
+      qjackctl). Fixed issue #109.
+
 2017-11-03 belangeo <belangeo at gmail.com>
 
     * Added a callback attribute to PVAnal. The function receives magnitudes
       and true frequencies for every analysis frame.
 
+2017-11-02 belangeo <belangeo at gmail.com>
+
+    * Fixed PyoArgumentTypeError when ctrl() is called for an object with
+      dataOnly parameter and tk is used instead of wxpython.
+
+2017-11-02 belangeo <belangeo at gmail.com>
+
+    * Granulator now compensates for the difference between the loaded sound's
+      sampling rate and pyo's sampling rate, if any.
+
+2017-11-01 belangeo <belangeo at gmail.com>
+
+    * E-Pyo: Fixed crash when preferences contains unicode characters.
+
+2017-10-31 belangeo <belangeo at gmail.com>
+
+    * E-Pyo: template, snippets and other features now defaults to python3.
+
+2017-10-15 belangeo <belangeo at gmail.com>
+
+    * Added a new init argument (wintitle) to Scope and Spectrum objects to
+      allow the user to set the title name of their window. Also added a
+      method to show/hide the channel labels in their window.
+
 2017-10-09 belangeo <belangeo at gmail.com>
 
     * Added Jack midi support to the Server.
 
+2017-10-09 belangeo <belangeo at gmail.com>
+
+    * Added missing static declaration to functions in pyomodule.
+
 2017-10-07 belangeo <belangeo at gmail.com>
 
     * Removed internal import of the random module. Scripts importing
       both pyo and random modules segfault on garbagge collection at exit.
 
+2017-09-15 belangeo <belangeo at gmail.com>
+
+    * Added missing binding to stop method in MidiListener.
+
+2017-09-06 belangeo <belangeo at gmail.com>
+
+    * Added windows audio inspector script.
+
+2017-08-31 belangeo <belangeo at gmail.com>
+
+    * Fixed compiling with debug symbols on MacOS.
+
+2017-08-28 belangeo <belangeo at gmail.com>
+
+    * Fixed VoiceManager dealloc function.
+
 2017-08-28 belangeo <belangeo at gmail.com>
 
     * Upgraded version number to 0.8.7.
diff --git a/TODO.md b/TODO.md
index bc84438..1aa1fde 100644
--- a/TODO.md
+++ b/TODO.md
@@ -90,8 +90,6 @@ Matrices
 E-Pyo
 -----
 
-- Split the file name (shown in the notebook tab) with the last dot, not the first.
-
 - Complete review of E-Pyo on Windows. Lot of features don't seem to work.
 
     - Project tree refresh function doesn't work.
diff --git a/debian/changelog b/debian/changelog
index c1948ab..4a3267f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
-python-pyo (0.8.7+git20171105-1) unstable; urgency=medium
 
-  * New features from upstream, including jack midi support.
+python-pyo (0.8.8-1) unstable; urgency=medium
 
- -- Tiago Bortoletto Vaz <tiago at debian.org>  Sun, 05 Nov 2017 09:33:48 -0500
+  * New upstream release.
+
+ -- Tiago Bortoletto Vaz <tiago at debian.org>  Thu, 16 Nov 2017 10:00:03 -0500
 
 python-pyo (0.8.7-1) unstable; urgency=medium
 
diff --git a/doc-sphinx/source/index.rst b/doc-sphinx/source/index.rst
index 588895c..0d59ffb 100644
--- a/doc-sphinx/source/index.rst
+++ b/doc-sphinx/source/index.rst
@@ -3,7 +3,7 @@
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-Welcome to the pyo 0.8.7 documentation
+Welcome to the pyo 0.8.8 documentation
 ===================================================
 
 .. image:: E-PyoIcon.png
diff --git a/include/ad_jack.h b/include/ad_jack.h
index 892fba8..c49b222 100644
--- a/include/ad_jack.h
+++ b/include/ad_jack.h
@@ -33,6 +33,7 @@ typedef struct {
 } PyoJackMidiEvent;
 
 typedef struct {
+    int activated;
     jack_client_t *jack_client;
     jack_port_t **jack_in_ports;
     jack_port_t **jack_out_ports;
diff --git a/include/py2to3.h b/include/py2to3.h
index d0227d4..96452b1 100644
--- a/include/py2to3.h
+++ b/include/py2to3.h
@@ -80,8 +80,10 @@
 #define PY_STRING_CHECK(a) PyUnicode_Check(a) 
 #define PY_STRING_AS_STRING(a) PyUnicode_AsUTF8(a)
 #define PY_UNICODE_AS_UNICODE(a) PyUnicode_AsUTF8(a)
+#define PY_BYTES_FROM_STRING(a) PyBytes_FromString(a)
 #else
 #define PY_STRING_CHECK(a) (PyUnicode_Check(a) || PyBytes_Check(a))
 #define PY_STRING_AS_STRING(a) PyBytes_AsString(a)
 #define PY_UNICODE_AS_UNICODE(a) PyBytes_AsString(PyUnicode_AsASCIIString(a))
+#define PY_BYTES_FROM_STRING(a) PyString_FromString(a)
 #endif
diff --git a/include/pyomodule.h b/include/pyomodule.h
index 7839e2a..4a620f7 100644
--- a/include/pyomodule.h
+++ b/include/pyomodule.h
@@ -21,7 +21,7 @@
 #include "Python.h"
 #include <math.h>
 
-#define PYO_VERSION "0.8.7"
+#define PYO_VERSION "0.8.8"
 
 #ifndef __MYFLT_DEF
 #define __MYFLT_DEF
@@ -621,6 +621,7 @@ extern PyTypeObject TableScanType;
 
 #define pyo_CLEAR \
     if (self->server != NULL) { \
+        Py_DECREF(self->server); \
         self->server = NULL; \
     } \
     if (self->stream != NULL) \
@@ -632,6 +633,7 @@ extern PyTypeObject TableScanType;
 
 #define pyo_table_CLEAR \
     if (self->server != NULL) { \
+        Py_DECREF(self->server); \
         self->server = NULL; \
     } \
     if (self->tablestream != NULL) \
@@ -639,6 +641,7 @@ extern PyTypeObject TableScanType;
 
 #define pyo_matrix_CLEAR \
     if (self->server != NULL) { \
+        Py_DECREF(self->server); \
         self->server = NULL; \
     } \
     if (self->matrixstream != NULL) \
@@ -681,6 +684,7 @@ extern PyTypeObject TableScanType;
 /* Init Server & Stream */
 #define INIT_OBJECT_COMMON \
     self->server = PyServer_get_server(); \
+    Py_INCREF(self->server); \
     self->mul = PyFloat_FromDouble(1); \
     self->add = PyFloat_FromDouble(0); \
     self->bufsize = PyInt_AsLong(PyObject_CallMethod(self->server, "getBufferSize", NULL)); \
diff --git a/installers/osx/release_x86_64_py2.sh b/installers/osx/release_x86_64_py2.sh
index 2db031e..d5eb2fb 100755
--- a/installers/osx/release_x86_64_py2.sh
+++ b/installers/osx/release_x86_64_py2.sh
@@ -8,9 +8,9 @@
 # 3. cd utils and build E-Pyo for python2
 # 4. cd installers/osx and build the release for python2
 
-export PACKAGE_NAME=pyo_0.8.7_x86_64_py2.pkg
-export DMG_DIR="pyo 0.8.7 py2 Universal"
-export DMG_NAME="pyo_0.8.7_OSX_py2-universal.dmg"
+export PACKAGE_NAME=pyo_0.8.8_x86_64_py2.pkg
+export DMG_DIR="pyo 0.8.8 py2 Universal"
+export DMG_NAME="pyo_0.8.8_OSX_py2-universal.dmg"
 export INSTALLER_DIR=`pwd`/installer
 export PYO_MODULE_DIR=$INSTALLER_DIR/PyoModule/Package_Contents/tmp
 export SUPPORT_LIBS_DIR=$INSTALLER_DIR/SupportLibs/Package_Contents/usr/local/lib
diff --git a/installers/osx/release_x86_64_py3.5.sh b/installers/osx/release_x86_64_py3.5.sh
index 0cee288..2d28d88 100755
--- a/installers/osx/release_x86_64_py3.5.sh
+++ b/installers/osx/release_x86_64_py3.5.sh
@@ -8,9 +8,9 @@
 # 3. cd utils and build E-Pyo for python3.5
 # 4. cd installers/osx and build the release for python3.5
 
-export PACKAGE_NAME=pyo_0.8.7_x86_64_py35.pkg
-export DMG_DIR="pyo 0.8.7 py35 Universal"
-export DMG_NAME="pyo_0.8.7_OSX_py35-universal.dmg"
+export PACKAGE_NAME=pyo_0.8.8_x86_64_py35.pkg
+export DMG_DIR="pyo 0.8.8 py35 Universal"
+export DMG_NAME="pyo_0.8.8_OSX_py35-universal.dmg"
 export INSTALLER_DIR=`pwd`/installer
 export PYO_MODULE_DIR=$INSTALLER_DIR/PyoModule/Package_Contents/tmp
 export SUPPORT_LIBS_DIR=$INSTALLER_DIR/SupportLibs/Package_Contents/usr/local/lib
diff --git a/installers/osx/release_x86_64_py3.6.sh b/installers/osx/release_x86_64_py3.6.sh
index 367a5d0..57d669b 100755
--- a/installers/osx/release_x86_64_py3.6.sh
+++ b/installers/osx/release_x86_64_py3.6.sh
@@ -8,9 +8,9 @@
 # 3. cd utils and build E-Pyo for python3.6
 # 4. cd installers/osx and build the release for python3.6
 
-export PACKAGE_NAME=pyo_0.8.7_x86_64_py36.pkg
-export DMG_DIR="pyo 0.8.7 py36 Universal"
-export DMG_NAME="pyo_0.8.7_OSX_py36-universal.dmg"
+export PACKAGE_NAME=pyo_0.8.8_x86_64_py36.pkg
+export DMG_DIR="pyo 0.8.8 py36 Universal"
+export DMG_NAME="pyo_0.8.8_OSX_py36-universal.dmg"
 export INSTALLER_DIR=`pwd`/installer
 export PYO_MODULE_DIR=$INSTALLER_DIR/PyoModule/Package_Contents/tmp
 export SUPPORT_LIBS_DIR=$INSTALLER_DIR/SupportLibs/Package_Contents/usr/local/lib
diff --git a/installers/win/win_installer_py27.iss b/installers/win/win_installer_py27.iss
index 20209f8..6642e39 100644
--- a/installers/win/win_installer_py27.iss
+++ b/installers/win/win_installer_py27.iss
@@ -3,7 +3,7 @@
 
 #define appName "pyo"
 #define pyVer "2.7"
-#define appVer "0.8.7"
+#define appVer "0.8.8"
 
 [Setup]
 ; NOTE: The value of AppId uniquely identifies this application.
diff --git a/installers/win/win_installer_py35.iss b/installers/win/win_installer_py35.iss
index 92468e2..f2fba57 100644
--- a/installers/win/win_installer_py35.iss
+++ b/installers/win/win_installer_py35.iss
@@ -3,7 +3,7 @@
 
 #define appName "pyo"
 #define pyVer "3.5"
-#define appVer "0.8.7"
+#define appVer "0.8.8"
 
 [Setup]
 ; NOTE: The value of AppId uniquely identifies this application.
diff --git a/installers/win/win_installer_py36.iss b/installers/win/win_installer_py36.iss
index 920f1a8..f85a7f6 100644
--- a/installers/win/win_installer_py36.iss
+++ b/installers/win/win_installer_py36.iss
@@ -3,7 +3,7 @@
 
 #define appName "pyo"
 #define pyVer "3.6"
-#define appVer "0.8.7"
+#define appVer "0.8.8"
 
 [Setup]
 ; NOTE: The value of AppId uniquely identifies this application.
diff --git a/pyolib/_core.py b/pyolib/_core.py
index 1418932..0e42eab 100644
--- a/pyolib/_core.py
+++ b/pyolib/_core.py
@@ -31,6 +31,7 @@ import sys
 import time
 import inspect
 import tempfile
+import locale
 from subprocess import call
 from weakref import proxy
 
@@ -149,8 +150,12 @@ def listscramble(lst):
 
 def stringencode(st):
     if sys.version_info[0] >= 3:
-        if type(st) is str:
-            st = st.encode(sys.getfilesystemencoding())
+        if sys.version_info[1] <= 5:
+            if type(st) is str:
+                st = st.encode(sys.getfilesystemencoding())
+        else:
+            if type(st) is str:
+                st = st.encode(locale.getpreferredencoding())
     return st
 
 def sndinfo(path, print=False):
diff --git a/pyolib/_tkwidgets.py b/pyolib/_tkwidgets.py
index 4873530..2c0b31e 100644
--- a/pyolib/_tkwidgets.py
+++ b/pyolib/_tkwidgets.py
@@ -289,7 +289,8 @@ class ServerGUI(tk.Frame):
     "Server's graphical interface."
     def __init__(self, master=None, nchnls=2, startf=None, stopf=None,
                  recstartf=None, recstopf=None, ampf=None, started=0,
-                 locals=None, shutdown=None, meter=True, timer=True, amp=1.):
+                 locals=None, shutdown=None, meter=True, timer=True, amp=1.,
+                 getIsBooted=None):
         tk.Frame.__init__(self, master, padx=10, pady=10, bd=2, relief=tk.GROOVE)
         self.shutdown = shutdown
         self.locals = locals
@@ -302,6 +303,7 @@ class ServerGUI(tk.Frame):
         self.recstopf = recstopf
         self.ampf = ampf
         self.amp = amp
+        self.getIsBooted = getIsBooted
         self._started = False
         self._recstarted = False
         self.B1, self.B2 = 193 - VM_OFFSET, 244 - VM_OFFSET
@@ -388,7 +390,8 @@ class ServerGUI(tk.Frame):
 
     def on_quit(self):
         "Clean up on quit."
-        self.shutdown()
+        if self.getIsBooted():
+            self.shutdown()
         self.quit()
 
     def getPrev(self, event):
diff --git a/pyolib/_widgets.py b/pyolib/_widgets.py
index 80d6f32..d1c1dac 100644
--- a/pyolib/_widgets.py
+++ b/pyolib/_widgets.py
@@ -387,7 +387,7 @@ def createExprEditorWindow(object, title, wxnoserver=False):
             EXPREDITORWINDOWS.append([object, title])
 
 def createServerGUI(nchnls, start, stop, recstart, recstop, setAmp, started,
-                    locals, shutdown, meter, timer, amp, exit, title):
+                    locals, shutdown, meter, timer, amp, exit, title, getIsBooted):
     "Creates the server's GUI."
     global X, Y, MAX_X, NEXT_Y
     if title is None:
@@ -396,13 +396,13 @@ def createServerGUI(nchnls, start, stop, recstart, recstop, setAmp, started,
         createRootWindow()
         win = tkCreateToplevelWindow()
         f = ServerGUI(win, nchnls, start, stop, recstart, recstop, setAmp,
-                      started, locals, shutdown, meter, timer, amp)
+                      started, locals, shutdown, meter, timer, amp, getIsBooted)
         f.master.title(title)
         f.focus_set()
     else:
         win = createRootWindow()
         f = ServerGUI(None, nchnls, start, stop, recstart, recstop, setAmp,
-                      started, locals, shutdown, meter, timer, amp, exit)
+                      started, locals, shutdown, meter, timer, amp, exit, getIsBooted)
         f.SetTitle(title)
         f.SetPosition((30, 30))
         f.Show()
diff --git a/pyolib/_wxwidgets.py b/pyolib/_wxwidgets.py
index 31c97e1..811efbe 100644
--- a/pyolib/_wxwidgets.py
+++ b/pyolib/_wxwidgets.py
@@ -2908,7 +2908,7 @@ class ServerGUI(wx.Frame):
     def __init__(self, parent=None, nchnls=2, startf=None, stopf=None,
                 recstartf=None, recstopf=None, ampf=None, started=0,
                 locals=None, shutdown=None, meter=True, timer=True, amp=1.,
-                exit=True):
+                exit=True, getIsBooted=None):
         wx.Frame.__init__(self, parent, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
 
         self.menubar = wx.MenuBar()
@@ -2929,6 +2929,7 @@ class ServerGUI(wx.Frame):
         self.recstopf = recstopf
         self.ampf = ampf
         self.exit = exit
+        self.getIsBooted = getIsBooted
         self._started = False
         self._recstarted = False
         self._history = []
@@ -3026,7 +3027,7 @@ class ServerGUI(wx.Frame):
         wx.CallAfter(self.on_quit, None)
 
     def on_quit(self, evt):
-        if self.exit:
+        if self.exit and self.getIsBooted():
             self.shutdown()
             time.sleep(0.25)
         self.Destroy()
diff --git a/pyolib/server.py b/pyolib/server.py
index 9d30948..02f6b2a 100644
--- a/pyolib/server.py
+++ b/pyolib/server.py
@@ -234,7 +234,8 @@ class Server(object):
         self._gui_frame, win, withWX = createServerGUI(self._nchnls, self.start, self.stop,
                                                self.recstart, self.recstop, self.setAmp,
                                                self.getIsStarted(), locals, self.shutdown,
-                                               meter, timer, self._amp, exit, title)
+                                               meter, timer, self._amp, exit, title,
+                                               self.getIsBooted)
         if meter:
             self._server.setAmpCallable(self._gui_frame)
         if timer:
@@ -905,7 +906,7 @@ class Server(object):
                     self._fileformat = fileformat
                     self._server.recordOptions(self._dur, filename, self._fileformat, self._sampletype)
 
-        self._server.recstart(filename)
+        self._server.recstart(stringencode(filename))
 
     def recstop(self):
         """
diff --git a/scripts/release_doc_src.sh b/scripts/release_doc_src.sh
index 9859557..d94fd5a 100755
--- a/scripts/release_doc_src.sh
+++ b/scripts/release_doc_src.sh
@@ -6,7 +6,7 @@
 # 3. Execute from pyo folder : ./scripts/release_doc_src.sh
 #
 
-version=0.8.7
+version=0.8.8
 replace=XXX
 
 doc_rep=pyo_XXX-doc
diff --git a/setup.py b/setup.py
index 6860aeb..dcdd7bd 100644
--- a/setup.py
+++ b/setup.py
@@ -48,7 +48,7 @@ def get_jack_api():
     else:
         return "JACK_NEW_API"
 
-pyo_version = "0.8.7"
+pyo_version = "0.8.8"
 build_with_jack_support = False
 compile_externals = False
 
diff --git a/src/engine/ad_jack.c b/src/engine/ad_jack.c
index 19e4c13..82e0467 100644
--- a/src/engine/ad_jack.c
+++ b/src/engine/ad_jack.c
@@ -69,6 +69,7 @@ jack_callback(jack_nframes_t nframes, void *arg) {
     jack_default_audio_sample_t *in_buffers[server->ichnls], *out_buffers[server->nchnls];
 
     PyoJackBackendData *be_data = (PyoJackBackendData *) server->audio_be_data;
+
     for (i = 0; i < server->ichnls; i++) {
         in_buffers[i] = jack_port_get_buffer(be_data->jack_in_ports[i+server->input_offset], server->bufferSize);
     }
@@ -198,18 +199,24 @@ jack_bufsize_cb(jack_nframes_t nframes, void *arg) {
 
 static void
 jack_error_cb(const char *desc) {
+#ifndef NDEBUG
     PyGILState_STATE s = PyGILState_Ensure();
     PySys_WriteStdout("JACK error: %s\n", desc);
     PyGILState_Release(s);
+#endif
 }
 
 static void
 jack_shutdown_cb(void *arg) {
     Server *server = (Server *) arg;
 
+    PyoJackBackendData *be_data = (PyoJackBackendData *) server->audio_be_data;
+
+    be_data->activated = 0;
+
     PyGILState_STATE s = PyGILState_Ensure();
     Server_shutdown(server);
-    Server_warning(server, "JACK server shutdown. Pyo Server shut down.\n");
+    Server_warning(server, "JACK server shutdown. Pyo Server also shutdown.\n");
     PyGILState_Release(s);
 }
 
@@ -386,8 +393,9 @@ Server_jack_init(Server *self) {
     int index = 0;
     int ret = 0;
     assert(self->audio_be_data == NULL);
-    PyoJackBackendData *be_data = (PyoJackBackendData *) malloc(sizeof(PyoJackBackendData *));
+    PyoJackBackendData *be_data = (PyoJackBackendData *) malloc(sizeof(PyoJackBackendData));
     self->audio_be_data = (void *) be_data;
+    be_data->activated = 0;
     strncpy(client_name, self->serverName, 32);
 
     Py_BEGIN_ALLOW_THREADS
@@ -515,6 +523,8 @@ Server_jack_init(Server *self) {
         return -1;
     }
 
+    be_data->activated = 1;
+
     Server_jack_autoconnect(self);
 
     return 0;
@@ -522,33 +532,36 @@ Server_jack_init(Server *self) {
 
 int
 Server_jack_deinit(Server *self) {
-    int ret;
+    int ret = 0;
     PyoJackBackendData *be_data = (PyoJackBackendData *) self->audio_be_data;
 
-    Py_BEGIN_ALLOW_THREADS
-    ret = jack_deactivate(be_data->jack_client);
-    Py_END_ALLOW_THREADS
+    if (be_data->activated == 1) {
+
+        Py_BEGIN_ALLOW_THREADS
+        ret = jack_deactivate(be_data->jack_client);
+        Py_END_ALLOW_THREADS
 
-    if (ret)
-        Server_error(self, "Jack error: cannot deactivate jack client.\n");
+        if (ret)
+            Server_error(self, "Jack error: cannot deactivate jack client.\n");
 
-    Py_BEGIN_ALLOW_THREADS
-    ret = jack_client_close(be_data->jack_client);
-    Py_END_ALLOW_THREADS
 
-    if (ret)
-        Server_error(self, "Jack error: cannot close client.\n");
+        Py_BEGIN_ALLOW_THREADS
+        ret = jack_client_close(be_data->jack_client);
+        Py_END_ALLOW_THREADS
+
+        if (ret)
+            Server_error(self, "Jack error: cannot close client.\n");
+    }
+
+    be_data->activated = 0;
 
     free(be_data->jack_in_ports);
     free(be_data->jack_out_ports);
     if (self->withJackMidi == 1) {
         free(be_data->midi_events);
     }
-    /* Since I add midi_event_count entry in the PyoJackBackendData struct,
-       freeing the struct gives an error "free(): invalid next size (fast)".
-       until I find the correct solution, I'll just let leak the struct when
-       we shutdown the server. */
-    //free(self->audio_be_data);
+
+    free(self->audio_be_data);
 
     return ret;
 }
diff --git a/src/engine/ad_portaudio.c b/src/engine/ad_portaudio.c
index 064210b..ab41290 100644
--- a/src/engine/ad_portaudio.c
+++ b/src/engine/ad_portaudio.c
@@ -164,7 +164,7 @@ Server_pa_init(Server *self)
         portaudio_assert(n, "Pa_GetDeviceCount");
     }
 
-    PyoPaBackendData *be_data = (PyoPaBackendData *) malloc(sizeof(PyoPaBackendData *));
+    PyoPaBackendData *be_data = (PyoPaBackendData *) malloc(sizeof(PyoPaBackendData));
     self->audio_be_data = (void *) be_data;
 
     if (self->output == -1)
diff --git a/src/engine/md_portmidi.c b/src/engine/md_portmidi.c
index 6d8592b..1933121 100644
--- a/src/engine/md_portmidi.c
+++ b/src/engine/md_portmidi.c
@@ -77,7 +77,7 @@ Server_pm_init(Server *self)
         self->withPortMidiOut = 1;
     }
 
-    PyoPmBackendData *be_data = (PyoPmBackendData *) malloc(sizeof(PyoPmBackendData *));
+    PyoPmBackendData *be_data = (PyoPmBackendData *) malloc(sizeof(PyoPmBackendData));
     self->midi_be_data = (void *) be_data;
 
     if (self->withPortMidi == 1) {
diff --git a/src/engine/servermodule.c b/src/engine/servermodule.c
index 476297d..482bfd2 100644
--- a/src/engine/servermodule.c
+++ b/src/engine/servermodule.c
@@ -536,6 +536,10 @@ Server_traverse(Server *self, visitproc visit, void *arg)
         Py_VISIT(self->CALLBACK);
     if (PyList_Size(self->streams) > 0)
         Py_VISIT(self->streams);
+    Py_VISIT(self->jackInputPortNames);
+    Py_VISIT(self->jackOutputPortNames);
+    Py_VISIT(self->jackMidiInputPortName);
+    Py_VISIT(self->jackMidiOutputPortName);
     Py_VISIT(self->jackAutoConnectInputPorts);
     Py_VISIT(self->jackAutoConnectOutputPorts);
     Py_VISIT(self->jackAutoConnectMidiInputPort);
@@ -552,6 +556,10 @@ Server_clear(Server *self)
         Py_CLEAR(self->CALLBACK);
     if (PyList_Size(self->streams) > 0)
         Py_CLEAR(self->streams);
+    Py_CLEAR(self->jackInputPortNames);
+    Py_CLEAR(self->jackOutputPortNames);
+    Py_CLEAR(self->jackMidiInputPortName);
+    Py_CLEAR(self->jackMidiOutputPortName);
     Py_CLEAR(self->jackAutoConnectInputPorts);
     Py_CLEAR(self->jackAutoConnectOutputPorts);
     Py_CLEAR(self->jackAutoConnectMidiInputPort);
@@ -613,6 +621,10 @@ Server_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self->serverName = (char *) calloc(32, sizeof(char));
     self->jackautoin = 1;
     self->jackautoout = 1;
+    self->jackInputPortNames = PY_BYTES_FROM_STRING("");
+    self->jackOutputPortNames = PY_BYTES_FROM_STRING("");
+    self->jackMidiInputPortName = PY_BYTES_FROM_STRING("");
+    self->jackMidiOutputPortName = PY_BYTES_FROM_STRING("");
     self->jackAutoConnectInputPorts = PyList_New(0);
     self->jackAutoConnectOutputPorts = PyList_New(0);
     self->jackAutoConnectMidiInputPort = PyList_New(0);
@@ -1530,12 +1542,12 @@ Server_recordOptions(Server *self, PyObject *args, PyObject *kwds)
 static PyObject *
 Server_start_rec(Server *self, PyObject *args, PyObject *kwds)
 {
-    //Py_ssize_t psize;
+    Py_ssize_t psize;
     char *filename=NULL;
 
     static char *kwlist[] = {"filename", NULL};
 
-    if (! PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist, &filename)) {
+    if (! PyArg_ParseTupleAndKeywords(args, kwds, "|s#", kwlist, &filename, &psize)) {
         return PyInt_FromLong(-1);
     }
     Server_start_rec_internal(self, filename);
diff --git a/src/objects/matrixmodule.c b/src/objects/matrixmodule.c
index e4fd2d6..0eaf3d8 100644
--- a/src/objects/matrixmodule.c
+++ b/src/objects/matrixmodule.c
@@ -233,6 +233,7 @@ NewMatrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (NewMatrix *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->x_pointer = self->y_pointer = 0;
 
diff --git a/src/objects/phasevocmodule.c b/src/objects/phasevocmodule.c
index 9396098..217965f 100644
--- a/src/objects/phasevocmodule.c
+++ b/src/objects/phasevocmodule.c
@@ -445,7 +445,6 @@ typedef struct {
     pyo_audio_HEAD
     PyObject *input;
     PVStream *input_stream;
-    //PVStream *pv_stream;
     int size;
     int hsize;
     int olaps;
@@ -616,7 +615,6 @@ PVSynth_traverse(PVSynth *self, visitproc visit, void *arg)
     pyo_VISIT
     Py_VISIT(self->input);
     Py_VISIT(self->input_stream);
-    //Py_VISIT(self->pv_stream);
     return 0;
 }
 
@@ -626,7 +624,6 @@ PVSynth_clear(PVSynth *self)
     pyo_CLEAR
     Py_CLEAR(self->input);
     Py_CLEAR(self->input_stream);
-    //Py_CLEAR(self->pv_stream);
     return 0;
 }
 
@@ -763,7 +760,6 @@ static PyObject * PVSynth_inplace_div(PVSynth *self, PyObject *arg) { INPLACE_DI
 static PyMemberDef PVSynth_members[] = {
 {"server", T_OBJECT_EX, offsetof(PVSynth, server), 0, "Pyo server."},
 {"stream", T_OBJECT_EX, offsetof(PVSynth, stream), 0, "Stream object."},
-//{"pv_stream", T_OBJECT_EX, offsetof(PVSynth, pv_stream), 0, "Phase Vocoder Stream object."},
 {"input", T_OBJECT_EX, offsetof(PVSynth, input), 0, "FFT sound object."},
 {"mul", T_OBJECT_EX, offsetof(PVSynth, mul), 0, "Mul factor."},
 {"add", T_OBJECT_EX, offsetof(PVSynth, add), 0, "Add factor."},
@@ -773,7 +769,6 @@ static PyMemberDef PVSynth_members[] = {
 static PyMethodDef PVSynth_methods[] = {
 {"getServer", (PyCFunction)PVSynth_getServer, METH_NOARGS, "Returns server object."},
 {"_getStream", (PyCFunction)PVSynth_getStream, METH_NOARGS, "Returns stream object."},
-//{"_getPVStream", (PyCFunction)PVSynth_getPVStream, METH_NOARGS, "Returns pvstream object."},
 {"play", (PyCFunction)PVSynth_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
 {"out", (PyCFunction)PVSynth_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
 {"stop", (PyCFunction)PVSynth_stop, METH_NOARGS, "Stops computing."},
diff --git a/src/objects/tablemodule.c b/src/objects/tablemodule.c
index 0dd4769..d69a0f7 100644
--- a/src/objects/tablemodule.c
+++ b/src/objects/tablemodule.c
@@ -223,6 +223,7 @@ HarmTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (HarmTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->amplist = PyList_New(0);
     PyList_Append(self->amplist, PyFloat_FromDouble(1.));
@@ -520,6 +521,7 @@ ChebyTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (ChebyTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->amplist = PyList_New(0);
     PyList_Append(self->amplist, PyFloat_FromDouble(1.));
@@ -833,6 +835,7 @@ HannTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (HannTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->size = 8192;
 
@@ -1058,6 +1061,7 @@ SincTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (SincTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->size = 8192;
     self->freq = TWOPI;
@@ -1294,6 +1298,7 @@ WinTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (WinTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->size = 8192;
     self->type = 2;
@@ -1530,6 +1535,7 @@ ParaTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (ParaTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->size = 8192;
 
@@ -1766,6 +1772,7 @@ LinTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (LinTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointslist = PyList_New(0);
     self->size = 8192;
@@ -2093,6 +2100,7 @@ LogTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (LogTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointslist = PyList_New(0);
     self->size = 8192;
@@ -2398,6 +2406,7 @@ CosTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (CosTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointslist = PyList_New(0);
     self->size = 8192;
@@ -2727,6 +2736,7 @@ CosLogTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (CosLogTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointslist = PyList_New(0);
     self->size = 8192;
@@ -3057,6 +3067,7 @@ CurveTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (CurveTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointslist = PyList_New(0);
     self->size = 8192;
@@ -3430,6 +3441,7 @@ ExpTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (ExpTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointslist = PyList_New(0);
     self->size = 8192;
@@ -4119,6 +4131,8 @@ SndTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (SndTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
+
     self->sr = (MYFLT)PyFloat_AsDouble(PyObject_CallMethod(self->server, "getSamplingRate", NULL));
 
     self->chnl = 0;
@@ -4596,6 +4610,7 @@ NewTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (NewTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->pointer = 0;
     self->feedback = 0.0;
@@ -4914,6 +4929,7 @@ DataTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (DataTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     MAKE_NEW_TABLESTREAM(self->tablestream, &TableStreamType, NULL);
 
@@ -5117,6 +5133,7 @@ AtanTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (AtanTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->size = 8192;
     self->slope = 0.5;
@@ -5429,6 +5446,7 @@ PadSynthTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (PadSynthTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     self->size = 262144;
     self->basefreq = 440;
@@ -7521,6 +7539,7 @@ SharedTable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = (SharedTable *)type->tp_alloc(type, 0);
 
     self->server = PyServer_get_server();
+    Py_INCREF(self->server);
 
     MAKE_NEW_TABLESTREAM(self->tablestream, &TableStreamType, NULL);
 
diff --git a/utils/E-Pyo.py b/utils/E-Pyo.py
index ecb4ce3..efea1f0 100755
--- a/utils/E-Pyo.py
+++ b/utils/E-Pyo.py
@@ -29,16 +29,21 @@ import wx.lib.agw.flatnotebook as FNB
 from pyo import * # TODO: what do we really need? OBJECTS_TREE, PYO_VERSION
 from PyoDoc import ManualFrame
 
+encoding_to_add = sys.getfilesystemencoding()
 if sys.version_info[0] < 3:
     from StringIO import StringIO
     unicode_t = unicode
     reload(sys)
     sys.setdefaultencoding("utf-8")
     exec_string = "python"
+    if sys.platform == "win32":
+        encoding_to_add = "utf-8"
 else:
     from io import StringIO as StringIO
     unicode_t = str
     exec_string = "python3"
+    if sys.platform == "win32":
+        encoding_to_add = "mbcs"
 
 if "phoenix" in wx.version():
     from wx.adv import AboutDialogInfo, AboutBox
@@ -144,7 +149,7 @@ if not os.path.isfile(PREFERENCES_PATH):
 
 epyo_prefs = {}
 # TODO: Should handle utf-8 encoding!
-with codecs.open(PREFERENCES_PATH, "r", encoding="utf-8") as f:
+with codecs.open(PREFERENCES_PATH, "r", encoding=encoding_to_add) as f:
     text = f.read()
 spos = text.find("=")
 dictext = text[spos+1:]
@@ -348,11 +353,11 @@ BACKGROUND_SERVER_ARGS = PREFERENCES.get("background_server_args", BACKGROUND_SE
 
 ################## TEMPLATES ##################
 HEADER_TEMPLATE = """#!/usr/bin/env %s
-# encoding: utf-8
-""" % exec_string
+# encoding: %s
+""" % (exec_string, encoding_to_add)
 
 PYO_TEMPLATE = """#!/usr/bin/env %s
-# encoding: utf-8
+# encoding: %s
 from pyo import *
 
 s = Server(sr=44100, nchnls=2, buffersize=512, duplex=1).boot()
@@ -361,7 +366,7 @@ s = Server(sr=44100, nchnls=2, buffersize=512, duplex=1).boot()
 
 
 s.gui(locals())
-""" % exec_string
+""" % (exec_string, encoding_to_add)
 
 CECILIA5_TEMPLATE = '''class Module(BaseModule):
     """
@@ -406,7 +411,7 @@ MODULES = {
 '''
 
 AUDIO_INTERFACE_TEMPLATE = '''#!/usr/bin/env python
-# encoding: utf-8
+# encoding: %s
 import wx
 from pyo import *
 
@@ -441,17 +446,17 @@ class MyFrame(wx.Frame):
 
     def changeFreq(self, evt):
         x = evt.GetInt() * 0.01
-        self.frTxt.SetLabel("Freq: %.2f" % x)
+        self.frTxt.SetLabel("Freq: " + str(x))
         self.freqPort.value = x
 
 app = wx.App(False)
 mainFrame = MyFrame(None, title='Simple App', pos=(100,100), size=(500,300))
 mainFrame.Show()
 app.MainLoop()
-'''
+''' % encoding_to_add
 
 WXPYTHON_TEMPLATE = '''#!/usr/bin/env %s
-# encoding: utf-8
+# encoding: %s
 import wx
 
 class MyFrame(wx.Frame):
@@ -466,7 +471,7 @@ if __name__ == "__main__":
     mainFrame = MyFrame(None, title='Simple App', pos=(100,100), size=(500,300))
     mainFrame.Show()
     app.MainLoop()
-''' % exec_string
+''' % (exec_string, encoding_to_add)
 
 RADIOPYO_TEMPLATE = '''#!/usr/bin/env python
 # encoding: utf-8
@@ -3186,7 +3191,7 @@ class MainFrame(wx.Frame):
             if check1:
                 if not line.startswith("#"):
                     if not '# encoding:' in text:
-                        newtext += '# -*- encoding: %s -*-\n' % sys.getfilesystemencoding()
+                        newtext += '# -*- encoding: %s -*-\n' % encoding_to_add
                     check1 = False
             if not check1 and check2:
                 if is_future and '__future__' in line:
diff --git a/utils/setup.py b/utils/setup.py
index 52e4e9e..7be9164 100644
--- a/utils/setup.py
+++ b/utils/setup.py
@@ -16,11 +16,11 @@ OPTIONS = {'argv_emulation': False,
                'CFBundleExecutable': 'E-Pyo',
                'CFBundleIconFile': 'E-PyoIcon.icns',
                'CFBundleIdentifier': 'com.ajaxsoundstudio.E-Pyo',
-               'CFBundleInfoDictionaryVersion': '0.8.7',
+               'CFBundleInfoDictionaryVersion': '0.8.8',
                'CFBundleName': 'E-Pyo',
                'CFBundlePackageType': 'APPL',
-               'CFBundleShortVersionString': '0.8.7',
-               'CFBundleVersion': '0.8.7',
+               'CFBundleShortVersionString': '0.8.8',
+               'CFBundleVersion': '0.8.8',
                'CFBundleDocumentTypes': [{'CFBundleTypeOSTypes': ['TEXT'],
                                           'CFBundleTypeExtensions': ['py'],
                                           'CFBundleTypeRole': 'Editor',

-- 
python-pyo packaging



More information about the pkg-multimedia-commits mailing list