{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/584","repository_url":"https://api.github.com/repos/eclipse/smarthome","labels_url":"https://api.github.com/repos/eclipse/smarthome/issues/584/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/584/comments","events_url":"https://api.github.com/repos/eclipse/smarthome/issues/584/events","html_url":"https://github.com/eclipse/smarthome/issues/584","id":120137678,"number":584,"title":"Refactor TTS APIs into a general audio dispatching allowing different sources and sinks","user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars.githubusercontent.com/u/3244965?v=3","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eclipse/smarthome/labels/Core","name":"Core","color":"207de5"},{"url":"https://api.github.com/repos/eclipse/smarthome/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":45,"created_at":"2015-12-03T10:23:51Z","updated_at":"2016-03-02T14:22:10Z","closed_at":null,"body":"migrated from Bugzilla [#463802](https://bugs.eclipse.org/bugs/show_bug.cgi?id=463802)\nstatus NEW severity *enhancement* in component *Core* for *---*\nReported in version *unspecified* on platform *All*\nAssigned to: Project Inbox\n\nOn 2015-04-02 09:11:10 -0400, Kai Kreuzer wrote:\n\n> The current TTS implementations combine the creation of the audio stream with its output. E.g. the Google translate TTS service generates an mp3 and outputs it on the local soundcard.\n> It would be much nicer, if the mp3 would be created by one service (the \"source\", here: Google Translate) and the output would be done by another one - this way, it could be played back as well on Sonos, Squeezebox etc. (the \"sink\").\n> \n> When splitting it this way, it automatically means that it is not limited to TTS - but it could indeed be any kind of soundfile. So this refactoring should also address the \"playSound\" action at the same time.\n\n"},"comment":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/comments/191255521","html_url":"https://github.com/eclipse/smarthome/issues/584#issuecomment-191255521","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/584","id":191255521,"user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars.githubusercontent.com/u/3244965?v=3","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T14:22:10Z","updated_at":"2016-03-02T14:22:10Z","body":"> However for certain use cases (like a kind of ringtones) it might be helpful to have some way of identifying the concrete AudioSource / AudioSink.\r\n\r\nLet's only add it when we really need it. Until then, you can use toString() to have a string representing the instance :-)\r\n\r\n> If you both think this unnecessary we can leave the method out.\r\n> If you both are happy with this interface and you do not object\r\n\r\nYou missed the situation that one of us agrees and the other objects :sunglasses: \r\nThe problem that I am seeing with `getOutputStream()`is that a sink might need to provide a specific output stream depending on the audio format. This method now assumes that the stream can directly deal with any content. So to be clean, we would probably rather have to have a `getOutputStream(AudioFormat format)`. Another problem is multi-threading. Assuming the sink is something like a speaker, there can only be a single source stream being processed at a time. The `process` method supports this nicely as it can either block until the previous stream is done or it can internally queue the request. Reaching out the output stream to an unknown number of callers can result in pretty bad concurrency problems and unexpected behavior."}}