play static, with volume controlled by the music volume slider

This commit is contained in:
Eric Wasylishen 2011-01-01 23:58:26 -07:00
parent 195baa74bc
commit 9998e06750
4 changed files with 116 additions and 25 deletions

1
Quake/cd_ogg.c Normal file
View File

@ -0,0 +1 @@

View File

@ -167,7 +167,7 @@ void S_PaintChannels (int endtime)
// clear the paint buffer
memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t));
// paint in the channels.
// paint in the sfx channels.
ch = snd_channels;
for (i = 0; i < total_channels; i++, ch++)
{
@ -215,6 +215,30 @@ void S_PaintChannels (int endtime)
}
}
// paint the OGG music
{
ltime = paintedtime;
int volume = 255 * bgmvolume.value;
count = end - ltime;
int i;
int *lscale, *rscale;
lscale = snd_scaletable[volume >> 3];
rscale = snd_scaletable[volume >> 3];
for (i = 0; i < count; i++)
{
unsigned char data = rand() % 256;
paintbuffer[i].left += lscale[data];
paintbuffer[i].right += rscale[data];
}
}
// transfer out according to DMA format
S_TransferPaintBuffer(end);
paintedtime = end;

View File

@ -50,9 +50,15 @@
<Unit filename="..\..\Quake\anorms.h" />
<Unit filename="..\..\Quake\arch_def.h" />
<Unit filename="..\..\Quake\bspfile.h" />
<Unit filename="..\..\Quake\cd_ogg.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\Quake\cd_sdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\Quake\cd_shared.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\Quake\cdaudio.h" />
<Unit filename="..\..\Quake\chase.c">
<Option compilerVar="CC" />
@ -184,10 +190,10 @@
<Unit filename="..\..\Quake\net_main.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\Quake\net_sys.h" />
<Unit filename="..\..\Quake\net_win.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\Quake\net_sys.h" />
<Unit filename="..\..\Quake\net_wins.c">
<Option compilerVar="CC" />
</Unit>

View File

@ -1,11 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Release" />
<File name="..\..\Quake\bspfile.h" open="0" top="0" tabpos="0">
<Cursor position="4528" topLine="170" />
</File>
<File name="..\..\Quake\cd_ogg.c" open="1" top="0" tabpos="31">
<Cursor position="0" topLine="0" />
</File>
<File name="..\..\Quake\cd_sdl.c" open="1" top="0" tabpos="2">
<Cursor position="3339" topLine="118" />
</File>
<File name="..\..\Quake\cd_shared.c" open="1" top="0" tabpos="21">
<Cursor position="18" topLine="0" />
</File>
<File name="..\..\Quake\cdaudio.h" open="1" top="1" tabpos="27">
<Cursor position="842" topLine="0" />
</File>
<File name="..\..\Quake\cl_demo.c" open="0" top="0" tabpos="2">
<Cursor position="4395" topLine="177" />
</File>
<File name="..\..\Quake\cl_main.c" open="0" top="0" tabpos="6">
<Cursor position="800" topLine="7" />
<File name="..\..\Quake\cl_main.c" open="1" top="0" tabpos="8">
<Cursor position="18388" topLine="745" />
</File>
<File name="..\..\Quake\cl_parse.c" open="1" top="0" tabpos="22">
<Cursor position="28792" topLine="1138" />
</File>
<File name="..\..\Quake\client.h" open="1" top="0" tabpos="25">
<Cursor position="6290" topLine="208" />
</File>
<File name="..\..\Quake\cmd.c" open="1" top="0" tabpos="20">
<Cursor position="9700" topLine="149" />
</File>
<File name="..\..\Quake\cmd.h" open="1" top="0" tabpos="18">
<Cursor position="1371" topLine="35" />
</File>
<File name="..\..\Quake\common.c" open="0" top="0" tabpos="8">
<Cursor position="34577" topLine="1726" />
@ -19,8 +46,11 @@
<File name="..\..\Quake\gl_draw.c" open="0" top="0" tabpos="1">
<Cursor position="10937" topLine="406" />
</File>
<File name="..\..\Quake\gl_sky.c" open="0" top="0" tabpos="11">
<Cursor position="14811" topLine="679" />
<File name="..\..\Quake\gl_fog.c" open="1" top="0" tabpos="23">
<Cursor position="4128" topLine="149" />
</File>
<File name="..\..\Quake\gl_sky.c" open="1" top="0" tabpos="24">
<Cursor position="5567" topLine="215" />
</File>
<File name="..\..\Quake\gl_texmgr.h" open="0" top="0" tabpos="0">
<Cursor position="1553" topLine="22" />
@ -31,11 +61,11 @@
<File name="..\..\Quake\glquake.h" open="0" top="0" tabpos="13">
<Cursor position="5067" topLine="164" />
</File>
<File name="..\..\Quake\host.c" open="0" top="0" tabpos="1">
<Cursor position="17767" topLine="770" />
<File name="..\..\Quake\host.c" open="1" top="0" tabpos="11">
<Cursor position="21415" topLine="0" />
</File>
<File name="..\..\Quake\host_cmd.c" open="1" top="0" tabpos="1">
<Cursor position="403" topLine="0" />
<File name="..\..\Quake\host_cmd.c" open="1" top="0" tabpos="12">
<Cursor position="1148" topLine="29" />
</File>
<File name="..\..\Quake\image.h" open="0" top="0" tabpos="0">
<Cursor position="912" topLine="0" />
@ -43,19 +73,19 @@
<File name="..\..\Quake\in_sdl.c" open="0" top="0" tabpos="4">
<Cursor position="1102" topLine="19" />
</File>
<File name="..\..\Quake\main_sdl.c" open="0" top="0" tabpos="4">
<Cursor position="2851" topLine="93" />
<File name="..\..\Quake\main_sdl.c" open="1" top="0" tabpos="10">
<Cursor position="264" topLine="47" />
</File>
<File name="..\..\Quake\mathlib.h" open="0" top="0" tabpos="3">
<Cursor position="2074" topLine="46" />
</File>
<File name="..\..\Quake\menu.c" open="0" top="0" tabpos="5">
<Cursor position="27465" topLine="1268" />
<File name="..\..\Quake\menu.c" open="1" top="0" tabpos="28">
<Cursor position="22576" topLine="0" />
</File>
<File name="..\..\Quake\net_dgrm.c" open="0" top="0" tabpos="3">
<Cursor position="905" topLine="21" />
<File name="..\..\Quake\net_dgrm.c" open="1" top="0" tabpos="30">
<Cursor position="1527" topLine="45" />
</File>
<File name="..\..\Quake\net_wins.c" open="1" top="1" tabpos="2">
<File name="..\..\Quake\net_wins.c" open="1" top="0" tabpos="1">
<Cursor position="766" topLine="0" />
</File>
<File name="..\..\Quake\pl_win.c" open="0" top="0" tabpos="2">
@ -67,8 +97,14 @@
<File name="..\..\Quake\pr_exec.c" open="0" top="0" tabpos="7">
<Cursor position="4522" topLine="270" />
</File>
<File name="..\..\Quake\quakedef.h" open="0" top="0" tabpos="7">
<Cursor position="5875" topLine="205" />
<File name="..\..\Quake\progdefs.h" open="1" top="0" tabpos="17">
<Cursor position="45" topLine="0" />
</File>
<File name="..\..\Quake\progs.h" open="1" top="0" tabpos="16">
<Cursor position="1018" topLine="15" />
</File>
<File name="..\..\Quake\quakedef.h" open="1" top="0" tabpos="4">
<Cursor position="2907" topLine="75" />
</File>
<File name="..\..\Quake\r_brush.c" open="0" top="0" tabpos="10">
<Cursor position="15512" topLine="592" />
@ -79,16 +115,40 @@
<File name="..\..\Quake\render.h" open="0" top="0" tabpos="0">
<Cursor position="3780" topLine="106" />
</File>
<File name="..\..\Quake\snd_dma.c" open="0" top="0" tabpos="0">
<Cursor position="18183" topLine="831" />
<File name="..\..\Quake\server.h" open="1" top="0" tabpos="15">
<Cursor position="6556" topLine="169" />
</File>
<File name="..\..\Quake\snd_mix.c" open="0" top="0" tabpos="0">
<Cursor position="3595" topLine="145" />
<File name="..\..\Quake\snd_dma.c" open="1" top="0" tabpos="3">
<Cursor position="9192" topLine="486" />
</File>
<File name="..\..\Quake\sys_sdl_win.c" open="0" top="0" tabpos="6">
<Cursor position="3415" topLine="137" />
<File name="..\..\Quake\snd_mem.c" open="1" top="0" tabpos="29">
<Cursor position="2707" topLine="76" />
</File>
<File name="..\..\Quake\snd_mix.c" open="1" top="0" tabpos="7">
<Cursor position="2140" topLine="42" />
</File>
<File name="..\..\Quake\snd_sdl.c" open="1" top="0" tabpos="6">
<Cursor position="1106" topLine="0" />
</File>
<File name="..\..\Quake\sound.h" open="1" top="0" tabpos="5">
<Cursor position="1336" topLine="42" />
</File>
<File name="..\..\Quake\sv_main.c" open="1" top="0" tabpos="26">
<Cursor position="8296" topLine="269" />
</File>
<File name="..\..\Quake\sv_phys.c" open="1" top="0" tabpos="13">
<Cursor position="0" topLine="0" />
</File>
<File name="..\..\Quake\sys.h" open="1" top="0" tabpos="19">
<Cursor position="1796" topLine="5" />
</File>
<File name="..\..\Quake\sys_sdl_win.c" open="1" top="0" tabpos="14">
<Cursor position="4358" topLine="287" />
</File>
<File name="..\..\Quake\wad.c" open="0" top="0" tabpos="5">
<Cursor position="1942" topLine="55" />
</File>
<File name="..\..\Quake\zone.c" open="1" top="0" tabpos="9">
<Cursor position="1142" topLine="934" />
</File>
</CodeBlocks_layout_file>