Yet Another (WA)SAPI New Technology (YASAPI/NT) Output Plugin for Winamp
Documenation draft

Copyright © 2015-2018 by Peter Belkner (http://home.snafu.de/pbelkner/)

Yet Another (WA)SAPI New Technology (YASAPI/NT) Output Plugin for Winamp (out_yasapi-nt) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

out_yasapi-nt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with out_yasapi-nt.  If not, see <http://www.gnu.org/licenses/>.

Last generated 180916-0337.

Nanos gigantum humeris insidentes: This project is dedicated to my European heritage. It is strictly to be understood as a statement against the "sweet" liberal lie of "multiculturalism" which is going to destroy Europe as we know it, in particular against the Merkel regime selling out Europe for nothing as we watch. #TeamWhite

The UML-diagrams are created by means of the impressive plantuml.


Contents

1.   Introduction
2.   Class Engine
    2.1.   Overview of class Engine
    2.2.   Overview to the states of an instance of class Engine may take
    2.3.   State eEngineBase
    2.4.   State eEngineInitialized
    2.5.   State eEngineStarted
Note:    You may toggle the size of an image by clicking on it.

1. Introduction

The aim of this document is to give a rough overview on the ideas the plug-in is based on.

2. Class Engine

2.1. Overview of class Engine


Figure 1: Class Engine.

2.2. Overview to the states an instance of class Engine may take

At the core of the plug-in is class Engine. The main idea is to implement class Engine in such a way that at each point in time it is in a definite state. Those states are defined in file "yasapi.h" the following way:

typedef enum _EEngine EEngine;

enum _EEngine {
  // [
    eEngineNull,
    // eEngineBase [
      eEngineCriticalSection,
      eEngineTimerEvent,
      eEngineTimer,
      eEngineEventProducer,
      eEngineEventConsumer,
      eEngineThread,
      eEngineThreadRunning,
      eEngineBase=eEngineThreadRunning,
    // ]
    // eEngineInitialized [
      eEngineAudioClientInititial,
      eEngineRing,
      eEngineInitialized=eEngineRing,
    // ]
    // eEngineStarted [
      eEnginePauseDisconnected,
      eEngineDisconnected=eEnginePauseDisconnected,
      eEngineAudioClient,
      eEngineVolume,
      eEngineAudioClock,
      eEngineAudioRenderClient,
      eEngineStopped=eEngineAudioRenderClient,
      eEnginePauseConnected,
      eEngineAudioClientStarted,
      eEngineTimerStarted,
      eEngineStarted=eEngineTimerStarted,
    // ]
    eEngineDraining,
    eEngineEot,
  // ]
  eEngineMax,
};

Before looking at the states in more detail we'd like to give a rough overview. For that means we bundle the fine-grained states to more compact ones (the same way we already see in the above extract from "yasapi.h".)


Figure 2: Overview.

State      Transition to state      Remark
 
start   end   When exit and no track was ever played: nothing to do.
eEngineBase   When the first track is played by the plug-in: acquire several non-WASAPI objects from Windows persisting during the plug-in's lifetime (including starting the render thread.)
 
eEngineBase   end   When exit: release the non-WASAPI objects.
eEngineInitialized   When next track: aquire and initialize an instance of IAudioClient along with an instance of class Ring.
 
eEngineInitialized   eEngineBase   When stop or exit: release the instance of IAudioClient.
 
eEngineInitializeded   eEngineInitialized    
 
To be continued ...


Figure 3: A user playing a gapless sequence.

2.3. State eEngineBase


Figure 4: State eEngineBase.

2.4. State eEngineInitialized


Figure 5: State eEngineInitialized.

2.5. State eEngineStarted


Figure 5: State eEngineStarted.