LCOV - code coverage report
Current view: top level - muse/framework/audio/engine/internal/nodes - eventaudionode.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 1 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2025 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include "audiosourcenode.h"
      26              : 
      27              : #include "global/async/asyncable.h"
      28              : #include "global/modularity/ioc.h"
      29              : #include "mpe/events.h"
      30              : 
      31              : #include "audio/common/audiotypes.h"
      32              : #include "../iaudiofactory.h"
      33              : 
      34              : namespace muse::audio::engine {
      35              : class EventAudioNode : public AudioSourceNode, public async::Asyncable
      36              : {
      37              :     GlobalInject<IAudioFactory> audioFactory;
      38              : 
      39              : public:
      40              :     using OnOffStreamEventsReceived = std::function<void ()>;
      41              : 
      42              :     explicit EventAudioNode(TrackId trackId, const mpe::PlaybackData& playbackData, OnOffStreamEventsReceived onOffStreamReceived);
      43              : 
      44              :     ~EventAudioNode() override;
      45              : 
      46              :     void seek(const TimePosition& position, const bool flushSound = true) override;
      47              :     void flush() override;
      48              : 
      49              :     const AudioInputParams& inputParams() const override;
      50              :     void applyInputParams(const AudioInputParams& requiredParams) override;
      51              :     async::Channel<AudioInputParams> inputParamsChanged() const override;
      52              : 
      53              :     void prepareToPlay() override;
      54              :     bool readyToPlay() const override;
      55              :     async::Notification readyToPlayChanged() const override;
      56              : 
      57              :     bool hasPendingChunks() const override;
      58              :     void processInput() override;
      59              :     InputProcessingProgress inputProcessingProgress() const override;
      60              : 
      61              :     void clearCache() override;
      62              : 
      63              : private:
      64              :     struct SynthCtx
      65              :     {
      66              :         ProcessMode mode = ProcessMode::Undefined;
      67              :         TimePosition playbackPosition;
      68            0 :         bool isValid() const { return mode != ProcessMode::Undefined; }
      69              :     };
      70              : 
      71              :     void onModeChanged(const ProcessMode mode) override;
      72              :     void onOutputSpecChanged(const OutputSpec& spec) override;
      73              : 
      74              :     void doSelfProcess(float* buffer, samples_t samplesPerChannel) override;
      75              : 
      76              :     void setupSource();
      77              :     SynthCtx currentSynthCtx() const;
      78              :     void restoreSynthCtx(const SynthCtx& ctx);
      79              : 
      80              :     TrackId m_trackId = -1;
      81              :     mpe::PlaybackData m_playbackData;
      82              :     synth::ISynthesizerPtr m_synth = nullptr;
      83              :     AudioInputParams m_params;
      84              :     async::Channel<AudioInputParams> m_paramsChanges;
      85              : };
      86              : 
      87              : using EventAudioNodePtr = std::shared_ptr<EventAudioNode>;
      88              : }
        

Generated by: LCOV version 2.0-1