mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Remove support for ogg audio files as they cannot be saved
At least until I find a way to save them. Wav files will be supported with Godot 4.4
This commit is contained in:
parent
47fb74b268
commit
98d2e12415
|
@ -45,7 +45,7 @@ func handle_loading_file(file: String) -> void:
|
||||||
return
|
return
|
||||||
var file_name: String = file.get_file().get_basename()
|
var file_name: String = file.get_file().get_basename()
|
||||||
Global.control.find_child("ShaderEffect").change_shader(shader, file_name)
|
Global.control.find_child("ShaderEffect").change_shader(shader, file_name)
|
||||||
elif file_ext == "ogg" or file_ext == "mp3": # Audio file
|
elif file_ext == "mp3": # Audio file
|
||||||
open_audio_file(file)
|
open_audio_file(file)
|
||||||
|
|
||||||
else: # Image files
|
else: # Image files
|
||||||
|
@ -198,13 +198,13 @@ func handle_loading_video(file: String) -> bool:
|
||||||
Global.projects.append(new_project)
|
Global.projects.append(new_project)
|
||||||
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
|
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
|
||||||
Global.canvas.camera_zoom()
|
Global.canvas.camera_zoom()
|
||||||
var output_audio_file := temp_path_real.path_join("audio.ogg")
|
var output_audio_file := temp_path_real.path_join("audio.mp3")
|
||||||
# ffmpeg -y -i input_file -vn audio.ogg
|
# ffmpeg -y -i input_file -vn audio.mp3
|
||||||
var ffmpeg_execute_audio: PackedStringArray = ["-y", "-i", file, "-vn", output_audio_file]
|
var ffmpeg_execute_audio: PackedStringArray = ["-y", "-i", file, "-vn", output_audio_file]
|
||||||
var success_audio := OS.execute(Global.ffmpeg_path, ffmpeg_execute_audio, [], true)
|
var success_audio := OS.execute(Global.ffmpeg_path, ffmpeg_execute_audio, [], true)
|
||||||
if FileAccess.file_exists(output_audio_file):
|
if FileAccess.file_exists(output_audio_file):
|
||||||
open_audio_file(output_audio_file)
|
open_audio_file(output_audio_file)
|
||||||
temp_dir.remove("audio.ogg")
|
temp_dir.remove("audio.mp3")
|
||||||
DirAccess.remove_absolute(Export.TEMP_PATH)
|
DirAccess.remove_absolute(Export.TEMP_PATH)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
@ -915,12 +915,9 @@ func set_new_imported_tab(project: Project, path: String) -> void:
|
||||||
func open_audio_file(path: String) -> void:
|
func open_audio_file(path: String) -> void:
|
||||||
var audio_stream: AudioStream
|
var audio_stream: AudioStream
|
||||||
var file_ext := path.get_extension().to_lower()
|
var file_ext := path.get_extension().to_lower()
|
||||||
if file_ext == "ogg":
|
var file := FileAccess.open(path, FileAccess.READ)
|
||||||
audio_stream = AudioStreamOggVorbis.load_from_file(path)
|
audio_stream = AudioStreamMP3.new()
|
||||||
elif file_ext == "mp3":
|
audio_stream.data = file.get_buffer(file.get_length())
|
||||||
var file := FileAccess.open(path, FileAccess.READ)
|
|
||||||
audio_stream = AudioStreamMP3.new()
|
|
||||||
audio_stream.data = file.get_buffer(file.get_length())
|
|
||||||
if not is_instance_valid(audio_stream):
|
if not is_instance_valid(audio_stream):
|
||||||
return
|
return
|
||||||
var project := Global.current_project
|
var project := Global.current_project
|
||||||
|
|
Loading…
Reference in a new issue