{"action":"created","issue":{"url":"https://api.github.com/repos/spatialaudio/jackclient-python/issues/10","labels_url":"https://api.github.com/repos/spatialaudio/jackclient-python/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/spatialaudio/jackclient-python/issues/10/comments","events_url":"https://api.github.com/repos/spatialaudio/jackclient-python/issues/10/events","html_url":"https://github.com/spatialaudio/jackclient-python/pull/10","id":67785534,"number":10,"title":"Add transport_query() method on Client","user":{"login":"Vampouille","id":7067560,"avatar_url":"https://avatars.githubusercontent.com/u/7067560?v=3","gravatar_id":"","url":"https://api.github.com/users/Vampouille","html_url":"https://github.com/Vampouille","followers_url":"https://api.github.com/users/Vampouille/followers","following_url":"https://api.github.com/users/Vampouille/following{/other_user}","gists_url":"https://api.github.com/users/Vampouille/gists{/gist_id}","starred_url":"https://api.github.com/users/Vampouille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vampouille/subscriptions","organizations_url":"https://api.github.com/users/Vampouille/orgs","repos_url":"https://api.github.com/users/Vampouille/repos","events_url":"https://api.github.com/users/Vampouille/events{/privacy}","received_events_url":"https://api.github.com/users/Vampouille/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-11T13:27:41Z","updated_at":"2015-04-14T14:32:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/spatialaudio/jackclient-python/pulls/10","html_url":"https://github.com/spatialaudio/jackclient-python/pull/10","diff_url":"https://github.com/spatialaudio/jackclient-python/pull/10.diff","patch_url":"https://github.com/spatialaudio/jackclient-python/pull/10.patch"},"body":"Hello, \r\n\r\nI added transport_query() method in order to get current transport position and BPM.\r\n\r\nI added several C types from /usr/include/jack/types.h\r\npackage : libjack-jackd2-dev 1.9.9.5+201306 (Linux Mint 17.1 64bit)\r\nI also added a new attribute to Client class : 'position' to avoid malloc() in transport_query() method\r\n"},"comment":{"url":"https://api.github.com/repos/spatialaudio/jackclient-python/issues/comments/92878471","html_url":"https://github.com/spatialaudio/jackclient-python/pull/10#issuecomment-92878471","issue_url":"https://api.github.com/repos/spatialaudio/jackclient-python/issues/10","id":92878471,"user":{"login":"mgeier","id":705404,"avatar_url":"https://avatars.githubusercontent.com/u/705404?v=3","gravatar_id":"","url":"https://api.github.com/users/mgeier","html_url":"https://github.com/mgeier","followers_url":"https://api.github.com/users/mgeier/followers","following_url":"https://api.github.com/users/mgeier/following{/other_user}","gists_url":"https://api.github.com/users/mgeier/gists{/gist_id}","starred_url":"https://api.github.com/users/mgeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgeier/subscriptions","organizations_url":"https://api.github.com/users/mgeier/orgs","repos_url":"https://api.github.com/users/mgeier/repos","events_url":"https://api.github.com/users/mgeier/events{/privacy}","received_events_url":"https://api.github.com/users/mgeier/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T14:32:55Z","updated_at":"2015-04-14T14:32:55Z","body":"First of all, Python isn't really reliable for realtime stuff.\r\nMany things may work quite well, but there isn't really a guarantee for anything.\r\n\r\nI made these Python bindings mainly to be able to do the non-realtime stuff (connecting ports and so on).\r\nI also implemented some of the realtime stuff, but mostly out of curiosity.\r\n\r\nIf you want a more reliable system, you should use C or C++.\r\n\r\nThat said, I still want to try to make the library as useful, reliable and efficient as is possible.\r\n\r\n> My first idea was to hide CFFI struct with a class suitable for realtime \r\nusage that take CFFI struct as constructor argument.\r\n> This class will \r\nhave methods to access each fields (or group of fields) of the CFFI struct :\r\n\r\n```Python\r\nclass Position():\r\n     def __init__(self,cffi_data):\r\n         self._data = cffi_data\r\n\r\n     def get_bar_beat_tick(self):\r\n         return (self._data.bar, self._data.beat, self._data.tick)\r\n\r\n     def get_frame(self):\r\n         return self._data.frame\r\n     ...\r\n```\r\n\r\nGetter methods are un-Pythonic, you would use properties here:\r\n\r\n```Python\r\n    @property\r\n     def bar_beat_tick(self):\r\n         return self._data.bar, self._data.beat, self._data.tick\r\n```\r\n\r\n> constructor only store reference to the CFFI struct so it should be ok \r\nfor realtime?\r\n> This class will avoid copy of all data ? (and it can be documented)\r\n\r\nIt doesn't really make a difference if you create a class instance or a `dict`, because the class instance also holds a `dict` (or at least something similar).\r\n\r\nSo no, a class isn't better than a `dict`, because both will have to be allocated.\r\n\r\nOTOH, Python uses some kind of memory pool for small objects, but I don't really know any details and I don't know if we should count on this.\r\n\r\n> As you suggest, I will add a method to return a complete dict with all \r\nvalues in correct python type.\r\n\r\n>> The former could also do the consistency check |unique_1 == unique_2|.\r\n>\r\n> Should I check consistency (|unique_1 == unique_2|) before returning position ?\r\n\r\nI think this would be good, since that's what those strange fields are there for.\r\n\r\nBut if you make two different options - one for efficiency and one for Pythonicity - you should probably do this only on the latter.\r\n\r\n> Should I send you another pull request or can you check my fork ?\r\n\r\nYou *can* make another pull request if you want, but normally you would just add more commits to your branch \"add_transport_query\".\r\nWhen you push those commits to your repository, they will automagically be added to this PR.\r\nBut I guess you've found that out already ..."}}