kyzfrintin / Godot-Mixing-Desk

A complete audio solution for Godot 3.3.x, making procedural sound and adaptive/procedural music possible with a few nodes and a couple lines of code.
MIT License
636 stars 32 forks source link

Error when song stops #16

Open oppenheimer- opened 3 years ago

oppenheimer- commented 3 years ago

I'm following your tutorial over at youtube and installed the github version. Autoplay of the first song and the attached random ambient pieces seem to work fine, but when the core container is done playing it throws this error.

mixing_desk_music.gd Attempt to call function 'get_playback_position' in base 'null instance' on a null instance. Line 103 time = ref_track.get_playback_position()

Took some screenshots as well, maybe they help:

Node setup ![image](https://user-images.githubusercontent.com/10992675/100489874-73b23600-3117-11eb-9249-afc0fb061bae.png) Song settings ![image](https://user-images.githubusercontent.com/10992675/100489955-f20ed800-3117-11eb-8903-4fee7fb10908.png) Inspector ![image](https://user-images.githubusercontent.com/10992675/100489871-64cb8380-3117-11eb-87a3-7d0694a2ed79.png)
vanoak commented 3 years ago

I can confirm this issue. I followed the explanation in the documentation and I bumped into this the first time. I was using a WAV file. When I changed to the OGG format, it worked.

MJacred commented 3 years ago

Hi, I'm currently reading all the code and adding code comments and do cleanup. Can you upload a small test project for me, please? I'll go fix it : )

FFoeth commented 3 years ago

Hi, I ran into the above error message and my program aborting. As sound file I used a one bar Ogg Vorbis file in an AudioStreamPlayer, added to a CoreContainer, which was added to a Song container, which was added to a MixingDeskMusic instance. To check it had nothing to do with the file length, I added 5ms of silence to the sound file, still the same result. A quick workaround seems to be an extra check under 'if playing:' in _process() in mixing_desk_music.gd:

if playing:
    if is_instance_valid(ref_track):
        time = ref_track.get_playback_position()
        beat = int(floor(((time/beats_in_sec) * 1000.0) + 1.0))
        if beat != last_beat && (beat - 1) % int(bars * beats_in_bar) + 1 != last_beat:
            _beat()
        last_beat = beat

(No else statement). If I catch and print all relevant signals from MixingDeskMusic, I can print something like

Current bar 1 Current beat 1 Current beat 2 Current beat 3 Current beat 4 Current bar 2 Song 0 has ended. Current beat 1

I can work with this. No idea if this works in lists of songs or lists of songs with transitions

caliconiko commented 2 years ago

THIS FUKIN BUG AAAAAAAAAAAAAAAAA