[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10938] branches/soc-2007-hcube: added some comments, and changes in sequencer menu, only one Audio format is exists now.
Csaba Hruska
csaba.hruska at gmail.com
Sat Jun 16 01:22:25 CEST 2007
Revision: 10938
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10938
Author: hcube
Date: 2007-06-16 01:22:25 +0200 (Sat, 16 Jun 2007)
Log Message:
-----------
added some comments, and changes in sequencer menu, only one Audio format is exists now.
Modified Paths:
--------------
branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h
branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h
branches/soc-2007-hcube/source/blender/src/editseq.c
branches/soc-2007-hcube/source/blender/src/editsound.c
branches/soc-2007-hcube/source/blender/src/header_seq.c
Modified: branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h 2007-06-15 14:36:39 UTC (rev 10937)
+++ branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h 2007-06-15 23:22:25 UTC (rev 10938)
@@ -8,15 +8,17 @@
Can be looped
dont do any format conversion
provides pcm data at same format that it comes from dataProvider
+
+ todo: Add Play Direction
*/
class SND_FXSample: public SND_SoundInterface
{
public:
enum PlayState
{
- STARTED = 0,
- PAUSED = 1,
- STOPPED = 2
+ STARTED = 0,
+ PAUSED = 1,
+ STOPPED = 2
};
SND_FXSample( SND_DataProvider *dataProvider, int channelIdx );
Modified: branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h 2007-06-15 14:36:39 UTC (rev 10937)
+++ branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h 2007-06-15 23:22:25 UTC (rev 10938)
@@ -1,3 +1,6 @@
+#ifndef __SND_SOUNDINTERFACE_H__
+#define __SND_SOUNDINTERFACE_H__
+
class SND_SoundInterface
{
public:
@@ -13,3 +16,5 @@
};
+#endif //__SND_SOUNDINTERFACE_H__
+
Modified: branches/soc-2007-hcube/source/blender/src/editseq.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/editseq.c 2007-06-15 14:36:39 UTC (rev 10937)
+++ branches/soc-2007-hcube/source/blender/src/editseq.c 2007-06-15 23:22:25 UTC (rev 10938)
@@ -83,7 +83,7 @@
#include "BIF_editview.h"
#include "BIF_scrarea.h"
// by hcube
-//#include "BIF_editsound.h"
+#include "BIF_editsound.h"
#include "BSE_edit.h"
#include "BSE_sequence.h"
@@ -690,7 +690,7 @@
}
}
-static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile,
+static Sequence *sfile_to_snd_sequence(SpaceFile *sfile,
int cfra, int machine)
{
Sequence *seq;
@@ -708,15 +708,15 @@
strncat(str, sfile->file, FILE_MAXFILE-1);
// by hcube
- //sound= sound_new_sound(str);
+ sound= sound_new_sound(str);
if (!sound || sound->sample->type == SAMPLE_INVALID) {
error("Unsupported audio format");
return 0;
}
- if (sound->sample->bits != 16) {
- error("Only 16 bit audio is supported");
- return 0;
- }
+// if (sound->sample->bits != 16) {
+// error("Only 16 bit audio is supported");
+// return 0;
+// }
sound->id.us=1;
sound->flags |= SOUND_FLAGS_SEQUENCE;
// by hcube
@@ -762,109 +762,7 @@
return seq;
}
-static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
- int machine, int index)
-{
- Sequence *seq;
- struct hdaudio *hdaudio;
- Strip *strip;
- StripElem *se;
- int totframe, a;
- char name[160], rel[160];
- char str[FILE_MAXDIR+FILE_MAXFILE];
- totframe= 0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- if(index<0)
- strncat(str, sfile->file, FILE_MAXDIR-1);
- else
- strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
-
- /* is it a sound file? */
- // by hcube
- //hdaudio = sound_open_hdaudio(str);
- if(hdaudio==0) {
- error("The selected file is not a sound file or "
- "FFMPEG-support not compiled in!");
- return(cfra);
- }
-
- // by hcube
- //totframe= sound_hdaudio_get_duration(hdaudio, G.scene->r.frs_sec);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_HD_SOUND;
- seq->hdaudio= hdaudio;
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- strcpy(rel, G.sce);
- BLI_makestringcode(rel, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(totframe*sizeof(StripElem), "stripelem");
-
- /* name movie in first strip */
- if(index<0)
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- else
- strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
-
- for(a=1; a<=totframe; a++, se++) {
- se->ok= 2;
- se->ibuf = 0;
- se->nr= a;
- }
-
- /* last active name */
- strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
- return(cfra+totframe);
-}
-
-static void sfile_to_hdsnd_sequence(SpaceFile *sfile, int cfra, int machine)
-{
- int totsel, a;
-
- totsel= 0;
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if((sfile->filelist[a].type & S_IFDIR)==0) {
- totsel++;
- }
- }
- }
-
- if((totsel==0) && (sfile->file[0])) {
- cfra= sfile_to_hdsnd_sequence_load(sfile, cfra, machine, -1);
- return;
- }
-
- if(totsel==0) return;
-
- /* ok, check all the select file, and load it. */
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if((sfile->filelist[a].type & S_IFDIR)==0) {
- /* load and update current frame. */
- cfra= sfile_to_hdsnd_sequence_load(sfile, cfra, machine, a);
- }
- }
- }
-}
-
-
static void add_image_strips(char *name)
{
SpaceFile *sfile;
@@ -988,7 +886,7 @@
waitcursor(1);
/* read directory itself */
- sfile_to_hdsnd_sequence(sfile, cfra, machine);
+ sfile_to_snd_sequence(sfile, cfra, machine);
sfile_to_mv_sequence(sfile, cfra, machine);
waitcursor(0);
@@ -998,7 +896,7 @@
}
-static void add_sound_strip_ram(char *name)
+static void add_sound_strip(char *name)
{
SpaceFile *sfile;
float x, y;
@@ -1018,42 +916,14 @@
waitcursor(1);
- sfile_to_ramsnd_sequence(sfile, cfra, machine);
+ sfile_to_snd_sequence(sfile, cfra, machine);
waitcursor(0);
- BIF_undo_push("Add ram sound strip Sequencer");
+ BIF_undo_push("Add sound strip Sequencer");
transform_seq('g', 0);
}
-static void add_sound_strip_hd(char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq();
-
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if (sfile==0) return;
-
- /* where will it be */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- sfile_to_hdsnd_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add hd sound strip Sequencer");
- transform_seq('g', 0);
-}
-
#if 0
static void reload_sound_strip(char *name)
{
@@ -1391,11 +1261,8 @@
"|Movie%x102"
#ifdef WITH_FFMPEG
"|Movie + Audio (HD)%x105"
- "|Audio (RAM)%x103"
- "|Audio (HD)%x104"
-#else
- "|Audio (Wav)%x103"
#endif
+ "|Audio%x103"
"|Scene%x101"
"|Plugin%x10"
"|Cross%x2"
@@ -1502,12 +1369,8 @@
break;
case 103:
if (!last_sounddir[0]) strncpy(last_sounddir, U.sounddir, FILE_MAXDIR-1);
- activate_fileselect(FILE_SPECIAL, "Select Audio (RAM)", last_sounddir, add_sound_strip_ram);
+ activate_fileselect(FILE_SPECIAL, "Select Audio", last_sounddir, add_sound_strip);
break;
- case 104:
- if (!last_sounddir[0]) strncpy(last_sounddir, U.sounddir, FILE_MAXDIR-1);
- activate_fileselect(FILE_SPECIAL, "Select Audio (HD)", last_sounddir, add_sound_strip_hd);
- break;
}
}
Modified: branches/soc-2007-hcube/source/blender/src/editsound.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/editsound.c 2007-06-15 14:36:39 UTC (rev 10937)
+++ branches/soc-2007-hcube/source/blender/src/editsound.c 2007-06-15 23:22:25 UTC (rev 10938)
@@ -88,28 +88,15 @@
#include "mydevice.h"
#include "SND_C-api.h"
-//#include "SND_DependKludge.h"
#include "SYS_System.h"
#include "PIL_time.h"
-/* this might move to the external header */
-//void* sound_get_libraryinterface(void);
-
-//static SND_SceneHandle ghSoundScene=NULL;
-//static SND_AudioDeviceInterfaceHandle ghAudioDeviceInterface=NULL;
-
-/* que? why only here? because of the type define? */
-//bSound *sound_find_sound(char *id_name);
-//void sound_read_wav_data(bSound * sound, PackedFile * pf);
-//void sound_stop_sound(void *object, bSound *sound);
void winqreadsoundspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-/* void sound_stop_all_sounds(void); already in BIF_editsound.h */
-
/* Right. Now for some implementation: */
void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
{
@@ -290,6 +277,11 @@
scrarea_queue_winredraw(curarea);
}
+///////////////////////////////////////////////////////////
+// This is necessery if we cant change bSound and bSample
+//
+///////////////////////////////////////////////////////////
+
bSound* sound_new_sound(char *name)
{
bSound *sound = NULL;
@@ -332,796 +324,3 @@
SND_StopAllSounds();
}
-/*
-void sound_initialize_sounds(void)
-{
- bSound *sound;
-
- if(ghSoundScene) {
-
- // clear the soundscene
- SND_RemoveAllSounds(ghSoundScene);
- SND_RemoveAllSamples(ghSoundScene);
- }
-
- // initialize sample blocks (doesnt call audio system, needs to be done once after load
- sound = G.main->sound.first;
- while (sound) {
- sound_sample_is_null(sound);
- sound = (bSound *) sound->id.next;
- }
-}
-*/
-
-/*
-bSound *sound_make_copy(bSound *originalsound)
-{
- bSound *sound = NULL;
- char name[160];
- int len;
-
- if(ghSoundScene==NULL) sound_init_audio();
-
- // only copy sounds that are sounds
- if (originalsound)
- {
- // do some name magic
- strcpy(name, originalsound->name);
- len = strlen(name);
- while ((len > 0) && (name[len - 1] != '/') && (name[len - 1] != '\\'))
- len--;
-
- // allocate the needed memory
- sound = alloc_libblock(&G.main->sound, ID_SO, name + len);
-
- // create a soundobject
- sound->snd_sound = SND_CreateSound();
-
- // set the samplename
- strcpy(sound->name, name);
- SND_SetSampleName(sound->snd_sound, sound->name);
-
- // add the new object to the soundscene
- SND_AddSound(ghSoundScene, sound->snd_sound);
-
- // and copy the data from the original
- sound->attenuation = originalsound->attenuation;
- sound->distance = originalsound->distance;
- sound->max_gain = originalsound->max_gain;
- sound->min_gain = originalsound->min_gain;
- sound->newpackedfile = originalsound->newpackedfile;
- sound->panning = originalsound->panning;
- sound->pitch = originalsound->pitch;
- sound->sample = originalsound->sample;
- sound->volume = originalsound->volume;
-
- if (originalsound->flags & SOUND_FLAGS_3D)
- sound->flags |= SOUND_FLAGS_3D;
- else
- sound->flags &= ~SOUND_FLAGS_3D;
- }
-
- return sound;
-}
-*/
-
-/*
-void sound_initialize_sample(bSound *sound)
-{
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list