LCOV - code coverage report
Current view: top level - src - VoiceManager.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 29 29
Test Date: 2026-03-03 00:31:37 Functions: 100.0 % 8 8

            Line data    Source code
       1              : #include "VoiceManager.h"
       2              : 
       3           20 : VoiceManager::VoiceManager() {
       4           50 :     for (int v = 0; v < 4; ++v)
       5           40 :         drumVoiceMidiChannel[v].store(10, std::memory_order_relaxed);
       6           10 :     melodicMidiChannel[0].store(2, std::memory_order_relaxed);
       7           10 :     melodicMidiChannel[1].store(3, std::memory_order_relaxed);
       8           10 :     melodicMidiChannel[2].store(4, std::memory_order_relaxed);
       9           20 : }
      10              : 
      11            2 : void VoiceManager::setDrumChannel(int voice, int ch) {
      12            2 :     drumVoiceMidiChannel[voice].store(ch, std::memory_order_relaxed);
      13            2 : }
      14              : 
      15           59 : int VoiceManager::getDrumChannel(int voice) const {
      16           59 :     return drumVoiceMidiChannel[voice].load(std::memory_order_relaxed);
      17              : }
      18              : 
      19            1 : void VoiceManager::setMelodicChannel(int track, int ch) {
      20            1 :     melodicMidiChannel[track].store(ch, std::memory_order_relaxed);
      21            1 : }
      22              : 
      23           44 : int VoiceManager::getMelodicChannel(int track) const {
      24           44 :     return melodicMidiChannel[track].load(std::memory_order_relaxed);
      25              : }
      26              : 
      27           21 : int VoiceManager::matchDrumVoice(int ch, int note, const int drumCh[4]) {
      28           74 :     for (int v = 0; v < 4; ++v)
      29           64 :         if (ch == drumCh[v] && note == kDrumNotes[v])
      30           11 :             return v;
      31           10 :     return -1;
      32           21 : }
      33              : 
      34           13 : int VoiceManager::matchMelodicVoice(int ch, const int melCh[3]) {
      35           28 :     for (int i = 0; i < 3; ++i)
      36           24 :         if (ch == melCh[i])
      37            9 :             return i;
      38            4 :     return -1;
      39           13 : }
        

Generated by: LCOV version 2.4-0