Skylicht Engine
Loading...
Searching...
No Matches
CDriverMMSystem.h
1/*
2!@
3MIT License
4
5Copyright (c) 2012 - 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "SkylichtAudioConfig.h"
28
29#ifdef USE_MMDRIVER
30
31#include <windows.h>
32#include <mmsystem.h>
33#pragma comment(lib, "Winmm.lib")
34
35#include "CDriverNull.h"
36
37#include "Thread/IThread.h"
38#include "Thread/IMutex.h"
39using namespace Skylicht::System;
40
41namespace Skylicht
42{
43 namespace Audio
44 {
45 class CDriverMMSystem :
46 public CDriverNull,
47 public IThreadCallback
48 {
49 public:
50 CDriverMMSystem();
51 virtual ~CDriverMMSystem();
52
53 virtual void init();
54 virtual void shutdown();
55 virtual void suspend();
56 virtual void resume();
57
58 virtual void updateThread();
59 protected:
60 int m_minBufferSize;
61 int m_v5MinLatency;
62 int m_v6MinLatency;
63
64 // Buffer parameters
65 struct SBufferParam
66 {
67 int NumBuffers;
68 int BufferSize;
69 int CurrentBuffer;
70 unsigned char** Buffers;
71
72 // MMSytem parameters
73 WAVEFORMATEX Waveformat;
74 WAVEHDR* WaveBlocks; // Objects containing buffer address provided (by reference) to mmsystem.
75
76 IThread* UpdateThread;
77 bool IsThreadRunning;
78 };
79
80 HWAVEOUT m_waveOut;
81 HWAVEIN m_waveIn;
82
83 SBufferParam m_output;
84 SBufferParam m_input;
85 };
86 }
87}
88
89#endif
Definition CDriverNull.h:40
Handles all core audio functionality.
Definition AudioDebugLog.h:31
The foundation for thread and process handling.
Definition CNullMutex.h:32
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29