3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
* Copyright (C) 2005 - 2009 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
774 |
} |
} |
775 |
} |
} |
776 |
|
|
777 |
|
#if defined(WIN32) |
778 |
|
static HINSTANCE dllInstance = NULL; |
779 |
|
|
780 |
|
String Sampler::GetInstallDir() { |
781 |
|
char buf[MAX_PATH + 1]; |
782 |
|
if (GetModuleFileName(dllInstance, buf, MAX_PATH)) { |
783 |
|
String s(buf); |
784 |
|
size_t n = s.rfind('\\'); |
785 |
|
if (n != String::npos) { |
786 |
|
return s.substr(0, n); |
787 |
|
} |
788 |
|
} |
789 |
|
return ""; |
790 |
|
} |
791 |
|
#endif |
792 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |
793 |
|
|
794 |
|
#if defined(WIN32) |
795 |
|
extern "C" { |
796 |
|
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) |
797 |
|
{ |
798 |
|
switch (reason) { |
799 |
|
case DLL_PROCESS_ATTACH: |
800 |
|
LinuxSampler::dllInstance = instance; |
801 |
|
break; |
802 |
|
} |
803 |
|
return TRUE; |
804 |
|
} |
805 |
|
} |
806 |
|
#endif |