congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AudioFormat.getChannels
Code IndexAdd Tabnine to your IDE (free)

How to use
getChannels
method
in
javax.media.format.AudioFormat

Best Java code snippets using javax.media.format.AudioFormat.getChannels (Showing top 20 results out of 315)

origin: jitsi/libjitsi

/**
 * Gets the number of audio channels associated with this
 * <tt>AudioMediaFormat</tt>.
 *
 * @return the number of audio channels associated with this
 * <tt>AudioMediaFormat</tt>
 * @see AudioMediaFormat#getChannels()
 */
public int getChannels()
{
  int channels = format.getChannels();
  return (Format.NOT_SPECIFIED == channels) ? 1 : channels;
}
origin: jitsi/libjitsi

@Override
protected Format[] getMatchingOutputFormats(Format in)
{
  AudioFormat af = (AudioFormat) in;
  supportedOutputFormats =
    new AudioFormat[]
    { new AudioFormat(AudioFormat.LINEAR, af.getSampleRate(), 16,
      af.getChannels(), AudioFormat.LITTLE_ENDIAN, // isBigEndian(),
      AudioFormat.SIGNED // isSigned());
    ) };
  return supportedOutputFormats;
}
origin: jitsi/libjitsi

private void initConverter(AudioFormat inFormat)
  numberOfInputChannels = inFormat.getChannels();
  if (outputFormat != null)
    numberOfOutputChannels = outputFormat.getChannels();
  inputSampleSize = inFormat.getSampleSizeInBits();
origin: jitsi/libjitsi

int inChannels = inAudioFormat.getChannels();
double inSampleRate = inAudioFormat.getSampleRate();
    = (AudioFormat) supportedFormat;
  if (supportedAudioFormat.getChannels() != inChannels)
    continue;
origin: jitsi/libjitsi

/**
 * Gets the frame size measured in bytes defined by a specific
 * <tt>Format</tt>.
 *
 * @param format the <tt>Format</tt> to determine the frame size in
 *            bytes of
 * @return the frame size measured in bytes defined by the specified
 *         <tt>Format</tt>
 */
private static int getFrameSizeInBytes(Format format)
{
  AudioFormat audioFormat = (AudioFormat) format;
  int frameSizeInBits = audioFormat.getFrameSizeInBits();
  if (frameSizeInBits <= 0)
    return
      (audioFormat.getSampleSizeInBits() / 8)
        * audioFormat.getChannels();
  return (frameSizeInBits <= 8) ? 1 : (frameSizeInBits / 8);
}
origin: jitsi/libjitsi

int channels = audioFormat.getChannels();
origin: jitsi/libjitsi

  /**
   * {@inheritDoc}
   */
  @Override
  public Format setOutputFormat(Format format)
  {
    Format setOutputFormat = super.setOutputFormat(format);

    if (setOutputFormat != null)
    {
      AudioFormat af = (AudioFormat) setOutputFormat;

      outputFrameSize = (af.getSampleSizeInBits() / 8) * af.getChannels();
      outputSampleRate = (int) af.getSampleRate();
    }
    return setOutputFormat;
  }
}
origin: jitsi/libjitsi

@Override
protected Format[] getMatchingOutputFormats(Format in)
{
  AudioFormat inFormat = (AudioFormat) in;
  int channels = inFormat.getChannels();
  int sampleRate = (int) (inFormat.getSampleRate());
  if (channels == 2)
  {
    supportedOutputFormats = new AudioFormat[] {
        new AudioFormat(AudioFormat.ULAW, sampleRate, 8, 2,
            Format.NOT_SPECIFIED, Format.NOT_SPECIFIED),
        new AudioFormat(AudioFormat.ULAW, sampleRate, 8, 1,
            Format.NOT_SPECIFIED, Format.NOT_SPECIFIED) };
  }
  else
  {
    supportedOutputFormats = new AudioFormat[] { new AudioFormat(
        AudioFormat.ULAW, sampleRate, 8, 1, Format.NOT_SPECIFIED,
        Format.NOT_SPECIFIED) };
  }
  return supportedOutputFormats;
}
origin: jitsi/libjitsi

private void connect()
{
  AudioFormat format = (AudioFormat) getFormat();
  int channels = format.getChannels();
  if (channels == Format.NOT_SPECIFIED)
    channels = 1;
  int sampleSizeInBits = format.getSampleSizeInBits();
  double sampleRate = format.getSampleRate();
  int framesPerBuffer
    = (int) ((sampleRate * MacCoreAudioDevice.DEFAULT_MILLIS_PER_BUFFER)
        / (channels * 1000));
  bytesPerBuffer = (sampleSizeInBits / 8) * channels * framesPerBuffer;
  // Know the Format in which this MacCoreaudioStream will output audio
  // data so that it can report it without going through its DataSource.
  this.format = new AudioFormat(
      AudioFormat.LINEAR,
      sampleRate,
      sampleSizeInBits,
      channels,
      AudioFormat.LITTLE_ENDIAN,
      AudioFormat.SIGNED,
      Format.NOT_SPECIFIED /* frameSizeInBits */,
      Format.NOT_SPECIFIED /* frameRate */,
      Format.byteArray);
}
origin: jitsi/libjitsi

|| (inputCast.getSampleSizeInBits() != 8
  && inputCast.getSampleSizeInBits() != Format.NOT_SPECIFIED)
  || (inputCast.getChannels() != 1
    && inputCast.getChannels() != Format.NOT_SPECIFIED)
  || (inputCast.getFrameSizeInBits() != 264
    && inputCast.getFrameSizeInBits() != Format.NOT_SPECIFIED)
origin: jitsi/libjitsi

/**
 * Gets an <tt>AudioFormat</tt> instance which matches a specific
 * <tt>AudioFormat</tt> and has 1 channel if the specified
 * <tt>AudioFormat</tt> has its number of channels not specified.
 *
 * @param format the <tt>AudioFormat</tt> to get a match of
 * @return if the specified <tt>format</tt> has a specific number of
 * channels, <tt>format</tt>; otherwise, a new <tt>AudioFormat</tt> instance
 * which matches <tt>format</tt> and has 1 channel
 */
private static AudioFormat fixChannels(AudioFormat format)
{
  if (Format.NOT_SPECIFIED == format.getChannels())
    format
      = (AudioFormat)
        format
          .intersects(
            new AudioFormat(
                format.getEncoding(),
                format.getSampleRate(),
                format.getSampleSizeInBits(),
                1));
  return format;
}
origin: jitsi/libjitsi

@Override
protected void doOpen()
  throws ResourceUnavailableException
{
  decState = new SKP_Silk_decoder_state();
  if (DecAPI.SKP_Silk_SDK_InitDecoder(decState) != 0)
  {
    throw new ResourceUnavailableException(
        "DecAPI.SKP_Silk_SDK_InitDecoder");
  }
  AudioFormat inputFormat = (AudioFormat) getInputFormat();
  double sampleRate = inputFormat.getSampleRate();
  int channels = inputFormat.getChannels();
  decControl = new SKP_SILK_SDK_DecControlStruct();
  decControl.API_sampleRate = (int) sampleRate;
  frameLength = (short) ((FRAME_DURATION * sampleRate * channels) / 1000);
  lastSeqNo = Buffer.SEQUENCE_UNKNOWN;
}
origin: jitsi/libjitsi

@Override
public Format[] getSupportedOutputFormats(Format input)
{
  if (input == null)
    return outputFormats;
  else
  {
    if (!(input instanceof AudioFormat))
    {
      return new Format[] {null};
    }
    final AudioFormat inputCast = (AudioFormat) input;
    if (!inputCast.getEncoding().equals(AudioFormat.GSM_RTP))
    {
      return new Format[] {null};
    }
    final AudioFormat result =
        new AudioFormat(
            AudioFormat.GSM,
            inputCast.getSampleRate(),
            inputCast.getSampleSizeInBits(),
            inputCast.getChannels(),
            inputCast.getEndian(),
            inputCast.getSigned(),
            inputCast.getFrameSizeInBits(),
            inputCast.getFrameRate(),
            inputCast.getDataType());
    return new Format[] {result};
  }
}
origin: jitsi/libjitsi

/**
 * Returns the supported output formats
 * @param in Format
 * @return Format[]
 */
public Format[] getSupportedOutputFormats(Format in)
{
  if (in == null)
  {
    return new Format[]{new AudioFormat(AudioFormat.ALAW)};
  }
  if (matches(in, inputFormats) == null)
  {
    return new Format[1];
  }
  if (! (in instanceof AudioFormat))
  {
    return new Format[]{new AudioFormat(AudioFormat.ALAW)};
  }
  AudioFormat af = (AudioFormat) in;
  return new Format[]
  {
    new AudioFormat(
      AudioFormat.ALAW,
      af.getSampleRate(),
      af.getSampleSizeInBits(),
      af.getChannels())
  };
}
origin: jitsi/libjitsi

= format.getChannels()
  * (((int) format.getSampleRate()) / 50)
  * (format.getSampleSizeInBits() / 8);
origin: jitsi/jitsi-hammer

= format.getChannels()
  * (((int) format.getSampleRate()) / 50)
  * (format.getSampleSizeInBits() / 8);
origin: jitsi/libjitsi

@Override
protected void doOpen()
  throws ResourceUnavailableException
{
  encState = new SKP_Silk_encoder_state_FLP();
  encControl = new SKP_SILK_SDK_EncControlStruct();
  if (EncAPI.SKP_Silk_SDK_InitEncoder(encState, encControl) != 0)
  {
    throw new ResourceUnavailableException(
        "EncAPI.SKP_Silk_SDK_InitEncoder");
  }
  AudioFormat inputFormat = (AudioFormat) getInputFormat();
  double sampleRate = inputFormat.getSampleRate();
  int channels = inputFormat.getChannels();
  encControl.API_sampleRate = (int) sampleRate;
  encControl.bitRate = BITRATE;
  encControl.complexity = COMPLEXITY;
  encControl.maxInternalSampleRate = encControl.API_sampleRate;
  setExpectedPacketLoss(0);
  encControl.packetSize
    = (int)
      ((JavaDecoder.FRAME_DURATION * sampleRate * channels) / 1000);
  encControl.useDTX = USE_DTX ? 1 : 0;
  encControl.useInBandFEC = useFec ? 1 : 0;
}
origin: jitsi/libjitsi

af.getSampleRate(),
af.getSampleSizeInBits(),
af.getChannels(),
af.getEndian(),
af.getSigned(),
origin: jitsi/libjitsi

af.getSampleRate(),
af.getSampleSizeInBits(),
af.getChannels(),
af.getEndian(),
af.getSigned(),
origin: jitsi/libjitsi

outputAudioFormat.getSampleRate(),
outputAudioFormat.getSampleSizeInBits(),
outputAudioFormat.getChannels(),
outputAudioFormat.getEndian(),
outputAudioFormat.getSigned(),
javax.media.formatAudioFormatgetChannels

Popular methods of AudioFormat

  • <init>
  • getSampleRate
  • computeDuration
  • getEncoding
  • getSampleSizeInBits
  • getDataType
  • getEndian
  • getFrameRate
  • getFrameSizeInBits
  • getSigned
  • intersects
  • matches
  • intersects,
  • matches

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Runner (org.openjdk.jmh.runner)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now