Update of /cvsroot/cbar/cbar/src
In directory sc8-pr-cvs1:/tmp/cvs-serv24425
Modified Files:
csound.c csound.h csound.t unit.c
Log Message:
Corrected the use of error texts
Index: csound.c
===================================================================
RCS file: /cvsroot/cbar/cbar/src/csound.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** csound.c 29 Mar 2003 00:43:39 -0000 1.2
--- csound.c 7 Dec 2003 18:30:49 -0000 1.3
***************
*** 241,252 ****
}
! extern int _CbarCheckInternalSoundSettings(t_sound *s, int ok, const char*const*txt)
{
char tmp[1000];
!
if (s->freq < 20 || s->duration < 55 || s->freq > 20000 || s->duration > 5000) {
sprintf(tmp, txt[BAD_VALUES_FREQ_DURATION_YES_KEEP_NO_SET_DEFAULT],
s->freq, s->duration);
! if (Req("", tmp) == 0) {
if (ok) {
s->freq = 1000;
--- 241,257 ----
}
! extern int _CbarCheckInternalSoundSettings(t_sound *s, int ok)
{
char tmp[1000];
! const char*const*txt;
! int nr;
!
if (s->freq < 20 || s->duration < 55 || s->freq > 20000 || s->duration > 5000) {
+ txt = LoadCompiledTexts(cbar_labels, "csound", &nr);
+ if (nr < SIZE_csound)
+ return 0;
sprintf(tmp, txt[BAD_VALUES_FREQ_DURATION_YES_KEEP_NO_SET_DEFAULT],
s->freq, s->duration);
! if (Req("", tmp) == 1) {
if (ok) {
s->freq = 1000;
***************
*** 261,271 ****
}
! extern int _CbarCheckExternalSoundSettings(t_sound *s, const char*const*txt)
{
char tmp[1000];
if (s->fn == NULL || *s->fn == 0) {
Req("", txt[NO_SOUND_FILE_TO_SOUND_CARD_CLOSE]);
! return 0;
}
if (!exists(s->fn)) {
--- 266,282 ----
}
! extern int _CbarCheckExternalSoundSettings(t_sound *s, const char *def)
{
char tmp[1000];
+ const char*const*txt;
+ int nr;
+
+ txt = LoadCompiledTexts(cbar_labels, "csound", &nr);
+ if (nr < SIZE_csound)
+ return 0;
if (s->fn == NULL || *s->fn == 0) {
Req("", txt[NO_SOUND_FILE_TO_SOUND_CARD_CLOSE]);
! s->fn = MkString(def);
}
if (!exists(s->fn)) {
Index: csound.h
===================================================================
RCS file: /cvsroot/cbar/cbar/src/csound.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** csound.h 29 Mar 2003 00:43:39 -0000 1.2
--- csound.h 7 Dec 2003 18:30:50 -0000 1.3
***************
*** 21,26 ****
extern int _CbarSound(struct t_sound *s);
extern void _CbarDestroySound(struct t_sound *s);
! extern int _CbarCheckInternalSoundSettings(struct t_sound *s, int ok, const char*const*txt);
! extern int _CbarCheckExternalSoundSettings(struct t_sound *s, const char*const*txt);
extern struct t_dialsound *_CbarCreateDialSound(struct t_sound *s);
extern void _CbarDestroyDialSound(struct t_dialsound *ds);
--- 21,26 ----
extern int _CbarSound(struct t_sound *s);
extern void _CbarDestroySound(struct t_sound *s);
! extern int _CbarCheckInternalSoundSettings(struct t_sound *s, int ok);
! extern int _CbarCheckExternalSoundSettings(struct t_sound *s, const char *def);
extern struct t_dialsound *_CbarCreateDialSound(struct t_sound *s);
extern void _CbarDestroyDialSound(struct t_dialsound *ds);
Index: csound.t
===================================================================
RCS file: /cvsroot/cbar/cbar/src/csound.t,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** csound.t 27 Feb 2003 18:43:45 -0000 1.1.1.1
--- csound.t 7 Dec 2003 18:30:50 -0000 1.2
***************
*** 1,31 ****
! <language=en>
! [csound]
! BAD_VALUES_FREQ_DURATION_YES_KEEP_NO_SET_DEFAULT "You have entered bad values of frequencey(%d) or duration(%d). If you select 'Yes' they will be kept, else default values will be set. Do you want to keep them?|No|Yes"
! NO_SOUND_FILE_TO_SOUND_CARD_CLOSE "You have stated that the sound should be outputted to the external speakers, but not specified a name of the soundfile. The default file will be used.|Close"
! SPECIFIED_SOUND_FILE_NOT_FOUND_OR_NOT_LOADABLE_CLOSE "The specified sound object \"%s\" is corrupt and can not be loaded|Close"
! NO_VOLUME_TO_SOUND_CARD_CLOSE "You have entered 0 as volume to the sound-card, i.e. there will be no sound.|Close"
! SOUND_SAMPLE "Sound sample"
! LOAD_SOUND_FILE "Load sound file"
! SOUND_CHECK "Sound-test"
! FREQUENCE "Frequence"
! DURATION "Duration"
! SOUND_FILE "Sound file"
! VOLUME "Volume (0-255)"
! SELECT "Select"
!
! <language=se>
! [csound]
! BAD_VALUES_FREQ_DURATION_YES_KEEP_NO_SET_DEFAULT "Du har skrivit in orimliga värden på frekvens(%d) eller varaktighet(%d). Om du väljer 'Ja' behålls de annars sätts standardvärden. Vill du behålla värdena?|Nej|Ja"
! NO_SOUND_FILE_TO_SOUND_CARD_CLOSE "Du har angett att ljudet ska till högtalare via ljudkort men inte angett någon ljudfil. Standardfilen för ljud kommer att användas|Stäng"
! SPECIFIED_SOUND_FILE_NOT_FOUND_OR_NOT_LOADABLE_CLOSE "Det angivna ljudobjektet \"%s\" är felaktigt och kan inte laddas|Stäng"
! NO_VOLUME_TO_SOUND_CARD_CLOSE "Du har angett 0 i volym till ljudkortet, dvs. inget kommer att höras.|Stäng"
! SOUND_SAMPLE "Ljudfil"
! LOAD_SOUND_FILE "Välj ljudfil"
! SOUND_CHECK "Ljudtest"
! FREQUENCE "Tonhöjd (Hz)"
! DURATION "Varaktighet (ms)"
! SOUND_FILE "Ljudfil"
! VOLUME "Volym (0-255)"
! SELECT "Välj"
!
!
--- 1,46 ----
! <language=en>
! [csound]
! BAD_VALUES_FREQ_DURATION_KEEP_SETDEFAULT "You have entered bad values of "
! "frequencey(%d) or duration(%d). If "
! "you select 'Yes' they will be kept, "
! "else default values will be set. Do "
! "you want to keep them?|Keep|Set_default"
! NO_SOUND_FILE_TO_SOUND_CARD_CLOSE "You have stated that the sound should be outputted to the external speakers, but not specified a name of the soundfile. The default file will be used.|Close"
! SPECIFIED_SOUND_FILE_NOT_FOUND_OR_NOT_LOADABLE_CLOSE "The specified sound object \"%s\" is corrupt and can not be loaded|Close"
! NO_VOLUME_TO_SOUND_CARD_CLOSE "You have entered 0 as volume to the sound-card, i.e. there will be no sound.|Close"
! SOUND_SAMPLE "Sound sample"
! LOAD_SOUND_FILE "Load sound file"
! SOUND_CHECK "Sound-test"
! FREQUENCE "Frequence"
! DURATION "Duration"
! SOUND_FILE "Sound file"
! VOLUME "Volume (0-255)"
! SELECT "Select"
!
! <language=se>
! [csound]
! BAD_VALUES_FREQ_DURATION_KEEP_SETDEFAULT "Du har skrivit in orimliga värden "
! "på frekvens(%d) eller varaktighet"
! "(%d). Om du väljer 'Ja' behålls de "
! "annars sätts standardvärden. Vill "
! "du behålla värdena?|Behåll|Sätt_standardvärden"
! NO_SOUND_FILE_TO_SOUND_CARD_CLOSE "Du har angett att ljudet ska till "
! "högtalare via ljudkort men inte "
! "angett någon ljudfil. "
! "Standardfilen för ljud kommer att "
! "användas|Stäng"
! SPECIFIED_SOUND_FILE_NOT_FOUND_OR_NOT_LOADABLE_CLOSE "Det angivna ljudobjektet "
! "\"%s\" är felaktigt och kan inte "
! "laddas|Stäng"
! NO_VOLUME_TO_SOUND_CARD_CLOSE "Du har angett 0 i volym till ljudkortet, "
! "dvs. inget kommer att höras.|Stäng"
! SOUND_SAMPLE "Ljudfil"
! LOAD_SOUND_FILE "Välj ljudfil"
! SOUND_CHECK "Ljudtest"
! FREQUENCE "Tonhöjd (Hz)"
! DURATION "Varaktighet (ms)"
! SOUND_FILE "Ljudfil"
! VOLUME "Volym (0-255)"
! SELECT "Välj"
!
!
Index: unit.c
===================================================================
RCS file: /cvsroot/cbar/cbar/src/unit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** unit.c 29 Mar 2003 00:43:39 -0000 1.2
--- unit.c 7 Dec 2003 18:30:50 -0000 1.3
***************
*** 27,32 ****
#define UnitSection(str, i) sprintf(str, unit_section_name, i+1)
! #define defok ""
! #define deferr ""
static char *unit_section_name = "Bar-reader%d";
static char *unit_dbid_src = "Reader-connection";
--- 27,32 ----
#define UnitSection(str, i) sprintf(str, unit_section_name, i+1)
! #define defok "barok.wav"
! #define deferr "barerror.wav"
static char *unit_section_name = "Bar-reader%d";
static char *unit_dbid_src = "Reader-connection";
***************
*** 249,269 ****
{
t_unit *cbcu;
- const char*const*txt;
- int nr;
- txt = LoadCompiledTexts(cbar_labels, "unit", &nr);
- if (nr < SIZE_unit)
- return 0;
cbcu = du->cbcu;
if (cbcu->setting.intsound) {
! if (!_CbarCheckInternalSoundSettings(cbcu->ok, 1, txt))
return 0;
! if (!_CbarCheckInternalSoundSettings(cbcu->error, 0, txt))
return 0;
}
if (cbcu->setting.leftsound || cbcu->setting.rightsound) {
! if (!_CbarCheckExternalSoundSettings(cbcu->ok, txt))
return 0;
! if (!_CbarCheckExternalSoundSettings(cbcu->error, txt))
return 0;
}
--- 249,264 ----
{
t_unit *cbcu;
cbcu = du->cbcu;
if (cbcu->setting.intsound) {
! if (!_CbarCheckInternalSoundSettings(cbcu->ok, 1))
return 0;
! if (!_CbarCheckInternalSoundSettings(cbcu->error, 0))
return 0;
}
if (cbcu->setting.leftsound || cbcu->setting.rightsound) {
! if (!_CbarCheckExternalSoundSettings(cbcu->ok, defok))
return 0;
! if (!_CbarCheckExternalSoundSettings(cbcu->error, deferr))
return 0;
}
|