Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
40d9fefb
Commit
40d9fefb
authored
Jun 27, 2012
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "DirectSound: apply volume attenuation with DirectSound"
This reverts commit
999a7af7
.
parent
00ae211b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
41 deletions
+2
-41
modules/audio_output/directx.c
modules/audio_output/directx.c
+2
-41
No files found.
modules/audio_output/directx.c
View file @
40d9fefb
...
...
@@ -29,8 +29,6 @@
# include "config.h"
#endif
#include <math.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
...
...
@@ -75,7 +73,6 @@ struct aout_sys_t
LPDIRECTSOUNDBUFFER
p_dsbuffer
;
/* the sound buffer we use (direct sound
* takes care of mixing all the
* secondary buffers into the primary) */
LONG
volume
;
notification_thread_t
notif
;
/* DirectSoundThread id */
...
...
@@ -96,7 +93,6 @@ struct aout_sys_t
static
int
OpenAudio
(
vlc_object_t
*
);
static
void
CloseAudio
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
int
VolumeSet
(
audio_output_t
*
,
float
,
bool
);
/* local functions */
static
void
Probe
(
audio_output_t
*
);
...
...
@@ -232,7 +228,6 @@ static int OpenAudio( vlc_object_t *p_this )
}
aout_PacketInit
(
p_aout
,
&
p_aout
->
sys
->
packet
,
A52_FRAME_NB
);
p_aout
->
sys
->
volume
=
-
1
;
aout_VolumeNoneInit
(
p_aout
);
}
else
...
...
@@ -287,7 +282,7 @@ static int OpenAudio( vlc_object_t *p_this )
/* Calculate the frame size in bytes */
aout_FormatPrepare
(
&
p_aout
->
format
);
aout_PacketInit
(
p_aout
,
&
p_aout
->
sys
->
packet
,
FRAME_SIZE
);
aout_Volume
HardInit
(
p_aout
,
VolumeSet
,
true
);
aout_Volume
SoftInit
(
p_aout
);
}
/* Now we need to setup our DirectSound play notification structure */
...
...
@@ -574,34 +569,6 @@ static void Play( audio_output_t *p_aout, block_t *p_buffer )
p_aout
->
pf_play
=
aout_PacketPlay
;
}
/*****************************************************************************
* VolumeSet: change audio device volume
*****************************************************************************/
static
int
VolumeSet
(
audio_output_t
*
p_aout
,
float
vol
,
bool
mute
)
{
aout_sys_t
*
sys
=
p_aout
->
sys
;
/* Convert UI volume to linear factor (cube) */
vol
=
vol
*
vol
*
vol
;
/* millibels from linear amplification */
LONG
mb
=
lroundf
(
2000
.
f
*
log10f
(
vol
));
/* Clamp to allowed DirectSound range */
static_assert
(
DSBVOLUME_MIN
<
DSBVOLUME_MAX
,
"DSBVOLUME_* confused"
);
if
(
mb
>=
DSBVOLUME_MAX
)
mb
=
DSBVOLUME_MAX
;
if
(
mb
<=
DSBVOLUME_MIN
)
mb
=
DSBVOLUME_MIN
;
InterlockedExchange
(
&
sys
->
volume
,
mute
?
DSBVOLUME_MIN
:
mb
);
/* Convert back to UI volume */
vol
=
cbrtf
(
powf
(
10
.
f
,
((
float
)
mb
)
/
-
2000
.
f
));
aout_VolumeHardSet
(
p_aout
,
vol
,
mute
);
return
0
;
}
/*****************************************************************************
* CloseAudio: close the audio device
*****************************************************************************/
...
...
@@ -825,8 +792,7 @@ static int CreateDSBuffer( audio_output_t *p_aout, int i_format,
memset
(
&
dsbdesc
,
0
,
sizeof
(
DSBUFFERDESC
));
dsbdesc
.
dwSize
=
sizeof
(
DSBUFFERDESC
);
dsbdesc
.
dwFlags
=
DSBCAPS_GETCURRENTPOSITION2
/* Better position accuracy */
|
DSBCAPS_GLOBALFOCUS
/* Allows background playing */
|
DSBCAPS_CTRLVOLUME
;
/* Allows volume control */
|
DSBCAPS_GLOBALFOCUS
;
/* Allows background playing */
/* Only use the new WAVE_FORMAT_EXTENSIBLE format for multichannel audio */
if
(
i_nb_channels
<=
2
)
...
...
@@ -1065,11 +1031,6 @@ static void* DirectSoundThread( void *data )
mtime_t
mtime
=
mdate
();
int
i
;
/* Update volume if required */
LONG
volume
=
InterlockedExchange
(
&
p_aout
->
sys
->
volume
,
-
1
);
if
(
unlikely
(
volume
!=
-
1
)
)
IDirectSoundBuffer_SetVolume
(
p_aout
->
sys
->
p_dsbuffer
,
volume
);
/*
* Fill in as much audio data as we can in our circular buffer
*/
...
...
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