@@ -29,136 +29,155 @@ import java.io.Closeable
2929 * forcibly terminated without notifying peers.
3030 */
3131interface ToxAv : Closeable {
32+ /* *
33+ * Start new A/V session. There can only be only one session per Tox instance.
34+ *
35+ * @param tox A compatible ToxCore implementation.
36+ * @return the new A/V session.
37+ */
38+ // @throws[ToxavNewException]
39+ fun create (tox : ToxCore ): ToxAv
3240
33- /* *
34- * Start new A/V session. There can only be only one session per Tox instance.
35- *
36- * @param tox A compatible ToxCore implementation.
37- * @return the new A/V session.
38- */
39- // @throws[ToxavNewException]
40- fun create (tox : ToxCore ): ToxAv
41+ /* *
42+ * Releases all resources associated with the A/V session.
43+ *
44+ * If any calls were ongoing, these will be forcibly terminated without notifying peers. After
45+ * calling this function, no other functions may be called and the av pointer becomes invalid.
46+ */
47+ override fun close (): Unit
4148
42- /* *
43- * Releases all resources associated with the A/V session.
44- *
45- * If any calls were ongoing, these will be forcibly terminated without notifying peers. After
46- * calling this function, no other functions may be called and the av pointer becomes invalid.
47- */
48- override fun close (): Unit
49+ /* * Returns the interval in milliseconds when the next [[iterate]] call should be. */
50+ val iterationInterval: Int
4951
50- /* * Returns the interval in milliseconds when the next [[iterate]] call should be. */
51- val iterationInterval: Int
52+ /* *
53+ * Main loop for the session. This function needs to be called in intervals of
54+ * [[iterationInterval]] milliseconds. It is best called in the separate thread from
55+ * [[ToxCore.iterate]].
56+ */
57+ fun <S > iterate (
58+ handler : ToxAvEventListener <S >,
59+ state : S ,
60+ ): S
5261
53- /* *
54- * Main loop for the session. This function needs to be called in intervals of
55- * [[iterationInterval]] milliseconds. It is best called in the separate thread from
56- * [[ToxCore.iterate]].
57- */
58- fun <S > iterate (handler : ToxAvEventListener <S >, state : S ): S
62+ /* *
63+ * Call a friend. This will start ringing the friend.
64+ *
65+ * It is the client's responsibility to stop ringing after a certain timeout, if such behaviour is
66+ * desired. If the client does not stop ringing, the library will not stop until the friend is
67+ * disconnected.
68+ *
69+ * @param friendNumber The friend number of the friend that should be called.
70+ * @param audioBitRate Audio bit rate in Kb/sec. Set this to 0 to disable audio sending.
71+ * @param videoBitRate Video bit rate in Kb/sec. Set this to 0 to disable video sending.
72+ */
73+ // @throws[ToxavCallException]
74+ fun call (
75+ friendNumber : ToxFriendNumber ,
76+ audioBitRate : BitRate ,
77+ videoBitRate : BitRate ,
78+ ): Unit
5979
60- /* *
61- * Call a friend. This will start ringing the friend.
62- *
63- * It is the client's responsibility to stop ringing after a certain timeout, if such behaviour is
64- * desired. If the client does not stop ringing, the library will not stop until the friend is
65- * disconnected.
66- *
67- * @param friendNumber The friend number of the friend that should be called.
68- * @param audioBitRate Audio bit rate in Kb/sec. Set this to 0 to disable audio sending.
69- * @param videoBitRate Video bit rate in Kb/sec. Set this to 0 to disable video sending.
70- */
71- // @throws[ToxavCallException]
72- fun call (friendNumber : ToxFriendNumber , audioBitRate : BitRate , videoBitRate : BitRate ): Unit
80+ /* *
81+ * Accept an incoming call.
82+ *
83+ * If answering fails for any reason, the call will still be pending and it is possible to try and
84+ * answer it later.
85+ *
86+ * @param friendNumber The friend number of the friend that is calling.
87+ * @param audioBitRate Audio bit rate in Kb/sec. Set this to 0 to disable audio sending.
88+ * @param videoBitRate Video bit rate in Kb/sec. Set this to 0 to disable video sending.
89+ */
90+ // @throws[ToxavAnswerException]
91+ fun answer (
92+ friendNumber : ToxFriendNumber ,
93+ audioBitRate : BitRate ,
94+ videoBitRate : BitRate ,
95+ ): Unit
7396
74- /* *
75- * Accept an incoming call.
76- *
77- * If answering fails for any reason, the call will still be pending and it is possible to try and
78- * answer it later.
79- *
80- * @param friendNumber The friend number of the friend that is calling.
81- * @param audioBitRate Audio bit rate in Kb/sec. Set this to 0 to disable audio sending.
82- * @param videoBitRate Video bit rate in Kb/sec. Set this to 0 to disable video sending.
83- */
84- // @throws[ToxavAnswerException]
85- fun answer (friendNumber : ToxFriendNumber , audioBitRate : BitRate , videoBitRate : BitRate ): Unit
97+ /* *
98+ * Sends a call control command to a friend.
99+ *
100+ * @param friendNumber The friend number of the friend to send the call control to.
101+ * @param control The control command to send.
102+ */
103+ // @throws[ToxavCallControlException]
104+ fun callControl (
105+ friendNumber : ToxFriendNumber ,
106+ control : ToxavCallControl ,
107+ ): Unit
86108
87- /* *
88- * Sends a call control command to a friend.
89- *
90- * @param friendNumber The friend number of the friend to send the call control to.
91- * @param control The control command to send.
92- */
93- // @throws[ToxavCallControlException]
94- fun callControl (friendNumber : ToxFriendNumber , control : ToxavCallControl ): Unit
109+ /* *
110+ * Set the audio bit rate to be used in subsequent audio frames.
111+ *
112+ * @param friendNumber The friend number of the friend for which to set the audio bit rate.
113+ * @param audioBitRate The new audio bit rate in Kb/sec. Set to 0 to disable audio sending. Pass
114+ * -1 to leave unchanged.
115+ */
116+ // @throws[ToxavBitRateSetException]
117+ fun setAudioBitRate (
118+ friendNumber : ToxFriendNumber ,
119+ audioBitRate : BitRate ,
120+ ): Unit
95121
96- /* *
97- * Set the audio bit rate to be used in subsequent audio frames.
98- *
99- * @param friendNumber The friend number of the friend for which to set the audio bit rate.
100- * @param audioBitRate The new audio bit rate in Kb/sec. Set to 0 to disable audio sending. Pass
101- * -1 to leave unchanged.
102- */
103- // @throws[ToxavBitRateSetException]
104- fun setAudioBitRate (friendNumber : ToxFriendNumber , audioBitRate : BitRate ): Unit
122+ /* *
123+ * Set the video bit rate to be used in subsequent audio frames.
124+ *
125+ * @param friendNumber The friend number of the friend for which to set the audio bit rate.
126+ * @param videoBitRate The new video bit rate in Kb/sec. Set to 0 to disable video sending. Pass
127+ * -1 to leave unchanged.
128+ */
129+ // @throws[ToxavBitRateSetException]
130+ fun setVideoBitRate (
131+ friendNumber : ToxFriendNumber ,
132+ videoBitRate : BitRate ,
133+ ): Unit
105134
106- /* *
107- * Set the video bit rate to be used in subsequent audio frames.
108- *
109- * @param friendNumber The friend number of the friend for which to set the audio bit rate.
110- * @param videoBitRate The new video bit rate in Kb/sec. Set to 0 to disable video sending. Pass
111- * -1 to leave unchanged.
112- */
113- // @throws[ToxavBitRateSetException]
114- fun setVideoBitRate (friendNumber : ToxFriendNumber , videoBitRate : BitRate ): Unit
135+ /* *
136+ * Send an audio frame to a friend.
137+ *
138+ * The expected format of the PCM data is: [s1c1][s1c2][...][s2c1][s2c2][...]... Meaning: sample 1
139+ * for channel 1, sample 1 for channel 2, ... For mono audio, this has no meaning, every sample is
140+ * subsequent. For stereo, this means the expected format is LRLRLR... with samples for left and
141+ * right alternating.
142+ *
143+ * @param friendNumber The friend number of the friend to which to send an audio frame.
144+ * @param pcm An array of audio samples. The size of this array must be sample_count * channels.
145+ * @param sampleCount Number of samples in this frame in milliseconds. Valid numbers here are
146+ * ((sample rate) * (audio length) / 1000), where audio length can be 2.5, 5, 10, 20, 40 or 60
147+ * milliseconds.
148+ * @param channels Number of audio channels. Supported values are 1 and 2.
149+ * @param samplingRate Audio sampling rate used in this frame in Hz. Valid sampling rates are
150+ * 8000, 12000, 16000, 24000, or 48000.
151+ */
152+ // @throws[ToxavSendFrameException]
153+ fun audioSendFrame (
154+ friendNumber : ToxFriendNumber ,
155+ pcm : ShortArray ,
156+ sampleCount : SampleCount ,
157+ channels : AudioChannels ,
158+ samplingRate : SamplingRate ,
159+ ): Unit
115160
116- /* *
117- * Send an audio frame to a friend.
118- *
119- * The expected format of the PCM data is: [s1c1][s1c2][...][s2c1][s2c2][...]... Meaning: sample 1
120- * for channel 1, sample 1 for channel 2, ... For mono audio, this has no meaning, every sample is
121- * subsequent. For stereo, this means the expected format is LRLRLR... with samples for left and
122- * right alternating.
123- *
124- * @param friendNumber The friend number of the friend to which to send an audio frame.
125- * @param pcm An array of audio samples. The size of this array must be sample_count * channels.
126- * @param sampleCount Number of samples in this frame in milliseconds. Valid numbers here are
127- * ((sample rate) * (audio length) / 1000), where audio length can be 2.5, 5, 10, 20, 40 or 60
128- * milliseconds.
129- * @param channels Number of audio channels. Supported values are 1 and 2.
130- * @param samplingRate Audio sampling rate used in this frame in Hz. Valid sampling rates are
131- * 8000, 12000, 16000, 24000, or 48000.
132- */
133- // @throws[ToxavSendFrameException]
134- fun audioSendFrame (
135- friendNumber : ToxFriendNumber ,
136- pcm : ShortArray ,
137- sampleCount : SampleCount ,
138- channels : AudioChannels ,
139- samplingRate : SamplingRate
140- ): Unit
141-
142- /* *
143- * Send a video frame to a friend.
144- *
145- * Y - plane should be of size: height * width U - plane should be of size: (height/2) * (width/2)
146- * V - plane should be of size: (height/2) * (width/2)
147- *
148- * @param friendNumber The friend number of the friend to which to send a video frame.
149- * @param width Width of the frame in pixels.
150- * @param height Height of the frame in pixels.
151- * @param y Y (Luminance) plane data.
152- * @param u U (Chroma) plane data.
153- * @param v V (Chroma) plane data.
154- */
155- // @throws[ToxavSendFrameException]
156- fun videoSendFrame (
157- friendNumber : ToxFriendNumber ,
158- width : Int ,
159- height : Int ,
160- y : ByteArray ,
161- u : ByteArray ,
162- v : ByteArray
163- ): Unit
161+ /* *
162+ * Send a video frame to a friend.
163+ *
164+ * Y - plane should be of size: height * width U - plane should be of size: (height/2) * (width/2)
165+ * V - plane should be of size: (height/2) * (width/2)
166+ *
167+ * @param friendNumber The friend number of the friend to which to send a video frame.
168+ * @param width Width of the frame in pixels.
169+ * @param height Height of the frame in pixels.
170+ * @param y Y (Luminance) plane data.
171+ * @param u U (Chroma) plane data.
172+ * @param v V (Chroma) plane data.
173+ */
174+ // @throws[ToxavSendFrameException]
175+ fun videoSendFrame (
176+ friendNumber : ToxFriendNumber ,
177+ width : Int ,
178+ height : Int ,
179+ y : ByteArray ,
180+ u : ByteArray ,
181+ v : ByteArray ,
182+ ): Unit
164183}
0 commit comments