Giter Site home page Giter Site logo

wavein's Introduction

WaveIn

Very simple audio acquisition class for bcc32c/bcc64 compilers

Description

It is a very small header-only library for capturing audio with Windows. It consists of only one header file, although an "empty" .cpp file is paired with the .h file to form a so-called Unit.

Internally, it uses a callback procedure from Multimedia API (mmeapi.h header) to produce another callback in the context of the running class instance (object), so be careful because the code of the callback runs in the context of a separated multimedia thread.

Usage

The usage is fairly simple: first, include the header file WaveIn.h and declare a specific WaveInCO device according with the type of sample to treat:

#include <cstdint>

#include "WaveIn.h"

// Declare a type representing a WaveIn device treating 16 bit signed samples
using WaveInType = App::WaveInCO<int16_t>;

Then, lets define an instance passing some parameters (device, input channel count, buffer(s) length, and sample rate) and the callable object (lambda, function, functor... etc). In the example below, a lambda was used.

// Declare an instance
WaveInCO  Wi( 
  0,      // Input device number 
  2,      // Stereo channels (2 channels)
  1024,   // 1 KiB buffer lenght
  44100,   // Sample rate (CD)
  []( auto& Buffer ) {
    // Buffer contains the samples to process
    // In this example, Buffer is a
    // 
    //    std::vector<int16_t> const &
    // 
    // Note: this code runs in the context 
    // of a separate thread from the one that
    // created the WaveInCO object.
  }
);

// Start acquisition
Wi.Start(); 

Finally, when the acquisition has to end, just call the Stop function (or destroy the instance).

Wi.Stop();

wavein's People

Contributors

gcardi avatar

Watchers

 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.