Dualie
Loading...
Searching...
No Matches
dl::Music Class Reference

A class that handles the playback of opus audio files. More...

#include <Music.hpp>

Public Member Functions

void loadFromFile (std::string path)
 loads a opus file from romfs
 
void play ()
 Plays the opus music file loaded.
 
void restart ()
 Restarts the song from the beginning. If playback is stopped, it plays it.
 
void stop ()
 Stops the currently playing song. Maintains the current position of the music.
 
void setLooping (bool looping)
 Sets whether the music should loop when finished.
 

Static Public Attributes

static constexpr int SAMPLE_RATE = 48000
 
static constexpr int SAMPLES_PER_BUF = SAMPLE_RATE * 120 / 1000
 
static constexpr int CHANNELS_PER_SAMPLE = 2
 
static constexpr int THREAD_AFFINITY = -1
 
static constexpr int THREAD_STACK_SZ = 32 * 1024
 
static constexpr size_t WAVEBUF_SIZE = SAMPLES_PER_BUF * CHANNELS_PER_SAMPLE * sizeof(int16_t)
 

Detailed Description

A class that handles the playback of opus audio files.

Member Function Documentation

◆ loadFromFile()

void dl::Music::loadFromFile ( std::string path)

loads a opus file from romfs

Parameters
pathThe path of the file to open

◆ setLooping()

void dl::Music::setLooping ( bool looping)

Sets whether the music should loop when finished.

Parameters
loopingMusic should loop or not

The documentation for this class was generated from the following files: