Giter Club home page Giter Club logo

openal-source's Introduction

OpenAL-Source

This is a project which aims to embed OpenAL into the Source Engine with a few other useful/related tools. This project pushes to take Source to accomplish new feats which it hasn't been able to do with it's in-engine audio. OpenAL for Source provides many new features to your Source games in comparison to the audio system that comes inside of the engine.

Another benefit gained from a custom audio solution is that you have direct access to the audio code in the SDK, which will provide you with more flexibility in your source games.

Features:

  • Audio moves at the speed of sound and respects the doppler effect
  • OggVorbis, MP3, FLAC and WAV Playback
  • Links audio sources to entities so that they are consistently in sync
  • Audio can be local to the player or positional
    • Uses for "local" audio include media players, in-game radio, etc.
    • Positional audio can be used to add depth to an environment
  • Samples can be grouped together based on group names
  • Relinking standard Source entities to use OpenAL instead of Miles

Coming Soon:

  • More in-game syncronization possibly including:
    • Under water audio distortion
    • Occlusion culling (if Source allows)
    • Deafening effects
  • Entities allowing mappers to modify the state of the system
  • Fourier analysis system for beat detection and more

Notes:

All samples currently are not transient. They will not be removed on map change or if any other game-based event occurs - aside from quitting the game altogether. This is being worked on.

Remember that multi-channel audio can not be used as positional audio, so make sure that all positional sound effects are mono files.

openal-source's People

Contributors

monokrome avatar

Stargazers

 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  avatar

openal-source's Issues

WAV files require little-endian system

Loading of WAV files requires that the operating system uses little-endian data. We need to modify the system so that consoles, older OS X systems, and some Linux distributions aren't effected by this issue in case these systems are being used by the game or in the preparation for the possibility that Source modding is ported to these systems.

Looping doesn't work properly

There is an issue where the system wont properly seek back to the beginning of a sample's file when set to loop. This could be related to Source's Seek method not returning error information, or it could be related to the looping code itself.

The sample pool must respect positional audio

Currently the sample pool takes little account of samples that require positional audio. To fix this, at least three changes are needed:

-Upon creating the sample, the pool must take notice of any parameters that exists to mark a sample as positional or not.

-The sample pool needs to be made responsible for updating positional properties of all samples that depend on positional parameters.

-The OpenAL manager needs to take care of properly updating the listener position, orientation, and velocity. Currently the threaded design prevents this because GetAbsOrigin's are calculated from frame to frame, and are not always valid. The IsAbsQueriesValid function always returns true for threads other than the main thread, making it difficult to implement the update code using this function.

SoundEmitterSystem.cpp is a Valve file

Valve files should not be included in this project for the following reasons:

  • This aims to be simple to install on any SDK version. Portability should be a high priority. Copying the file from a specific SDK does not guarantee support with later versions, nor does it help with forward-compatibility with the Source SDK. The more code that we need to maintain from Valve's SDK files, the more work will be needed on our end to support new SDK versions or possibly licensed Source games interested in the project.
  • There Source SDK's license seems to be unannounced based on my searching. I'm not sure if we can legally provide modified copies their files.

Instead, we should have a routing class in a file of our own that we can have users include with a few short lines in an installation documentation file explaining the rerouting process and any limitations that maybe be imposed from this method.

Cmd line parameter -disable_openal

If an end user is having trouble using the OpenAL system, there should be a cmd line parameter such as -disable_openal to prevent the user from being unable to play a mod using it. The router would then pass all sound events back to the default Miles system, and only a bare minimum of the OpenAL code will be executed.

All audio samples are streamed.

Currently, IOpenALSample only supports audio streaming. This is possibly inefficient for small sound effects, as they should instead be completely loaded - played - and then disposed of.

There is no reason why this should be streamed. Although, I don't think there's too much of a performance decrease either way.

Ideally, samples should have a SetStreaming() method.

Sound files containing less than 256kb uncompressed PCM data won't play

The number of buffers are hard-coded to 4. This makes life hard for samples trying to play sounds with less than 4xBuffer size of data, because it's unable to fill all buffers. The system is then led to believe that the stream is not containing audio data.

See the first loop at IOpenALSample::Play()

Samples and Sources should be separate

A sample is a specific sound, while a source is a description of where/how the sound is being emitted. This project initially kept the source and sample together within the same object, but there are noticeable performance gains available when using them as separate objects.

The most notable gain would be that multiple sources using the same sound file don't need to load the sound file multiple times. If we have 10 of the same monster, for instance - they are currently all loading their sound files separately instead of sharing the same resources.

Furthermore, as per issue #5 we also would benefit from caching these sounds outside of IOpenALSample for another performance gain.

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.