Handles audio playback for the music editor using the SNES APU emulator. More...
#include <music_player.h>

Public Member Functions | |
| MusicPlayer (zelda3::music::MusicBank *music_bank) | |
| ~MusicPlayer () | |
| void | SetRom (Rom *rom) |
| void | SetEmulator (emu::Emulator *emulator) |
| Set the main emulator instance to use for playback. | |
| void | SetAudioExclusivityCallback (std::function< void(bool)> callback) |
| Set a callback to be called when audio playback starts/stops. | |
| emu::Emulator * | emulator () |
| void | Update () |
| Call once per frame to update playback state. | |
| void | PlaySong (int song_index) |
| Start playing a song by index. | |
| void | Pause () |
| Pause the current playback. | |
| void | Resume () |
| Resume paused playback. | |
| void | Stop () |
| Stop playback completely. | |
| void | TogglePlayPause () |
| Toggle between play/pause states. | |
| void | PreviewNote (const zelda3::music::MusicSong &song, const zelda3::music::TrackEvent &event, int segment_index, int channel_index) |
| Preview a single note with the current instrument. | |
| void | PreviewSegment (const zelda3::music::MusicSong &song, int segment_index) |
| Preview a specific segment of a song. | |
| void | PreviewInstrument (int instrument_index) |
| Preview an instrument at middle C. | |
| void | PreviewSample (int sample_index) |
| Preview a raw BRR sample. | |
| void | PreviewCustomSong (int song_index) |
| Preview a custom (modified) song from memory. | |
| void | SetVolume (float volume) |
| Set the master volume (0.0 to 1.0). | |
| void | SetPlaybackSpeed (float speed) |
| Set the playback speed (0.25x to 2.0x). | |
| void | SetInterpolationType (int type) |
| Set the DSP interpolation type for audio quality. | |
| void | SetDirectSpcMode (bool enabled) |
| Enable/disable direct SPC mode (bypasses game CPU). | |
| void | SeekToSegment (int segment_index) |
| Seek to a specific segment in the current song. | |
| PlaybackState | GetState () const |
| PlaybackMode | GetMode () const |
| ChannelState | GetChannelState (int channel_index) const |
| std::array< ChannelState, 8 > | GetChannelStates () const |
| bool | IsAudioReady () const |
| Check if the audio system is ready for playback. | |
| bool | IsPlaying () const |
| Check if currently playing. | |
| bool | IsPaused () const |
| Check if currently paused. | |
| int | GetPlayingSongIndex () const |
| Get the index of the currently playing song, or -1 if none. | |
| const zelda3::music::MusicInstrument * | ResolveInstrumentForEvent (const zelda3::music::MusicSegment &segment, int channel_index, uint16_t tick) const |
| Resolve the instrument used at a specific tick in a track. | |
| DspDebugStatus | GetDspStatus () const |
| Get DSP buffer diagnostic status. | |
| ApuDebugStatus | GetApuStatus () const |
| Get APU timing diagnostic status. | |
| AudioQueueStatus | GetAudioQueueStatus () const |
| Get audio queue diagnostic status. | |
| void | ClearAudioQueue () |
| Clear the audio queue (stops sound immediately). | |
| void | ResetDspBuffer () |
| Reset the DSP sample buffer. | |
| void | ForceNewFrame () |
| Force a DSP NewFrame() call. | |
| void | ReinitAudio () |
| Reinitialize the audio system. | |
Private Member Functions | |
| bool | EnsureAudioReady () |
| bool | EnsurePreviewReady () |
| void | InitializeDirectSpc () |
| void | InitializePreviewMode () |
| void | PlaySongDirect (int song_id) |
| void | UploadSoundBankFromRom (uint32_t rom_offset) |
| void | UploadSongToAram (const std::vector< uint8_t > &data, uint16_t aram_address) |
| uint32_t | GetBankRomOffset (uint8_t bank) const |
| int | GetSongIndexInBank (int song_id, uint8_t bank) const |
| float | CalculateTicksPerSecond (uint8_t tempo) const |
| uint32_t | GetCurrentPlaybackTick () const |
| uint8_t | GetSongTempo (const zelda3::music::MusicSong &song) const |
| void | TransitionTo (PlaybackMode new_mode) |
| void | PrepareAudioPlayback () |
| Prepare audio pipeline for playback. | |
Private Attributes | |
| zelda3::music::MusicBank * | music_bank_ = nullptr |
| emu::Emulator * | emulator_ = nullptr |
| Rom * | rom_ = nullptr |
| PlaybackMode | mode_ = PlaybackMode::Stopped |
| int | playing_song_index_ = -1 |
| bool | use_direct_spc_ = true |
| float | volume_ = 1.0f |
| int | interpolation_type_ = 2 |
| bool | spc_initialized_ = false |
| bool | preview_initialized_ = false |
| uint8_t | current_spc_bank_ = 0xFF |
| std::chrono::steady_clock::time_point | playback_start_time_ |
| std::chrono::steady_clock::time_point | last_frame_time_ |
| uint32_t | playback_start_tick_ = 0 |
| float | ticks_per_second_ = 0.0f |
| int | playback_segment_index_ = 0 |
| std::function< void(bool)> | audio_exclusivity_callback_ |
Handles audio playback for the music editor using the SNES APU emulator.
The MusicPlayer manages playback of songs from ROM or memory, providing:
Playback uses direct SPC700/DSP emulation for authentic SNES audio.
Definition at line 122 of file music_player.h.
|
explicit |
Definition at line 20 of file music_player.cc.
| yaze::editor::music::MusicPlayer::~MusicPlayer | ( | ) |
Definition at line 23 of file music_player.cc.
References Stop().

