annotate src/scripts/audio.lua @ 1448:108ee2e81f65 default tip

Fix a case typo, imageData.h -> ImageData.h
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 18 Jan 2014 13:57:44 +0100
parents b7f097053d74
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1096
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
1 --[[
1282
b7f097053d74 Updated copyright text for the new year
Alex Szpakowski <slime73@gmail.com>
parents: 1096
diff changeset
2 Copyright (c) 2006-2013 LOVE Development Team
1096
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
3
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
4 This software is provided 'as-is', without any express or implied
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
5 warranty. In no event will the authors be held liable for any damages
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
6 arising from the use of this software.
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
7
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
8 Permission is granted to anyone to use this software for any purpose,
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
9 including commercial applications, and to alter it and redistribute it
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
10 freely, subject to the following restrictions:
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
11
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
12 1. The origin of this software must not be misrepresented; you must not
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
13 claim that you wrote the original software. If you use this software
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
14 in a product, an acknowledgment in the product documentation would be
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
15 appreciated but is not required.
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
16 2. Altered source versions must be plainly marked as such, and must not be
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
17 misrepresented as being the original software.
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
18 3. This notice may not be removed or altered from any source distribution.
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
19 --]]
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
20
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
21 function love.audio.newSource(a, b)
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
22 if type(a) == "string" then
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
23 a = love.filesystem.newFile(a)
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
24 end
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
25 if type(a) == "userdata" then
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
26 if a:typeOf("File") then
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
27 a = love.sound.newDecoder(a)
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
28 end
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
29
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
30 if a:typeOf("Decoder") then
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
31 if b == "static" then
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
32 a = love.sound.newSoundData(a)
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
33 end
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
34 return love.audio.newSource1(a)
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
35 end
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
36 if a:typeOf("SoundData") then
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
37 return love.audio.newSource1(a)
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
38 end
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
39 end
86a44f2bc38f CRLF to LF
Bart van Strien <bart.bes+projects@gmail.com>
parents: 958
diff changeset
40 error("No matching overload")
210
1401d3998edd Major developments to love.audio/love.sound. Music and Sound are gone. There are only Sources now, which is much cleaner.
rude
parents:
diff changeset
41 end