Skip to content
Snippets Groups Projects
Verified Commit 86931f16 authored by Sebastian's avatar Sebastian
Browse files

Try converting to endianness

parent 4ba3a40e
No related branches found
No related tags found
No related merge requests found
Pipeline #12806 failed
......@@ -20,6 +20,7 @@ package org.briarproject.briar.desktop.utils
import org.briarproject.briar.desktop.utils.ResourceUtils.getResourceAsStream
import java.io.BufferedInputStream
import javax.sound.sampled.AudioFormat
import javax.sound.sampled.AudioSystem
import javax.sound.sampled.Clip
......@@ -29,8 +30,13 @@ object AudioUtils {
val resourceStream = getResourceAsStream(name) ?: return null
val bufferedStream = BufferedInputStream(resourceStream) // add buffer for mark/reset support
val audioInputStream = AudioSystem.getAudioInputStream(bufferedStream)
val f = audioInputStream.format
val audioInputStream2 = AudioSystem.getAudioInputStream(
AudioFormat(f.encoding, f.sampleRate, f.sampleSizeInBits, f.channels, f.frameSize, f.frameRate, true),
audioInputStream
)
val sound = AudioSystem.getClip()
sound.open(audioInputStream)
sound.open(audioInputStream2)
return sound
}
......
/*
* Briar Desktop
* Copyright (C) 2021-2022 The Briar Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.briarproject.briar.desktop
import org.briarproject.briar.desktop.notification.SoundNotificationProvider
import org.briarproject.briar.desktop.utils.AudioUtils
import org.briarproject.briar.desktop.utils.AudioUtils.play
import javax.sound.sampled.AudioFormat
import javax.sound.sampled.AudioSystem
fun main() {
val sound = AudioUtils.loadAudioFromResource("/audio/notification.wav") ?: throw Exception()
sound.play()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment