Code Monkey home page Code Monkey logo

liteninja-audioservice's Introduction

LiteNinja Audio Service

LiteNinja Audio Service is a C# library that provides a simple and efficient way to manage and play audio in your Unity3D application. It includes two main services: IMusicService and ISoundService.

Dependencies

  • DOTween (for Music fade in/out)

Getting Started

To use the LiteNinja Audio Service, you first need to install it. You can do this by adding it as a dependency in your project.

Dependencies

  • DOTween

Usage

Music Service

The IMusicService interface provides methods for playing and stopping music tracks. It supports playing a track with or without a fade effect, and stopping a track with or without a fade effect.

Here's an example of how to use the IMusicService:

IMusicService musicService = ... // Get the music service instance
AudioClip clip = ... // Get the AudioClip to play

// Play the AudioClip with a fade effect
musicService.Play(clip, true);

// Stop the currently playing AudioClip with a fade effect
musicService.Stop(true);

Sound Service

The ISoundService interface provides methods for playing sound effects at a specific position with a given volume and pitch.

Here's an example of how to use the ISoundService:

ISoundService soundService = ... // Get the sound service instance
AudioClip clip = ... // Get the AudioClip to play
Vector3 position = ... // The position where the sound should be played

// Play the AudioClip at the specified position with a volume of 1 and a pitch of 1
soundService.Play(clip, position, 1f, 1f);

Error Handling

If there's an error while using the services, the library will throw an exception. You can catch these exceptions and handle them in a way that makes sense for your application.

Further Reading

For more detailed information about the classes and methods in the LiteNinja Audio Service, please refer to the inline documentation in the source code.

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.