aboutsummaryrefslogtreecommitdiff
path: root/modules/chibi/cp_sample_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/chibi/cp_sample_manager.cpp')
-rw-r--r--modules/chibi/cp_sample_manager.cpp53
1 files changed, 23 insertions, 30 deletions
diff --git a/modules/chibi/cp_sample_manager.cpp b/modules/chibi/cp_sample_manager.cpp
index 2ad0a720b..001c10a83 100644
--- a/modules/chibi/cp_sample_manager.cpp
+++ b/modules/chibi/cp_sample_manager.cpp
@@ -28,48 +28,41 @@
/*************************************************************************/
#include "cp_sample_manager.h"
+CPSampleManager *CPSampleManager::singleton = NULL;
-CPSampleManager * CPSampleManager::singleton=NULL;
+void CPSampleManager::copy_to(CPSample_ID p_from, CPSample_ID &p_to) {
+ ERR_FAIL_COND(!check(p_from));
-void CPSampleManager::copy_to(CPSample_ID p_from,CPSample_ID &p_to) {
-
- ERR_FAIL_COND(!check( p_from ));
-
-
if (p_to.is_null()) {
-
- p_to=create( is_16bits( p_from), is_stereo( p_from), get_size(p_from));
+
+ p_to = create(is_16bits(p_from), is_stereo(p_from), get_size(p_from));
} else {
-
- recreate( p_to, is_16bits( p_from), is_stereo( p_from), get_size(p_from));
-
+
+ recreate(p_to, is_16bits(p_from), is_stereo(p_from), get_size(p_from));
}
-
- int len=get_size( p_from );
- int ch=is_stereo( p_from ) ? 2 : 1;
-
- for (int c=0;c<ch;c++) {
-
- for (int i=0;i<len;i++) {
-
- int16_t s=get_data( p_from, i, c );
- set_data( p_to, i, s, c );
+
+ int len = get_size(p_from);
+ int ch = is_stereo(p_from) ? 2 : 1;
+
+ for (int c = 0; c < ch; c++) {
+
+ for (int i = 0; i < len; i++) {
+
+ int16_t s = get_data(p_from, i, c);
+ set_data(p_to, i, s, c);
}
}
-
- set_loop_type( p_to, get_loop_type( p_from ) );
- set_loop_begin( p_to, get_loop_begin( p_from ) );
- set_loop_end( p_to, get_loop_end( p_from ) );
- set_c5_freq( p_to, get_c5_freq( p_from ) );
-
-
-
+
+ set_loop_type(p_to, get_loop_type(p_from));
+ set_loop_begin(p_to, get_loop_begin(p_from));
+ set_loop_end(p_to, get_loop_end(p_from));
+ set_c5_freq(p_to, get_c5_freq(p_from));
}
CPSampleManager::CPSampleManager() {
- singleton=this;
+ singleton = this;
}
CPSampleManager *CPSampleManager::get_singleton() {