Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port V2 to Linux #97

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions v2/libv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
/*************************************************************************************/
/*************************************************************************************/

#ifndef _MSC_VER
#define __stdcall
#endif

#ifdef __cplusplus
extern "C"
{
Expand Down
12 changes: 10 additions & 2 deletions v2/phonemtab.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// file automatically generated by kram.exe - do not ask


#ifdef _MSC_VER
#pragma pack (push, 1)
#endif

struct Phoneme
{
Expand All @@ -12,9 +14,15 @@ struct Phoneme
sF32 a_voicing, a_aspiration, a_frication, a_bypass;
sF32 a_1, a_2, a_3, a_4, a_n, a_56;
sF32 duration, rank;
};
}
#ifndef _MSC_VER
__attribute__((__packed__))
#endif
;

#ifdef _MSC_VER
#pragma pack (pop)
#endif

// { 490, 60, 1480, 90, 2500, 150, 270, 0, 0, 0,-16,-16,-16,-16,-16,-16,-16, 0, 5, 31}, // 18: end
// { 280, 60, 1720, 90, 2560, 150, 270, 62, 0, 0,-16, 43, 38, 38, 50,-16,-16, 0, 4, 20}, // 68: zz
Expand Down Expand Up @@ -152,4 +160,4 @@ static Phoneme orgphonemes[] =
{ 280, 60, 2020, 90, 2560, 150, 270, 62, 0, 0,-16, 43, 40, 50, 40, 30, 10, 4, 20}, // 67: zh
{ 280, 60, 1720, 90, 2560, 150, 270, 62, 0, 0,-16, 43, 38, 38, 50, 30, 10, 4, 20}, // 68: zz
};
*/
*/
13 changes: 11 additions & 2 deletions v2/ronan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

//#pragma intrinsic (atan, cos, fabs)

#if !defined(_MSC_VER) && !defined(__stdcall)
#define __stdcall
#endif

#ifdef _MSC_VER
static sInt sFtol (const float f)
{
__asm
Expand Down Expand Up @@ -96,6 +100,11 @@ static sF64 sFExp(sF64 f)

return f;
}
#else
#define sFtol(a) ((sInt)(a))
#define sFPow(a, b) powf(a, b)
#define sFExp(a) expf(a)
#endif

#ifndef sCopyMem
#define sCopyMem memcpy
Expand Down Expand Up @@ -576,7 +585,7 @@ extern "C" void __stdcall ronanCBProcess(syWRonan *wsptr,sF32 *buf, sU32 len)

}

extern "C" extern void* __stdcall synthGetSpeechMem(void *a_pthis);
extern "C" /*extern*/ void* __stdcall synthGetSpeechMem(void *a_pthis);

extern "C" void __stdcall synthSetLyrics(void *a_pthis,const char **a_ptr)
{
Expand All @@ -585,4 +594,4 @@ extern "C" void __stdcall synthSetLyrics(void *a_pthis,const char **a_ptr)
wsptr->baseptr=wsptr->ptr=wsptr->texts[0];
}

#endif
#endif
24 changes: 18 additions & 6 deletions v2/sounddef.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
//#include "stdafx.h"

#include "types.h"
#if defined(_WIN32) /*&& defined(_MSC_VER)*/
#include "tool/file.h"
#endif

#include <string.h>
#include <stdio.h>

#include "sounddef.h"
#include "v2mconv.h"

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define V2_memset ZeroMemory
#else
#ifndef V2_memset
#include <string.h>
#define V2_memset(p,s) memset(p,0,s)
#endif
#endif

// lr: in case you miss the arrays: look in sounddef.h

Expand Down Expand Up @@ -112,8 +122,8 @@ void sdInit()
p+=v2gtopics[i].no;
}

#ifdef RONAN
ZeroMemory(speech,64*256);
#ifdef RONAN
V2_memset(speech,64*256);
for (int i=0; i<64; i++)
speechptrs[i]=speech[i];

Expand All @@ -130,7 +140,7 @@ void sdClose()
}



#ifdef _WIN32
static sBool sdLoadPatch(file &in, sInt pn, sInt fver=-1)
{
if (fver==-1)
Expand Down Expand Up @@ -216,7 +226,7 @@ static sBool sdLoadBank(file &in)


#ifdef RONAN
ZeroMemory(speech,64*256);
V2_memset(speech,64*256);
#endif

if (!in.eof())
Expand All @@ -232,7 +242,9 @@ static sBool sdLoadBank(file &in)
}
#else
#ifndef SINGLECHN
#ifdef _WIN32
if (sml) MessageBox(0,"Warning: Not loading speech synth texts\nIf you overwrite the file later, the texts will be lost!","Farbrausch V2",MB_ICONEXCLAMATION);
#endif
#endif
in.seekcur(sml);
#endif
Expand Down Expand Up @@ -319,7 +331,7 @@ sBool sdImportV2MPatches(file &in, const char *prefix)

return np?1:0;
}

#endif

void sdCopyPatch()
{
Expand All @@ -337,4 +349,4 @@ void sdInitPatch()
{
memcpy(soundmem+128*4+v2curpatch*v2soundsize,v2initsnd,v2soundsize);
sprintf(patchnames[v2curpatch],"Init Patch #%03d",v2curpatch);
}
}
15 changes: 10 additions & 5 deletions v2/sounddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ enum V2CTLTYPES { VCTL_SKIP, VCTL_SLIDER, VCTL_MB, };

typedef struct {
int no;
char *name;
char *name2;
const char *name;
const char *name2;
} V2TOPIC;

typedef struct {

int version;
char *name;
const char *name;
V2CTLTYPES ctltype;
int offset, min, max;
int isdest;
char *ctlstr;
const char *ctlstr;
} V2PARAM;

////////////////////////////////////////////
Expand Down Expand Up @@ -58,7 +58,12 @@ const int v2ntopics = sizeof(v2topics)/sizeof(V2TOPIC);
//
////////////////////////////////////////////

__declspec(selectany) const char *v2sources[] = {
#ifdef _MSC_VER
__declspec(selectany)
#else
__attribute__((__weak__))
#endif
const char *v2sources[] = {
"Velocity",
"Modulation",
"Breath",
Expand Down
Loading