Atlas - SDL_ngageaudio.hpp

Home / ext / SDL / src / audio / ngage Lines: 1 | Size: 2689 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21 22#ifndef SDL_ngageaudio_hpp 23#define SDL_ngageaudio_hpp 24 25#include <e32base.h> 26#include <e32std.h> 27#include <mda/common/audio.h> 28#include <mdaaudiooutputstream.h> 29 30#ifdef __cplusplus 31extern "C" { 32#endif 33 34#include "../SDL_sysaudio.h" 35#include "SDL_ngageaudio.h" 36 37#ifdef __cplusplus 38} 39#endif 40 41TBool AudioIsReady(); 42void InitAudio(TInt *aLatency); 43void DeinitAudio(); 44 45class CAudio : public CActive, public MMdaAudioOutputStreamCallback 46{ 47 public: 48 static CAudio *NewL(TInt aLatency); 49 ~CAudio(); 50 51 void ConstructL(TInt aLatency); 52 void Start(); 53 void Feed(); 54 55 void RunL(); 56 void DoCancel(); 57 58 static TInt ProcessThreadCB(TAny * /*aPtr*/); 59 60 // From MMdaAudioOutputStreamCallback 61 void MaoscOpenComplete(TInt aError); 62 void MaoscBufferCopied(TInt aError, const TDesC8 &aBuffer); 63 void MaoscPlayComplete(TInt aError); 64 65 enum 66 { 67 EStateNone = 0, 68 EStateOpening, 69 EStatePlaying, 70 EStateWriting, 71 EStateDone 72 } iState; 73 74 private: 75 CAudio(); 76 void StartThread(); 77 void StopThread(); 78 79 CMdaAudioOutputStream *iStream; 80 TMdaAudioDataSettings iStreamSettings; 81 TBool iStreamStarted; 82 83 TPtr8 iBufDes; // Descriptor for the buffer. 84 TInt iLatency; // Latency target in ms 85 TInt iLatencySamples; // Latency target in samples. 86 TInt iMinWrite; // Min number of samples to write per turn. 87 TInt iMaxWrite; // Max number of samples to write per turn. 88 TInt iBaseSamplesPlayed; // amples played before last restart. 89 TInt iSamplesWritten; // Number of samples written so far. 90 91 RTimer iTimer; 92 TBool iTimerCreated; 93 TBool iTimerActive; 94 95 RThread iProcess; 96}; 97 98#endif // SDL_ngageaudio_hpp
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.