mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-15 01:57:39 -05:00
#30 - cleanup
This commit is contained in:
@@ -277,7 +277,13 @@ public abstract class AudioBroadcaster implements IAudioPacketListener
|
|||||||
|
|
||||||
if(!connected())
|
if(!connected())
|
||||||
{
|
{
|
||||||
mAudioRecordingQueue.clear();
|
StreamableAudioRecording recording = mAudioRecordingQueue.poll();
|
||||||
|
|
||||||
|
while(recording != null)
|
||||||
|
{
|
||||||
|
removeRecording(recording);
|
||||||
|
recording = mAudioRecordingQueue.poll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,45 +331,4 @@ public class ShoutcastV1AudioBroadcaster extends AudioBroadcaster
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
ShoutcastV1Configuration config = new ShoutcastV1Configuration(BroadcastFormat.MP3);
|
|
||||||
config.setName("Test Configuration");
|
|
||||||
config.setHost("localhost");
|
|
||||||
config.setPort(8000);
|
|
||||||
config.setPassword("denny3:#1");
|
|
||||||
config.setStreamName("Denny's Audio Broadcast Test");
|
|
||||||
config.setGenre("Scanner Audio");
|
|
||||||
config.setPublic(true);
|
|
||||||
config.setURL("http://localhost:8000");
|
|
||||||
config.setBitRate(16);
|
|
||||||
|
|
||||||
ThreadPoolManager threadPoolManager = new ThreadPoolManager();
|
|
||||||
|
|
||||||
final AudioBroadcaster audioBroadcaster = BroadcastFactory.getBroadcaster(threadPoolManager,config);
|
|
||||||
|
|
||||||
Path path = Paths.get("/home/denny/Music/PCM.wav");
|
|
||||||
mLog.debug("Opening: " + path.toString());
|
|
||||||
|
|
||||||
mLog.debug("Registering and starting audio playback");
|
|
||||||
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
mLog.debug("Playback started [" + path.toString() + "]");
|
|
||||||
|
|
||||||
try (AudioPacketMonoWaveReader reader = new AudioPacketMonoWaveReader(path, true))
|
|
||||||
{
|
|
||||||
reader.setListener(audioBroadcaster);
|
|
||||||
reader.read();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
mLog.error("Error", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
mLog.debug("Playback ended [" + path.toString() + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,54 +512,4 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
boolean test = false;
|
|
||||||
|
|
||||||
ShoutcastV2Configuration config = new ShoutcastV2Configuration(BroadcastFormat.MP3);
|
|
||||||
config.setStreamID(1);
|
|
||||||
config.setName("Test Configuration");
|
|
||||||
config.setHost("localhost");
|
|
||||||
config.setPort(8000);
|
|
||||||
config.setPassword("denny3");
|
|
||||||
config.setStreamName("Denny's Audio Broadcast Test");
|
|
||||||
config.setGenre("Public Safety");
|
|
||||||
config.setPublic(true);
|
|
||||||
config.setURL("http://localhost:8000");
|
|
||||||
config.setBitRate(16);
|
|
||||||
|
|
||||||
if(test)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ThreadPoolManager threadPoolManager = new ThreadPoolManager();
|
|
||||||
|
|
||||||
final AudioBroadcaster audioBroadcaster = BroadcastFactory.getBroadcaster(threadPoolManager,config);
|
|
||||||
|
|
||||||
Path path = Paths.get("/home/denny/Music/PCM.wav");
|
|
||||||
mLog.debug("Opening: " + path.toString());
|
|
||||||
|
|
||||||
mLog.debug("Registering and starting audio playback");
|
|
||||||
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
mLog.debug("Playback started [" + path.toString() + "]");
|
|
||||||
|
|
||||||
try (AudioPacketMonoWaveReader reader = new AudioPacketMonoWaveReader(path, true))
|
|
||||||
{
|
|
||||||
reader.setListener(audioBroadcaster);
|
|
||||||
reader.read();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
mLog.error("Error", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
mLog.debug("Playback ended [" + path.toString() + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user