Added GoZenSound and VideoControl
This commit is contained in:
parent
c5058f8b84
commit
f875d2ca0f
6 changed files with 107 additions and 1 deletions
14
addons/gde_gozen/GoZenAudio.cs
Normal file
14
addons/gde_gozen/GoZenAudio.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
1
addons/gde_gozen/GoZenAudio.cs.uid
Normal file
1
addons/gde_gozen/GoZenAudio.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bsrbb6owyigx0
|
||||
84
addons/gde_gozen/VideoControl.cs
Normal file
84
addons/gde_gozen/VideoControl.cs
Normal file
|
|
@ -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
|
||||
}
|
||||
1
addons/gde_gozen/VideoControl.cs.uid
Normal file
1
addons/gde_gozen/VideoControl.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://clrgdf4tqpx4o
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue