Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit f7a6724

Browse files
committed
Simplified initialization of the Ad class
1 parent 5905804 commit f7a6724

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

swig/sphinxbase/ad.i

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,12 @@ negative error code."
6666
typedef struct {} Ad;
6767

6868
%extend Ad {
69-
Ad(int *errcode) {
70-
Ad *ad = ad_open();
71-
*errcode = ad ? 0 : -1;
72-
return ad;
73-
}
74-
75-
Ad(int32 samples_per_sec, int *errcode) {
76-
Ad *ad = ad_open_sps(samples_per_sec);
77-
*errcode = ad ? 0 : -1;
78-
return ad;
79-
}
80-
81-
Ad(const char *dev, int32 samples_per_sec, int *errcode) {
82-
Ad *ad = ad_open_dev(dev, samples_per_sec);
69+
Ad(const char *device=NULL, int32 rate=16000, int *errcode) {
70+
Ad *ad;
71+
if (device == NULL)
72+
ad = ad_open_sps(rate);
73+
else
74+
ad = ad_open_dev(device, rate);
8375
*errcode = ad ? 0 : -1;
8476
return ad;
8577
}

0 commit comments

Comments
 (0)