mirror of
https://github.com/damp11113/IDRB.git
synced 2025-04-27 06:28:09 +00:00
notting updatee
This commit is contained in:
parent
718b918324
commit
4b522fc2e7
@ -192,6 +192,7 @@ class App:
|
||||
bytesconunt_frame = 0
|
||||
start_time = time.time()
|
||||
evaluation_audio_X = None
|
||||
decodecodec = None
|
||||
while True:
|
||||
try:
|
||||
if self.working:
|
||||
@ -245,9 +246,11 @@ class App:
|
||||
pass
|
||||
|
||||
if self.firstrun:
|
||||
opus_decoder = OpusDecoder()
|
||||
opus_decoder.set_channels(self.RDS["ContentInfo"]["channel"])
|
||||
opus_decoder.set_sampling_frequency(self.RDS["ContentInfo"]["samplerates"])
|
||||
decodecodec = datadecoded["channel"][self.readchannel]["RDS"]["ContentInfo"]["Codec"]
|
||||
if decodecodec.upper() == "OPUS":
|
||||
opus_decoder = OpusDecoder()
|
||||
opus_decoder.set_channels(self.RDS["ContentInfo"]["channel"])
|
||||
opus_decoder.set_sampling_frequency(self.RDS["ContentInfo"]["samplerates"])
|
||||
streamoutput = self.paudio.open(format=pyaudio.paInt16, channels=self.RDS["ContentInfo"]["channel"], rate=self.RDS["ContentInfo"]["samplerates"], output=True, output_device_index=self.device_index_output)
|
||||
evaluation_audio_X = np.fft.fftfreq(1024, 1.0 / self.RDS["ContentInfo"]["samplerates"])[:1024 // 2]
|
||||
if len(datadecoded["channel"]) > 1:
|
||||
@ -269,7 +272,6 @@ class App:
|
||||
dpg.configure_item("mediachannelselect", show=True, default_value=channel_info[self.readchannel - 1])
|
||||
elif self.firststart:
|
||||
self.readchannel = datadecoded["mainchannel"]
|
||||
|
||||
# check if channel is encrypted
|
||||
if datadecoded["channel"][self.readchannel]["Encrypt"]:
|
||||
dpg.configure_item("requestpasswordpopup", show=True)
|
||||
@ -302,7 +304,10 @@ class App:
|
||||
dpg.configure_item("serverstatus", default_value="Decrypt Error", color=(255, 0, 0))
|
||||
|
||||
if self.ccisdecrypt or not self.ccisencrypt:
|
||||
decoded_pcm = opus_decoder.decode(memoryview(bytearray(data)))
|
||||
if decodecodec.upper() == "OPUS":
|
||||
decoded_pcm = opus_decoder.decode(memoryview(bytearray(data)))
|
||||
else: # pcm
|
||||
decoded_pcm = data
|
||||
|
||||
# Check if the decoded PCM is empty or not
|
||||
if len(decoded_pcm) > 0:
|
||||
@ -486,6 +491,8 @@ class App:
|
||||
if self.config["debug"]["hideconsole"] == "true":
|
||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
||||
|
||||
ctypes.CDLL("opus.dll")
|
||||
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title=f'IDRB Client v1.5 Beta', width=1280, height=720, large_icon="IDRBfavicon.ico") # set viewport window
|
||||
dpg.setup_dearpygui()
|
||||
|
@ -12,7 +12,8 @@ a = Analysis(
|
||||
('config.ini', '.'), # Example source ('config.ini') and destination ('.') paths
|
||||
('IDRBfavicon.ico', '.'),
|
||||
('IDRBfavicon.png', '.'),
|
||||
('IDRBlogo.png', '.')
|
||||
('IDRBlogo.png', '.'),
|
||||
('opus.dll', '.')
|
||||
],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
|
@ -1,5 +1,6 @@
|
||||
[audio]
|
||||
device =
|
||||
device = Speakers (2- USB Audio DAC )
|
||||
|
||||
[debug]
|
||||
hideconsole = true
|
||||
hideconsole = true
|
||||
|
||||
|
BIN
Client/opus.dll
Normal file
BIN
Client/opus.dll
Normal file
Binary file not shown.
@ -48,22 +48,11 @@ s.bind(server_port)
|
||||
|
||||
s.listen(1)
|
||||
|
||||
|
||||
p = pyaudio.PyAudio()
|
||||
|
||||
sample_rate = 48000
|
||||
bytes_per_sample = p.get_sample_size(pyaudio.paInt16)
|
||||
|
||||
codec = "opus" # opus, pcm, aac
|
||||
|
||||
# Create an Opus encoder
|
||||
bitrates = 64000 #Kbps
|
||||
channel = 2 # Stereo
|
||||
framesize = 60
|
||||
|
||||
|
||||
if bitrates >= 500000:
|
||||
bitrates = 500000
|
||||
|
||||
device_name_input = "Line 5 (Virtual Audio Cable)"
|
||||
device_index_input = 0
|
||||
@ -126,9 +115,9 @@ RDS = {
|
||||
# can add more here
|
||||
],
|
||||
"ContentInfo": {
|
||||
"Codec": codec,
|
||||
"bitrate": bitrates,
|
||||
"channel": channel,
|
||||
"Codec": "opus",
|
||||
"bitrate": 64000,
|
||||
"channel": 2,
|
||||
"samplerates": sample_rate
|
||||
},
|
||||
"images": {
|
||||
@ -168,9 +157,9 @@ RDS2 = {
|
||||
# can add more server here
|
||||
],
|
||||
"ContentInfo": {
|
||||
"Codec": codec,
|
||||
"Codec": "Opus",
|
||||
"bitrate": 8000,
|
||||
"channel": channel,
|
||||
"channel": 2,
|
||||
"samplerates": sample_rate
|
||||
},
|
||||
"images": {
|
||||
@ -226,9 +215,9 @@ def encode_audio():
|
||||
encoder = OpusBufferedEncoder()
|
||||
encoder.set_application("audio")
|
||||
encoder.set_sampling_frequency(sample_rate)
|
||||
encoder.set_channels(channel)
|
||||
encoder.set_bitrates(bitrates)
|
||||
encoder.set_frame_size(framesize)
|
||||
encoder.set_channels(2)
|
||||
encoder.set_bitrates(64000)
|
||||
encoder.set_frame_size(60)
|
||||
|
||||
while True:
|
||||
pcm = np.frombuffer(streaminput.read(1024, exception_on_overflow=False), dtype=np.int16)
|
||||
@ -239,15 +228,13 @@ def encode_audio():
|
||||
|
||||
channel1.put(encoded_packet.tobytes())
|
||||
|
||||
|
||||
|
||||
def encode_audio2():
|
||||
encoder2 = OpusBufferedEncoder()
|
||||
encoder2.set_application("audio")
|
||||
encoder2.set_sampling_frequency(sample_rate)
|
||||
encoder2.set_channels(channel)
|
||||
encoder2.set_channels(2)
|
||||
encoder2.set_bitrates(8000)
|
||||
encoder2.set_frame_size(framesize)
|
||||
encoder2.set_frame_size(60)
|
||||
|
||||
while True:
|
||||
pcm2 = np.frombuffer(streaminput2.read(1024, exception_on_overflow=False), dtype=np.int16)
|
||||
@ -257,6 +244,8 @@ def encode_audio2():
|
||||
# Put the encoded audio into the buffer
|
||||
channel2.put(encoded_packet.tobytes())
|
||||
|
||||
#channel2.put(pcm2.tobytes()) # if you use pcm
|
||||
|
||||
audio_thread = threading.Thread(target=encode_audio)
|
||||
audio_thread.start()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user