CTRE Phoenix 6 C++ 24.3.0
|
Orchestra is used to play music through devices. More...
#include <ctre/phoenix6/Orchestra.hpp>
Public Member Functions | |
Orchestra () | |
Constructor for a new Orchestra. More... | |
Orchestra (char const *filepath) | |
Constructor for a new Orchestra using the given Chirp file. More... | |
Orchestra (std::vector< hardware::ParentDevice * > const &instruments) | |
Constructor for a new Orchestra using the given Chirp file. More... | |
template<size_t N> | |
Orchestra (std::array< hardware::ParentDevice *, N > const &instruments) | |
Constructor for a new Orchestra using the given Chirp file. More... | |
Orchestra (std::vector< hardware::ParentDevice * > const &instruments, char const *filepath) | |
Constructor for a new Orchestra using the given Chirp file. More... | |
template<size_t N> | |
Orchestra (std::array< hardware::ParentDevice *, N > const &instruments, char const *filepath) | |
Constructor for a new Orchestra using the given Chirp file. More... | |
~Orchestra () | |
ctre::phoenix::StatusCode | AddInstrument (hardware::ParentDevice const &instrument) |
Adds an instrument to the orchestra. More... | |
ctre::phoenix::StatusCode | AddInstrument (hardware::ParentDevice const &instrument, uint16_t trackNumber) |
Adds an instrument to the orchestra on the given track. More... | |
ctre::phoenix::StatusCode | ClearInstruments () |
Clears all instruments in the orchestra. More... | |
ctre::phoenix::StatusCode | LoadMusic (char const *filepath) |
Loads a Chirp file at the specified file path. More... | |
ctre::phoenix::StatusCode | Play () |
Plays the loaded music file. More... | |
ctre::phoenix::StatusCode | Pause () |
Pauses the loaded music file. More... | |
ctre::phoenix::StatusCode | Stop () |
Stops the loaded music file. More... | |
bool | IsPlaying () const |
Gets whether the current track is actively playing. More... | |
double | GetCurrentTime () const |
Gets the current timestamp of the music file. More... | |
Orchestra is used to play music through devices.
It uses a "Chirp" (.chrp) music file that can be generated using Phoenix Tuner. Chirp files are generated from standard MIDI files.
Any Chirp file located in the src/main/deploy directory of your FRC project will automatically be copied to the roboRIO on code deploy.
The robot must be enabled to play music. Additionally, devices playing in Orchestra will not run any other control requests while Orchestra is running. Users can Pause or Stop the Orchestra to re-enable device control.
Each device can only play a single track within the music file. For multi-track files, multiple devices are needed. Devices can be added with an explicit track number. Otherwise, the first track will be played through the first Talon FX added, the second track will be played through the second Talon FX added, etc.
To use Orchestra:
Once ready, the Orchestra can be controlled using Play/Pause/Stop. New music files can be loaded at any time.
ctre::phoenix6::Orchestra::Orchestra | ( | ) |
Constructor for a new Orchestra.
|
inline |
Constructor for a new Orchestra using the given Chirp file.
filepath | The path to the music file to immediately load into the orchestra. |
|
inline |
Constructor for a new Orchestra using the given Chirp file.
instruments | A vector of device addresses that will be used as instruments in the orchestra. |
|
inline |
Constructor for a new Orchestra using the given Chirp file.
instruments | An array of device addresses that will be used as instruments in the orchestra. |
|
inline |
Constructor for a new Orchestra using the given Chirp file.
instruments | A vector of device addresses that will be used as instruments in the orchestra. |
filepath | The path to the music file to immediately load into the orchestra. |
|
inline |
Constructor for a new Orchestra using the given Chirp file.
instruments | An array of device addresses that will be used as instruments in the orchestra. |
filepath | The path to the music file to immediately load into the orchestra. |
ctre::phoenix6::Orchestra::~Orchestra | ( | ) |
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::AddInstrument | ( | hardware::ParentDevice const & | instrument | ) |
Adds an instrument to the orchestra.
instrument | The device to add to the orchestra |
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::AddInstrument | ( | hardware::ParentDevice const & | instrument, |
uint16_t | trackNumber | ||
) |
Adds an instrument to the orchestra on the given track.
instrument | The device to add to the orchestra |
trackNumber | The track number the device should play, starting at 0 |
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::ClearInstruments | ( | ) |
Clears all instruments in the orchestra.
double ctre::phoenix6::Orchestra::GetCurrentTime | ( | ) | const |
bool ctre::phoenix6::Orchestra::IsPlaying | ( | ) | const |
Gets whether the current track is actively playing.
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::LoadMusic | ( | char const * | filepath | ) |
Loads a Chirp file at the specified file path.
If the Chirp file is inside your "src/main/deploy" directory, it will be automatically deployed to a default directory on the roboRIO when you deploy code. For these files, the name and file extension is sufficient.
A Chirp file can be created from a MIDI file using Phoenix Tuner.
filepath | The path to the Chirp file |
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::Pause | ( | ) |
Pauses the loaded music file.
This saves the current position in the track so it can be resumed later.
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::Play | ( | ) |
Plays the loaded music file.
If the player is paused, this will resume the orchestra.
ctre::phoenix::StatusCode ctre::phoenix6::Orchestra::Stop | ( | ) |
Stops the loaded music file.
This resets the current position in the track to the start.