Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 306071 Details for
Bug 158415
games-fps/quake2-icculus-0.16.1-r1 Error: Hunk_End: Could not remap virtual block (2)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
quake2-icculus-0.16.1-alsa.patch
quake2-icculus-0.16.1-alsa.patch (text/plain), 4.54 KB, created by
Grzegorz {NineX} Krzystek
on 2012-03-21 06:49:20 UTC
(
hide
)
Description:
quake2-icculus-0.16.1-alsa.patch
Filename:
MIME Type:
Creator:
Grzegorz {NineX} Krzystek
Created:
2012-03-21 06:49:20 UTC
Size:
4.54 KB
patch
obsolete
>--- quake2-r0.16.1/src/linux/snd_alsa.c.alsa~ 2011-05-26 21:52:25.498677779 +0200 >+++ quake2-r0.16.1/src/linux/snd_alsa.c 2011-05-26 21:56:21.409728486 +0200 >@@ -22,13 +22,22 @@ > $Id: snd_alsa.c,v 1.5 2005/01/02 03:29:11 bburns Exp $ > */ > >-#define BUFFER_SIZE 4096 >+// quake2-r0.16.1/src/linux/snd_alsa.c 2010-08-29 09:58:50 >+// Alsa Redux Patch >+#define BUFFER_SIZE 16384 > > #include <alsa/asoundlib.h> > > #include "../client/client.h" > #include "../client/snd_loc.h" > >+#define AFSize 4 >+static int snd_inited=0; >+static snd_pcm_t *handle; >+static int AlsaFrames; >+static int AlsaPos; >+ >+/* > #define snd_buf BUFFER_SIZE > > static int snd_inited; >@@ -43,17 +52,58 @@ cvar_t *sndchannels; > cvar_t *snddevice; > > static int tryrates[] = { 44100, 22051, 11025, 8000 }; >- >+*/ > qboolean SNDDMA_Init (void) > { >- int i; >- int err; >- int buffersize; >- int framesize; >- int format; >+ int confirm; >+ int latency; >+ Com_Printf("Setting up ALSA driver .....\n"); > > if (snd_inited) { return 1; } >- >+ int s_khz=(Cvar_Get("s_khz", "22", CVAR_ARCHIVE))->value; >+ if (s_khz <22 ){ >+ Com_Printf("Low Performance 11KHz.\n"); >+ Cvar_Set("s_mixahead","0.2"); >+ dma.speed=11025; >+ AlsaFrames=2048; >+ latency=200000; >+ }else{ >+ Com_Printf("High Quality 48KHz.\n"); >+ Cvar_Set("s_mixahead","0.1"); >+ dma.speed=48000; >+ AlsaFrames=4800; >+ latency=110000;} >+ >+ dma.channels = 2; >+ dma.samplebits = 16; >+ AlsaPos = 0; >+ handle = NULL; >+ confirm = >+snd_pcm_open(&handle,"default",SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK); >+ if (confirm < 0) { >+ Com_Printf("ALSA sound error: cannot open device \n"); >+ return 0;} >+ confirm = snd_pcm_set_params(handle, >+ SND_PCM_FORMAT_S16_LE, >+ SND_PCM_ACCESS_RW_INTERLEAVED, >+ dma.channels, >+ dma.speed, >+ 1,//soft resample >+ latency); >+ if (confirm < 0){ >+ Com_Printf("Alsa error: %s\n", snd_strerror(confirm)); >+ return 0;} >+ confirm = snd_pcm_prepare(handle); >+ if (confirm < 0) { >+ Com_Printf("...failed.\n"); >+ return 0;} >+ >+ int rambuffer = (BUFFER_SIZE+AlsaFrames)*AFSize; >+ dma.buffer=malloc(rambuffer); >+ dma.samplepos = 0; >+ dma.samples = BUFFER_SIZE*dma.channels; >+ dma.submission_chunk = 16; >+ /* > sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE); > sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE); > sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE); >@@ -159,7 +209,6 @@ qboolean SNDDMA_Init (void) > return 0; > } > >- /* > buffer_size = snd_pcm_hw_params_get_buffer_size(hw_params); > frame_size = (snd_pcm_format_physical_width(format)*dma.channels)/8; > >@@ -172,7 +221,6 @@ qboolean SNDDMA_Init (void) > } > > snd_buf = buffer_size*frame_size; >- */ > > //snd_buf = BUFFER_SIZE; > >@@ -183,7 +231,7 @@ qboolean SNDDMA_Init (void) > dma.samples = snd_buf / (dma.samplebits/8); > dma.submission_chunk = 1; > dma.buffer = (char *)buffer; >- >+ */ > snd_inited = 1; > return 1; > } >@@ -191,22 +239,36 @@ qboolean SNDDMA_Init (void) > int > SNDDMA_GetDMAPos (void) > { >- if(snd_inited) >- return dma.samplepos; >- else >- Com_Printf ("Sound not inizialized\n"); >- return 0; >+ int timerpos; >+ int send; >+ int taken; >+ timerpos = snd_pcm_avail(handle); >+ if (timerpos<0){// likely buffer underrun. >+ timerpos = snd_pcm_prepare(handle); >+ timerpos=0;} >+ >+ send=AlsaFrames-timerpos; >+ if ( (send+AlsaPos)>BUFFER_SIZE ) >+ { memcpy (dma.buffer+BUFFER_SIZE*AFSize, >+ dma.buffer,AlsaFrames*AFSize);} >+ taken = snd_pcm_writei(handle, dma.buffer+AlsaPos*AFSize, send); >+ if (taken<0) {taken=0;} >+ >+ AlsaPos+=taken; >+ if (BUFFER_SIZE<=AlsaPos){AlsaPos -= BUFFER_SIZE;} >+ return AlsaPos*dma.channels; >+ > } > > void > SNDDMA_Shutdown (void) > { > if (snd_inited) { >- snd_pcm_drop(playback_handle); >- snd_pcm_close(playback_handle); >+ snd_pcm_drop(handle); >+ snd_pcm_close(handle); > snd_inited = 0; >+ free(dma.buffer); > } >- free(dma.buffer); > dma.buffer = NULL; > } > >@@ -217,13 +279,6 @@ Send sound to device if buffer isn't rea > void > SNDDMA_Submit (void) > { >- int written; >- >- if ((written = snd_pcm_writei(playback_handle, dma.buffer, snd_buf)) < 0) { >- snd_pcm_prepare(playback_handle); >- Com_Printf("alsa: buffer underrun\n"); >- } >- dma.samplepos += written/(dma.samplebits/8); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 158415
:
104353
|
123131
|
123133
|
173337
|
306069
| 306071 |
306077