| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 591 人关注过本帖
标题:[求助]这个C函数的VB声明应该怎么写?
只看楼主 加入收藏
nxhujiee
Rank: 1
等 级:新手上路
威 望:1
帖 子:17
专家分:0
注 册:2009-7-19
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:6 
[求助]这个C函数的VB声明应该怎么写?
ttsGetAudLibInfoList
  得到指定语言的所有发音人信息列表。



语法:
  int ttsGetAudLibInfoList (
   int nLanguage,
   SPEAKERINFO* pSpeakerInfo
  );



参数
nLanguage 语言种类,0:普通话,1:粤语 2:英语
pSpeakerInfo 指向全体发音人信息结构体的指针,SPEAKERINFO结构体参见注释



返回值:
  成功返回0,失败返回其它。



注释:
   typedef struct
 {
   int m_nSpeakerNum;
   char m_szSpeakerDesc[MAX_SPEAKER_NUM][MAX_SPEAKER_DESC_NUM];
   char m_szSpeakerName[MAX_SPEAKER_NUM][MAX_SPEAKER_PATH_NUM];
 }SPEAKERINFO;
  自上至下依次是发音人数量,发音人的描述,以及发音人的路径.

----------------------------------------------
尤其是这个SPEAKERINFO如何改写成vb的自定义数据类型,请懂C语言的大神看看,帮帮忙
搜索更多相关主题的帖子: 普通话 结构体 英语 粤语 信息 
2013-08-27 21:35
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
收藏
得分:10 
tpye SPEAKERINFO
    SpeakerNum as long '不用前缀了吧!
    SpeakerDesc(1 to MAX_SPEAKER_NUM,1 to MAX_SPEAKER_DESC_NUM) as byte
    SpeakerName(1 to MAX_SPEAKER_NUM,1 to MAX_SPEAKER_PATH_NUM) as byte
end type
自己调试转字符看看对不对吧。话说咱怀疑它会出错。
2013-08-27 22:11
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:10 
我感觉这个定义用 STRING 更好。

