congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AudioFormat.getSampleSizeInBits
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: jitsi/libjitsi

/**
 * Gets the size in bytes of an audio sample of a specific
 * <tt>AudioFormat</tt>.
 *
 * @param format the <tt>AudioFormat</tt> to get the size in bytes of an
 * audio sample of
 * @return the size in bytes of an audio sample of the specified
 * <tt>format</tt>
 */
public static int getSampleSizeInBytes(AudioFormat format)
{
  int sampleSizeInBits = format.getSampleSizeInBits();
  switch (sampleSizeInBits)
  {
  case 8:
    return 1;
  case 16:
    return 2;
  default:
    return sampleSizeInBits / 8;
  }
}
origin: jitsi/libjitsi

/**
 * Init the converter to the new format
 * @param inFormat AudioFormat
 */
private void initConverter(AudioFormat inFormat)
{
  lastFormat = inFormat;
  inputSampleSize = inFormat.getSampleSizeInBits();
  bigEndian = inFormat.getEndian()==AudioFormat.BIG_ENDIAN;
}
origin: jitsi/libjitsi

/**
 * Gets the maximum possible value for an audio sample of a specific
 * <tt>AudioFormat</tt>.
 *
 * @param outFormat the <tt>AudioFormat</tt> of which to get the maximum
 * possible value for an audio sample
 * @return the maximum possible value for an audio sample of the specified
 * <tt>AudioFormat</tt>
 * @throws UnsupportedFormatException if the specified <tt>outFormat</tt>
 * is not supported by the underlying implementation
 */
private static int getMaxOutSample(AudioFormat outFormat)
  throws UnsupportedFormatException
{
  switch(outFormat.getSampleSizeInBits())
  {
  case 8:
    return Byte.MAX_VALUE;
  case 16:
    return Short.MAX_VALUE;
  case 32:
    return Integer.MAX_VALUE;
  case 24:
  default:
    throw new UnsupportedFormatException(
        "Format.getSampleSizeInBits()",
        outFormat);
  }
}
origin: jitsi/libjitsi

/**
 * Initializes and opens a new instance of {@link #resampler} if the
 * <tt>Format</tt>-related state of this instance deems its existence
 * necessary.
 */
private void maybeOpenResampler()
{
  AudioFormat inFormat = this.effectiveFormat;
  AudioFormat outFormat = this.format;
  // We are able to translate between mono and stereo.
  if ((inFormat.getSampleRate() == outFormat.getSampleRate())
      && (inFormat.getSampleSizeInBits()
          == outFormat.getSampleSizeInBits()))
  {
    return;
  }
  Codec resampler
    = WASAPIRenderer.maybeOpenResampler(inFormat, outFormat);
  if (resampler == null)
  {
    throw new IllegalStateException(
        "Failed to open a codec to resample [" + inFormat
          + "] into [" + outFormat + "].");
  }
  else
    this.resampler = resampler;
}
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

= audioFormat.getSampleSizeInBits();
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

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

if (outputFormat != null)
  numberOfOutputChannels = outputFormat.getChannels();
inputSampleSize = inFormat.getSampleSizeInBits();
origin: jitsi/libjitsi

|| (inputCast.getSampleSizeInBits() != 8
  && inputCast.getSampleSizeInBits() != Format.NOT_SPECIFIED)
  || (inputCast.getChannels() != 1
    && inputCast.getChannels() != 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
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/jitsi-hammer

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

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

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

outputAudioFormat.getEncoding(),
outputAudioFormat.getSampleRate(),
outputAudioFormat.getSampleSizeInBits(),
outputAudioFormat.getChannels(),
outputAudioFormat.getEndian(),
origin: jitsi/libjitsi

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

outputAudioFormat.getEncoding(),
outputAudioFormat.getSampleRate(),
outputAudioFormat.getSampleSizeInBits(),
outputAudioFormat.getChannels(),
outputAudioFormat.getEndian(),
origin: jitsi/libjitsi

af.getEncoding(),
af.getSampleRate(),
af.getSampleSizeInBits(),
af.getChannels(),
af.getEndian(),
javax.media.formatAudioFormatgetSampleSizeInBits

Popular methods of AudioFormat

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • getSystemService (Context)
  • getSupportFragmentManager (FragmentActivity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Reference (javax.naming)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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