mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
1 line
No EOL
18 KiB
JSON
1 line
No EOL
18 KiB
JSON
{"class":{"name":"Phaser.Sound","extends":"","static":false,"constructor":true,"parameters":[{"name":"game","type":["Phaser.Game"],"help":"Reference to the current game instance.","optional":false,"default":null},{"name":"key","type":["string"],"help":"Asset key for the sound.","optional":false,"default":null},{"name":"volume","type":["number"],"help":"Default value for the volume, between 0 and 1.","optional":true,"default":"1"},{"name":"loop","type":["boolean"],"help":"Whether or not the sound will loop.","optional":true,"default":"false"}],"help":"The Sound class constructor."},"consts":[],"methods":{"public":[{"name":"addMarker","static":false,"returns":null,"help":"Adds a marker into the current Sound. A marker is represented by a unique key and a start time and duration.\\nThis allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback.","line":346,"public":true,"protected":false,"private":false,"parameters":[{"name":"name","type":["string"],"help":"A unique name for this marker, i.e. 'explosion', 'gunshot', etc.","optional":false,"default":null},{"name":"start","type":["number"],"help":"The start point of this marker in the audio file, given in seconds. 2.5 = 2500ms, 0.5 = 500ms, etc.","optional":false,"default":null},{"name":"duration","type":["number"],"help":"The duration of the marker in seconds. 2.5 = 2500ms, 0.5 = 500ms, etc.","optional":false,"default":null},{"name":"volume","type":["number"],"help":"The volume the sound will play back at, between 0 (silent) and 1 (full volume).","optional":true,"default":"1"},{"name":"loop","type":["boolean"],"help":"Sets if the sound will loop or not.","optional":true,"default":"false"}],"inherited":false,"inheritedFrom":""},{"name":"destroy","static":false,"returns":null,"help":"Destroys this sound and all associated events and removes it from the SoundManager.","line":881,"public":true,"protected":false,"private":false,"parameters":[{"name":"remove","type":["boolean"],"help":"If true this Sound is automatically removed from the SoundManager.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"fadeIn","static":false,"returns":null,"help":"Starts this sound playing (or restarts it if already doing so) and sets the volume to zero.\\nThen increases the volume from 0 to 1 over the duration specified.\\nAt the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,\\nand the final volume (1) as the second parameter.","line":799,"public":true,"protected":false,"private":false,"parameters":[{"name":"duration","type":["number"],"help":"The time in milliseconds over which the Sound should fade in.","optional":true,"default":"1000"},{"name":"loop","type":["boolean"],"help":"Should the Sound be set to loop? Note that this doesn't cause the fade to repeat.","optional":true,"default":"false"}],"inherited":false,"inheritedFrom":""},{"name":"fadeOut","static":false,"returns":null,"help":"Decreases the volume of this Sound from its current value to 0 over the duration specified.\\nAt the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,\\nand the final volume (0) as the second parameter.","line":822,"public":true,"protected":false,"private":false,"parameters":[{"name":"duration","type":["number"],"help":"The time in milliseconds over which the Sound should fade out.","optional":true,"default":"1000"}],"inherited":false,"inheritedFrom":""},{"name":"fadeTo","static":false,"returns":null,"help":"Fades the volume of this Sound from its current value to the given volume over the duration specified.\\nAt the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,\\nand the final volume (volume) as the second parameter.","line":837,"public":true,"protected":false,"private":false,"parameters":[{"name":"duration","type":["number"],"help":"The time in milliseconds during which the Sound should fade out.","optional":true,"default":"1000"},{"name":"volume","type":["number"],"help":"The volume which the Sound should fade to. This is a value between 0 and 1.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"pause","static":false,"returns":null,"help":"Pauses the sound.","line":673,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"play","static":false,"returns":{"types":["Phaser.Sound"],"help":"This sound instance."},"help":"Play this sound, or a marked section of it.","line":448,"public":true,"protected":false,"private":false,"parameters":[{"name":"marker","type":["string"],"help":"If you want to play a marker then give the key here, otherwise leave blank to play the full sound.","optional":true,"default":"''"},{"name":"position","type":["number"],"help":"The starting position to play the sound from - this is ignored if you provide a marker.","optional":true,"default":"0"},{"name":"volume","type":["number"],"help":"Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).","optional":true,"default":"1"},{"name":"loop","type":["boolean"],"help":"Loop when it finished playing?","optional":true,"default":"false"},{"name":"forceRestart","type":["boolean"],"help":"If the sound is already playing you can set forceRestart to restart it from the beginning.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"removeMarker","static":false,"returns":null,"help":"Removes a marker from the sound.","line":368,"public":true,"protected":false,"private":false,"parameters":[{"name":"name","type":["string"],"help":"The key of the marker to remove.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"restart","static":false,"returns":null,"help":"Restart the sound, or a marked section of it.","line":657,"public":true,"protected":false,"private":false,"parameters":[{"name":"marker","type":["string"],"help":"If you want to play a marker then give the key here, otherwise leave blank to play the full sound.","optional":true,"default":"''"},{"name":"position","type":["number"],"help":"The starting position to play the sound from - this is ignored if you provide a marker.","optional":true,"default":"0"},{"name":"volume","type":["number"],"help":"Volume of the sound you want to play.","optional":true,"default":"1"},{"name":"loop","type":["boolean"],"help":"Loop when it finished playing?","optional":true,"default":"false"}],"inherited":false,"inheritedFrom":""},{"name":"resume","static":false,"returns":null,"help":"Resumes the sound.","line":691,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"stop","static":false,"returns":null,"help":"Stop playing this sound.","line":744,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""}],"protected":[{"name":"soundHasUnlocked","static":false,"returns":null,"help":"Called automatically when this sound is unlocked.","line":325,"public":false,"protected":true,"private":false,"parameters":[{"name":"key","type":["string"],"help":"The Phaser.Cache key of the sound file to check for decoding.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"update","static":false,"returns":null,"help":"Called automatically by Phaser.SoundManager.","line":379,"public":false,"protected":true,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""}],"private":[{"name":"fadeComplete","static":false,"returns":null,"help":"Internal handler for Sound.fadeIn, Sound.fadeOut and Sound.fadeTo.","line":864,"public":false,"protected":false,"private":true,"parameters":[],"inherited":false,"inheritedFrom":""}],"static":[]},"properties":{"public":[{"name":"allowMultiple","type":["boolean"],"help":"","inlineHelp":"This will allow you to have multiple instances of this Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels.","line":144,"default":"false","public":true,"protected":false,"private":false,"readOnly":false},{"name":"autoplay","type":["boolean"],"help":"","inlineHelp":"Boolean indicating whether the sound should start automatically.","line":62,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"context","type":["AudioContext"],"help":"","inlineHelp":"Reference to the AudioContext instance.","line":57,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"currentMarker","type":["string"],"help":"","inlineHelp":"The string ID of the currently playing marker, if any.","line":126,"default":"''","public":true,"protected":false,"private":false,"readOnly":false},{"name":"currentTime","type":["number"],"help":"","inlineHelp":"The current time the sound is at.","line":78,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"duration","type":["number"],"help":"","inlineHelp":"The duration of the current sound marker in seconds.","line":83,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"durationMS","type":["number"],"help":"","inlineHelp":"The duration of the current sound marker in ms.","line":88,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"externalNode","type":["object"],"help":"","inlineHelp":"If defined this Sound won't connect to the SoundManager master gain node, but will instead connect to externalNode.","line":160,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"gainNode","type":["object"],"help":"","inlineHelp":"The gain node in a Web Audio system.","line":170,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"game","type":["Phaser.Game"],"help":"A reference to the currently running Game.","inlineHelp":"","line":27,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"isDecoded","type":["boolean"],"help":"","inlineHelp":"Returns true if the sound file has decoded.","line":932,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"isDecoding","type":["boolean"],"help":"","inlineHelp":"Returns true if the sound file is still decoding.","line":919,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"isPlaying","type":["boolean"],"help":"","inlineHelp":"true if the sound is currently playing, otherwise false.","line":120,"default":"false","public":true,"protected":false,"private":false,"readOnly":false},{"name":"key","type":["string"],"help":"","inlineHelp":"Asset key for the sound.","line":37,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"loop","type":["boolean"],"help":"","inlineHelp":"Whether or not the sound or current sound marker will loop.","line":42,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"markers","type":["object"],"help":"","inlineHelp":"The sound markers.","line":52,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"masterGainNode","type":["object"],"help":"","inlineHelp":"The master gain node in a Web Audio system.","line":165,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"mute","type":["boolean"],"help":"","inlineHelp":"Gets or sets the muted state of this sound.","line":944,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"name","type":["string"],"help":"","inlineHelp":"Name of the sound.","line":32,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onDecoded","type":["Phaser.Signal"],"help":"","inlineHelp":"The onDecoded event is dispatched when the sound has finished decoding (typically for mp3 files)","line":214,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onFadeComplete","type":["Phaser.Signal"],"help":"","inlineHelp":"The onFadeComplete event is dispatched when this sound finishes fading either in or out.","line":254,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onLoop","type":["Phaser.Signal"],"help":"","inlineHelp":"The onLoop event is dispatched when this sound loops during playback.","line":234,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onMarkerComplete","type":["Phaser.Signal"],"help":"","inlineHelp":"The onMarkerComplete event is dispatched when a marker within this sound completes playback.","line":249,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onMute","type":["Phaser.Signal"],"help":"","inlineHelp":"The onMouse event is dispatched when this sound is muted.","line":244,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onPause","type":["Phaser.Signal"],"help":"","inlineHelp":"The onPause event is dispatched when this sound is paused.","line":224,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onPlay","type":["Phaser.Signal"],"help":"","inlineHelp":"The onPlay event is dispatched each time this sound is played.","line":219,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onResume","type":["Phaser.Signal"],"help":"","inlineHelp":"The onResume event is dispatched when this sound is resumed from a paused state.","line":229,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onStop","type":["Phaser.Signal"],"help":"","inlineHelp":"The onStop event is dispatched when this sound stops playback.","line":239,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"override","type":["boolean"],"help":"","inlineHelp":"if true when you play this sound it will always start from the beginning.","line":138,"default":"false","public":true,"protected":false,"private":false,"readOnly":false},{"name":"paused","type":["boolean"],"help":"","inlineHelp":"true if the sound is paused, otherwise false.","line":104,"default":"false","public":true,"protected":false,"private":false,"readOnly":false},{"name":"pausedPosition","type":["number"],"help":"","inlineHelp":"The position the sound had reached when it was paused.","line":109,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"pausedTime","type":["number"],"help":"","inlineHelp":"The game time at which the sound was paused.","line":114,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"pendingPlayback","type":["boolean"],"help":"","inlineHelp":"true if the sound file is pending playback","line":132,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"position","type":["number"],"help":"","inlineHelp":"The position of the current sound marker.","line":93,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"startTime","type":["number"],"help":"","inlineHelp":"The time the Sound starts at (typically 0 unless starting from a marker)","line":73,"default":"0","public":true,"protected":false,"private":false,"readOnly":false},{"name":"stopTime","type":["number"],"help":"","inlineHelp":"The time the sound stopped.","line":98,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"totalDuration","type":["number"],"help":"","inlineHelp":"The total duration of the sound in seconds.","line":67,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"usingAudioTag","type":["boolean"],"help":"","inlineHelp":"true if the sound is being played via the Audio tag.","line":155,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"usingWebAudio","type":["boolean"],"help":"","inlineHelp":"true if this sound is being played with Web Audio.","line":150,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"volume","type":["number"],"help":"","inlineHelp":"Gets or sets the volume of this sound, a value between 0 and 1.","line":996,"default":null,"public":true,"protected":false,"private":false,"readOnly":true}],"protected":[],"private":[{"name":"_buffer","type":["any"],"help":"","inlineHelp":"Decoded data buffer \/ Audio tag.","line":266,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_muteVolume","type":["number"],"help":"","inlineHelp":"Internal cache var.","line":296,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_muted","type":["boolean"],"help":"","inlineHelp":"Boolean indicating whether the sound is muted or not.","line":272,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_onDecodedEventDispatched","type":["boolean"],"help":"","inlineHelp":"Was the onDecoded event dispatched?","line":314,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_paused","type":["boolean"],"help":"","inlineHelp":"Was this sound paused via code or a game event?","line":308,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_tempLoop","type":["boolean"],"help":"","inlineHelp":"Internal cache var.","line":302,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_tempMarker","type":["number"],"help":"","inlineHelp":"Internal marker var.","line":278,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_tempPosition","type":["number"],"help":"","inlineHelp":"Internal marker var.","line":284,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_tempVolume","type":["number"],"help":"","inlineHelp":"Internal marker var.","line":290,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_volume","type":["number"],"help":"","inlineHelp":"The global audio volume. A value between 0 (silence) and 1 (full volume).","line":260,"default":null,"public":false,"protected":false,"private":true,"readOnly":false}]}} |