Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
driver.hpp File Reference

Audio driver interface - canonical types and convenience functions. More...

Detailed Description

Audio driver interface - canonical types and convenience functions.

This header provides the portable audio API for Sound Byte Libs.

Audio Driver Contract

Drivers implement the following static interface:

static void init(); // configure with defaults
static void init(const AudioConfig&); // configure with custom settings
static void set_callback(AudioCallback); // register the processing function
static void start(); // begin streaming
static void stop(); // stop streaming

Before each block's callback the driver stamps the block with the system timer's count (FrameCount::stamp), and after it adds the block's frames to the frame count (FrameCount::advance); see frame_count.hpp.

Convenience Functions

sbl::audio::start<sbl::driver::Sai>(my_callback);
sbl::audio::stop<sbl::driver::Sai>();

Usage in application:

#include <sbl/hw/driver/sai.hpp>
sbl::audio::start<sbl::driver::Sai>(audio_callback);
Audio driver interface - canonical types and convenience functions.

Definition in file driver.hpp.

#include "types.hpp"

Go to the source code of this file.

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::audio
 Convenience layer: start audio with a validated driver.
 

Typedefs

using sbl::audio::AudioConfig = sbl::hal::audio::AudioConfig
 
using sbl::audio::AudioCallback = sbl::hal::audio::AudioCallback
 

Functions

template<typename Driver >
void sbl::audio::start (AudioCallback cb)
 Configure audio with defaults, set callback, and start streaming.
 
template<typename Driver >
void sbl::audio::start (const AudioConfig &config, AudioCallback cb)
 Configure with custom settings, set callback, and start streaming.
 
template<typename Driver >
void sbl::audio::stop ()
 Stop audio streaming.