Manevolent / ts3j

An open-source Java Teamspeak 3 client library using the TS3 full client protocol
Apache License 2.0
107 stars 15 forks source link

Audio Example #49

Open melliiii opened 1 year ago

melliiii commented 1 year ago

Heii there,

im trying to run the example you provided in this project but i get this exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'opus': The specified module could not be found.

    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
    at net.tomp2p.opuswrapper.Opus.<clinit>(Opus.java:24)
    at de.affenbande.audio.OpusEncoder.<init>(OpusEncoder.java:68)
    at de.affenbande.audio.OpusEncoder.<init>(OpusEncoder.java:39)
    at de.affenbande.audio.TeamspeakFastMixerSink.openOpusEncoder(TeamspeakFastMixerSink.java:206)
    at de.affenbande.audio.TeamspeakFastMixerSink.start(TeamspeakFastMixerSink.java:255)
    at de.affenbande.audio.MusicPlayer.main(MusicPlayer.java:89)
[mp3 @ 000001ec0e82b400] Skipping 1 bytes of junk at 0.
Input #0, mp3, from '':
  Duration: N/A, start: 0.000000, bitrate: 112 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 112 kb/s

Process finished with exit code 1

i edited the pom.xml as the hash you put as the version for FFMpeg4j couldnt be found by maven. the latest version didnt take an inputstream as an input for FFmpegInput, only FFmpegIO, but i didnt know how to convert it. So i put in version 4.1-1.4.4

Any help would be appreciated ^^

melliiii commented 1 year ago

Okay i got about 50 packets to get through after adding System.load("absolute/path/to/lib/opus.dll"), but it stops after the 50 packets and closes.

This is my log:

0.079214 0.04 0
Draining...
Encoder time taken = 30134400 ns
Audio position = 99840 samples sank
Encoder position = 99840 samples encoded
Network position = 12480 bytes sent
Packets encoded = 52 packets encoded
Packets sent = 52 packets sent
Overflow events = 0
Underflow events = 0
[mp3 @ 00000277f103b400] Skipping 1 bytes of junk at 0.
Input #0, mp3, from '':
  Duration: N/A, start: 0.000000, bitrate: 112 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 112 kb/s

Process finished with exit code 0
melliiii commented 1 year ago

Ahh there was a break too much in the while loop right at the bottom, i will later add a pull request to fix this later and also show how to add the opus.dll file so that you can actually use the Opus Library ^^