| void yaze::editor::music::MusicPlayer::SetRom | ( | Rom * | rom | ) |
Definition at line 31 of file music_player.cc.
References rom_.
| void yaze::editor::music::MusicPlayer::SetEmulator | ( | emu::Emulator * | emulator | ) |
Set the main emulator instance to use for playback.
MusicPlayer controls this emulator directly for audio playback.
| emulator | The emulator instance (must outlive MusicPlayer) |
Definition at line 27 of file music_player.cc.
References emulator(), and emulator_.

|
inline |
Set a callback to be called when audio playback starts/stops.
This allows external systems (like EditorManager) to pause/mute other audio sources (like the main emulator) when MusicPlayer takes control.
| callback | Function called with (true) when playback starts, and (false) when playback stops. |
Definition at line 148 of file music_player.h.
References audio_exclusivity_callback_.
|
inline |
Definition at line 153 of file music_player.h.
References emulator_.
Referenced by yaze::editor::MusicAudioDebugPanel::Draw(), and SetEmulator().
| void yaze::editor::music::MusicPlayer::Update | ( | ) |
Call once per frame to update playback state.
This polls the emulator for current song info and updates timing state. Note: The actual audio processing is done by the emulator's RunAudioFrame().
Definition at line 149 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), CalculateTicksPerSecond(), emulator_, yaze::zelda3::music::MusicBank::GetSong(), GetSongTempo(), yaze::emu::Emulator::is_audio_focus_mode(), yaze::emu::Emulator::is_snes_initialized(), yaze::editor::music::kNativeSampleRate, last_frame_time_, LOG_DEBUG, LOG_ERROR, LOG_INFO, mode_, music_bank_, playback_segment_index_, playback_start_tick_, playback_start_time_, yaze::editor::music::Playing, playing_song_index_, yaze::emu::Emulator::RunAudioFrame(), yaze::emu::Emulator::RunFrameOnly(), yaze::emu::Emulator::running(), yaze::emu::Emulator::snes(), yaze::editor::music::Stopped, ticks_per_second_, TransitionTo(), use_direct_spc_, and yaze::emu::Emulator::wanted_frames().
| void yaze::editor::music::MusicPlayer::PlaySong | ( | int | song_index | ) |
Start playing a song by index.
| song_index | Zero-based song index in the music bank. |
Definition at line 402 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), audio_exclusivity_callback_, CalculateTicksPerSecond(), emulator_, EnsureAudioReady(), yaze::zelda3::music::MusicBank::GetSong(), GetSongTempo(), interpolation_type_, yaze::editor::music::kNativeSampleRate, last_frame_time_, LOG_INFO, LOG_WARN, mode_, music_bank_, playback_segment_index_, playback_start_tick_, playback_start_time_, yaze::editor::music::Playing, playing_song_index_, PlaySongDirect(), rom_, yaze::emu::Emulator::running(), yaze::emu::Emulator::set_interpolation_type(), yaze::emu::Emulator::set_running(), yaze::emu::Emulator::snes(), Stop(), yaze::editor::music::Stopped, ticks_per_second_, TransitionTo(), and use_direct_spc_.
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset(), and TogglePlayPause().
| void yaze::editor::music::MusicPlayer::Pause | ( | ) |
Pause the current playback.
Definition at line 622 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, GetCurrentPlaybackTick(), LOG_DEBUG, mode_, yaze::editor::music::Paused, playback_start_tick_, yaze::editor::music::Playing, yaze::editor::music::Previewing, yaze::emu::Emulator::set_running(), and TransitionTo().
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset(), and TogglePlayPause().

| void yaze::editor::music::MusicPlayer::Resume | ( | ) |
Resume paused playback.
Definition at line 639 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, last_frame_time_, LOG_DEBUG, mode_, yaze::editor::music::Paused, playback_start_tick_, playback_start_time_, yaze::editor::music::Playing, yaze::emu::Emulator::ResetFrameTiming(), yaze::emu::Emulator::set_running(), and TransitionTo().
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset(), and TogglePlayPause().

| void yaze::editor::music::MusicPlayer::Stop | ( | ) |
Stop playback completely.
Definition at line 662 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, yaze::editor::music::kSpcStopCycles, LOG_DEBUG, mode_, playback_segment_index_, playback_start_tick_, yaze::emu::Emulator::set_audio_focus_mode(), yaze::emu::Emulator::set_running(), yaze::emu::Emulator::snes(), yaze::editor::music::Stopped, ticks_per_second_, and TransitionTo().
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset(), PlaySong(), ReinitAudio(), and ~MusicPlayer().
| void yaze::editor::music::MusicPlayer::TogglePlayPause | ( | ) |
Toggle between play/pause states.
Definition at line 132 of file music_player.cc.
References mode_, Pause(), yaze::editor::music::Paused, yaze::editor::music::Playing, playing_song_index_, PlaySong(), yaze::editor::music::Previewing, Resume(), and yaze::editor::music::Stopped.

