This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sox - package is broken


Hi

thanks for all participants in this audio thread.
(I hope this post is auto-connected to the thread with this name - I
seldom use mailinglists. If not, sorry for that)

This weekend, I was also woundering about the way the exit/stop/close is
donw or if it can work.

But I found another issue in fhandler_dsp.cc:
"bits / 8" should be "((bits+7) / 8)" , see below.
as described in the german wikipedia-article (not in engl. one)
https://de.wikipedia.org/wiki/RIFF_WAVE#.E2.80.9EFormat.E2.80.9C-Abschnitt
this makes even more sence:
then cygwin can support 1..16 bit (which is allowed for riff/wave/pcm),
not only 8 and 16 bit.

Alexander
--------------------------
void
fhandler_dev_dsp::Audio::fillFormat (WAVEFORMATEX * format,
                                     int rate, int bits, int channels)
{
  memset (format, 0, sizeof (*format));
  format->wFormatTag = WAVE_FORMAT_PCM;
  format->wBitsPerSample = bits;
  format->nChannels = channels;
  format->nSamplesPerSec = rate;
  format->nAvgBytesPerSec = format->nSamplesPerSec * format->nChannels
    * ((bits+7) / 8);
  format->nBlockAlign = format->nChannels * ((bits+7) / 8);
}

// calculate a good block size
unsigned
fhandler_dev_dsp::Audio::blockSize (int rate, int bits, int channels)
{
  unsigned blockSize;
  blockSize = (((bits+7) / 8) * channels * rate) / 8; // approx 125ms per
block
  // round up to multiple of 64
  blockSize +=  0x3f;
  blockSize &= ~0x3f;
  return blockSize;
}



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]