[Scummvm-cvs-logs] CVS: scummvm/gob gob.cpp,1.8,1.9 gob.h,1.4,1.5 sound.cpp,1.5,1.6 sound.h,1.4,1.5
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Fri Apr 29 03:09:04 CEST 2005
Update of /cvsroot/scummvm/scummvm/gob
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28076
Modified Files:
gob.cpp gob.h sound.cpp sound.h
Log Message:
Some limited - and quite possibly wrong - sound effects support. I have
assumed, given their tiny size, that the sound samples are 8-bit mono.
Looping is not implemented yet.
Some sounds are skipped since the engine asks that they be played at a
negative sample rate. (I think there is more to this than just a simple
signed/unsigned issue, because they sound wrong even if I treat the
frequency as unsigned.)
Index: gob.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/gob.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gob.cpp 26 Apr 2005 06:29:53 -0000 1.8
+++ gob.cpp 29 Apr 2005 10:07:00 -0000 1.9
@@ -88,7 +88,7 @@
namespace Gob {
#define MAX_TIME_DELTA 100
- GobEngine *_vm = NULL;
+GobEngine *_vm = NULL;
GobEngine::GobEngine(GameDetector *detector, OSystem * syst) : Engine(syst) {
Index: gob.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/gob.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gob.h 13 Apr 2005 00:47:17 -0000 1.4
+++ gob.h 29 Apr 2005 10:07:00 -0000 1.5
@@ -54,5 +54,7 @@
};
+extern GobEngine *_vm;
+
} // End of namespace Gob
#endif
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/sound.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sound.cpp 9 Apr 2005 19:32:29 -0000 1.5
+++ sound.cpp 29 Apr 2005 10:07:00 -0000 1.6
@@ -23,31 +23,57 @@
#include "gob/global.h"
#include "gob/sound.h"
namespace Gob {
- int16 snd_checkProAudio(void) {return 0;}
- int16 snd_checkAdlib(void) {return 0;}
- int16 snd_checkBlaster(void) {return 0;}
- void snd_setBlasterPort(int16 port) {return;}
- void snd_speakerOn(int16 frequency) {return;}
- void snd_speakerOff(void) {return;}
- void snd_stopSound(int16 arg){return;}
- void snd_setResetTimerFlag(char flag){return;}
- void snd_playSample(Snd_SoundDesc * soundDesc, int16 repCount, int16 frequency) {;}
- void snd_cleanupFuncCallback() {;}
- CleanupFuncPtr (snd_cleanupFunc);
- //CleanupFuncPtr snd_cleanupFunc;// = &snd_cleanupFuncCallback();
+SoundHandle soundHandle;
- int16 snd_soundPort;
- char snd_playingSound;
+int16 snd_checkProAudio(void) {return 0;}
+int16 snd_checkAdlib(void) {return 0;}
+int16 snd_checkBlaster(void) {return 0;}
+void snd_setBlasterPort(int16 port) {return;}
+void snd_speakerOn(int16 frequency) {return;}
+void snd_speakerOff(void) {return;}
+void snd_stopSound(int16 arg){return;}
+void snd_setResetTimerFlag(char flag){return;}
- void snd_writeAdlib(int16 port, int16 data) {
+void snd_playSample(Snd_SoundDesc *sndDesc, int16 repCount, int16 frequency) {
+ if (repCount != 1)
+ warning("snd_playSample: repCount = %d - not implemented", repCount);
+ if (frequency < 0) {
+ warning("snd_playSample: frequency = %d - this is weird", frequency);
return;
}
- Snd_SoundDesc *snd_loadSoundData(const char *path) {
- return NULL;
- }
-void snd_freeSoundData(Snd_SoundDesc * sndDesc) {;}
+ _vm->_mixer->playRaw(&soundHandle, sndDesc->data, sndDesc->size, frequency, 0);
+}
+
+void snd_cleanupFuncCallback() {;}
+CleanupFuncPtr (snd_cleanupFunc);
+//CleanupFuncPtr snd_cleanupFunc;// = &snd_cleanupFuncCallback();
+
+int16 snd_soundPort;
+char snd_playingSound;
+
+void snd_writeAdlib(int16 port, int16 data) {
+ return;
+}
+
+Snd_SoundDesc *snd_loadSoundData(const char *path) {
+ Snd_SoundDesc *sndDesc;
+ int32 size;
+
+ size = data_getDataSize(path);
+ sndDesc = (Snd_SoundDesc *)malloc(size);
+ sndDesc->size = size;
+ sndDesc->data = data_getData(path);
+
+ return sndDesc;
+}
+
+void snd_freeSoundData(Snd_SoundDesc *sndDesc) {
+ free(sndDesc->data);
+ free(sndDesc);
+}
+
void snd_playComposition(Snd_SoundDesc ** samples, int16 *composit, int16 freqVal) {;}
void snd_waitEndPlay(void) {;}
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/sound.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sound.h 9 Apr 2005 19:19:54 -0000 1.4
+++ sound.h 29 Apr 2005 10:07:00 -0000 1.5
@@ -50,10 +50,10 @@
int16 flag;
} Snd_SoundDesc;
-void snd_playSample(Snd_SoundDesc * soundDesc, int16 repCount, int16 frequency);
+void snd_playSample(Snd_SoundDesc *sndDesc, int16 repCount, int16 frequency);
Snd_SoundDesc *snd_loadSoundData(const char *path);
-void snd_freeSoundData(Snd_SoundDesc * sndDesc);
-void snd_playComposition(Snd_SoundDesc ** samples, int16 *composit, int16 freqVal);
+void snd_freeSoundData(Snd_SoundDesc *sndDesc);
+void snd_playComposition(Snd_SoundDesc **samples, int16 *composit, int16 freqVal);
void snd_waitEndPlay(void);
} // End of namespace Gob
More information about the Scummvm-git-logs
mailing list