Toga.Sound
implementation design
#2106
Replies: 1 comment 7 replies
-
Those APIs are an obvious surface interpretation of a Sound API. Some questions/suggestions/areas for further research:
However, the biggest question is a meta-question: Is there a need for this in Toga at all? Could this be done by adding iOS/Android support to an existing audio library (like PyAudio)? I haven't done any work with Audio so I have no idea what the "state of the art" is on Python - but I know we've had multiple people asking about using PyAudio on our support forums. If we can let this be someone else's problem, that's going to be preferable to rolling our own; but if there isn't a good option out there that plays well with async and binary packaging, we might need to consider building our own. If we do need to build our own, it would be worth looking at the APIs provided by other platforms (including the native APIs we need to integrate with) to see what functionality they provide for audio - both in terms of determining common language and API patterns, and also to see what is even possible. It might also be worth considering whether this needs to be in toga core - perhaps a standalone "toga-audio" package would make more sense. Every application needs buttons and dialogs; only a very specific set of applications need to be able to play sound. |
Beta Was this translation helpful? Give feedback.
-
I will be implementing the
Toga.Sound
class.The following are the methods and members that
Toga.Sound
class will have:path
- Path to the sound filedata
- Bytes representation object of the sound file in a supported formatplay()
- Play the sound resourcestop()
- Stop the sound resourceOther than
pause()
andresume()
, what other APIs do you all think should be present?Beta Was this translation helpful? Give feedback.
All reactions