mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
#1170 resolves issue with MP3 encoded audio raspy. Adds auto-clipping of PCM audio prior to encoding and adds 4x new 32-bit input sample rate selections to choose from, in addition to original 4x 16-bit input formats. (#1171)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
package io.github.dsheirer.gui.preference.mp3;
|
||||
|
||||
import io.github.dsheirer.audio.convert.AudioSampleRate;
|
||||
import io.github.dsheirer.audio.convert.InputAudioFormat;
|
||||
import io.github.dsheirer.audio.convert.MP3Setting;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import io.github.dsheirer.preference.mp3.MP3Preference;
|
||||
@@ -43,7 +43,7 @@ public class MP3PreferenceEditor extends HBox
|
||||
private MP3Preference mMP3Preference;
|
||||
private GridPane mEditorPane;
|
||||
private ComboBox<MP3Setting> mMP3SettingComboBox;
|
||||
private ComboBox<AudioSampleRate> mAudioSampleRateComboBox;
|
||||
private ComboBox<InputAudioFormat> mAudioSampleRateComboBox;
|
||||
|
||||
public MP3PreferenceEditor(UserPreferences userPreferences)
|
||||
{
|
||||
@@ -96,12 +96,12 @@ public class MP3PreferenceEditor extends HBox
|
||||
return mMP3SettingComboBox;
|
||||
}
|
||||
|
||||
private ComboBox<AudioSampleRate> getAudioSampleRateComboBox()
|
||||
private ComboBox<InputAudioFormat> getAudioSampleRateComboBox()
|
||||
{
|
||||
if(mAudioSampleRateComboBox == null)
|
||||
{
|
||||
mAudioSampleRateComboBox = new ComboBox<>();
|
||||
mAudioSampleRateComboBox.getItems().addAll(AudioSampleRate.values());
|
||||
mAudioSampleRateComboBox.getItems().addAll(InputAudioFormat.values());
|
||||
mAudioSampleRateComboBox.getSelectionModel().select(mMP3Preference.getAudioSampleRate());
|
||||
mAudioSampleRateComboBox.getSelectionModel().selectedItemProperty()
|
||||
.addListener((observable, oldValue, newValue) -> mMP3Preference.setAudioSampleRate(newValue));
|
||||
|
||||
@@ -407,7 +407,7 @@ public class PlaybackPreferenceEditor extends HBox
|
||||
|
||||
byte[] bytes = buffer.array();
|
||||
|
||||
DataLine.Info info = new DataLine.Info(Clip.class, AudioFormats.PCM_SIGNED_8_KHZ_16BITS_MONO);
|
||||
DataLine.Info info = new DataLine.Info(Clip.class, AudioFormats.PCM_SIGNED_8000_HZ_16_BIT_MONO);
|
||||
|
||||
if(!AudioSystem.isLineSupported(info))
|
||||
{
|
||||
@@ -418,7 +418,7 @@ public class PlaybackPreferenceEditor extends HBox
|
||||
try
|
||||
{
|
||||
Clip clip = (Clip)AudioSystem.getLine(info);
|
||||
clip.open(AudioFormats.PCM_SIGNED_8_KHZ_16BITS_MONO, bytes, 0, bytes.length);
|
||||
clip.open(AudioFormats.PCM_SIGNED_8000_HZ_16_BIT_MONO, bytes, 0, bytes.length);
|
||||
clip.start();
|
||||
}
|
||||
catch(Exception e)
|
||||
|
||||
Reference in New Issue
Block a user