diff --git a/addons/gde_gozen/GoZenAudio.cs b/addons/gde_gozen/GoZenAudio.cs new file mode 100644 index 0000000..d442199 --- /dev/null +++ b/addons/gde_gozen/GoZenAudio.cs @@ -0,0 +1,14 @@ +using Godot; +using System; + +public partial class GoZenAudio : Resource +{ + public static byte[] GetAudioData() => ClassDB.ClassCallStatic("GoZenAudio", "get_audio_data").AsByteArray(); + + public static byte[] CombineData(byte[] audio1, byte[] audio2) => ClassDB.ClassCallStatic("GoZenAudio", + "combine_data", Variant.CreateFrom(audio1), Variant.CreateFrom(audio2)).AsByteArray(); + + public static byte[] ChangeDb(byte[] audio, float db) => ClassDB.ClassCallStatic("GoZenAudio", "change_db", Variant.CreateFrom(audio), Variant.CreateFrom(db)).AsByteArray(); + + public static byte[] ChangeToMono(byte[] audio) => ClassDB.ClassCallStatic("GoZenAudio", "change_to_mono", Variant.CreateFrom(audio)).AsByteArray(); +} diff --git a/addons/gde_gozen/GoZenAudio.cs.uid b/addons/gde_gozen/GoZenAudio.cs.uid new file mode 100644 index 0000000..6a38ee1 --- /dev/null +++ b/addons/gde_gozen/GoZenAudio.cs.uid @@ -0,0 +1 @@ +uid://bsrbb6owyigx0 diff --git a/addons/gde_gozen/VideoControl.cs b/addons/gde_gozen/VideoControl.cs new file mode 100644 index 0000000..03ad912 --- /dev/null +++ b/addons/gde_gozen/VideoControl.cs @@ -0,0 +1,84 @@ +using Godot; +using System; +using Godot.NativeInterop; + +public partial class VideoControl : Control +{ + + [Signal] + public delegate void FrameChangedEventHandler(int frame_nr); + + [Signal] + public delegate void NextFrameCalledEventHandler(int frame_nr); + + [Signal] + public delegate void VideoLoadedEventHandler(); + + [Signal] + public delegate void VideoEndedEventHandler(); + + [Signal] + public delegate void PlaybackStartedEventHandler(); + + [Signal] + public delegate void PlaybackPausedEventHandler(); + + [Signal] + public delegate void PlaybackReadyEventHandler(); + + public const float PLAYBACK_SPEED_MIN = 0.25f; + public const float PLAYBACK_SPEED_MAX = 4.0f; + + [Export(PropertyHint.File)] public string Path; + [Export] public bool EnableAudio = true; + [Export] public bool EnableAutoPlay = false; + + [Export(PropertyHint.Range, $"0.25,4.0,0.05")] + public float PlaybackSpeed = 1.0f; + + [Export] public bool PitchAdjust = true; + [Export] public bool Loop = false; + + [ExportGroup("Extra's")] + [Export] public ColorProfile ColorProfile = ColorProfile.Auto; + + [Export] public bool Debug = false; + + public GoZenVideo? Video; + + public TextureRect VideoTexture = new TextureRect(); + public AudioStreamPlayer AudioStream = new AudioStreamPlayer(); + + public bool IsPlaying = false; + public int CurrentFrame = 0; + + private float _timeElapsed = 0.0f; + private float _timeFrame = 0.0f; + private int _skippedFrames = 0; + + private int _rotation = 0; + private int _padding = 0; + private float _frameRate = 0.0f; + private int _frameCount = 0; + + private Vector2I _resolution = Vector2I.Zero; + private ShaderMaterial _shaderMaterial; + + private long[] _threads = []; + private AudioEffectPitchShift _audioPitchEffect = new AudioEffectPitchShift(); + + private ImageTexture _yTexture; + private ImageTexture _uTexture; + private ImageTexture _vTexture; + +} + +public enum ColorProfile +{ + Auto, + Bt470, + Bt601, + Bt709, + Bt2020, + Bt2100 +} \ No newline at end of file diff --git a/addons/gde_gozen/VideoControl.cs.uid b/addons/gde_gozen/VideoControl.cs.uid new file mode 100644 index 0000000..301b748 --- /dev/null +++ b/addons/gde_gozen/VideoControl.cs.uid @@ -0,0 +1 @@ +uid://clrgdf4tqpx4o diff --git a/icon.png.import b/icon.png.import index e0beffa..5429869 100644 --- a/icon.png.import +++ b/icon.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/project.godot b/project.godot index cf94910..88f00de 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="GDE_Gozen_CSharp" config/description="Enter an interesting project description here!" -config/features=PackedStringArray("4.5") +config/features=PackedStringArray("4.5", "C#") config/icon="res://icon.png" [dotnet]