@@ -41,8 +41,6 @@ interface WSPRAudioSource
4141 *
4242 * @return Success if initialization completed without errors,
4343 * Failure with descriptive error information if initialization failed
44- *
45- * @throws WSPRAudioSourceException for unrecoverable initialization errors
4644 */
4745 suspend fun initialize (): Result <Unit >
4846
@@ -68,8 +66,6 @@ interface WSPRAudioSource
6866 * @return Array of 16-bit audio samples covering the requested duration.
6967 * May be shorter than requested if insufficient audio is available.
7068 * Should not be longer than requested to prevent buffer overflow.
71- *
72- * @throws WSPRAudioSourceException for unrecoverable read errors
7369 */
7470 suspend fun readAudioChunk (durationMs : Long ): ShortArray
7571
@@ -110,68 +106,4 @@ interface WSPRAudioSource
110106 * @return Current status and diagnostic information
111107 */
112108 suspend fun getSourceStatus (): AudioSourceStatus
113- }
114-
115- /* *
116- * Exception thrown by WSPR audio source implementations.
117- */
118- class WSPRAudioSourceException (
119- message : String ,
120- cause : Throwable ? = null
121- ) : Exception(message, cause)
122- {
123- companion object
124- {
125- /* *
126- * Creates an exception for initialization failures.
127- *
128- * @param sourceDescription Type or name of the audio source
129- * @param cause Underlying cause of the failure
130- * @return Formatted exception with descriptive message
131- */
132- fun createInitializationFailure (sourceDescription : String , cause : Throwable ? = null): WSPRAudioSourceException
133- {
134- return WSPRAudioSourceException (
135- " Failed to initialize WSPR audio source: $sourceDescription . ${cause?.message ? : " Unknown error" } " ,
136- cause
137- )
138- }
139-
140- /* *
141- * Creates an exception for audio reading failures.
142- *
143- * @param cause Underlying cause of the read failure
144- * @return Formatted exception with descriptive message
145- */
146- fun createReadFailure (cause : Throwable ? = null): WSPRAudioSourceException
147- {
148- return WSPRAudioSourceException (
149- " Failed to read audio data from WSPR source. ${cause?.message ? : " Unknown error" } " ,
150- cause
151- )
152- }
153-
154- /* *
155- * Creates an exception for audio format compatibility issues.
156- *
157- * @param actualSampleRate Actual sample rate provided by source
158- * @param actualChannels Actual channel count provided by source
159- * @param actualBitDepth Actual bit depth provided by source
160- * @return Formatted exception describing the compatibility issue
161- */
162- fun createFormatIncompatibility (
163- actualSampleRate : Int ,
164- actualChannels : Int ,
165- actualBitDepth : Int
166- ): WSPRAudioSourceException
167- {
168- return WSPRAudioSourceException (
169- " Audio source format incompatible with WSPR requirements. " +
170- " Required: ${WSPRConstants .WSPR_REQUIRED_SAMPLE_RATE } Hz, " +
171- " ${WSPRConstants .WSPR_REQUIRED_CHANNELS } channel, " +
172- " ${WSPRConstants .WSPR_REQUIRED_BIT_DEPTH } -bit. " +
173- " Actual: ${actualSampleRate} Hz, ${actualChannels} channels, ${actualBitDepth} -bit."
174- )
175- }
176- }
177109}
0 commit comments