Giter Site home page Giter Site logo

mightyprinny / godot-flmusiclib Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 7.0 65.13 MB

GDNative library that plays mp3, chiptune and tracker music files using Game Music Emu, Minimp3 and openmpt

License: Creative Commons Zero v1.0 Universal

QMake 0.26% CMake 0.88% Makefile 0.08% Python 3.72% C 54.90% C++ 38.99% Shell 1.16%
mp3 music chiptune godot gdnative

godot-flmusiclib's People

Contributors

mightyprinny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

godot-flmusiclib's Issues

HTML5 export

It'd be cool to somehow export to HTML5, or at very least fallback to ogg files with same name. Looks like someone ported libopenmpt to webasm here, but I'm not sure how godot export works with javascript libs.

Volume cannot be reduced

Hello!

Playback works great but I am having trouble reducing the volume. Music.set_volume(10.0) is working fine to increase it, but reducing it with e.g. Music.set_volume(0.1) has no effect, so I cannot go below the "base" volume. I'm not sure if I'm just using it incorrectly or if it's an unsupported feature. I confirmed that I cannot reduce the volume on the demo project either.

I am using Godot 3.2 on Windows 10. I understand your last update was for 3.1 so maybe it's a version issue.

P.S. Thank you for this wonderful library. I was excited to stumble across a Godot implementation of GME... I've been using a C# implementation for a while now with MonoGame and love it. I don't know if you've messed with GME's other controls but being able to control tempo or stereo effect through your library would be amazing additions as well! The stereo effect especially adds a ton of depth and texture to a song.

Licence when used in game

I'm slightly confused by the licensing for FLmusiclib, am I required to make my game's source available if I use this Godot addon or is that only required for the author of the addon? Otherwise, what am I required to do when distributing me game, is it putting a link to this or the original library in a txt file credit included with my game's distribution?

Crash on play_music with Godot 3.2.1 in Linux (Ubuntu Bionic)

Script:

extends Node2D

onready var music = preload("res://FLMusicLib/FLMusic.gdns").new()

func _ready():
	music.play_music("res://music/01 - Jagd Flieger.vgz", 0)

The game closes on play_music. Also tried nsf and vgm files.
When pressing play in the editor, it quits silently.
When exported and run from the command line, it outputs:

handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7ff4af3cef20] (??:0)
[2] ./HSW.x86_64() [0x9e532f] (??:?)
[3] godot_variant godot::__wrapped_method<FLMusicLib, bool, godot::String, int, bool, int, int, int>(void*, void*, void*, int, godot_variant**) (??:0)
[4] ./HSW.x86_64() [0x1b6b9e7] (<artificial>:?)
[5] ./HSW.x86_64() [0xa2077f] (??:?)
[6] ./HSW.x86_64() [0x92059d] (??:?)
[7] ./HSW.x86_64() [0x1b94c89] (<artificial>:?)
[8] ./HSW.x86_64() [0x1ba3785] (<artificial>:?)
[9] ./HSW.x86_64() [0x1725bf5] (??:?)
[10] ./HSW.x86_64() [0x1330508] (??:?)
[11] ./HSW.x86_64() [0x98d6f4] (??:?)
[12] ./HSW.x86_64() [0x16b4dfc] (<artificial>:?)
[13] ./HSW.x86_64() [0x16b4d53] (<artificial>:?)
[14] ./HSW.x86_64() [0x16e7fb7] (??:?)
[15] ./HSW.x86_64() [0x16e803a] (??:?)
[16] ./HSW.x86_64() [0x68210e] (??:?)
[17] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7ff4af3b1b97] (??:0)
[18] ./HSW.x86_64() [0x68fb1e] (??:?)
-- END OF BACKTRACE --
Aborted (core dumped)

Forgot to load Dependencies for Windows version of library in the GDNativeLib file

Which causes if the project exported, only Windows version will suffer from error no such method

Checked file:

both files above forgot to load Dependency .dll files for Windows version of the Native Library. It seems for Windows version, the .dll library is separated hence the main FLMusicLib.dll requires dependencies which included next to it. for other platform, such as Linux, and Android, already had all in one .so file, so I suspect that it no longer require to have dependency.

