Let the game engine manage it's own sound scene. This is to fix bug 1415 (Patch...
[blender.git] / source / blender / src / editsound.c
index 8f384da000b8bcb341b596dfb32f78c6e7b961e2..b409804a9f83487163b681f03a550355433b81ed 100644 (file)
@@ -58,6 +58,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_sound_types.h"
 #include "DNA_packedFile_types.h"
+#include "DNA_userdef_types.h"
 
 #include "BKE_utildefines.h"
 #include "BKE_global.h"
@@ -108,6 +109,7 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
        float dx, dy;
        int doredraw= 0, cfra, first = 0;
        short mval[2], nr;
+       short mousebut = L_MOUSE;
        
        if(curarea->win==0) return;
 
@@ -115,6 +117,17 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                
                if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
 
+               /* swap mouse buttons based on user preference */
+               if (U.flag & USER_LMOUSESELECT) {
+                       if (evt->event == LEFTMOUSE) {
+                               event = RIGHTMOUSE;
+                               mousebut = L_MOUSE;
+                       } else if (evt->event == RIGHTMOUSE) {
+                               event = LEFTMOUSE;
+                               mousebut = R_MOUSE;
+                       }
+               }
+
                switch(event) {
                case LEFTMOUSE:
                        ssound->flag |= SND_CFRA_NUM;
@@ -133,7 +146,7 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        force_draw_plus(SPACE_VIEW3D);
                                }
                        
-                       } while(get_mbut()&L_MOUSE);
+                       } while(get_mbut() & mousebut);
                        ssound->flag &= ~SND_CFRA_NUM;
                        
                        doredraw= 1;
@@ -501,7 +514,7 @@ int sound_get_filetype_from_header(bSound* sound, PackedFile* pf)
        {
                filetype = SAMPLE_OGG_VORBIS;
        }
-       else if ((!memcmp(buffer, "ID3", 3)) || (!memcmp(buffer, "ÿû", 2)))
+       else if ((!memcmp(buffer, "ID3", 3)) || (!memcmp(buffer, "", 2)))
        {
                filetype = SAMPLE_MP3;
        }
@@ -1002,9 +1015,6 @@ void sound_init_audio(void)
        SYS_SystemHandle hSystem = NULL;
        
        if(ghSoundScene==NULL) {
-               
-               printf("sound init audio\n");
-       
                hSystem = SYS_GetSystem();
                noaudio = SYS_GetCommandLineInt(hSystem,"noaudio",0);
                
@@ -1030,5 +1040,6 @@ void sound_exit_audio(void)
        if(ghSoundScene) {
                SND_DeleteScene(ghSoundScene);
                SND_ReleaseDevice();
+               ghSoundScene = NULL;
        }
 }