| void yaze::editor::music::MusicPlayer::PreviewNote | ( | const zelda3::music::MusicSong & | song, |
| const zelda3::music::TrackEvent & | event, | ||
| int | segment_index, | ||
| int | channel_index ) |
Preview a single note with the current instrument.
Definition at line 810 of file music_player.cc.
References yaze::zelda3::music::TrackEvent::Command, emulator_, EnsureAudioReady(), yaze::zelda3::music::MusicBank::GetInstrument(), yaze::zelda3::music::Note::IsNote(), yaze::editor::music::kDspAdsr1, yaze::editor::music::kDspAdsr2, yaze::editor::music::kDspKeyOn, yaze::editor::music::kDspPitchHigh, yaze::editor::music::kDspPitchLow, yaze::editor::music::kDspSrcn, yaze::editor::music::kDspVolL, yaze::editor::music::kDspVolR, yaze::editor::music::kSpcPreviewCycles, yaze::zelda3::music::LookupNSpcPitch(), music_bank_, yaze::zelda3::music::TrackEvent::Note, yaze::zelda3::music::TrackEvent::note, yaze::zelda3::music::Note::pitch, PrepareAudioPlayback(), yaze::editor::music::Previewing, yaze::zelda3::music::MusicInstrument::sample_index, yaze::zelda3::music::MusicSong::segments, yaze::emu::Emulator::snes(), yaze::zelda3::music::TrackEvent::tick, yaze::zelda3::music::MusicSegment::tracks, TransitionTo(), and yaze::zelda3::music::TrackEvent::type.
Referenced by yaze::editor::MusicPianoRollPanel::Draw().
| void yaze::editor::music::MusicPlayer::PreviewSegment | ( | const zelda3::music::MusicSong & | song, |
| int | segment_index ) |
Preview a specific segment of a song.
Definition at line 906 of file music_player.cc.
References yaze::zelda3::music::MusicSong::bank, CalculateTicksPerSecond(), emulator_, EnsureAudioReady(), GetSongTempo(), yaze::zelda3::music::kSongTableAram, LOG_DEBUG, LOG_ERROR, yaze::zelda3::music::MusicSong::loop_point, yaze::zelda3::music::MusicSong::name, playback_segment_index_, playback_start_tick_, playback_start_time_, PrepareAudioPlayback(), yaze::editor::music::Previewing, yaze::zelda3::music::MusicSong::segments, yaze::zelda3::music::SpcSerializer::SerializeSong(), yaze::emu::Emulator::snes(), ticks_per_second_, TransitionTo(), and UploadSongToAram().
Referenced by yaze::editor::MusicPianoRollPanel::Draw().
| void yaze::editor::music::MusicPlayer::PreviewInstrument | ( | int | instrument_index | ) |
Preview an instrument at middle C.
Definition at line 953 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, EnsurePreviewReady(), yaze::zelda3::music::MusicBank::GetInstrument(), yaze::editor::music::kDspAdsr1, yaze::editor::music::kDspAdsr2, yaze::editor::music::kDspGain, yaze::editor::music::kDspKeyOff, yaze::editor::music::kDspKeyOn, yaze::editor::music::kDspPitchHigh, yaze::editor::music::kDspPitchLow, yaze::editor::music::kDspSrcn, yaze::editor::music::kDspVolL, yaze::editor::music::kDspVolR, yaze::zelda3::music::LookupNSpcPitch(), music_bank_, PrepareAudioPlayback(), yaze::editor::music::Previewing, yaze::emu::Emulator::snes(), and TransitionTo().
| void yaze::editor::music::MusicPlayer::PreviewSample | ( | int | sample_index | ) |
Preview a raw BRR sample.
Definition at line 991 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, EnsurePreviewReady(), yaze::zelda3::music::MusicBank::GetSample(), yaze::editor::music::kDspAdsr1, yaze::editor::music::kDspAdsr2, yaze::editor::music::kDspGain, yaze::editor::music::kDspKeyOff, yaze::editor::music::kDspKeyOn, yaze::editor::music::kDspPitchHigh, yaze::editor::music::kDspPitchLow, yaze::editor::music::kDspSrcn, yaze::editor::music::kDspVolL, yaze::editor::music::kDspVolR, music_bank_, PrepareAudioPlayback(), yaze::editor::music::Previewing, yaze::emu::Emulator::snes(), TransitionTo(), and UploadSongToAram().
| void yaze::editor::music::MusicPlayer::PreviewCustomSong | ( | int | song_index | ) |
Preview a custom (modified) song from memory.
Definition at line 1039 of file music_player.cc.
References CalculateTicksPerSecond(), emulator_, EnsureAudioReady(), yaze::zelda3::music::MusicBank::GetSong(), GetSongTempo(), yaze::zelda3::music::kSongTableAram, yaze::editor::music::kSpcInitCycles, LOG_ERROR, LOG_INFO, music_bank_, playback_segment_index_, playback_start_tick_, playback_start_time_, playing_song_index_, PrepareAudioPlayback(), yaze::editor::music::Previewing, yaze::zelda3::music::SpcSerializer::SerializeSong(), yaze::emu::Emulator::snes(), ticks_per_second_, TransitionTo(), and UploadSongToAram().
Referenced by PlaySongDirect().
| void yaze::editor::music::MusicPlayer::SetVolume | ( | float | volume | ) |
Set the master volume (0.0 to 1.0).
Definition at line 695 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, and yaze::emu::audio::IAudioBackend::SetVolume().
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset().

| void yaze::editor::music::MusicPlayer::SetPlaybackSpeed | ( | float | speed | ) |
Set the playback speed (0.25x to 2.0x).
This affects both tempo and pitch (tape-style varispeed).
Definition at line 701 of file music_player.cc.
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset().
| void yaze::editor::music::MusicPlayer::SetInterpolationType | ( | int | type | ) |
Set the DSP interpolation type for audio quality.
| type | 0=Linear, 1=Hermite, 2=Gaussian, 3=Cosine, 4=Cubic |
Definition at line 706 of file music_player.cc.
References emulator_, interpolation_type_, yaze::emu::Emulator::is_snes_initialized(), and yaze::emu::Emulator::set_interpolation_type().

