Skip to content

A high performance VoIP audio lib for swiftlys2.

License

Notifications You must be signed in to change notification settings

SwiftlyS2-Plugins/Audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio

A high performance VoIP audio lib for swiftlys2.

Build Status Downloads Stars License

Get Started

Download Plugin

Download the plugin from the latest release and install it on your server.

Include API In Your Project

Add following lines to your .csproj file:

  <PackageReference Include="SwiftlyS2.Plugin.Audio.API" Version="2.0.0" />

Configuration

You can find the configuration file in addons/swiftlys2/configs/plugins/Audio/config.jsonc after the plugin has properly started up once.

The configuration keys are as follows.

OpusComplexity

Control the complexity of opus encoder, ranging from 0 to 10 ( 10 by default ).

The higher the complexity is, the better the encoding quality but the slower the encoding speed.

You can try to lower this if you experience audio lag.

UseFFMpeg

Whether to use ffmpeg as the pcm decoder, set to false by default.

Only enable this if you have correct ffmpeg executable installed and it exists in PATH.

Otherwise the native rust pcm decoder will be used.

API Example

public override void UseSharedInterface(IInterfaceManager interfaceManager)
{
  // get api, you can store it in other place, but remember to reset it every time this method is called
  IAudioApi api = interfaceManager.GetSharedInterface<IAudioApi>("audio");

  // get a channel for your plugin
  IAudioChannelController controller = api.UseChannel("test");

  /// decode source from mp3 file
  IAudioSource source = api.DecodeFromFile("E:/p.mp3");

  // assign source to the channel
  controller.SetSource(source);

  // adjust volume
  controller.SetVolumeToAll(0.5f);

  // play
  controller.PlayToAll();
}

To see more api, please check AudioApi

About

A high performance VoIP audio lib for swiftlys2.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors