|
@@ -48,8 +48,8 @@ bool SamplePlayer::_set(const StringName& p_name, const Variant& p_value) {
|
|
}
|
|
}
|
|
} else if (name=="config/samples")
|
|
} else if (name=="config/samples")
|
|
set_sample_library(p_value);
|
|
set_sample_library(p_value);
|
|
- else if (name=="config/voices")
|
|
|
|
- set_voice_count(p_value);
|
|
|
|
|
|
+ else if (name=="config/polyphony")
|
|
|
|
+ set_polyphony(p_value);
|
|
else if (name.begins_with("default/")) {
|
|
else if (name.begins_with("default/")) {
|
|
|
|
|
|
String what=name.right(8);
|
|
String what=name.right(8);
|
|
@@ -95,8 +95,8 @@ bool SamplePlayer::_get(const StringName& p_name,Variant &r_ret) const {
|
|
|
|
|
|
if (name=="play/play") {
|
|
if (name=="play/play") {
|
|
r_ret=played_back;
|
|
r_ret=played_back;
|
|
- } else if (name=="config/voices") {
|
|
|
|
- r_ret= get_voice_count();
|
|
|
|
|
|
+ } else if (name=="config/polyphony") {
|
|
|
|
+ r_ret= get_polyphony();
|
|
} else if (name=="config/samples") {
|
|
} else if (name=="config/samples") {
|
|
|
|
|
|
r_ret= get_sample_library();
|
|
r_ret= get_sample_library();
|
|
@@ -153,7 +153,7 @@ void SamplePlayer::_get_property_list(List<PropertyInfo> *p_list) const {
|
|
}
|
|
}
|
|
|
|
|
|
p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR));
|
|
p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR));
|
|
- p_list->push_back( PropertyInfo( Variant::INT, "config/voices", PROPERTY_HINT_RANGE, "1,256,1"));
|
|
|
|
|
|
+ p_list->push_back( PropertyInfo( Variant::INT, "config/polyphony", PROPERTY_HINT_RANGE, "1,256,1"));
|
|
p_list->push_back( PropertyInfo( Variant::OBJECT, "config/samples", PROPERTY_HINT_RESOURCE_TYPE, "SampleLibrary"));
|
|
p_list->push_back( PropertyInfo( Variant::OBJECT, "config/samples", PROPERTY_HINT_RESOURCE_TYPE, "SampleLibrary"));
|
|
p_list->push_back( PropertyInfo( Variant::REAL, "default/volume_db", PROPERTY_HINT_RANGE, "-80,24,0.01"));
|
|
p_list->push_back( PropertyInfo( Variant::REAL, "default/volume_db", PROPERTY_HINT_RANGE, "-80,24,0.01"));
|
|
p_list->push_back( PropertyInfo( Variant::REAL, "default/pitch_scale", PROPERTY_HINT_RANGE, "0.01,48,0.01"));
|
|
p_list->push_back( PropertyInfo( Variant::REAL, "default/pitch_scale", PROPERTY_HINT_RANGE, "0.01,48,0.01"));
|
|
@@ -203,14 +203,14 @@ SamplePlayer::Voice::~Voice() {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-void SamplePlayer::set_voice_count(int p_voice_count) {
|
|
|
|
|
|
+void SamplePlayer::set_polyphony(int p_voice_count) {
|
|
|
|
|
|
ERR_FAIL_COND( p_voice_count <1 || p_voice_count >0xFFFE );
|
|
ERR_FAIL_COND( p_voice_count <1 || p_voice_count >0xFFFE );
|
|
|
|
|
|
voices.resize(p_voice_count);
|
|
voices.resize(p_voice_count);
|
|
}
|
|
}
|
|
|
|
|
|
-int SamplePlayer::get_voice_count() const {
|
|
|
|
|
|
+int SamplePlayer::get_polyphony() const {
|
|
|
|
|
|
return voices.size();
|
|
return voices.size();
|
|
}
|
|
}
|
|
@@ -606,8 +606,8 @@ void SamplePlayer::_bind_methods() {
|
|
ObjectTypeDB::bind_method(_MD("set_sample_library","library:SampleLibrary"),&SamplePlayer::set_sample_library );
|
|
ObjectTypeDB::bind_method(_MD("set_sample_library","library:SampleLibrary"),&SamplePlayer::set_sample_library );
|
|
ObjectTypeDB::bind_method(_MD("get_sample_library:SampleLibrary"),&SamplePlayer::get_sample_library );
|
|
ObjectTypeDB::bind_method(_MD("get_sample_library:SampleLibrary"),&SamplePlayer::get_sample_library );
|
|
|
|
|
|
- ObjectTypeDB::bind_method(_MD("set_voice_count","max_voices"),&SamplePlayer::set_voice_count );
|
|
|
|
- ObjectTypeDB::bind_method(_MD("get_voice_count"),&SamplePlayer::get_voice_count );
|
|
|
|
|
|
+ ObjectTypeDB::bind_method(_MD("set_polyphony","max_voices"),&SamplePlayer::set_polyphony );
|
|
|
|
+ ObjectTypeDB::bind_method(_MD("get_polyphony"),&SamplePlayer::get_polyphony );
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("play","name","unique"),&SamplePlayer::play, DEFVAL(false) );
|
|
ObjectTypeDB::bind_method(_MD("play","name","unique"),&SamplePlayer::play, DEFVAL(false) );
|
|
ObjectTypeDB::bind_method(_MD("stop","voice"),&SamplePlayer::stop );
|
|
ObjectTypeDB::bind_method(_MD("stop","voice"),&SamplePlayer::stop );
|
|
@@ -677,6 +677,8 @@ void SamplePlayer::_bind_methods() {
|
|
BIND_CONSTANT( REVERB_LARGE );
|
|
BIND_CONSTANT( REVERB_LARGE );
|
|
BIND_CONSTANT( REVERB_HALL );
|
|
BIND_CONSTANT( REVERB_HALL );
|
|
|
|
|
|
|
|
+ BIND_CONSTANT( INVALID_VOICE_ID );
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|