~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/editsound.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: editsound.c,v 1.17 2004/05/03 21:21:29 ton Exp $
 
2
 * $Id: editsound.c,v 1.25 2005/03/09 19:45:56 lukep Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
31
31
 */
32
32
 
33
33
#include <stdio.h>
 
34
#include <stdlib.h>
34
35
#include <math.h>
35
36
#include <string.h>
36
37
#include <fcntl.h>
40
41
#endif
41
42
 
42
43
#ifndef WIN32 
 
44
#define __USE_XOPEN /* Needed for swab on linux */
43
45
#include <unistd.h>
 
46
#undef __USE_XOPEN
44
47
#else
 
48
 
45
49
#include <io.h>
46
50
#endif
47
51
#include "MEM_guardedalloc.h"
54
58
#include "DNA_scene_types.h"
55
59
#include "DNA_sound_types.h"
56
60
#include "DNA_packedFile_types.h"
 
61
#include "DNA_userdef_types.h"
57
62
 
58
63
#include "BKE_utildefines.h"
59
64
#include "BKE_global.h"
80
85
 
81
86
#include "SYS_System.h"
82
87
 
 
88
#include "PIL_time.h"
 
89
 
 
90
 
83
91
/* this might move to the external header */
84
92
void* sound_get_libraryinterface(void);
85
93
 
104
112
        float dx, dy;
105
113
        int doredraw= 0, cfra, first = 0;
106
114
        short mval[2], nr;
 
115
        short mousebut = L_MOUSE;
107
116
        
108
117
        if(curarea->win==0) return;
109
118
 
111
120
                
112
121
                if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
113
122
 
 
123
                /* swap mouse buttons based on user preference */
 
124
                if (U.flag & USER_LMOUSESELECT) {
 
125
                        if (event == LEFTMOUSE) {
 
126
                                event = RIGHTMOUSE;
 
127
                                mousebut = L_MOUSE;
 
128
                        } else if (event == RIGHTMOUSE) {
 
129
                                event = LEFTMOUSE;
 
130
                                mousebut = R_MOUSE;
 
131
                        }
 
132
                }
 
133
 
114
134
                switch(event) {
115
135
                case LEFTMOUSE:
116
136
                        ssound->flag |= SND_CFRA_NUM;
126
146
                                        first= 0;
127
147
                                        CFRA= cfra;
128
148
                                        update_for_newframe();
129
 
                                        force_draw_plus(SPACE_VIEW3D);
 
149
                                        force_draw_plus(SPACE_VIEW3D, 1);
130
150
                                }
 
151
                                else PIL_sleep_ms(30);
131
152
                        
132
 
                        } while(get_mbut()&L_MOUSE);
 
153
                        } while(get_mbut() & mousebut);
133
154
                        ssound->flag &= ~SND_CFRA_NUM;
134
155
                        
135
156
                        doredraw= 1;
186
207
                /* clear the soundscene */
187
208
                SND_RemoveAllSounds(ghSoundScene);
188
209
                SND_RemoveAllSamples(ghSoundScene);
 
210
        }
189
211
        
190
 
                /* initialize sounds */
191
 
                sound = G.main->sound.first;
192
 
                while (sound)
193
 
                {
194
 
                        sound_sample_is_null(sound);
195
 
                        sound = (bSound *) sound->id.next;
196
 
                }
 
212
        /* initialize sample blocks (doesnt call audio system, needs to be done once after load */
 
213
        sound = G.main->sound.first;
 
214
        while (sound)
 
215
        {
 
216
                sound_sample_is_null(sound);
 
217
                sound = (bSound *) sound->id.next;
197
218
        }
198
219
}
199
220
 
431
452
 
432
453
 
433
454
/* ugly, but it works (for now) */
434
 
int sound_get_filetype_from_header(bSound* sound, PackedFile* pf)
 
455
static int sound_get_filetype_from_header(bSound* sound, PackedFile* pf)
435
456
{
436
457
        int filetype = SAMPLE_INVALID;
437
458
        int i;
497
518
        {
498
519
                filetype = SAMPLE_OGG_VORBIS;
499
520
        }
500
 
        else if ((!memcmp(buffer, "ID3", 3)) || (!memcmp(buffer, "��", 2)))
 
521
        else if ((!memcmp(buffer, "ID3", 3)) || (!memcmp(buffer, "", 2)))
501
522
        {
502
523
                filetype = SAMPLE_MP3;
503
524
        }
513
534
 
514
535
 
515
536
 
516
 
int check_filetype(bSound* sound, PackedFile* pf)
 
537
static int check_filetype(bSound* sound, PackedFile* pf)
517
538
{
518
539
//      char* pdest;
519
540
        sound->sample->type = SAMPLE_INVALID;
998
1019
        SYS_SystemHandle hSystem = NULL;
999
1020
        
1000
1021
        if(ghSoundScene==NULL) {
1001
 
                
1002
 
                printf("sound init audio\n");
1003
 
        
1004
1022
                hSystem = SYS_GetSystem();
1005
1023
                noaudio = SYS_GetCommandLineInt(hSystem,"noaudio",0);
1006
1024
                
1026
1044
        if(ghSoundScene) {
1027
1045
                SND_DeleteScene(ghSoundScene);
1028
1046
                SND_ReleaseDevice();
 
1047
                ghSoundScene = NULL;
1029
1048
        }
1030
1049
}