forked from hitmen047/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtalkback.h
732 lines (642 loc) · 36.8 KB
/
talkback.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// =============================================================================
// Interface to the LIPSinc TalkBack 1.1 library (TalkBack_*.lib).
//
// Copyright © 1998-2002 LIPSinc. All rights reserved.
#if !defined(TalkBack_h)
#define TalkBack_h
#include <stddef.h> // size_t.
// Enforce a C API.
#if defined(__cplusplus)
extern "C"
{
#endif
// -----------------------------------------------------------------------------
// Use the preprocessor to make the new API compatible with the old one.
#define TalkbackStartupLibrary TalkBackStartupLibrary
#define TalkbackShutdownLibrary TalkBackShutdownLibrary
#define TalkbackGetVersion TalkBackGetVersion
#define TalkbackGetVersionString TalkBackGetVersionString
#define TalkbackCheckSoundFile TalkBackCheckSoundFile
#define TalkbackCheckSpokenText TalkBackCheckSpokenText
#define TalkbackGetErrorString TalkBackGetErrorString
#define TalkbackGetAnalysis TalkBackGetAnalysis
#define TalkbackFreeAnalysis TalkBackFreeAnalysis
#define TalkbackGetFirstFrameNum TalkBackGetFirstFrameNum
#define TalkbackGetLastFrameNum TalkBackGetLastFrameNum
#define TalkbackGetFrameStartTime TalkBackGetFrameStartTime
#define TalkbackGetFrameEndTime TalkBackGetFrameEndTime
#define TalkbackGetNumPhonemes TalkBackGetNumPhonemes
#define TalkbackGetPhonemeEnum TalkBackGetPhonemeEnum
#define TalkbackGetPhonemeStartTime TalkBackGetPhonemeStartTime
#define TalkbackGetPhonemeEndTime TalkBackGetPhonemeEndTime
#define TalkbackInsertPhoneme TalkBackInsertPhoneme
#define TalkbackDeletePhoneme TalkBackDeletePhoneme
#define TalkbackChangePhonemeStart TalkBackChangePhonemeStart
#define TalkbackChangePhonemeEnd TalkBackChangePhonemeEnd
#define TalkbackChangePhonemeEnum TalkBackChangePhonemeEnum
#define TalkbackGetNumWords TalkBackGetNumWords
#define TalkbackGetWord TalkBackGetWord
#define TalkbackGetWordStartTime TalkBackGetWordStartTime
#define TalkbackGetWordEndTime TalkBackGetWordEndTime
#define TalkbackGetNumSpeechTargetTracks TalkBackGetNumSpeechTargetTracks
#define TalkbackGetNumSpeechTargetKeys TalkBackGetNumSpeechTargetKeys
#define TalkbackGetSpeechTargetKeyInfo TalkBackGetSpeechTargetKeyInfo
#define TalkbackGetSpeechTargetValueAtFrame TalkBackGetSpeechTargetValueAtFrame
#define TalkbackGetDominantSpeechTargetAtFrame TalkBackGetDominantSpeechTargetAtFrame
#define TalkbackGetSpeechTargetValueAtTime TalkBackGetSpeechTargetValueAtTime
#define TalkbackGetSpeechTargetDerivativesAtTime TalkBackGetSpeechTargetDerivativesAtTime
#define TalkbackGetNumGestureTracks TalkBackGetNumGestureTracks
#define TalkbackGetNumGestureKeys TalkBackGetNumGestureKeys
#define TalkbackGetGestureKeyInfo TalkBackGetGestureKeyInfo
#define TalkbackGetGestureValueAtFrame TalkBackGetGestureValueAtFrame
#define TalkbackGetGestureValueAtTime TalkBackGetGestureValueAtTime
#define TalkbackGetGestureDerivativesAtTime TalkBackGetGestureDerivativesAtTime
// -----------------------------------------------------------------------------
// For debug builds, set this to a non-zero value to get verbose debugging
// output from TalkBack.
extern int g_enableTalkBackDebuggingOutput;
// -----------------------------------------------------------------------------
// Miscellaneous constants.
// For calling TalkBackGetAnalysis() with all defaults.
#define TALKBACK_DEFAULT_SETTINGS NULL
// For setting the iSoundText parameter in TalkBackGetAnalysis() to "no text."
#define TALKBACK_NO_TEXT NULL
// Handy constants for TALKBACK_ANALYSIS_SETTINGS fields:
// For setting fSize.
#define TALKBACK_SETTINGS_SIZE sizeof(TALKBACK_ANALYSIS_SETTINGS)
// For setting fFrameRate to the
// default.
#define TALKBACK_DEFAULT_FRAME_RATE 30
// For setting fOptimizeForFlipbook
// to *not* optimize for flipbook.
#define TALKBACK_OPTIMIZE_FOR_FLIPBOOK_OFF 0
// For setting fOptimizeForFlipbook
// to optimize for flipbook.
#define TALKBACK_OPTIMIZE_FOR_FLIPBOOK_ON 1
// For setting fRandomSeed to use the
// current time to seed the random
// number generator and thereby get
// non-deterministic speech gestures.
#define TALKBACK_RANDOM_SEED -1
// For setting fConfigFile to "no
// config file."
#define TALKBACK_NO_CONFIG_FILE NULL
// -----------------------------------------------------------------------------
// Data types.
// TALKBACK_NOERR if successful, TalkBack error code if not.
typedef long TALKBACK_ERR;
// Opaque analysis results.
typedef void TALKBACK_ANALYSIS;
// Speech target.
typedef long TALKBACK_SPEECH_TARGET;
// Speech gesture.
typedef long TALKBACK_GESTURE;
// Phoneme.
typedef long TALKBACK_PHONEME;
// -----------------------------------------------------------------------------
// Data structures.
#pragma pack(push, 1)
// Optional analysis settings passed to TalkBackGetAnalysis().
typedef struct
{
// Set this field to sizeof(TALKBACK_ANALYSIS_SETTINGS) before using the
// structure.
long fSize;
// Frame rate for analysis. This only matters if you will be using *AtFrame
// functions.
//
// Default value: 30 (frames per second).
long fFrameRate;
// Set this to 1 to optimize for flipbook output, 0 to do analysis normally.
//
// Default value: 0 (normal analysis).
long fOptimizeForFlipbook;
// Set this to -1 to seed the random number generator with the current time.
// Any other number will be used directly for the random number seed, which
// is useful if you want repeatable speech gestures. This value does not
// influence lip-synching at all.
//
// Default value: -1 (use current time).
long fRandomSeed;
// Path to the configuration (.INI) file with phoneme-to-speech-target
// mapping. Set this to NULL to use the default mapping.
//
// Default value: NULL (use default mapping).
char const *fConfigFile;
} TALKBACK_ANALYSIS_SETTINGS;
typedef struct
{
// Set this field to sizeof(TALKBACK_SOUND_FILE_METRICS) before using the
// structure. This will allow the structure to evolve if necessary.
size_t m_size;
// Bits per sample.
long m_bitsPerSample;
// Sample rate in Hertz.
long m_sampleRate;
// Duration of the audio in seconds.
double m_duration;
// 1 if the sound file can be analyzed, 0 if not.
long m_canBeAnalyzed;
// 1 if the sound file is clipped, 0 if not.
long m_isClipped;
// The decibel range of the sound file.
double m_decibelRange;
// A quality value for the sound file: the nominal range is 0 to 100. Try
// to keep it above 45 for good results.
int m_quality;
// Added for version 2 of the metrics structure:
// ---------------------------------------------
// The number of channels in the sound file: 1 for mono, 2 for stereo, etc.
long m_channelCount;
} TALKBACK_SOUND_FILE_METRICS;
#pragma pack(pop)
// -----------------------------------------------------------------------------
// Constants.
// TalkBack error codes. Use TalkBackGetErrorString() to return text
// descriptions for these codes.
enum
{
// Windows convention: set this bit to indicate an application-defined error
// code.
BIT29 = (1 << 29),
// Success (not an error).
TALKBACK_NOERR = 0,
// The first error code: useful for iterating through the error codes.
TALKBACK_ERROR_FIRST = 4201 | BIT29,
// Generic error.
TALKBACK_ERROR = TALKBACK_ERROR_FIRST,
// TalkBackStartupLibrary() failed [internal error] or was never called.
TALKBACK_STARTUP_FAILED_ERR,
// TalkBackShutdownLibrary() failed, either because
// TalkBackStartupLibrary() was never called or because
// TalkBackShutdownLibrary() has already been called.
TALKBACK_SHUTDOWN_FAILED_ERR,
// The TalkBack data files could not be found [invalid path or missing
// files].
TALKBACK_CORE_DATA_NOT_FOUND_ERR,
// One or more of the parameters are NULL.
TALKBACK_NULL_PARAMETER_ERR,
// One or more of the parameters is invalid.
TALKBACK_INVALID_PARAMETER_ERR,
// The analysis object pointer is invalid.
TALKBACK_INVALID_ANALYSIS_ERR,
// Analysis failed [the sound file cannot be analyzed or an internal error
// occurred].
TALKBACK_ANALYSIS_FAILED_ERR,
// One or more of the indices (track, key, frame, word, phoneme) are
// invalid (out of range).
TALKBACK_INVALID_INDEX_ERR,
// The time parameter is invalid (out of range).
TALKBACK_INVALID_TIME_ERR,
// A serious internal error occurred in TalkBack; please alert LIPSinc by
// sending mail with a description of how the error was triggered to
// talkback-support@LIPSinc.com.
TALKBACK_INTERNAL_ERR,
// Could not open the specified sound file.
TALKBACK_COULD_NOT_LOAD_SOUND_ERR,
// TalkBackStartupLibrary() has not been called.
TALKBACK_STARTUP_NOT_CALLED,
// The configuration file specified in the TALKBACK_ANALYSIS_SETTINGS
// structure is invalid.
TALKBACK_CONFIG_PARSE_ERROR,
// The last error code: useful for iterating through the error codes.
TALKBACK_ERROR_LAST = TALKBACK_CONFIG_PARSE_ERROR
};
// Default lip-synching track identifiers.
//
// NOTE: these track identifiers apply *only* to the default phoneme-to-track
// mapping! Consult the TalkBack Reference Guide for more details.
//
// NOTE: these values are valid *only* if you use the default mapping and are
// provided as a convenience. If you use your own mapping, these values
// are invalid and should not be used.
enum
{
TALKBACK_SPEECH_TARGET_INVALID = -1,
TALKBACK_SPEECH_TARGET_FIRST = 0,
TALKBACK_SPEECH_TARGET_EAT = TALKBACK_SPEECH_TARGET_FIRST, // 0
TALKBACK_SPEECH_TARGET_EARTH, // 1
TALKBACK_SPEECH_TARGET_IF, // 2
TALKBACK_SPEECH_TARGET_OX, // 3
TALKBACK_SPEECH_TARGET_OAT, // 4
TALKBACK_SPEECH_TARGET_WET, // 5
TALKBACK_SPEECH_TARGET_SIZE, // 6
TALKBACK_SPEECH_TARGET_CHURCH, // 7
TALKBACK_SPEECH_TARGET_FAVE, // 8
TALKBACK_SPEECH_TARGET_THOUGH, // 9
TALKBACK_SPEECH_TARGET_TOLD, // 10
TALKBACK_SPEECH_TARGET_BUMP, // 11
TALKBACK_SPEECH_TARGET_NEW, // 12
TALKBACK_SPEECH_TARGET_ROAR, // 13
TALKBACK_SPEECH_TARGET_CAGE, // 14
TALKBACK_SPEECH_TARGET_LAST = TALKBACK_SPEECH_TARGET_CAGE, // 14
TALKBACK_NUM_SPEECH_TARGETS // 15 (0..14)
};
// Speech gesture track identifiers.
enum
{
TALKBACK_GESTURE_INVALID = -1,
TALKBACK_GESTURE_FIRST = 0,
TALKBACK_GESTURE_EYEBROW_RAISE_LEFT = TALKBACK_GESTURE_FIRST, // 0
TALKBACK_GESTURE_EYEBROW_RAISE_RIGHT, // 1
TALKBACK_GESTURE_BLINK_LEFT, // 2
TALKBACK_GESTURE_BLINK_RIGHT, // 3
TALKBACK_GESTURE_HEAD_BEND, // 4
TALKBACK_GESTURE_HEAD_SIDE_SIDE, // 5
TALKBACK_GESTURE_HEAD_TWIST, // 6
TALKBACK_GESTURE_EYE_SIDE_SIDE_LEFT, // 7
TALKBACK_GESTURE_EYE_SIDE_SIDE_RIGHT, // 8
TALKBACK_GESTURE_EYE_UP_DOWN_LEFT, // 9
TALKBACK_GESTURE_EYE_UP_DOWN_RIGHT, // 10
TALKBACK_GESTURE_LAST = TALKBACK_GESTURE_EYE_UP_DOWN_RIGHT, // 10
TALKBACK_NUM_GESTURES // 11 (0..10)
};
// Phoneme identifiers.
enum
{
TALKBACK_PHONEME_INVALID = -1,
TALKBACK_PHONEME_FIRST = 0,
TALKBACK_PHONEME_IY = TALKBACK_PHONEME_FIRST, // 0
TALKBACK_PHONEME_IH, // 1
TALKBACK_PHONEME_EH, // 2
TALKBACK_PHONEME_EY, // 3
TALKBACK_PHONEME_AE, // 4
TALKBACK_PHONEME_AA, // 5
TALKBACK_PHONEME_AW, // 6
TALKBACK_PHONEME_AY, // 7
TALKBACK_PHONEME_AH, // 8
TALKBACK_PHONEME_AO, // 9
TALKBACK_PHONEME_OY, // 10
TALKBACK_PHONEME_OW, // 11
TALKBACK_PHONEME_UH, // 12
TALKBACK_PHONEME_UW, // 13
TALKBACK_PHONEME_ER, // 14
TALKBACK_PHONEME_AX, // 15
TALKBACK_PHONEME_S, // 16
TALKBACK_PHONEME_SH, // 17
TALKBACK_PHONEME_Z, // 18
TALKBACK_PHONEME_ZH, // 19
TALKBACK_PHONEME_F, // 20
TALKBACK_PHONEME_TH, // 21
TALKBACK_PHONEME_V, // 22
TALKBACK_PHONEME_DH, // 23
TALKBACK_PHONEME_M, // 24
TALKBACK_PHONEME_N, // 25
TALKBACK_PHONEME_NG, // 26
TALKBACK_PHONEME_L, // 27
TALKBACK_PHONEME_R, // 28
TALKBACK_PHONEME_W, // 29
TALKBACK_PHONEME_Y, // 30
TALKBACK_PHONEME_HH, // 31
TALKBACK_PHONEME_B, // 32
TALKBACK_PHONEME_D, // 33
TALKBACK_PHONEME_JH, // 34
TALKBACK_PHONEME_G, // 35
TALKBACK_PHONEME_P, // 36
TALKBACK_PHONEME_T, // 37
TALKBACK_PHONEME_K, // 38
TALKBACK_PHONEME_CH, // 39
TALKBACK_PHONEME_SIL, // 40
TALKBACK_PHONEME_LAST = TALKBACK_PHONEME_SIL, // 40
TALKBACK_NUM_PHONEMES // 41 (0..40)
};
// -----------------------------------------------------------------------------
// Function declarations.
// ---------------------------
// Startup/shutdown functions.
// ---------------------------
// Must be the first function called when using TalkBack.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackStartupLibrary(
char const *iCoreDataDir); // IN: full path of folder containing TalkBack data files.
// Should be the last function called when using TalkBack.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackShutdownLibrary(); // IN: nothing.
// ------------------
// Version functions.
// ------------------
// Gets the TalkBack version number.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetVersion(
long *oMajor, // OUT: major version number.
long *oMinor, // OUT: minor version number.
long *oRevision); // OUT: revision version number.
// Gets the TalkBack version number as a string.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetVersionString(
long iMaxChars, // IN: size of version string buffer.
char *oVersion); // OUT: version string buffer.
// ------------------
// Utility functions.
// ------------------
// Checks whether a sound file can be analyzed and returns some quality metrics.
//
// NOTE: this function is deprecated and has been supplanted by
// TalkBackGetSoundFileMetrics().
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackCheckSoundFile(
char const *iSoundFileName, // IN: name of sound file to be checked.
long *oCanBeAnalyzed, // OUT: 1 if sound can be analyzed, 0 if not.
long *oIsClipped, // OUT: 1 if sound is clipped, 0 if not.
double *oDecibelRange); // OUT: used decibel range of sound.
// Returns metrics for the specified sound file.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetSoundFileMetrics(
char const *iSoundFileName, // IN: name of sound file to be checked.
TALKBACK_SOUND_FILE_METRICS *ioMetrics); // IN/OUT: address of a structure where the metrics will be stored.
// Checks whether text can be used for text-based analysis, returning the text
// as it will be analyzed.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackCheckSpokenText(
char const *iSpokenText, // IN: text to check.
long iMaxChars, // IN: size of analyzed text buffer.
char *oAnalyzedText); // OUT: buffer for text as it will be analyzed.
// Convert a TalkBack error code to a description string.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetErrorString(
TALKBACK_ERR iErrorCode, // IN: TalkBack error code to convert.
long iMaxChars, // IN: size of the buffer.
char *oErrorString); // OUT: buffer for the description string.
// Gets the error code and text for the most recent TalkBack error.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetLastError(
long iMaxChars, // IN: size of the buffer.
char *oErrorString, // OUT: buffer for the description string.
TALKBACK_ERR *oErrorCode); // OUT: most recent TalkBack error code.
// -------------------
// Analysis functions.
// -------------------
// Gets an opaque TALKBACK_ANALYSIS object. This object is then queried with the
// TalkBackGet* functions below.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetAnalysis(
TALKBACK_ANALYSIS **ioAnalysis, // IN/OUT: address of a TALKBACK_ANALYSIS *variable where analysis will be stored.
char const *iSoundFileName, // IN: name of the sound file to analyze.
char const *iSoundText, // IN: text spoken in sound file (can be NULL to use textless analysis).
TALKBACK_ANALYSIS_SETTINGS *iSettings); // IN: pointer to a TALKBACK_ANALYSIS_SETTINGS structure (can be NULL for defaults).
// Frees an opaque TALKBACK_ANALYSIS object. This releases all memory used by
// the analysis.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackFreeAnalysis(
TALKBACK_ANALYSIS **ioAnalysis); // IN/OUT: analysis to free.
// #######################################################################
// NOTE: all functions from this point on require a valid analysis object.
// #######################################################################
// ------------------------
// Speech target functions.
// ------------------------
// Gets the number of speech target tracks.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetNumSpeechTargetTracks(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long *oResult); // OUT: number of speech target tracks.
// Gets the number of keys in the specified speech target track.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetNumSpeechTargetKeys(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech target track.
long *oResult); // OUT: number of keys in the speech target track.
// Gets key information (time, value, derivative in, and derivative out) for the
// specified key in the specified speech target track.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetSpeechTargetKeyInfo(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech target track.
long iKeyNum, // IN: speech target key.
double *oTime, // OUT: time of key.
double *oValue, // OUT: value of key.
double *oDerivativeIn, // OUT: incoming derivative of key.
double *oDerivativeOut); // OUT: outgoing derivative of key.
// Gets the value of the function curve for the specified speech target track at
// the specified time.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetSpeechTargetValueAtTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech target track.
double iTime, // IN: time in seconds.
double *oResult); // OUT: value of the function curve.
// Gets the derivatives of the function curve for the specified speech target
// track at the specified time.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetSpeechTargetDerivativesAtTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech target track.
double iTime, // IN: time in seconds.
double *oDerivativeIn, // OUT: value of the incoming derivative of the function curve.
double *oDerivativeOut); // OUT: value of the outgoing derivative of the function curve.
// -------------------------
// Speech gesture functions.
// -------------------------
// Gets the number of speech gesture tracks.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetNumGestureTracks(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long *oResult); // OUT: number of speech gesture tracks
// Gets the number of keys in the specified speech gesture track.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetNumGestureKeys(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech gesture track.
long *oResult); // OUT: number of keys in the speech gesture track.
// Gets key information (time, value, derivative in, and derivative out) for the
// specified key in the specified speech gesture track.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetGestureKeyInfo(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech gesture track.
long iKeyNum, // IN: speech gesture key.
double *oTime, // OUT: time of key.
double *oValue, // OUT: value of key.
double *oDerivativeIn, // OUT: incoming derivative of key.
double *oDerivativeOut); // OUT: outgoing derivative of key.
// Gets the value of the function curve for the specified speech gesture track
// at the specified time.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetGestureValueAtTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech gesture track.
double iTime, // IN: time in seconds.
double *oResult); // OUT: value of the function curve.
// Gets the derivatives of the function curve for the specified speech gesture
// track at the specified time.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetGestureDerivativesAtTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech gesture track.
double iTime, // IN: time in seconds.
double *oDerivativeIn, // OUT: value of the incoming derivative of the function curve.
double *oDerivativeOut); // OUT: value of the outgoing derivative of the function curve.
// ----------------
// Frame functions.
// ----------------
// NOTE: these functions use the frame rate specified in the
// TALKBACK_ANALYSIS_SETTINGS structure passed to TalkBackGetAnalysis() and
// default to 30 fps (TALKBACK_DEFAULT_FRAME_RATE) if the structure pointer was
// NULL.
// Gets the first frame number.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetFirstFrameNum(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long *oResult); // OUT: number of the first frame.
// Gets the last frame number.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetLastFrameNum(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long *oResult); // OUT: number of the last frame.
// Gets the start time of the specified frame.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetFrameStartTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iFrameNum, // IN: frame.
double *oResult); // OUT: start time of the frame in seconds.
// Gets the end time of the specified frame.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetFrameEndTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iFrameNum, // IN: frame.
double *oResult); // OUT: end time of the frame in seconds.
// Gets the value of the function curve for a speech target integrated over the
// specified frame.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetSpeechTargetValueAtFrame(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech target track.
long iFrameNum, // IN: frame number.
double *oResult); // OUT: value of the function curve integrated over the frame.
// Gets the dominant speech target at the specified frame.
//
// NOTE: this function is meant to be used in flipbook mode only.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetDominantSpeechTargetAtFrame(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iFrameNum, // IN: frame number.
TALKBACK_SPEECH_TARGET *oSpeechTarget); // OUT: dominant speech target.
// Gets the value of the function curve for a speech gesture integrated over the
// specified frame.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetGestureValueAtFrame(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iTrackNum, // IN: speech gesture track.
long iFrameNum, // IN: frame number.
double *oResult); // OUT: value of the function curve integrated over the frame.
// ------------------
// Phoneme functions.
// ------------------
// Gets the number of phonemes.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetNumPhonemes(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long *oResult); // OUT: number of phonemes.
// Gets the enumeration of the specified phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetPhonemeEnum(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeNum, // IN: phoneme.
TALKBACK_PHONEME *oResult); // OUT: enumeration of the specified phoneme.
// Gets the start time of the specified phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetPhonemeStartTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeNum, // IN: phoneme.
double *oResult); // OUT: start time of the phoneme in seconds.
// Gets the end time of the specified phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetPhonemeEndTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeNum, // IN: phoneme.
double *oResult); // OUT: end time of the phoneme in seconds.
// ---------------
// Word functions.
// ---------------
// NOTE: these functions only yield data for text-based analysis.
// Gets the number of words.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetNumWords(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long *oResult); // OUT: number of words.
// Gets the text of the specified word.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetWord(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iWordNum, // IN: word.
long iMaxChars, // IN: size of word buffer.
char *oWord); // OUT: word buffer.
// Gets the start time of the specified word.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetWordStartTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iWordNum, // IN: word.
double *oResult); // OUT: start time of the word in seconds.
// Gets the end time of the specified word.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackGetWordEndTime(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iWordNum, // IN: word.
double *oResult); // OUT: end time of the word in seconds.
// --------------------------
// Phoneme editing functions.
// --------------------------
// Use these functions to modify the phoneme list after you get an opaque
// analysis object from TalkBackGetAnalysis(). After modifying the phoneme list
// in the opaque analysis object, subsequent TalkBackGet* calls on that opaque
// analysis object for speech target (lip-synching) data will return values
// based on the modified phoneme list. However, speech gesture data is not
// affected by phoneme editing.
//
// NOTE: phoneme editing is only provided in order to support Ventriloquist-like
// applications where tweaking of the phoneme segmenation (and subsequent
// recalculation of the animation data) is required. Most customers probably
// won't need this functionality.
// Inserts a phoneme at the specified position in the specified manner.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackInsertPhoneme(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
TALKBACK_PHONEME iPhoneme, // IN: enumeration of phoneme to insert.
long iInsertPosition, // IN: position (phoneme number) at which to insert.
int iInsertBefore); // IN: manner of insertion:
// 0 means put phoneme after insert position;
// 1 means put phoneme before insert position.
// Deletes the specified phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackDeletePhoneme(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeToDelete); // IN: phoneme to delete.
// Changes the start time of the specified phoneme.
//
// NOTE: the start time specified may not be the actual start time for a number
// of reasons, most notably if the specified start time will make the phoneme
// too short. This function returns the actual start time so the caller can
// check the result without having to query the phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackChangePhonemeStart(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeToChange, // IN: phoneme to change.
double *ioNewTime); // IN/OUT: new start time value in seconds (in); actual start time (out).
// Changes the end time of the specified phoneme.
//
// NOTE: the end time specified may not be the actual end time for a number of
// reasons, most notably if the specified end time will make the phoneme too
// short. This function returns the actual end time so the caller can check the
// result without having to query the phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackChangePhonemeEnd(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeToChange, // IN: phoneme to change.
double *ioNewTime); // IN/OUT: new end time value in seconds (in); actual end time (out).
// Changes the enumeration of the specified phoneme.
TALKBACK_ERR // RETURNS: TALKBACK_NOERR if successful, TalkBack error code if not.
TalkBackChangePhonemeEnum(
TALKBACK_ANALYSIS *iAnalysis, // IN: opaque analysis object returned by TalkBackGetAnalysis().
long iPhonemeToChange, // IN: phoneme to change.
TALKBACK_PHONEME iNewPhoneme); // IN: new phoneme enumeration.
#if defined(__cplusplus)
}
#endif
#endif