MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / PlayNote

Method PlayNote

Source/FamiTrackerView.cpp:1795–1836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1793//////////////////////////////////////////////////////////////////////////////////////////////////////////
1794
1795void CFamiTrackerView::PlayNote(std::size_t Index, int MidiNote, unsigned int Velocity) const { // // //
1796 if (MidiNote < 0 || MidiNote >= NOTE_COUNT)
1797 return;
1798
1799 // Play a note in a channel
1800 stChanNote NoteData; // // //
1801
1802 NoteData.Note = ft0cc::doc::pitch_from_midi(MidiNote);
1803 NoteData.Octave = ft0cc::doc::oct_from_midi(MidiNote);
1804 NoteData.Instrument = GetInstrument();
1805 if (FTEnv.GetSettings()->Midi.bMidiVelocity)
1806 NoteData.Vol = Velocity / 8;
1807/*
1808 if (FTEnv.GetSettings()->General.iEditStyle == edit_style_t::IT)
1809 NoteData.Instrument = m_LastNote.Instrument;
1810 else
1811 NoteData.Instrument = GetInstrument();
1812*/
1813 const CChannelOrder &order = GetSongView()->GetChannelOrder();
1814 const CSongData &song = GetSongView()->GetSong();
1815
1816 stChannelID Channel = SplitAdjustChannel(TranslateChannel(Index), NoteData);
1817 if (order.HasChannel(Channel)) {
1818 stChannelID ret = m_pNoteQueue->Trigger(MidiNote, Channel);
1819 if (order.HasChannel(ret)) {
1820 SplitKeyboardAdjust(NoteData, ret);
1821 FTEnv.GetSoundGenerator()->QueueNote(ret, NoteData, NOTE_PRIO_2); // // //
1822 FTEnv.GetSoundGenerator()->ForceReloadInstrument(ret); // // //
1823 }
1824 }
1825
1826 if (FTEnv.GetSettings()->General.bPreviewFullRow) {
1827 int Frame = GetSelectedFrame();
1828 int Row = GetSelectedRow();
1829
1830 order.ForeachChannel([&] (stChannelID i) {
1831 if (!IsChannelMuted(i) && i != Channel)
1832 FTEnv.GetSoundGenerator()->QueueNote(i, song.GetActiveNote(i, Frame, Row),
1833 (i == Channel) ? NOTE_PRIO_2 : NOTE_PRIO_1); // // //
1834 });
1835 }
1836}
1837
1838void CFamiTrackerView::ReleaseNote(std::size_t Index, int MidiNote) const {
1839 if (MidiNote < 0 || MidiNote >= NOTE_COUNT)

Callers

nothing calls this directly

Calls 11

pitch_from_midiFunction · 0.85
oct_from_midiFunction · 0.85
GetSongMethod · 0.80
HasChannelMethod · 0.80
ForeachChannelMethod · 0.80
GetSettingsMethod · 0.45
TriggerMethod · 0.45
QueueNoteMethod · 0.45
GetSoundGeneratorMethod · 0.45
ForceReloadInstrumentMethod · 0.45
GetActiveNoteMethod · 0.45

Tested by

no test coverage detected