| void yaze::editor::music::MusicPlayer::SetDirectSpcMode | ( | bool | enabled | ) |
Enable/disable direct SPC mode (bypasses game CPU).
Definition at line 713 of file music_player.cc.
References use_direct_spc_.
| void yaze::editor::music::MusicPlayer::SeekToSegment | ( | int | segment_index | ) |
Seek to a specific segment in the current song.
Definition at line 1084 of file music_player.cc.
References CalculateTicksPerSecond(), yaze::zelda3::music::TrackEvent::Command, yaze::zelda3::music::MusicBank::GetSong(), yaze::editor::music::kOpcodeTempo, music_bank_, playback_segment_index_, playback_start_tick_, playback_start_time_, playing_song_index_, yaze::zelda3::music::MusicSong::segments, and ticks_per_second_.

| PlaybackState yaze::editor::music::MusicPlayer::GetState | ( | ) | const |
Definition at line 35 of file music_player.cc.
References yaze::editor::music::PlaybackState::current_segment_index, yaze::editor::music::PlaybackState::current_tick, GetCurrentPlaybackTick(), yaze::editor::music::PlaybackState::is_paused, yaze::editor::music::PlaybackState::is_playing, mode_, yaze::editor::music::Paused, playback_segment_index_, yaze::editor::music::PlaybackState::playback_speed, yaze::editor::music::Playing, yaze::editor::music::PlaybackState::playing_song_index, playing_song_index_, yaze::editor::music::Previewing, yaze::editor::music::PlaybackState::ticks_per_second, and ticks_per_second_.
Referenced by yaze::editor::MusicPianoRollPanel::Draw(), yaze::editor::MusicPlaybackControlPanel::DrawPlaybackStatus(), yaze::editor::MusicAudioDebugPanel::DrawResamplingStatus(), and yaze::editor::MusicPlaybackControlPanel::DrawToolset().

|
inline |
Definition at line 250 of file music_player.h.
References mode_.
| ChannelState yaze::editor::music::MusicPlayer::GetChannelState | ( | int | channel_index | ) | const |
Definition at line 869 of file music_player.cc.
References yaze::editor::music::ChannelState::adsr_state, emulator_, yaze::editor::music::ChannelState::gain, yaze::emu::Emulator::is_snes_initialized(), yaze::editor::music::ChannelState::key_on, yaze::editor::music::ChannelState::pitch, yaze::editor::music::ChannelState::sample_index, yaze::emu::Emulator::snes(), yaze::editor::music::ChannelState::volume_l, and yaze::editor::music::ChannelState::volume_r.

| std::array< ChannelState, 8 > yaze::editor::music::MusicPlayer::GetChannelStates | ( | ) | const |
Definition at line 886 of file music_player.cc.
References emulator_, yaze::emu::Emulator::is_snes_initialized(), and yaze::emu::Emulator::snes().
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

| bool yaze::editor::music::MusicPlayer::IsAudioReady | ( | ) | const |
Check if the audio system is ready for playback.
Definition at line 275 of file music_player.cc.
References rom_.
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawToolset().
|
inline |
Check if currently playing.
Definition at line 262 of file music_player.h.
References mode_, and yaze::editor::music::Playing.
|
inline |
Check if currently paused.
Definition at line 267 of file music_player.h.
References mode_, and yaze::editor::music::Paused.
|
inline |
Get the index of the currently playing song, or -1 if none.
Definition at line 272 of file music_player.h.
References playing_song_index_.
| const zelda3::music::MusicInstrument * yaze::editor::music::MusicPlayer::ResolveInstrumentForEvent | ( | const zelda3::music::MusicSegment & | segment, |
| int | channel_index, | ||
| uint16_t | tick ) const |
Resolve the instrument used at a specific tick in a track.
Definition at line 1114 of file music_player.cc.
References yaze::zelda3::music::TrackEvent::Command, yaze::zelda3::music::MusicBank::GetInstrument(), music_bank_, and yaze::zelda3::music::MusicSegment::tracks.

| DspDebugStatus yaze::editor::music::MusicPlayer::GetDspStatus | ( | ) | const |
Get DSP buffer diagnostic status.
Definition at line 1136 of file music_player.cc.
References yaze::editor::music::DspDebugStatus::echo_delay, yaze::editor::music::DspDebugStatus::echo_enabled, emulator_, yaze::editor::music::DspDebugStatus::frame_boundary, yaze::emu::Emulator::is_snes_initialized(), yaze::editor::music::DspDebugStatus::master_vol_l, yaze::editor::music::DspDebugStatus::master_vol_r, yaze::editor::music::DspDebugStatus::mute, yaze::editor::music::DspDebugStatus::reset, yaze::editor::music::DspDebugStatus::sample_offset, and yaze::emu::Emulator::snes().
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawDebugControls(), and yaze::editor::MusicAudioDebugPanel::DrawDspStatus().