tpye SPEAKERINFO
    SpeakerNum as long
    SpeakerDesc(1 to MAX_SPEAKER_DESC_NUM) as string *  MAX_SPEAKER_NUM
    SpeakerName(1 to MAX_SPEAKER_PATH_NUM as string * MAX_SPEAKER_NUM
end type

授人于鱼,不如授人于渔
早已停用QQ了
2013-08-28 08:27
nxhujiee
Rank: 1
等 级:新手上路
威 望:1
帖 子:17
专家分:0
注 册:2009-7-19
收藏
得分:0 
感谢上面二位大神,二位的代码运行后都要求 to 后面为常数。改成这样可以通过:

Type SPEAKERINFO
    SpeakerNum As Long
    SpeakerDesc(1 To 10) As String * MAX_SPEAKER_NUM
    SpeakerName(1 To 10) As String * MAX_SPEAKER_NUM
End Type

但又出现错误49,DLL调用约定错误,我已经凌乱了
2013-08-28 23:02
nxhujiee
Rank: 1
等 级:新手上路
威 望:1
帖 子:17
专家分:0
注 册:2009-7-19
收藏
得分:0 
这是慧声语音的SkyVoice.dll,无法引入vb,所以想动态调用。
上面的内容是慧声语音提供的一个.h头文件中的,我想根据这个头文件改写成vb声明。

下面是完整的头文件内容:
/*=========================================================================*/
/*                                                                         */
/*                              慧声语音工作室                             */
/*                         http://www.                        */
/*                                                                         */
/*=========================================================================*/
/**
 * \file    SkyVoice.h
 *
 * \version    3.0.0
 *
 * \brief    Declaration of SkyVoice APIs
 */
/*=========================================================================*/
#ifndef SKYVOICE_H
#define SKYVOICE_H


/** \brief    definition of encoding type*/
#define ENCODING_GB         1
#define ENCODING_GBK         2
#define ENCODING_BIG5        3

/** \brief    definition of language mode*/
#define MANDARIN            0

/** \brief    definition of TTS engine status*/
#define TTS_STATUS_UNINITIAL            0        ///<  TTS status is unintialed
#define TTS_STATUS_INVALIDATEHANDLE        1        ///<  TTS status is that handle is invalidated
#define TTS_STATUS_IDLE                    2        ///<  TTS status is idle
#define TTS_STATUS_SYNTHESIS            3        ///<  TTS status is synthesising

/** \brief    definition of speaker information*/
#define MAX_SPEAKER_NUM        10
#define MAX_SPEAKER_DESC    256
#define MAX_SPEAKER_PATH    256

/** \brief    Speaker information structure     */
typedef struct
{
    int     m_nSpeakerNum;                                            ///<  number of speakers
    char m_szSpeakerDesc[MAX_SPEAKER_NUM][MAX_SPEAKER_DESC];    ///<  description of speakers, e.g., 小严(普通话男声)
    char m_szSpeakerName[MAX_SPEAKER_NUM][MAX_SPEAKER_PATH];    ///<  name of speaker audio file, e.g., mandarin/xiaoyan.dat, the name can be used directly as the input parameter of interface ttsSetAudLib
}SPEAKERINFO;


#ifdef __cplusplus
extern "C" {
#endif


/*-------------------------------------------------------------------------*/
/**
 * \brief        Initialize tts with audio function
 * \param    szIniFileName    [in]    full file name of SkyVoice.ini
 * \return    0: success; others: error code
 */
/*-------------------------------------------------------------------------*/
int ttsInitial(char *szIniFileName);



/*-------------------------------------------------------------------------*/
/**
 * \brief        Close tts with audio function
 * \param    none
* \return    0: success; others: error code
 */
/*-------------------------------------------------------------------------*/
int ttsClose();



/*-------------------------------------------------------------------------*/
/**
 * \brief        Query status of TTS engine
 * \param    none
 * \return    status of TTS
 */
/*-------------------------------------------------------------------------*/
int ttsGetStatus();



/*-------------------------------------------------------------------------*/
/**
* \brief    Convert the code of input text to GB encoding type
* \param    szsrcText        [in]    the source text to be converted
* \param    nCodeType        [in]    encoding type of input text, AUTO, GB, GBK, BIG5 are supported
* \param    szConvedText    [out]    the converted text
* \return    0: success;        others: error code
*/
/*-------------------------------------------------------------------------*/
int ttsCodeConvert(char *szSrcText,int nCodeType, char *szConvedText);



/*-------------------------------------------------------------------------*/
/**
* \brief    Run TTS play engine to synthesis text to audio
* \param    hWnd        [in]    handle of current window
* \param    szText        [in]    input text, the encodeing type must be GB
* \return    0: success, others: error code
*/
/*-------------------------------------------------------------------------*/
int ttsPlay(int hWnd, char *szText);



/*-------------------------------------------------------------------------*/
/**
* \brief        Stop the synthesizing
* \param    none
* \return    0: tts handle is invalid         0:success
*/
/*-------------------------------------------------------------------------*/
int ttsStop();



/*-------------------------------------------------------------------------*/
/**
* \brief    Set language mode.
* \param    fSpeed        [in]    the rate of playing speed, 1.0 is the default speed
* \return    0: success,others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsSetLangMode(int nLangMode);



/*-------------------------------------------------------------------------*/
/**
* \brief    Get language mode..
* \param    pnLangMode    [in]    pointer of language mode
* \return    0: success,others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetLangMode(int *pnLangMode);



/*-------------------------------------------------------------------------*/
/**
* \brief    Get the speaker information of specified language.
* \param    nLanguage        [in]    language specified
* \param    pSpeakerInfo    [out]    speaker infomation
* \return    0: others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetAudLibInfoList(int nLanguage,SPEAKERINFO* pSpeakerInfo);



/*-------------------------------------------------------------------------*/
/**
* \brief    Set active audio library of specified language,
* \param    nLanguage        [in]    specified language
* \param    szAudLibName    [in]    name of audio lib to be loaded
* \return    0: success, others: error code
*/
/*-------------------------------------------------------------------------*/
int ttsSetAudLib(int nLanguage, char *szAudLibName);



/*-------------------------------------------------------------------------*/
/**
* \brief    Get the name of active audio library of specified language
* \param    nLanguage        [in]    specified language
* \param    szAudLibName    [in]    name of audio lib to be loaded
* \return    0:success,     others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetAudLib(int nLanguage, char *szAudLibName);



/*-------------------------------------------------------------------------*/
/**
* \brief        Set the playing speed of the specified TTS engine. It's a relative value, 1 is default speed.
* \param    fSpeed        [in]    the rate of playing speed, range from 0.2 to 5.0, 1.0 is the default speed
* \return    0: success, others: error code
*/
/*-------------------------------------------------------------------------*/
int ttsSetSpeed(float fSpeed);



/*-------------------------------------------------------------------------*/
/**
* \brief        Get the playing speed of the specified TTS engine. It's a relative value, 1 is default speed.
* \param    pfSpeed        [out]    pointer of speed
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetSpeed(float *pfSpeed);



/*-------------------------------------------------------------------------*/
/**
* \brief    Set the adjusting ratio of pitch. It's a relative value, 1 is default speed.
* \param    fPitchRatio    [in]    the adjusting ratio of pitch,range from 0.2 to 5.0, 1.0 is the default value
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsSetPitchRatio(float fPitchRatio);



/*-------------------------------------------------------------------------*/
/**
* \brief    Get the adjusting ratio of pitch.. It's a relative value, 1 is default speed.
* \param    pfPitchRatio[in]    pointer of the adjusting ratio of pitch
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetPitchRatio(float* pfPitchRatio);



/*-------------------------------------------------------------------------*/
/**
* \brief    Set adjusting ratio of volume.
* \param    fVolume        [in]    volume, range from 0.1 to 2.0, 1.0 is the default volume
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsSetVolume(float fVolume);



/*-------------------------------------------------------------------------*/
/**
* \brief    Get the volume.
* \param    pfVolume    [out]    pointer of volume
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetVolume(float *pfVolume);



/*-------------------------------------------------------------------------*/
/**
* \brief    set whether to set 'return' as end symbol of sentences
* \param    cSet            [in]     
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsSetRdReturn(char cSet);



/*-------------------------------------------------------------------------*/
/**
* \brief    check whether setting 'return' as end symbol of sentences
* \param    pcSet        [out]   
* \return    0:success, others:error code
*/
/*-------------------------------------------------------------------------*/
int ttsGetRdReturn(char *pcSet);



/*-------------------------------------------------------------------------*/
/**
* \brief    Set the TTS engine to read out symbol,which is ignored in default
* \param    cRdSymbol    [in]    the flag whether read out symbols
* \return    0:success, others:error code   
*/
/*-------------------------------------------------------------------------*/
int ttsSetReadPunc(char cRdSymbol);



/*-------------------------------------------------------------------------*/
/**
* \brief    check whether TTS engin is to read out symbol
* \param    pcRdSymbol    [out]    the flag whether read out symbols
* \return    0:success, others:error code   
*/
/*-------------------------------------------------------------------------*/
int ttsGetReadPunc(char *pcRdSymbol);



#ifdef __cplusplus
}
#endif


#endif

------------------------------------------------------------
这是慧声语音SDK下载地址:
http://www.
这个语音引擎非常好,二个语音库加起来才30M左右,却几乎可以达到讯飞语音的流畅效果。
我想用它的SDK作二次开发,但是卡在了dll函数声明这块,不知哪位C语言达人可以试一下。
2013-08-28 23:13
nxhujiee
Rank: 1
等 级:新手上路
威 望:1
帖 子:17
专家分:0
注 册:2009-7-19
收藏
得分:0 
最近因为工作需要,我要合成一批中文语音文件,我比较了多种语音,最后选中了慧声语音。由于慧声语音工作室开发的朗声语音操作不方便而且不能输出声音文件,所以我写了一个辅助工具,顺利完成了任务,而且效果非常好。
这是我用易语言写的一个朗声语音辅助工具,很好用的:
http://www.
胡子朗声语音辅助工具2.rar (406.98 KB)

图片附件: 游客没有浏览图片的权限,请 登录注册


如果能引用它的SDK ,就可以随心所欲地实现自己的想法了。可惜我的C语言只够写个hello world.
2013-08-28 23:29
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:0 
回四楼:

#define MAX_SPEAKER_NUM        10
#define MAX_SPEAKER_DESC    256
#define MAX_SPEAKER_PATH    256

根据你的 头文件。
这三个 符号 需要定义为 常量。定义到模块里。
public const MAX_SPEAKER_NUM =10
public const MAX_SPEAKER_DESC =256
public const MAX_SPEAKER_PATH =256

授人于鱼,不如授人于渔
早已停用QQ了
2013-08-29 08:42
快速回复:[求助]这个C函数的VB声明应该怎么写?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056159 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved