Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local AudioSprite JSON data object support #1447

Closed
wants to merge 2 commits into from
Closed

Conversation

jounii
Copy link
Contributor

@jounii jounii commented Dec 12, 2014

Tested with modified audio sprite phaser-examples example. If ok, modified example could be another PR

@jounii
Copy link
Contributor Author

jounii commented Dec 12, 2014

Similar usage as with textureatlas. Usage example:

    game.load.audiosprite('sfx', 'assets/audio/SoundEffects/fx_mixdown.ogg', null, {
        spritemap: {
            'alien death': {
                start: 1,
                end: 2,
                loop: false
            },
            'boss hit': {
                start: 3,
                end: 3.5,
                loop: false
            },
            'escape': {
                start: 4,
                end: 7.2,
                loop: false
            },
            'meow': {
                start: 8,
                end: 8.5,
                loop: false
            },
            'numkey': {
                start: 9,
                end: 9.1,
                loop: false
            },
            'ping': {
                start: 10,
                end: 11,
                loop: false
            },
            'death': {
                start: 12,
                end: 16.2,
                loop: false
            },
            'shot': {
                start: 17,
                end: 18,
                loop: false
            },
            'squit': {
                start: 19,
                end: 19.3,
                loop: false
            }
        }
    });

photonstorm added a commit that referenced this pull request Feb 11, 2015
…ass a pre-existing JSON object (or a string which will be parsed as JSON) to use as the audiosprite data, instead of specifying a URL to a JSON file on the server (thanks @jounii #1447)

Loader.audiosprite has a new `autoDecode` parameter. If `true` the audio file will be decoded immediately upon load.
@photonstorm
Copy link
Collaborator

Thanks for this! I have implemented my own take on providing this feature which is now in dev, but thanks for the suggestion and example json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants