diff options
author | Michael Bishop <mbtyke@gmail.com> | 2013-03-08 17:10:27 -0500 |
---|---|---|
committer | Michael Bishop <mbtyke@gmail.com> | 2013-03-08 17:10:27 -0500 |
commit | 03c82a1c25d6551675d3191810eecd628df04b3c (patch) | |
tree | 21c1fa65a74e0791f11ec551cd1c7a9e7c278185 /src/library_sdl.js | |
parent | a3fa0380155176e4d60159ccc5f2a264268863ac (diff) |
Add support for `Mix_ReserveChannels`
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 5033b27e..a7a59a89 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1235,6 +1235,7 @@ var LibrarySDL = { Mix_Init: function(flags) { if (!flags) return 0; + SDL.channelMinimumNumber = 0; return 8; /* MIX_INIT_OGG */ }, Mix_Quit: function(){}, @@ -1317,7 +1318,9 @@ var LibrarySDL = { Mix_FreeChunk: function(id) { SDL.audios[id] = null; }, - + Mix_ReserveChannels: function(num) { + SDL.channelMinimumNumber = num; + }, Mix_PlayChannel: function(channel, id, loops) { // TODO: handle loops @@ -1333,7 +1336,7 @@ var LibrarySDL = { channel = 0; for (var i = 0; i < SDL.numChannels; i++) { if (!SDL.channels[i].audio) { - channel = i; + channel = [Math.max(i, SDL.channelMinimumNumber)]; break; } } @@ -1497,7 +1500,7 @@ var LibrarySDL = { if (id === -1) { var count = 0; for (var i = 0; i < SDL.audios.length; i++) { - count += SDL.Mix_Playing(i); + count += _Mix_Playing(i); } return count; } @@ -1511,7 +1514,7 @@ var LibrarySDL = { Mix_Pause: function(id) { if (id === -1) { for (var i = 0; i<SDL.audios.length;i++) { - SDL.Mix_Pause(i); + _Mix_Pause(i); } return; } @@ -1526,7 +1529,7 @@ var LibrarySDL = { if (id === -1) { var pausedCount = 0; for (var i = 0; i<SDL.audios.length;i++) { - pausedCount += SDL.Mix_Paused(i); + pausedCount += _Mix_Paused(i); } return pausedCount; } @@ -1545,7 +1548,7 @@ var LibrarySDL = { Mix_Resume: function(id) { if (id === -1) { for (var i = 0; i<SDL.audios.length;i++) { - SDL.Mix_Resume(i); + _Mix_Resume(i); } return; } |