| ApuDebugStatus yaze::editor::music::MusicPlayer::GetApuStatus | ( | ) | const |
Get APU timing diagnostic status.
Definition at line 1154 of file music_player.cc.
References yaze::editor::music::ApuDebugStatus::cycles, emulator_, yaze::emu::Emulator::is_snes_initialized(), yaze::editor::music::ApuDebugStatus::port0_in, yaze::editor::music::ApuDebugStatus::port0_out, yaze::editor::music::ApuDebugStatus::port1_in, yaze::editor::music::ApuDebugStatus::port1_out, yaze::emu::Emulator::snes(), yaze::editor::music::ApuDebugStatus::timer0_counter, yaze::editor::music::ApuDebugStatus::timer0_enabled, yaze::editor::music::ApuDebugStatus::timer0_target, yaze::editor::music::ApuDebugStatus::timer1_counter, yaze::editor::music::ApuDebugStatus::timer1_enabled, yaze::editor::music::ApuDebugStatus::timer1_target, yaze::editor::music::ApuDebugStatus::timer2_counter, yaze::editor::music::ApuDebugStatus::timer2_enabled, and yaze::editor::music::ApuDebugStatus::timer2_target.
Referenced by yaze::editor::MusicAudioDebugPanel::DrawApuStatus(), and yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

| AudioQueueStatus yaze::editor::music::MusicPlayer::GetAudioQueueStatus | ( | ) | const |
Get audio queue diagnostic status.
Definition at line 1190 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), yaze::editor::music::AudioQueueStatus::backend_name, emulator_, yaze::editor::music::AudioQueueStatus::has_underrun, yaze::editor::music::AudioQueueStatus::is_playing, yaze::editor::music::AudioQueueStatus::queued_bytes, yaze::editor::music::AudioQueueStatus::queued_frames, and yaze::editor::music::AudioQueueStatus::sample_rate.
Referenced by yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

| void yaze::editor::music::MusicPlayer::ClearAudioQueue | ( | ) |
Clear the audio queue (stops sound immediately).
Definition at line 1213 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, and LOG_INFO.
Referenced by yaze::editor::MusicAudioDebugPanel::DrawDebugActions(), and yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

| void yaze::editor::music::MusicPlayer::ResetDspBuffer | ( | ) |
Reset the DSP sample buffer.
Definition at line 1222 of file music_player.cc.
References emulator_, yaze::emu::Emulator::is_snes_initialized(), LOG_INFO, and yaze::emu::Emulator::snes().
Referenced by yaze::editor::MusicAudioDebugPanel::DrawDebugActions(), and yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

| void yaze::editor::music::MusicPlayer::ForceNewFrame | ( | ) |
Force a DSP NewFrame() call.
Definition at line 1230 of file music_player.cc.
References emulator_, yaze::emu::Emulator::is_snes_initialized(), LOG_INFO, and yaze::emu::Emulator::snes().
Referenced by yaze::editor::MusicAudioDebugPanel::DrawDebugActions(), and yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

| void yaze::editor::music::MusicPlayer::ReinitAudio | ( | ) |
Reinitialize the audio system.
Definition at line 1238 of file music_player.cc.
References current_spc_bank_, emulator_, LOG_INFO, preview_initialized_, spc_initialized_, and Stop().
Referenced by yaze::editor::MusicAudioDebugPanel::DrawDebugActions(), and yaze::editor::MusicPlaybackControlPanel::DrawDebugControls().

|
private |
Definition at line 280 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, yaze::emu::Emulator::EnsureInitialized(), InitializeDirectSpc(), interpolation_type_, yaze::emu::Emulator::is_snes_initialized(), yaze::editor::music::kNativeSampleRate, LOG_ERROR, LOG_INFO, LOG_WARN, yaze::emu::Emulator::mark_audio_stream_configured(), rom_, yaze::emu::Emulator::set_interpolation_type(), yaze::emu::Emulator::set_use_sdl_audio_stream(), spc_initialized_, and yaze::emu::Emulator::wanted_samples().
Referenced by EnsurePreviewReady(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewNote(), and PreviewSegment().
|
private |
Definition at line 336 of file music_player.cc.
References EnsureAudioReady(), InitializePreviewMode(), and preview_initialized_.
Referenced by PreviewInstrument(), and PreviewSample().

|
private |
Definition at line 345 of file music_player.cc.
References current_spc_bank_, emulator_, GetBankRomOffset(), yaze::editor::music::kDriverEntryPoint, yaze::editor::music::kSpcResetCycles, LOG_INFO, preview_initialized_, rom_, yaze::emu::Emulator::snes(), spc_initialized_, and UploadSoundBankFromRom().
Referenced by EnsureAudioReady(), and PlaySongDirect().

|
private |
Definition at line 376 of file music_player.cc.
References emulator_, GetBankRomOffset(), yaze::editor::music::kDspDir, yaze::editor::music::kDspEchoVolL, yaze::editor::music::kDspEchoVolR, yaze::editor::music::kDspFlg, yaze::editor::music::kDspKeyOff, yaze::editor::music::kDspKeyOn, yaze::editor::music::kDspMainVolL, yaze::editor::music::kDspMainVolR, LOG_INFO, preview_initialized_, rom_, yaze::emu::Emulator::snes(), and UploadSoundBankFromRom().
Referenced by EnsurePreviewReady().

|
private |
Definition at line 468 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), audio_exclusivity_callback_, yaze::zelda3::music::MusicSong::bank, CalculateTicksPerSecond(), current_spc_bank_, emulator_, EnsureAudioReady(), GetBankRomOffset(), yaze::zelda3::music::MusicBank::GetSong(), GetSongTempo(), yaze::zelda3::music::MusicBank::HasExpandedMusicPatch(), InitializeDirectSpc(), interpolation_type_, yaze::editor::music::kNativeSampleRate, yaze::editor::music::kSpcInitCycles, last_frame_time_, LOG_INFO, yaze::zelda3::music::MusicSong::modified, music_bank_, yaze::zelda3::music::MusicSong::name, playback_segment_index_, playback_start_tick_, playback_start_time_, yaze::editor::music::Playing, playing_song_index_, preview_initialized_, PreviewCustomSong(), yaze::emu::Emulator::ResetFrameTiming(), rom_, yaze::emu::Emulator::set_audio_focus_mode(), yaze::emu::Emulator::set_interpolation_type(), yaze::emu::Emulator::set_running(), yaze::emu::Emulator::snes(), ticks_per_second_, TransitionTo(), and UploadSoundBankFromRom().
Referenced by PlaySong().
|
private |
Definition at line 717 of file music_player.cc.
References yaze::Rom::data(), emulator_, LOG_INFO, LOG_WARN, rom_, yaze::Rom::size(), and yaze::emu::Emulator::snes().
Referenced by InitializeDirectSpc(), InitializePreviewMode(), and PlaySongDirect().

|
private |
Definition at line 747 of file music_player.cc.
References emulator_, and yaze::emu::Emulator::snes().
Referenced by PreviewCustomSong(), PreviewSample(), and PreviewSegment().

