GithubHelp home page GithubHelp logo

richknowles / pb-macos-audioplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deseven/pb-macos-audioplayer

0.0 0.0 0.0 15 KB

macOS audio player module

License: The Unlicense

PureBasic 100.00%

pb-macos-audioplayer's Introduction

pb-macos-audioplayer

A simple wrapper built around macOS AVAudioPlayer for PureBasic. Totally asynchronous, but NOT threadsafe. Should support mp3, m4a, aac, wav, aiff, alac natively and everything else with the help of FFmpeg.

Usage

IncludeFile "audioplayer.pbi"
If audioplayer::load(0,"file.mp3")
  Debug "Playing file " + audioplayer::getPath(0)
  Debug "File duration: " + StrD(audioplayer::getDuration(0)) + " sec"
  audioplayer::play(0)
  Delay(5100)
  audioplayer::pause(0)
  Debug "Played: " +  StrD(audioplayer::getCurrentTime(0)) + " sec"
  audioplayer::stop(0)
  audioplayer::free(0)
EndIf

For advanced usage check out the included example.pb.

FFmpeg

In order to support additional formats, FFMpeg can be used by defining its path with audioplayer::setFFmpegPath(path.s) and needed formats with audioplayer::addFFmpegFormat(ext.s). This is totally optional and the module works with native formats without any external stuff. In case you want to have a portable FFmpeg and use it with your project, here's your options:

  1. You can simply grab FFmpeg from here.
  2. I made a build script that builds statically-linked (i.e. portable) FFmpeg that can process ape, flac, ogg and wv files, with a binary of just 1.4MB, you can find it here. Also check the one it's based on.
  3. Build it yourself depending on what you need, start here.

Don't forget to check legal information here - https://www.ffmpeg.org/legal.html

pb-macos-audioplayer's People

Contributors

deseven avatar

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.