libcsound 1.0.0__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {libcsound-1.0.0 → libcsound-1.0.2}/PKG-INFO +1 -1
  2. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/api7.py +76 -2
  3. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound.egg-info/PKG-INFO +1 -1
  4. libcsound-1.0.2/libcsound.egg-info/scm_version.json +8 -0
  5. libcsound-1.0.0/libcsound.egg-info/scm_version.json +0 -8
  6. {libcsound-1.0.0 → libcsound-1.0.2}/.github/workflows/test.yml +0 -0
  7. {libcsound-1.0.0 → libcsound-1.0.2}/AGENTS.md +0 -0
  8. {libcsound-1.0.0 → libcsound-1.0.2}/LICENSE +0 -0
  9. {libcsound-1.0.0 → libcsound-1.0.2}/MANIFEST.in +0 -0
  10. {libcsound-1.0.0 → libcsound-1.0.2}/README.rst +0 -0
  11. {libcsound-1.0.0 → libcsound-1.0.2}/cmake/csound-custom-macos.cmake +0 -0
  12. {libcsound-1.0.0 → libcsound-1.0.2}/docs/Makefile +0 -0
  13. {libcsound-1.0.0 → libcsound-1.0.2}/docs/_static/custom.css +0 -0
  14. {libcsound-1.0.0 → libcsound-1.0.2}/docs/conf.py +0 -0
  15. {libcsound-1.0.0 → libcsound-1.0.2}/docs/csound7.rst +0 -0
  16. {libcsound-1.0.0 → libcsound-1.0.2}/docs/index.rst +0 -0
  17. {libcsound-1.0.0 → libcsound-1.0.2}/docs/introduction.rst +0 -0
  18. {libcsound-1.0.0 → libcsound-1.0.2}/docs/make.bat +0 -0
  19. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/01-Introduction.ipynb +0 -0
  20. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/02-Threading.ipynb +0 -0
  21. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/no-queue.png +0 -0
  22. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/no-queue.wav +0 -0
  23. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/threading-example1.mp3 +0 -0
  24. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/threading-example2.mp3 +0 -0
  25. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks/with-queue.wav +0 -0
  26. {libcsound-1.0.0 → libcsound-1.0.2}/docs/notebooks.rst +0 -0
  27. {libcsound-1.0.0 → libcsound-1.0.2}/docs/requirements.txt +0 -0
  28. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/__init__.py +0 -0
  29. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/_dll.py +0 -0
  30. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/_install.py +0 -0
  31. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/_util.py +0 -0
  32. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/common.py +0 -0
  33. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/data/getcsound.ps1 +0 -0
  34. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/data/getcsound.sh +0 -0
  35. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound/py.typed +0 -0
  36. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound.egg-info/SOURCES.txt +0 -0
  37. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound.egg-info/dependency_links.txt +0 -0
  38. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound.egg-info/requires.txt +0 -0
  39. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound.egg-info/scm_file_list.json +0 -0
  40. {libcsound-1.0.0 → libcsound-1.0.2}/libcsound.egg-info/top_level.txt +0 -0
  41. {libcsound-1.0.0 → libcsound-1.0.2}/pyproject.toml +0 -0
  42. {libcsound-1.0.0 → libcsound-1.0.2}/setup.cfg +0 -0
  43. {libcsound-1.0.0 → libcsound-1.0.2}/test/actions-test1.py +0 -0
  44. {libcsound-1.0.0 → libcsound-1.0.2}/test/actionstest.csd +0 -0
  45. {libcsound-1.0.0 → libcsound-1.0.2}/test/bufferInOut.csd +0 -0
  46. {libcsound-1.0.0 → libcsound-1.0.2}/test/check-installer-sync.py +0 -0
  47. {libcsound-1.0.0 → libcsound-1.0.2}/test/linux-install-render.py +0 -0
  48. {libcsound-1.0.0 → libcsound-1.0.2}/test/macos-install-render.py +0 -0
  49. {libcsound-1.0.0 → libcsound-1.0.2}/test/numpfields.csd +0 -0
  50. {libcsound-1.0.0 → libcsound-1.0.2}/test/simple1.csd +0 -0
  51. {libcsound-1.0.0 → libcsound-1.0.2}/test/simple2.csd +0 -0
  52. {libcsound-1.0.0 → libcsound-1.0.2}/test/test-numpfields.py +0 -0
  53. {libcsound-1.0.0 → libcsound-1.0.2}/test/test0.py +0 -0
  54. {libcsound-1.0.0 → libcsound-1.0.2}/test/test1.py +0 -0
  55. {libcsound-1.0.0 → libcsound-1.0.2}/test/windows-install-render.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libcsound
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Python bindings to the Csound 7 API
5
5
  Author-email: Eduardo Moguillansky <eduardo.moguillansky@gmail.com>
6
6
  License: GNU LESSER GENERAL PUBLIC LICENSE
@@ -301,6 +301,10 @@ def _declareAPI(libcsound):
301
301
  ct.c_char_p, ct.c_int32]
302
302
  libcsound.csoundGetChannelVarTypeName.restype = ct.c_char_p
303
303
  libcsound.csoundGetChannelVarTypeName.argtypes = [CSOUND_p, ct.c_char_p]
304
+ libcsound.csoundGetTypePool.restype = ct.c_void_p
305
+ libcsound.csoundGetTypePool.argtypes = [CSOUND_p]
306
+ libcsound.csoundGetTypeWithVarTypeName.restype = ct.c_void_p
307
+ libcsound.csoundGetTypeWithVarTypeName.argtypes = [ct.c_void_p, ct.c_char_p]
304
308
  libcsound.csoundListChannels.restype = ct.c_int32
305
309
  libcsound.csoundListChannels.argtypes = [CSOUND_p, ct.POINTER(ct.POINTER(ControlChannelInfo))]
306
310
  libcsound.csoundDeleteChannelList.argtypes = [CSOUND_p, ct.POINTER(ControlChannelInfo)]
@@ -600,7 +604,8 @@ class Csound:
600
604
  self._compilationStarted = False
601
605
 
602
606
  self._ugenFactory: UgenFactory | None = None
603
-
607
+ self._typePool: ct.c_void_p | None = None
608
+ self._cache: dict[str, _t.Any] = {}
604
609
  self._started = False
605
610
 
606
611
  def destroy(self):
@@ -1749,7 +1754,6 @@ class Csound:
1749
1754
  if chan_type == CSOUND_STRING_CHANNEL:
1750
1755
  return ct.cast(ptr, STRINGDAT_p), err
1751
1756
  elif chan_type == CSOUND_ARRAY_CHANNEL:
1752
- # TODO: cast to a numpy array
1753
1757
  return ct.cast(ptr, ARRAYDAT_p), err
1754
1758
  elif chan_type == CSOUND_PVS_CHANNEL:
1755
1759
  return ct.cast(ptr, PVSDAT_p), err
@@ -1801,6 +1805,76 @@ class Csound:
1801
1805
  '[': 'array'
1802
1806
  }[ret]
1803
1807
 
1808
+ def varTypePointer(self, typename: str) -> int | None:
1809
+ """Returns the pointer to the canonical type for a variable type name.
1810
+
1811
+ The returned pointer is the same one that is passed as the last
1812
+ argument (``channelType``) to the input/output channel callbacks set
1813
+ with :meth:`setInputChannelCallback` / :meth:`setOutputChannelCallback`,
1814
+ so it can be compared against it to find out the type of the value
1815
+ passed to the callback.
1816
+
1817
+ For the standard types these correspond to the ``CS_VAR_TYPE_*``
1818
+ objects in the Csound C API, i.e. ``varTypePointer('k')`` is
1819
+ ``CS_VAR_TYPE_K`` and ``varTypePointer('S')`` is ``CS_VAR_TYPE_S``.
1820
+
1821
+ Args:
1822
+ typename: the variable type name, e.g. 'k' (control), 'a' (audio),
1823
+ 'S' (string), 'i' (init), 'f' (pvs), '[' (array)
1824
+
1825
+ Returns:
1826
+ the address of the canonical type as an int, or None if the type
1827
+ name is unknown.
1828
+
1829
+ .. note::
1830
+
1831
+ The returned pointers are valid for the lifetime of the process and
1832
+ are the same for every :class:`Csound` instance, so they only need
1833
+ to be resolved once (before setting the callback).
1834
+
1835
+ .. rubric:: Example
1836
+
1837
+ Compare the type of a value received in an outvalue callback:
1838
+
1839
+ .. code-block:: python
1840
+
1841
+ cs = Csound()
1842
+ cs.compileOrc(...)
1843
+
1844
+ ktype = cs.varTypePointer('k')
1845
+ stype = cs.varTypePointer('S')
1846
+
1847
+ def outvalue(csnd, name, value_ptr, type_ptr):
1848
+ if type_ptr == ktype:
1849
+ value = ct.c_double.from_address(value_ptr).value
1850
+ elif type_ptr == stype:
1851
+ value = ct.cast(value_ptr, ct.c_char_p).value
1852
+ else:
1853
+ value = None
1854
+ print(name.decode(), value)
1855
+
1856
+ cs.setOutputChannelCallback(outvalue)
1857
+ """
1858
+ key = 'vartypeptr/' + typename
1859
+ if ptr := self._cache.get(key):
1860
+ return ptr
1861
+ pool = self.getTypePool()
1862
+ ptr = libcsound.csoundGetTypeWithVarTypeName(pool, cstring(typename))
1863
+ self._cache[key] = ptr
1864
+ return ptr
1865
+
1866
+ def getTypePool(self) -> ct.c_void_p:
1867
+ """Returns the type pool for this Csound instance.
1868
+
1869
+ The type pool is used to resolve variable types by name, e.g. with
1870
+ :meth:`varTypePointer()`.
1871
+ """
1872
+ if self._typePool is None:
1873
+ self._typePool = pool = libcsound.csoundGetTypePool(self.cs)
1874
+ return pool
1875
+ else:
1876
+ return self._typePool
1877
+
1804
1878
  def allocatedChannels(self) -> list[ChannelInfo]:
1805
1879
  """
1806
1880
  Returns a list of allocated channels
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libcsound
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Python bindings to the Csound 7 API
5
5
  Author-email: Eduardo Moguillansky <eduardo.moguillansky@gmail.com>
6
6
  License: GNU LESSER GENERAL PUBLIC LICENSE
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.0.2",
3
+ "distance": 0,
4
+ "node": "gd9fc7bc2c60734eea2e07b0c9d838e9c3b8e71bb",
5
+ "dirty": false,
6
+ "branch": "master",
7
+ "node_date": "2026-10-17"
8
+ }
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "1.0.0",
3
- "distance": 0,
4
- "node": "g2b873675ba6b3be65e128f7809c44c965b25aec7",
5
- "dirty": false,
6
- "branch": "csound7-only",
7
- "node_date": "2026-10-13"
8
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes