Sound Byte Libs 0.5.1-121-g3358a44
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 processing function static void start() - Begin streaming static void stop() - Stop streaming

Every block the driver clocks out advances SampleClock by its frame count (sample_clock.hpp), after the callback returns — the elapsed-samples source for control code.

Convenience Functions

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

Usage in application: #include <sbl/hw/hal/audio/driver.hpp> #include <sbl/hw/driver/sai.hpp>

sbl::audio::start<sbl::driver::Sai>(audio_callback);

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.