Tyrian 2000 in DOS with sound on PCIe only machines? (Announce)
> I understand that for adding 2 signals together the sample value need to be
> halved before to avoid overflow/clipping the result
It's not "halved", it's using kind of a "geometric mean", looks rather complicated ( because the sample values are "signed"):
for( i = 0; i < samples * 2; i++ ) {
int a = (*(pPCM+i) * (int)voicevol / 256) + 32768; /* convert to 0-65535 */
int b = (*(pOPLPCM+i) * (int)midivol / 256 ) + 32768; /* convert to 0-65535 */
int mixed = (a < 32768 || b < 32768) ? ((a*b)/32768) : ((a+b)*2 - (a*b)/32768 - 65536);
*(pPCM+i) = (mixed > 65535 ) ? 0x7fff : mixed - 32768;
}
IIRC crazii found this somewhere on "stackoverflow". I will happily adjust vsbhda if you know something better.
---
MS-DOS forever!
Complete thread:
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 20.03.2024, 11:46 (Announce)
- Tyrian 2000 in DOS with sound on PCIe only machines? - Rugxulo, 21.03.2024, 05:52
- Tyrian 2000 in DOS with sound on PCIe only machines? - Laaca, 21.03.2024, 18:36
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 21.03.2024, 21:42
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 23.03.2024, 02:58
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 23.03.2024, 10:54
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 24.03.2024, 02:18
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 24.03.2024, 05:06
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 25.03.2024, 22:42
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 24.03.2024, 05:06
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 24.03.2024, 02:18
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 23.03.2024, 10:54
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 26.03.2024, 06:16
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 26.03.2024, 08:34
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 26.03.2024, 13:48
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 27.03.2024, 02:17
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 27.03.2024, 06:33
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 27.03.2024, 14:06
- Tyrian 2000 in DOS with sound on PCIe only machines? - Laaca, 27.03.2024, 17:35
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 28.03.2024, 04:39
- Tyrian 2000 in DOS with sound on PCIe only machines? - Laaca, 27.03.2024, 17:35
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 27.03.2024, 14:06
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 27.03.2024, 06:33
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 27.03.2024, 02:17
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 26.03.2024, 13:48
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 27.03.2024, 14:27
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 27.03.2024, 16:02
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 27.03.2024, 17:39
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 28.03.2024, 02:49
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 28.03.2024, 06:34
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 28.03.2024, 04:43
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 28.03.2024, 06:10
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 29.03.2024, 20:20
- VSBHDA 1.5 pre - RayeR, 15.05.2024, 07:06
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 29.03.2024, 20:20
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 28.03.2024, 06:10
- Tyrian 2000 in DOS with sound on PCIe only machines? - Zyzzle, 28.03.2024, 02:49
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 27.03.2024, 17:39
- Tyrian 2000 in DOS with sound on PCIe only machines? - RayeR, 27.03.2024, 16:02
- Tyrian 2000 in DOS with sound on PCIe only machines? - Japheth, 26.03.2024, 08:34
- VSBHDA v1.4 (final) has been released - Japheth, 20.04.2024, 10:41
- VSBHDA v1.4 (final) has been released - rr, 20.04.2024, 20:07
- VSBHDA v1.4 (final) has been released - Zyzzle, 21.04.2024, 01:56
- VSBHDA v1.4 (final) has been released - Japheth, 21.04.2024, 10:39
- VSBHDA v1.4 (final) has been released - Zyzzle, 22.04.2024, 13:31
- VSBHDA v1.4 (final) has been released - Japheth, 21.04.2024, 10:39
- VSBHDA v1.4 (final) has been released - Zyzzle, 21.04.2024, 01:56
- VSBHDA v1.4 (final) has been released - rr, 22.04.2024, 20:07
- VSBHDA v1.4 (final) has been released - 0ffer, 28.04.2024, 08:57
- VSBHDA v1.4 (final) has been released - Rugxulo, 28.04.2024, 11:16
- VSBHDA v1.4 (final) has been released - 0ffer, 28.04.2024, 12:35
- Windows for Workgroups 3.11, FreeDOS, MS DOS 8, HIMEM etc. - mceric, 28.04.2024, 16:41
- Windows for Workgroups 3.11, FreeDOS, MS DOS 8, HIMEM etc. - 0ffer, 29.04.2024, 00:57
- Windows for Workgroups 3.11, FreeDOS, MS DOS 8, HIMEM etc. - mceric, 28.04.2024, 16:41
- VSBHDA v1.4 (final) has been released - 0ffer, 28.04.2024, 12:35
- VSBHDA v1.4 (final) has been released - roytam, 28.04.2024, 11:43
- VSBHDA v1.4 (final) has been released - 0ffer, 28.04.2024, 12:37
- VSBHDA v1.4 (final) has been released - Rugxulo, 28.04.2024, 11:16
- VSBHDA v1.4 (final) has been released - rr, 20.04.2024, 20:07
- Tyrian 2000 in DOS with sound on PCIe only machines? - Rugxulo, 21.03.2024, 05:52