[Scummvm-cvs-logs] SF.net SVN: scummvm:[47034] scummvm/trunk/sound/mixer.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Jan 5 20:52:50 CET 2010
Revision: 47034
http://scummvm.svn.sourceforge.net/scummvm/?rev=47034&view=rev
Author: lordhoto
Date: 2010-01-05 19:52:50 +0000 (Tue, 05 Jan 2010)
Log Message:
-----------
Add some basic documentation to the new Channel interface.
Modified Paths:
--------------
scummvm/trunk/sound/mixer.cpp
Modified: scummvm/trunk/sound/mixer.cpp
===================================================================
--- scummvm/trunk/sound/mixer.cpp 2010-01-05 19:52:32 UTC (rev 47033)
+++ scummvm/trunk/sound/mixer.cpp 2010-01-05 19:52:50 UTC (rev 47034)
@@ -40,33 +40,94 @@
/**
- * Channels used by the sound mixer.
+ * Generic Channel interface used by the default Mixer implementation.
*/
class Channel {
public:
Channel(Mixer *mixer, Mixer::SoundType type, int id, bool permanent);
virtual ~Channel() {}
+ /**
+ * Mixes the channel's samples into the given buffer.
+ *
+ * @param data buffer where to mix the data
+ * @param len number of sample *pairs*. So a value of
+ * 10 means that the buffer contains twice 10 sample, each
+ * 16 bits, for a total of 40 bytes.
+ */
virtual void mix(int16 *data, uint len) = 0;
+ /**
+ * Queries whether the channel is still playing or not.
+ */
virtual bool isFinished() const = 0;
+ /**
+ * Queries whether the channel is a permanent channel.
+ * A permanent channel is not affected by a Mixer::stopAll
+ * call.
+ */
bool isPermanent() const { return _permanent; }
+ /**
+ * Returns the id of the channel.
+ */
int getId() const { return _id; }
+ /**
+ * Pauses or unpaused the channel in a recursive fashion.
+ *
+ * @param paused true, when the channel should be paused.
+ * false when it should be unpaused.
+ */
void pause(bool paused);
+
+ /**
+ * Queries whether the channel is currently paused.
+ */
bool isPaused() const { return (_pauseLevel != 0); }
+ /**
+ * Sets the channel's own volume.
+ *
+ * @param volume new volume
+ */
void setVolume(const byte volume);
+
+ /**
+ * Sets the channel's balance setting.
+ *
+ * @param balance new balance
+ */
void setBalance(const int8 balance);
+
+ /**
+ * Notifies the channel that the global sound type
+ * volume settings changed.
+ */
void notifyGlobalVolChange() { updateChannelVolumes(); }
+ /**
+ * Queries how many milliseconds the channel has
+ * been playing.
+ */
uint32 getElapsedTime();
+ /**
+ * Queries the channel's sound type.
+ */
Mixer::SoundType getType() const { return _type; }
+ /**
+ * Sets the channel's sound handle.
+ *
+ * @param handle new handle
+ */
void setHandle(const SoundHandle handle) { _handle = handle; }
+
+ /**
+ * Queries the channel's sound handle.
+ */
SoundHandle getHandle() const { return _handle; }
private:
@@ -83,7 +144,14 @@
st_volume_t _volL, _volR;
protected:
+ /**
+ * Queries the volume of the left output channel.
+ */
st_volume_t getLeftVolume() const { return _volL; }
+
+ /**
+ * Queries the volume of the right output channel.
+ */
st_volume_t getRightVolume() const { return _volR; }
Mixer *_mixer;
@@ -503,10 +571,6 @@
delete _input;
}
-/* len indicates the number of sample *pairs*. So a value of
- 10 means that the buffer contains twice 10 sample, each
- 16 bits, for a total of 40 bytes.
- */
void SimpleChannel::mix(int16 *data, uint len) {
assert(_input);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list