[Scummvm-cvs-logs] CVS: residual/imuse imuse.h,1.3,1.4 imuse_track.cpp,1.4,1.5

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Dec 30 14:40:01 CET 2004


Update of /cvsroot/scummvm/residual/imuse
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32312/imuse

Modified Files:
	imuse.h imuse_track.cpp 
Log Message:
attach imuse to lua commands scripts

Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/residual/imuse/imuse.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- imuse.h	29 Dec 2004 06:32:07 -0000	1.3
+++ imuse.h	30 Dec 2004 22:38:53 -0000	1.4
@@ -102,7 +102,6 @@
 	void callback();
 	void switchToNextRegion(Track *track);
 	int allocSlot(int priority);
-	void startSound(const char *soundName, int volGroupId, int hookId, int volume, int pan, int priority);
 	void selectVolumeGroup(const char *soundName, int volGroupId);
 
 	int32 getPosInMs(const char *soundName);
@@ -110,14 +109,13 @@
 	void fadeOutMusic(int fadeDelay);
 	Track *cloneToFadeOutTrack(Track *track, int fadeDelay);
 
-	void setMusicState(int stateId);
-	void setMusicSequence(int seqId);
 	void playMusic(const ImuseTable *table, int atribPos, bool sequence);
 
 public:
 	Imuse(int fps);
 	~Imuse();
 
+	bool startSound(const char *soundName, int volGroupId, int hookId, int volume, int pan, int priority);
 	void startVoice(const char *soundName);
 	void startMusic(const char *soundName, int hookId, int volume, int pan);
 	void startSfx(const char *soundName, int priority);
@@ -134,12 +132,15 @@
 
 	void setPriority(const char *soundName, int priority);
 	void setVolume(const char *soundName, int volume);
+	int getVolume(const char *soundName);
 	void setPan(const char *soundName, int pan);
 	void setFade(const char *soundName, int destVolume, int delay60HzTicks);
+	int getCountPlayedTracks();
 	void stopSound(const char *soundName);
 	void stopAllSounds();
 	void pause(bool pause);
-//	void parseScriptCmds(int cmd, int soundId, int sub_cmd, int d, int e, int f, int g, int h);
+	void setMusicState(int stateId);
+	void setMusicSequence(int seqId);
 	void refreshScripts();
 	void flushTracks();
 	bool getSoundStatus(const char *soundName) const;

Index: imuse_track.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/imuse/imuse_track.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- imuse_track.cpp	29 Dec 2004 06:32:07 -0000	1.4
+++ imuse_track.cpp	30 Dec 2004 22:38:53 -0000	1.5
@@ -61,11 +61,11 @@
 	return trackId;
 }
 
-void Imuse::startSound(const char *soundName, int volGroupId, int hookId, int volume, int pan, int priority) {
+bool Imuse::startSound(const char *soundName, int volGroupId, int hookId, int volume, int pan, int priority) {
 	int l = allocSlot(priority);
 	if (l == -1) {
 		warning("Imuse::startSound() Can't start sound - no free slots");
-		return;
+		return false;
 	}
 
 	Track *track = _track[l];
@@ -102,7 +102,7 @@
 	track->soundHandle = _sound->openSound(soundName, volGroupId);
 
 	if (track->soundHandle == NULL)
-		return;
+		return false;
 
 	bits = _sound->getBits(track->soundHandle);
 	channels = _sound->getChannels(track->soundHandle);
@@ -145,6 +145,8 @@
 	g_mixer->playInputStream(&track->handle, track->stream, false, -1, track->mixerVol, track->mixerPan, false);
 	track->started = true;
 	track->used = true;
+
+	return true;
 }
 
 void Imuse::setPriority(const char *soundName, int priority) {
@@ -176,6 +178,27 @@
 	}
 }
 
+int Imuse::getVolume(const char *soundName) {
+	for (int l = 0; l < MAX_IMUSE_TRACKS; l++) {
+		Track *track = _track[l];
+		if (track->used && !track->toBeRemoved && (strcmp(track->soundName, soundName) == 0)) {
+			return track->vol / 1000;
+		}
+	}
+}
+
+int Imuse::getCountPlayedTracks() {
+	int count = 0;
+	for (int l = 0; l < MAX_IMUSE_TRACKS; l++) {
+		Track *track = _track[l];
+		if (track->used && !track->toBeRemoved) {
+			count++;
+		}
+	}
+
+	return count;
+}
+
 void Imuse::selectVolumeGroup(const char *soundName, int volGroupId) {
 	assert((volGroupId >= 1) && (volGroupId <= 4));
 





More information about the Scummvm-git-logs mailing list