mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
#660 Updates audio processing subsystem to use audio segments. Updates audio playback, recording and streaming to use audio segments. Adds support to UserPreferences for sound card selection and audio tone insertion during playback. Adds record preference for WAVE or MP3. Resolves issues with metadata in recordings. (#675)
This commit is contained in:
@@ -1,76 +1,108 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2020 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.source.mixer;
|
||||
|
||||
import javax.sound.sampled.Mixer;
|
||||
|
||||
public class MixerChannelConfiguration
|
||||
{
|
||||
private Mixer mMixer;
|
||||
private MixerChannel mMixerChannel;
|
||||
|
||||
public MixerChannelConfiguration( Mixer mixer, MixerChannel channel )
|
||||
{
|
||||
mMixer = mixer;
|
||||
mMixerChannel = channel;
|
||||
}
|
||||
|
||||
public Mixer getMixer()
|
||||
{
|
||||
return mMixer;
|
||||
}
|
||||
|
||||
public MixerChannel getMixerChannel()
|
||||
{
|
||||
return mMixerChannel;
|
||||
}
|
||||
|
||||
public boolean matches( String mixer, String channels )
|
||||
{
|
||||
return mixer != null &&
|
||||
channels != null &&
|
||||
mMixer.getMixerInfo().getName().contentEquals( mixer ) &&
|
||||
mMixerChannel.name().contentEquals( channels );
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( mMixer.getMixerInfo().getName() );
|
||||
sb.append( " - " );
|
||||
sb.append( mMixerChannel.name() );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
private Mixer mMixer;
|
||||
private MixerChannel mMixerChannel;
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ( ( mMixer == null ) ? 0 : mMixer.hashCode() );
|
||||
result = prime * result
|
||||
+ ( ( mMixerChannel == null ) ? 0 : mMixerChannel.hashCode() );
|
||||
return result;
|
||||
}
|
||||
public MixerChannelConfiguration(Mixer mixer, MixerChannel channel)
|
||||
{
|
||||
mMixer = mixer;
|
||||
mMixerChannel = channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
MixerChannelConfiguration other = (MixerChannelConfiguration) obj;
|
||||
if ( mMixer == null )
|
||||
public Mixer getMixer()
|
||||
{
|
||||
return mMixer;
|
||||
}
|
||||
|
||||
public MixerChannel getMixerChannel()
|
||||
{
|
||||
return mMixerChannel;
|
||||
}
|
||||
|
||||
public boolean matches(String mixer, String channels)
|
||||
{
|
||||
return mixer != null &&
|
||||
channels != null &&
|
||||
mMixer.getMixerInfo().getName().contentEquals(mixer) &&
|
||||
mMixerChannel.name().contentEquals(channels);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(mMixer.getMixerInfo().getName());
|
||||
sb.append(" - ");
|
||||
sb.append(mMixerChannel.name());
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((mMixer == null) ? 0 : mMixer.hashCode());
|
||||
result = prime * result
|
||||
+ ((mMixerChannel == null) ? 0 : mMixerChannel.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
{
|
||||
if ( other.mMixer != null )
|
||||
return true;
|
||||
}
|
||||
if(obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MixerChannelConfiguration other = (MixerChannelConfiguration)obj;
|
||||
if(mMixer == null)
|
||||
{
|
||||
if(other.mMixer != null)
|
||||
{
|
||||
return false;
|
||||
} else if ( !mMixer.equals( other.mMixer ) )
|
||||
}
|
||||
}
|
||||
else if(!mMixer.equals(other.mMixer))
|
||||
{
|
||||
return false;
|
||||
if ( mMixerChannel != other.mMixerChannel )
|
||||
}
|
||||
if(mMixerChannel != other.mMixerChannel)
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user