Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
a0726fa8
Commit
a0726fa8
authored
3 months ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Allow configuring audio output type
Compile-time isn't the best time for configuration.
parent
00eb3c1f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#7818
passed
3 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/syncterm/bbslist.c
+69
-20
69 additions, 20 deletions
src/syncterm/bbslist.c
src/syncterm/syncterm.c
+77
-0
77 additions, 0 deletions
src/syncterm/syncterm.c
src/syncterm/syncterm.h
+4
-0
4 additions, 0 deletions
src/syncterm/syncterm.h
with
150 additions
and
20 deletions
src/syncterm/bbslist.c
+
69
−
20
View file @
a0726fa8
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include
"uifcinit.h"
#include
"uifcinit.h"
#include
"vidmodes.h"
#include
"vidmodes.h"
#include
"window.h"
#include
"window.h"
#include
"xpbeep.h"
#if defined(__unix__) && defined(SOUNDCARD_H_IN) && (SOUNDCARD_H_IN > 0) && !defined(_WIN32)
#if defined(__unix__) && defined(SOUNDCARD_H_IN) && (SOUNDCARD_H_IN > 0) && !defined(_WIN32)
#if SOUNDCARD_H_IN==1
#if SOUNDCARD_H_IN==1
...
@@ -2138,15 +2139,47 @@ scale_to_settings(int i)
...
@@ -2138,15 +2139,47 @@ scale_to_settings(int i)
settings
.
extern_scale
=
(
i
&
2
)
?
true
:
false
;
settings
.
extern_scale
=
(
i
&
2
)
?
true
:
false
;
}
}
static
void
edit_audio_mode
(
str_list_t
*
inicontents
)
{
char
opts
[
10
][
80
];
char
*
opt
[
11
];
int
i
=
0
;
int
j
=
0
;
uifc
.
helpbuf
=
"`Audio Output Mode`
\n\n
"
" Options are tried in the order listed in the menu
\n
"
;
while
(
i
!=
-
1
)
{
for
(
i
=
0
;
audio_output_types
[
i
].
name
!=
NULL
;
i
++
)
{
SAFEPRINTF2
(
opts
[
i
],
"%-10.10s %s"
,
audio_output_types
[
i
].
name
,
(
xpbeep_sound_devices_enabled
&
audio_output_types
[
i
].
bit
)
?
"Yes"
:
"No"
);
opt
[
i
]
=
opts
[
i
];
}
opt
[
i
]
=
NULL
;
switch
(
i
=
uifc
.
list
(
WIN_SAV
,
0
,
0
,
0
,
&
j
,
NULL
,
"Audio Output Mode"
,
opt
))
{
case
-
1
:
check_exit
(
false
);
continue
;
default:
xpbeep_sound_devices_enabled
^=
audio_output_types
[
j
].
bit
;
iniSetBitField
(
inicontents
,
"SyncTERM"
,
"AudioModes"
,
audio_output_bits
,
xpbeep_sound_devices_enabled
,
&
ini_style
);
break
;
}
}
}
void
void
change_settings
(
int
connected
)
change_settings
(
int
connected
)
{
{
char
inipath
[
MAX_PATH
+
1
];
char
inipath
[
MAX_PATH
+
1
];
FILE
*
inifile
;
FILE
*
inifile
;
str_list_t
inicontents
;
str_list_t
inicontents
;
char
opts
[
1
3
][
1049
];
char
opts
[
1
4
][
1049
];
char
*
opt
[
1
4
];
char
*
opt
[
1
5
];
char
*
subopts
[
10
];
char
*
subopts
[
10
];
char
audio_opts
[
1024
];
int
i
,
j
,
k
,
l
;
int
i
,
j
,
k
,
l
;
char
str
[
64
];
char
str
[
64
];
int
cur
=
0
;
int
cur
=
0
;
...
@@ -2173,6 +2206,8 @@ change_settings(int connected)
...
@@ -2173,6 +2206,8 @@ change_settings(int connected)
" Set the initial screen screen mode/size.
\n\n
"
" Set the initial screen screen mode/size.
\n\n
"
"~ Video Output Mode ~
\n
"
"~ Video Output Mode ~
\n
"
" Set video output mode (used during startup).
\n\n
"
" Set video output mode (used during startup).
\n\n
"
"~ Audio Output Mode ~
\n
"
" Set audio output modes attempted.
\n\n
"
"~ Scrollback Buffer Lines ~
\n
"
"~ Scrollback Buffer Lines ~
\n
"
" The number of lines in the scrollback buffer.
\n\n
"
" The number of lines in the scrollback buffer.
\n\n
"
"~ Modem/Comm Device ~
\n
"
"~ Modem/Comm Device ~
\n
"
...
@@ -2195,22 +2230,33 @@ change_settings(int connected)
...
@@ -2195,22 +2230,33 @@ change_settings(int connected)
SAFEPRINTF
(
opts
[
1
],
"Prompt to Save %s"
,
settings
.
prompt_save
?
"Yes"
:
"No"
);
SAFEPRINTF
(
opts
[
1
],
"Prompt to Save %s"
,
settings
.
prompt_save
?
"Yes"
:
"No"
);
SAFEPRINTF
(
opts
[
2
],
"Startup Screen Mode %s"
,
screen_modes
[
settings
.
startup_mode
]);
SAFEPRINTF
(
opts
[
2
],
"Startup Screen Mode %s"
,
screen_modes
[
settings
.
startup_mode
]);
SAFEPRINTF
(
opts
[
3
],
"Video Output Mode %s"
,
output_descrs
[
settings
.
output_mode
]);
SAFEPRINTF
(
opts
[
3
],
"Video Output Mode %s"
,
output_descrs
[
settings
.
output_mode
]);
SAFEPRINTF
(
opts
[
4
],
"Scrollback Buffer Lines %d"
,
settings
.
backlines
);
audio_opts
[
0
]
=
0
;
SAFEPRINTF
(
opts
[
5
],
"Modem/Comm Device %s"
,
settings
.
mdm
.
device_name
);
for
(
j
=
0
;
audio_output_types
[
j
].
name
!=
NULL
;
j
++
)
{
if
(
xpbeep_sound_devices_enabled
&
audio_output_types
[
j
].
bit
)
{
if
(
audio_opts
[
0
])
strcat
(
audio_opts
,
", "
);
strcat
(
audio_opts
,
audio_output_types
[
j
].
name
);
}
}
if
(
!
audio_opts
[
0
])
strcpy
(
audio_opts
,
"<None>"
);
SAFEPRINTF
(
opts
[
4
],
"Audio Output Mode %s"
,
audio_opts
);
SAFEPRINTF
(
opts
[
5
],
"Scrollback Buffer Lines %d"
,
settings
.
backlines
);
SAFEPRINTF
(
opts
[
6
],
"Modem/Comm Device %s"
,
settings
.
mdm
.
device_name
);
if
(
settings
.
mdm
.
com_rate
)
if
(
settings
.
mdm
.
com_rate
)
sprintf
(
str
,
"%lubps"
,
settings
.
mdm
.
com_rate
);
sprintf
(
str
,
"%lubps"
,
settings
.
mdm
.
com_rate
);
else
else
strcpy
(
str
,
"Current"
);
strcpy
(
str
,
"Current"
);
SAFEPRINTF
(
opts
[
6
],
"Modem/Comm Rate %s"
,
str
);
SAFEPRINTF
(
opts
[
7
],
"Modem/Comm Rate %s"
,
str
);
SAFEPRINTF
(
opts
[
7
],
"Modem Init String %s"
,
settings
.
mdm
.
init_string
);
SAFEPRINTF
(
opts
[
8
],
"Modem Init String %s"
,
settings
.
mdm
.
init_string
);
SAFEPRINTF
(
opts
[
8
],
"Modem Dial String %s"
,
settings
.
mdm
.
dial_string
);
SAFEPRINTF
(
opts
[
9
],
"Modem Dial String %s"
,
settings
.
mdm
.
dial_string
);
SAFEPRINTF
(
opts
[
9
],
"List Path %s"
,
settings
.
stored_list_path
);
SAFEPRINTF
(
opts
[
10
],
"List Path %s"
,
settings
.
stored_list_path
);
SAFEPRINTF
(
opts
[
1
0
],
"TERM For Shell %s"
,
settings
.
TERM
);
SAFEPRINTF
(
opts
[
1
1
],
"TERM For Shell %s"
,
settings
.
TERM
);
sprintf
(
opts
[
1
1
],
"Scaling %s"
,
scaling_names
[
settings_to_scale
()]);
sprintf
(
opts
[
1
2
],
"Scaling %s"
,
scaling_names
[
settings_to_scale
()]);
if
(
connected
)
if
(
connected
)
opt
[
1
2
]
=
NULL
;
opt
[
1
3
]
=
NULL
;
else
else
sprintf
(
opts
[
1
2
],
"Custom Screen Mode"
);
sprintf
(
opts
[
1
3
],
"Custom Screen Mode"
);
switch
(
uifc
.
list
(
WIN_MID
|
WIN_SAV
|
WIN_ACT
,
0
,
0
,
0
,
&
cur
,
NULL
,
"Program Settings"
,
opt
))
{
switch
(
uifc
.
list
(
WIN_MID
|
WIN_SAV
|
WIN_ACT
,
0
,
0
,
0
,
&
cur
,
NULL
,
"Program Settings"
,
opt
))
{
case
-
1
:
case
-
1
:
check_exit
(
false
);
check_exit
(
false
);
...
@@ -2323,6 +2369,9 @@ change_settings(int connected)
...
@@ -2323,6 +2369,9 @@ change_settings(int connected)
}
}
break
;
break
;
case
4
:
case
4
:
edit_audio_mode
(
&
inicontents
);
break
;
case
5
:
uifc
.
helpbuf
=
"`Scrollback Buffer Lines`
\n\n
"
uifc
.
helpbuf
=
"`Scrollback Buffer Lines`
\n\n
"
" The number of lines in the scrollback buffer.
\n
"
" The number of lines in the scrollback buffer.
\n
"
" This value MUST be greater than zero
\n
"
;
" This value MUST be greater than zero
\n
"
;
...
@@ -2362,7 +2411,7 @@ change_settings(int connected)
...
@@ -2362,7 +2411,7 @@ change_settings(int connected)
else
else
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
5
:
case
6
:
uifc
.
helpbuf
=
"`Modem/Comm Device`
\n\n
"
uifc
.
helpbuf
=
"`Modem/Comm Device`
\n\n
"
"Enter the name of the device used to communicate with the modem.
\n\n
"
"Enter the name of the device used to communicate with the modem.
\n\n
"
"Example:
\"
`"
"Example:
\"
`"
...
@@ -2379,7 +2428,7 @@ change_settings(int connected)
...
@@ -2379,7 +2428,7 @@ change_settings(int connected)
else
else
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
6
:
case
7
:
uifc
.
helpbuf
=
"`Modem/Comm Rate`
\n\n
"
uifc
.
helpbuf
=
"`Modem/Comm Rate`
\n\n
"
"Enter the rate (in `bits-per-second`) used to communicate with the modem.
\n
"
"Enter the rate (in `bits-per-second`) used to communicate with the modem.
\n
"
"Use the highest `DTE Rate` supported by your communication port and modem.
\n\n
"
"Use the highest `DTE Rate` supported by your communication port and modem.
\n\n
"
...
@@ -2399,7 +2448,7 @@ change_settings(int connected)
...
@@ -2399,7 +2448,7 @@ change_settings(int connected)
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
7
:
case
8
:
uifc
.
helpbuf
=
"`Modem Init String`
\n\n
"
uifc
.
helpbuf
=
"`Modem Init String`
\n\n
"
"Your modem initialization string goes here.
\n\n
"
"Your modem initialization string goes here.
\n\n
"
"Example:
\n
"
"Example:
\n
"
...
@@ -2430,7 +2479,7 @@ change_settings(int connected)
...
@@ -2430,7 +2479,7 @@ change_settings(int connected)
else
else
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
8
:
case
9
:
uifc
.
helpbuf
=
"`Modem Dial String`
\n\n
"
uifc
.
helpbuf
=
"`Modem Dial String`
\n\n
"
"The command string to dial the modem goes here.
\n\n
"
"The command string to dial the modem goes here.
\n\n
"
"Example:
\"
`ATDT`
\"
will dial a Hayes-compatible modem in touch-tone mode."
;
"Example:
\"
`ATDT`
\"
will dial a Hayes-compatible modem in touch-tone mode."
;
...
@@ -2445,7 +2494,7 @@ change_settings(int connected)
...
@@ -2445,7 +2494,7 @@ change_settings(int connected)
else
else
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
9
:
case
10
:
uifc
.
helpbuf
=
"`List Path`
\n\n
"
uifc
.
helpbuf
=
"`List Path`
\n\n
"
"The complete path to the BBS list goes here.
\n
"
;
"The complete path to the BBS list goes here.
\n
"
;
if
(
uifc
.
input
(
WIN_MID
|
WIN_SAV
,
0
,
0
,
"List Path"
,
settings
.
stored_list_path
,
MAX_PATH
,
if
(
uifc
.
input
(
WIN_MID
|
WIN_SAV
,
0
,
0
,
"List Path"
,
settings
.
stored_list_path
,
MAX_PATH
,
...
@@ -2461,7 +2510,7 @@ change_settings(int connected)
...
@@ -2461,7 +2510,7 @@ change_settings(int connected)
else
else
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
1
0
:
case
1
1
:
uifc
.
helpbuf
=
"`TERM For Shell`
\n\n
"
uifc
.
helpbuf
=
"`TERM For Shell`
\n\n
"
"The value to set the TERM envirnonment variable to goes here.
\n\n
"
"The value to set the TERM envirnonment variable to goes here.
\n\n
"
"Example:
\"
`ansi`
\"
will select a dumb ANSI mode."
;
"Example:
\"
`ansi`
\"
will select a dumb ANSI mode."
;
...
@@ -2471,7 +2520,7 @@ change_settings(int connected)
...
@@ -2471,7 +2520,7 @@ change_settings(int connected)
else
else
check_exit
(
false
);
check_exit
(
false
);
break
;
break
;
case
1
1
:
case
1
2
:
i
=
settings_to_scale
();
i
=
settings_to_scale
();
i
++
;
i
++
;
if
(
i
==
3
)
if
(
i
==
3
)
...
@@ -2486,7 +2535,7 @@ change_settings(int connected)
...
@@ -2486,7 +2535,7 @@ change_settings(int connected)
cio_api
.
options
&=
~
CONIO_OPT_BLOCKY_SCALING
;
cio_api
.
options
&=
~
CONIO_OPT_BLOCKY_SCALING
;
setscaling_type
(
settings
.
extern_scale
?
CIOLIB_SCALING_EXTERNAL
:
CIOLIB_SCALING_INTERNAL
);
setscaling_type
(
settings
.
extern_scale
?
CIOLIB_SCALING_EXTERNAL
:
CIOLIB_SCALING_INTERNAL
);
break
;
break
;
case
1
2
:
case
1
3
:
uifc
.
helpbuf
=
"`Custom Screen Mode`
\n\n
"
uifc
.
helpbuf
=
"`Custom Screen Mode`
\n\n
"
"~ Rows ~
\n
"
"~ Rows ~
\n
"
" Sets the number of rows in the custom screen mode
\n
"
" Sets the number of rows in the custom screen mode
\n
"
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/syncterm.c
+
77
−
0
View file @
a0726fa8
...
@@ -86,6 +86,7 @@ enum {
...
@@ -86,6 +86,7 @@ enum {
#include
"term.h"
#include
"term.h"
#include
"uifcinit.h"
#include
"uifcinit.h"
#include
"window.h"
#include
"window.h"
#include
"xpbeep.h"
const
char
*
syncterm_version
=
"SyncTERM 1.4b"
const
char
*
syncterm_version
=
"SyncTERM 1.4b"
...
@@ -868,6 +869,80 @@ char *output_enum[] = {
...
@@ -868,6 +869,80 @@ char *output_enum[] = {
NULL
NULL
};
};
ini_bitdesc_t
audio_output_bits
[]
=
{
{
.
name
=
"PulseAudio"
,
.
bit
=
XPBEEP_DEVICE_PULSEAUDIO
},
{
.
name
=
"PortAudio"
,
.
bit
=
XPBEEP_DEVICE_PORTAUDIO
},
{
.
name
=
"SDL"
,
.
bit
=
XPBEEP_DEVICE_SDL
},
{
.
name
=
"WaveOut"
,
.
bit
=
XPBEEP_DEVICE_WIN32
},
{
.
name
=
"ALSA"
,
.
bit
=
XPBEEP_DEVICE_ALSA
},
{
.
name
=
"OSS"
,
.
bit
=
XPBEEP_DEVICE_OSS
},
{
.
name
=
NULL
,
.
bit
=
0
},
};
ini_bitdesc_t
audio_output_types
[]
=
{
#ifdef WITH_PULSEAUDIO
{
.
name
=
"PulseAudio"
,
.
bit
=
XPBEEP_DEVICE_PULSEAUDIO
},
#endif
#ifdef WITH_PORTAUDIO
{
.
name
=
"PortAudio"
,
.
bit
=
XPBEEP_DEVICE_PORTAUDIO
},
#endif
#ifdef WITH_SDL_AUDIO
{
.
name
=
"SDL"
,
.
bit
=
XPBEEP_DEVICE_SDL
},
#endif
#ifdef _WIN32
{
.
name
=
"WaveOut"
,
.
bit
=
XPBEEP_DEVICE_WIN32
},
#endif
#ifdef USE_ALSA_SOUND
{
.
name
=
"ALSA"
,
.
bit
=
XPBEEP_DEVICE_ALSA
},
#endif
#if (defined SOUNDCARD_H_IN) && (SOUNDCARD_H_IN > 0) && (defined AFMT_U8)
{
.
name
=
"OSS"
,
.
bit
=
XPBEEP_DEVICE_OSS
},
#endif
{
.
name
=
NULL
,
.
bit
=
0
},
};
bool
bool
check_exit
(
bool
force
)
check_exit
(
bool
force
)
{
{
...
@@ -1418,6 +1493,7 @@ load_settings(struct syncterm_settings *set)
...
@@ -1418,6 +1493,7 @@ load_settings(struct syncterm_settings *set)
set
->
startup_mode
=
iniReadEnum
(
inifile
,
"SyncTERM"
,
"VideoMode"
,
screen_modes_enum
,
SCREEN_MODE_CURRENT
);
set
->
startup_mode
=
iniReadEnum
(
inifile
,
"SyncTERM"
,
"VideoMode"
,
screen_modes_enum
,
SCREEN_MODE_CURRENT
);
set
->
startup_mode
=
iniReadEnum
(
inifile
,
"SyncTERM"
,
"ScreenMode"
,
screen_modes_enum
,
set
->
startup_mode
);
set
->
startup_mode
=
iniReadEnum
(
inifile
,
"SyncTERM"
,
"ScreenMode"
,
screen_modes_enum
,
set
->
startup_mode
);
set
->
output_mode
=
iniReadEnum
(
inifile
,
"SyncTERM"
,
"OutputMode"
,
output_enum
,
CIOLIB_MODE_AUTO
);
set
->
output_mode
=
iniReadEnum
(
inifile
,
"SyncTERM"
,
"OutputMode"
,
output_enum
,
CIOLIB_MODE_AUTO
);
set
->
audio_output_modes
=
iniReadBitField
(
inifile
,
"SyncTERM"
,
"AudioModes"
,
audio_output_bits
,
XPBEEP_DEVICE_DEFAULT
);
set
->
backlines
=
iniReadInteger
(
inifile
,
"SyncTERM"
,
"ScrollBackLines"
,
2000
);
set
->
backlines
=
iniReadInteger
(
inifile
,
"SyncTERM"
,
"ScrollBackLines"
,
2000
);
set
->
xfer_success_keypress_timeout
=
iniReadInteger
(
inifile
,
set
->
xfer_success_keypress_timeout
=
iniReadInteger
(
inifile
,
"SyncTERM"
,
"SyncTERM"
,
...
@@ -1716,6 +1792,7 @@ main(int argc, char **argv)
...
@@ -1716,6 +1792,7 @@ main(int argc, char **argv)
ciolib_initial_program_name
=
"syncterm"
;
ciolib_initial_program_name
=
"syncterm"
;
ciolib_initial_program_class
=
"SyncTERM"
;
ciolib_initial_program_class
=
"SyncTERM"
;
ciolib_mode
=
settings
.
output_mode
;
ciolib_mode
=
settings
.
output_mode
;
xpbeep_sound_devices_enabled
=
settings
.
audio_output_modes
;
if
(
settings
.
startup_mode
!=
SCREEN_MODE_CURRENT
)
if
(
settings
.
startup_mode
!=
SCREEN_MODE_CURRENT
)
text_mode
=
screen_to_ciolib
(
settings
.
startup_mode
);
text_mode
=
screen_to_ciolib
(
settings
.
startup_mode
);
else
else
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/syncterm.h
+
4
−
0
View file @
a0726fa8
...
@@ -80,8 +80,12 @@ struct syncterm_settings {
...
@@ -80,8 +80,12 @@ struct syncterm_settings {
int
left_just
;
int
left_just
;
int
blocky
;
int
blocky
;
int
extern_scale
;
int
extern_scale
;
uint
audio_output_modes
;
};
};
extern
ini_bitdesc_t
audio_output_bits
[];
extern
ini_bitdesc_t
audio_output_types
[];
extern
char
*
inpath
;
extern
char
*
inpath
;
extern
char
*
list_override
;
extern
char
*
list_override
;
extern
const
char
*
syncterm_version
;
extern
const
char
*
syncterm_version
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment