Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
819791ba
Commit
819791ba
authored
Apr 24, 1999
by
Ove Kaaven
Committed by
Alexandre Julliard
Apr 24, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't malloc/free for every mixing operation, use the same buffer over
instead...
parent
60e414fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
dsound.c
multimedia/dsound.c
+18
-2
No files found.
multimedia/dsound.c
View file @
819791ba
...
...
@@ -1935,6 +1935,22 @@ static void DSOUND_Mixer3D(IDirectSoundBufferImpl *dsb, BYTE *buf, INT len)
}
#endif
static
void
*
tmp_buffer
;
static
size_t
tmp_buffer_len
=
0
;
static
void
*
DSOUND_tmpbuffer
(
size_t
len
)
{
if
(
len
>
tmp_buffer_len
)
{
void
*
new_buffer
=
realloc
(
tmp_buffer
,
len
);
if
(
new_buffer
)
{
tmp_buffer
=
new_buffer
;
tmp_buffer_len
=
len
;
}
return
new_buffer
;
}
return
tmp_buffer
;
}
static
DWORD
DSOUND_MixInBuffer
(
IDirectSoundBufferImpl
*
dsb
)
{
INT
i
,
len
,
ilen
,
temp
,
field
;
...
...
@@ -1968,7 +1984,7 @@ static DWORD DSOUND_MixInBuffer(IDirectSoundBufferImpl *dsb)
/* Been seeing segfaults in malloc() for some reason... */
TRACE
(
dsound
,
"allocating buffer (size = %d)
\n
"
,
len
);
if
((
buf
=
ibuf
=
(
BYTE
*
)
malloc
(
len
))
==
NULL
)
if
((
buf
=
ibuf
=
(
BYTE
*
)
DSOUND_tmpbuffer
(
len
))
==
NULL
)
return
0
;
TRACE
(
dsound
,
"MixInBuffer (%p) len = %d
\n
"
,
dsb
,
len
);
...
...
@@ -2002,7 +2018,7 @@ static DWORD DSOUND_MixInBuffer(IDirectSoundBufferImpl *dsb)
if
(
obuf
>=
(
BYTE
*
)(
primarybuf
->
buffer
+
primarybuf
->
buflen
))
obuf
=
primarybuf
->
buffer
;
}
free
(
buf
);
/* free(buf); */
if
(
dsb
->
dsbd
.
dwFlags
&
DSBCAPS_CTRLPOSITIONNOTIFY
)
DSOUND_CheckEvent
(
dsb
,
ilen
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment