summaryrefslogtreecommitdiff
path: root/scene/resources/audio_stream.cpp
diff options
context:
space:
mode:
authorKostadin Damyanov <maxmight@gmail.com>2015-10-13 05:01:54 +0300
committerKostadin Damyanov <maxmight@gmail.com>2015-10-13 05:01:54 +0300
commit29caf2bb5be061cd1ab014cf938f2c71d0bd2663 (patch)
tree859a0c3d2805198672c1e22d4780c3eb68f55a57 /scene/resources/audio_stream.cpp
parentc5f574b914b3cb11d97ae616df4a0bced45bb17c (diff)
parent79e5ced7e668fa53567ac6aaf5a26393cea6c9a2 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'scene/resources/audio_stream.cpp')
-rw-r--r--scene/resources/audio_stream.cpp70
1 files changed, 14 insertions, 56 deletions
diff --git a/scene/resources/audio_stream.cpp b/scene/resources/audio_stream.cpp
index 7694b8ef79..569ed8620d 100644
--- a/scene/resources/audio_stream.cpp
+++ b/scene/resources/audio_stream.cpp
@@ -28,76 +28,34 @@
/*************************************************************************/
#include "audio_stream.h"
+//////////////////////////////
-int AudioStream::InternalAudioStream::get_channel_count() const {
+void AudioStreamPlayback::_bind_methods() {
- return owner->get_channel_count();
+ ObjectTypeDB::bind_method(_MD("play","from_pos_sec"),&AudioStreamPlayback::play,DEFVAL(0));
+ ObjectTypeDB::bind_method(_MD("stop"),&AudioStreamPlayback::stop);
+ ObjectTypeDB::bind_method(_MD("is_playing"),&AudioStreamPlayback::is_playing);
-}
-
-void AudioStream::InternalAudioStream::set_mix_rate(int p_rate) {
-
- owner->_mix_rate=p_rate;
-}
-
-bool AudioStream::InternalAudioStream::mix(int32_t *p_buffer,int p_frames) {
-
- return owner->mix(p_buffer,p_frames);
-}
-
-bool AudioStream::InternalAudioStream::can_update_mt() const {
+ ObjectTypeDB::bind_method(_MD("set_loop","enabled"),&AudioStreamPlayback::set_loop);
+ ObjectTypeDB::bind_method(_MD("has_loop"),&AudioStreamPlayback::has_loop);
- return owner->get_update_mode()==UPDATE_THREAD;
-}
+ ObjectTypeDB::bind_method(_MD("get_loop_count"),&AudioStreamPlayback::get_loop_count);
-void AudioStream::InternalAudioStream::update() {
+ ObjectTypeDB::bind_method(_MD("seek_pos","pos"),&AudioStreamPlayback::seek_pos);
+ ObjectTypeDB::bind_method(_MD("get_pos"),&AudioStreamPlayback::get_pos);
- owner->update();
-}
+ ObjectTypeDB::bind_method(_MD("get_length"),&AudioStreamPlayback::get_length);
+ ObjectTypeDB::bind_method(_MD("get_channels"),&AudioStreamPlayback::get_channels);
+ ObjectTypeDB::bind_method(_MD("get_mix_rate"),&AudioStreamPlayback::get_mix_rate);
+ ObjectTypeDB::bind_method(_MD("get_minimum_buffer_size"),&AudioStreamPlayback::get_minimum_buffer_size);
-AudioServer::AudioStream *AudioStream::get_audio_stream() {
- return internal_audio_stream;
}
void AudioStream::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("play"),&AudioStream::play);
- ObjectTypeDB::bind_method(_MD("stop"),&AudioStream::stop);
- ObjectTypeDB::bind_method(_MD("is_playing"),&AudioStream::is_playing);
-
- ObjectTypeDB::bind_method(_MD("set_loop","enabled"),&AudioStream::set_loop);
- ObjectTypeDB::bind_method(_MD("has_loop"),&AudioStream::has_loop);
-
- ObjectTypeDB::bind_method(_MD("get_stream_name"),&AudioStream::get_stream_name);
- ObjectTypeDB::bind_method(_MD("get_loop_count"),&AudioStream::get_loop_count);
-
- ObjectTypeDB::bind_method(_MD("seek_pos","pos"),&AudioStream::seek_pos);
- ObjectTypeDB::bind_method(_MD("get_pos"),&AudioStream::get_pos);
-
- ObjectTypeDB::bind_method(_MD("get_length"),&AudioStream::get_length);
-
- ObjectTypeDB::bind_method(_MD("get_update_mode"),&AudioStream::get_update_mode);
-
- ObjectTypeDB::bind_method(_MD("update"),&AudioStream::update);
-
- BIND_CONSTANT( UPDATE_NONE );
- BIND_CONSTANT( UPDATE_IDLE );
- BIND_CONSTANT( UPDATE_THREAD );
}
-AudioStream::AudioStream() {
-
- _mix_rate=44100;
- internal_audio_stream = memnew( InternalAudioStream );
- internal_audio_stream->owner=this;
-}
-
-
-AudioStream::~AudioStream() {
-
- memdelete(internal_audio_stream);
-}