diff options
Diffstat (limited to 'scene/audio/stream_player.cpp')
-rw-r--r-- | scene/audio/stream_player.cpp | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index 99ecace1ed..9e506034a6 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -167,8 +167,10 @@ void StreamPlayer::play(float p_from_offset) { sp_update(); 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); + /* + if (stream->get_update_mode()!=AudioStream::UPDATE_NONE) + set_idle_process(true); + */ } @@ -305,8 +307,10 @@ bool StreamPlayer::has_autoplay() const { void StreamPlayer::set_paused(bool p_paused) { paused=p_paused; - //if (stream.is_valid()) - // stream->set_paused(p_paused); + /* + if (stream.is_valid()) + stream->set_paused(p_paused); + */ } bool StreamPlayer::is_paused() const { @@ -345,55 +349,55 @@ int StreamPlayer::get_buffering_msec() const{ void StreamPlayer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_stream","stream:AudioStream"),&StreamPlayer::set_stream); - ObjectTypeDB::bind_method(_MD("get_stream:AudioStream"),&StreamPlayer::get_stream); + ClassDB::bind_method(_MD("set_stream","stream:AudioStream"),&StreamPlayer::set_stream); + ClassDB::bind_method(_MD("get_stream:AudioStream"),&StreamPlayer::get_stream); - ObjectTypeDB::bind_method(_MD("play","offset"),&StreamPlayer::play,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("stop"),&StreamPlayer::stop); + ClassDB::bind_method(_MD("play","offset"),&StreamPlayer::play,DEFVAL(0)); + ClassDB::bind_method(_MD("stop"),&StreamPlayer::stop); - ObjectTypeDB::bind_method(_MD("is_playing"),&StreamPlayer::is_playing); + ClassDB::bind_method(_MD("is_playing"),&StreamPlayer::is_playing); - ObjectTypeDB::bind_method(_MD("set_paused","paused"),&StreamPlayer::set_paused); - ObjectTypeDB::bind_method(_MD("is_paused"),&StreamPlayer::is_paused); + ClassDB::bind_method(_MD("set_paused","paused"),&StreamPlayer::set_paused); + ClassDB::bind_method(_MD("is_paused"),&StreamPlayer::is_paused); - ObjectTypeDB::bind_method(_MD("set_loop","enabled"),&StreamPlayer::set_loop); - ObjectTypeDB::bind_method(_MD("has_loop"),&StreamPlayer::has_loop); + ClassDB::bind_method(_MD("set_loop","enabled"),&StreamPlayer::set_loop); + ClassDB::bind_method(_MD("has_loop"),&StreamPlayer::has_loop); - ObjectTypeDB::bind_method(_MD("set_volume","volume"),&StreamPlayer::set_volume); - ObjectTypeDB::bind_method(_MD("get_volume"),&StreamPlayer::get_volume); + ClassDB::bind_method(_MD("set_volume","volume"),&StreamPlayer::set_volume); + ClassDB::bind_method(_MD("get_volume"),&StreamPlayer::get_volume); - ObjectTypeDB::bind_method(_MD("set_volume_db","db"),&StreamPlayer::set_volume_db); - ObjectTypeDB::bind_method(_MD("get_volume_db"),&StreamPlayer::get_volume_db); + ClassDB::bind_method(_MD("set_volume_db","db"),&StreamPlayer::set_volume_db); + ClassDB::bind_method(_MD("get_volume_db"),&StreamPlayer::get_volume_db); - ObjectTypeDB::bind_method(_MD("set_buffering_msec","msec"),&StreamPlayer::set_buffering_msec); - ObjectTypeDB::bind_method(_MD("get_buffering_msec"),&StreamPlayer::get_buffering_msec); + ClassDB::bind_method(_MD("set_buffering_msec","msec"),&StreamPlayer::set_buffering_msec); + ClassDB::bind_method(_MD("get_buffering_msec"),&StreamPlayer::get_buffering_msec); - ObjectTypeDB::bind_method(_MD("set_loop_restart_time","secs"),&StreamPlayer::set_loop_restart_time); - ObjectTypeDB::bind_method(_MD("get_loop_restart_time"),&StreamPlayer::get_loop_restart_time); + ClassDB::bind_method(_MD("set_loop_restart_time","secs"),&StreamPlayer::set_loop_restart_time); + ClassDB::bind_method(_MD("get_loop_restart_time"),&StreamPlayer::get_loop_restart_time); - ObjectTypeDB::bind_method(_MD("get_stream_name"),&StreamPlayer::get_stream_name); - ObjectTypeDB::bind_method(_MD("get_loop_count"),&StreamPlayer::get_loop_count); + ClassDB::bind_method(_MD("get_stream_name"),&StreamPlayer::get_stream_name); + ClassDB::bind_method(_MD("get_loop_count"),&StreamPlayer::get_loop_count); - ObjectTypeDB::bind_method(_MD("get_pos"),&StreamPlayer::get_pos); - ObjectTypeDB::bind_method(_MD("seek_pos","time"),&StreamPlayer::seek_pos); + ClassDB::bind_method(_MD("get_pos"),&StreamPlayer::get_pos); + ClassDB::bind_method(_MD("seek_pos","time"),&StreamPlayer::seek_pos); - ObjectTypeDB::bind_method(_MD("set_autoplay","enabled"),&StreamPlayer::set_autoplay); - ObjectTypeDB::bind_method(_MD("has_autoplay"),&StreamPlayer::has_autoplay); + ClassDB::bind_method(_MD("set_autoplay","enabled"),&StreamPlayer::set_autoplay); + ClassDB::bind_method(_MD("has_autoplay"),&StreamPlayer::has_autoplay); - ObjectTypeDB::bind_method(_MD("get_length"),&StreamPlayer::get_length); + ClassDB::bind_method(_MD("get_length"),&StreamPlayer::get_length); - ObjectTypeDB::bind_method(_MD("_set_play","play"),&StreamPlayer::_set_play); - ObjectTypeDB::bind_method(_MD("_get_play"),&StreamPlayer::_get_play); - ObjectTypeDB::bind_method(_MD("_do_stop"),&StreamPlayer::_do_stop); + ClassDB::bind_method(_MD("_set_play","play"),&StreamPlayer::_set_play); + ClassDB::bind_method(_MD("_get_play"),&StreamPlayer::_get_play); + ClassDB::bind_method(_MD("_do_stop"),&StreamPlayer::_do_stop); - ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream/stream", PROPERTY_HINT_RESOURCE_TYPE,"AudioStream"), _SCS("set_stream"), _SCS("get_stream") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/play"), _SCS("_set_play"), _SCS("_get_play") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), _SCS("set_loop"), _SCS("has_loop") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL, "stream/volume_db", PROPERTY_HINT_RANGE,"-80,24,0.01"), _SCS("set_volume_db"), _SCS("get_volume_db") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/autoplay"), _SCS("set_autoplay"), _SCS("has_autoplay") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/paused"), _SCS("set_paused"), _SCS("is_paused") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL, "stream/loop_restart_time"), _SCS("set_loop_restart_time"), _SCS("get_loop_restart_time") ); - ADD_PROPERTY( PropertyInfo(Variant::INT, "stream/buffering_ms"), _SCS("set_buffering_msec"), _SCS("get_buffering_msec") ); + 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::REAL, "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") ); ADD_SIGNAL(MethodInfo("finished")); } |