]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/directx.c
* exchanged directx' and waveout's capabilities because the latter
[vlc] / modules / audio_output / directx.c
index 2e830cf777ce023b242539d8f3d8daf41a579868..d44e2e0ec268a7f03063ca40abb075294013a107 100644 (file)
@@ -2,7 +2,7 @@
  * 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>
  *
@@ -86,9 +86,6 @@ struct aout_sys_t
 {
     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) */
@@ -123,7 +120,7 @@ static int  DirectxFillBuffer            ( aout_instance_t *, int,
  *****************************************************************************/
 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();
@@ -136,8 +133,6 @@ 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" );
@@ -152,7 +147,6 @@ static int OpenAudio( vlc_object_t *p_this )
 
     /* 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;
@@ -168,21 +162,6 @@ static int OpenAudio( vlc_object_t *p_this )
         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) );
@@ -197,7 +176,7 @@ static int OpenAudio( vlc_object_t *p_this )
     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 ) )
@@ -212,7 +191,7 @@ static int OpenAudio( vlc_object_t *p_this )
     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;
@@ -283,10 +262,6 @@ static void CloseAudio( vlc_object_t *p_this )
     /* 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 );