├── .gitattributes ├── README.md ├── glide.lock ├── glide.yaml ├── main.go ├── server └── server.go ├── speed_test.go ├── vendor └── github.com │ ├── garyburd │ └── redigo │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.markdown │ │ ├── internal │ │ ├── commandinfo.go │ │ ├── commandinfo_test.go │ │ └── redistest │ │ │ └── testdb.go │ │ ├── redis │ │ ├── conn.go │ │ ├── conn_test.go │ │ ├── doc.go │ │ ├── log.go │ │ ├── pool.go │ │ ├── pool_test.go │ │ ├── pubsub.go │ │ ├── pubsub_test.go │ │ ├── redis.go │ │ ├── reply.go │ │ ├── reply_test.go │ │ ├── scan.go │ │ ├── scan_test.go │ │ ├── script.go │ │ ├── script_test.go │ │ ├── test_test.go │ │ └── zpop_example_test.go │ │ └── redisx │ │ ├── connmux.go │ │ ├── connmux_test.go │ │ └── doc.go │ └── imroc │ └── log │ ├── LICENSE │ ├── README.md │ └── log.go └── xf ├── README.md ├── doc ├── iFlytek MSC Reference Manual │ ├── all__0_8js.html │ ├── all__1_8js.html │ ├── arrowdown.png │ ├── arrowright.png │ ├── bc_s.png │ ├── bdwn.png │ ├── closed.png │ ├── dir_25539194184bab781b1c7ecd67774cd8.html │ ├── dir_9a65024ac0a05d9abfc2bb6c7ff8f818.html │ ├── doc.png │ ├── doxygen.css │ ├── doxygen.png │ ├── dynsections.js │ ├── dynsections_8js.html │ ├── files.html │ ├── files__0_8js.html │ ├── files__1_8js.html │ ├── folderclosed.png │ ├── folderopen.png │ ├── functions__0_8js.html │ ├── functions__1_8js.html │ ├── globals.html │ ├── globals_func.html │ ├── globals_vars.html │ ├── index.html │ ├── jquery.js │ ├── jquery_8js.html │ ├── msp__cmn_8h.html │ ├── msp__cmn_8h_source.html │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── qisr_8h.html │ ├── qisr_8h_source.html │ ├── qmfv_8h.html │ ├── qmfv_8h_source.html │ ├── qtts_8h.html │ ├── qtts_8h_source.html │ ├── search │ │ ├── all_0.html │ │ ├── all_0.js │ │ ├── all_1.html │ │ ├── all_1.js │ │ ├── all_10.html │ │ ├── all_10.js │ │ ├── all_11.html │ │ ├── all_11.js │ │ ├── all_2.html │ │ ├── all_2.js │ │ ├── all_3.html │ │ ├── all_3.js │ │ ├── all_4.html │ │ ├── all_4.js │ │ ├── all_5.html │ │ ├── all_5.js │ │ ├── all_6.html │ │ ├── all_6.js │ │ ├── all_7.html │ │ ├── all_7.js │ │ ├── all_8.html │ │ ├── all_8.js │ │ ├── all_9.html │ │ ├── all_9.js │ │ ├── all_a.html │ │ ├── all_a.js │ │ ├── all_b.html │ │ ├── all_b.js │ │ ├── all_c.html │ │ ├── all_c.js │ │ ├── all_d.html │ │ ├── all_d.js │ │ ├── all_e.html │ │ ├── all_e.js │ │ ├── all_f.html │ │ ├── all_f.js │ │ ├── close.png │ │ ├── files_0.html │ │ ├── files_0.js │ │ ├── files_1.html │ │ ├── files_1.js │ │ ├── files_2.html │ │ ├── files_2.js │ │ ├── files_3.html │ │ ├── files_3.js │ │ ├── files_4.html │ │ ├── files_4.js │ │ ├── files_5.html │ │ ├── files_5.js │ │ ├── files_6.html │ │ ├── files_6.js │ │ ├── functions_0.html │ │ ├── functions_0.js │ │ ├── functions_1.html │ │ ├── functions_1.js │ │ ├── functions_2.html │ │ ├── functions_2.js │ │ ├── functions_3.html │ │ ├── functions_3.js │ │ ├── functions_4.html │ │ ├── functions_4.js │ │ ├── functions_5.html │ │ ├── functions_5.js │ │ ├── functions_6.html │ │ ├── functions_6.js │ │ ├── functions_7.html │ │ ├── functions_7.js │ │ ├── functions_8.html │ │ ├── functions_8.js │ │ ├── functions_9.html │ │ ├── functions_9.js │ │ ├── functions_a.html │ │ ├── functions_a.js │ │ ├── mag_sel.png │ │ ├── nomatches.html │ │ ├── search.css │ │ ├── search.js │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ ├── searchdata.js │ │ ├── variables_0.html │ │ ├── variables_0.js │ │ ├── variables_1.html │ │ ├── variables_1.js │ │ ├── variables_2.html │ │ ├── variables_2.js │ │ ├── variables_3.html │ │ ├── variables_3.js │ │ ├── variables_4.html │ │ ├── variables_4.js │ │ ├── variables_5.html │ │ ├── variables_5.js │ │ ├── variables_6.html │ │ ├── variables_6.js │ │ ├── variables_7.html │ │ └── variables_7.js │ ├── search_8js.html │ ├── searchdata_8js.html │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ └── tabs.css └── tts_sample │ ├── 32bit_make.sh │ ├── 64bit_make.sh │ ├── Makefile │ └── tts_sample.c ├── include ├── .msp_cmn.h.swp ├── convert.h ├── msp_cmn.h ├── msp_errors.h ├── msp_types.h └── qtts.h ├── lib ├── libmsc.so ├── x64 │ └── libmsc.so └── x86 │ └── libmsc.so └── xf.go /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=Go 2 | *.css linguist-language=Go 3 | *.html linguist-language=Go 4 | *.c linguist-language=Go 5 | *.h linguist-language=Go 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ontts 2 | ============== 3 | ontts 是语音在线合成服务 4 | 5 | ## 编译 6 | 7 | ##### GOPATH 8 | 项目源文件需要放在$GOPATH下 9 | 10 | ##### glide 11 | 通过glide管理依赖,若没有安装glide,需先安装 12 | 13 | Ubuntu下glide安装方法: 14 | ``` sh 15 | sudo add-apt-repository ppa:masterminds/glide && sudo apt-get update 16 | sudo apt-get install glide 17 | ``` 18 | 在源文件目录下执行以下命令下载依赖 19 | ``` sh 20 | glide install 21 | ``` 22 | 23 | ##### 编译 24 | ``` sh 25 | go build 26 | ``` 27 | 28 | ##### 运行 29 | 需要将libmsc.so加入环境变量 30 | ``` sh 31 | mv xf/lib/libmsc.so /usr/local/lib/ 32 | vi ~/.bashrc 33 | ``` 34 | export LD_LIBRARY_PATH=/usr/local/lib 35 | 36 | 37 | ## 使用示例 38 | ##### 单次合成: 39 | ``` sh 40 | ./ontts -t "云喇叭快递,快递小管家,您的快递到了,请于下午6点前到学校后门申通快递取件" -o test.wav 41 | ``` 42 | 43 | ##### 启动合成后台服务: 44 | ``` sh 45 | ./ontts -r ":6379" -d /tmp/out 46 | ``` 47 | 48 | ## 命令参数 49 |
50 | 讯飞语音参数选项:
51 |     -tp                  TTS合成参数[有默认值]
52 |     -lp                  登录参数[有默认值]
53 | 
54 | 单次合成模式选项:
55 |     -t                 	待合成的文本
56 |     -o                	音频输出路径 
57 | 
58 | 合成服务模式选项:
59 |     -d                     音频保存的目录 
60 |     -s                   合成速度级别(1-10),数值越小速度越快,越耗CPU[默认为1]
61 |     -r                    redis连接地址
62 | 
63 | 日志选项:
64 |     -l                    日志输出路径[默认./ontts.log]
65 |     -ll                  日志输出级别(debug,info,warn,error)
66 | 
67 | 其他:
68 |     -h                          查看帮助 
69 | 
70 | 71 | ## 目录 72 |
73 | ── ontts
74 |    ├── glide.yaml (glide依赖配置)
75 |    ├── main.go (程序入口)
76 |    ├── README.md
77 |    ├── server (TTS合成主体逻辑的package)
78 |    │   └── server.go
79 |    ├── speed_test.go (速度测试)
80 |    └── xf (讯飞SDK的Go封装)
81 |        ├── doc (讯飞语音linux SDK相关参考)
82 |        ├── include (cgo需要用到的头文件)
83 |        ├── lib (动态链接库 SDK)
84 |        │   └── libmsc.so
85 |        ├── README.md
86 |        └── xf.go
87 | 
88 | -------------------------------------------------------------------------------- /glide.lock: -------------------------------------------------------------------------------- 1 | hash: d98040927f84a825e931f22625c59c43237cf893c9efebb7db41f19ba629c6d9 2 | updated: 2016-10-25T19:52:44.942310245+08:00 3 | imports: 4 | - name: github.com/garyburd/redigo 5 | version: 80f7de34463b0ed3d7c61303e5619efe1b227f92 6 | subpackages: 7 | - internal 8 | - redis 9 | - name: github.com/imroc/log 10 | version: c6167dd819ca6d57c694583aeb6bc534e5fb5b1d 11 | testImports: [] 12 | -------------------------------------------------------------------------------- /glide.yaml: -------------------------------------------------------------------------------- 1 | package: ontts 2 | import: 3 | - package: github.com/imroc/log 4 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "ontts/server" 7 | "os" 8 | "strings" 9 | 10 | "github.com/imroc/log" 11 | ) 12 | 13 | var usageStr = ` 14 | Usage: ontts [options] 15 | 16 | 讯飞语音参数选项: 17 | -tp TTS合成参数[有默认值] 18 | -lp 登录参数[有默认值] 19 | 20 | 单次合成模式选项: 21 | -t 待合成的文本 22 | -o 音频输出路径 23 | 24 | 合成服务模式选项: 25 | -d 音频保存的目录 26 | -b 音频备份的目录 27 | -s 合成速度级别(1-10),数值越小速度越快,越耗CPU[默认为1] 28 | -r redis连接地址 29 | -rp redis密码 30 | 31 | 日志选项: 32 | -l 日志输出路径[默认./ontts.log] 33 | -ll 日志输出级别(debug,info,warn,error) 34 | 35 | 其他: 36 | -h 查看帮助 37 | ` 38 | 39 | func main() { 40 | opts := &server.Options{} 41 | 42 | var txt string 43 | var out string 44 | var help bool 45 | var logFile string 46 | var logLevel string 47 | 48 | flag.StringVar(&txt, "t", "", "单次合成的文本") 49 | flag.StringVar(&out, "o", "", "单次合成的输出路径") 50 | flag.StringVar(&logFile, "l", "ontts.log", "日志输出路径") 51 | flag.StringVar(&logLevel, "ll", "debug", "日志输出级别") 52 | flag.BoolVar(&help, "h", false, "Help") 53 | 54 | flag.StringVar(&opts.TTSParams, "tp", "voice_name = xiaoqi, text_encoding = UTF8, sample_rate = 8000, speed = 50, volume = 50, pitch = 50, rdn = 2", "TTS合成参数") 55 | flag.StringVar(&opts.LoginParams, "lp", "appid = 5718a335, work_dir = .", "登录参数") 56 | flag.StringVar(&opts.RedisAddr, "r", ":6379", "redis连接地址") 57 | flag.StringVar(&opts.RedisPass, "rp", "", "redis连接密码") 58 | flag.StringVar(&opts.OutDir, "d", "", "音频输出目录") 59 | flag.StringVar(&opts.BackupDir, "b", "", "音频保存目录") 60 | flag.IntVar(&opts.Speed, "s", 1, "合成速度") 61 | 62 | flag.Parse() 63 | 64 | if help { 65 | fmt.Printf("%s\n", usageStr) 66 | return 67 | } 68 | 69 | err := configureLog(logFile, logLevel) 70 | if err != nil { 71 | log.Error("日志配置失败:%v", err) 72 | return 73 | } 74 | 75 | s := server.New(opts) 76 | 77 | if txt != "" { // 单次合成 78 | if out == "" { 79 | out = txt + ".wav" 80 | } 81 | log.Debug("合成文本:%q,输出:%s", txt, out) 82 | if err = s.Once(txt, out); err != nil { 83 | log.Error("%v", err) 84 | return 85 | } 86 | } 87 | 88 | s.Start() 89 | 90 | } 91 | 92 | func configureLog(logFile, logLevel string) error { 93 | level := log.DEBUG 94 | 95 | switch strings.ToLower(logLevel) { 96 | case "debug": 97 | level = log.DEBUG 98 | case "info": 99 | level = log.INFO 100 | case "warn": 101 | level = log.WARN 102 | case "error": 103 | level = log.ERROR 104 | } 105 | 106 | file, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) 107 | if err != nil { 108 | return err 109 | } 110 | 111 | log.Set(level, file, log.Lshortfile|log.LstdFlags) 112 | 113 | return nil 114 | } 115 | -------------------------------------------------------------------------------- /server/server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io" 7 | "ontts/xf" 8 | "os" 9 | "strings" 10 | "time" 11 | 12 | "github.com/garyburd/redigo/redis" 13 | "github.com/imroc/log" 14 | ) 15 | 16 | type Server struct { 17 | opts *Options 18 | } 19 | 20 | type Options struct { 21 | OutDir string //音频输出目录 22 | BackupDir string // 备份目录,文件输出成功之后,再将文件复制到备份目录 23 | Level int //音频生成速度级别,越快越耗CPU,级别1~10,数字越小速度越快 24 | TTSParams string 25 | LoginParams string 26 | RedisAddr string 27 | RedisPass string 28 | Speed int 29 | } 30 | 31 | type Speech struct { 32 | Id string `json:"id"` 33 | Txt string `json:"txt"` 34 | } 35 | 36 | func New(opts *Options) *Server { 37 | return &Server{ 38 | opts: opts, 39 | } 40 | } 41 | 42 | func (s *Server) Start() { 43 | var c redis.Conn 44 | var err error 45 | if s.opts.RedisPass == "" { 46 | c, err = redis.Dial("tcp", s.opts.RedisAddr) 47 | } else { 48 | c, err = redis.Dial("tcp", s.opts.RedisAddr, redis.DialPassword(s.opts.RedisPass)) 49 | } 50 | if err != nil { 51 | log.Error("failed to connect redis:%v") 52 | return 53 | } 54 | defer c.Close() 55 | 56 | psc := redis.PubSubConn{Conn: c} 57 | 58 | err = psc.Subscribe("tts") 59 | if err != nil { 60 | log.Error("failed to subscribe:%v", err) 61 | return 62 | } 63 | 64 | sub, ok := psc.Receive().(redis.Subscription) 65 | if !ok { 66 | log.Error("first message is not subscription") 67 | return 68 | } 69 | if sub.Count == 0 { 70 | log.Error("redis subscription count is 0") 71 | return 72 | } 73 | 74 | err = setXF(s.opts.Speed, s.opts.TTSParams, s.opts.LoginParams) 75 | if err != nil { 76 | log.Error("failed to set xunfei params:%v", err) 77 | return 78 | } 79 | 80 | if s.opts.OutDir != "" && s.opts.OutDir[len(s.opts.OutDir)-1] != os.PathSeparator { 81 | s.opts.OutDir += string(os.PathSeparator) 82 | } 83 | if s.opts.BackupDir != "" && s.opts.BackupDir[len(s.opts.BackupDir)-1] != os.PathSeparator { 84 | s.opts.BackupDir += string(os.PathSeparator) 85 | } 86 | 87 | var speech Speech 88 | for { 89 | switch n := psc.Receive().(type) { 90 | case redis.Message: 91 | err := json.Unmarshal(n.Data, &speech) 92 | if err != nil { 93 | log.Error("error unmarshal:%v", err) 94 | continue 95 | } 96 | if len(strings.Fields(speech.Txt)) == 0 { // 忽略空白字符串,会导致语音合成参数错误 97 | continue 98 | } 99 | tryN := 0 100 | ttsFilename := s.opts.OutDir + speech.Id + ".wav" 101 | TTS: 102 | err = xf.TextToSpeech(speech.Txt, ttsFilename) 103 | if err != nil { 104 | tryN++ 105 | log.Error("error convert:%v,tts ID:%s,TXT:%s", err, speech.Id, speech.Txt) 106 | if tryN > 5 { // 多次重试失败,忽略此条语音的合成 107 | continue 108 | } 109 | time.Sleep(5 * time.Second) 110 | goto TTS 111 | } 112 | log.Debug("合成ID:%s,TXT:%s", speech.Id, speech.Txt) 113 | if s.opts.BackupDir != "" { 114 | src, _err := os.Open(ttsFilename) 115 | if _err != nil { 116 | log.Error("failed to open file %s:%v", ttsFilename, _err) 117 | } 118 | filename := s.opts.BackupDir + speech.Id + ".wav" 119 | dst, _err := os.Create(filename) 120 | if _err != nil { 121 | log.Error("failed to create file %s:%v", filename, _err) 122 | } else { 123 | _, _err = io.Copy(dst, src) 124 | if _err != nil { 125 | log.Error("failed to copy file %s->%s:%v", ttsFilename, filename, _err) 126 | } 127 | } 128 | } 129 | case error: 130 | log.Error("error redis message:%v", n) 131 | time.Sleep(10 * time.Second) 132 | default: 133 | log.Warn("unknown message:%v", n) 134 | } 135 | } 136 | 137 | } 138 | 139 | func (s *Server) Once(txt string, desPath string) error { 140 | log.Debug("tts:%s,login:%s", s.opts.TTSParams, s.opts.LoginParams) 141 | xf.SetTTSParams(s.opts.TTSParams) 142 | err := xf.Login(s.opts.LoginParams) 143 | if err != nil { 144 | return err 145 | } 146 | //不SetSleep,默认为0,单次合成以高性能模式 147 | log.Debug("txt:%s,des_path:%s", txt, desPath) 148 | err = xf.TextToSpeech(txt, desPath) 149 | if err != nil { 150 | return err 151 | } 152 | return nil 153 | } 154 | 155 | func setXF(speedLevel int, ttsParams, loginParams string) error { 156 | if speedLevel < 1 || speedLevel > 10 { 157 | return fmt.Errorf("wrong speed level:%d,it should between 1 and 10", speedLevel) 158 | } 159 | 160 | sleepTime := 15000 * (speedLevel - 1) 161 | 162 | xf.SetSleep(sleepTime) 163 | 164 | xf.SetTTSParams(ttsParams) 165 | 166 | err := xf.Login(loginParams) 167 | if err != nil { 168 | return err 169 | } 170 | return nil 171 | } 172 | -------------------------------------------------------------------------------- /speed_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/rand" 6 | "ontts/xf" 7 | "os" 8 | "testing" 9 | "time" 10 | 11 | "github.com/imroc/log" 12 | ) 13 | 14 | func TestSpeed(t *testing.T) { 15 | file, _ := os.OpenFile("test.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) 16 | log.Set(log.DEBUG, file, log.LstdFlags) 17 | 18 | xf.SetTTSParams("voice_name = xiaoqi, text_encoding = UTF8, sample_rate = 8000, speed = 50, volume = 50, pitch = 50, rdn = 2") 19 | xf.SetSleep(0) 20 | 21 | err := xf.Login("appid = 5718a335, work_dir = .") 22 | 23 | if err != nil { 24 | log.Error("err:%v", err) 25 | return 26 | } 27 | 28 | now := time.Now() 29 | 30 | var txt string 31 | for i := 1; i < 1000; i++ { 32 | txt = getRandomString(r.Intn(21) + 40) 33 | err = xf.TextToSpeech(txt, fmt.Sprintf("/home/roc/wav/%d.wav", i)) 34 | if err != nil { 35 | log.Error("err:%v", err) 36 | return 37 | } 38 | log.Debug("已生成第%d个:%s,共用%f秒", i, txt, time.Since(now).Seconds()) 39 | } 40 | 41 | log.Info("执行完毕,总消耗:%f秒", time.Since(now).Seconds()) 42 | xf.Logout() 43 | 44 | } 45 | 46 | var start rune = 0x4e00 47 | var stop rune = 0x9fa5 48 | var n int32 = int32(stop - start) 49 | var r *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano())) 50 | 51 | func getRandomString(l int) string { 52 | s := make([]rune, l) 53 | for i := 0; i < l; i++ { 54 | s[i] = rune(r.Int31n(n) + start) 55 | } 56 | return string(s) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | services: 4 | - redis-server 5 | 6 | go: 7 | - 1.4 8 | - 1.5 9 | - 1.6 10 | - 1.7 11 | - tip 12 | 13 | script: 14 | - go get -t -v ./... 15 | - diff -u <(echo -n) <(gofmt -d .) 16 | - go vet $(go list ./... | grep -v /vendor/) 17 | - go test -v -race ./... 18 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/README.markdown: -------------------------------------------------------------------------------- 1 | Redigo 2 | ====== 3 | 4 | [![Build Status](https://travis-ci.org/garyburd/redigo.svg?branch=master)](https://travis-ci.org/garyburd/redigo) 5 | [![GoDoc](https://godoc.org/github.com/garyburd/redigo/redis?status.svg)](https://godoc.org/github.com/garyburd/redigo/redis) 6 | 7 | Redigo is a [Go](http://golang.org/) client for the [Redis](http://redis.io/) database. 8 | 9 | Features 10 | ------- 11 | 12 | * A [Print-like](http://godoc.org/github.com/garyburd/redigo/redis#hdr-Executing_Commands) API with support for all Redis commands. 13 | * [Pipelining](http://godoc.org/github.com/garyburd/redigo/redis#hdr-Pipelining), including pipelined transactions. 14 | * [Publish/Subscribe](http://godoc.org/github.com/garyburd/redigo/redis#hdr-Publish_and_Subscribe). 15 | * [Connection pooling](http://godoc.org/github.com/garyburd/redigo/redis#Pool). 16 | * [Script helper type](http://godoc.org/github.com/garyburd/redigo/redis#Script) with optimistic use of EVALSHA. 17 | * [Helper functions](http://godoc.org/github.com/garyburd/redigo/redis#hdr-Reply_Helpers) for working with command replies. 18 | 19 | Documentation 20 | ------------- 21 | 22 | - [API Reference](http://godoc.org/github.com/garyburd/redigo/redis) 23 | - [FAQ](https://github.com/garyburd/redigo/wiki/FAQ) 24 | 25 | Installation 26 | ------------ 27 | 28 | Install Redigo using the "go get" command: 29 | 30 | go get github.com/garyburd/redigo/redis 31 | 32 | The Go distribution is Redigo's only dependency. 33 | 34 | Related Projects 35 | ---------------- 36 | 37 | - [rafaeljusto/redigomock](https://godoc.org/github.com/rafaeljusto/redigomock) - A mock library for Redigo. 38 | - [chasex/redis-go-cluster](https://github.com/chasex/redis-go-cluster) - A Redis cluster client implementation. 39 | - [FZambia/go-sentinel](https://github.com/FZambia/go-sentinel) - Redis Sentinel support for Redigo 40 | - [PuerkitoBio/redisc](https://github.com/PuerkitoBio/redisc) - Redis Cluster client built on top of Redigo 41 | 42 | Contributing 43 | ------------ 44 | 45 | Send email to Gary Burd (address in GitHub profile) before doing any work on Redigo. 46 | 47 | License 48 | ------- 49 | 50 | Redigo is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). 51 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/internal/commandinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package internal // import "github.com/garyburd/redigo/internal" 16 | 17 | import ( 18 | "strings" 19 | ) 20 | 21 | const ( 22 | WatchState = 1 << iota 23 | MultiState 24 | SubscribeState 25 | MonitorState 26 | ) 27 | 28 | type CommandInfo struct { 29 | Set, Clear int 30 | } 31 | 32 | var commandInfos = map[string]CommandInfo{ 33 | "WATCH": {Set: WatchState}, 34 | "UNWATCH": {Clear: WatchState}, 35 | "MULTI": {Set: MultiState}, 36 | "EXEC": {Clear: WatchState | MultiState}, 37 | "DISCARD": {Clear: WatchState | MultiState}, 38 | "PSUBSCRIBE": {Set: SubscribeState}, 39 | "SUBSCRIBE": {Set: SubscribeState}, 40 | "MONITOR": {Set: MonitorState}, 41 | } 42 | 43 | func init() { 44 | for n, ci := range commandInfos { 45 | commandInfos[strings.ToLower(n)] = ci 46 | } 47 | } 48 | 49 | func LookupCommandInfo(commandName string) CommandInfo { 50 | if ci, ok := commandInfos[commandName]; ok { 51 | return ci 52 | } 53 | return commandInfos[strings.ToUpper(commandName)] 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/internal/commandinfo_test.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import "testing" 4 | 5 | func TestLookupCommandInfo(t *testing.T) { 6 | for _, n := range []string{"watch", "WATCH", "wAtch"} { 7 | if LookupCommandInfo(n) == (CommandInfo{}) { 8 | t.Errorf("LookupCommandInfo(%q) = CommandInfo{}, expected non-zero value", n) 9 | } 10 | } 11 | } 12 | 13 | func benchmarkLookupCommandInfo(b *testing.B, names ...string) { 14 | for i := 0; i < b.N; i++ { 15 | for _, c := range names { 16 | LookupCommandInfo(c) 17 | } 18 | } 19 | } 20 | 21 | func BenchmarkLookupCommandInfoCorrectCase(b *testing.B) { 22 | benchmarkLookupCommandInfo(b, "watch", "WATCH", "monitor", "MONITOR") 23 | } 24 | 25 | func BenchmarkLookupCommandInfoMixedCase(b *testing.B) { 26 | benchmarkLookupCommandInfo(b, "wAtch", "WeTCH", "monItor", "MONiTOR") 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/internal/redistest/testdb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Package redistest contains utilities for writing Redigo tests. 16 | package redistest 17 | 18 | import ( 19 | "errors" 20 | "time" 21 | 22 | "github.com/garyburd/redigo/redis" 23 | ) 24 | 25 | type testConn struct { 26 | redis.Conn 27 | } 28 | 29 | func (t testConn) Close() error { 30 | _, err := t.Conn.Do("SELECT", "9") 31 | if err != nil { 32 | return nil 33 | } 34 | _, err = t.Conn.Do("FLUSHDB") 35 | if err != nil { 36 | return err 37 | } 38 | return t.Conn.Close() 39 | } 40 | 41 | // Dial dials the local Redis server and selects database 9. To prevent 42 | // stomping on real data, DialTestDB fails if database 9 contains data. The 43 | // returned connection flushes database 9 on close. 44 | func Dial() (redis.Conn, error) { 45 | c, err := redis.DialTimeout("tcp", ":6379", 0, 1*time.Second, 1*time.Second) 46 | if err != nil { 47 | return nil, err 48 | } 49 | 50 | _, err = c.Do("SELECT", "9") 51 | if err != nil { 52 | c.Close() 53 | return nil, err 54 | } 55 | 56 | n, err := redis.Int(c.Do("DBSIZE")) 57 | if err != nil { 58 | c.Close() 59 | return nil, err 60 | } 61 | 62 | if n != 0 { 63 | c.Close() 64 | return nil, errors.New("database #9 is not empty, test can not continue") 65 | } 66 | 67 | return testConn{c}, nil 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Package redis is a client for the Redis database. 16 | // 17 | // The Redigo FAQ (https://github.com/garyburd/redigo/wiki/FAQ) contains more 18 | // documentation about this package. 19 | // 20 | // Connections 21 | // 22 | // The Conn interface is the primary interface for working with Redis. 23 | // Applications create connections by calling the Dial, DialWithTimeout or 24 | // NewConn functions. In the future, functions will be added for creating 25 | // sharded and other types of connections. 26 | // 27 | // The application must call the connection Close method when the application 28 | // is done with the connection. 29 | // 30 | // Executing Commands 31 | // 32 | // The Conn interface has a generic method for executing Redis commands: 33 | // 34 | // Do(commandName string, args ...interface{}) (reply interface{}, err error) 35 | // 36 | // The Redis command reference (http://redis.io/commands) lists the available 37 | // commands. An example of using the Redis APPEND command is: 38 | // 39 | // n, err := conn.Do("APPEND", "key", "value") 40 | // 41 | // The Do method converts command arguments to binary strings for transmission 42 | // to the server as follows: 43 | // 44 | // Go Type Conversion 45 | // []byte Sent as is 46 | // string Sent as is 47 | // int, int64 strconv.FormatInt(v) 48 | // float64 strconv.FormatFloat(v, 'g', -1, 64) 49 | // bool true -> "1", false -> "0" 50 | // nil "" 51 | // all other types fmt.Print(v) 52 | // 53 | // Redis command reply types are represented using the following Go types: 54 | // 55 | // Redis type Go type 56 | // error redis.Error 57 | // integer int64 58 | // simple string string 59 | // bulk string []byte or nil if value not present. 60 | // array []interface{} or nil if value not present. 61 | // 62 | // Use type assertions or the reply helper functions to convert from 63 | // interface{} to the specific Go type for the command result. 64 | // 65 | // Pipelining 66 | // 67 | // Connections support pipelining using the Send, Flush and Receive methods. 68 | // 69 | // Send(commandName string, args ...interface{}) error 70 | // Flush() error 71 | // Receive() (reply interface{}, err error) 72 | // 73 | // Send writes the command to the connection's output buffer. Flush flushes the 74 | // connection's output buffer to the server. Receive reads a single reply from 75 | // the server. The following example shows a simple pipeline. 76 | // 77 | // c.Send("SET", "foo", "bar") 78 | // c.Send("GET", "foo") 79 | // c.Flush() 80 | // c.Receive() // reply from SET 81 | // v, err = c.Receive() // reply from GET 82 | // 83 | // The Do method combines the functionality of the Send, Flush and Receive 84 | // methods. The Do method starts by writing the command and flushing the output 85 | // buffer. Next, the Do method receives all pending replies including the reply 86 | // for the command just sent by Do. If any of the received replies is an error, 87 | // then Do returns the error. If there are no errors, then Do returns the last 88 | // reply. If the command argument to the Do method is "", then the Do method 89 | // will flush the output buffer and receive pending replies without sending a 90 | // command. 91 | // 92 | // Use the Send and Do methods to implement pipelined transactions. 93 | // 94 | // c.Send("MULTI") 95 | // c.Send("INCR", "foo") 96 | // c.Send("INCR", "bar") 97 | // r, err := c.Do("EXEC") 98 | // fmt.Println(r) // prints [1, 1] 99 | // 100 | // Concurrency 101 | // 102 | // Connections support one concurrent caller to the Receive method and one 103 | // concurrent caller to the Send and Flush methods. No other concurrency is 104 | // supported including concurrent calls to the Do method. 105 | // 106 | // For full concurrent access to Redis, use the thread-safe Pool to get, use 107 | // and release a connection from within a goroutine. Connections returned from 108 | // a Pool have the concurrency restrictions described in the previous 109 | // paragraph. 110 | // 111 | // Publish and Subscribe 112 | // 113 | // Use the Send, Flush and Receive methods to implement Pub/Sub subscribers. 114 | // 115 | // c.Send("SUBSCRIBE", "example") 116 | // c.Flush() 117 | // for { 118 | // reply, err := c.Receive() 119 | // if err != nil { 120 | // return err 121 | // } 122 | // // process pushed message 123 | // } 124 | // 125 | // The PubSubConn type wraps a Conn with convenience methods for implementing 126 | // subscribers. The Subscribe, PSubscribe, Unsubscribe and PUnsubscribe methods 127 | // send and flush a subscription management command. The receive method 128 | // converts a pushed message to convenient types for use in a type switch. 129 | // 130 | // psc := redis.PubSubConn{c} 131 | // psc.Subscribe("example") 132 | // for { 133 | // switch v := psc.Receive().(type) { 134 | // case redis.Message: 135 | // fmt.Printf("%s: message: %s\n", v.Channel, v.Data) 136 | // case redis.Subscription: 137 | // fmt.Printf("%s: %s %d\n", v.Channel, v.Kind, v.Count) 138 | // case error: 139 | // return v 140 | // } 141 | // } 142 | // 143 | // Reply Helpers 144 | // 145 | // The Bool, Int, Bytes, String, Strings and Values functions convert a reply 146 | // to a value of a specific type. To allow convenient wrapping of calls to the 147 | // connection Do and Receive methods, the functions take a second argument of 148 | // type error. If the error is non-nil, then the helper function returns the 149 | // error. If the error is nil, the function converts the reply to the specified 150 | // type: 151 | // 152 | // exists, err := redis.Bool(c.Do("EXISTS", "foo")) 153 | // if err != nil { 154 | // // handle error return from c.Do or type conversion error. 155 | // } 156 | // 157 | // The Scan function converts elements of a array reply to Go types: 158 | // 159 | // var value1 int 160 | // var value2 string 161 | // reply, err := redis.Values(c.Do("MGET", "key1", "key2")) 162 | // if err != nil { 163 | // // handle error 164 | // } 165 | // if _, err := redis.Scan(reply, &value1, &value2); err != nil { 166 | // // handle error 167 | // } 168 | package redis // import "github.com/garyburd/redigo/redis" 169 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/log.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | import ( 18 | "bytes" 19 | "fmt" 20 | "log" 21 | ) 22 | 23 | // NewLoggingConn returns a logging wrapper around a connection. 24 | func NewLoggingConn(conn Conn, logger *log.Logger, prefix string) Conn { 25 | if prefix != "" { 26 | prefix = prefix + "." 27 | } 28 | return &loggingConn{conn, logger, prefix} 29 | } 30 | 31 | type loggingConn struct { 32 | Conn 33 | logger *log.Logger 34 | prefix string 35 | } 36 | 37 | func (c *loggingConn) Close() error { 38 | err := c.Conn.Close() 39 | var buf bytes.Buffer 40 | fmt.Fprintf(&buf, "%sClose() -> (%v)", c.prefix, err) 41 | c.logger.Output(2, buf.String()) 42 | return err 43 | } 44 | 45 | func (c *loggingConn) printValue(buf *bytes.Buffer, v interface{}) { 46 | const chop = 32 47 | switch v := v.(type) { 48 | case []byte: 49 | if len(v) > chop { 50 | fmt.Fprintf(buf, "%q...", v[:chop]) 51 | } else { 52 | fmt.Fprintf(buf, "%q", v) 53 | } 54 | case string: 55 | if len(v) > chop { 56 | fmt.Fprintf(buf, "%q...", v[:chop]) 57 | } else { 58 | fmt.Fprintf(buf, "%q", v) 59 | } 60 | case []interface{}: 61 | if len(v) == 0 { 62 | buf.WriteString("[]") 63 | } else { 64 | sep := "[" 65 | fin := "]" 66 | if len(v) > chop { 67 | v = v[:chop] 68 | fin = "...]" 69 | } 70 | for _, vv := range v { 71 | buf.WriteString(sep) 72 | c.printValue(buf, vv) 73 | sep = ", " 74 | } 75 | buf.WriteString(fin) 76 | } 77 | default: 78 | fmt.Fprint(buf, v) 79 | } 80 | } 81 | 82 | func (c *loggingConn) print(method, commandName string, args []interface{}, reply interface{}, err error) { 83 | var buf bytes.Buffer 84 | fmt.Fprintf(&buf, "%s%s(", c.prefix, method) 85 | if method != "Receive" { 86 | buf.WriteString(commandName) 87 | for _, arg := range args { 88 | buf.WriteString(", ") 89 | c.printValue(&buf, arg) 90 | } 91 | } 92 | buf.WriteString(") -> (") 93 | if method != "Send" { 94 | c.printValue(&buf, reply) 95 | buf.WriteString(", ") 96 | } 97 | fmt.Fprintf(&buf, "%v)", err) 98 | c.logger.Output(3, buf.String()) 99 | } 100 | 101 | func (c *loggingConn) Do(commandName string, args ...interface{}) (interface{}, error) { 102 | reply, err := c.Conn.Do(commandName, args...) 103 | c.print("Do", commandName, args, reply, err) 104 | return reply, err 105 | } 106 | 107 | func (c *loggingConn) Send(commandName string, args ...interface{}) error { 108 | err := c.Conn.Send(commandName, args...) 109 | c.print("Send", commandName, args, nil, err) 110 | return err 111 | } 112 | 113 | func (c *loggingConn) Receive() (interface{}, error) { 114 | reply, err := c.Conn.Receive() 115 | c.print("Receive", "", nil, reply, err) 116 | return reply, err 117 | } 118 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/pubsub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | import "errors" 18 | 19 | // Subscription represents a subscribe or unsubscribe notification. 20 | type Subscription struct { 21 | 22 | // Kind is "subscribe", "unsubscribe", "psubscribe" or "punsubscribe" 23 | Kind string 24 | 25 | // The channel that was changed. 26 | Channel string 27 | 28 | // The current number of subscriptions for connection. 29 | Count int 30 | } 31 | 32 | // Message represents a message notification. 33 | type Message struct { 34 | 35 | // The originating channel. 36 | Channel string 37 | 38 | // The message data. 39 | Data []byte 40 | } 41 | 42 | // PMessage represents a pmessage notification. 43 | type PMessage struct { 44 | 45 | // The matched pattern. 46 | Pattern string 47 | 48 | // The originating channel. 49 | Channel string 50 | 51 | // The message data. 52 | Data []byte 53 | } 54 | 55 | // Pong represents a pubsub pong notification. 56 | type Pong struct { 57 | Data string 58 | } 59 | 60 | // PubSubConn wraps a Conn with convenience methods for subscribers. 61 | type PubSubConn struct { 62 | Conn Conn 63 | } 64 | 65 | // Close closes the connection. 66 | func (c PubSubConn) Close() error { 67 | return c.Conn.Close() 68 | } 69 | 70 | // Subscribe subscribes the connection to the specified channels. 71 | func (c PubSubConn) Subscribe(channel ...interface{}) error { 72 | c.Conn.Send("SUBSCRIBE", channel...) 73 | return c.Conn.Flush() 74 | } 75 | 76 | // PSubscribe subscribes the connection to the given patterns. 77 | func (c PubSubConn) PSubscribe(channel ...interface{}) error { 78 | c.Conn.Send("PSUBSCRIBE", channel...) 79 | return c.Conn.Flush() 80 | } 81 | 82 | // Unsubscribe unsubscribes the connection from the given channels, or from all 83 | // of them if none is given. 84 | func (c PubSubConn) Unsubscribe(channel ...interface{}) error { 85 | c.Conn.Send("UNSUBSCRIBE", channel...) 86 | return c.Conn.Flush() 87 | } 88 | 89 | // PUnsubscribe unsubscribes the connection from the given patterns, or from all 90 | // of them if none is given. 91 | func (c PubSubConn) PUnsubscribe(channel ...interface{}) error { 92 | c.Conn.Send("PUNSUBSCRIBE", channel...) 93 | return c.Conn.Flush() 94 | } 95 | 96 | // Ping sends a PING to the server with the specified data. 97 | func (c PubSubConn) Ping(data string) error { 98 | c.Conn.Send("PING", data) 99 | return c.Conn.Flush() 100 | } 101 | 102 | // Receive returns a pushed message as a Subscription, Message, PMessage, Pong 103 | // or error. The return value is intended to be used directly in a type switch 104 | // as illustrated in the PubSubConn example. 105 | func (c PubSubConn) Receive() interface{} { 106 | reply, err := Values(c.Conn.Receive()) 107 | if err != nil { 108 | return err 109 | } 110 | 111 | var kind string 112 | reply, err = Scan(reply, &kind) 113 | if err != nil { 114 | return err 115 | } 116 | 117 | switch kind { 118 | case "message": 119 | var m Message 120 | if _, err := Scan(reply, &m.Channel, &m.Data); err != nil { 121 | return err 122 | } 123 | return m 124 | case "pmessage": 125 | var pm PMessage 126 | if _, err := Scan(reply, &pm.Pattern, &pm.Channel, &pm.Data); err != nil { 127 | return err 128 | } 129 | return pm 130 | case "subscribe", "psubscribe", "unsubscribe", "punsubscribe": 131 | s := Subscription{Kind: kind} 132 | if _, err := Scan(reply, &s.Channel, &s.Count); err != nil { 133 | return err 134 | } 135 | return s 136 | case "pong": 137 | var p Pong 138 | if _, err := Scan(reply, &p.Data); err != nil { 139 | return err 140 | } 141 | return p 142 | } 143 | return errors.New("redigo: unknown pubsub notification") 144 | } 145 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/pubsub_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis_test 16 | 17 | import ( 18 | "fmt" 19 | "reflect" 20 | "sync" 21 | "testing" 22 | 23 | "github.com/garyburd/redigo/redis" 24 | ) 25 | 26 | func publish(channel, value interface{}) { 27 | c, err := dial() 28 | if err != nil { 29 | fmt.Println(err) 30 | return 31 | } 32 | defer c.Close() 33 | c.Do("PUBLISH", channel, value) 34 | } 35 | 36 | // Applications can receive pushed messages from one goroutine and manage subscriptions from another goroutine. 37 | func ExamplePubSubConn() { 38 | c, err := dial() 39 | if err != nil { 40 | fmt.Println(err) 41 | return 42 | } 43 | defer c.Close() 44 | var wg sync.WaitGroup 45 | wg.Add(2) 46 | 47 | psc := redis.PubSubConn{Conn: c} 48 | 49 | // This goroutine receives and prints pushed notifications from the server. 50 | // The goroutine exits when the connection is unsubscribed from all 51 | // channels or there is an error. 52 | go func() { 53 | defer wg.Done() 54 | for { 55 | switch n := psc.Receive().(type) { 56 | case redis.Message: 57 | fmt.Printf("Message: %s %s\n", n.Channel, n.Data) 58 | case redis.PMessage: 59 | fmt.Printf("PMessage: %s %s %s\n", n.Pattern, n.Channel, n.Data) 60 | case redis.Subscription: 61 | fmt.Printf("Subscription: %s %s %d\n", n.Kind, n.Channel, n.Count) 62 | if n.Count == 0 { 63 | return 64 | } 65 | case error: 66 | fmt.Printf("error: %v\n", n) 67 | return 68 | } 69 | } 70 | }() 71 | 72 | // This goroutine manages subscriptions for the connection. 73 | go func() { 74 | defer wg.Done() 75 | 76 | psc.Subscribe("example") 77 | psc.PSubscribe("p*") 78 | 79 | // The following function calls publish a message using another 80 | // connection to the Redis server. 81 | publish("example", "hello") 82 | publish("example", "world") 83 | publish("pexample", "foo") 84 | publish("pexample", "bar") 85 | 86 | // Unsubscribe from all connections. This will cause the receiving 87 | // goroutine to exit. 88 | psc.Unsubscribe() 89 | psc.PUnsubscribe() 90 | }() 91 | 92 | wg.Wait() 93 | 94 | // Output: 95 | // Subscription: subscribe example 1 96 | // Subscription: psubscribe p* 2 97 | // Message: example hello 98 | // Message: example world 99 | // PMessage: p* pexample foo 100 | // PMessage: p* pexample bar 101 | // Subscription: unsubscribe example 1 102 | // Subscription: punsubscribe p* 0 103 | } 104 | 105 | func expectPushed(t *testing.T, c redis.PubSubConn, message string, expected interface{}) { 106 | actual := c.Receive() 107 | if !reflect.DeepEqual(actual, expected) { 108 | t.Errorf("%s = %v, want %v", message, actual, expected) 109 | } 110 | } 111 | 112 | func TestPushed(t *testing.T) { 113 | pc, err := redis.DialDefaultServer() 114 | if err != nil { 115 | t.Fatalf("error connection to database, %v", err) 116 | } 117 | defer pc.Close() 118 | 119 | sc, err := redis.DialDefaultServer() 120 | if err != nil { 121 | t.Fatalf("error connection to database, %v", err) 122 | } 123 | defer sc.Close() 124 | 125 | c := redis.PubSubConn{Conn: sc} 126 | 127 | c.Subscribe("c1") 128 | expectPushed(t, c, "Subscribe(c1)", redis.Subscription{Kind: "subscribe", Channel: "c1", Count: 1}) 129 | c.Subscribe("c2") 130 | expectPushed(t, c, "Subscribe(c2)", redis.Subscription{Kind: "subscribe", Channel: "c2", Count: 2}) 131 | c.PSubscribe("p1") 132 | expectPushed(t, c, "PSubscribe(p1)", redis.Subscription{Kind: "psubscribe", Channel: "p1", Count: 3}) 133 | c.PSubscribe("p2") 134 | expectPushed(t, c, "PSubscribe(p2)", redis.Subscription{Kind: "psubscribe", Channel: "p2", Count: 4}) 135 | c.PUnsubscribe() 136 | expectPushed(t, c, "Punsubscribe(p1)", redis.Subscription{Kind: "punsubscribe", Channel: "p1", Count: 3}) 137 | expectPushed(t, c, "Punsubscribe()", redis.Subscription{Kind: "punsubscribe", Channel: "p2", Count: 2}) 138 | 139 | pc.Do("PUBLISH", "c1", "hello") 140 | expectPushed(t, c, "PUBLISH c1 hello", redis.Message{Channel: "c1", Data: []byte("hello")}) 141 | 142 | c.Ping("hello") 143 | expectPushed(t, c, `Ping("hello")`, redis.Pong{Data: "hello"}) 144 | 145 | c.Conn.Send("PING") 146 | c.Conn.Flush() 147 | expectPushed(t, c, `Send("PING")`, redis.Pong{}) 148 | } 149 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/redis.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | // Error represents an error returned in a command reply. 18 | type Error string 19 | 20 | func (err Error) Error() string { return string(err) } 21 | 22 | // Conn represents a connection to a Redis server. 23 | type Conn interface { 24 | // Close closes the connection. 25 | Close() error 26 | 27 | // Err returns a non-nil value if the connection is broken. The returned 28 | // value is either the first non-nil value returned from the underlying 29 | // network connection or a protocol parsing error. Applications should 30 | // close broken connections. 31 | Err() error 32 | 33 | // Do sends a command to the server and returns the received reply. 34 | Do(commandName string, args ...interface{}) (reply interface{}, err error) 35 | 36 | // Send writes the command to the client's output buffer. 37 | Send(commandName string, args ...interface{}) error 38 | 39 | // Flush flushes the output buffer to the Redis server. 40 | Flush() error 41 | 42 | // Receive receives a single reply from the Redis server 43 | Receive() (reply interface{}, err error) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/reply_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis_test 16 | 17 | import ( 18 | "fmt" 19 | "reflect" 20 | "testing" 21 | 22 | "github.com/garyburd/redigo/redis" 23 | ) 24 | 25 | type valueError struct { 26 | v interface{} 27 | err error 28 | } 29 | 30 | func ve(v interface{}, err error) valueError { 31 | return valueError{v, err} 32 | } 33 | 34 | var replyTests = []struct { 35 | name interface{} 36 | actual valueError 37 | expected valueError 38 | }{ 39 | { 40 | "ints([v1, v2])", 41 | ve(redis.Ints([]interface{}{[]byte("4"), []byte("5")}, nil)), 42 | ve([]int{4, 5}, nil), 43 | }, 44 | { 45 | "ints(nil)", 46 | ve(redis.Ints(nil, nil)), 47 | ve([]int(nil), redis.ErrNil), 48 | }, 49 | { 50 | "strings([v1, v2])", 51 | ve(redis.Strings([]interface{}{[]byte("v1"), []byte("v2")}, nil)), 52 | ve([]string{"v1", "v2"}, nil), 53 | }, 54 | { 55 | "strings(nil)", 56 | ve(redis.Strings(nil, nil)), 57 | ve([]string(nil), redis.ErrNil), 58 | }, 59 | { 60 | "byteslices([v1, v2])", 61 | ve(redis.ByteSlices([]interface{}{[]byte("v1"), []byte("v2")}, nil)), 62 | ve([][]byte{[]byte("v1"), []byte("v2")}, nil), 63 | }, 64 | { 65 | "byteslices(nil)", 66 | ve(redis.ByteSlices(nil, nil)), 67 | ve([][]byte(nil), redis.ErrNil), 68 | }, 69 | { 70 | "values([v1, v2])", 71 | ve(redis.Values([]interface{}{[]byte("v1"), []byte("v2")}, nil)), 72 | ve([]interface{}{[]byte("v1"), []byte("v2")}, nil), 73 | }, 74 | { 75 | "values(nil)", 76 | ve(redis.Values(nil, nil)), 77 | ve([]interface{}(nil), redis.ErrNil), 78 | }, 79 | { 80 | "float64(1.0)", 81 | ve(redis.Float64([]byte("1.0"), nil)), 82 | ve(float64(1.0), nil), 83 | }, 84 | { 85 | "float64(nil)", 86 | ve(redis.Float64(nil, nil)), 87 | ve(float64(0.0), redis.ErrNil), 88 | }, 89 | { 90 | "uint64(1)", 91 | ve(redis.Uint64(int64(1), nil)), 92 | ve(uint64(1), nil), 93 | }, 94 | { 95 | "uint64(-1)", 96 | ve(redis.Uint64(int64(-1), nil)), 97 | ve(uint64(0), redis.ErrNegativeInt), 98 | }, 99 | } 100 | 101 | func TestReply(t *testing.T) { 102 | for _, rt := range replyTests { 103 | if rt.actual.err != rt.expected.err { 104 | t.Errorf("%s returned err %v, want %v", rt.name, rt.actual.err, rt.expected.err) 105 | continue 106 | } 107 | if !reflect.DeepEqual(rt.actual.v, rt.expected.v) { 108 | t.Errorf("%s=%+v, want %+v", rt.name, rt.actual.v, rt.expected.v) 109 | } 110 | } 111 | } 112 | 113 | // dial wraps DialDefaultServer() with a more suitable function name for examples. 114 | func dial() (redis.Conn, error) { 115 | return redis.DialDefaultServer() 116 | } 117 | 118 | func ExampleBool() { 119 | c, err := dial() 120 | if err != nil { 121 | fmt.Println(err) 122 | return 123 | } 124 | defer c.Close() 125 | 126 | c.Do("SET", "foo", 1) 127 | exists, _ := redis.Bool(c.Do("EXISTS", "foo")) 128 | fmt.Printf("%#v\n", exists) 129 | // Output: 130 | // true 131 | } 132 | 133 | func ExampleInt() { 134 | c, err := dial() 135 | if err != nil { 136 | fmt.Println(err) 137 | return 138 | } 139 | defer c.Close() 140 | 141 | c.Do("SET", "k1", 1) 142 | n, _ := redis.Int(c.Do("GET", "k1")) 143 | fmt.Printf("%#v\n", n) 144 | n, _ = redis.Int(c.Do("INCR", "k1")) 145 | fmt.Printf("%#v\n", n) 146 | // Output: 147 | // 1 148 | // 2 149 | } 150 | 151 | func ExampleInts() { 152 | c, err := dial() 153 | if err != nil { 154 | fmt.Println(err) 155 | return 156 | } 157 | defer c.Close() 158 | 159 | c.Do("SADD", "set_with_integers", 4, 5, 6) 160 | ints, _ := redis.Ints(c.Do("SMEMBERS", "set_with_integers")) 161 | fmt.Printf("%#v\n", ints) 162 | // Output: 163 | // []int{4, 5, 6} 164 | } 165 | 166 | func ExampleString() { 167 | c, err := dial() 168 | if err != nil { 169 | fmt.Println(err) 170 | return 171 | } 172 | defer c.Close() 173 | 174 | c.Do("SET", "hello", "world") 175 | s, err := redis.String(c.Do("GET", "hello")) 176 | fmt.Printf("%#v\n", s) 177 | // Output: 178 | // "world" 179 | } 180 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/script.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | import ( 18 | "crypto/sha1" 19 | "encoding/hex" 20 | "io" 21 | "strings" 22 | ) 23 | 24 | // Script encapsulates the source, hash and key count for a Lua script. See 25 | // http://redis.io/commands/eval for information on scripts in Redis. 26 | type Script struct { 27 | keyCount int 28 | src string 29 | hash string 30 | } 31 | 32 | // NewScript returns a new script object. If keyCount is greater than or equal 33 | // to zero, then the count is automatically inserted in the EVAL command 34 | // argument list. If keyCount is less than zero, then the application supplies 35 | // the count as the first value in the keysAndArgs argument to the Do, Send and 36 | // SendHash methods. 37 | func NewScript(keyCount int, src string) *Script { 38 | h := sha1.New() 39 | io.WriteString(h, src) 40 | return &Script{keyCount, src, hex.EncodeToString(h.Sum(nil))} 41 | } 42 | 43 | func (s *Script) args(spec string, keysAndArgs []interface{}) []interface{} { 44 | var args []interface{} 45 | if s.keyCount < 0 { 46 | args = make([]interface{}, 1+len(keysAndArgs)) 47 | args[0] = spec 48 | copy(args[1:], keysAndArgs) 49 | } else { 50 | args = make([]interface{}, 2+len(keysAndArgs)) 51 | args[0] = spec 52 | args[1] = s.keyCount 53 | copy(args[2:], keysAndArgs) 54 | } 55 | return args 56 | } 57 | 58 | // Do evaluates the script. Under the covers, Do optimistically evaluates the 59 | // script using the EVALSHA command. If the command fails because the script is 60 | // not loaded, then Do evaluates the script using the EVAL command (thus 61 | // causing the script to load). 62 | func (s *Script) Do(c Conn, keysAndArgs ...interface{}) (interface{}, error) { 63 | v, err := c.Do("EVALSHA", s.args(s.hash, keysAndArgs)...) 64 | if e, ok := err.(Error); ok && strings.HasPrefix(string(e), "NOSCRIPT ") { 65 | v, err = c.Do("EVAL", s.args(s.src, keysAndArgs)...) 66 | } 67 | return v, err 68 | } 69 | 70 | // SendHash evaluates the script without waiting for the reply. The script is 71 | // evaluated with the EVALSHA command. The application must ensure that the 72 | // script is loaded by a previous call to Send, Do or Load methods. 73 | func (s *Script) SendHash(c Conn, keysAndArgs ...interface{}) error { 74 | return c.Send("EVALSHA", s.args(s.hash, keysAndArgs)...) 75 | } 76 | 77 | // Send evaluates the script without waiting for the reply. 78 | func (s *Script) Send(c Conn, keysAndArgs ...interface{}) error { 79 | return c.Send("EVAL", s.args(s.src, keysAndArgs)...) 80 | } 81 | 82 | // Load loads the script without evaluating it. 83 | func (s *Script) Load(c Conn) error { 84 | _, err := c.Do("SCRIPT", "LOAD", s.src) 85 | return err 86 | } 87 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/script_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis_test 16 | 17 | import ( 18 | "fmt" 19 | "reflect" 20 | "testing" 21 | "time" 22 | 23 | "github.com/garyburd/redigo/redis" 24 | ) 25 | 26 | var ( 27 | // These variables are declared at package level to remove distracting 28 | // details from the examples. 29 | c redis.Conn 30 | reply interface{} 31 | err error 32 | ) 33 | 34 | func ExampleScript() { 35 | // Initialize a package-level variable with a script. 36 | var getScript = redis.NewScript(1, `return redis.call('get', KEYS[1])`) 37 | 38 | // In a function, use the script Do method to evaluate the script. The Do 39 | // method optimistically uses the EVALSHA command. If the script is not 40 | // loaded, then the Do method falls back to the EVAL command. 41 | reply, err = getScript.Do(c, "foo") 42 | } 43 | 44 | func TestScript(t *testing.T) { 45 | c, err := redis.DialDefaultServer() 46 | if err != nil { 47 | t.Fatalf("error connection to database, %v", err) 48 | } 49 | defer c.Close() 50 | 51 | // To test fall back in Do, we make script unique by adding comment with current time. 52 | script := fmt.Sprintf("--%d\nreturn {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", time.Now().UnixNano()) 53 | s := redis.NewScript(2, script) 54 | reply := []interface{}{[]byte("key1"), []byte("key2"), []byte("arg1"), []byte("arg2")} 55 | 56 | v, err := s.Do(c, "key1", "key2", "arg1", "arg2") 57 | if err != nil { 58 | t.Errorf("s.Do(c, ...) returned %v", err) 59 | } 60 | 61 | if !reflect.DeepEqual(v, reply) { 62 | t.Errorf("s.Do(c, ..); = %v, want %v", v, reply) 63 | } 64 | 65 | err = s.Load(c) 66 | if err != nil { 67 | t.Errorf("s.Load(c) returned %v", err) 68 | } 69 | 70 | err = s.SendHash(c, "key1", "key2", "arg1", "arg2") 71 | if err != nil { 72 | t.Errorf("s.SendHash(c, ...) returned %v", err) 73 | } 74 | 75 | err = c.Flush() 76 | if err != nil { 77 | t.Errorf("c.Flush() returned %v", err) 78 | } 79 | 80 | v, err = c.Receive() 81 | if !reflect.DeepEqual(v, reply) { 82 | t.Errorf("s.SendHash(c, ..); c.Receive() = %v, want %v", v, reply) 83 | } 84 | 85 | err = s.Send(c, "key1", "key2", "arg1", "arg2") 86 | if err != nil { 87 | t.Errorf("s.Send(c, ...) returned %v", err) 88 | } 89 | 90 | err = c.Flush() 91 | if err != nil { 92 | t.Errorf("c.Flush() returned %v", err) 93 | } 94 | 95 | v, err = c.Receive() 96 | if !reflect.DeepEqual(v, reply) { 97 | t.Errorf("s.Send(c, ..); c.Receive() = %v, want %v", v, reply) 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/test_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | import ( 18 | "bufio" 19 | "errors" 20 | "flag" 21 | "fmt" 22 | "io" 23 | "io/ioutil" 24 | "os" 25 | "os/exec" 26 | "strconv" 27 | "strings" 28 | "sync" 29 | "testing" 30 | "time" 31 | ) 32 | 33 | func SetNowFunc(f func() time.Time) { 34 | nowFunc = f 35 | } 36 | 37 | var ( 38 | ErrNegativeInt = errNegativeInt 39 | 40 | serverPath = flag.String("redis-server", "redis-server", "Path to redis server binary") 41 | serverBasePort = flag.Int("redis-port", 16379, "Beginning of port range for test servers") 42 | serverLogName = flag.String("redis-log", "", "Write Redis server logs to `filename`") 43 | serverLog = ioutil.Discard 44 | 45 | defaultServerMu sync.Mutex 46 | defaultServer *Server 47 | defaultServerErr error 48 | ) 49 | 50 | type Server struct { 51 | name string 52 | cmd *exec.Cmd 53 | done chan struct{} 54 | } 55 | 56 | func NewServer(name string, args ...string) (*Server, error) { 57 | s := &Server{ 58 | name: name, 59 | cmd: exec.Command(*serverPath, args...), 60 | done: make(chan struct{}), 61 | } 62 | 63 | r, err := s.cmd.StdoutPipe() 64 | if err != nil { 65 | return nil, err 66 | } 67 | 68 | err = s.cmd.Start() 69 | if err != nil { 70 | return nil, err 71 | } 72 | 73 | ready := make(chan error, 1) 74 | go s.watch(r, ready) 75 | 76 | select { 77 | case err = <-ready: 78 | case <-time.After(time.Second * 10): 79 | err = errors.New("timeout waiting for server to start") 80 | } 81 | 82 | if err != nil { 83 | s.Stop() 84 | return nil, err 85 | } 86 | 87 | return s, nil 88 | } 89 | 90 | func (s *Server) watch(r io.Reader, ready chan error) { 91 | fmt.Fprintf(serverLog, "%d START %s \n", s.cmd.Process.Pid, s.name) 92 | var listening bool 93 | var text string 94 | scn := bufio.NewScanner(r) 95 | for scn.Scan() { 96 | text = scn.Text() 97 | fmt.Fprintf(serverLog, "%s\n", text) 98 | if !listening { 99 | if strings.Contains(text, "The server is now ready to accept connections on port") { 100 | listening = true 101 | ready <- nil 102 | } 103 | } 104 | } 105 | if !listening { 106 | ready <- fmt.Errorf("server exited: %s", text) 107 | } 108 | s.cmd.Wait() 109 | fmt.Fprintf(serverLog, "%d STOP %s \n", s.cmd.Process.Pid, s.name) 110 | close(s.done) 111 | } 112 | 113 | func (s *Server) Stop() { 114 | s.cmd.Process.Signal(os.Interrupt) 115 | <-s.done 116 | } 117 | 118 | // stopDefaultServer stops the server created by DialDefaultServer. 119 | func stopDefaultServer() { 120 | defaultServerMu.Lock() 121 | defer defaultServerMu.Unlock() 122 | if defaultServer != nil { 123 | defaultServer.Stop() 124 | defaultServer = nil 125 | } 126 | } 127 | 128 | // startDefaultServer starts the default server if not already running. 129 | func startDefaultServer() error { 130 | defaultServerMu.Lock() 131 | defer defaultServerMu.Unlock() 132 | if defaultServer != nil || defaultServerErr != nil { 133 | return defaultServerErr 134 | } 135 | defaultServer, defaultServerErr = NewServer( 136 | "default", 137 | "--port", strconv.Itoa(*serverBasePort), 138 | "--save", "", 139 | "--appendonly", "no") 140 | return defaultServerErr 141 | } 142 | 143 | // DialDefaultServer starts the test server if not already started and dials a 144 | // connection to the server. 145 | func DialDefaultServer() (Conn, error) { 146 | if err := startDefaultServer(); err != nil { 147 | return nil, err 148 | } 149 | c, err := Dial("tcp", fmt.Sprintf(":%d", *serverBasePort), DialReadTimeout(1*time.Second), DialWriteTimeout(1*time.Second)) 150 | if err != nil { 151 | return nil, err 152 | } 153 | c.Do("FLUSHDB") 154 | return c, nil 155 | } 156 | 157 | func TestMain(m *testing.M) { 158 | os.Exit(func() int { 159 | flag.Parse() 160 | 161 | var f *os.File 162 | if *serverLogName != "" { 163 | var err error 164 | f, err = os.OpenFile(*serverLogName, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0600) 165 | if err != nil { 166 | fmt.Fprintf(os.Stderr, "Error opening redis-log: %v\n", err) 167 | return 1 168 | } 169 | defer f.Close() 170 | serverLog = f 171 | } 172 | 173 | defer stopDefaultServer() 174 | 175 | return m.Run() 176 | }()) 177 | } 178 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redis/zpop_example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis_test 16 | 17 | import ( 18 | "fmt" 19 | "github.com/garyburd/redigo/redis" 20 | ) 21 | 22 | // zpop pops a value from the ZSET key using WATCH/MULTI/EXEC commands. 23 | func zpop(c redis.Conn, key string) (result string, err error) { 24 | 25 | defer func() { 26 | // Return connection to normal state on error. 27 | if err != nil { 28 | c.Do("DISCARD") 29 | } 30 | }() 31 | 32 | // Loop until transaction is successful. 33 | for { 34 | if _, err := c.Do("WATCH", key); err != nil { 35 | return "", err 36 | } 37 | 38 | members, err := redis.Strings(c.Do("ZRANGE", key, 0, 0)) 39 | if err != nil { 40 | return "", err 41 | } 42 | if len(members) != 1 { 43 | return "", redis.ErrNil 44 | } 45 | 46 | c.Send("MULTI") 47 | c.Send("ZREM", key, members[0]) 48 | queued, err := c.Do("EXEC") 49 | if err != nil { 50 | return "", err 51 | } 52 | 53 | if queued != nil { 54 | result = members[0] 55 | break 56 | } 57 | } 58 | 59 | return result, nil 60 | } 61 | 62 | // zpopScript pops a value from a ZSET. 63 | var zpopScript = redis.NewScript(1, ` 64 | local r = redis.call('ZRANGE', KEYS[1], 0, 0) 65 | if r ~= nil then 66 | r = r[1] 67 | redis.call('ZREM', KEYS[1], r) 68 | end 69 | return r 70 | `) 71 | 72 | // This example implements ZPOP as described at 73 | // http://redis.io/topics/transactions using WATCH/MULTI/EXEC and scripting. 74 | func Example_zpop() { 75 | c, err := dial() 76 | if err != nil { 77 | fmt.Println(err) 78 | return 79 | } 80 | defer c.Close() 81 | 82 | // Add test data using a pipeline. 83 | 84 | for i, member := range []string{"red", "blue", "green"} { 85 | c.Send("ZADD", "zset", i, member) 86 | } 87 | if _, err := c.Do(""); err != nil { 88 | fmt.Println(err) 89 | return 90 | } 91 | 92 | // Pop using WATCH/MULTI/EXEC 93 | 94 | v, err := zpop(c, "zset") 95 | if err != nil { 96 | fmt.Println(err) 97 | return 98 | } 99 | fmt.Println(v) 100 | 101 | // Pop using a script. 102 | 103 | v, err = redis.String(zpopScript.Do(c, "zset")) 104 | if err != nil { 105 | fmt.Println(err) 106 | return 107 | } 108 | fmt.Println(v) 109 | 110 | // Output: 111 | // red 112 | // blue 113 | } 114 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redisx/connmux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redisx 16 | 17 | import ( 18 | "errors" 19 | "sync" 20 | 21 | "github.com/garyburd/redigo/internal" 22 | "github.com/garyburd/redigo/redis" 23 | ) 24 | 25 | // ConnMux multiplexes one or more connections to a single underlying 26 | // connection. The ConnMux connections do not support concurrency, commands 27 | // that associate server side state with the connection or commands that put 28 | // the connection in a special mode. 29 | type ConnMux struct { 30 | c redis.Conn 31 | 32 | sendMu sync.Mutex 33 | sendID uint 34 | 35 | recvMu sync.Mutex 36 | recvID uint 37 | recvWait map[uint]chan struct{} 38 | } 39 | 40 | func NewConnMux(c redis.Conn) *ConnMux { 41 | return &ConnMux{c: c, recvWait: make(map[uint]chan struct{})} 42 | } 43 | 44 | // Get gets a connection. The application must close the returned connection. 45 | func (p *ConnMux) Get() redis.Conn { 46 | c := &muxConn{p: p} 47 | c.ids = c.buf[:0] 48 | return c 49 | } 50 | 51 | // Close closes the underlying connection. 52 | func (p *ConnMux) Close() error { 53 | return p.c.Close() 54 | } 55 | 56 | type muxConn struct { 57 | p *ConnMux 58 | ids []uint 59 | buf [8]uint 60 | } 61 | 62 | func (c *muxConn) send(flush bool, cmd string, args ...interface{}) error { 63 | if internal.LookupCommandInfo(cmd).Set != 0 { 64 | return errors.New("command not supported by mux pool") 65 | } 66 | p := c.p 67 | p.sendMu.Lock() 68 | id := p.sendID 69 | c.ids = append(c.ids, id) 70 | p.sendID++ 71 | err := p.c.Send(cmd, args...) 72 | if flush { 73 | err = p.c.Flush() 74 | } 75 | p.sendMu.Unlock() 76 | return err 77 | } 78 | 79 | func (c *muxConn) Send(cmd string, args ...interface{}) error { 80 | return c.send(false, cmd, args...) 81 | } 82 | 83 | func (c *muxConn) Flush() error { 84 | p := c.p 85 | p.sendMu.Lock() 86 | err := p.c.Flush() 87 | p.sendMu.Unlock() 88 | return err 89 | } 90 | 91 | func (c *muxConn) Receive() (interface{}, error) { 92 | if len(c.ids) == 0 { 93 | return nil, errors.New("mux pool underflow") 94 | } 95 | 96 | id := c.ids[0] 97 | c.ids = c.ids[1:] 98 | if len(c.ids) == 0 { 99 | c.ids = c.buf[:0] 100 | } 101 | 102 | p := c.p 103 | p.recvMu.Lock() 104 | if p.recvID != id { 105 | ch := make(chan struct{}) 106 | p.recvWait[id] = ch 107 | p.recvMu.Unlock() 108 | <-ch 109 | p.recvMu.Lock() 110 | if p.recvID != id { 111 | panic("out of sync") 112 | } 113 | } 114 | 115 | v, err := p.c.Receive() 116 | 117 | id++ 118 | p.recvID = id 119 | ch, ok := p.recvWait[id] 120 | if ok { 121 | delete(p.recvWait, id) 122 | } 123 | p.recvMu.Unlock() 124 | if ok { 125 | ch <- struct{}{} 126 | } 127 | 128 | return v, err 129 | } 130 | 131 | func (c *muxConn) Close() error { 132 | var err error 133 | if len(c.ids) == 0 { 134 | return nil 135 | } 136 | c.Flush() 137 | for _ = range c.ids { 138 | _, err = c.Receive() 139 | } 140 | return err 141 | } 142 | 143 | func (c *muxConn) Do(cmd string, args ...interface{}) (interface{}, error) { 144 | if err := c.send(true, cmd, args...); err != nil { 145 | return nil, err 146 | } 147 | return c.Receive() 148 | } 149 | 150 | func (c *muxConn) Err() error { 151 | return c.p.c.Err() 152 | } 153 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redisx/connmux_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redisx_test 16 | 17 | import ( 18 | "net/textproto" 19 | "sync" 20 | "testing" 21 | 22 | "github.com/garyburd/redigo/internal/redistest" 23 | "github.com/garyburd/redigo/redis" 24 | "github.com/garyburd/redigo/redisx" 25 | ) 26 | 27 | func TestConnMux(t *testing.T) { 28 | c, err := redistest.Dial() 29 | if err != nil { 30 | t.Fatalf("error connection to database, %v", err) 31 | } 32 | m := redisx.NewConnMux(c) 33 | defer m.Close() 34 | 35 | c1 := m.Get() 36 | c2 := m.Get() 37 | c1.Send("ECHO", "hello") 38 | c2.Send("ECHO", "world") 39 | c1.Flush() 40 | c2.Flush() 41 | s, err := redis.String(c1.Receive()) 42 | if err != nil { 43 | t.Fatal(err) 44 | } 45 | if s != "hello" { 46 | t.Fatalf("echo returned %q, want %q", s, "hello") 47 | } 48 | s, err = redis.String(c2.Receive()) 49 | if err != nil { 50 | t.Fatal(err) 51 | } 52 | if s != "world" { 53 | t.Fatalf("echo returned %q, want %q", s, "world") 54 | } 55 | c1.Close() 56 | c2.Close() 57 | } 58 | 59 | func TestConnMuxClose(t *testing.T) { 60 | c, err := redistest.Dial() 61 | if err != nil { 62 | t.Fatalf("error connection to database, %v", err) 63 | } 64 | m := redisx.NewConnMux(c) 65 | defer m.Close() 66 | 67 | c1 := m.Get() 68 | c2 := m.Get() 69 | 70 | if err := c1.Send("ECHO", "hello"); err != nil { 71 | t.Fatal(err) 72 | } 73 | if err := c1.Close(); err != nil { 74 | t.Fatal(err) 75 | } 76 | 77 | if err := c2.Send("ECHO", "world"); err != nil { 78 | t.Fatal(err) 79 | } 80 | if err := c2.Flush(); err != nil { 81 | t.Fatal(err) 82 | } 83 | 84 | s, err := redis.String(c2.Receive()) 85 | if err != nil { 86 | t.Fatal(err) 87 | } 88 | if s != "world" { 89 | t.Fatalf("echo returned %q, want %q", s, "world") 90 | } 91 | c2.Close() 92 | } 93 | 94 | func BenchmarkConn(b *testing.B) { 95 | b.StopTimer() 96 | c, err := redistest.Dial() 97 | if err != nil { 98 | b.Fatalf("error connection to database, %v", err) 99 | } 100 | defer c.Close() 101 | b.StartTimer() 102 | 103 | for i := 0; i < b.N; i++ { 104 | if _, err := c.Do("PING"); err != nil { 105 | b.Fatal(err) 106 | } 107 | } 108 | } 109 | 110 | func BenchmarkConnMux(b *testing.B) { 111 | b.StopTimer() 112 | c, err := redistest.Dial() 113 | if err != nil { 114 | b.Fatalf("error connection to database, %v", err) 115 | } 116 | m := redisx.NewConnMux(c) 117 | defer m.Close() 118 | 119 | b.StartTimer() 120 | 121 | for i := 0; i < b.N; i++ { 122 | c := m.Get() 123 | if _, err := c.Do("PING"); err != nil { 124 | b.Fatal(err) 125 | } 126 | c.Close() 127 | } 128 | } 129 | 130 | func BenchmarkPool(b *testing.B) { 131 | b.StopTimer() 132 | 133 | p := redis.Pool{Dial: redistest.Dial, MaxIdle: 1} 134 | defer p.Close() 135 | 136 | // Fill the pool. 137 | c := p.Get() 138 | if err := c.Err(); err != nil { 139 | b.Fatal(err) 140 | } 141 | c.Close() 142 | 143 | b.StartTimer() 144 | 145 | for i := 0; i < b.N; i++ { 146 | c := p.Get() 147 | if _, err := c.Do("PING"); err != nil { 148 | b.Fatal(err) 149 | } 150 | c.Close() 151 | } 152 | } 153 | 154 | const numConcurrent = 10 155 | 156 | func BenchmarkConnMuxConcurrent(b *testing.B) { 157 | b.StopTimer() 158 | c, err := redistest.Dial() 159 | if err != nil { 160 | b.Fatalf("error connection to database, %v", err) 161 | } 162 | defer c.Close() 163 | 164 | m := redisx.NewConnMux(c) 165 | 166 | var wg sync.WaitGroup 167 | wg.Add(numConcurrent) 168 | 169 | b.StartTimer() 170 | 171 | for i := 0; i < numConcurrent; i++ { 172 | go func() { 173 | defer wg.Done() 174 | for i := 0; i < b.N; i++ { 175 | c := m.Get() 176 | if _, err := c.Do("PING"); err != nil { 177 | b.Fatal(err) 178 | } 179 | c.Close() 180 | } 181 | }() 182 | } 183 | wg.Wait() 184 | } 185 | 186 | func BenchmarkPoolConcurrent(b *testing.B) { 187 | b.StopTimer() 188 | 189 | p := redis.Pool{Dial: redistest.Dial, MaxIdle: numConcurrent} 190 | defer p.Close() 191 | 192 | // Fill the pool. 193 | conns := make([]redis.Conn, numConcurrent) 194 | for i := range conns { 195 | c := p.Get() 196 | if err := c.Err(); err != nil { 197 | b.Fatal(err) 198 | } 199 | conns[i] = c 200 | } 201 | for _, c := range conns { 202 | c.Close() 203 | } 204 | 205 | var wg sync.WaitGroup 206 | wg.Add(numConcurrent) 207 | 208 | b.StartTimer() 209 | 210 | for i := 0; i < numConcurrent; i++ { 211 | go func() { 212 | defer wg.Done() 213 | for i := 0; i < b.N; i++ { 214 | c := p.Get() 215 | if _, err := c.Do("PING"); err != nil { 216 | b.Fatal(err) 217 | } 218 | c.Close() 219 | } 220 | }() 221 | } 222 | wg.Wait() 223 | } 224 | 225 | func BenchmarkPipelineConcurrency(b *testing.B) { 226 | b.StopTimer() 227 | c, err := redistest.Dial() 228 | if err != nil { 229 | b.Fatalf("error connection to database, %v", err) 230 | } 231 | defer c.Close() 232 | 233 | var wg sync.WaitGroup 234 | wg.Add(numConcurrent) 235 | 236 | var pipeline textproto.Pipeline 237 | 238 | b.StartTimer() 239 | 240 | for i := 0; i < numConcurrent; i++ { 241 | go func() { 242 | defer wg.Done() 243 | for i := 0; i < b.N; i++ { 244 | id := pipeline.Next() 245 | pipeline.StartRequest(id) 246 | c.Send("PING") 247 | c.Flush() 248 | pipeline.EndRequest(id) 249 | pipeline.StartResponse(id) 250 | _, err := c.Receive() 251 | if err != nil { 252 | b.Fatal(err) 253 | } 254 | pipeline.EndResponse(id) 255 | } 256 | }() 257 | } 258 | wg.Wait() 259 | } 260 | -------------------------------------------------------------------------------- /vendor/github.com/garyburd/redigo/redisx/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Package redisx contains experimental features for Redigo. Features in this 16 | // package may be modified or deleted at any time. 17 | package redisx // import "github.com/garyburd/redigo/redisx" 18 | -------------------------------------------------------------------------------- /vendor/github.com/imroc/log/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 roc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/imroc/log/README.md: -------------------------------------------------------------------------------- 1 | log 2 | ============== 3 | log is a logging framework of Go. see [API](https://godoc.org/github.com/imroc/log). 4 | 5 | ## Features 6 | * light weight 7 | * easy to use 8 | * level logging support 9 | * flexible 10 | 11 | ## Quick Start 12 | 13 | ##### Installation 14 | ``` sh 15 | go get github.com/imroc/log 16 | ``` 17 | ##### Simple Usage 18 | ``` go 19 | import ( 20 | "github.com/imroc/log" 21 | ) 22 | 23 | func main() { 24 | // DEBUG < INFO < WARN < ERROR < FATAL 25 | log.SetLevel(log.WARN) // level DEBUG and INFO will not output 26 | log.Debug("%s message", "debug") 27 | log.Info("%s message", "info") 28 | log.Warn("%s message", "warn") 29 | log.Error("%s message", "error") 30 | log.Fatal("%s message", "fatal") 31 | } 32 | ``` 33 | output: 34 | ``` 35 | 2016/10/04 14:38:38 [WARN] warn message 36 | 2016/10/04 14:38:38 [EROR] error message 37 | 2016/10/04 14:38:38 [FATL] fatal message 38 | ``` 39 | ##### More Control 40 | ``` go 41 | file, _ := os.OpenFile("test.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) 42 | log.Set(log.INFO, file, log.Llongfile|log.LstdFlags) 43 | log.Debug("%s message", "debug") 44 | log.Info("%s message", "info") 45 | log.Warn("%s message", "warn") 46 | log.Error("%s message", "error") 47 | log.Fatal("%s message", "fatal") 48 | ``` 49 | output to test.log: 50 | ``` 51 | 2016/10/04 15:04:00 [INFO] /home/cpwl/go/dev/src/test/test.go:13: info message 52 | 2016/10/04 15:04:00 [WARN] /home/cpwl/go/dev/src/test/test.go:14: warn message 53 | 2016/10/04 15:04:00 [EROR] /home/cpwl/go/dev/src/test/test.go:15: error message 54 | 2016/10/04 15:04:00 [FATL] /home/cpwl/go/dev/src/test/test.go:16: fatal message 55 | ``` 56 | ## LICENSE 57 | log is is distributed under the terms of the MIT License. 58 | -------------------------------------------------------------------------------- /xf/README.md: -------------------------------------------------------------------------------- 1 | xf 2 | ============== 3 | xf 是科大讯飞语音离线合成SDK的go封装. 4 | 5 | ##注意 6 | 使用该包的程序依赖 lib/libmsc.so 动态链接库文件,将其放入某路径并指定环境变量 LD_LIBRARY_PATH ,如:export LD_LIBRARY_PATH = /usr/local/lib 7 | 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/arrowdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/arrowdown.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/arrowright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/arrowright.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/bc_s.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/bdwn.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/closed.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/dir_25539194184bab781b1c7ecd67774cd8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MSC for Windows&Linux API: iFlytek MSC Reference Manual/search 目录参考 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 29 | 30 | 31 |
26 |
MSC for Windows&Linux API 27 |
28 |
32 |
33 | 34 | 35 | 38 | 60 | 61 |
65 |
66 | 67 | 68 |
69 | 72 |
73 | 74 | 78 |
79 |
80 |
81 |
search 目录参考
82 |
83 |
84 | 85 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |

86 | 文件

文件  all_0.js
 
文件  all_1.js
 
文件  files_0.js
 
文件  files_1.js
 
文件  functions_0.js
 
文件  functions_1.js
 
文件  search.js
 
文件  searchdata.js
 
104 |
105 | 106 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/dir_9a65024ac0a05d9abfc2bb6c7ff8f818.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MSC for Windows&Linux API: iFlytek MSC Reference Manual 目录参考 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 29 | 30 | 31 |
26 |
MSC for Windows&Linux API 27 |
28 |
32 |
33 | 34 | 35 | 38 | 60 | 61 |
65 |
66 | 67 | 68 |
69 | 72 |
73 | 74 | 78 |
79 |
80 |
81 |
iFlytek MSC Reference Manual 目录参考
82 |
83 |
84 | 85 | 87 | 88 | 89 |

86 | 目录

目录  search
 
90 | 92 | 93 | 94 | 95 | 96 |

91 | 文件

文件  dynsections.js
 
文件  jquery.js
 
97 |
98 | 99 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/doc.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/doxygen.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/dynsections.js: -------------------------------------------------------------------------------- 1 | function toggleVisibility(linkObj) 2 | { 3 | var base = $(linkObj).attr('id'); 4 | var summary = $('#'+base+'-summary'); 5 | var content = $('#'+base+'-content'); 6 | var trigger = $('#'+base+'-trigger'); 7 | var src=$(trigger).attr('src'); 8 | if (content.is(':visible')===true) { 9 | content.hide(); 10 | summary.show(); 11 | $(linkObj).addClass('closed').removeClass('opened'); 12 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 13 | } else { 14 | content.show(); 15 | summary.hide(); 16 | $(linkObj).removeClass('closed').addClass('opened'); 17 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 18 | } 19 | return false; 20 | } 21 | 22 | function updateStripes() 23 | { 24 | $('table.directory tr'). 25 | removeClass('even').filter(':visible:even').addClass('even'); 26 | } 27 | 28 | function toggleLevel(level) 29 | { 30 | $('table.directory tr').each(function() { 31 | var l = this.id.split('_').length-1; 32 | var i = $('#img'+this.id.substring(3)); 33 | var a = $('#arr'+this.id.substring(3)); 34 | if (l 2 | 3 | 4 | 5 | 6 | 7 | MSC for Windows&Linux API: iFlytek MSC Reference Manual/search/files_0.js 文件参考 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 29 | 30 | 31 |
26 |
MSC for Windows&Linux API 27 |
28 |
32 |
33 | 34 | 35 | 38 | 60 | 66 | 67 |
71 |
72 | 73 | 74 |
75 | 78 |
79 | 80 | 84 |
85 |
86 |
87 | 变量
88 |
89 |
files_0.js 文件参考
90 |
91 |
92 | 93 | 95 | 96 | 97 |

94 | 变量

var searchData
 
98 |

变量说明

99 | 100 |
101 |
102 | 103 | 104 | 105 | 106 |
var searchData
107 |
108 | 初始值:
=
109 |
[
110 |
['msp_5fcmn_2eh',['msp_cmn.h',['../msp__cmn_8h.html',1,'']]]
111 |
]
112 |
113 |
114 |
115 |
116 | 117 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/files__1_8js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MSC for Windows&Linux API: iFlytek MSC Reference Manual/search/files_1.js 文件参考 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 29 | 30 | 31 |
26 |
MSC for Windows&Linux API 27 |
28 |
32 |
33 | 34 | 35 | 38 | 60 | 66 | 67 |
71 |
72 | 73 | 74 |
75 | 78 |
79 | 80 | 84 |
85 |
86 |
87 | 变量
88 |
89 |
files_1.js 文件参考
90 |
91 |
92 | 93 | 95 | 96 | 97 |

94 | 变量

var searchData
 
98 |

变量说明

99 | 100 |
101 |
102 | 103 | 104 | 105 | 106 |
var searchData
107 |
108 | 初始值:
=
109 |
[
110 |
['qisr_2eh',['qisr.h',['../qisr_8h.html',1,'']]],
111 |
['qmfv_2eh',['qmfv.h',['../qmfv_8h.html',1,'']]],
112 |
['qtts_2eh',['qtts.h',['../qtts_8h.html',1,'']]]
113 |
]
114 |
115 |
116 |
117 |
118 | 119 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/folderclosed.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/folderopen.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MSC for Windows&Linux API: 文件成员 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 29 | 30 | 31 |
26 |
MSC for Windows&Linux API 27 |
28 |
32 |
33 | 34 | 35 | 38 | 60 | 66 | 73 |
74 | 75 |
79 |
80 | 81 | 82 |
83 | 86 |
87 | 88 |
89 |   156 |
157 | 158 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MSC for Windows&Linux API: 首页 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 29 | 30 | 31 |
26 |
MSC for Windows&Linux API 27 |
28 |
32 |
33 | 34 | 35 | 38 | 60 |
61 | 62 |
66 |
67 | 68 | 69 |
70 | 73 |
74 | 75 |
76 |
77 |
MSC for Windows&Linux API 文档
78 |
79 |
80 |
81 | 82 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/nav_f.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/nav_g.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/nav_h.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/open.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ad',['aD',['../jquery_8js.html#ad223f5fba68c41c1236671ac5c5b0fcb',1,'jquery.js']]], 4 | ['all_5f0_2ejs',['all_0.js',['../all__0_8js.html',1,'']]], 5 | ['all_5f1_2ejs',['all_1.js',['../all__1_8js.html',1,'']]], 6 | ['am',['aM',['../jquery_8js.html#a8cc6111a5def3ea889157d13fb9a9672',1,'jquery.js']]], 7 | ['ap',['ap',['../jquery_8js.html#a6ddf393cc7f9a8828e197bb0d9916c44',1,'jquery.js']]], 8 | ['aq',['aQ',['../jquery_8js.html#a79eb58dc6cdf0aef563d5dc1ded27df5',1,'jquery.js']]], 9 | ['au',['au',['../jquery_8js.html#a4fd8ddfab07c8d7c7cae0ab0e052cad3',1,'jquery.js']]], 10 | ['az',['aZ',['../jquery_8js.html#ac87125cdee1a5e57da4ef619af49bc7d',1,'jquery.js']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['b',['b',['../jquery_8js.html#aa4026ad5544b958e54ce5e106fa1c805',1,'b(): jquery.js'],['../jquery_8js.html#a2fa551895933fae935a0a6b87282241d',1,'b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw, bv){var e;b.swap(bw,{display:"inline-block"}, function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}}): jquery.js']]], 4 | ['bb',['bb',['../jquery_8js.html#a1d6558865876e1c8cca029fce41a4bdb',1,'jquery.js']]], 5 | ['bq',['bq',['../jquery_8js.html#af6ee77c71b2c89bdb365145ac5ad1219',1,'jquery.js']]], 6 | ['bs',['bs',['../jquery_8js.html#ae77642f8ef73fb9c20c2a737d956acda',1,'jquery.js']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_10.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['updatestripes',['updateStripes',['../dynsections_8js.html#a8f7493ad859d4fbf2523917511ee7177',1,'dynsections.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_11.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['z',['Z',['../jquery_8js.html#adc18d83abfd9f87d396e8fd6b6ac0fe1',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['c',['c',['../jquery_8js.html#abce695e0af988ece0826d9ad59b8160d',1,'jquery.js']]], 4 | ['converttoid',['convertToId',['../search_8js.html#a196a29bd5a5ee7cd5b485e0753a49e57',1,'search.js']]], 5 | ['createresults',['createResults',['../search_8js.html#a6b2c651120de3ed1dcf0d85341d51895',1,'search.js']]], 6 | ['css',['css',['../jquery_8js.html#a89ad527fcd82c01ebb587332f5b4fcd4',1,'jquery.js']]], 7 | ['curcss',['curCSS',['../jquery_8js.html#a88b21f8ba3af86d6981b1da520ece33b',1,'jquery.js']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dynsections_2ejs',['dynsections.js',['../dynsections_8js.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['each',['each',['../jquery_8js.html#a871ff39db627c54c710a3e9909b8234c',1,'jquery.js']]], 4 | ['extend',['extend',['../jquery_8js.html#a5fb206c91c64d1be35fde236706eab86',1,'jquery.js']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['files_5f0_2ejs',['files_0.js',['../files__0_8js.html',1,'']]], 4 | ['files_5f1_2ejs',['files_1.js',['../files__1_8js.html',1,'']]], 5 | ['functions_5f0_2ejs',['functions_0.js',['../functions__0_8js.html',1,'']]], 6 | ['functions_5f1_2ejs',['functions_1.js',['../functions__1_8js.html',1,'']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getxpos',['getXPos',['../search_8js.html#a76d24aea0009f892f8ccc31d941c0a2b',1,'search.js']]], 4 | ['getypos',['getYPos',['../search_8js.html#a8d7b405228661d7b6216b6925d2b8a69',1,'search.js']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['if',['if',['../jquery_8js.html#a9db6d45a025ad692282fe23e69eeba43',1,'if(!b.support.opacity): jquery.js'],['../jquery_8js.html#a30d3d2cd5b567c9f31b2aa30b9cb3bb8',1,'if(av.defaultView &&av.defaultView.getComputedStyle): jquery.js'],['../jquery_8js.html#a2c54bd8ed7482e89d19331ba61fe221c',1,'if(av.documentElement.currentStyle): jquery.js'],['../jquery_8js.html#a42cbfadee2b4749e8f699ea8d745a0e4',1,'if(b.expr &&b.expr.filters): jquery.js']]], 4 | ['indexsectionlabels',['indexSectionLabels',['../searchdata_8js.html#a529972e449c82dc118cbbd3bcf50c44d',1,'searchdata.js']]], 5 | ['indexsectionnames',['indexSectionNames',['../searchdata_8js.html#a77149ceed055c6c6ce40973b5bdc19ad',1,'searchdata.js']]], 6 | ['indexsectionswithcontent',['indexSectionsWithContent',['../searchdata_8js.html#a6250af3c9b54dee6efc5f55f40c78126',1,'searchdata.js']]], 7 | ['init_5fsearch',['init_search',['../search_8js.html#ae95ec7d5d450d0a8d6928a594798aaf4',1,'search.js']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['jquery_2ejs',['jquery.js',['../jquery_8js.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['k',['k',['../jquery_8js.html#ab26645c014aa005ecedef329ecf58c99',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['l',['L',['../jquery_8js.html#a38ee4c0b5f4fe2a18d0c783af540d253',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['msp_5fcmn_2eh',['msp_cmn.h',['../msp__cmn_8h.html',1,'']]], 4 | ['mspgetparam',['MSPGetParam',['../msp__cmn_8h.html#a4d3fa0aad5e761cb2a2afe30ae2a9714',1,'msp_cmn.h']]], 5 | ['mspgetversion',['MSPGetVersion',['../msp__cmn_8h.html#a632008aeddf5eba09555920ce38686a4',1,'msp_cmn.h']]], 6 | ['msplogin',['MSPLogin',['../msp__cmn_8h.html#a137acfe684fe46cbe5baf19f7d4a7fcc',1,'msp_cmn.h']]], 7 | ['msplogout',['MSPLogout',['../msp__cmn_8h.html#a1e0f72cd113b4578afdf3d16ab34463e',1,'msp_cmn.h']]], 8 | ['mspsearch',['MSPSearch',['../msp__cmn_8h.html#ae7be2dd2c6ee318524621b952998c14d',1,'msp_cmn.h']]], 9 | ['mspuploaddata',['MSPUploadData',['../msp__cmn_8h.html#ada276fa6db4a66342d951820020e4e8f',1,'msp_cmn.h']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_c.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['p',['p',['../jquery_8js.html#a2335e57f79b6acfb6de59c235dc8a83e',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_d.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['qisr_2eh',['qisr.h',['../qisr_8h.html',1,'']]], 4 | ['qisraudiowrite',['QISRAudioWrite',['../qisr_8h.html#a47fd2588fe834fa2d51fef1961d7aef4',1,'qisr.h']]], 5 | ['qisrgetparam',['QISRGetParam',['../qisr_8h.html#a2081e3cad9a8155c15790a2476be7044',1,'qisr.h']]], 6 | ['qisrgetresult',['QISRGetResult',['../qisr_8h.html#a2e7880db4792266a4d1439238c0b2c1b',1,'qisr.h']]], 7 | ['qisrsessionbegin',['QISRSessionBegin',['../qisr_8h.html#aaec4a5779275e07c4f7405ed8d739416',1,'qisr.h']]], 8 | ['qisrsessionend',['QISRSessionEnd',['../qisr_8h.html#ab50c4114e032100c4093ddd51329fecc',1,'qisr.h']]], 9 | ['qmfv_2eh',['qmfv.h',['../qmfv_8h.html',1,'']]], 10 | ['qmfvdatawrite',['QMFVDataWrite',['../qmfv_8h.html#a081a01b2add2dfac3010ec7cd8ba5eac',1,'qmfv.h']]], 11 | ['qmfvgetparam',['QMFVGetParam',['../qmfv_8h.html#a7174d943c2f1691f6a8c717429d43f8d',1,'qmfv.h']]], 12 | ['qmfvgetresult',['QMFVGetResult',['../qmfv_8h.html#aa87716ad6b28326982626c0c6a6ffcbd',1,'qmfv.h']]], 13 | ['qmfvsessionbegin',['QMFVSessionBegin',['../qmfv_8h.html#adbe23b402d4c50b4c06f47ca26253be5',1,'qmfv.h']]], 14 | ['qmfvsessionend',['QMFVSessionEnd',['../qmfv_8h.html#ad4ea72dd39285348cf26c627d67c6b65',1,'qmfv.h']]], 15 | ['qtts_2eh',['qtts.h',['../qtts_8h.html',1,'']]], 16 | ['qttsaudioget',['QTTSAudioGet',['../qtts_8h.html#a4e4f6bed4b9e4ea553aa00ccf539c22a',1,'qtts.h']]], 17 | ['qttsgetparam',['QTTSGetParam',['../qtts_8h.html#a0812612ff738a828490e4e3db59767e8',1,'qtts.h']]], 18 | ['qttssessionbegin',['QTTSSessionBegin',['../qtts_8h.html#a3fba4ad9599445073335851cc9479542',1,'qtts.h']]], 19 | ['qttssessionend',['QTTSSessionEnd',['../qtts_8h.html#a75d5047a2a889dbd890d116a6d0b550a',1,'qtts.h']]], 20 | ['qttstextput',['QTTSTextPut',['../qtts_8h.html#a5b7d146d6a35341d4d73efd720ae987b',1,'qtts.h']]] 21 | ]; 22 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_e.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['search_2ejs',['search.js',['../search_8js.html',1,'']]], 4 | ['searchbox',['SearchBox',['../search_8js.html#a52066106482f8136aa9e0ec859e8188f',1,'search.js']]], 5 | ['searchdata',['searchData',['../all__0_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): all_0.js'],['../all__1_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): all_1.js'],['../files__0_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): files_0.js'],['../files__1_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): files_1.js'],['../functions__0_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): functions_0.js'],['../functions__1_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): functions_1.js']]], 6 | ['searchdata_2ejs',['searchdata.js',['../searchdata_8js.html',1,'']]], 7 | ['searchresults',['SearchResults',['../search_8js.html#a9189b9f7a32b6bc78240f40348f7fe03',1,'search.js']]], 8 | ['setclassattr',['setClassAttr',['../search_8js.html#a499422fc054a5278ae32801ec0082c56',1,'search.js']]], 9 | ['setkeyactions',['setKeyActions',['../search_8js.html#a98192fa2929bb8e4b0a890a4909ab9b2',1,'search.js']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_f.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/all_f.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['togglefolder',['toggleFolder',['../dynsections_8js.html#af244da4527af2d845dca04f5656376cd',1,'dynsections.js']]], 4 | ['toggleinherit',['toggleInherit',['../dynsections_8js.html#ac057b640b17ff32af11ced151c9305b4',1,'dynsections.js']]], 5 | ['togglelevel',['toggleLevel',['../dynsections_8js.html#a19f577cc1ba571396a85bb1f48bf4df2',1,'dynsections.js']]], 6 | ['togglevisibility',['toggleVisibility',['../dynsections_8js.html#a1922c462474df7dfd18741c961d59a25',1,'dynsections.js']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/search/close.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['all_5f0_2ejs',['all_0.js',['../all__0_8js.html',1,'']]], 4 | ['all_5f1_2ejs',['all_1.js',['../all__1_8js.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dynsections_2ejs',['dynsections.js',['../dynsections_8js.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['files_5f0_2ejs',['files_0.js',['../files__0_8js.html',1,'']]], 4 | ['files_5f1_2ejs',['files_1.js',['../files__1_8js.html',1,'']]], 5 | ['functions_5f0_2ejs',['functions_0.js',['../functions__0_8js.html',1,'']]], 6 | ['functions_5f1_2ejs',['functions_1.js',['../functions__1_8js.html',1,'']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['jquery_2ejs',['jquery.js',['../jquery_8js.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['msp_5fcmn_2eh',['msp_cmn.h',['../msp__cmn_8h.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['qisr_2eh',['qisr.h',['../qisr_8h.html',1,'']]], 4 | ['qmfv_2eh',['qmfv.h',['../qmfv_8h.html',1,'']]], 5 | ['qtts_2eh',['qtts.h',['../qtts_8h.html',1,'']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/files_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['search_2ejs',['search.js',['../search_8js.html',1,'']]], 4 | ['searchdata_2ejs',['searchdata.js',['../searchdata_8js.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['b',['b',['../jquery_8js.html#a2fa551895933fae935a0a6b87282241d',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['converttoid',['convertToId',['../search_8js.html#a196a29bd5a5ee7cd5b485e0753a49e57',1,'search.js']]], 4 | ['createresults',['createResults',['../search_8js.html#a6b2c651120de3ed1dcf0d85341d51895',1,'search.js']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['each',['each',['../jquery_8js.html#a871ff39db627c54c710a3e9909b8234c',1,'jquery.js']]], 4 | ['extend',['extend',['../jquery_8js.html#a5fb206c91c64d1be35fde236706eab86',1,'jquery.js']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getxpos',['getXPos',['../search_8js.html#a76d24aea0009f892f8ccc31d941c0a2b',1,'search.js']]], 4 | ['getypos',['getYPos',['../search_8js.html#a8d7b405228661d7b6216b6925d2b8a69',1,'search.js']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['if',['if',['../jquery_8js.html#a9db6d45a025ad692282fe23e69eeba43',1,'if(!b.support.opacity): jquery.js'],['../jquery_8js.html#a30d3d2cd5b567c9f31b2aa30b9cb3bb8',1,'if(av.defaultView &&av.defaultView.getComputedStyle): jquery.js'],['../jquery_8js.html#a2c54bd8ed7482e89d19331ba61fe221c',1,'if(av.documentElement.currentStyle): jquery.js'],['../jquery_8js.html#a42cbfadee2b4749e8f699ea8d745a0e4',1,'if(b.expr &&b.expr.filters): jquery.js']]], 4 | ['init_5fsearch',['init_search',['../search_8js.html#ae95ec7d5d450d0a8d6928a594798aaf4',1,'search.js']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['mspgetparam',['MSPGetParam',['../msp__cmn_8h.html#a4d3fa0aad5e761cb2a2afe30ae2a9714',1,'msp_cmn.h']]], 4 | ['mspgetversion',['MSPGetVersion',['../msp__cmn_8h.html#a632008aeddf5eba09555920ce38686a4',1,'msp_cmn.h']]], 5 | ['msplogin',['MSPLogin',['../msp__cmn_8h.html#a137acfe684fe46cbe5baf19f7d4a7fcc',1,'msp_cmn.h']]], 6 | ['msplogout',['MSPLogout',['../msp__cmn_8h.html#a1e0f72cd113b4578afdf3d16ab34463e',1,'msp_cmn.h']]], 7 | ['mspsearch',['MSPSearch',['../msp__cmn_8h.html#ae7be2dd2c6ee318524621b952998c14d',1,'msp_cmn.h']]], 8 | ['mspuploaddata',['MSPUploadData',['../msp__cmn_8h.html#ada276fa6db4a66342d951820020e4e8f',1,'msp_cmn.h']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['p',['p',['../jquery_8js.html#a2335e57f79b6acfb6de59c235dc8a83e',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['qisraudiowrite',['QISRAudioWrite',['../qisr_8h.html#a47fd2588fe834fa2d51fef1961d7aef4',1,'qisr.h']]], 4 | ['qisrgetparam',['QISRGetParam',['../qisr_8h.html#a2081e3cad9a8155c15790a2476be7044',1,'qisr.h']]], 5 | ['qisrgetresult',['QISRGetResult',['../qisr_8h.html#a2e7880db4792266a4d1439238c0b2c1b',1,'qisr.h']]], 6 | ['qisrsessionbegin',['QISRSessionBegin',['../qisr_8h.html#aaec4a5779275e07c4f7405ed8d739416',1,'qisr.h']]], 7 | ['qisrsessionend',['QISRSessionEnd',['../qisr_8h.html#ab50c4114e032100c4093ddd51329fecc',1,'qisr.h']]], 8 | ['qmfvdatawrite',['QMFVDataWrite',['../qmfv_8h.html#a081a01b2add2dfac3010ec7cd8ba5eac',1,'qmfv.h']]], 9 | ['qmfvgetparam',['QMFVGetParam',['../qmfv_8h.html#a7174d943c2f1691f6a8c717429d43f8d',1,'qmfv.h']]], 10 | ['qmfvgetresult',['QMFVGetResult',['../qmfv_8h.html#aa87716ad6b28326982626c0c6a6ffcbd',1,'qmfv.h']]], 11 | ['qmfvsessionbegin',['QMFVSessionBegin',['../qmfv_8h.html#adbe23b402d4c50b4c06f47ca26253be5',1,'qmfv.h']]], 12 | ['qmfvsessionend',['QMFVSessionEnd',['../qmfv_8h.html#ad4ea72dd39285348cf26c627d67c6b65',1,'qmfv.h']]], 13 | ['qttsaudioget',['QTTSAudioGet',['../qtts_8h.html#a4e4f6bed4b9e4ea553aa00ccf539c22a',1,'qtts.h']]], 14 | ['qttsgetparam',['QTTSGetParam',['../qtts_8h.html#a0812612ff738a828490e4e3db59767e8',1,'qtts.h']]], 15 | ['qttssessionbegin',['QTTSSessionBegin',['../qtts_8h.html#a3fba4ad9599445073335851cc9479542',1,'qtts.h']]], 16 | ['qttssessionend',['QTTSSessionEnd',['../qtts_8h.html#a75d5047a2a889dbd890d116a6d0b550a',1,'qtts.h']]], 17 | ['qttstextput',['QTTSTextPut',['../qtts_8h.html#a5b7d146d6a35341d4d73efd720ae987b',1,'qtts.h']]] 18 | ]; 19 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['searchbox',['SearchBox',['../search_8js.html#a52066106482f8136aa9e0ec859e8188f',1,'search.js']]], 4 | ['searchresults',['SearchResults',['../search_8js.html#a9189b9f7a32b6bc78240f40348f7fe03',1,'search.js']]], 5 | ['setclassattr',['setClassAttr',['../search_8js.html#a499422fc054a5278ae32801ec0082c56',1,'search.js']]], 6 | ['setkeyactions',['setKeyActions',['../search_8js.html#a98192fa2929bb8e4b0a890a4909ab9b2',1,'search.js']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['togglefolder',['toggleFolder',['../dynsections_8js.html#af244da4527af2d845dca04f5656376cd',1,'dynsections.js']]], 4 | ['toggleinherit',['toggleInherit',['../dynsections_8js.html#ac057b640b17ff32af11ced151c9305b4',1,'dynsections.js']]], 5 | ['togglelevel',['toggleLevel',['../dynsections_8js.html#a19f577cc1ba571396a85bb1f48bf4df2',1,'dynsections.js']]], 6 | ['togglevisibility',['toggleVisibility',['../dynsections_8js.html#a1922c462474df7dfd18741c961d59a25',1,'dynsections.js']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/functions_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['updatestripes',['updateStripes',['../dynsections_8js.html#a8f7493ad859d4fbf2523917511ee7177',1,'dynsections.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/search/mag_sel.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
未找到
10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box */ 2 | 3 | #FSearchBox { 4 | float: left; 5 | } 6 | 7 | #MSearchBox { 8 | white-space : nowrap; 9 | position: absolute; 10 | float: none; 11 | display: inline; 12 | margin-top: 8px; 13 | right: 0px; 14 | width: 170px; 15 | z-index: 102; 16 | background-color: white; 17 | } 18 | 19 | #MSearchBox .left 20 | { 21 | display:block; 22 | position:absolute; 23 | left:10px; 24 | width:20px; 25 | height:19px; 26 | background:url('search_l.png') no-repeat; 27 | background-position:right; 28 | } 29 | 30 | #MSearchSelect { 31 | display:block; 32 | position:absolute; 33 | width:20px; 34 | height:19px; 35 | } 36 | 37 | .left #MSearchSelect { 38 | left:4px; 39 | } 40 | 41 | .right #MSearchSelect { 42 | right:5px; 43 | } 44 | 45 | #MSearchField { 46 | display:block; 47 | position:absolute; 48 | height:19px; 49 | background:url('search_m.png') repeat-x; 50 | border:none; 51 | width:111px; 52 | margin-left:20px; 53 | padding-left:4px; 54 | color: #909090; 55 | outline: none; 56 | font: 9pt Arial, Verdana, sans-serif; 57 | } 58 | 59 | #FSearchBox #MSearchField { 60 | margin-left:15px; 61 | } 62 | 63 | #MSearchBox .right { 64 | display:block; 65 | position:absolute; 66 | right:10px; 67 | top:0px; 68 | width:20px; 69 | height:19px; 70 | background:url('search_r.png') no-repeat; 71 | background-position:left; 72 | } 73 | 74 | #MSearchClose { 75 | display: none; 76 | position: absolute; 77 | top: 4px; 78 | background : none; 79 | border: none; 80 | margin: 0px 4px 0px 0px; 81 | padding: 0px 0px; 82 | outline: none; 83 | } 84 | 85 | .left #MSearchClose { 86 | left: 6px; 87 | } 88 | 89 | .right #MSearchClose { 90 | right: 2px; 91 | } 92 | 93 | .MSearchBoxActive #MSearchField { 94 | color: #000000; 95 | } 96 | 97 | /*---------------- Search filter selection */ 98 | 99 | #MSearchSelectWindow { 100 | display: none; 101 | position: absolute; 102 | left: 0; top: 0; 103 | border: 1px solid #90A5CE; 104 | background-color: #F9FAFC; 105 | z-index: 1; 106 | padding-top: 4px; 107 | padding-bottom: 4px; 108 | -moz-border-radius: 4px; 109 | -webkit-border-top-left-radius: 4px; 110 | -webkit-border-top-right-radius: 4px; 111 | -webkit-border-bottom-left-radius: 4px; 112 | -webkit-border-bottom-right-radius: 4px; 113 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 114 | } 115 | 116 | .SelectItem { 117 | font: 8pt Arial, Verdana, sans-serif; 118 | padding-left: 2px; 119 | padding-right: 12px; 120 | border: 0px; 121 | } 122 | 123 | span.SelectionMark { 124 | margin-right: 4px; 125 | font-family: monospace; 126 | outline-style: none; 127 | text-decoration: none; 128 | } 129 | 130 | a.SelectItem { 131 | display: block; 132 | outline-style: none; 133 | color: #000000; 134 | text-decoration: none; 135 | padding-left: 6px; 136 | padding-right: 12px; 137 | } 138 | 139 | a.SelectItem:focus, 140 | a.SelectItem:active { 141 | color: #000000; 142 | outline-style: none; 143 | text-decoration: none; 144 | } 145 | 146 | a.SelectItem:hover { 147 | color: #FFFFFF; 148 | background-color: #3D578C; 149 | outline-style: none; 150 | text-decoration: none; 151 | cursor: pointer; 152 | display: block; 153 | } 154 | 155 | /*---------------- Search results window */ 156 | 157 | iframe#MSearchResults { 158 | width: 60ex; 159 | height: 15em; 160 | } 161 | 162 | #MSearchResultsWindow { 163 | display: none; 164 | position: absolute; 165 | left: 0; top: 0; 166 | border: 1px solid #000; 167 | background-color: #EEF1F7; 168 | } 169 | 170 | /* ----------------------------------- */ 171 | 172 | 173 | #SRIndex { 174 | clear:both; 175 | padding-bottom: 15px; 176 | } 177 | 178 | .SREntry { 179 | font-size: 10pt; 180 | padding-left: 1ex; 181 | } 182 | 183 | .SRPage .SREntry { 184 | font-size: 8pt; 185 | padding: 1px 5px; 186 | } 187 | 188 | body.SRPage { 189 | margin: 5px 2px; 190 | } 191 | 192 | .SRChildren { 193 | padding-left: 3ex; padding-bottom: .5em 194 | } 195 | 196 | .SRPage .SRChildren { 197 | display: none; 198 | } 199 | 200 | .SRSymbol { 201 | font-weight: bold; 202 | color: #425E97; 203 | font-family: Arial, Verdana, sans-serif; 204 | text-decoration: none; 205 | outline: none; 206 | } 207 | 208 | a.SRScope { 209 | display: block; 210 | color: #425E97; 211 | font-family: Arial, Verdana, sans-serif; 212 | text-decoration: none; 213 | outline: none; 214 | } 215 | 216 | a.SRSymbol:focus, a.SRSymbol:active, 217 | a.SRScope:focus, a.SRScope:active { 218 | text-decoration: underline; 219 | } 220 | 221 | span.SRScope { 222 | padding-left: 4px; 223 | } 224 | 225 | .SRPage .SRStatus { 226 | padding: 2px 5px; 227 | font-size: 8pt; 228 | font-style: italic; 229 | } 230 | 231 | .SRResult { 232 | display: none; 233 | } 234 | 235 | DIV.searchresults { 236 | margin-left: 10px; 237 | margin-right: 10px; 238 | } 239 | 240 | /*---------------- External search page results */ 241 | 242 | .searchresult { 243 | background-color: #F0F3F8; 244 | } 245 | 246 | .pages b { 247 | color: white; 248 | padding: 5px 5px 3px 5px; 249 | background-image: url("../tab_a.png"); 250 | background-repeat: repeat-x; 251 | text-shadow: 0 1px 1px #000000; 252 | } 253 | 254 | .pages { 255 | line-height: 17px; 256 | margin-left: 4px; 257 | text-decoration: none; 258 | } 259 | 260 | .hl { 261 | font-weight: bold; 262 | } 263 | 264 | #searchresults { 265 | margin-bottom: 20px; 266 | } 267 | 268 | .searchpages { 269 | margin-top: 10px; 270 | } 271 | 272 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/search/search_l.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/search/search_m.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/search/search_r.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "abcdefgijklmpqstuz", 4 | 1: "adfjmqs", 5 | 2: "bcegimpqstu", 6 | 3: "abciklsz" 7 | }; 8 | 9 | var indexSectionNames = 10 | { 11 | 0: "all", 12 | 1: "files", 13 | 2: "functions", 14 | 3: "variables" 15 | }; 16 | 17 | var indexSectionLabels = 18 | { 19 | 0: "全部", 20 | 1: "文件", 21 | 2: "函数", 22 | 3: "变量" 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ad',['aD',['../jquery_8js.html#ad223f5fba68c41c1236671ac5c5b0fcb',1,'jquery.js']]], 4 | ['am',['aM',['../jquery_8js.html#a8cc6111a5def3ea889157d13fb9a9672',1,'jquery.js']]], 5 | ['ap',['ap',['../jquery_8js.html#a6ddf393cc7f9a8828e197bb0d9916c44',1,'jquery.js']]], 6 | ['aq',['aQ',['../jquery_8js.html#a79eb58dc6cdf0aef563d5dc1ded27df5',1,'jquery.js']]], 7 | ['au',['au',['../jquery_8js.html#a4fd8ddfab07c8d7c7cae0ab0e052cad3',1,'jquery.js']]], 8 | ['az',['aZ',['../jquery_8js.html#ac87125cdee1a5e57da4ef619af49bc7d',1,'jquery.js']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['b',['b',['../jquery_8js.html#aa4026ad5544b958e54ce5e106fa1c805',1,'jquery.js']]], 4 | ['bb',['bb',['../jquery_8js.html#a1d6558865876e1c8cca029fce41a4bdb',1,'jquery.js']]], 5 | ['bq',['bq',['../jquery_8js.html#af6ee77c71b2c89bdb365145ac5ad1219',1,'jquery.js']]], 6 | ['bs',['bs',['../jquery_8js.html#ae77642f8ef73fb9c20c2a737d956acda',1,'jquery.js']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['c',['c',['../jquery_8js.html#abce695e0af988ece0826d9ad59b8160d',1,'jquery.js']]], 4 | ['css',['css',['../jquery_8js.html#a89ad527fcd82c01ebb587332f5b4fcd4',1,'jquery.js']]], 5 | ['curcss',['curCSS',['../jquery_8js.html#a88b21f8ba3af86d6981b1da520ece33b',1,'jquery.js']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['indexsectionlabels',['indexSectionLabels',['../searchdata_8js.html#a529972e449c82dc118cbbd3bcf50c44d',1,'searchdata.js']]], 4 | ['indexsectionnames',['indexSectionNames',['../searchdata_8js.html#a77149ceed055c6c6ce40973b5bdc19ad',1,'searchdata.js']]], 5 | ['indexsectionswithcontent',['indexSectionsWithContent',['../searchdata_8js.html#a6250af3c9b54dee6efc5f55f40c78126',1,'searchdata.js']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['k',['k',['../jquery_8js.html#ab26645c014aa005ecedef329ecf58c99',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['l',['L',['../jquery_8js.html#a38ee4c0b5f4fe2a18d0c783af540d253',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['searchdata',['searchData',['../all__0_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): all_0.js'],['../all__1_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): all_1.js'],['../files__0_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): files_0.js'],['../files__1_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): files_1.js'],['../functions__0_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): functions_0.js'],['../functions__1_8js.html#ad01a7523f103d6242ef9b0451861231e',1,'searchData(): functions_1.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/search/variables_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['z',['Z',['../jquery_8js.html#adc18d83abfd9f87d396e8fd6b6ac0fe1',1,'jquery.js']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/splitbar.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/sync_off.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/sync_on.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/tab_a.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/tab_b.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/tab_h.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/doc/iFlytek MSC Reference Manual/tab_s.png -------------------------------------------------------------------------------- /xf/doc/iFlytek MSC Reference Manual/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 7 | } 8 | 9 | .tabs2 { 10 | font-size: 10px; 11 | } 12 | .tabs3 { 13 | font-size: 9px; 14 | } 15 | 16 | .tablist { 17 | margin: 0; 18 | padding: 0; 19 | display: table; 20 | } 21 | 22 | .tablist li { 23 | float: left; 24 | display: table-cell; 25 | background-image: url('tab_b.png'); 26 | line-height: 36px; 27 | list-style: none; 28 | } 29 | 30 | .tablist a { 31 | display: block; 32 | padding: 0 20px; 33 | font-weight: bold; 34 | background-image:url('tab_s.png'); 35 | background-repeat:no-repeat; 36 | background-position:right; 37 | color: #283A5D; 38 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 39 | text-decoration: none; 40 | outline: none; 41 | } 42 | 43 | .tabs3 .tablist a { 44 | padding: 0 10px; 45 | } 46 | 47 | .tablist a:hover { 48 | background-image: url('tab_h.png'); 49 | background-repeat:repeat-x; 50 | color: #fff; 51 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 52 | text-decoration: none; 53 | } 54 | 55 | .tablist li.current a { 56 | background-image: url('tab_a.png'); 57 | background-repeat:repeat-x; 58 | color: #fff; 59 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 60 | } 61 | -------------------------------------------------------------------------------- /xf/doc/tts_sample/32bit_make.sh: -------------------------------------------------------------------------------- 1 | #编译32位可执行文件 2 | make clean;make 3 | #设置libmsc.so库搜索路径 4 | export LD_LIBRARY_PATH=$(pwd)/../../libs/x86/ 5 | -------------------------------------------------------------------------------- /xf/doc/tts_sample/64bit_make.sh: -------------------------------------------------------------------------------- 1 | #编译64位可执行文件 2 | make clean;make LINUX64=1 3 | #设置libmsc.so库搜索路径 4 | export LD_LIBRARY_PATH=$(pwd)/../../libs/x64/ 5 | -------------------------------------------------------------------------------- /xf/doc/tts_sample/Makefile: -------------------------------------------------------------------------------- 1 | #common makefile header 2 | 3 | DIR_INC = ../../include 4 | DIR_BIN = ../../bin 5 | DIR_LIB = ../../libs 6 | 7 | TARGET = tts_sample 8 | BIN_TARGET = $(DIR_BIN)/$(TARGET) 9 | 10 | CROSS_COMPILE = 11 | CFLAGS = -g -Wall -I$(DIR_INC) 12 | 13 | ifdef LINUX64 14 | LDFLAGS := -L$(DIR_LIB)/x64 15 | else 16 | LDFLAGS := -L$(DIR_LIB)/x86 17 | endif 18 | LDFLAGS += -lmsc -lrt -ldl -lpthread 19 | 20 | OBJECTS := $(patsubst %.c,%.o,$(wildcard *.c)) 21 | 22 | $(BIN_TARGET) : $(OBJECTS) 23 | $(CROSS_COMPILE)gcc $(CFLAGS) $^ -o $@ $(LDFLAGS) 24 | 25 | %.o : %.c 26 | $(CROSS_COMPILE)gcc -c $(CFLAGS) $< -o $@ 27 | clean: 28 | @rm -f *.o $(BIN_TARGET) 29 | 30 | .PHONY:clean 31 | 32 | #common makefile foot 33 | -------------------------------------------------------------------------------- /xf/doc/tts_sample/tts_sample.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 语音合成(Text To Speech,TTS)技术能够自动将任意文字实时转换为连续的 3 | * 自然语音,是一种能够在任何时间、任何地点,向任何人提供语音信息服务的 4 | * 高效便捷手段,非常符合信息时代海量数据、动态更新和个性化查询的需求。 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "qtts.h" 13 | #include "msp_cmn.h" 14 | #include "msp_errors.h" 15 | 16 | /* wav音频头部格式 */ 17 | typedef struct _wave_pcm_hdr 18 | { 19 | char riff[4]; // = "RIFF" 20 | int size_8; // = FileSize - 8 21 | char wave[4]; // = "WAVE" 22 | char fmt[4]; // = "fmt " 23 | int fmt_size; // = 下一个结构体的大小 : 16 24 | 25 | short int format_tag; // = PCM : 1 26 | short int channels; // = 通道数 : 1 27 | int samples_per_sec; // = 采样率 : 8000 | 6000 | 11025 | 16000 28 | int avg_bytes_per_sec; // = 每秒字节数 : samples_per_sec * bits_per_sample / 8 29 | short int block_align; // = 每采样点字节数 : wBitsPerSample / 8 30 | short int bits_per_sample; // = 量化比特数: 8 | 16 31 | 32 | char data[4]; // = "data"; 33 | int data_size; // = 纯数据长度 : FileSize - 44 34 | } wave_pcm_hdr; 35 | 36 | /* 默认wav音频头部数据 */ 37 | wave_pcm_hdr default_wav_hdr = 38 | { 39 | { 'R', 'I', 'F', 'F' }, 40 | 0, 41 | {'W', 'A', 'V', 'E'}, 42 | {'f', 'm', 't', ' '}, 43 | 16, 44 | 1, 45 | 1, 46 | 16000, 47 | 32000, 48 | 2, 49 | 16, 50 | {'d', 'a', 't', 'a'}, 51 | 0 52 | }; 53 | /* 文本合成 */ 54 | int text_to_speech(const char* src_text, const char* des_path, const char* params) 55 | { 56 | int ret = -1; 57 | FILE* fp = NULL; 58 | const char* sessionID = NULL; 59 | unsigned int audio_len = 0; 60 | wave_pcm_hdr wav_hdr = default_wav_hdr; 61 | int synth_status = MSP_TTS_FLAG_STILL_HAVE_DATA; 62 | 63 | if (NULL == src_text || NULL == des_path) 64 | { 65 | printf("params is error!\n"); 66 | return ret; 67 | } 68 | fp = fopen(des_path, "wb"); 69 | if (NULL == fp) 70 | { 71 | printf("open %s error.\n", des_path); 72 | return ret; 73 | } 74 | /* 开始合成 */ 75 | sessionID = QTTSSessionBegin(params, &ret); 76 | if (MSP_SUCCESS != ret) 77 | { 78 | printf("QTTSSessionBegin failed, error code: %d.\n", ret); 79 | fclose(fp); 80 | return ret; 81 | } 82 | ret = QTTSTextPut(sessionID, src_text, (unsigned int)strlen(src_text), NULL); 83 | if (MSP_SUCCESS != ret) 84 | { 85 | printf("QTTSTextPut failed, error code: %d.\n",ret); 86 | QTTSSessionEnd(sessionID, "TextPutError"); 87 | fclose(fp); 88 | return ret; 89 | } 90 | printf("正在合成 ...\n"); 91 | fwrite(&wav_hdr, sizeof(wav_hdr) ,1, fp); //添加wav音频头,使用采样率为16000 92 | while (1) 93 | { 94 | /* 获取合成音频 */ 95 | const void* data = QTTSAudioGet(sessionID, &audio_len, &synth_status, &ret); 96 | if (MSP_SUCCESS != ret) 97 | break; 98 | if (NULL != data) 99 | { 100 | fwrite(data, audio_len, 1, fp); 101 | wav_hdr.data_size += audio_len; //计算data_size大小 102 | } 103 | if (MSP_TTS_FLAG_DATA_END == synth_status) 104 | break; 105 | printf(">"); 106 | usleep(150*1000); //防止频繁占用CPU 107 | }//合成状态synth_status取值请参阅《讯飞语音云API文档》 108 | printf("\n"); 109 | if (MSP_SUCCESS != ret) 110 | { 111 | printf("QTTSAudioGet failed, error code: %d.\n",ret); 112 | QTTSSessionEnd(sessionID, "AudioGetError"); 113 | fclose(fp); 114 | return ret; 115 | } 116 | /* 修正wav文件头数据的大小 */ 117 | wav_hdr.size_8 += wav_hdr.data_size + (sizeof(wav_hdr) - 8); 118 | 119 | /* 将修正过的数据写回文件头部,音频文件为wav格式 */ 120 | fseek(fp, 4, 0); 121 | fwrite(&wav_hdr.size_8,sizeof(wav_hdr.size_8), 1, fp); //写入size_8的值 122 | fseek(fp, 40, 0); //将文件指针偏移到存储data_size值的位置 123 | fwrite(&wav_hdr.data_size,sizeof(wav_hdr.data_size), 1, fp); //写入data_size的值 124 | fclose(fp); 125 | fp = NULL; 126 | /* 合成完毕 */ 127 | ret = QTTSSessionEnd(sessionID, "Normal"); 128 | if (MSP_SUCCESS != ret) 129 | { 130 | printf("QTTSSessionEnd failed, error code: %d.\n",ret); 131 | } 132 | 133 | return ret; 134 | } 135 | 136 | int main(int argc, char* argv[]) 137 | { 138 | int ret = MSP_SUCCESS; 139 | const char* login_params = "appid = 5808ae7e, work_dir = .";//登录参数,appid与msc库绑定,请勿随意改动 140 | /* 141 | * rdn: 合成音频数字发音方式 142 | * volume: 合成音频的音量 143 | * pitch: 合成音频的音调 144 | * speed: 合成音频对应的语速 145 | * voice_name: 合成发音人 146 | * sample_rate: 合成音频采样率 147 | * text_encoding: 合成文本编码格式 148 | * 149 | * 详细参数说明请参阅《讯飞语音云MSC--API文档》 150 | */ 151 | const char* session_begin_params = "voice_name = xiaoyan, text_encoding = utf8, sample_rate = 16000, speed = 50, volume = 50, pitch = 50, rdn = 2"; 152 | const char* filename = "tts_sample.wav"; //合成的语音文件名称 153 | const char* text = "亲爱的用户,您好,这是一个语音合成示例,感谢您对科大讯飞语音技术的支持!科大讯飞是亚太地区最大的语音上市公司,股票代码:002230"; //合成文本 154 | 155 | /* 用户登录 */ 156 | ret = MSPLogin(NULL, NULL, login_params);//第一个参数是用户名,第二个参数是密码,第三个参数是登录参数,用户名和密码可在http://open.voicecloud.cn注册获取 157 | if (MSP_SUCCESS != ret) 158 | { 159 | printf("MSPLogin failed, error code: %d.\n", ret); 160 | goto exit ;//登录失败,退出登录 161 | } 162 | printf("\n###########################################################################\n"); 163 | printf("## 语音合成(Text To Speech,TTS)技术能够自动将任意文字实时转换为连续的 ##\n"); 164 | printf("## 自然语音,是一种能够在任何时间、任何地点,向任何人提供语音信息服务的 ##\n"); 165 | printf("## 高效便捷手段,非常符合信息时代海量数据、动态更新和个性化查询的需求。 ##\n"); 166 | printf("###########################################################################\n\n"); 167 | /* 文本合成 */ 168 | printf("开始合成 ...\n"); 169 | ret = text_to_speech(text, filename, session_begin_params); 170 | if (MSP_SUCCESS != ret) 171 | { 172 | printf("text_to_speech failed, error code: %d.\n", ret); 173 | } 174 | printf("合成完毕\n"); 175 | 176 | exit: 177 | printf("按任意键退出 ...\n"); 178 | getchar(); 179 | MSPLogout(); //退出登录 180 | 181 | return 0; 182 | } 183 | 184 | -------------------------------------------------------------------------------- /xf/include/.msp_cmn.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/include/.msp_cmn.h.swp -------------------------------------------------------------------------------- /xf/include/convert.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "qtts.h" 8 | #include "msp_cmn.h" 9 | #include "msp_errors.h" 10 | 11 | // wav音频头部格式 12 | typedef struct _wave_pcm_hdr 13 | { 14 | char riff[4]; // = "RIFF" 15 | int size_8; // = FileSize - 8 16 | char wave[4]; // = "WAVE" 17 | char fmt[4]; // = "fmt " 18 | int fmt_size; // = 下一个结构体的大小 : 16 19 | 20 | short int format_tag; // = PCM : 1 21 | short int channels; // = 通道数 : 1 22 | int samples_per_sec; // = 采样率 : 8000 | 6000 | 11025 | 16000 23 | int avg_bytes_per_sec; // = 每秒字节数 : samples_per_sec * bits_per_sample / 8 24 | short int block_align; // = 每采样点字节数 : wBitsPerSample / 8 25 | short int bits_per_sample; // = 量化比特数: 8 | 16 26 | 27 | char data[4]; // = "data"; 28 | int data_size; // = 纯数据长度 : FileSize - 44 29 | } wave_pcm_hdr; 30 | 31 | // 默认wav音频头部数据 32 | wave_pcm_hdr default_wav_hdr = 33 | { 34 | { 'R', 'I', 'F', 'F' }, 35 | 0, 36 | {'W', 'A', 'V', 'E'}, 37 | {'f', 'm', 't', ' '}, 38 | 16, 39 | 1, 40 | 1, 41 | 8000, 42 | 16000, 43 | 2, 44 | 16, 45 | {'d', 'a', 't', 'a'}, 46 | 0 47 | }; 48 | 49 | 50 | // 文本合成 51 | int text_to_speech(const char* src_text, const char* des_path, const char* params, int sleep_time) 52 | { 53 | int ret = -1; 54 | FILE* fp = NULL; 55 | const char* sessionID = NULL; 56 | unsigned int audio_len = 0; 57 | wave_pcm_hdr wav_hdr = default_wav_hdr; 58 | int synth_status = MSP_TTS_FLAG_STILL_HAVE_DATA; 59 | 60 | 61 | if (NULL == src_text || NULL == des_path) 62 | { 63 | return ret; 64 | } 65 | fp = fopen(des_path, "wb"); 66 | if (NULL == fp) 67 | { 68 | return ret; 69 | } 70 | //开始合成 71 | sessionID = QTTSSessionBegin(params, &ret); 72 | if (MSP_SUCCESS != ret) 73 | { 74 | fclose(fp); 75 | return ret; 76 | } 77 | ret = QTTSTextPut(sessionID, src_text, (unsigned int)strlen(src_text), NULL); 78 | if (MSP_SUCCESS != ret) 79 | { 80 | QTTSSessionEnd(sessionID, "TextPutError"); 81 | fclose(fp); 82 | return ret; 83 | } 84 | fwrite(&wav_hdr, sizeof(wav_hdr) ,1, fp); //添加wav音频头,使用采样率为8000 85 | 86 | while (1) 87 | { 88 | /* 获取合成音频 */ 89 | const void* data = QTTSAudioGet(sessionID, &audio_len, &synth_status, &ret); 90 | if (MSP_SUCCESS != ret) 91 | break; 92 | if (NULL != data) 93 | { 94 | fwrite(data, audio_len, 1, fp); 95 | wav_hdr.data_size += audio_len; //计算data_size大小 96 | } 97 | if (MSP_TTS_FLAG_DATA_END == synth_status) 98 | break; 99 | usleep(sleep_time); //防止频繁占用CPU 100 | }//合成状态synth_status取值请参阅《讯飞语音云API文档》 101 | 102 | if (MSP_SUCCESS != ret) 103 | { 104 | QTTSSessionEnd(sessionID, "AudioGetError"); 105 | fclose(fp); 106 | return ret; 107 | } 108 | // 修正wav文件头数据的大小 109 | wav_hdr.size_8 += wav_hdr.data_size + (sizeof(wav_hdr) - 8); 110 | 111 | // 将修正过的数据写回文件头部,音频文件为wav格式 112 | fseek(fp, 4, 0); 113 | fwrite(&wav_hdr.size_8,sizeof(wav_hdr.size_8), 1, fp); //写入size_8的值 114 | fseek(fp, 40, 0); //将文件指针偏移到存储data_size值的位置 115 | fwrite(&wav_hdr.data_size,sizeof(wav_hdr.data_size), 1, fp); //写入data_size的值 116 | fclose(fp); 117 | fp = NULL; 118 | // 合成完毕 119 | ret = QTTSSessionEnd(sessionID, "Normal"); 120 | return ret; 121 | } 122 | 123 | -------------------------------------------------------------------------------- /xf/include/msp_errors.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/include/msp_errors.h -------------------------------------------------------------------------------- /xf/include/msp_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __MSP_TYPES_H__ 2 | #define __MSP_TYPES_H__ 3 | 4 | #if !defined(MSPAPI) 5 | #if defined(WIN32) || defined(WINPHONE8) || defined(WIN8) 6 | #define MSPAPI __stdcall 7 | #else 8 | #define MSPAPI 9 | #endif /* WIN32 */ 10 | #endif /* MSPAPI */ 11 | 12 | 13 | /** 14 | * MSPSampleStatus indicates how the sample buffer should be handled 15 | * MSP_AUDIO_SAMPLE_FIRST - The sample buffer is the start of audio 16 | * If recognizer was already recognizing, it will discard 17 | * audio received to date and re-start the recognition 18 | * MSP_AUDIO_SAMPLE_CONTINUE - The sample buffer is continuing audio 19 | * MSP_AUDIO_SAMPLE_LAST - The sample buffer is the end of audio 20 | * The recognizer will cease processing audio and 21 | * return results 22 | * Note that sample statii can be combined; for example, for file-based input 23 | * the entire file can be written with SAMPLE_FIRST | SAMPLE_LAST as the 24 | * status. 25 | * Other flags may be added in future to indicate other special audio 26 | * conditions such as the presence of AGC 27 | */ 28 | enum 29 | { 30 | MSP_AUDIO_SAMPLE_INIT = 0x00, 31 | MSP_AUDIO_SAMPLE_FIRST = 0x01, 32 | MSP_AUDIO_SAMPLE_CONTINUE = 0x02, 33 | MSP_AUDIO_SAMPLE_LAST = 0x04, 34 | }; 35 | 36 | /* 37 | * The enumeration MSPRecognizerStatus contains the recognition status 38 | * MSP_REC_STATUS_SUCCESS - successful recognition with partial results 39 | * MSP_REC_STATUS_NO_MATCH - recognition rejected 40 | * MSP_REC_STATUS_INCOMPLETE - recognizer needs more time to compute results 41 | * MSP_REC_STATUS_NON_SPEECH_DETECTED - discard status, no more in use 42 | * MSP_REC_STATUS_SPEECH_DETECTED - recognizer has detected audio, this is delayed status 43 | * MSP_REC_STATUS_COMPLETE - recognizer has return all result 44 | * MSP_REC_STATUS_MAX_CPU_TIME - CPU time limit exceeded 45 | * MSP_REC_STATUS_MAX_SPEECH - maximum speech length exceeded, partial results may be returned 46 | * MSP_REC_STATUS_STOPPED - recognition was stopped 47 | * MSP_REC_STATUS_REJECTED - recognizer rejected due to low confidence 48 | * MSP_REC_STATUS_NO_SPEECH_FOUND - recognizer still found no audio, this is delayed status 49 | */ 50 | enum 51 | { 52 | MSP_REC_STATUS_SUCCESS = 0, 53 | MSP_REC_STATUS_NO_MATCH = 1, 54 | MSP_REC_STATUS_INCOMPLETE = 2, 55 | MSP_REC_STATUS_NON_SPEECH_DETECTED = 3, 56 | MSP_REC_STATUS_SPEECH_DETECTED = 4, 57 | MSP_REC_STATUS_COMPLETE = 5, 58 | MSP_REC_STATUS_MAX_CPU_TIME = 6, 59 | MSP_REC_STATUS_MAX_SPEECH = 7, 60 | MSP_REC_STATUS_STOPPED = 8, 61 | MSP_REC_STATUS_REJECTED = 9, 62 | MSP_REC_STATUS_NO_SPEECH_FOUND = 10, 63 | MSP_REC_STATUS_FAILURE = MSP_REC_STATUS_NO_MATCH, 64 | }; 65 | 66 | /** 67 | * The enumeration MSPepState contains the current endpointer state 68 | * MSP_EP_LOOKING_FOR_SPEECH - Have not yet found the beginning of speech 69 | * MSP_EP_IN_SPEECH - Have found the beginning, but not the end of speech 70 | * MSP_EP_AFTER_SPEECH - Have found the beginning and end of speech 71 | * MSP_EP_TIMEOUT - Have not found any audio till timeout 72 | * MSP_EP_ERROR - The endpointer has encountered a serious error 73 | * MSP_EP_MAX_SPEECH - Have arrive the max size of speech 74 | */ 75 | enum 76 | { 77 | MSP_EP_LOOKING_FOR_SPEECH = 0, 78 | MSP_EP_IN_SPEECH = 1, 79 | MSP_EP_AFTER_SPEECH = 3, 80 | MSP_EP_TIMEOUT = 4, 81 | MSP_EP_ERROR = 5, 82 | MSP_EP_MAX_SPEECH = 6, 83 | MSP_EP_IDLE = 7 // internal state after stop and before start 84 | }; 85 | 86 | /* Synthesizing process flags */ 87 | enum 88 | { 89 | MSP_TTS_FLAG_STILL_HAVE_DATA = 1, 90 | MSP_TTS_FLAG_DATA_END = 2, 91 | MSP_TTS_FLAG_CMD_CANCELED = 4, 92 | }; 93 | 94 | /* Handwriting process flags */ 95 | enum 96 | { 97 | MSP_HCR_DATA_FIRST = 1, 98 | MSP_HCR_DATA_CONTINUE = 2, 99 | MSP_HCR_DATA_END = 4, 100 | }; 101 | 102 | /*ivw message type */ 103 | enum 104 | { 105 | MSP_IVW_MSG_WAKEUP = 1, 106 | MSP_IVW_MSG_ERROR = 2, 107 | MSP_IVW_MSG_ISR_RESULT = 3, 108 | MSP_IVW_MSG_ISR_EPS = 4, 109 | MSP_IVW_MSG_VOLUME = 5, 110 | MSP_IVW_MSG_ENROLL = 6, 111 | MSP_IVW_MSG_RESET = 7 112 | }; 113 | 114 | /* Upload data process flags */ 115 | enum 116 | { 117 | MSP_DATA_SAMPLE_INIT = 0x00, 118 | MSP_DATA_SAMPLE_FIRST = 0x01, 119 | MSP_DATA_SAMPLE_CONTINUE = 0x02, 120 | MSP_DATA_SAMPLE_LAST = 0x04, 121 | }; 122 | 123 | #endif /* __MSP_TYPES_H__ */ 124 | -------------------------------------------------------------------------------- /xf/lib/libmsc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/lib/libmsc.so -------------------------------------------------------------------------------- /xf/lib/x64/libmsc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/lib/x64/libmsc.so -------------------------------------------------------------------------------- /xf/lib/x86/libmsc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imroc/ontts/af26ab273796c0c9fa5bbc5db3bad18491d0d63f/xf/lib/x86/libmsc.so -------------------------------------------------------------------------------- /xf/xf.go: -------------------------------------------------------------------------------- 1 | package xf 2 | 3 | /* 4 | 5 | #cgo CFLAGS:-g -Wall -I./include 6 | #cgo LDFLAGS:-L./lib -lmsc -lrt -ldl -lpthread 7 | 8 | #include "convert.h" 9 | 10 | */ 11 | import "C" 12 | import ( 13 | "fmt" 14 | "unsafe" 15 | ) 16 | 17 | /* 18 | * rdn: 合成音频数字发音方式 19 | * volume: 合成音频的音量 20 | * pitch: 合成音频的音调 21 | * speed: 合成音频对应的语速 22 | * voice_name: 合成发音人 23 | * sample_rate: 合成音频采样率 24 | * text_encoding: 合成文本编码格式 25 | * 26 | * 详细参数说明请参阅《iFlytek MSC Reference Manual》 27 | */ 28 | var ttsParams *C.char 29 | var sleep C.int = C.int(0) 30 | 31 | func SetTTSParams(params string) { 32 | ttsParams = C.CString(params) 33 | } 34 | 35 | func SetSleep(t int) { 36 | sleep = C.int(t) 37 | } 38 | 39 | func Login(loginParams string) error { 40 | l := C.CString(loginParams) 41 | defer C.free(unsafe.Pointer(l)) 42 | 43 | ret := C.MSPLogin(nil, nil, C.CString(loginParams)) 44 | if ret != C.MSP_SUCCESS { 45 | return fmt.Errorf("登录失败,错误码:%d", int(ret)) 46 | } 47 | return nil 48 | } 49 | 50 | func Logout() error { 51 | ret := C.MSPLogout() 52 | if ret != C.MSP_SUCCESS { 53 | return fmt.Errorf("注销失败,错误码:%d", int(ret)) 54 | } 55 | return nil 56 | } 57 | 58 | func TextToSpeech(text, outPath string) error { 59 | t := C.CString(text) 60 | o := C.CString(outPath) 61 | defer C.free(unsafe.Pointer(t)) 62 | defer C.free(unsafe.Pointer(o)) 63 | ret := C.text_to_speech(t, o, ttsParams, sleep) 64 | if ret != C.MSP_SUCCESS { 65 | return fmt.Errorf("音频生成失败,错误码:%d", int(ret)) 66 | } 67 | return nil 68 | } 69 | --------------------------------------------------------------------------------