Repository: 4ian/GDevelop
File: GDJS/Runtime/howler-sound-manager/howler-sound-manager.ts (TypeScript)

Code before:
      return sound;
    }

    /**
     * Creates a new gdjs.HowlerSound using preloaded/cached Howl instances.
     * @param soundName The name of the file or resource to play.
     * @param isMusic True if a music, false if a sound.
     * @param volume Between 0 and 1.
     * @param loop True if it should be played looping.
     * @param rate speed at which it is played.
     */
    createHowlerSound(
      soundName: string,
      isMusic: boolean,
      volume: float,
      loop: boolean,
      rate: float
    ): HowlerSound {
      const cacheContainer = isMusic ? this._loadedMusics : this._loadedSounds;
      const resource = this._getAudioResource(soundName);

      let howl = cacheContainer.get(resource);
      if (!howl) {
        const fileName = resource ? resource.file : soundName;
        howl = new Howl(
          Object.assign(
            {
              src: this._getSoundUrlsFromResource(resource),
              html5: isMusic,
              xhr: {
                withCredentials: this._resourceLoader.checkIfCredentialsRequired(
                  fileName
                ),
              },
              // Cache the sound with no volume. This avoids a bug where it plays at full volume
              // for a split second before setting its correct volume.
              volume: 0,
            },
            HowlParameters
          )
        );
        cacheContainer.set(resource, howl);
      }

      return new gdjs.HowlerSound(howl, volume, loop, rate);
    }

    /**
     * Preloads a sound or a music in memory.
     * @param soundName The name of the file or resource to preload.
     * @param isMusic True if a music, false if a sound.

Review comment (suggestion):
here it seems the logic has changed, it's using resource (so `resource.file`) where it used to be that or `soundName` if not defined.
The resource is created from the soundName, I'm actually unsure if this case can happen or not

Code after:
    }

    /**
     * Creates a new gdjs.HowlerSound using preloaded/cached Howl instances.
     * @param soundName The name of the file or resource to play.
     * @param isMusic True if a music, false if a sound.
     * @param volume Between 0 and 1.
     * @param loop True if it should be played looping.
     * @param rate speed at which it is played.
     */
    createHowlerSound(
      soundName: string,
      isMusic: boolean,
      volume: float,
      loop: boolean,
      rate: float
    ): HowlerSound {
      const cacheContainer = isMusic ? this._loadedMusics : this._loadedSounds;
      const resource = this._getAudioResource(soundName);

      let howl = cacheContainer.get(resource);
      if (!howl) {
        howl = new Howl(
          Object.assign(
            {
              src: this._getSoundUrlsFromResource(resource),
              html5: isMusic,
              xhr: {
                withCredentials:
                  this._resourceLoader.checkIfCredentialsRequired(
                    resource.file
                  ),
              },
              // Cache the sound with no volume. This avoids a bug where it plays at full volume
              // for a split second before setting its correct volume.
              volume: 0,
            },
            HowlParameters
          )
        );
        cacheContainer.set(resource, howl);
      }

      return new gdjs.HowlerSound(howl, volume, loop, rate);
    }

    /**
     * Preloads a sound or a music in memory.
     * @param soundName The name of the file or resource to preload.
     * @param isMusic True if a music, false if a sound.
     */