LCOV - code coverage report
Current view: top level - muse/framework/audio/engine/internal - iaudiocontext.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 1 1
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) 2026 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              : #pragma once
      23              : 
      24              : #include "global/types/retval.h"
      25              : #include "global/async/promise.h"
      26              : #include "global/async/channel.h"
      27              : #include "audio/common/audiotypes.h"
      28              : 
      29              : namespace muse::audio::engine {
      30              : class IAudioContext
      31              : {
      32              : public:
      33            3 :     virtual ~IAudioContext() = default;
      34              : 
      35              :     virtual AudioCtxId id() const = 0;
      36              : 
      37              :     // Init
      38              :     virtual Ret init() = 0;
      39              :     virtual void deinit() = 0;
      40              : 
      41              :     // Resources
      42              :     virtual AudioResourceMetaList availableInputResources() const = 0;
      43              :     virtual SoundPresetList availableSoundPresets(const AudioResourceMeta& resourceMeta) const = 0;
      44              :     virtual AudioResourceMetaList availableOutputResources() const = 0;
      45              : 
      46              :     // Tracks
      47              :     virtual RetVal2<TrackId, TrackParams> addTrack(const TrackName& trackName, io::IODevice* playbackData, const TrackParams& params) = 0;
      48              :     virtual RetVal2<TrackId, TrackParams> addTrack(const TrackName& trackName, const mpe::PlaybackData& playbackData,
      49              :                                                    const TrackParams& params) = 0;
      50              :     virtual RetVal2<TrackId, TrackParams> addAuxTrack(const TrackName& trackName, const TrackParams& params) = 0;
      51              : 
      52              :     virtual void removeTrack(const TrackId trackId) = 0;
      53              :     virtual void removeAllTracks() = 0;
      54              : 
      55              :     virtual async::Channel<TrackId> trackAdded() const = 0;
      56              :     virtual async::Channel<TrackId> trackRemoved() const = 0;
      57              : 
      58              :     virtual RetVal<TrackIdList> trackIdList() const = 0;
      59              :     virtual RetVal<TrackName> trackName(const TrackId trackId) const = 0;
      60              : 
      61              :     // Params
      62              :     virtual RetVal<TrackParams> params(const TrackId trackId) const = 0;
      63              :     virtual void setSourceParams(const TrackId trackId, const AudioSourceParams& params) = 0;
      64              :     virtual void setControlParams(const TrackId trackId, const ControlParams& params) = 0;
      65              :     virtual void setFxChainParams(const TrackId trackId, const AudioFxChain& params) = 0;
      66              :     virtual void setAuxSendsParams(const TrackId trackId, const AuxSendsParams& params) = 0;
      67              : 
      68              :     virtual async::Channel<TrackId, AudioSourceParams> sourceParamsChanged() const = 0;
      69              :     virtual async::Channel<TrackId, ControlParams> controlParamsChanged() const = 0;
      70              :     virtual async::Channel<TrackId, AudioFxChain> fxChainParamsChanged() const = 0;
      71              :     virtual async::Channel<TrackId, AuxSendsParams> auxSendsParamsChanged() const = 0;
      72              : 
      73              :     // Input processing
      74              :     virtual void processInput(const TrackId trackId) const = 0;
      75              :     virtual RetVal<InputProcessingProgress> inputProcessingProgress(const TrackId trackId) const = 0;
      76              : 
      77              :     // Clear
      78              :     virtual void clearCache(const TrackId trackId) const = 0;
      79              :     virtual void clearSources() = 0;
      80              :     virtual void clearMasterOutputParams() = 0;
      81              :     virtual void clearAllFx() = 0;
      82              : 
      83              :     // Signals
      84              :     virtual RetVal<AudioSignalChanges> signalChanges(const TrackId trackId) const = 0;
      85              : 
      86              :     // Automation
      87              :     virtual RetVal<AutomatedControlParamsChanges> automatedControlParamsChanges(const TrackId trackId) const = 0;
      88              : 
      89              :     // Play
      90              :     virtual async::Promise<Ret> prepareToPlay() = 0;
      91              : 
      92              :     virtual void play(const secs_t delay = 0.0) = 0;
      93              :     virtual void seek(const secs_t newPosition, const bool flushSound = true) = 0;
      94              :     virtual void stop() = 0;
      95              :     virtual void pause() = 0;
      96              :     virtual void resume(const secs_t delay = 0.0) = 0;
      97              : 
      98              :     virtual void setDuration(const secs_t duration) = 0;
      99              :     virtual Ret setLoop(const secs_t from, const secs_t to) = 0;
     100              :     virtual void resetLoop() = 0;
     101              : 
     102              :     virtual PlaybackStatus playbackStatus() const = 0;
     103              :     virtual async::Channel<PlaybackStatus> playbackStatusChanged() const = 0;
     104              :     virtual secs_t playbackPosition() const = 0;
     105              :     virtual async::Channel<secs_t> playbackPositionChanged() const = 0;
     106              : 
     107              :     // Export
     108              :     virtual async::Promise<Ret> saveSoundTrack(io::IODevice& dstDevice, const SoundTrackFormat& format) = 0;
     109              :     virtual SaveSoundTrackProgress saveSoundTrackProgressChanged() const = 0;
     110              :     virtual void abortSavingAllSoundTracks() = 0;
     111              : };
     112              : }
        

Generated by: LCOV version 2.0-1