Update changelog
[jack2.git] / windows / JackMMCSS.h
blob19329aedad9b0c4e3b93402b889dd337d17bcff0
1 /*
2 Copyright (C) 2004-2008 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef __JackMMCSS__
23 #define __JackMMCSS__
25 #include "JackSystemDeps.h"
26 #include "JackCompilerDeps.h"
27 #ifdef __MINGW32__
28 #include <winsock2.h>
29 #endif
30 #include <windows.h>
31 #include <map>
33 namespace Jack
36 typedef enum _AVRT_PRIORITY {
37 AVRT_PRIORITY_LOW = -1,
38 AVRT_PRIORITY_NORMAL, /* 0 */
39 AVRT_PRIORITY_HIGH, /* 1 */
40 AVRT_PRIORITY_CRITICAL /* 2 */
41 } AVRT_PRIORITY, *PAVRT_PRIORITY;
43 #define BASE_REALTIME_PRIORITY 90
45 typedef HANDLE (WINAPI *avSetMmThreadCharacteristics)(LPCTSTR, LPDWORD);
46 typedef BOOL (WINAPI *avRevertMmThreadCharacteristics)(HANDLE);
47 typedef BOOL (WINAPI *avSetMmThreadPriority)(HANDLE, AVRT_PRIORITY);
49 /*!
50 \brief MMCSS services.
53 class SERVER_EXPORT JackMMCSS
56 private:
58 static JACK_HANDLE fAvrtDll;
59 static avSetMmThreadCharacteristics ffMMCSSFun1;
60 static avSetMmThreadPriority ffMMCSSFun2;
61 static avRevertMmThreadCharacteristics ffMMCSSFun3;
62 static std::map<jack_native_thread_t, HANDLE> fHandleTable;
64 public:
66 JackMMCSS();
67 ~JackMMCSS();
69 static int MMCSSAcquireRealTime(jack_native_thread_t thread, int priority);
70 static int MMCSSDropRealTime(jack_native_thread_t thread);
74 } // end of namespace
76 #endif