* directx.c: Windows DirectX audio output method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: directx.c,v 1.8 2002/11/15 16:27:10 gbazin Exp $
+ * $Id: directx.c,v 1.11 2003/02/14 17:00:02 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
{
LPDIRECTSOUND p_dsobject; /* main Direct Sound object */
- LPDIRECTSOUNDBUFFER p_dsbuffer_primary; /* the actual sound card buffer
- (not used directly) */
-
LPDIRECTSOUNDBUFFER p_dsbuffer; /* the sound buffer we use (direct sound
* takes care of mixing all the
* secondary buffers into the primary) */
*****************************************************************************/
vlc_module_begin();
set_description( _("DirectX audio module") );
- set_capability( "audio output", 100 );
+ set_capability( "audio output", 50 );
add_shortcut( "directx" );
set_callbacks( OpenAudio, CloseAudio );
vlc_module_end();
static int OpenAudio( vlc_object_t *p_this )
{
aout_instance_t * p_aout = (aout_instance_t *)p_this;
- HRESULT dsresult;
- DSBUFFERDESC dsbuffer_desc;
int i;
msg_Dbg( p_aout, "Open" );
/* Initialize some variables */
p_aout->output.p_sys->p_dsobject = NULL;
- p_aout->output.p_sys->p_dsbuffer_primary = NULL;
p_aout->output.p_sys->p_dsbuffer = NULL;
p_aout->output.p_sys->p_dsnotify = NULL;
p_aout->output.p_sys->p_notif = NULL;
goto error;
}
- /* Obtain (not create) Direct Sound primary buffer */
- memset( &dsbuffer_desc, 0, sizeof(DSBUFFERDESC) );
- dsbuffer_desc.dwSize = sizeof(DSBUFFERDESC);
- dsbuffer_desc.dwFlags = DSBCAPS_PRIMARYBUFFER;
- msg_Warn( p_aout, "create direct sound primary buffer" );
- dsresult = IDirectSound_CreateSoundBuffer(p_aout->output.p_sys->p_dsobject,
- &dsbuffer_desc,
- &p_aout->output.p_sys->p_dsbuffer_primary,
- NULL);
- if( dsresult != DS_OK )
- {
- msg_Err( p_aout, "cannot create direct sound primary buffer" );
- goto error;
- }
-
/* Now we need to setup DirectSound play notification */
p_aout->output.p_sys->p_notif =
vlc_object_create( p_aout, sizeof(notification_thread_t) );
p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
if( DirectxCreateSecondaryBuffer( p_aout ) )
{
- msg_Err( p_aout, "cannot create WAVE_FORMAT_IEEE_FLOAT buffer" );
+ msg_Dbg( p_aout, "cannot create WAVE_FORMAT_IEEE_FLOAT buffer" );
p_aout->output.output.i_format = VLC_FOURCC('s','1','6','l');
if( DirectxCreateSecondaryBuffer( p_aout ) )
if( vlc_thread_create( p_aout->output.p_sys->p_notif,
"DirectSound Notification Thread",
DirectSoundThread,
- THREAD_PRIORITY_TIME_CRITICAL, 1 ) )
+ VLC_THREAD_PRIORITY_HIGHEST, 1 ) )
{
msg_Err( p_aout, "cannot create DirectSoundThread" );
goto error;
/* release the secondary buffer */
DirectxDestroySecondaryBuffer( p_aout );
- /* then release the primary buffer */
- if( p_aout->output.p_sys->p_dsbuffer_primary )
- IDirectSoundBuffer_Release( p_aout->output.p_sys->p_dsbuffer_primary );
-
/* finally release the DirectSound object */
if( p_aout->output.p_sys->p_dsobject )
IDirectSound_Release( p_aout->output.p_sys->p_dsobject );