mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Resolves issues with classpath on Windows and null pointer exception with the AM decoder.
This commit is contained in:
@@ -24,6 +24,5 @@
|
||||
<classpathentry kind="lib" path="imports/logback-classic-1.1.2.jar"/>
|
||||
<classpathentry kind="lib" path="imports/logback-core-1.1.2.jar"/>
|
||||
<classpathentry kind="lib" path="imports/commons-io-2.4.jar"/>
|
||||
<classpathentry kind="lib" path="/jmbe/library/jmbe-0.1.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1 +1 @@
|
||||
java -cp "SDRTrunk.jar;libs/*;config/*;images/*" gui.SDRTrunk
|
||||
java -cp "SDRTrunk.jar;*;libs/*;config/*;images/*" gui.SDRTrunk
|
||||
64
src/audio/AudioOutputManager.java
Normal file
64
src/audio/AudioOutputManager.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package audio;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.DataLine;
|
||||
import javax.sound.sampled.Line;
|
||||
import javax.sound.sampled.Mixer;
|
||||
import javax.sound.sampled.SourceDataLine;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AudioOutputManager
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( AudioOutputManager.class );
|
||||
|
||||
public AudioOutputManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
Mixer.Info[] mi = AudioSystem.getMixerInfo();
|
||||
|
||||
for (Mixer.Info info : mi)
|
||||
{
|
||||
mLog.debug( "info: " + info );
|
||||
|
||||
Mixer m = AudioSystem.getMixer(info);
|
||||
|
||||
mLog.debug( "mixer " + m );
|
||||
|
||||
Line.Info[] sl = m.getSourceLineInfo();
|
||||
|
||||
for (Line.Info info2 : sl)
|
||||
{
|
||||
mLog.debug( " info: " + info2 );
|
||||
|
||||
try
|
||||
{
|
||||
Line line = AudioSystem.getLine( info2 );
|
||||
|
||||
if (line instanceof SourceDataLine)
|
||||
{
|
||||
SourceDataLine source = (SourceDataLine) line;
|
||||
|
||||
DataLine.Info i = (DataLine.Info) source.getLineInfo();
|
||||
|
||||
for (AudioFormat format : i.getFormats())
|
||||
{
|
||||
mLog.debug( " format: " + format );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "errors", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,8 +86,7 @@ public class AMDecoder extends Decoder
|
||||
@Override
|
||||
public IAudioOutput getAudioOutput()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return mAudioOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,18 +29,13 @@ public class IMBETargetDataLine implements TargetDataLine
|
||||
*/
|
||||
public IMBETargetDataLine()
|
||||
{
|
||||
mLog.debug( "Constructing instance of TDL" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open( AudioFormat format, int bufferSize )
|
||||
throws LineUnavailableException
|
||||
{
|
||||
if( format == IMBEAudioFormat.IMBE_AUDIO_FORMAT )
|
||||
{
|
||||
mLog.debug( "We have now set the state - open:" );
|
||||
}
|
||||
else
|
||||
if( format != IMBEAudioFormat.IMBE_AUDIO_FORMAT )
|
||||
{
|
||||
throw new LineUnavailableException( "Unsupported format" );
|
||||
}
|
||||
@@ -49,15 +44,12 @@ public class IMBETargetDataLine implements TargetDataLine
|
||||
@Override
|
||||
public void open() throws LineUnavailableException
|
||||
{
|
||||
mLog.debug( "open() invoked" );
|
||||
|
||||
open( IMBEAudioFormat.IMBE_AUDIO_FORMAT, BUFFER_SIZE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
mLog.debug( "Closing the IMBE target data line" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -140,7 +140,7 @@ public class P25AudioOutput implements IAudioOutput, IAudioTypeListener,
|
||||
|
||||
if( mIMBEToPCMConverter != null )
|
||||
{
|
||||
mLog.debug( "IMBE audio converter library loaded successfully" );
|
||||
mLog.info( "IMBE audio converter library loaded successfully" );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -148,8 +148,6 @@ public class P25AudioOutput implements IAudioOutput, IAudioTypeListener,
|
||||
|
||||
if( mOutput != null )
|
||||
{
|
||||
mLog.debug( "Audio output line loaded successfully" );
|
||||
|
||||
/* Open the audio line with room for two buffers */
|
||||
mOutput.open( IMBEAudioFormat.PCM_SIGNED_8KHZ_16BITS,
|
||||
PROCESSED_AUDIO_FRAME_SIZE * 2 );
|
||||
@@ -184,7 +182,7 @@ public class P25AudioOutput implements IAudioOutput, IAudioTypeListener,
|
||||
}
|
||||
catch( IllegalArgumentException iae )
|
||||
{
|
||||
mLog.equals( "couldn't find/load IMBE to PCM audio converter" );
|
||||
mLog.info( "could NOT find/load IMBE audio converter library" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user