previous detail: godotengine/godot#42777

Generated error

bellow is the debug console output of exported application which is FLMusicLib demo.

Godot Engine v3.2.3.stable.official - https://godotengine.org
Using GLES2 video driver
OpenGL ES 2.0 Renderer: GeForce GTX 1050 Ti/PCIe/SSE2
OpenGL ES 2.0 Batching: ON
        OPTIONS
        max_join_item_commands 16
        colored_vertex_format_threshold 0.25
        batch_buffer_size 16384
        light_scissor_area_threshold 1
        item_reordering_lookahead 4
        light_max_join_items 32
        single_rect_fallback False
        debug_flash False
        diagnose_frame False
WASAPI: wFormatTag = 65534
WASAPI: nChannels = 8
WASAPI: nSamplesPerSec = 48000
WASAPI: nAvgBytesPerSec = 1536000
WASAPI: nBlockAlign = 32
WASAPI: wBitsPerSample = 32
WASAPI: cbSize = 22
WASAPI: detected 8 channels
WASAPI: audio buffer frames: 1962 calculated latency: 44ms

Loading resource: res://FLMusicLib/FLMusicLib.gdnlib
ERROR: Can't open dynamic library: FLMusicLib/Windows/x86/FLMusicLib.dll, error: Error 126: The specified module could not be found.
.
   At: platform/windows/os_windows.cpp:2395
CORE API HASH: 17947557007960061372
EDITOR API HASH: 3270892295
Loading resource: res://default_env.tres
Loading resource: res://global.gdc
Loading resource: res://FLMusicLib/FLMusic.gdns
Loading resource: res://FLMusicLib/FLMusicLib.gdnlib
ERROR: Can't open dynamic library: FLMusicLib/Windows/x86/FLMusicLib.dll, error: Error 126: The specified module could not be found.
.
   At: platform/windows/os_windows.cpp:2395
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
   At: modules/gdnative/gdnative.cpp:501
ERROR: init_library: No nativescript_init in "res://FLMusicLib/Windows/x86/FLMusicLib.dll" found
   At: modules/gdnative/nativescript/nativescript.cpp:1506
SCRIPT ERROR: _init: Attempt to call function 'new' in base 'NativeScript' on a null instance.
          At: res://global.gdc:8
Loaded builtin certs
Loading resource: res://MyScene.tscn
Loading resource: res://MyScene.gdc
Loading resource: res://TrackList.gdc
ERROR: add_child: Parameter "p_child" is null.
   At: scene/main/node.cpp:1174
SCRIPT ERROR: _ready: Invalid call. Nonexistent function 'set_gme_buffer_size' in base 'Nil'.
          At: res://global.gdc:12
SCRIPT ERROR: _ready: Invalid call. Nonexistent function 'connect' in base 'Nil'.
          At: res://MyScene.gdc:23
SCRIPT ERROR: _play_music: Invalid call. Nonexistent function 'play_music' in base 'Nil'.
          At: res://MyScene.gdc:30
SCRIPT ERROR: _play_music: Invalid call. Nonexistent function 'play_music' in base 'Nil'.
          At: res://MyScene.gdc:30
SCRIPT ERROR: _play_music: Invalid call. Nonexistent function 'play_music' in base 'Nil'.
          At: res://MyScene.gdc:30

to even clarify, I also implemented the FLMusicLib into my own project, made the implementation to use that when the music file is the format for the GMEPlayer, and it resulted the same. Invalid call. Nonexistent function 'play_music' in base 'Nil'

...
res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom3D.tscn
Queueing Scene res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom3D.tscn
Queueing Scene res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom2D.tscn
Set Statuso Flag
Set Statuso Flag
Queue is ready res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom3D.tscn
Connect Signal 3D
Queue is ready res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom2D.tscn
Testoid Location= C:/Users/joelr/AppData/Roaming/Perkedel Technologies/Hexagon Engine/TestoidDummy.txt
SCRIPT ERROR: _ready: Invalid call. Nonexistent function 'connect' in base 'Nil'.
          At: res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom2D.gdc:59
Connect Signal 2D
Show UI Gameplay


(NOTICE)PLEASE DON'T LOSE THE CRACKLES!!! LEFT 15 PCS!!! (NOTICE)


Body Out of Bound = TestoidDrop
openFile = D:/PRIVATE FOLDER/FILE JOEL ROBERT/MP3/Tobu/Tobu - Calling.mp3
Use GME = D:/PRIVATE FOLDER/FILE JOEL ROBERT/MP3/Tobu/Tobu - Calling.mp3
SCRIPT ERROR: PlaySong: Invalid call. Nonexistent function 'play_music' in base 'Nil'.
          At: res://GameDVDCardtridge/TemplateHexagonEngine/LevelCardtridge/MusicEnjoy/MusicRoom2D.gdc:127

fixing problem

  • Reopen the demo project
  • open up the FLMusicLib.gdnlib and pay attention to GDNative Library bottom window.
  • pay attention to Windows libraries fields.
  • Load up all .dll files on the Dependency field.
  • Export again
  • now it works. both editing & executable

Solution

  • commit an update to all related branch that finally loads all dependency for Windows version. The final result for file FLMusicLib.gdnlib should looks like
[general]

singleton=true
load_once=true
symbol_prefix="godot_"
reloadable=true

[entry]

Android.armeabi-v7a="res://FLMusicLib/Android/armv7a/libFLMusicLib.so"
Android.arm64-v8a="res://FLMusicLib/Android/armv8-64/libFLMusicLib.so"
Windows.64="res://FLMusicLib/Windows/x64/FLMusicLib.dll"
Windows.32="res://FLMusicLib/Windows/x86/FLMusicLib.dll"
X11.64="res://FLMusicLib/Linux/x64/libFLMusicLib.so.1.0.0"

[dependencies]

Android.armeabi-v7a=[  ]
Android.arm64-v8a=[  ]
Windows.64=[ "res://FLMusicLib/Windows/x64/libopenmpt.dll", "res://FLMusicLib/Windows/x64/openmpt-mpg123.dll", "res://FLMusicLib/Windows/x64/openmpt-ogg.dll", "res://FLMusicLib/Windows/x64/openmpt-vorbis.dll", "res://FLMusicLib/Windows/x64/openmpt-zlib.dll" ]
Windows.32=[ "res://FLMusicLib/Windows/x86/libopenmpt.dll", "res://FLMusicLib/Windows/x86/openmpt-mpg123.dll", "res://FLMusicLib/Windows/x86/openmpt-ogg.dll", "res://FLMusicLib/Windows/x86/openmpt-vorbis.dll", "res://FLMusicLib/Windows/x86/openmpt-zlib.dll" ]
X11.64=[  ]

notice that in the section [dependencies], I manually added other DLL files for Windows version, which you already aware that following fields above are empty. this way, made the WIndows version export finally works.

Function Overload Request For play_music()

Can we add an overload for play_music() where we add a string variable called realType and that will switch the logic for FileType, so we could use any filename and extension combo but play the file anyway? Like the Old UT99 music files were .IT files just renamed .UMX

Example:

bool PlayMusic(String path,int trackNum,bool loop = true,int loopStart = -1,int loopEnd = -1,int startMsec = 0, String realType)
{
....
....
String extTest = realType.to_lower();
if (Some compare technique)
{
type = FileType::MP3;
}
else if (Some compare technique)
{
type = FileType::OGG;
}
else if (Some compare technique)
{
type = FileType::MOD;
}
else if (Some compare technique)
{
type = FileType::VGM;
}
else
{
Godot::print("couldn't identify extension");
return false;
}
....
....
}

Problem when playing two instances

I have two instances (both created with FLMusicLib.new()) because I want to use one for music and the other for sfx. At first, one instance starts playing music, but if the second instance plays a sound (it is just a short track), when this ends, both instances stop playing.

I am using Godot 3.2beta1. Both instances are playing nsf files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.