diff options
-rw-r--r-- | drivers/chibi/cp_loader_mod.cpp | 9 | ||||
-rw-r--r-- | drivers/chibi/cp_loader_s3m.cpp | 20 | ||||
-rw-r--r-- | drivers/chibi/cp_loader_xm.cpp | 16 | ||||
-rw-r--r-- | scene/main/node.cpp | 2 |
4 files changed, 31 insertions, 16 deletions
diff --git a/drivers/chibi/cp_loader_mod.cpp b/drivers/chibi/cp_loader_mod.cpp index 98174ff9b1..6340a6f5ea 100644 --- a/drivers/chibi/cp_loader_mod.cpp +++ b/drivers/chibi/cp_loader_mod.cpp @@ -446,18 +446,19 @@ CPLoader::Error CPLoader_MOD::load_song(const char *p_file,CPSong *p_song,bool p if (sid.is_null()) { continue; //empty sample, not stored? } - + sm->lock_data(sid); + uint8_t *dataptr = (uint8_t*)sm->get_data(sid); + int len=sm->get_size(sid); for (int s=0;s<len;s++) { uint8_t d=file->get_byte(); //d-=128; //convert to signed int8_t*ds=(int8_t*)&d; - int16_t d16=*ds; - d16<<=8; - sm->set_data( sid, s, d16 ); + dataptr[s]=*ds; } + sm->unlock_data(sid); } file->close(); diff --git a/drivers/chibi/cp_loader_s3m.cpp b/drivers/chibi/cp_loader_s3m.cpp index c21f7bdd38..073f35791c 100644 --- a/drivers/chibi/cp_loader_s3m.cpp +++ b/drivers/chibi/cp_loader_s3m.cpp @@ -196,8 +196,12 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { if (id.is_null()) return FILE_OUT_OF_MEMORY; + + sm->lock_data(id); + void *dataptr = sm->get_data(id); - for (int c=0;c<(data_is_stereo?2:1);c++) { + int chans = (data_is_stereo?2:1); + for (int c=0;c<chans;c++) { for (int i=0;i<sample_size;i++) { if (data_is_16bits) { @@ -206,7 +210,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { s-=32768; //toggle sign int16_t *v=(int16_t*)&s; - sm->set_data(id,i,*v,c); + ((int16_t*)dataptr)[i*chans+c]=*v; } else { @@ -214,16 +218,16 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { uint8_t s=file->get_byte(); s-=128; //toggle sign v=(int8_t*)&s; - int16_t v16=*v; - v16<<=8; - sm->set_data(id,i,v16,c); - + ((int8_t*)dataptr)[i*chans+c]=*v; + } - - + } } + + sm->unlock_data(id); + sm->set_loop_begin( id, loop_begin ); sm->set_loop_end( id, loop_end ); diff --git a/drivers/chibi/cp_loader_xm.cpp b/drivers/chibi/cp_loader_xm.cpp index 8bde6b673e..66f36954ce 100644 --- a/drivers/chibi/cp_loader_xm.cpp +++ b/drivers/chibi/cp_loader_xm.cpp @@ -627,6 +627,10 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool CPSample *sample=song->get_sample(sample_index[j]); CPSample_ID sid=sample->get_sample_data(); + sm->lock_data(sid); + + void*dataptr=sm->get_data(sid); + if (sm->is_16bits( sid)) { int16_t old=0; @@ -638,8 +642,9 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool int16_t sampleval=file->get_word(); newsample=sampleval+old; old=newsample; - - sm->set_data( sid, k, newsample ); + + ((int16_t*)dataptr)[k]=newsample; + //sm->set_data( sid, k, newsample ); } } else { @@ -653,10 +658,15 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool newsample=sampleval+old; old=newsample; - sm->set_data( sid, k, (int16_t)newsample << 8 ); + ((int8_t*)dataptr)[k]=newsample; + + //sm->set_data( sid, k, (int16_t)newsample << 8 ); } } + + sm->unlock_data(sid); + } for (int j=0;j<96;j++) { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f5252cf446..90e3915fec 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -802,7 +802,7 @@ void Node::remove_child(Node *p_child) { } ERR_FAIL_COND( idx==-1 ); - ERR_FAIL_COND( p_child->data.blocked > 0 ); + //ERR_FAIL_COND( p_child->data.blocked > 0 ); //if (data.scene) { does not matter |