1 /** 2 Plays audio with random pitch shifting. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.audiostreamrandompitch; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.audiostream; 25 import godot.resource; 26 /** 27 Plays audio with random pitch shifting. 28 29 Randomly varies pitch on each start. 30 */ 31 @GodotBaseClass struct AudioStreamRandomPitch 32 { 33 package(godot) enum string _GODOT_internal_name = "AudioStreamRandomPitch"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ AudioStream _GODOT_base; } 37 alias _GODOT_base this; 38 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 39 package(godot) __gshared bool _classBindingInitialized = false; 40 package(godot) static struct GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_audio_stream") GodotMethod!(AudioStream) getAudioStream; 44 @GodotName("get_random_pitch") GodotMethod!(double) getRandomPitch; 45 @GodotName("set_audio_stream") GodotMethod!(void, AudioStream) setAudioStream; 46 @GodotName("set_random_pitch") GodotMethod!(void, double) setRandomPitch; 47 } 48 /// 49 pragma(inline, true) bool opEquals(in AudioStreamRandomPitch other) const 50 { return _godot_object.ptr is other._godot_object.ptr; } 51 /// 52 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 53 { _godot_object.ptr = n; return null; } 54 /// 55 pragma(inline, true) bool opEquals(typeof(null) n) const 56 { return _godot_object.ptr is n; } 57 /// 58 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 59 mixin baseCasts; 60 /// Construct a new instance of AudioStreamRandomPitch. 61 /// Note: use `memnew!AudioStreamRandomPitch` instead. 62 static AudioStreamRandomPitch _new() 63 { 64 static godot_class_constructor constructor; 65 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioStreamRandomPitch"); 66 if(constructor is null) return typeof(this).init; 67 return cast(AudioStreamRandomPitch)(constructor()); 68 } 69 @disable new(size_t s); 70 /** 71 72 */ 73 Ref!AudioStream getAudioStream() const 74 { 75 checkClassBinding!(typeof(this))(); 76 return ptrcall!(AudioStream)(GDNativeClassBinding.getAudioStream, _godot_object); 77 } 78 /** 79 80 */ 81 double getRandomPitch() const 82 { 83 checkClassBinding!(typeof(this))(); 84 return ptrcall!(double)(GDNativeClassBinding.getRandomPitch, _godot_object); 85 } 86 /** 87 88 */ 89 void setAudioStream(AudioStream stream) 90 { 91 checkClassBinding!(typeof(this))(); 92 ptrcall!(void)(GDNativeClassBinding.setAudioStream, _godot_object, stream); 93 } 94 /** 95 96 */ 97 void setRandomPitch(in double scale) 98 { 99 checkClassBinding!(typeof(this))(); 100 ptrcall!(void)(GDNativeClassBinding.setRandomPitch, _godot_object, scale); 101 } 102 /** 103 The current $(D AudioStream). 104 */ 105 @property AudioStream audioStream() 106 { 107 return getAudioStream(); 108 } 109 /// ditto 110 @property void audioStream(AudioStream v) 111 { 112 setAudioStream(v); 113 } 114 /** 115 The intensity of random pitch variation. 116 */ 117 @property double randomPitch() 118 { 119 return getRandomPitch(); 120 } 121 /// ditto 122 @property void randomPitch(double v) 123 { 124 setRandomPitch(v); 125 } 126 }