CTRE Phoenix C++ 5.33.1
|
An Orchestra is used to play music through Talon FX motor controllers. More...
#include <ctre/phoenix/music/Orchestra.h>
Public Member Functions | |
Orchestra () | |
Constructor for an Orchestra Object. More... | |
ErrorCode | LoadMusic (const std::string &filePath) |
Loads a Chirp file at the specified file path. More... | |
ErrorCode | Play () |
Plays the music file that's loaded. More... | |
ErrorCode | Pause () |
Pauses the music file that's loaded. More... | |
ErrorCode | Stop () |
Stops the music file that's loaded. More... | |
bool | IsPlaying () |
Returns whether the current track is actively playing or not. More... | |
uint32_t | GetCurrentTime () |
ErrorCode | AddInstrument (ctre::phoenix::motorcontrol::can::TalonFX &instrument) |
Adds another instrument to the orchestra. More... | |
ErrorCode | ClearInstruments () |
Clears all instruments in the orchestra. More... | |
An Orchestra is used to play music through Talon FX motor controllers.
It uses a "Chirp" (.chrp) music file that can be generated using Phoenix Tuner.
Chirp files are generated from standard MIDI files. Each Talon FX can only play a single track within the music file. For multi-track files, multiple Talon FXs are needed. ie, 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.
Any Chirp file located in the src/main/deploy directory of your FRC project will automatically be copied to the roboRIO on code deploy.
To use the Orchestra:
Once ready, the Orchestra can be controlled using standard play/pause/stop routines.
New music files can be loaded at any time.
The robot must be enabled to play music.
Calling set on any of the TalonFX instruments while the orchestra is playing will pause the orchestra.
ctre::phoenix::music::Orchestra::Orchestra | ( | ) |
Constructor for an Orchestra Object.
Call AddInstrument after this to add the instruments.
ErrorCode ctre::phoenix::music::Orchestra::AddInstrument | ( | ctre::phoenix::motorcontrol::can::TalonFX & | instrument | ) |
Adds another instrument to the orchestra.
instrument | TalonFX to add to orchestra |
ErrorCode ctre::phoenix::music::Orchestra::ClearInstruments | ( | ) |
Clears all instruments in the orchestra.
uint32_t ctre::phoenix::music::Orchestra::GetCurrentTime | ( | ) |
bool ctre::phoenix::music::Orchestra::IsPlaying | ( | ) |
Returns whether the current track is actively playing or not.
ErrorCode ctre::phoenix::music::Orchestra::LoadMusic | ( | const std::string & | filePath | ) |
Loads a Chirp file at the specified file path.
If the Chirp file is inside your "src/main/deploy" directory this file will be automatically deployed to a default directory in the RoboRIO when you deploy code. For these files, the name and file extension is sufficient.
Use Tuner to create a Chirp file.
filepath | The path to the Chirp File. |
ErrorCode ctre::phoenix::music::Orchestra::Pause | ( | ) |
Pauses the music file that's loaded.
This saves the current position in the track, so it can be resumed later. Pausing while stopped is an invalid request.
ErrorCode ctre::phoenix::music::Orchestra::Play | ( | ) |
Plays the music file that's loaded.
If the player is paused, this will resume. This will also resume a song if the orchestra was interrupted.
ErrorCode ctre::phoenix::music::Orchestra::Stop | ( | ) |
Stops the music file that's loaded.
This resets the current position in the track to the start.