JavaSound mixer with both Port(s) and DataLine(s)?

后端 未结 2 1569
心在旅途
心在旅途 2020-12-17 06:54

The diagrms in the JavaSound API Programmer\'s Guide appear to imply (pp. 19-20) that a Mixer can in principle have both DataLines and Ports. However, I was wondering if any

2条回答
  •  隐瞒了意图╮
    2020-12-17 07:28

    It would appear that the intention of the JavaSound API was to allow a Mixer to handle both DataLines and Ports. However the Sun implementation of the API that's included in the JRE has four concrete classes (DirectAudioDevice, SimpleInputDevice, HeadspaceMixer and PortMixer) that each only handle one or the other. They have native methods that map to the way the OS handles audio and it makes sense to keep the logic separate (the classes aren't small). There's not a 1:1 of DataLines to Ports (I for example have 5x DirectAudioDevice and 3x PortMixer) so it's up the programmer to determine what to use for what (or expose to the user for control). Perhaps there are 3rd party implementations of the API for specific devices which combine the two into one Mixer implementation, however I haven't seen one.

提交回复
热议问题