Git Product home page Git Product logo

chirp's Introduction

Chirp

The easiest way to prepare, play, and remove sounds in your Swift app!

##Installation ###CocoaPods Installation Chirp is available on CocoaPods. Just add the following to your project Podfile:

pod 'Chirp', '~> 1.2'

###Non-CocoaPods Installation You can drop Chirp.swift directly into your project, or drag the Chirp project into your workspace.

Sample code

prepareSound is used to preload a sound into memory. This increases the retain count of the sound by 1. You must call this method before calling playSound

/* MyViewController.swift */

override func viewDidLoad() {
    super.viewDidLoad()
    
    // Load sounds into memory
    Chirp.sharedManager.prepareSound("boop") // default extension is .wav
    Chirp.sharedManager.prepareSound("ding.mp3") // so other extensions you must name explicitly
}

playSound plays the preloaded sound

func submitButtonTouched(button: UIButton) {
    // Since the sound is already loaded into memory, this will play immediately
    Chirp.sharedManager.playSound("boop") 
    
    // example function that might get called when you touch a button
    submitForm() 
}

removeSound removes the sound from memory

deinit {
    // Cleanup is really simple!
    Chirp.sharedManager.removeSound("boop")
    Chirp.sharedManager.removeSound("ding.mp3")
    Chirp.sharedManager.removeSound("oops.mp3")
    
    // If you never loaded the sounds, e.g. viewDidLoad wasn't called, or submission never failed or succeeded,
    // that's ok, because these will function as no-ops
}

Enjoy! I know sound management can be a little annoying. Hopefully this helps your project out a little bit.

chirp's People

Contributors

jpmcglone avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chirp's Issues

Swift 3 compatibility

Hey, I'd love to see this lib available in Swift 3 so I can implement it in my project.

Thanks ๐Ÿ˜„

linker error

i tried compiling and got this error

ld: framework not found Chirp
clang: error: linker command failed with exit code 1 (use -v to see invocation)

any suggestions?

thanks

julian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.