X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:subject:from:to:mime-version
	:content-type:content-transfer-encoding; q=dns; s=default; b=O8D
	hR7GulzTMI2AUWWZQkp46G7Q7TtZ3JIs67R56/5YmVJhjI6f282/kE461QlcFoao
	JuWnVVpbnaenzUHy0bSO/Ig4cK4pyilr76WaZ7rfV8XIjZJE4vSubIb1k4bSo5b4
	P/jfhkhMDxuHX8jYzcLaTbHsFhJAfhSc8P6pGEGg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:subject:from:to:mime-version
	:content-type:content-transfer-encoding; s=default; bh=3YVfigSzL
	QuPEiHwcNCrLh07jgQ=; b=ulQp8AJVH7m+k4pwpi/VqesmktQr1T1btqJOQuAoM
	YG+0rzdY1eDJnuc2ad+qSXdeErPaig8DHMda05BOMa8qtnfO9CHutsssnTlnrty9
	3SmgqqkahaVWkIr5RbKn9zAIUP3rwhM247dAnoRg3XuvbsJ6OLANG5qkL/17NxPW
	dE=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.7 required=5.0 tests=AWL,BAYES_40,T_HK_NAME_DR,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mail.tu-berlin.de
X-tubIT-Incoming-IP: 130.149.58.163
Message-ID: <5dbbc1840b152c7f69ef2e0b06c08070.squirrel@www.physik.tu-berlin.de>
Date: Mon, 17 Mar 2014 08:59:26 +0100
Subject: Re: sox - package is broken
From: "Dr. Alexander Kleinsorge" <aleks@physik.tu-berlin.de>
To: cygwin@cygwin.com
User-Agent: SquirrelMail/1.4.22
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit

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

