issue #2103 modify audioEngine table name to AudioEngine

This commit is contained in:
samuele3hu 2013-06-08 14:06:19 +08:00
parent 34b4cb48ab
commit 836bfe1d3f
3 changed files with 44 additions and 44 deletions

View File

@ -1,4 +1,4 @@
require "audioEngine" require "AudioEngine"
local EFFECT_FILE = "effect1.wav" local EFFECT_FILE = "effect1.wav"
local MUSIC_FILE = "background.mp3" local MUSIC_FILE = "background.mp3"
@ -36,60 +36,60 @@ local function CocosDenshionTest()
local nIdx = pMenuItem:getZOrder() - 10000 local nIdx = pMenuItem:getZOrder() - 10000
-- play background music -- play background music
if nIdx == 0 then if nIdx == 0 then
audioEngine.playMusic(MUSIC_FILE, true) AudioEngine.playMusic(MUSIC_FILE, true)
elseif nIdx == 1 then elseif nIdx == 1 then
-- stop background music -- stop background music
audioEngine.stopMusic() AudioEngine.stopMusic()
elseif nIdx == 2 then elseif nIdx == 2 then
-- pause background music -- pause background music
audioEngine.pauseMusic() AudioEngine.pauseMusic()
elseif nIdx == 3 then elseif nIdx == 3 then
-- resume background music -- resume background music
audioEngine.resumeMusic() AudioEngine.resumeMusic()
-- rewind background music -- rewind background music
elseif nIdx == 4 then elseif nIdx == 4 then
audioEngine.rewindMusic() AudioEngine.rewindMusic()
elseif nIdx == 5 then elseif nIdx == 5 then
-- is background music playing -- is background music playing
if audioEngine.isMusicPlaying () then if AudioEngine.isMusicPlaying () then
cclog("background music is playing") cclog("background music is playing")
else else
cclog("background music is not playing") cclog("background music is not playing")
end end
elseif nIdx == 6 then elseif nIdx == 6 then
-- play effect -- play effect
m_nSoundId = audioEngine.playEffect(EFFECT_FILE) m_nSoundId = AudioEngine.playEffect(EFFECT_FILE)
elseif nIdx == 7 then elseif nIdx == 7 then
-- play effect -- play effect
m_nSoundId = audioEngine.playEffect(EFFECT_FILE, true) m_nSoundId = AudioEngine.playEffect(EFFECT_FILE, true)
elseif nIdx == 8 then elseif nIdx == 8 then
-- stop effect -- stop effect
audioEngine.stopEffect(m_nSoundId) AudioEngine.stopEffect(m_nSoundId)
elseif nIdx == 9 then elseif nIdx == 9 then
-- unload effect -- unload effect
audioEngine.unloadEffect(EFFECT_FILE) AudioEngine.unloadEffect(EFFECT_FILE)
elseif nIdx == 10 then elseif nIdx == 10 then
-- add bakcground music volume -- add bakcground music volume
audioEngine.setMusicVolume(audioEngine.getMusicVolume() + 0.1) AudioEngine.setMusicVolume(AudioEngine.getMusicVolume() + 0.1)
elseif nIdx == 11 then elseif nIdx == 11 then
-- sub backgroud music volume -- sub backgroud music volume
audioEngine.setMusicVolume(audioEngine.getMusicVolume() - 0.1) AudioEngine.setMusicVolume(AudioEngine.getMusicVolume() - 0.1)
elseif nIdx == 12 then elseif nIdx == 12 then
-- add effects volume -- add effects volume
audioEngine.setEffectsVolume(audioEngine.getEffectsVolume() + 0.1) AudioEngine.setEffectsVolume(AudioEngine.getEffectsVolume() + 0.1)
elseif nIdx == 13 then elseif nIdx == 13 then
-- sub effects volume -- sub effects volume
audioEngine.setEffectsVolume(audioEngine.getEffectsVolume() - 0.1) AudioEngine.setEffectsVolume(AudioEngine.getEffectsVolume() - 0.1)
elseif nIdx == 14 then elseif nIdx == 14 then
audioEngine.pauseEffect(m_nSoundId) AudioEngine.pauseEffect(m_nSoundId)
elseif nIdx == 15 then elseif nIdx == 15 then
audioEngine.resumeEffect(m_nSoundId) AudioEngine.resumeEffect(m_nSoundId)
elseif nIdx == 16 then elseif nIdx == 16 then
audioEngine.pauseAllEffects() AudioEngine.pauseAllEffects()
elseif nIdx == 17 then elseif nIdx == 17 then
audioEngine.resumeAllEffects() AudioEngine.resumeAllEffects()
elseif nIdx == 18 then elseif nIdx == 18 then
audioEngine.stopAllEffects() AudioEngine.stopAllEffects()
end end
end end
-- add menu items for tests -- add menu items for tests

View File

@ -1 +1 @@
54465b466d8d1517df1d0297972fe6c29e4bdb1c 9d61a5b14ae04510a9e3158ad944e3aea5ec334f

View File

@ -1,5 +1,5 @@
--Encapsulate SimpleAudioEngine to audioEngine,Play music and sound effects. --Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects.
audioEngine = audioEngine or {} AudioEngine = AudioEngine or {}
local sharedEngine = SimpleAudioEngine:sharedEngine() local sharedEngine = SimpleAudioEngine:sharedEngine()
@ -100,26 +100,26 @@ local function resumeEffect(handle)
end end
audioEngine.stopAllEffects = stopAllEffects AudioEngine.stopAllEffects = stopAllEffects
audioEngine.getMusicVolume = getMusicVolume AudioEngine.getMusicVolume = getMusicVolume
audioEngine.isMusicPlaying = isMusicPlaying AudioEngine.isMusicPlaying = isMusicPlaying
audioEngine.getEffectsVolume = getEffectsVolume AudioEngine.getEffectsVolume = getEffectsVolume
audioEngine.setMusicVolume = setMusicVolume AudioEngine.setMusicVolume = setMusicVolume
audioEngine.stopEffect = stopEffect AudioEngine.stopEffect = stopEffect
audioEngine.stopMusic = stopMusic AudioEngine.stopMusic = stopMusic
audioEngine.playMusic = playMusic AudioEngine.playMusic = playMusic
audioEngine.pauseAllEffects = pauseAllEffects AudioEngine.pauseAllEffects = pauseAllEffects
audioEngine.preloadMusic = preloadMusic AudioEngine.preloadMusic = preloadMusic
audioEngine.resumeMusic = resumeMusic AudioEngine.resumeMusic = resumeMusic
audioEngine.playEffect = playEffect AudioEngine.playEffect = playEffect
audioEngine.rewindMusic = rewindMusic AudioEngine.rewindMusic = rewindMusic
audioEngine.willPlayMusic = willPlayMusic AudioEngine.willPlayMusic = willPlayMusic
audioEngine.unloadEffect = unloadEffect AudioEngine.unloadEffect = unloadEffect
audioEngine.preloadEffect = preloadEffect AudioEngine.preloadEffect = preloadEffect
audioEngine.setEffectsVolume = setEffectsVolume AudioEngine.setEffectsVolume = setEffectsVolume
audioEngine.pauseEffect = pauseEffect AudioEngine.pauseEffect = pauseEffect
audioEngine.resumeAllEffects = resumeAllEffects AudioEngine.resumeAllEffects = resumeAllEffects
audioEngine.pauseMusic = pauseMusic AudioEngine.pauseMusic = pauseMusic
audioEngine.resumeEffect = resumeEffect AudioEngine.resumeEffect = resumeEffect