| @@ -2,8 +2,9 @@ | |||
| * mbrowrap -- A wrapper library around the mbrola binary | |||
| * providing a subset of the API from the Windows mbrola DLL. | |||
| * | |||
| * Copyright (C) 2005 to 2013 by Jonathan Duddington | |||
| * Copyright (C) 2010 by Nicolas Pitre <[email protected]> | |||
| * Copyright (C) 2013 Reece H. Dunn | |||
| * Copyright (C) 2013-2016 Reece H. Dunn | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the GNU General Public License as published by | |||
| @@ -18,6 +19,46 @@ | |||
| #include "config.h" | |||
| #if defined(_WIN32) || defined(_WIN64) | |||
| #include <windows.h> | |||
| #endif | |||
| #include "mbrowrap.h" | |||
| #if defined(_WIN32) || defined(_WIN64) | |||
| HINSTANCE hinstDllMBR = NULL; | |||
| BOOL load_MBR() | |||
| { | |||
| if (hinstDllMBR != NULL) | |||
| return TRUE; // already loaded | |||
| if ((hinstDllMBR = LoadLibraryA("mbrola.dll")) == 0) | |||
| return FALSE; | |||
| init_MBR = (PROCIC)GetProcAddress(hinstDllMBR, "init_MBR"); | |||
| write_MBR = (PROCIC)GetProcAddress(hinstDllMBR, "write_MBR"); | |||
| flush_MBR = (PROCIV)GetProcAddress(hinstDllMBR, "flush_MBR"); | |||
| read_MBR = (PROCISI)GetProcAddress(hinstDllMBR, "read_MBR"); | |||
| close_MBR = (PROCVV)GetProcAddress(hinstDllMBR, "close_MBR"); | |||
| reset_MBR = (PROCVV)GetProcAddress(hinstDllMBR, "reset_MBR"); | |||
| lastError_MBR = (PROCIV)GetProcAddress(hinstDllMBR, "lastError_MBR"); | |||
| lastErrorStr_MBR = (PROCVCI)GetProcAddress(hinstDllMBR, "lastErrorStr_MBR"); | |||
| setNoError_MBR = (PROCVI)GetProcAddress(hinstDllMBR, "setNoError_MBR"); | |||
| setVolumeRatio_MBR = (PROCVF)GetProcAddress(hinstDllMBR, "setVolumeRatio_MBR"); | |||
| return TRUE; | |||
| } | |||
| void unload_MBR() | |||
| { | |||
| if (hinstDllMBR) { | |||
| FreeLibrary(hinstDllMBR); | |||
| hinstDllMBR = NULL; | |||
| } | |||
| } | |||
| #else | |||
| #include <espeak-ng/espeak_ng.h> | |||
| #include "speech.h" | |||
| @@ -34,8 +75,6 @@ | |||
| #include <sys/types.h> | |||
| #include <sys/wait.h> | |||
| #include "mbrowrap.h" | |||
| /* | |||
| * mbrola instance parameters | |||
| */ | |||
| @@ -610,3 +649,5 @@ void resetError_MBR(void) | |||
| { | |||
| mbr_errorbuf[0] = 0; | |||
| } | |||
| #endif | |||
| @@ -43,46 +43,11 @@ extern int Read4Bytes(FILE *f); | |||
| extern void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range); | |||
| extern unsigned char *outbuf; | |||
| #ifndef PLATFORM_WINDOWS | |||
| #include "mbrowrap.h" | |||
| #else | |||
| #if defined(_WIN32) || defined(_WIN64) | |||
| #include <windows.h> | |||
| #include "mbrowrap.h" | |||
| HINSTANCE hinstDllMBR = NULL; | |||
| BOOL load_MBR() | |||
| { | |||
| if (hinstDllMBR != NULL) | |||
| return TRUE; // already loaded | |||
| if ((hinstDllMBR = LoadLibraryA("mbrola.dll")) == 0) | |||
| return FALSE; | |||
| init_MBR = (PROCIC)GetProcAddress(hinstDllMBR, "init_MBR"); | |||
| write_MBR = (PROCIC)GetProcAddress(hinstDllMBR, "write_MBR"); | |||
| flush_MBR = (PROCIV)GetProcAddress(hinstDllMBR, "flush_MBR"); | |||
| read_MBR = (PROCISI)GetProcAddress(hinstDllMBR, "read_MBR"); | |||
| close_MBR = (PROCVV)GetProcAddress(hinstDllMBR, "close_MBR"); | |||
| reset_MBR = (PROCVV)GetProcAddress(hinstDllMBR, "reset_MBR"); | |||
| lastError_MBR = (PROCIV)GetProcAddress(hinstDllMBR, "lastError_MBR"); | |||
| lastErrorStr_MBR = (PROCVCI)GetProcAddress(hinstDllMBR, "lastErrorStr_MBR"); | |||
| setNoError_MBR = (PROCVI)GetProcAddress(hinstDllMBR, "setNoError_MBR"); | |||
| setVolumeRatio_MBR = (PROCVF)GetProcAddress(hinstDllMBR, "setVolumeRatio_MBR"); | |||
| return TRUE; | |||
| } | |||
| void unload_MBR() | |||
| { | |||
| if (hinstDllMBR) { | |||
| FreeLibrary(hinstDllMBR); | |||
| hinstDllMBR = NULL; | |||
| } | |||
| } | |||
| #endif | |||
| #endif // windows | |||
| #include "mbrowrap.h" | |||
| static MBROLA_TAB *mbrola_tab = NULL; | |||
| static int mbrola_control = 0; | |||
| @@ -159,6 +159,7 @@ | |||
| <ClCompile Include="..\libespeak-ng\ieee80.c" /> | |||
| <ClCompile Include="..\libespeak-ng\intonation.c" /> | |||
| <ClCompile Include="..\libespeak-ng\klatt.c" /> | |||
| <ClCompile Include="..\libespeak-ng\mbrowrap.c" /> | |||
| <ClCompile Include="..\libespeak-ng\numbers.c" /> | |||
| <ClCompile Include="..\libespeak-ng\phonemelist.c" /> | |||
| <ClCompile Include="..\libespeak-ng\readclause.c" /> | |||
| @@ -84,6 +84,9 @@ | |||
| <ClCompile Include="..\libespeak-ng\klatt.c"> | |||
| <Filter>Source Files</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\libespeak-ng\mbrowrap.c"> | |||
| <Filter>Source Files</Filter> | |||
| </ClCompile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ClInclude Include="config.h"> | |||