* mbrowrap -- A wrapper library around the mbrola binary | * mbrowrap -- A wrapper library around the mbrola binary | ||||
* providing a subset of the API from the Windows mbrola DLL. | * 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) 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 | * 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 | * it under the terms of the GNU General Public License as published by | ||||
#include "config.h" | #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 <espeak-ng/espeak_ng.h> | ||||
#include "speech.h" | #include "speech.h" | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/wait.h> | #include <sys/wait.h> | ||||
#include "mbrowrap.h" | |||||
/* | /* | ||||
* mbrola instance parameters | * mbrola instance parameters | ||||
*/ | */ | ||||
{ | { | ||||
mbr_errorbuf[0] = 0; | mbr_errorbuf[0] = 0; | ||||
} | } | ||||
#endif |
extern void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range); | extern void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range); | ||||
extern unsigned char *outbuf; | extern unsigned char *outbuf; | ||||
#ifndef PLATFORM_WINDOWS | |||||
#include "mbrowrap.h" | |||||
#else | |||||
#if defined(_WIN32) || defined(_WIN64) | |||||
#include <windows.h> | #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 MBROLA_TAB *mbrola_tab = NULL; | ||||
static int mbrola_control = 0; | static int mbrola_control = 0; |
<ClCompile Include="..\libespeak-ng\ieee80.c" /> | <ClCompile Include="..\libespeak-ng\ieee80.c" /> | ||||
<ClCompile Include="..\libespeak-ng\intonation.c" /> | <ClCompile Include="..\libespeak-ng\intonation.c" /> | ||||
<ClCompile Include="..\libespeak-ng\klatt.c" /> | <ClCompile Include="..\libespeak-ng\klatt.c" /> | ||||
<ClCompile Include="..\libespeak-ng\mbrowrap.c" /> | |||||
<ClCompile Include="..\libespeak-ng\numbers.c" /> | <ClCompile Include="..\libespeak-ng\numbers.c" /> | ||||
<ClCompile Include="..\libespeak-ng\phonemelist.c" /> | <ClCompile Include="..\libespeak-ng\phonemelist.c" /> | ||||
<ClCompile Include="..\libespeak-ng\readclause.c" /> | <ClCompile Include="..\libespeak-ng\readclause.c" /> |
<ClCompile Include="..\libespeak-ng\klatt.c"> | <ClCompile Include="..\libespeak-ng\klatt.c"> | ||||
<Filter>Source Files</Filter> | <Filter>Source Files</Filter> | ||||
</ClCompile> | </ClCompile> | ||||
<ClCompile Include="..\libespeak-ng\mbrowrap.c"> | |||||
<Filter>Source Files</Filter> | |||||
</ClCompile> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ClInclude Include="config.h"> | <ClInclude Include="config.h"> |