summaryrefslogtreecommitdiff
path: root/servers/audio/sample_manager_sw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio/sample_manager_sw.cpp')
-rw-r--r--servers/audio/sample_manager_sw.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/servers/audio/sample_manager_sw.cpp b/servers/audio/sample_manager_sw.cpp
index 9195136a5d..375aa88cd2 100644
--- a/servers/audio/sample_manager_sw.cpp
+++ b/servers/audio/sample_manager_sw.cpp
@@ -38,12 +38,8 @@ SampleManagerSW::~SampleManagerSW()
RID SampleManagerMallocSW::sample_create(AS::SampleFormat p_format, bool p_stereo, int p_length) {
- ERR_EXPLAIN("IMA-ADPCM and STEREO are not a valid combination for sample format.");
- ERR_FAIL_COND_V( p_format == AS::SAMPLE_FORMAT_IMA_ADPCM && p_stereo,RID());
Sample *s = memnew( Sample );
int datalen = p_length;
- if (p_stereo)
- datalen*=2;
if (p_format==AS::SAMPLE_FORMAT_PCM16)
datalen*=2;
else if (p_format==AS::SAMPLE_FORMAT_IMA_ADPCM) {
@@ -53,6 +49,10 @@ RID SampleManagerMallocSW::sample_create(AS::SampleFormat p_format, bool p_stere
datalen/=2;
datalen+=4;
}
+
+ if (p_stereo)
+ datalen*=2;
+
#define SAMPLE_EXTRA 16
s->data = memalloc(datalen+SAMPLE_EXTRA); //help the interpolator by allocating a little more..