diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/area.cpp | 2 | ||||
-rw-r--r-- | scene/3d/baked_light_instance.cpp | 3 | ||||
-rw-r--r-- | scene/3d/body_shape.cpp | 2 | ||||
-rw-r--r-- | scene/3d/bone_attachment.cpp | 4 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 2 | ||||
-rw-r--r-- | scene/3d/character_camera.cpp | 4 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 1 | ||||
-rw-r--r-- | scene/3d/light.cpp | 2 | ||||
-rw-r--r-- | scene/3d/mesh_instance.cpp | 2 | ||||
-rw-r--r-- | scene/3d/navigation.cpp | 4 | ||||
-rw-r--r-- | scene/3d/room_instance.cpp | 46 | ||||
-rw-r--r-- | scene/3d/room_instance.h | 10 | ||||
-rw-r--r-- | scene/3d/spatial_player.cpp | 135 | ||||
-rw-r--r-- | scene/3d/spatial_player.h | 87 | ||||
-rw-r--r-- | scene/3d/spatial_sample_player.cpp | 241 | ||||
-rw-r--r-- | scene/3d/spatial_sample_player.h | 90 | ||||
-rw-r--r-- | scene/3d/spatial_stream_player.cpp | 407 | ||||
-rw-r--r-- | scene/3d/spatial_stream_player.h | 120 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 4 |
19 files changed, 18 insertions, 1148 deletions
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 99e40984c5..3301c4d754 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -664,7 +664,7 @@ void Area::_bind_methods() { Area::Area() : CollisionObject(PhysicsServer::get_singleton()->area_create(),true) { space_override=SPACE_OVERRIDE_DISABLED; - set_gravity(9.8);; + set_gravity(9.8); locked=false; set_gravity_vector(Vector3(0,-1,0)); gravity_is_point=false; diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index e42439bf3b..514c73a488 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -943,7 +943,7 @@ void BakedLight::_bake_light(Light* p_light) { Vector3 light_dir = -rel_xf.basis.get_axis(2); Color color = dl->get_color(); - float nrg = dl->get_param(Light::PARAM_ENERGY);; + float nrg = dl->get_param(Light::PARAM_ENERGY); color.r*=nrg; color.g*=nrg; color.b*=nrg; @@ -1705,7 +1705,6 @@ void BakedLight::create_debug_mesh(DebugMode p_mode) { #else mmi->set_owner(get_owner()); #endif - } void BakedLight::_debug_mesh_albedo() { diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index f6ec8639d3..f3c839d525 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -506,7 +506,7 @@ void CollisionShape::_create_debug_shape() { if (debug_shape) { - debug_shape->queue_delete();; + debug_shape->queue_delete(); debug_shape=NULL; } diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp index c3ab2df939..825cf1c535 100644 --- a/scene/3d/bone_attachment.cpp +++ b/scene/3d/bone_attachment.cpp @@ -79,7 +79,7 @@ void BoneAttachment::_check_bind() { Skeleton *sk = get_parent()->cast_to<Skeleton>(); int idx = sk->find_bone(bone_name); if (idx!=-1) { - sk->bind_child_node_to_bone(idx,this);; + sk->bind_child_node_to_bone(idx,this); set_transform(sk->get_bone_global_pose(idx)); bound=true; } @@ -94,7 +94,7 @@ void BoneAttachment::_check_unbind() { Skeleton *sk = get_parent()->cast_to<Skeleton>(); int idx = sk->find_bone(bone_name); if (idx!=-1) { - sk->unbind_child_node_from_bone(idx,this);; + sk->unbind_child_node_from_bone(idx,this); } } bound=false; diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 3f36caf62c..5bd2c771ee 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -644,7 +644,7 @@ Vector<Plane> Camera::get_frustum() const { void Camera::set_v_offset(float p_offset) { v_offset=p_offset; - _update_camera();; + _update_camera(); } float Camera::get_v_offset() const { diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp index b4cd46bd35..211619d0df 100644 --- a/scene/3d/character_camera.cpp +++ b/scene/3d/character_camera.cpp @@ -97,7 +97,7 @@ void CharacterCamera::_get_property_list( List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo( Variant::INT, "type", PROPERTY_HINT_ENUM, "Fixed,Follow") ); p_list->push_back( PropertyInfo( Variant::VECTOR2, "orbit" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "height", PROPERTY_HINT_RANGE,"-1024,1024,0.01" ) ); - p_list->push_back( PropertyInfo( Variant::REAL, "inclination", PROPERTY_HINT_RANGE,"-90,90,0.01" ) ); ; + p_list->push_back( PropertyInfo( Variant::REAL, "inclination", PROPERTY_HINT_RANGE,"-90,90,0.01" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "max_orbit_x", PROPERTY_HINT_RANGE,"-90,90,0.01" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "min_orbit_x", PROPERTY_HINT_RANGE,"-90,90,0.01" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "min_distance", PROPERTY_HINT_RANGE,"0,100,0.01" ) ); @@ -168,7 +168,7 @@ void CharacterCamera::_compute_camera() { Vector3 vec1 = accepted.origin; Vector3 vec2 = proposed.origin; - final.origin = vec2.linear_interpolate(vec1, pos_ratio * time);; + final.origin = vec2.linear_interpolate(vec1, pos_ratio * time); Quat q1 = accepted.basis; Quat q2 = proposed.basis; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 54d7cb6b9e..8035ce1cc7 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1324,7 +1324,6 @@ void GIProbe::_create_debug_mesh(Baker *p_baker) { #else mmi->set_owner(get_owner()); #endif - } void GIProbe::_debug_bake() { diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index d685cd8ce7..0c6c113dd2 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -47,7 +47,7 @@ void Light::set_param(Param p_param, float p_value) { VS::get_singleton()->light_set_param(light,VS::LightParam(p_param),p_value); if (p_param==PARAM_SPOT_ANGLE || p_param==PARAM_RANGE) { - update_gizmo();; + update_gizmo(); } diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 764aff1c08..2198f538b8 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -91,7 +91,7 @@ void MeshInstance::_get_property_list( List<PropertyInfo> *p_list) const { ls.push_back(E->key()); } - ls.sort();; + ls.sort(); for(List<String>::Element *E=ls.front();E;E=E->next()) { p_list->push_back( PropertyInfo(Variant::REAL,E->get(),PROPERTY_HINT_RANGE,"0,1,0.01")); diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index 9bb19880bf..38893598d6 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -129,7 +129,7 @@ void Navigation::_navmesh_link(int p_id) { C->get().B=&p; C->get().B_edge=j; C->get().A->edges[C->get().A_edge].C=&p; - C->get().A->edges[C->get().A_edge].C_edge=j;; + C->get().A->edges[C->get().A_edge].C_edge=j; p.edges[j].C=C->get().A; p.edges[j].C_edge=C->get().A_edge; //connection successful. @@ -550,7 +550,7 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3& p_start, const Vector path.push_back(begin_point); - path.invert();; + path.invert(); } return path; diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index cdca54cd84..a2e1a48781 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -56,17 +56,11 @@ void Room::_notification(int p_what) { } - if (sound_enabled) - SpatialSoundServer::get_singleton()->room_set_space(sound_room,get_world()->get_sound_space()); - } break; case NOTIFICATION_TRANSFORM_CHANGED: { - SpatialSoundServer::get_singleton()->room_set_transform(sound_room,get_global_transform()); } break; case NOTIFICATION_EXIT_WORLD: { - if (sound_enabled) - SpatialSoundServer::get_singleton()->room_set_space(sound_room,RID()); } break; @@ -158,61 +152,27 @@ void Room::_parse_node_faces(PoolVector<Face3> &all_faces,const Node *p_node) co -void Room::set_simulate_acoustics(bool p_enable) { - - if (sound_enabled==p_enable) - return; - - sound_enabled=p_enable; - if (!is_inside_world()) - return; //nothing to do - - if (sound_enabled) - SpatialSoundServer::get_singleton()->room_set_space(sound_room,get_world()->get_sound_space()); - else - SpatialSoundServer::get_singleton()->room_set_space(sound_room,RID()); - - -} - void Room::_bounds_changed() { update_gizmo(); } -bool Room::is_simulating_acoustics() const { - - return sound_enabled; -} - -RID Room::get_sound_room() const { - - return RID(); -} - void Room::_bind_methods() { ClassDB::bind_method(_MD("set_room","room:Room"),&Room::set_room ); ClassDB::bind_method(_MD("get_room:Room"),&Room::get_room ); - - ClassDB::bind_method(_MD("set_simulate_acoustics","enable"),&Room::set_simulate_acoustics ); - ClassDB::bind_method(_MD("is_simulating_acoustics"),&Room::is_simulating_acoustics ); - - - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "room/room", PROPERTY_HINT_RESOURCE_TYPE, "Area" ), _SCS("set_room"), _SCS("get_room") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "room/simulate_acoustics"), _SCS("set_simulate_acoustics"), _SCS("is_simulating_acoustics") ); + } Room::Room() { - sound_enabled=false; - sound_room=SpatialSoundServer::get_singleton()->room_create(); +// sound_enabled=false; level=0; @@ -222,6 +182,6 @@ Room::Room() { Room::~Room() { - SpatialSoundServer::get_singleton()->free(sound_room); + } diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index 145589a780..cbc1b12b7e 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -31,7 +31,7 @@ #include "scene/3d/visual_instance.h" #include "scene/resources/room.h" -#include "servers/spatial_sound_server.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -58,9 +58,6 @@ public: private: Ref<RoomBounds> room; - RID sound_room; - - bool sound_enabled; int level; void _parse_node_faces(PoolVector<Face3> &all_faces,const Node *p_node) const; @@ -88,11 +85,6 @@ public: void set_room( const Ref<RoomBounds>& p_room ); Ref<RoomBounds> get_room() const; - void set_simulate_acoustics(bool p_enable); - bool is_simulating_acoustics() const; - - - RID get_sound_room() const; Room(); ~Room(); diff --git a/scene/3d/spatial_player.cpp b/scene/3d/spatial_player.cpp deleted file mode 100644 index 6a368d771a..0000000000 --- a/scene/3d/spatial_player.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************/ -/* spatial_player.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "spatial_player.h" - -#include "servers/audio_server.h" -#include "camera.h" -#include "servers/spatial_sound_server.h" -#include "scene/resources/surface_tool.h" - - -void SpatialPlayer::_notification(int p_what) { - - - switch(p_what) { - - case NOTIFICATION_ENTER_WORLD: { - //find the sound space - - source_rid = SpatialSoundServer::get_singleton()->source_create(get_world()->get_sound_space()); - for(int i=0;i<PARAM_MAX;i++) - set_param(Param(i),params[i]); - - - } break; - case NOTIFICATION_TRANSFORM_CHANGED: { - - SpatialSoundServer::get_singleton()->source_set_transform(source_rid,get_global_transform()); - - } break; - case NOTIFICATION_EXIT_WORLD: { - - if (source_rid.is_valid()) - SpatialSoundServer::get_singleton()->free(source_rid); - - } break; - } - -} - - -void SpatialPlayer::set_param( Param p_param, float p_value) { - - ERR_FAIL_INDEX(p_param,PARAM_MAX); - params[p_param]=p_value; - if (p_param==PARAM_EMISSION_CONE_DEGREES) { - update_gizmo(); - } - if (source_rid.is_valid()) - SpatialSoundServer::get_singleton()->source_set_param(source_rid,(SpatialSoundServer::SourceParam)p_param,p_value); - -} - -float SpatialPlayer::get_param( Param p_param) const { - - ERR_FAIL_INDEX_V(p_param,PARAM_MAX,0); - return params[p_param]; - -} - -bool SpatialPlayer::_can_gizmo_scale() const { - - return false; -} - -void SpatialPlayer::_bind_methods() { - - - ClassDB::bind_method(_MD("set_param","param","value"),&SpatialPlayer::set_param); - ClassDB::bind_method(_MD("get_param","param"),&SpatialPlayer::get_param); - - BIND_CONSTANT( PARAM_VOLUME_DB ); - BIND_CONSTANT( PARAM_PITCH_SCALE ); - BIND_CONSTANT( PARAM_ATTENUATION_MIN_DISTANCE ); - BIND_CONSTANT( PARAM_ATTENUATION_MAX_DISTANCE ); - BIND_CONSTANT( PARAM_ATTENUATION_DISTANCE_EXP ); - BIND_CONSTANT( PARAM_EMISSION_CONE_DEGREES ); - BIND_CONSTANT( PARAM_EMISSION_CONE_ATTENUATION_DB ); - BIND_CONSTANT( PARAM_MAX ); - - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "volume_db",PROPERTY_HINT_RANGE, "-80,24,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_VOLUME_DB); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pitch_scale",PROPERTY_HINT_RANGE, "0.001,32,0.001"),_SCS("set_param"),_SCS("get_param"),PARAM_PITCH_SCALE); - ADD_GROUP("Attenuation","attenuation_"); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "attenuation_min_distance",PROPERTY_HINT_RANGE, "0.01,4096,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_MIN_DISTANCE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "attenuation_max_distance",PROPERTY_HINT_RANGE, "0.01,4096,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_MAX_DISTANCE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "attenuation_distance_exp",PROPERTY_HINT_EXP_EASING, "attenuation"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_DISTANCE_EXP); - ADD_GROUP("Emission Cone","emission_cone_"); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "emission_cone_degrees",PROPERTY_HINT_RANGE, "0,180,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_EMISSION_CONE_DEGREES); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "emission_cone_attenuation_db",PROPERTY_HINT_RANGE, "-80,24,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_EMISSION_CONE_ATTENUATION_DB); - -} - - -SpatialPlayer::SpatialPlayer() { - - params[PARAM_VOLUME_DB]=0.0; - params[PARAM_PITCH_SCALE]=1.0; - params[PARAM_ATTENUATION_MIN_DISTANCE]=1; - params[PARAM_ATTENUATION_MAX_DISTANCE]=100; - params[PARAM_ATTENUATION_DISTANCE_EXP]=1.0; //linear (and not really good) - params[PARAM_EMISSION_CONE_DEGREES]=180.0; //cone disabled - params[PARAM_EMISSION_CONE_ATTENUATION_DB]=-6.0; //minus 6 db attenuation - set_notify_transform(true); - -} - -SpatialPlayer::~SpatialPlayer() { - - -} diff --git a/scene/3d/spatial_player.h b/scene/3d/spatial_player.h deleted file mode 100644 index 16671a0cb5..0000000000 --- a/scene/3d/spatial_player.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************/ -/* spatial_player.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef SPATIAL_PLAYER_H -#define SPATIAL_PLAYER_H - - -#include "scene/3d/spatial.h" -#include "scene/main/node.h" -#include "scene/resources/sample_library.h" -#include "servers/spatial_sound_server.h" -#include "scene/main/viewport.h" - -class SpatialPlayer : public Spatial { - - GDCLASS(SpatialPlayer,Spatial); -public: - - - enum Param { - - PARAM_VOLUME_DB=SpatialSoundServer::SOURCE_PARAM_VOLUME_DB, - PARAM_PITCH_SCALE=SpatialSoundServer::SOURCE_PARAM_PITCH_SCALE, - PARAM_ATTENUATION_MIN_DISTANCE=SpatialSoundServer::SOURCE_PARAM_ATTENUATION_MIN_DISTANCE, - PARAM_ATTENUATION_MAX_DISTANCE=SpatialSoundServer::SOURCE_PARAM_ATTENUATION_MAX_DISTANCE, - PARAM_ATTENUATION_DISTANCE_EXP=SpatialSoundServer::SOURCE_PARAM_ATTENUATION_DISTANCE_EXP, - PARAM_EMISSION_CONE_DEGREES=SpatialSoundServer::SOURCE_PARAM_EMISSION_CONE_DEGREES, - PARAM_EMISSION_CONE_ATTENUATION_DB=SpatialSoundServer::SOURCE_PARAM_EMISSION_CONE_ATTENUATION_DB, - PARAM_MAX=SpatialSoundServer::SOURCE_PARAM_MAX - }; - -private: - - float params[PARAM_MAX]; - RID source_rid; - - virtual bool _can_gizmo_scale() const; - - - -protected: - - _FORCE_INLINE_ RID get_source_rid() const { return source_rid; } - - void _notification(int p_what); - - static void _bind_methods(); - -public: - - void set_param( Param p_param, float p_value); - float get_param( Param p_param) const; - - - SpatialPlayer(); - ~SpatialPlayer(); - - -}; - -VARIANT_ENUM_CAST( SpatialPlayer::Param ); -#endif // SPATIAL_PLAYER_H diff --git a/scene/3d/spatial_sample_player.cpp b/scene/3d/spatial_sample_player.cpp deleted file mode 100644 index 3e1c0e9947..0000000000 --- a/scene/3d/spatial_sample_player.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/*************************************************************************/ -/* spatial_sample_player.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "spatial_sample_player.h" - -#include "servers/audio_server.h" -#include "camera.h" -#include "servers/spatial_sound_server.h" -#include "scene/scene_string_names.h" - -bool SpatialSamplePlayer::_set(const StringName& p_name, const Variant& p_value) { - - String name=p_name; - - if (name==SceneStringNames::get_singleton()->play_play) { - if (library.is_valid()) { - - String what=p_value; - if (what=="") - stop_all(); - else - play(what); - - played_back=what; - } - return true; - - } - - return false; -} - -bool SpatialSamplePlayer::_get(const StringName& p_name,Variant &r_ret) const { - - - String name=p_name; - - if (name==SceneStringNames::get_singleton()->play_play) { - r_ret=played_back; - return true; - } - - return false; -} - -void SpatialSamplePlayer::_get_property_list(List<PropertyInfo> *p_list) const { - - String en=""; - if (library.is_valid()) { - List<StringName> samples; - Ref<SampleLibrary> ncl=library; - ncl->get_sample_list(&samples); - for (List<StringName>::Element *E=samples.front();E;E=E->next()) { - - en+=","; - en+=E->get(); - } - } - - p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_ANIMATE_AS_TRIGGER)); - -} -void SpatialSamplePlayer::_notification(int p_what) { - - - switch(p_what) { - - case NOTIFICATION_ENTER_WORLD: { - - SpatialSoundServer::get_singleton()->source_set_polyphony(get_source_rid(),polyphony); - - - } break; - } - -} - -void SpatialSamplePlayer::set_sample_library(const Ref<SampleLibrary>& p_library) { - - library=p_library; - _change_notify(); - update_configuration_warning(); -} - -Ref<SampleLibrary> SpatialSamplePlayer::get_sample_library() const { - - return library; -} - -void SpatialSamplePlayer::set_polyphony(int p_voice_count) { - - ERR_FAIL_COND(p_voice_count<0 || p_voice_count>64); - polyphony=p_voice_count; - if (get_source_rid().is_valid()) - SpatialSoundServer::get_singleton()->source_set_polyphony(get_source_rid(),polyphony); - -} - -int SpatialSamplePlayer::get_polyphony() const { - - return polyphony; -} - -SpatialSamplePlayer::VoiceID SpatialSamplePlayer::play(const String& p_sample,int p_voice) { - - if (!get_source_rid().is_valid()) - return INVALID_VOICE; - if (library.is_null()) - return INVALID_VOICE; - if (!library->has_sample(p_sample)) - return INVALID_VOICE; - Ref<Sample> sample = library->get_sample(p_sample); - float vol_change = library->sample_get_volume_db(p_sample); - float pitch_change = library->sample_get_pitch_scale(p_sample); - - VoiceID vid = SpatialSoundServer::get_singleton()->source_play_sample(get_source_rid(),sample->get_rid(),sample->get_mix_rate()*pitch_change,p_voice); - if (vol_change) - SpatialSoundServer::get_singleton()->source_voice_set_volume_scale_db(get_source_rid(),vid,vol_change); - - return vid; - - -} -//voices -void SpatialSamplePlayer::voice_set_pitch_scale(VoiceID p_voice, float p_pitch_scale) { - - if (!get_source_rid().is_valid()) - return; - - SpatialSoundServer::get_singleton()->source_voice_set_pitch_scale(get_source_rid(),p_voice,p_pitch_scale); - -} - -void SpatialSamplePlayer::voice_set_volume_scale_db(VoiceID p_voice, float p_volume_db) { - - if (!get_source_rid().is_valid()) - return; - SpatialSoundServer::get_singleton()->source_voice_set_volume_scale_db(get_source_rid(),p_voice,p_volume_db); - -} - -bool SpatialSamplePlayer::is_voice_active(VoiceID p_voice) const { - - if (!get_source_rid().is_valid()) - return false; - return SpatialSoundServer::get_singleton()->source_is_voice_active(get_source_rid(),p_voice); - -} - -void SpatialSamplePlayer::stop_voice(VoiceID p_voice) { - - if (!get_source_rid().is_valid()) - return; - SpatialSoundServer::get_singleton()->source_stop_voice(get_source_rid(),p_voice); - -} - -void SpatialSamplePlayer::stop_all() { - - if (!get_source_rid().is_valid()) - return; - - for(int i=0;i<polyphony;i++) { - - SpatialSoundServer::get_singleton()->source_stop_voice(get_source_rid(),i); - } -} - -String SpatialSamplePlayer::get_configuration_warning() const { - - if (library.is_null()) { - return TTR("A SampleLibrary resource must be created or set in the 'samples' property in order for SpatialSamplePlayer to play sound."); - } - - return String(); -} - - -void SpatialSamplePlayer::_bind_methods() { - - - ClassDB::bind_method(_MD("set_sample_library","library:SampleLibrary"),&SpatialSamplePlayer::set_sample_library); - ClassDB::bind_method(_MD("get_sample_library:SampleLibrary"),&SpatialSamplePlayer::get_sample_library); - - ClassDB::bind_method(_MD("set_polyphony","voices"),&SpatialSamplePlayer::set_polyphony); - ClassDB::bind_method(_MD("get_polyphony"),&SpatialSamplePlayer::get_polyphony); - - ClassDB::bind_method(_MD("play","sample","voice"),&SpatialSamplePlayer::play,DEFVAL(NEXT_VOICE)); - //voices,DEV - ClassDB::bind_method(_MD("voice_set_pitch_scale","voice","ratio"),&SpatialSamplePlayer::voice_set_pitch_scale); - ClassDB::bind_method(_MD("voice_set_volume_scale_db","voice","db"),&SpatialSamplePlayer::voice_set_volume_scale_db); - - ClassDB::bind_method(_MD("is_voice_active","voice"),&SpatialSamplePlayer::is_voice_active); - ClassDB::bind_method(_MD("stop_voice","voice"),&SpatialSamplePlayer::stop_voice); - ClassDB::bind_method(_MD("stop_all"),&SpatialSamplePlayer::stop_all); - - BIND_CONSTANT( INVALID_VOICE ); - BIND_CONSTANT( NEXT_VOICE ); - - ADD_PROPERTY( PropertyInfo( Variant::INT, "polyphony", PROPERTY_HINT_RANGE, "1,64,1"),_SCS("set_polyphony"),_SCS("get_polyphony")); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "samples", PROPERTY_HINT_RESOURCE_TYPE,"SampleLibrary"),_SCS("set_sample_library"),_SCS("get_sample_library")); - - -} - - -SpatialSamplePlayer::SpatialSamplePlayer() { - - polyphony=1; - -} - -SpatialSamplePlayer::~SpatialSamplePlayer() { - - -} diff --git a/scene/3d/spatial_sample_player.h b/scene/3d/spatial_sample_player.h deleted file mode 100644 index d30ff6e908..0000000000 --- a/scene/3d/spatial_sample_player.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************/ -/* spatial_sample_player.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef SPATIAL_SAMPLE_PLAYER_H -#define SPATIAL_SAMPLE_PLAYER_H - -#include "scene/3d/spatial_player.h" -#include "scene/resources/sample_library.h" -#include "servers/spatial_sound_server.h" - -class SpatialSamplePlayer : public SpatialPlayer { - - GDCLASS(SpatialSamplePlayer,SpatialPlayer); -public: - - enum { - - INVALID_VOICE=SpatialSoundServer::SOURCE_INVALID_VOICE, - NEXT_VOICE=SpatialSoundServer::SOURCE_NEXT_VOICE - }; - - typedef int VoiceID; - - -private: - - Ref<SampleLibrary> library; - int polyphony; - String played_back; -protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; - - void _notification(int p_what); - static void _bind_methods(); - -public: - - void set_sample_library(const Ref<SampleLibrary>& p_library); - Ref<SampleLibrary> get_sample_library() const; - - void set_polyphony(int p_voice_count); - int get_polyphony() const; - - VoiceID play(const String& p_sample,int p_voice=NEXT_VOICE); - //voices - void voice_set_pitch_scale(VoiceID p_voice, float p_pitch_scale); - void voice_set_volume_scale_db(VoiceID p_voice, float p_volume_db); - - bool is_voice_active(VoiceID p_voice) const; - void stop_voice(VoiceID p_voice); - void stop_all(); - - String get_configuration_warning() const; - - SpatialSamplePlayer(); - ~SpatialSamplePlayer(); - - -}; - - -#endif // SPATIAL_SAMPLE_PLAYER_H diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp deleted file mode 100644 index 1f9765c1d3..0000000000 --- a/scene/3d/spatial_stream_player.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/*************************************************************************/ -/* spatial_stream_player.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "spatial_stream_player.h" - - - -int SpatialStreamPlayer::InternalStream::get_channel_count() const { - - return player->sp_get_channel_count(); -} -void SpatialStreamPlayer::InternalStream::set_mix_rate(int p_rate){ - - return player->sp_set_mix_rate(p_rate); -} -bool SpatialStreamPlayer::InternalStream::mix(int32_t *p_buffer,int p_frames){ - - return player->sp_mix(p_buffer,p_frames); -} -void SpatialStreamPlayer::InternalStream::update(){ - - player->sp_update(); -} - - -int SpatialStreamPlayer::sp_get_channel_count() const { - - return playback->get_channels(); -} - -void SpatialStreamPlayer::sp_set_mix_rate(int p_rate){ - - server_mix_rate=p_rate; -} - -bool SpatialStreamPlayer::sp_mix(int32_t *p_buffer,int p_frames) { - - if (resampler.is_ready() && !paused) { - return resampler.mix(p_buffer,p_frames); - } - - return false; -} - -void SpatialStreamPlayer::sp_update() { - - _THREAD_SAFE_METHOD_ - if (!paused && resampler.is_ready() && playback.is_valid()) { - - if (!playback->is_playing()) { - //stream depleted data, but there's still audio in the ringbuffer - //check that all this audio has been flushed before stopping the stream - int to_mix = resampler.get_total() - resampler.get_todo(); - if (to_mix==0) { - stop(); - return; - } - - return; - } - - int todo =resampler.get_todo(); - int wrote = playback->mix(resampler.get_write_buffer(),todo); - resampler.write(wrote); - } -} - - - -void SpatialStreamPlayer::_notification(int p_what) { - - switch(p_what) { - - case NOTIFICATION_ENTER_TREE: { - - //set_idle_process(false); //don't annoy - if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) - play(); - } break; - case NOTIFICATION_EXIT_TREE: { - - stop(); //wathever it may be doing, stop - } break; - } -} - - - -void SpatialStreamPlayer::set_stream(const Ref<AudioStream> &p_stream) { - - stop(); - - stream=p_stream; - - if (!stream.is_null()) { - playback=stream->instance_playback(); - playback->set_loop(loops); - playback->set_loop_restart_time(loop_point); - AudioServer::get_singleton()->lock(); - resampler.setup(playback->get_channels(),playback->get_mix_rate(),server_mix_rate,buffering_ms,playback->get_minimum_buffer_size()); - AudioServer::get_singleton()->unlock(); - } else { - AudioServer::get_singleton()->lock(); - resampler.clear(); - playback.unref(); - AudioServer::get_singleton()->unlock(); - } -} - -Ref<AudioStream> SpatialStreamPlayer::get_stream() const { - - return stream; -} - - -void SpatialStreamPlayer::play(float p_from_offset) { - - ERR_FAIL_COND(!is_inside_tree()); - if (playback.is_null()) - return; - if (playback->is_playing()) - stop(); - - _THREAD_SAFE_METHOD_ - playback->play(p_from_offset); - //feed the ringbuffer as long as no update callback is going on - sp_update(); - - SpatialSoundServer::get_singleton()->source_set_audio_stream(get_source_rid(),&internal_stream); - - /* - AudioServer::get_singleton()->stream_set_active(stream_rid,true); - AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,volume); - if (stream->get_update_mode()!=AudioStream::UPDATE_NONE) - set_idle_process(true); - */ - -} - -void SpatialStreamPlayer::stop() { - - if (!is_inside_tree()) - return; - if (playback.is_null()) - return; - - _THREAD_SAFE_METHOD_ - //AudioServer::get_singleton()->stream_set_active(stream_rid,false); - SpatialSoundServer::get_singleton()->source_set_audio_stream(get_source_rid(),NULL); - playback->stop(); - resampler.flush(); - //set_idle_process(false); -} - -bool SpatialStreamPlayer::is_playing() const { - - if (playback.is_null()) - return false; - - return playback->is_playing(); -} - -void SpatialStreamPlayer::set_loop(bool p_enable) { - - loops=p_enable; - if (playback.is_null()) - return; - playback->set_loop(loops); - -} -bool SpatialStreamPlayer::has_loop() const { - - return loops; -} - -void SpatialStreamPlayer::set_volume(float p_vol) { - - volume=p_vol; - if (stream_rid.is_valid()) - AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,volume); -} - -float SpatialStreamPlayer::get_volume() const { - - return volume; -} - -void SpatialStreamPlayer::set_loop_restart_time(float p_secs) { - - loop_point=p_secs; - if (playback.is_valid()) - playback->set_loop_restart_time(p_secs); -} - -float SpatialStreamPlayer::get_loop_restart_time() const { - - return loop_point; -} - - -void SpatialStreamPlayer::set_volume_db(float p_db) { - - if (p_db<-79) - set_volume(0); - else - set_volume(Math::db2linear(p_db)); -} - -float SpatialStreamPlayer::get_volume_db() const { - - if (volume==0) - return -80; - else - return Math::linear2db(volume); -} - - -String SpatialStreamPlayer::get_stream_name() const { - - if (stream.is_null()) - return "<No Stream>"; - return stream->get_name(); - -} - -int SpatialStreamPlayer::get_loop_count() const { - - if (playback.is_null()) - return 0; - return playback->get_loop_count(); - -} - -float SpatialStreamPlayer::get_pos() const { - - if (playback.is_null()) - return 0; - return playback->get_pos(); - -} - -float SpatialStreamPlayer::get_length() const { - - if (playback.is_null()) - return 0; - return playback->get_length(); -} -void SpatialStreamPlayer::seek_pos(float p_time) { - - if (playback.is_null()) - return; - return playback->seek_pos(p_time); - -} - -void SpatialStreamPlayer::set_autoplay(bool p_enable) { - - autoplay=p_enable; -} - -bool SpatialStreamPlayer::has_autoplay() const { - - return autoplay; -} - -void SpatialStreamPlayer::set_paused(bool p_paused) { - - paused=p_paused; - /* - if (stream.is_valid()) - stream->set_paused(p_paused); - */ -} - -bool SpatialStreamPlayer::is_paused() const { - - return paused; -} - -void SpatialStreamPlayer::_set_play(bool p_play) { - - _play=p_play; - if (is_inside_tree()) { - if(_play) - play(); - else - stop(); - } - -} - -bool SpatialStreamPlayer::_get_play() const{ - - return _play; -} - -void SpatialStreamPlayer::set_buffering_msec(int p_msec) { - - buffering_ms=p_msec; -} - -int SpatialStreamPlayer::get_buffering_msec() const{ - - return buffering_ms; -} - - - -void SpatialStreamPlayer::_bind_methods() { - - ClassDB::bind_method(_MD("set_stream","stream:AudioStream"),&SpatialStreamPlayer::set_stream); - ClassDB::bind_method(_MD("get_stream:AudioStream"),&SpatialStreamPlayer::get_stream); - - ClassDB::bind_method(_MD("play","offset"),&SpatialStreamPlayer::play,DEFVAL(0)); - ClassDB::bind_method(_MD("stop"),&SpatialStreamPlayer::stop); - - ClassDB::bind_method(_MD("is_playing"),&SpatialStreamPlayer::is_playing); - - ClassDB::bind_method(_MD("set_paused","paused"),&SpatialStreamPlayer::set_paused); - ClassDB::bind_method(_MD("is_paused"),&SpatialStreamPlayer::is_paused); - - ClassDB::bind_method(_MD("set_loop","enabled"),&SpatialStreamPlayer::set_loop); - ClassDB::bind_method(_MD("has_loop"),&SpatialStreamPlayer::has_loop); - - ClassDB::bind_method(_MD("set_volume","volume"),&SpatialStreamPlayer::set_volume); - ClassDB::bind_method(_MD("get_volume"),&SpatialStreamPlayer::get_volume); - - ClassDB::bind_method(_MD("set_volume_db","db"),&SpatialStreamPlayer::set_volume_db); - ClassDB::bind_method(_MD("get_volume_db"),&SpatialStreamPlayer::get_volume_db); - - ClassDB::bind_method(_MD("set_buffering_msec","msec"),&SpatialStreamPlayer::set_buffering_msec); - ClassDB::bind_method(_MD("get_buffering_msec"),&SpatialStreamPlayer::get_buffering_msec); - - ClassDB::bind_method(_MD("set_loop_restart_time","secs"),&SpatialStreamPlayer::set_loop_restart_time); - ClassDB::bind_method(_MD("get_loop_restart_time"),&SpatialStreamPlayer::get_loop_restart_time); - - ClassDB::bind_method(_MD("get_stream_name"),&SpatialStreamPlayer::get_stream_name); - ClassDB::bind_method(_MD("get_loop_count"),&SpatialStreamPlayer::get_loop_count); - - ClassDB::bind_method(_MD("get_pos"),&SpatialStreamPlayer::get_pos); - ClassDB::bind_method(_MD("seek_pos","time"),&SpatialStreamPlayer::seek_pos); - - ClassDB::bind_method(_MD("set_autoplay","enabled"),&SpatialStreamPlayer::set_autoplay); - ClassDB::bind_method(_MD("has_autoplay"),&SpatialStreamPlayer::has_autoplay); - - ClassDB::bind_method(_MD("get_length"),&SpatialStreamPlayer::get_length); - - ClassDB::bind_method(_MD("_set_play","play"),&SpatialStreamPlayer::_set_play); - ClassDB::bind_method(_MD("_get_play"),&SpatialStreamPlayer::_get_play); - - ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE,"AudioStream"), _SCS("set_stream"), _SCS("get_stream") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "play"), _SCS("_set_play"), _SCS("_get_play") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "loop"), _SCS("set_loop"), _SCS("has_loop") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE,"-80,24,0.01"), _SCS("set_volume_db"), _SCS("get_volume_db") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "autoplay"), _SCS("set_autoplay"), _SCS("has_autoplay") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "paused"), _SCS("set_paused"), _SCS("is_paused") ); - ADD_PROPERTY( PropertyInfo(Variant::INT, "loop_restart_time"), _SCS("set_loop_restart_time"), _SCS("get_loop_restart_time") ); - ADD_PROPERTY( PropertyInfo(Variant::INT, "buffering_ms"), _SCS("set_buffering_msec"), _SCS("get_buffering_msec") ); -} - - -SpatialStreamPlayer::SpatialStreamPlayer() { - - volume=1; - loops=false; - paused=false; - autoplay=false; - _play=false; - server_mix_rate=1; - internal_stream.player=this; - stream_rid=AudioServer::get_singleton()->audio_stream_create(&internal_stream); - buffering_ms=500; - loop_point=0; - -} - -SpatialStreamPlayer::~SpatialStreamPlayer() { - AudioServer::get_singleton()->free(stream_rid); - resampler.clear(); - - -} diff --git a/scene/3d/spatial_stream_player.h b/scene/3d/spatial_stream_player.h deleted file mode 100644 index 27533d3f6e..0000000000 --- a/scene/3d/spatial_stream_player.h +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************/ -/* spatial_stream_player.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef SPATIAL_STREAM_PLAYER_H -#define SPATIAL_STREAM_PLAYER_H - -#include "scene/resources/audio_stream.h" -#include "scene/3d/spatial_player.h" -#include "servers/audio/audio_rb_resampler.h" - -class SpatialStreamPlayer : public SpatialPlayer { - - GDCLASS(SpatialStreamPlayer,SpatialPlayer); - - _THREAD_SAFE_CLASS_ - - struct InternalStream : public AudioServer::AudioStream { - SpatialStreamPlayer *player; - virtual int get_channel_count() const; - virtual void set_mix_rate(int p_rate); //notify the stream of the mix rate - virtual bool mix(int32_t *p_buffer,int p_frames); - virtual void update(); - }; - - - InternalStream internal_stream; - Ref<AudioStreamPlayback> playback; - Ref<AudioStream> stream; - - int sp_get_channel_count() const; - void sp_set_mix_rate(int p_rate); //notify the stream of the mix rate - bool sp_mix(int32_t *p_buffer,int p_frames); - void sp_update(); - - int server_mix_rate; - - RID stream_rid; - bool paused; - bool autoplay; - bool loops; - float volume; - float loop_point; - int buffering_ms; - - AudioRBResampler resampler; - - bool _play; - void _set_play(bool p_play); - bool _get_play() const; -protected: - void _notification(int p_what); - - static void _bind_methods(); -public: - - void set_stream(const Ref<AudioStream> &p_stream); - Ref<AudioStream> get_stream() const; - - void play(float p_from_offset=0); - void stop(); - bool is_playing() const; - - void set_paused(bool p_paused); - bool is_paused() const; - - void set_loop(bool p_enable); - bool has_loop() const; - - void set_volume(float p_vol); - float get_volume() const; - - void set_loop_restart_time(float p_secs); - float get_loop_restart_time() const; - - void set_volume_db(float p_db); - float get_volume_db() const; - - String get_stream_name() const; - - int get_loop_count() const; - - float get_pos() const; - void seek_pos(float p_time); - float get_length() const; - void set_autoplay(bool p_vol); - bool has_autoplay() const; - - void set_buffering_msec(int p_msec); - int get_buffering_msec() const; - - SpatialStreamPlayer(); - ~SpatialStreamPlayer(); -}; - -#endif // SPATIAL_STREAM_PLAYER_H diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 9f0c91c4b8..479fe1fed9 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1190,7 +1190,7 @@ void AnimatedSprite3D::set_frame(int p_frame) { frame=p_frame; _reset_timeout(); - _queue_update();; + _queue_update(); _change_notify("frame"); emit_signal(SceneStringNames::get_singleton()->frame_changed); @@ -1293,7 +1293,7 @@ void AnimatedSprite3D::set_animation(const StringName& p_animation){ _reset_timeout(); set_frame(0); _change_notify(); - _queue_update();; + _queue_update(); } StringName AnimatedSprite3D::get_animation() const{ |