Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wolf3d
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
wolf3d
Commits
2757f756
Commit
2757f756
authored
Apr 30, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial (very hackish) OpenAL Support.
parent
c030b94b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
7 deletions
+84
-7
sd_comm.h
src/sd_comm.h
+0
-1
sd_oal.c
src/sd_oal.c
+83
-4
wl_debug.c
src/wl_debug.c
+1
-2
No files found.
src/sd_comm.h
View file @
2757f756
...
...
@@ -135,7 +135,6 @@ extern boolean SD_MusicPlaying(void),
extern
word
SD_SoundPlaying
(
void
);
extern
void
SD_SetDigiDevice
(
SDSMode
),
SD_PlayDigitized
(
word
which
,
int
leftpos
,
int
rightpos
),
SD_StopDigitized
(
void
),
SD_Poll
(
void
);
...
...
src/sd_oal.c
View file @
2757f756
...
...
@@ -70,6 +70,8 @@ static word sqMode,sqFadeStep;
/* ------------------------------------------------------------------------ */
ALuint
*
sources
;
ALuint
*
buffers
;
void
*
cc
;
void
SD_StopDigitized
(
void
)
...
...
@@ -84,10 +86,6 @@ void SD_SetPosition(int leftpos,int rightpos)
{
}
void
SD_PlayDigitized
(
word
which
,
int
leftpos
,
int
rightpos
)
{
}
void
SD_SetDigiDevice
(
SDSMode
mode
)
{
}
...
...
@@ -122,14 +120,86 @@ boolean SD_SetMusicMode(SMMode mode)
///////////////////////////////////////////////////////////////////////////
void
SD_Startup
(
void
)
{
int
i
;
if
(
SD_Started
)
return
;
for
(
i
=
0
;
i
<
LASTSOUND
;
i
++
)
DigiMap
[
i
]
=
-
1
;
cc
=
alcCreateContext
(
NULL
);
if
(
cc
==
NULL
)
printf
(
"alcCreateContext failed..
\n
"
);
else
{
word
*
SoundList
=
PM_GetPage
(
ChunksInFile
-
1
);
PageListStruct
*
page
=
&
PMPages
[
ChunksInFile
-
1
];
int
p
=
page
->
length
;
int
x
=
0
,
w
,
y
,
z
;
for
(
i
=
0
;
i
<
p
/
2
;
i
+=
2
)
{
w
=
*
(
SoundList
+
i
);
y
=
*
(
SoundList
+
i
+
1
);
page
=
&
PMPages
[
w
+
PMSoundStart
];
if
(
page
->
length
==
0
)
{
x
++
;
// count it?
continue
;
}
for
(
z
=
0
;
z
<
y
;
w
++
,
z
++
)
{
page
=
&
PMPages
[
w
+
PMSoundStart
];
z
+=
page
->
length
;
}
x
++
;
}
buffers
=
(
ALuint
*
)
malloc
(
sizeof
(
ALuint
)
*
x
);
if
(
alGenBuffers
(
x
,
buffers
)
!=
x
)
printf
(
"OpenAL buffer allocation problem
\n
"
);
x
=
0
;
for
(
i
=
0
;
i
<
p
/
2
;
i
+=
2
)
{
byte
*
dat
;
w
=
*
(
SoundList
+
i
);
y
=
*
(
SoundList
+
i
+
1
);
page
=
&
PMPages
[
w
+
PMSoundStart
];
if
(
page
->
length
==
0
)
{
x
++
;
// count it?
continue
;
}
if
(
y
==
0
){
printf
(
"wtf?
\n
"
);
continue
;
}
dat
=
(
byte
*
)
malloc
(
y
);
for
(
z
=
0
;
z
<
y
;
w
++
)
{
page
=
&
PMPages
[
w
+
PMSoundStart
];
memcpy
(
dat
+
z
,
PM_GetPage
(
w
+
PMSoundStart
),
page
->
length
);
z
+=
page
->
length
;
}
alBufferData
(
buffers
[
x
],
AL_FORMAT_MONO8
,
dat
,
y
,
6896
);
if
(
alGetError
()
!=
AL_NO_ERROR
)
{
printf
(
"AL error
\n
"
);
}
free
(
dat
);
x
++
;
}
sources
=
(
ALuint
*
)
malloc
(
sizeof
(
ALuint
)
*
1
);
alGenSources
(
1
,
sources
);
}
SD_Started
=
true
;
}
...
...
@@ -178,6 +248,15 @@ boolean SD_PlaySound(soundnames sound)
boolean
ispos
;
int
lp
,
rp
;
printf
(
"Playing sound %d, digimap %d
\n
"
,
sound
,
DigiMap
[
sound
]);
fflush
(
stdout
);
if
(
DigiMap
[
sound
]
!=
-
1
)
{
alSourceStop
(
*
sources
);
alSourcei
(
*
sources
,
AL_BUFFER
,
buffers
[
DigiMap
[
sound
]]);
alSourcePlay
(
*
sources
);
}
lp
=
LeftPosition
;
rp
=
RightPosition
;
LeftPosition
=
0
;
...
...
src/wl_debug.c
View file @
2757f756
...
...
@@ -248,8 +248,7 @@ static char buf[10];
PM_GetPage(j);
break;
case sc_P:
// if (sound != -1)
// SD_PlayDigitized(sound);
/* TODO: this would play the current digital sound */
break;
case sc_Escape:
done = true;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment