mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-04 07:48:47 +00:00
Move the Windows MBROLA API support layer to mbrowrap.c,
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
* 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 <nico@fluxnic.net>
|
* Copyright (C) 2010 by Nicolas Pitre <nico@fluxnic.net>
|
||||||
* 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
|
||||||
@@ -18,6 +19,46 @@
|
|||||||
|
|
||||||
#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"
|
||||||
@@ -34,8 +75,6 @@
|
|||||||
#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
|
||||||
*/
|
*/
|
||||||
@@ -610,3 +649,5 @@ void resetError_MBR(void)
|
|||||||
{
|
{
|
||||||
mbr_errorbuf[0] = 0;
|
mbr_errorbuf[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -43,47 +43,12 @@ extern int Read4Bytes(FILE *f);
|
|||||||
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
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
|
||||||
#include "mbrowrap.h"
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mbrowrap.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 // windows
|
|
||||||
|
|
||||||
static MBROLA_TAB *mbrola_tab = NULL;
|
static MBROLA_TAB *mbrola_tab = NULL;
|
||||||
static int mbrola_control = 0;
|
static int mbrola_control = 0;
|
||||||
static int mbr_name_prefix = 0;
|
static int mbr_name_prefix = 0;
|
||||||
|
|||||||
@@ -159,6 +159,7 @@
|
|||||||
<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" />
|
||||||
|
|||||||
@@ -84,6 +84,9 @@
|
|||||||
<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">
|
||||||
|
|||||||
Reference in New Issue
Block a user