aboutsummaryrefslogtreecommitdiff
path: root/engines/cryo/clsoundraw.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-14 23:39:27 +0200
committerEugene Sandulenko2017-01-25 22:41:54 +0100
commitea01120013f144ba9ad61a1973907b565acb7833 (patch)
tree6a790e869409d3390a1e8d63a516bfa242fd2f7f /engines/cryo/clsoundraw.cpp
parent0dfe25149634bff3f7bcb5cc5e883bfe2fe03d1e (diff)
downloadscummvm-rg350-ea01120013f144ba9ad61a1973907b565acb7833.tar.gz
scummvm-rg350-ea01120013f144ba9ad61a1973907b565acb7833.tar.bz2
scummvm-rg350-ea01120013f144ba9ad61a1973907b565acb7833.zip
CRYO: Refactor to avoid nested includes
Diffstat (limited to 'engines/cryo/clsoundraw.cpp')
-rw-r--r--engines/cryo/clsoundraw.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/engines/cryo/clsoundraw.cpp b/engines/cryo/clsoundraw.cpp
new file mode 100644
index 0000000000..7058780ea8
--- /dev/null
+++ b/engines/cryo/clsoundraw.cpp
@@ -0,0 +1,55 @@
+#include "cryo/cryolib.h"
+
+namespace Cryo {
+
+sound_t *CLSoundRaw_New(short arg1, float rate, short sampleSize, short mode) {
+ sound_t *sound;
+ CLBeginCheck;
+
+ sound = (sound_t *)CLMemory_Alloc(sizeof(*sound));
+ if (sound) {
+ sound->ff_1A = arg1;
+ sound->rate = rate;
+ sound->sampleSize = sampleSize;
+ sound->buffer = 0;
+// sound->sndHandle = CLMemory_AllocHandle(arg1 + 100);
+// if(!sound->sndHandle)
+// {
+// __libError = -1;
+// __osError = MemError();
+// CLCheckError();
+// }
+// else
+ {
+ CLSound_PrepareSample(sound, mode);
+ CLNoError;
+ }
+ } else {
+ __libError = -1;
+ __osError = MemError();
+ CLCheckError();
+ }
+
+ CLEndCheck;
+ return sound;
+}
+
+void CLSoundRaw_Free(sound_t *sound) {
+ while (sound->locked) ;
+// CLMemory_FreeHandle(sound->sndHandle);
+ CLMemory_Free(sound);
+}
+
+void CLSoundRaw_AssignBuffer(sound_t *sound, void *buffer, int bufferOffs, int length) {
+ char *buf;
+ CLSound_SetLength(sound, length);
+ sound->length = length;
+ buf = bufferOffs + (char *)buffer;
+// if(CLSound_GetWantsDesigned())
+// CLSound_Signed2NonSigned(buf, length);
+ sound->buffer = buf;
+// if(sound->reversed && sound->sampleSize == 16)
+// ReverseBlock16(buf, length);
+}
+
+} // End of namespace Cryo