emu10k1: add 96Khz support and setting sample rate for direct SPDIF output
PATCH 1/1 emu10k1: add 96Khz support and setting sample rate for direct SPDIF output
This patch should add support for 96Khz "direct SPDIF" aka "SPDIF Bypass" (not P16V) playback mode available on the Audigy1 and 2 and newer SBLives (?). It lets you bypass the 48khz DSP resampling when using the card in digital mode. It also adds 96khz analog playback support, good for testing but less interesting because it's downsampled to 48khz. A new mixer control "Audigy SPDIF Output Sample Rate" is created, you can choose 44100, 48000, or 96000. Standard SPDIF playback, AC3 passthrough (real 96khz playback), and analog playback (96khz is resampled to 48khz in the DSP) all work with a 16 bit,96khz wav file. Only the last was tested due to lack of any SPDIF hardware.
This was derived mostly from the opensource.creative.com driver. All that was needed for 96khz playback to work in analog mode was changing the format to 8000_96000 (looks like the creative driver supports 192khz too). And, of course this sample rate has always been supported (albeit downsampled) because if you have 48khz samples in a soundfont the envelope engine has to be able to pitch shift them in both directions.
I still have not been able to figure out how to get 24 bit playback to work. This is possible, independent of the P16V, for spdif and analog 24/48 playback via the DSP. I do know how to access the full 24 bits from the ADC from within the DSP, just not how to get it in there. For one thing I have no idea which 24 bit format it supports. Some of them seemed to work with JACK but produced noise.
This was generated with my multichannel patch but it applies against ALSA CVS as well.
alsa-kernel/include/emu10k1.h +4 -3
@@ -789,9 +789,10 @@#define A_FXWC2 0x75/* Selects 0x9f-0x80 for FX recording */ #define A_SPDIF_SAMPLERATE 0x76/* Set the sample rate of SPDIF output */ -#define A_SPDIF_48000 0x00000080 -#define A_SPDIF_44100 0x00000000 -#define A_SPDIF_96000 0x00000040 +#define A_SPDIF_RATE_MASK 0x000000c0 +#define A_SPDIF_48000 0x00000000 +#define A_SPDIF_44100 0x00000040 +#define A_SPDIF_96000 0x00000080/* 0x77,0x78,0x79 "something i2s-related" - default to 0x01080000 on my audigy 2 ZS --rlrevell */ /* 0x7a, 0x7b - lookup tables */
alsa-kernel/pci/emu10k1/emumixer.c +90 -0
102 lines not on this page · raw message
alsa-kernel/pci/emu10k1/emupcm.c +2 -2
@@ -946,9 +947,9 @@SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE), .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_96000, .rate_min = 4000, - .rate_max = 48000, + .rate_max = 96000, .channels_min = 1, .channels_max = 2, .buffer_bytes_max = (128*1024),
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl
At Sun, 06 Feb 2005 16:12:43 -0500,
Quoted 11 lines · Lee Revell
This patch should add support for 96Khz "direct SPDIF" aka "SPDIF Bypass" (not P16V) playback mode available on the Audigy1 and 2 and newer SBLives (?). It lets you bypass the 48khz DSP resampling when using the card in digital mode. It also adds 96khz analog playback support, good for testing but less interesting because it's downsampled to 48khz. A new mixer control "Audigy SPDIF Output Sample Rate" is created, you can choose 44100, 48000, or 96000. Standard SPDIF playback, AC3 passthrough (real 96khz playback), and analog playback (96khz is resampled to 48khz in the DSP) all work with a 16 bit,96khz wav file. Only the last was tested due to lack of any SPDIF hardware.
What happens if you play in a non-matching sample rate or a strange rate like 45000Hz?
Quoted 4 lines
This was derived mostly from the opensource.creative.com driver. All that was needed for 96khz playback to work in analog mode was changing the format to 8000_96000 (looks like the creative driver supports 192khz too).
192kHz results in pitch_target=0x10000, so needs a correction to0xffff? Just a guess. I'll need to take a look at creative driver.
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 14 lines · Takashi Iwai
At Sun, 06 Feb 2005 16:12:43 -0500,
Quoted 11 lines · Lee Revell
This patch should add support for 96Khz "direct SPDIF" aka "SPDIF Bypass" (not P16V) playback mode available on the Audigy1 and 2 and newer SBLives (?). It lets you bypass the 48khz DSP resampling when using the card in digital mode. It also adds 96khz analog playback support, good for testing but less interesting because it's downsampled to 48khz. A new mixer control "Audigy SPDIF Output Sample Rate" is created, you can choose 44100, 48000, or 96000. Standard SPDIF playback, AC3 passthrough (real 96khz playback), and analog playback (96khz is resampled to 48khz in the DSP) all work with a 16 bit,96khz wav file. Only the last was tested due to lack of any SPDIF hardware.
Quoted 3 lines
What happens if you play in a non-matching sample rate or a strange rate like 45000Hz?
Works fine in analog mode. I just made a 51000Hz wave file and it played fine, sounds exactly like the 48KHz original. For SPDIF bypass mode it would presumably get resampled to 44.1, 48, or 92Khz depending on the control setting.
Quoted 8 lines
Quoted 4 lines
This was derived mostly from the opensource.creative.com driver. All that was needed for 96khz playback to work in analog mode was changing the format to 8000_96000 (looks like the creative driver supports 192khz too).
192kHz results in pitch_target=0x10000, so needs a correction to
0xffff? Just a guess. I'll need to take a look at creative driver.
Right, it supports anything < 192000 (from cardwo.c):
int sblive_waveoutQueryFormat(struct sblive_waveout *card_waveout, struct wave_format * wave_fmt, u32 flags)
{
if (flags & CARDWAVE_QF_CHANNEL)
if ((card_waveout->numplaybackinst) > card_waveout->maxnumplayinst)
return CTSTATUS_INUSE;
if (flags & CARDWAVE_QF_RATE)
if (wave_fmt->samplingrate >= 0x2EE00) /* FIXME: 0x2ee00 = 192000! Is this valid??? */
return CTSTATUS_BADFORMAT_RATE;
if (flags & CARDWAVE_QF_BITS)
if (wave_fmt->bitspersample != 8 && wave_fmt->bitspersample != 16)
return CTSTATUS_BADFORMAT_BITS;
return CTSTATUS_SUCCESS;
}Lee
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
At Tue, 08 Feb 2005 16:31:52 -0500,
Quoted 16 lines · Lee Revell
Quoted 14 lines · Takashi Iwai
At Sun, 06 Feb 2005 16:12:43 -0500,
Quoted 11 lines · Lee Revell
This patch should add support for 96Khz "direct SPDIF" aka "SPDIF Bypass" (not P16V) playback mode available on the Audigy1 and 2 and newer SBLives (?). It lets you bypass the 48khz DSP resampling when using the card in digital mode. It also adds 96khz analog playback support, good for testing but less interesting because it's downsampled to 48khz. A new mixer control "Audigy SPDIF Output Sample Rate" is created, you can choose 44100, 48000, or 96000. Standard SPDIF playback, AC3 passthrough (real 96khz playback), and analog playback (96khz is resampled to 48khz in the DSP) all work with a 16 bit,96khz wav file. Only the last was tested due to lack of any SPDIF hardware.
Quoted 8 lines
Quoted 3 lines
What happens if you play in a non-matching sample rate or a strange rate like 45000Hz?
Works fine in analog mode. I just made a 51000Hz wave file and it played fine, sounds exactly like the 48KHz original. For SPDIF bypass mode it would presumably get resampled to 44.1, 48, or 92Khz depending on the control setting.
OK, now I applied the patch to CVS.
thanks,
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 13 lines · Takashi Iwai
At Sun, 06 Feb 2005 16:12:43 -0500,
Quoted 11 lines · Lee Revell
This patch should add support for 96Khz "direct SPDIF" aka "SPDIF Bypass" (not P16V) playback mode available on the Audigy1 and 2 and newer SBLives (?). It lets you bypass the 48khz DSP resampling when using the card in digital mode. It also adds 96khz analog playback support, good for testing but less interesting because it's downsampled to 48khz. A new mixer control "Audigy SPDIF Output Sample Rate" is created, you can choose 44100, 48000, or 96000. Standard SPDIF playback, AC3 passthrough (real 96khz playback), and analog playback (96khz is resampled to 48khz in the DSP) all work with a 16 bit,96khz wav file. Only the last was tested due to lack of any SPDIF hardware.
I am just wondering, has anyone tried this yet by connecting the SPDIF output to something? I am curious to see if it works.
Lee
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click