Jack2 1.9.10

JackMMCSS.h

00001 /*
00002  Copyright (C) 2004-2008 Grame
00003 
00004  This program is free software; you can redistribute it and/or modify
00005  it under the terms of the GNU Lesser General Public License as published by
00006  the Free Software Foundation; either version 2.1 of the License, or
00007  (at your option) any later version.
00008 
00009  This program is distributed in the hope that it will be useful,
00010  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  GNU Lesser General Public License for more details.
00013 
00014  You should have received a copy of the GNU Lesser General Public License
00015  along with this program; if not, write to the Free Software
00016  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 
00018  */
00019 
00020 
00021 
00022 #ifndef __JackMMCSS__
00023 #define __JackMMCSS__
00024 
00025 #include "JackSystemDeps.h"
00026 #include "JackCompilerDeps.h"
00027 #include <windows.h>
00028 #include <map>
00029 
00030 namespace Jack
00031 {
00032 
00033 typedef enum _AVRT_PRIORITY {
00034   AVRT_PRIORITY_LOW = -1,
00035   AVRT_PRIORITY_NORMAL,         /* 0 */
00036   AVRT_PRIORITY_HIGH,           /* 1 */
00037   AVRT_PRIORITY_CRITICAL        /* 2 */
00038 } AVRT_PRIORITY, *PAVRT_PRIORITY;
00039 
00040 typedef HANDLE (WINAPI *avSetMmThreadCharacteristics)(LPCTSTR, LPDWORD);
00041 typedef BOOL (WINAPI *avRevertMmThreadCharacteristics)(HANDLE);
00042 typedef BOOL (WINAPI *avSetMmThreadPriority)(HANDLE, AVRT_PRIORITY);
00043 
00048 class SERVER_EXPORT JackMMCSS
00049 {
00050 
00051     private:
00052 
00053         static JACK_HANDLE fAvrtDll;
00054         static avSetMmThreadCharacteristics ffMMCSSFun1;
00055         static avSetMmThreadPriority ffMMCSSFun2;
00056         static avRevertMmThreadCharacteristics ffMMCSSFun3;
00057         static std::map<jack_native_thread_t, HANDLE> fHandleTable;
00058 
00059     public:
00060 
00061         JackMMCSS();
00062         ~JackMMCSS();
00063 
00064         static int MMCSSAcquireRealTime(jack_native_thread_t thread);
00065         static int MMCSSDropRealTime(jack_native_thread_t thread);
00066 
00067 };
00068 
00069 } // end of namespace
00070 
00071 #endif
00072