freebsd-dev/sys/dev/sound/pcm/feeder_fmt.c

1434 lines
47 KiB
C
Raw Normal View History

/*-
* Copyright (c) 1999 Cameron Grant <cg@FreeBSD.org>
* Copyright (c) 2005 Ariff Abdullah <ariff@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
*
* *New* and rewritten soft format converter, supporting 24/32bit pcm data,
* simplified and optimized.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* This new implementation is fully dedicated in memory of Cameron Grant, *
* the creator of the magnificent, highly addictive feeder infrastructure. *
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*/
#include <dev/sound/pcm/sound.h>
#include "feeder_if.h"
SND_DECLARE_FILE("$FreeBSD$");
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static int feeder_fmt_stereodownmix = 0;
TUNABLE_INT("hw.snd.feeder_fmt_stereodownmix", &feeder_fmt_stereodownmix);
#ifdef SND_DEBUG
SYSCTL_INT(_hw_snd, OID_AUTO, feeder_fmt_stereodownmix, CTLFLAG_RW,
&feeder_fmt_stereodownmix, 1, "averaging stereo downmix");
#endif
#define FEEDFMT_RESERVOIR 8 /* 32bit stereo */
static uint8_t ulaw_to_u8_tbl[] = {
3, 7, 11, 15, 19, 23, 27, 31,
35, 39, 43, 47, 51, 55, 59, 63,
66, 68, 70, 72, 74, 76, 78, 80,
82, 84, 86, 88, 90, 92, 94, 96,
98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113,
113, 114, 114, 115, 115, 116, 116, 117,
117, 118, 118, 119, 119, 120, 120, 121,
121, 121, 122, 122, 122, 122, 123, 123,
123, 123, 124, 124, 124, 124, 125, 125,
125, 125, 125, 125, 126, 126, 126, 126,
126, 126, 126, 126, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
253, 249, 245, 241, 237, 233, 229, 225,
221, 217, 213, 209, 205, 201, 197, 193,
190, 188, 186, 184, 182, 180, 178, 176,
174, 172, 170, 168, 166, 164, 162, 160,
158, 157, 156, 155, 154, 153, 152, 151,
150, 149, 148, 147, 146, 145, 144, 143,
143, 142, 142, 141, 141, 140, 140, 139,
139, 138, 138, 137, 137, 136, 136, 135,
135, 135, 134, 134, 134, 134, 133, 133,
133, 133, 132, 132, 132, 132, 131, 131,
131, 131, 131, 131, 130, 130, 130, 130,
130, 130, 130, 130, 129, 129, 129, 129,
129, 129, 129, 129, 129, 129, 129, 129,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static uint8_t alaw_to_u8_tbl[] = {
108, 109, 106, 107, 112, 113, 110, 111,
100, 101, 98, 99, 104, 105, 102, 103,
118, 118, 117, 117, 120, 120, 119, 119,
114, 114, 113, 113, 116, 116, 115, 115,
43, 47, 35, 39, 59, 63, 51, 55,
11, 15, 3, 7, 27, 31, 19, 23,
86, 88, 82, 84, 94, 96, 90, 92,
70, 72, 66, 68, 78, 80, 74, 76,
127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
123, 123, 123, 123, 124, 124, 124, 124,
121, 121, 121, 121, 122, 122, 122, 122,
126, 126, 126, 126, 126, 126, 126, 126,
125, 125, 125, 125, 125, 125, 125, 125,
148, 147, 150, 149, 144, 143, 146, 145,
156, 155, 158, 157, 152, 151, 154, 153,
138, 138, 139, 139, 136, 136, 137, 137,
142, 142, 143, 143, 140, 140, 141, 141,
213, 209, 221, 217, 197, 193, 205, 201,
245, 241, 253, 249, 229, 225, 237, 233,
170, 168, 174, 172, 162, 160, 166, 164,
186, 184, 190, 188, 178, 176, 182, 180,
129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 129, 129, 129, 129, 129, 129,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
133, 133, 133, 133, 132, 132, 132, 132,
135, 135, 135, 135, 134, 134, 134, 134,
130, 130, 130, 130, 130, 130, 130, 130,
131, 131, 131, 131, 131, 131, 131, 131,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
};
static uint8_t u8_to_ulaw_tbl[] = {
0, 0, 0, 0, 0, 1, 1, 1,
1, 2, 2, 2, 2, 3, 3, 3,
3, 4, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7,
7, 8, 8, 8, 8, 9, 9, 9,
9, 10, 10, 10, 10, 11, 11, 11,
11, 12, 12, 12, 12, 13, 13, 13,
13, 14, 14, 14, 14, 15, 15, 15,
15, 16, 16, 17, 17, 18, 18, 19,
19, 20, 20, 21, 21, 22, 22, 23,
23, 24, 24, 25, 25, 26, 26, 27,
27, 28, 28, 29, 29, 30, 30, 31,
31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46,
47, 49, 51, 53, 55, 57, 59, 61,
63, 66, 70, 74, 78, 84, 92, 104,
254, 231, 219, 211, 205, 201, 197, 193,
190, 188, 186, 184, 182, 180, 178, 176,
175, 174, 173, 172, 171, 170, 169, 168,
167, 166, 165, 164, 163, 162, 161, 160,
159, 159, 158, 158, 157, 157, 156, 156,
155, 155, 154, 154, 153, 153, 152, 152,
151, 151, 150, 150, 149, 149, 148, 148,
147, 147, 146, 146, 145, 145, 144, 144,
143, 143, 143, 143, 142, 142, 142, 142,
141, 141, 141, 141, 140, 140, 140, 140,
139, 139, 139, 139, 138, 138, 138, 138,
137, 137, 137, 137, 136, 136, 136, 136,
135, 135, 135, 135, 134, 134, 134, 134,
133, 133, 133, 133, 132, 132, 132, 132,
131, 131, 131, 131, 130, 130, 130, 130,
129, 129, 129, 129, 128, 128, 128, 128,
};
static uint8_t u8_to_alaw_tbl[] = {
42, 42, 42, 42, 42, 43, 43, 43,
43, 40, 40, 40, 40, 41, 41, 41,
41, 46, 46, 46, 46, 47, 47, 47,
47, 44, 44, 44, 44, 45, 45, 45,
45, 34, 34, 34, 34, 35, 35, 35,
35, 32, 32, 32, 32, 33, 33, 33,
33, 38, 38, 38, 38, 39, 39, 39,
39, 36, 36, 36, 36, 37, 37, 37,
37, 58, 58, 59, 59, 56, 56, 57,
57, 62, 62, 63, 63, 60, 60, 61,
61, 50, 50, 51, 51, 48, 48, 49,
49, 54, 54, 55, 55, 52, 52, 53,
53, 10, 11, 8, 9, 14, 15, 12,
13, 2, 3, 0, 1, 6, 7, 4,
5, 24, 30, 28, 18, 16, 22, 20,
106, 110, 98, 102, 122, 114, 75, 90,
213, 197, 245, 253, 229, 225, 237, 233,
149, 151, 145, 147, 157, 159, 153, 155,
133, 132, 135, 134, 129, 128, 131, 130,
141, 140, 143, 142, 137, 136, 139, 138,
181, 181, 180, 180, 183, 183, 182, 182,
177, 177, 176, 176, 179, 179, 178, 178,
189, 189, 188, 188, 191, 191, 190, 190,
185, 185, 184, 184, 187, 187, 186, 186,
165, 165, 165, 165, 164, 164, 164, 164,
167, 167, 167, 167, 166, 166, 166, 166,
161, 161, 161, 161, 160, 160, 160, 160,
163, 163, 163, 163, 162, 162, 162, 162,
173, 173, 173, 173, 172, 172, 172, 172,
175, 175, 175, 175, 174, 174, 174, 174,
169, 169, 169, 169, 168, 168, 168, 168,
171, 171, 171, 171, 170, 170, 170, 170,
};
static int
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
feed_table_8(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint32_t count, void *source)
{
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
int j, sign, k;
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint8_t *tbl = (uint8_t *)f->data;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (count < PCM_8_BPS)
return (0);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
k = FEEDER_FEED(f->source, c, b, count, source);
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (k < PCM_8_BPS)
return (0);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
j = k;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
sign = (f->desc->out & AFMT_SIGNED) ? 0x80 : 0x00;
do {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
j--;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
b[j] = tbl[b[j]] ^ sign;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
} while (j != 0);
return (k);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
}
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static int
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
feed_table_16(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint32_t count, void *source)
{
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
int i, j, sign, k;
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint8_t *tbl = (uint8_t *)f->data;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (count < PCM_16_BPS)
return (0);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
k = FEEDER_FEED(f->source, c, b, count >> 1, source);
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (k < PCM_8_BPS)
return (0);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
i = k;
k <<= 1;
j = k;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
sign = (f->desc->out & AFMT_SIGNED) ? 0x80 : 0x00;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
if (f->desc->out & AFMT_BIGENDIAN) {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
do {
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
b[--j] = 0;
b[--j] = tbl[b[--i]] ^ sign;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
} while (i != 0);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
} else {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
do {
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
b[--j] = tbl[b[--i]] ^ sign;
b[--j] = 0;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
} while (i != 0);
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
return (k);
}
static int
feed_table_xlaw(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
uint32_t count, void *source)
{
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
int j, sign, k;
uint8_t *tbl = (uint8_t *)f->data;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (count < PCM_8_BPS)
return (0);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
k = FEEDER_FEED(f->source, c, b, count, source);
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (k < PCM_8_BPS)
return (0);
j = k ;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
sign = (f->desc->in & AFMT_SIGNED) ? 0x80 : 0x00;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
do {
j--;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
b[j] = tbl[b[j] ^ sign];
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
} while (j != 0);
return (k);
}
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_ulawto8_desc[] = {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_MU_LAW, AFMT_U8, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_MU_LAW, AFMT_S8, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_ulawto8_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_table_8),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_ulawto8, 0, ulaw_to_u8_tbl);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_alawto8_desc[] = {
{FEEDER_FMT, AFMT_A_LAW, AFMT_U8, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_A_LAW, AFMT_S8, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_alawto8_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_table_8),
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_alawto8, 0, alaw_to_u8_tbl);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_ulawto16_desc[] = {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_MU_LAW, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_MU_LAW, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_MU_LAW, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_MU_LAW, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_ulawto16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_table_16),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_ulawto16, 0, ulaw_to_u8_tbl);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_alawto16_desc[] = {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_A_LAW, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_A_LAW, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_A_LAW, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_A_LAW, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_alawto16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_table_16),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_alawto16, 0, alaw_to_u8_tbl);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_8toulaw_desc[] = {
{FEEDER_FMT, AFMT_U8, AFMT_MU_LAW, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_MU_LAW | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S8, AFMT_MU_LAW, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_MU_LAW | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_8toulaw_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_table_xlaw),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
FEEDER_DECLARE(feeder_8toulaw, 0, u8_to_ulaw_tbl);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_8toalaw_desc[] = {
{FEEDER_FMT, AFMT_U8, AFMT_A_LAW, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_A_LAW | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S8, AFMT_A_LAW, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_A_LAW | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_8toalaw_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_table_xlaw),
{0, 0}
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
FEEDER_DECLARE(feeder_8toalaw, 0, u8_to_alaw_tbl);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* All conversion done in byte level to preserve endianess.
*/
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
#define FEEDFMT_SWAP_SIGN(f) (((((f)->desc->in & AFMT_SIGNED) == 0) != \
(((f)->desc->out & AFMT_SIGNED) == 0)) \
? 0x80 : 0x00)
/*
* Bit conversion
*/
#define FBIT_DATA(i, o, c) ((intptr_t)((((c) & 0xf) << 6) | \
(((i) & 0x7) << 3) | ((o) & 0x7)))
#define FBIT_OUTBPS(m) ((m) & 0x7)
#define FBIT_INBPS(m) FBIT_OUTBPS((m) >> 3)
#define FBIT_CHANNELS(m) (((m) >> 6) & 0xf)
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_updownbit_init(struct pcm_feeder *f)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int ibps, obps, channels;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (f->desc->in == f->desc->out || (f->desc->in & AFMT_STEREO) !=
(f->desc->out & AFMT_STEREO))
return (-1);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
channels = (f->desc->in & AFMT_STEREO) ? 2 : 1;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
if (f->desc->in & AFMT_32BIT)
ibps = PCM_32_BPS;
else if (f->desc->in & AFMT_24BIT)
ibps = PCM_24_BPS;
else if (f->desc->in & AFMT_16BIT)
ibps = PCM_16_BPS;
else
ibps = PCM_8_BPS;
if (f->desc->out & AFMT_32BIT)
obps = PCM_32_BPS;
else if (f->desc->out & AFMT_24BIT)
obps = PCM_24_BPS;
else if (f->desc->out & AFMT_16BIT)
obps = PCM_16_BPS;
else
obps = PCM_8_BPS;
f->data = (void *)FBIT_DATA(ibps, obps, channels);
return (0);
}
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_upbit(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
uint32_t count, void *source)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int i, j, k, sign, ibps, ialign, obps, oalign, pad;
uint8_t *src, *dst;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
ibps = FBIT_INBPS((intptr_t)f->data);
obps = FBIT_OUTBPS((intptr_t)f->data);
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
ialign = ibps * FBIT_CHANNELS((intptr_t)f->data);
oalign = obps * FBIT_CHANNELS((intptr_t)f->data);
if (count < oalign)
return (0);
k = FEEDER_FEED(f->source, c, b, (count / oalign) * ialign, source);
if (k < ialign)
return (0);
k -= k % ialign;
j = (k / ibps) * obps;
pad = obps - ibps;
src = b + k;
dst = b + j;
sign = FEEDFMT_SWAP_SIGN(f);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
if (f->desc->out & AFMT_BIGENDIAN) {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
do {
i = pad;
do {
*--dst = 0;
} while (--i != 0);
i = ibps;
while (--i != 0)
*--dst = *--src;
*--dst = *--src ^ sign;
} while (dst != b);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
} else {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
do {
*--dst = *--src ^ sign;
i = ibps;
while (--i != 0)
*--dst = *--src;
i = pad;
do {
*--dst = 0;
} while (--i != 0);
} while (dst != b);
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
return (j);
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_8to16_desc[] = {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_U8, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S8, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U8, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S8, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U8, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S8, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U8, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S8, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_8to16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_upbit),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
FEEDER_DECLARE(feeder_8to16, 0, NULL);
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static struct pcm_feederdesc feeder_8to24_desc[] = {
{FEEDER_FMT, AFMT_U8, AFMT_U24_LE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_S24_LE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U8, AFMT_U24_BE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_S24_BE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U8, AFMT_S24_LE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_U24_LE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U8, AFMT_S24_BE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_U24_BE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static kobj_method_t feeder_8to24_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_upbit),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_8to24, 0, NULL);
static struct pcm_feederdesc feeder_8to32_desc[] = {
{FEEDER_FMT, AFMT_U8, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U8, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_S32_BE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U8, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U8, AFMT_S32_BE, 0},
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_8to32_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_upbit),
{0, 0}
};
FEEDER_DECLARE(feeder_8to32, 0, NULL);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_16to24_desc[] = {
{FEEDER_FMT, AFMT_U16_LE, AFMT_U24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_S24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U16_BE, AFMT_U24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S16_BE, AFMT_S24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U16_LE, AFMT_S24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S16_LE, AFMT_U24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U16_BE, AFMT_S24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S16_BE, AFMT_U24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_16to24_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_upbit),
{0, 0}
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
FEEDER_DECLARE(feeder_16to24, 0, NULL);
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static struct pcm_feederdesc feeder_16to32_desc[] = {
{FEEDER_FMT, AFMT_U16_LE, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_BE, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_BE, AFMT_S32_BE, 0},
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_LE, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_BE, AFMT_S32_BE, 0},
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_BE, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_16to32_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_upbit),
{0, 0}
};
FEEDER_DECLARE(feeder_16to32, 0, NULL);
static struct pcm_feederdesc feeder_24to32_desc[] = {
{FEEDER_FMT, AFMT_U24_LE, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_LE, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_BE, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_BE, AFMT_S32_BE, 0},
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_LE, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_LE, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_BE, AFMT_S32_BE, 0},
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_BE, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_24to32_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_upbit),
{0, 0}
};
FEEDER_DECLARE(feeder_24to32, 0, NULL);
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_downbit(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint32_t count, void *source)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int i, j, k, sign, be, ibps, ialign, obps, oalign,dump;
uint8_t *src, *dst, *end;
uint8_t reservoir[FEEDFMT_RESERVOIR];
ibps = FBIT_INBPS((intptr_t)f->data);
obps = FBIT_OUTBPS((intptr_t)f->data);
ialign = ibps * FBIT_CHANNELS((intptr_t)f->data);
oalign = obps * FBIT_CHANNELS((intptr_t)f->data);
if (count < oalign)
return (0);
dst = b;
dump = ibps - obps;
sign = FEEDFMT_SWAP_SIGN(f);
be = (f->desc->in & AFMT_BIGENDIAN) ? 1 : 0;
k = count - (count % oalign);
do {
if (k < oalign)
break;
if (k < ialign) {
src = reservoir;
j = ialign;
} else {
src = dst;
j = k;
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
j = FEEDER_FEED(f->source, c, src, j - (j % ialign), source);
if (j < ialign)
break;
j -= j % ialign;
j *= obps;
j /= ibps;
end = dst + j;
if (be != 0) {
do {
*dst++ = *src++ ^ sign;
i = obps;
while (--i != 0)
*dst++ = *src++;
src += dump;
} while (dst != end);
} else {
do {
src += dump;
i = obps;
while (--i != 0)
*dst++ = *src++;
*dst++ = *src++ ^ sign;
} while (dst != end);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
k -= j;
} while (k != 0);
return (dst - b);
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static struct pcm_feederdesc feeder_16to8_desc[] = {
{FEEDER_FMT, AFMT_U16_LE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_BE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_BE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_LE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_BE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_BE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_16to8_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_downbit),
{0, 0}
};
FEEDER_DECLARE(feeder_16to8, 0, NULL);
static struct pcm_feederdesc feeder_24to8_desc[] = {
{FEEDER_FMT, AFMT_U24_LE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_LE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_BE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_BE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_LE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_LE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_BE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_BE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_24to8_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_downbit),
{0, 0}
};
FEEDER_DECLARE(feeder_24to8, 0, NULL);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_24to16_desc[] = {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_U24_LE, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S24_LE, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U24_BE, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S24_BE, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U24_LE, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S24_LE, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U24_BE, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S24_BE, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_24to16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_downbit),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_24to16, 0, NULL);
static struct pcm_feederdesc feeder_32to8_desc[] = {
{FEEDER_FMT, AFMT_U32_LE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_LE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U32_BE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_BE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U32_LE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_LE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U32_BE, AFMT_S8, 0},
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_BE, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
static kobj_method_t feeder_32to8_methods[] = {
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_downbit),
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_32to8, 0, NULL);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_32to16_desc[] = {
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_U32_LE, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S32_LE, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_BE, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_BE, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_LE, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_LE, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_BE, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_BE, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{0, 0, 0, 0},
};
static kobj_method_t feeder_32to16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_downbit),
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_32to16, 0, NULL);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_32to24_desc[] = {
{FEEDER_FMT, AFMT_U32_LE, AFMT_U24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_LE, AFMT_S24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_BE, AFMT_U24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_BE, AFMT_S24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_LE, AFMT_S24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_LE, AFMT_U24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_BE, AFMT_S24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_BE, AFMT_U24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{0, 0, 0, 0},
};
static kobj_method_t feeder_32to24_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_updownbit_init),
KOBJMETHOD(feeder_feed, feed_downbit),
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_32to24, 0, NULL);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Bit conversion end
*/
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Channel conversion (mono -> stereo)
*/
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_monotostereo(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint32_t count, void *source)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int bps, i, j, k, l;
uint8_t v;
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
bps = (int)((intptr_t)f->data);
if (count < (bps << 1))
return (0);
j = FEEDER_FEED(f->source, c, b, (count - (count % bps)) >> 1, source);
if (j < bps)
return (0);
j -= j % bps;
i = j << 1;
l = i;
do {
k = bps;
do {
v = b[--j];
b[--i] = v;
b[i - bps] = v;
} while (--k != 0);
i -= bps;
} while (i != 0);
return (l);
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_monotostereo8_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_MU_LAW, AFMT_MU_LAW | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_A_LAW, AFMT_A_LAW | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static kobj_method_t feeder_monotostereo8_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_monotostereo),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_monotostereo8, 0, (void *)PCM_8_BPS);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_monotostereo16_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_LE, AFMT_U16_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_S16_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U16_BE, AFMT_U16_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_BE, AFMT_S16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
static kobj_method_t feeder_monotostereo16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_monotostereo),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_monotostereo16, 0, (void *)PCM_16_BPS);
static struct pcm_feederdesc feeder_monotostereo24_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_LE, AFMT_U24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_LE, AFMT_S24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U24_BE, AFMT_U24_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_BE, AFMT_S24_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_monotostereo24_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_monotostereo),
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_monotostereo24, 0, (void *)PCM_24_BPS);
static struct pcm_feederdesc feeder_monotostereo32_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_LE, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_U32_BE, AFMT_U32_BE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_BE, AFMT_S32_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_monotostereo32_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_monotostereo),
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_monotostereo32, 0, (void *)PCM_32_BPS);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Channel conversion (mono -> stereo) end
*/
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Channel conversion (stereo -> mono)
*/
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
#define FEEDER_FMT_STEREODOWNMIX(FMTBIT, FMT_INTCAST, SIGN, \
SIGNS, ENDIAN, ENDIANS) \
static void \
SIGNS##FMTBIT##ENDIANS##_stereodownmix(uint8_t *dst, uint8_t *sx, uint8_t *sy) \
{ \
int32_t v; \
\
v = ((FMT_INTCAST)PCM_READ_##SIGN##FMTBIT##_##ENDIAN(sx) + \
PCM_READ_##SIGN##FMTBIT##_##ENDIAN(sy)) >> 1; \
PCM_WRITE_##SIGN##FMTBIT##_##ENDIAN(dst, v); \
}
FEEDER_FMT_STEREODOWNMIX(8, int32_t, S, s, NE, ne);
FEEDER_FMT_STEREODOWNMIX(16, int32_t, S, s, LE, le);
FEEDER_FMT_STEREODOWNMIX(24, int32_t, S, s, LE, le);
FEEDER_FMT_STEREODOWNMIX(32, intpcm_t, S, s, LE, le);
FEEDER_FMT_STEREODOWNMIX(16, int32_t, S, s, BE, be);
FEEDER_FMT_STEREODOWNMIX(24, int32_t, S, s, BE, be);
FEEDER_FMT_STEREODOWNMIX(32, intpcm_t, S, s, BE, be);
FEEDER_FMT_STEREODOWNMIX(8, int32_t, U, u, NE, ne);
FEEDER_FMT_STEREODOWNMIX(16, int32_t, U, u, LE, le);
FEEDER_FMT_STEREODOWNMIX(24, int32_t, U, u, LE, le);
FEEDER_FMT_STEREODOWNMIX(32, intpcm_t, U, u, LE, le);
FEEDER_FMT_STEREODOWNMIX(16, int32_t, U, u, BE, be);
FEEDER_FMT_STEREODOWNMIX(24, int32_t, U, u, BE, be);
FEEDER_FMT_STEREODOWNMIX(32, intpcm_t, U, u, BE, be);
static void
ulaw_stereodownmix(uint8_t *dst, uint8_t *sx, uint8_t *sy)
{
uint8_t v;
v = ((uint32_t)ulaw_to_u8_tbl[*sx] + ulaw_to_u8_tbl[*sy]) >> 1;
*dst = u8_to_ulaw_tbl[v];
}
static void
alaw_stereodownmix(uint8_t *dst, uint8_t *sx, uint8_t *sy)
{
uint8_t v;
v = ((uint32_t)alaw_to_u8_tbl[*sx] + alaw_to_u8_tbl[*sy]) >> 1;
*dst = u8_to_alaw_tbl[v];
}
typedef void (*feed_fmt_stereodownmix_filter)(uint8_t *,
uint8_t *, uint8_t *);
struct feed_fmt_stereodownmix_info {
uint32_t format;
int bps;
feed_fmt_stereodownmix_filter func[2];
};
static struct feed_fmt_stereodownmix_info feed_fmt_stereodownmix_tbl[] = {
{ AFMT_S8, PCM_8_BPS, { NULL, s8ne_stereodownmix }},
{ AFMT_S16_LE, PCM_16_BPS, { NULL, s16le_stereodownmix }},
{ AFMT_S16_BE, PCM_16_BPS, { NULL, s16be_stereodownmix }},
{ AFMT_S24_LE, PCM_24_BPS, { NULL, s24le_stereodownmix }},
{ AFMT_S24_BE, PCM_24_BPS, { NULL, s24be_stereodownmix }},
{ AFMT_S32_LE, PCM_32_BPS, { NULL, s32le_stereodownmix }},
{ AFMT_S32_BE, PCM_32_BPS, { NULL, s32be_stereodownmix }},
{ AFMT_U8, PCM_8_BPS, { NULL, u8ne_stereodownmix }},
{ AFMT_A_LAW, PCM_8_BPS, { NULL, alaw_stereodownmix }},
{ AFMT_MU_LAW, PCM_8_BPS, { NULL, ulaw_stereodownmix }},
{ AFMT_U16_LE, PCM_16_BPS, { NULL, u16le_stereodownmix }},
{ AFMT_U16_BE, PCM_16_BPS, { NULL, u16be_stereodownmix }},
{ AFMT_U24_LE, PCM_24_BPS, { NULL, u24le_stereodownmix }},
{ AFMT_U24_BE, PCM_24_BPS, { NULL, u24be_stereodownmix }},
{ AFMT_U32_LE, PCM_32_BPS, { NULL, u32le_stereodownmix }},
{ AFMT_U32_BE, PCM_32_BPS, { NULL, u32be_stereodownmix }},
};
#define FSM_DATA(i, j) ((intptr_t)((((i) & 0x1f) << 1) | ((j) & 0x1)))
#define FSM_INFOIDX(m) (((m) >> 1) & 0x1f)
#define FSM_FUNCIDX(m) ((m) & 0x1)
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_stereotomono_init(struct pcm_feeder *f)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int i, funcidx;
if (!(f->desc->in & AFMT_STEREO) || (f->desc->out & AFMT_STEREO))
return (-1);
funcidx = (feeder_fmt_stereodownmix != 0) ? 1 : 0;
for (i = 0; i < sizeof(feed_fmt_stereodownmix_tbl) /
sizeof(feed_fmt_stereodownmix_tbl[0]); i++) {
if (f->desc->out == feed_fmt_stereodownmix_tbl[i].format) {
f->data = (void *)FSM_DATA(i, funcidx);
return (0);
}
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
return (-1);
}
static int
feed_stereotomono(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
uint32_t count, void *source)
{
struct feed_fmt_stereodownmix_info *info;
feed_fmt_stereodownmix_filter stereodownmix;
int i, j, k, ibps, obps;
uint8_t *src, *dst, *end;
uint8_t reservoir[FEEDFMT_RESERVOIR];
info = &feed_fmt_stereodownmix_tbl[FSM_INFOIDX((intptr_t)f->data)];
obps = info->bps;
if (count < obps)
return (0);
stereodownmix = info->func[FSM_FUNCIDX((intptr_t)f->data)];
ibps = obps << 1;
dst = b;
k = count - (count % obps);
do {
if (k < obps)
break;
if (k < ibps) {
src = reservoir;
j = ibps;
} else {
src = dst;
j = k;
}
j = FEEDER_FEED(f->source, c, src, j - (j % ibps), source);
if (j < ibps)
break;
j -= j % ibps;
j >>= 1;
end = dst + j;
if (stereodownmix != NULL) {
do {
stereodownmix(dst, src, src + obps);
dst += obps;
src += ibps;
} while (dst != end);
} else {
do {
i = obps;
do {
*dst++ = *src++;
} while (--i != 0);
src += obps;
} while (dst != end);
}
k -= j;
} while (k != 0);
return (dst - b);
}
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_stereotomono8_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_U8, 0},
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_S8, 0},
{FEEDER_FMT, AFMT_MU_LAW | AFMT_STEREO, AFMT_MU_LAW, 0},
{FEEDER_FMT, AFMT_A_LAW | AFMT_STEREO, AFMT_A_LAW, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static kobj_method_t feeder_stereotomono8_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_stereotomono_init),
KOBJMETHOD(feeder_feed, feed_stereotomono),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
FEEDER_DECLARE(feeder_stereotomono8, 0, NULL);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_stereotomono16_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_U16_LE, 0},
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_S16_LE, 0},
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_U16_BE, 0},
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_S16_BE, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static kobj_method_t feeder_stereotomono16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_stereotomono_init),
KOBJMETHOD(feeder_feed, feed_stereotomono),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
FEEDER_DECLARE(feeder_stereotomono16, 0, NULL);
static struct pcm_feederdesc feeder_stereotomono24_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_U24_LE, 0},
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_S24_LE, 0},
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_U24_BE, 0},
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_S24_BE, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_stereotomono24_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_stereotomono_init),
KOBJMETHOD(feeder_feed, feed_stereotomono),
{0, 0}
};
FEEDER_DECLARE(feeder_stereotomono24, 0, NULL);
static struct pcm_feederdesc feeder_stereotomono32_desc[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_U32_LE, 0},
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_S32_LE, 0},
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_U32_BE, 0},
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_S32_BE, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_stereotomono32_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_init, feed_stereotomono_init),
KOBJMETHOD(feeder_feed, feed_stereotomono),
{0, 0}
};
FEEDER_DECLARE(feeder_stereotomono32, 0, NULL);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Channel conversion (stereo -> mono) end
*/
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Sign conversion
*/
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_sign(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint32_t count, void *source)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int i, j, bps, ofs;
bps = (int)((intptr_t)f->data);
if (count < bps)
return (0);
i = FEEDER_FEED(f->source, c, b, count - (count % bps), source);
if (i < bps)
return (0);
i -= i % bps;
j = i;
ofs = (f->desc->in & AFMT_BIGENDIAN) ? bps : 1;
do {
b[i - ofs] ^= 0x80;
i -= bps;
} while (i != 0);
return (j);
}
static struct pcm_feederdesc feeder_sign8_desc[] = {
{FEEDER_FMT, AFMT_U8, AFMT_S8, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U8 | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S8, AFMT_U8, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S8 | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
static kobj_method_t feeder_sign8_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_sign),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_sign8, 0, (void *)PCM_8_BPS);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_sign16_desc[] = {
{FEEDER_FMT, AFMT_U16_LE, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S16_LE, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U16_BE, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S16_BE, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_sign16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_sign),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_sign16, 0, (void *)PCM_16_BPS);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_sign24_desc[] = {
{FEEDER_FMT, AFMT_U24_LE, AFMT_S24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S24_LE, AFMT_U24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U24_BE, AFMT_S24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S24_BE, AFMT_U24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_sign24_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_sign),
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_sign24, 0, (void *)PCM_24_BPS);
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static struct pcm_feederdesc feeder_sign32_desc[] = {
{FEEDER_FMT, AFMT_U32_LE, AFMT_S32_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_FMT, AFMT_S32_LE, AFMT_U32_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_U32_BE, AFMT_S32_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
{FEEDER_FMT, AFMT_S32_BE, AFMT_U32_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes in every sense. General ------- - Multichannel safe, endian safe, format safe * Large part of critical pcm filters such as vchan.c, feeder_rate.c, feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that using them does not cause the pcm data to be converted to 16bit little endian. * Macrosses for accessing pcm data safely are defined within sound.h in the form of PCM_READ_* / PCM_WRITE_* * Currently, most of them are probably limited for mono/stereo handling, but the future addition of true multichannel will be much easier. - Low latency operation * Well, this require lot more works to do not just within sound driver, but we're heading towards right direction. Buffer/block sizing within channel.c is rewritten to calculate precise allocation for various combination of sample/data/rate size. As a result, applying correct SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar to what commercial 4front driver do. * Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not result long delay. * Eliminate sound truncation if the sound data is too small. DIY: 1) Download / extract http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz 2) Do a comparison between "cat state*.au > /dev/dsp" and "for x in state*.au ; do cat $x > /dev/dsp ; done" - there should be no "perceivable" differences. Double close for PR kern/31445. CAVEAT: Low latency come with (unbearable) price especially for poorly written applications. Applications that trying to act smarter by requesting (wrong) blocksize/blockcount will suffer the most. Fixup samples/patches can be found at: http://people.freebsd.org/~ariff/ports/ - Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42) due to closer compatibility with 4front driver. Discussed with: marcus@ (long time ago?) - All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been moved to their own dev sysctl nodes, notably: hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans Bump __FreeBSD_version. Driver specific --------------- - Ditto for sysctls. - snd_atiixp, snd_es137x, snd_via8233, snd_hda * Numerous cleanups and fixes. * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme. This was intended for pure debugging and latency measurement, but proven good enough in few unexpected and rare cases (such as problematic shared IRQ with GIANT devices - USB). Polling can be enabled/disabled through dev.pcm.0.polling. Disabled by default. - snd_ich * Fix possible overflow during speed calibration. Delay final initialization (pcm_setstatus) after calibration finished. PR: kern/100169 Tested by: Kevin Overman <oberman@es.net> * Inverted EAPD for few Nec VersaPro. PR: kern/104715 Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp> Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman, those at #freebsd-azalia @ freenode and others for testing. Joel Dahl will do the manpage update.
2006-11-26 12:24:06 +00:00
static kobj_method_t feeder_sign32_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_sign),
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_sign32, 0, (void *)PCM_32_BPS);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
* Endian conversion
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
*/
static int
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
feed_endian(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
uint32_t count, void *source)
{
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
int i, j, k, bps;
uint8_t *buf, v;
bps = (int)((intptr_t)f->data);
if (count < bps)
return (0);
k = FEEDER_FEED(f->source, c, b, count - (count % bps), source);
if (k < bps)
return (0);
k -= k % bps;
j = bps >> 1;
buf = b + k;
do {
buf -= bps;
i = j;
do {
v = buf[--i];
buf[i] = buf[bps - i - 1];
buf[bps - i - 1] = v;
} while (i != 0);
} while (buf != b);
return (k);
}
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_endian16_desc[] = {
{FEEDER_FMT, AFMT_U16_LE, AFMT_U16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_LE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S16_LE, AFMT_S16_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_LE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_U16_BE, AFMT_U16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U16_BE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S16_BE, AFMT_S16_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S16_BE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static kobj_method_t feeder_endian16_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_endian),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_endian16, 0, (void *)PCM_16_BPS);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_endian24_desc[] = {
{FEEDER_FMT, AFMT_U24_LE, AFMT_U24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_LE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S24_LE, AFMT_S24_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_LE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_U24_BE, AFMT_U24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U24_BE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S24_BE, AFMT_S24_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S24_BE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static kobj_method_t feeder_endian24_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_endian),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_endian24, 0, (void *)PCM_24_BPS);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static struct pcm_feederdesc feeder_endian32_desc[] = {
{FEEDER_FMT, AFMT_U32_LE, AFMT_U32_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_LE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S32_LE, AFMT_S32_BE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_LE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_U32_BE, AFMT_U32_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_U32_BE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{FEEDER_FMT, AFMT_S32_BE, AFMT_S32_LE, 0},
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
{FEEDER_FMT, AFMT_S32_BE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0, 0, 0},
};
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
static kobj_method_t feeder_endian32_methods[] = {
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
KOBJMETHOD(feeder_feed, feed_endian),
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
{0, 0}
};
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
FEEDER_DECLARE(feeder_endian32, 0, (void *)PCM_32_BPS);
Whats New: 1. Support wide range sampling rate, as low as 1hz up to int32 max (which is, insane) through new feeder_rate, multiple precisions choice (32/64 bit converter). This is indeed, quite insane, but it does give us more room and flexibility. Plenty sysctl options to adjust resampling characteristics. 2. Support 24/32 bit pcm format conversion through new, much improved, simplified and optimized feeder_fmt. Changes: 1. buffer.c / dsp.c / sound.h * Support for 24/32 AFMT. 2. feeder_rate.c * New implementation of sampling rate conversion with 32/64 bit precision, 1 - int32max hz (which is, ridiculous, yet very addictive). Much improved / smarter buffer management to not cause any missing samples at the end of conversion process * Tunable sysctls for various aspect: hw.snd.feeder_rate_ratemin - minimum allowable sampling rate (default to 4000) hw.snd.feeder_rate_ratemax - maximum allowable sampling rate (default to 1102500) hw.snd.feeder_rate_buffersize - conversion buffer size (default to 8192) hw.snd.feeder_rate_scaling - scaling / conversion method (please refer to the source for explaination). Default to previous implementation type. 3. feeder_fmt.c / sound.h * New implementation, support for 24/32bit conversion, optimized, and simplified. Few routines has been removed (8 to xlaw, 16 to 8). It just doesn't make sense. 4. channel.c * Support for 24/32 AFMT * Fix wrong xruns increment, causing incorrect underruns statistic while using vchans. 5. vchan.c * Support for 24/32 AFMT * Proper speed / rate detection especially for fixed rate ac97. User can override it using kernel hint: hint.pcm.<unit>.vchanrate="xxxx". Notes / Issues: * Virtual Channels (vchans) Enabling vchans can really, really help to solve overrun issues. This is quite understandable, because it operates entirely within its own buffering system without relying on hardware interrupt / state. Even if you don't need vchan, just enable single channel can help much. Few soundcards (notably via8233x, sblive, possibly others) have their own hardware multi channel, and this is unfortunately beyond vchan reachability. * The arrival of 24/32 also come with a price. Applications that can do 24/32bit playback need to be recompiled (notably mplayer). Use (recompiled) mplayer to experiment / test / debug this various format using -af format=fmt. Note that 24bit seeking in mplayer is a little bit broken, sometimes can cause silence or loud static noise. Pausing / seeking few times can solve this problem. You don't have to rebuild world entirely for this. Simply copy /usr/src/sys/sys/soundcard.h to /usr/include/sys/soundcard.h would suffice. Few drivers also need recompilation, and this can be done via /usr/src/sys/modules/sound/. Support for 24bit hardware playback is beyond the scope of this changes. That would require spessific hardware driver changes. * Don't expect playing 9999999999hz is a wise decision. Be reasonable. The new feeder_rate implemention provide flexibility, not insanity. You can easily chew up your CPU with this kind of mind instability. Please use proper mosquito repellent device for this obvious cracked brain attempt. As for testing purposes, you can use (again) mplayer to generate / play with different sampling rate. Use something like "mplayer -af resample=192000:0:0 <files>". Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
2005-07-31 16:16:22 +00:00
/*
* Endian conversion end
*/
[stage: 5/9] channel.c/channel_if.m: - Macros cleanups, prefer inlined min() over MIN(). - Rework chn_read()/chn_write() for better dead interrupt detection policy. Reduce scheduling overhead by doing pure 5 seconds sleep before giving up, instead of several cycle of brute micro sleeping. - Avoid calling wakeup_one() for non-sleeping channel (for example, vchan parent channel). - EWOULDBLOCK -> EAGAIN. - Fix possible divide-by-zero panic on chn_sync(). - Re-enforce ^2 blocksize policy, since there are too many broken userland apps that blindly assume it without even trying to do serious calculations. - New channel method - CHANNEL_SETFRAGMENTS(), a refined version of CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount arguments, so the driver internals will have better hints for buffering and timing calculations. - Hook FEEDER_SWAPLR into feederchain building process. feeder_fmt.c: - Unified version of various filters, avoiding duplications. - malloc()less feeder_fmt. Informations can be retrieved dynamically by doing table lookup on static data. For cases such as converting from stereo to mono or reducing bit depth where input data is larger than output, cycle remaining available free space until it has been exhausted and start kicking 8 bytes reservoir space from there to complete the remaining requested count. - Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several extremely cheap uaudio stick, possibly others) mistakenly wired left and right channels wrongly, screwing output or input.
2007-03-16 17:16:24 +00:00
/*
* L/R swap conversion
*/
static int
feed_swaplr(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
uint32_t count, void *source)
{
int i, j, bps, smpsz;
uint8_t *buf, v;
bps = (int)((intptr_t)f->data);
smpsz = bps << 1;
if (count < smpsz)
return (0);
j = FEEDER_FEED(f->source, c, b, count - (count % smpsz), source);
if (j < smpsz)
return (0);
j -= j % smpsz;
buf = b + j;
do {
buf -= smpsz;
i = bps;
do {
v = buf[--i];
buf[i] = buf[bps + i];
buf[bps + i] = v;
} while (i != 0);
} while (buf != b);
return (j);
}
static struct pcm_feederdesc feeder_swaplr8_desc[] = {
{FEEDER_SWAPLR, AFMT_S8 | AFMT_STEREO, AFMT_S8 | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U8 | AFMT_STEREO, AFMT_U8 | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_A_LAW | AFMT_STEREO, AFMT_A_LAW | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_MU_LAW | AFMT_STEREO, AFMT_A_LAW | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_swaplr8_methods[] = {
KOBJMETHOD(feeder_feed, feed_swaplr),
{0, 0}
};
FEEDER_DECLARE(feeder_swaplr8, -1, (void *)PCM_8_BPS);
static struct pcm_feederdesc feeder_swaplr16_desc[] = {
{FEEDER_SWAPLR, AFMT_S16_LE | AFMT_STEREO, AFMT_S16_LE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_S16_BE | AFMT_STEREO, AFMT_S16_BE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U16_LE | AFMT_STEREO, AFMT_U16_LE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U16_BE | AFMT_STEREO, AFMT_U16_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_swaplr16_methods[] = {
KOBJMETHOD(feeder_feed, feed_swaplr),
{0, 0}
};
FEEDER_DECLARE(feeder_swaplr16, -1, (void *)PCM_16_BPS);
static struct pcm_feederdesc feeder_swaplr24_desc[] = {
{FEEDER_SWAPLR, AFMT_S24_LE | AFMT_STEREO, AFMT_S24_LE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_S24_BE | AFMT_STEREO, AFMT_S24_BE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U24_LE | AFMT_STEREO, AFMT_U24_LE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U24_BE | AFMT_STEREO, AFMT_U24_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_swaplr24_methods[] = {
KOBJMETHOD(feeder_feed, feed_swaplr),
{0, 0}
};
FEEDER_DECLARE(feeder_swaplr24, -1, (void *)PCM_24_BPS);
static struct pcm_feederdesc feeder_swaplr32_desc[] = {
{FEEDER_SWAPLR, AFMT_S32_LE | AFMT_STEREO, AFMT_S32_LE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_S32_BE | AFMT_STEREO, AFMT_S32_BE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U32_LE | AFMT_STEREO, AFMT_U32_LE | AFMT_STEREO, 0},
{FEEDER_SWAPLR, AFMT_U32_BE | AFMT_STEREO, AFMT_U32_BE | AFMT_STEREO, 0},
{0, 0, 0, 0},
};
static kobj_method_t feeder_swaplr32_methods[] = {
KOBJMETHOD(feeder_feed, feed_swaplr),
{0, 0}
};
FEEDER_DECLARE(feeder_swaplr32, -1, (void *)PCM_32_BPS);
/*
* L/R swap conversion end
*/