|
1 | 1 | # SoundEffect |
2 | 2 | SoundEffect is a full featured class for playing audio in iOS, OS X and tvOS apps. |
| 3 | + |
| 4 | +#Usage |
| 5 | + |
| 6 | +```swift |
| 7 | +// Initialize Options |
| 8 | +let soundEffect = SoundEffect("sound", fileType: ".mp3", enableSound: true, enableLooping: true, defaultVolume: 0.5) |
| 9 | + |
| 10 | +let soundEffect2 = SoundEffect("sound", fileType: ".mp3", enableSound: true, enableLooping: true, loopTotal: 20, defaultVolume: 1.0) |
| 11 | + |
| 12 | +let soundEffect3 = SoundEffect("sound", fileType: ".mp3", enableSound: true, enableLooping: false) |
| 13 | + |
| 14 | +let soundEffect4 = SoundEffect("sound", fileType: ".mp3") |
| 15 | + |
| 16 | +// Prepare to Play |
| 17 | +soundEffect.prepareToPlay() |
| 18 | + |
| 19 | +// Start Playing |
| 20 | +soundEffect.play() |
| 21 | + |
| 22 | +// Pause Playing |
| 23 | +soundEffect.pause() |
| 24 | + |
| 25 | +// Stop Playing |
| 26 | +soundEffect.stop() |
| 27 | + |
| 28 | +// Toggle Enabled |
| 29 | +soundEffect.toggle() |
| 30 | + |
| 31 | +// Disable Sound |
| 32 | +soundEffect.disable() |
| 33 | + |
| 34 | +// Enable Sound |
| 35 | +soundEffect.enable() |
| 36 | + |
| 37 | +// Set Volume |
| 38 | +soundEffect.setVolume(1.0) // Float 0.0-1.0 |
| 39 | + |
| 40 | +``` |
| 41 | + |
| 42 | +#Related Projects: |
| 43 | + |
| 44 | +###Example Swift Apps by Mark Hamilton, Dryverless |
| 45 | +Collection of example applications written in Swift / Objective-C for iOS 9.x (developed under 9.2.1 SDK - will be migrated to 9.3 when released) |
| 46 | +######https://github.com/TheDarkCode/Example-Swift-Apps |
| 47 | + |
| 48 | +#Support: |
| 49 | + |
| 50 | +#####Send any questions or requests to: [email protected] |
| 51 | + |
| 52 | +# Contributing in 5 Easy Steps |
| 53 | + |
| 54 | + - 1) Fork this repository! |
| 55 | + - 2) Create your feature branch: ```git checkout -b Your-New-Feature``` |
| 56 | + - 3) Commit your changes: ```git commit -am 'Adding some super awesome update'``` |
| 57 | + - 4) Push to the branch: ```git push origin Your-New-Feature``` |
| 58 | + - 5) Submit a pull request! |
| 59 | + |
| 60 | +# License |
| 61 | +Copyright (c) 2016 Mark Hamilton / dryverless (http://www.dryverless.com) |
| 62 | + |
| 63 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 64 | +of this software and associated documentation files (the "Software"), to deal |
| 65 | +in the Software without restriction, including without limitation the rights |
| 66 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 67 | +copies of the Software, and to permit persons to whom the Software is |
| 68 | +furnished to do so, subject to the following conditions: |
| 69 | + |
| 70 | +The above copyright notice and this permission notice shall be included in all |
| 71 | +copies or substantial portions of the Software. |
| 72 | + |
| 73 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 74 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 75 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 76 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 77 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 78 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 79 | +SOFTWARE. |
0 commit comments