|
private |
Definition at line 755 of file music_player.cc.
References yaze::editor::music::kSoundBankOffsets.
Referenced by InitializeDirectSpc(), InitializePreviewMode(), and PlaySongDirect().
|
private |
Definition at line 762 of file music_player.cc.
|
private |
Definition at line 787 of file music_player.cc.
Referenced by PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewSegment(), SeekToSegment(), and Update().
|
private |
Definition at line 798 of file music_player.cc.
References mode_, playback_start_tick_, playback_start_time_, yaze::editor::music::Playing, yaze::editor::music::Previewing, and ticks_per_second_.
Referenced by GetState(), and Pause().
|
private |
Definition at line 771 of file music_player.cc.
References yaze::zelda3::music::TrackEvent::Command, yaze::editor::music::kOpcodeTempo, and yaze::zelda3::music::MusicSong::segments.
Referenced by PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewSegment(), and Update().
|
private |
Definition at line 47 of file music_player.cc.
References audio_exclusivity_callback_, LOG_DEBUG, LOG_INFO, mode_, yaze::editor::music::Playing, and yaze::editor::music::Previewing.
Referenced by Pause(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewInstrument(), PreviewNote(), PreviewSample(), PreviewSegment(), Resume(), Stop(), and Update().
|
private |
Prepare audio pipeline for playback.
Consolidates the common audio priming pattern used by all playback methods:
Definition at line 73 of file music_player.cc.
References yaze::emu::Emulator::audio_backend(), emulator_, yaze::editor::music::kNativeSampleRate, last_frame_time_, LOG_ERROR, LOG_INFO, yaze::emu::Emulator::ResetFrameTiming(), yaze::emu::Emulator::set_audio_focus_mode(), yaze::emu::Emulator::set_running(), and yaze::emu::Emulator::snes().
Referenced by PreviewCustomSong(), PreviewInstrument(), PreviewNote(), PreviewSample(), and PreviewSegment().
|
private |
Definition at line 346 of file music_player.h.
Referenced by PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewInstrument(), PreviewNote(), PreviewSample(), ResolveInstrumentForEvent(), SeekToSegment(), and Update().
|
private |
Definition at line 347 of file music_player.h.
Referenced by ClearAudioQueue(), emulator(), EnsureAudioReady(), ForceNewFrame(), GetApuStatus(), GetAudioQueueStatus(), GetChannelState(), GetChannelStates(), GetDspStatus(), InitializeDirectSpc(), InitializePreviewMode(), Pause(), PlaySong(), PlaySongDirect(), PrepareAudioPlayback(), PreviewCustomSong(), PreviewInstrument(), PreviewNote(), PreviewSample(), PreviewSegment(), ReinitAudio(), ResetDspBuffer(), Resume(), SetEmulator(), SetInterpolationType(), SetVolume(), Stop(), Update(), UploadSongToAram(), and UploadSoundBankFromRom().
|
private |
Definition at line 348 of file music_player.h.
Referenced by EnsureAudioReady(), InitializeDirectSpc(), InitializePreviewMode(), IsAudioReady(), PlaySong(), PlaySongDirect(), SetRom(), and UploadSoundBankFromRom().
|
private |
Definition at line 351 of file music_player.h.
Referenced by GetCurrentPlaybackTick(), GetMode(), GetState(), IsPaused(), IsPlaying(), Pause(), PlaySong(), Resume(), Stop(), TogglePlayPause(), TransitionTo(), and Update().
|
private |
Definition at line 352 of file music_player.h.
Referenced by GetPlayingSongIndex(), GetState(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), SeekToSegment(), TogglePlayPause(), and Update().
|
private |
Definition at line 355 of file music_player.h.
Referenced by PlaySong(), SetDirectSpcMode(), and Update().
|
private |
Definition at line 356 of file music_player.h.
|
private |
Definition at line 357 of file music_player.h.
Referenced by EnsureAudioReady(), PlaySong(), PlaySongDirect(), and SetInterpolationType().
|
private |
Definition at line 360 of file music_player.h.
Referenced by EnsureAudioReady(), InitializeDirectSpc(), and ReinitAudio().
|
private |
Definition at line 361 of file music_player.h.
Referenced by EnsurePreviewReady(), InitializeDirectSpc(), InitializePreviewMode(), PlaySongDirect(), and ReinitAudio().
|
private |
Definition at line 362 of file music_player.h.
Referenced by InitializeDirectSpc(), PlaySongDirect(), and ReinitAudio().
|
private |
Definition at line 365 of file music_player.h.
Referenced by GetCurrentPlaybackTick(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewSegment(), Resume(), SeekToSegment(), and Update().
|
private |
Definition at line 366 of file music_player.h.
Referenced by PlaySong(), PlaySongDirect(), PrepareAudioPlayback(), Resume(), and Update().
|
private |
Definition at line 367 of file music_player.h.
Referenced by GetCurrentPlaybackTick(), Pause(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewSegment(), Resume(), SeekToSegment(), Stop(), and Update().
|
private |
Definition at line 368 of file music_player.h.
Referenced by GetCurrentPlaybackTick(), GetState(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewSegment(), SeekToSegment(), Stop(), and Update().
|
private |
Definition at line 369 of file music_player.h.
Referenced by GetState(), PlaySong(), PlaySongDirect(), PreviewCustomSong(), PreviewSegment(), SeekToSegment(), Stop(), and Update().
|
private |
Definition at line 372 of file music_player.h.
Referenced by PlaySong(), PlaySongDirect(), SetAudioExclusivityCallback(), and TransitionTo().