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
00eb3c1f
Commit
00eb3c1f
authored
4 months ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Allow controlling sound output types with a global.
parent
7c614b63
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/xpbeep.c
+213
-200
213 additions, 200 deletions
src/xpdev/xpbeep.c
src/xpdev/xpbeep.h
+8
-0
8 additions, 0 deletions
src/xpdev/xpbeep.h
with
221 additions
and
200 deletions
src/xpdev/xpbeep.c
+
213
−
200
View file @
00eb3c1f
...
@@ -111,6 +111,7 @@ enum {
...
@@ -111,6 +111,7 @@ enum {
static
int
handle_type
=
SOUND_DEVICE_CLOSED
;
static
int
handle_type
=
SOUND_DEVICE_CLOSED
;
static
int
handle_rc
;
static
int
handle_rc
;
uint32_t
xpbeep_sound_devices_enabled
=
XPBEEP_DEVICE_DEFAULT
;
#ifdef WITH_PULSEAUDIO
#ifdef WITH_PULSEAUDIO
struct
pulseaudio_api_struct
{
struct
pulseaudio_api_struct
{
...
@@ -402,6 +403,7 @@ xptone_open_locked(void)
...
@@ -402,6 +403,7 @@ xptone_open_locked(void)
}
}
#ifdef WITH_PULSEAUDIO
#ifdef WITH_PULSEAUDIO
if
(
xpbeep_sound_devices_enabled
&
XPBEEP_DEVICE_PULSEAUDIO
)
{
if
(
!
pulseaudio_device_open_failed
)
{
if
(
!
pulseaudio_device_open_failed
)
{
if
(
pu_api
==
NULL
)
{
if
(
pu_api
==
NULL
)
{
const
char
*
libnames
[]
=
{
"pulse-simple"
,
NULL
};
const
char
*
libnames
[]
=
{
"pulse-simple"
,
NULL
};
...
@@ -441,9 +443,11 @@ xptone_open_locked(void)
...
@@ -441,9 +443,11 @@ xptone_open_locked(void)
}
}
}
}
}
}
}
#endif
#endif
#ifdef WITH_PORTAUDIO
#ifdef WITH_PORTAUDIO
if
(
xpbeep_sound_devices_enabled
&
XPBEEP_DEVICE_PORTAUDIO
)
{
if
(
!
portaudio_device_open_failed
)
{
if
(
!
portaudio_device_open_failed
)
{
if
(
pa_api
==
NULL
)
{
if
(
pa_api
==
NULL
)
{
const
char
*
libnames
[]
=
{
"portaudio"
,
NULL
};
const
char
*
libnames
[]
=
{
"portaudio"
,
NULL
};
...
@@ -509,9 +513,11 @@ xptone_open_locked(void)
...
@@ -509,9 +513,11 @@ xptone_open_locked(void)
}
}
}
}
}
}
}
#endif
#endif
#ifdef WITH_SDL_AUDIO
#ifdef WITH_SDL_AUDIO
if
(
xpbeep_sound_devices_enabled
&
XPBEEP_DEVICE_SDL
)
{
if
(
!
sdl_device_open_failed
)
{
if
(
!
sdl_device_open_failed
)
{
if
(
init_sdl_audio
()
==
-
1
)
{
if
(
init_sdl_audio
()
==
-
1
)
{
sdl_device_open_failed
=
true
;
sdl_device_open_failed
=
true
;
...
@@ -538,9 +544,11 @@ xptone_open_locked(void)
...
@@ -538,9 +544,11 @@ xptone_open_locked(void)
}
}
}
}
}
}
}
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
if
(
xpbeep_sound_devices_enabled
&
XPBEEP_DEVICE_WIN32
)
{
if
(
!
sound_device_open_failed
)
{
if
(
!
sound_device_open_failed
)
{
w
.
wFormatTag
=
WAVE_FORMAT_PCM
;
w
.
wFormatTag
=
WAVE_FORMAT_PCM
;
w
.
nChannels
=
1
;
w
.
nChannels
=
1
;
...
@@ -562,9 +570,11 @@ xptone_open_locked(void)
...
@@ -562,9 +570,11 @@ xptone_open_locked(void)
return
true
;
return
true
;
}
}
}
}
}
#endif
#endif
#ifdef USE_ALSA_SOUND
#ifdef USE_ALSA_SOUND
if
(
xpbeep_sound_devices_enabled
&
XPBEEP_DEVICE_ALSA
)
{
if
(
!
alsa_device_open_failed
)
{
if
(
!
alsa_device_open_failed
)
{
if
(
alsa_api
==
NULL
)
{
if
(
alsa_api
==
NULL
)
{
const
char
*
libnames
[]
=
{
"asound"
,
NULL
};
const
char
*
libnames
[]
=
{
"asound"
,
NULL
};
...
@@ -620,9 +630,11 @@ xptone_open_locked(void)
...
@@ -620,9 +630,11 @@ xptone_open_locked(void)
}
}
}
}
}
}
}
#endif
#endif
#ifdef AFMT_U8
#ifdef AFMT_U8
if
(
xpbeep_sound_devices_enabled
&
XPBEEP_DEVICE_OSS
)
{
if
(
!
sound_device_open_failed
)
{
if
(
!
sound_device_open_failed
)
{
if
((
dsp
=
open
(
"/dev/dsp"
,
O_WRONLY
,
0
))
<
0
)
{
if
((
dsp
=
open
(
"/dev/dsp"
,
O_WRONLY
,
0
))
<
0
)
{
sound_device_open_failed
=
true
;
sound_device_open_failed
=
true
;
...
@@ -651,6 +663,7 @@ xptone_open_locked(void)
...
@@ -651,6 +663,7 @@ xptone_open_locked(void)
handle_rc
++
;
handle_rc
++
;
return
true
;
return
true
;
}
}
}
#endif
#endif
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/xpbeep.h
+
8
−
0
View file @
00eb3c1f
...
@@ -30,6 +30,14 @@ enum WAVE_SHAPE {
...
@@ -30,6 +30,14 @@ enum WAVE_SHAPE {
,
WAVE_SHAPE_SINE_SAW_HARM
,
WAVE_SHAPE_SINE_SAW_HARM
};
};
#define XPBEEP_DEVICE_WIN32 (1U<<0)
#define XPBEEP_DEVICE_ALSA (1U<<1)
#define XPBEEP_DEVICE_OSS (1U<<2)
#define XPBEEP_DEVICE_SDL (1U<<3)
#define XPBEEP_DEVICE_PORTAUDIO (1U<<4)
#define XPBEEP_DEVICE_PULSEAUDIO (1U<<5)
#define XPBEEP_DEVICE_DEFAULT (XPBEEP_DEVICE_WIN32 | XPBEEP_DEVICE_ALSA | XPBEEP_DEVICE_OSS | XPBEEP_DEVICE_PORTAUDIO | XPBEEP_DEVICE_PULSEAUDIO)
extern
uint32_t
xpbeep_sound_devices_enabled
;
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
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