Topic: [Possible Bug] Sound problems

I've been finding a few weird problems with playing sounds with play_sample.

in the first state that calls a sample, the sample will not play. the next states play the sample normally using the same line of code.

the only workarounds are:

  • restarting the level

  • killing the player

  • do the following:

state "main"
{
unless "$_objectname_ready" "reset"

change_state "continue_normally"
}

        state "reset" //bugfix state.
    {
    let "$_objectname_ready = 1"
    create_child ".this_objects_name"
    destroy
    }

this obviously forces the object to duplicate and destroy itself, so that the sounds play normally. this is very annoying mad

I'm using modded r760 code, however no modifications to anything related to sound were made. Running Ubuntu 14.04 64bit

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: [Possible Bug] Sound problems

I haven't been able to reproduce this problem.

in a startup object, I typed:

// this object implements the camera system
object ".default_startup.camera"
{
    requires 0.2.0
    always_active

    state "main"
    {
        hide
play_sample 1up
[...]

and it just worked

maybe your object isn't always_active ?

Re: [Possible Bug] Sound problems

hmm.. could be cause i did not see that in you code. @KZR

www.facebook.com/24XFSAL  Hasn't been updated anytime recently, don't bother.
I'm on SoundCloud: https://soundcloud.com/rain-new-holy - I plan to upload one soon.
Name change from 24XFSAL coming soon. Currently studying for Information Technology and Game development. (Also studying game theory in spare time.)

Re: [Possible Bug] Sound problems

yes, the objects are always_active. they must be, as they are part of the companion objects for a player.

here goes code:

// ---------------------------------------------------------
// *Object Name:* Michio_footstep_sounds
// *Author:* Fracture
// *Designed for:* Shinobi Densetsu
// *Description:* plays footstep sounds at fixed intervals
// *Version:* SD Alpha 1
// *Last modded by:* KZR Apr 20 2014
// ---------------------------------------------------------

object ".michio_footstep_sounds"
{
    always_active
    
    state "main"
    {
        hide
        
        observe_player "michio"
        
        let "$footstep_volume = $_OPTION_sfx_volume/4"
        
        unless "$_footstep_ready" "wait"
        
        on_player_in_the_air "main"
        
        if "$_PLDATA_michio_state == $_walking" "walk"
        if "$_PLDATA_michio_state == $_running" "run"
        if "$_PLDATA_michio_state == $_sprinting" "sprint"
    }
        
        state "wait" //bugfix state
        {
        let "$_footstep_ready = 1"
        create_child ".michio_footstep_sounds"
        destroy
        }

        state "walk"
        {
            let "$pitch = .5+(random(3)/10)"
            
            play_sample "samples/characters/michio/step.wav" $footstep_volume/3 0 $pitch
            
            change_state "walk_timeout"
        }
        
            state "walk_timeout"
            {
                unless "$_PLDATA_michio_state == $_walking" "main"
            
                on_timeout .498 "main"
            }
            
        state "run"
        {
            
            let "$pitch = .75+(random(3)/10)"
            
            play_sample "samples/characters/michio/step.wav" $footstep_volume/2 0 $pitch
            
            change_state "run_timeout"
        }
        
            state "run_timeout"
            {
                unless "$_PLDATA_michio_state == $_running" "main"
                
                on_timeout .3 "main"
            }
            
        state "sprint"
        {
            
            let "$pitch = .85+(random(3)/10)"
            
            play_sample "samples/characters/michio/step.wav" $footstep_volume 0 $pitch*1.15
            
            change_state "sprint_timeout"            
        }
        
            state "sprint_timeout"
            {
            unless "$_PLDATA_michio_state == $_sprinting" "main"
                
            on_timeout .2499 "main"
            }    
}

in this case, without setting up a "wait" state to respawn the object, the footsteps for walking don't work. all other footsteps are audible :\

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: [Possible Bug] Sound problems

please, can you provide a minimum viable object, so that i can test the problem in a clean version of the unmodified engine ?