Compare commits

...

54 Commits

Author SHA1 Message Date
Andrew Greenwood
3d740a5070 Amendments to file headings (corrected paths mainly). No code changes.
svn path=/branches/silverblade-audio/; revision=38528
2009-01-03 11:19:21 +00:00
Andrew Greenwood
85d82c29f2 Removed duplicate (and incorrectly-typed) return statement. Thanks to
GedMurphy for spotting this.


svn path=/branches/silverblade-audio/; revision=38526
2009-01-03 11:06:56 +00:00
Andrew Greenwood
a1acef587a Started implementing WAVEHDR prepare/unprepare/submit routines (they call
the function table entries, nothing is on the other end). Also re-worked my
previous streaming thread code to operate on a per-device-instance basis and
tested the new implementation is capable of dispatching requests properly.


svn path=/branches/silverblade-audio/; revision=38520
2009-01-03 07:15:48 +00:00
Andrew Greenwood
f4cf76fcb5 Implemented device instance tracking list. Also fixed problem with NULL
initialisation of the function table.


svn path=/branches/silverblade-audio/; revision=38519
2009-01-03 05:20:07 +00:00
Andrew Greenwood
975fdd5150 Implemented callback mechanism, wired this up to the wave device opening and
closing routines. Media Player on Windows NT can now open and close the
device and will exit properly, letting go of the device now.


svn path=/branches/silverblade-audio/; revision=38516
2009-01-03 01:59:50 +00:00
Andrew Greenwood
3bf89b33ad Move MME interface-wrapping code into its own file (mmewrap.c), implement
device closure code. Still need to list/unlist instances but for now this
seems to work.


svn path=/branches/silverblade-audio/; revision=38515
2009-01-03 01:23:15 +00:00
Andrew Greenwood
d2f56b3c9e Split NT4-specific part of MME-Buddy off into its own support library (using
NT4 audio driver IOCTLs for unspecified functions was a stupid idea.)
Reimplemented routines for querying wave format, setting wave format, and
opening/closing devices. The new implementation can cater for multiple
instances of a sound device.


svn path=/branches/silverblade-audio/; revision=38514
2009-01-03 00:36:19 +00:00
Andrew Greenwood
72b2d5b752 Misc. code changes I forgot to commit previously. Just wanted to get this into
the branch before I do more work on this.


svn path=/branches/silverblade-audio/; revision=38412
2008-12-28 10:53:31 +00:00
Andrew Greenwood
c08cf6ca11 Reimplemented sound device capabilities retrieval. "Multimedia" control
panel applet on Windows NT4 calls our sndblst.dll which in turn retrieves
capabilities about the appropriate sound device and fills in the device
name, which the applet displays.


svn path=/branches/silverblade-audio/; revision=34612
2008-07-20 19:24:21 +00:00
Andrew Greenwood
b515847ba7 Re-implemented the device list. Separated allocation/init and cleanup/free
of sound device information from the insertion into/removal from the list.
Got debug output working in NT4 so this no longer plasters message boxes all
over the screen or outputs to command prompt window. "Multimedia" control
panel applet in NT4 happily loads and unloads this component, but since the
device count is reported but no device names, it doesn't do much more than
this.

Previously, debugging these components was quite awkward as the only debug
output I could get was via popup messages or spat out to the command prompt
window via printf, meaning if I had no console window (such is the case when
using a Windows program to interact with the sound device) I'd get less debug
info and would have to keep clicking OK to continue. Then it'd crash.

Now that NT4 is becoming friends with my sndblst.dll implementation (and the
support library I'm developing) and debug info is output to something I can
scroll through etc. things should be a bit easier.



svn path=/branches/silverblade-audio/; revision=34599
2008-07-20 04:20:29 +00:00
Andrew Greenwood
fc38a68eef Beginning of MME audio support rewrite. Made the message entrypoints
thread-safe. Refactored parts of the code, in particular the device I/O
handling. Uniformly implemented the GETNUMDEVS message for all device
types (wave/midi/mixer/aux). Pops up message boxes for each device found.
Tested on NT4. Removed lots of redundant debug code.


svn path=/branches/silverblade-audio/; revision=34595
2008-07-19 22:17:17 +00:00
Andrew Greenwood
cdf612941b Starting again (existing code backed-up and will be used as a reference for
the new re-write).


svn path=/branches/silverblade-audio/; revision=34587
2008-07-19 11:02:19 +00:00
Andrew Greenwood
8fa594e203 Various changes/tweaks. There are a few nasty issues due to the way the
library is presently implemented (deadlocking, unexpected I/O
completions, hacky debug code...) so after this commit I intend on
rewriting a majority of the code to make it cleaner and less hacky over
the next few days.

(hax equals code calories, which in turn equals fat and unstable)



svn path=/branches/silverblade-audio/; revision=34571
2008-07-17 22:44:47 +00:00
Andrew Greenwood
8648d53f03 Implemented WOM_OPEN, WOM_DONE and WOM_CLOSE callbacks. Added missing prototype
of DriverCallback to digitalv.h in the PSDK (as per MSDN). Looped buffers aren't
meant to be marked "done" until all loops are finished. But even then, NT4's own
sndblst.dll seems to horde looped buffers if we break out of the loop. (Give the
damn things back!) So, don't expect WOM_DONE from looped buffers.

MSDN states that you shouldn't call any wave functions within the wave callback,
or a deadlock will occur. Since buffer submission is dealt with inside the
streaming thread, as is the callback, this situation holds true for my
implementation.

Things are almost at a state now where it may be possible to drop this in-place
of the original sndblst.dll on an NT4 installation and have it function for wave
audio playback. But there are still issues to be sorted out.


svn path=/branches/silverblade-audio/; revision=34538
2008-07-15 22:42:34 +00:00
Andrew Greenwood
743bbcdb39 Corrected wave output device close routine to ensure the device is "idle"
rather than "stopped" (which actually means playback is paused...) Also
added code to the I/O completion routine to detect when a submitted WAVEHDR
from the client application has finished being played. No WAVEHDRs are
returned to the client application (yet...)


svn path=/branches/silverblade-audio/; revision=34534
2008-07-15 20:43:32 +00:00
Andrew Greenwood
e6b1b858ef Implemented WODM_BREAKLOOP (as used by waveOutBreakLoop). When playback is
occurring between a buffer marked with WHDR_BEGINLOOP and a buffer marked
with WHDR_ENDLOOP and this is called, the "remaining loops" counter is set
to zero so that when the end buffer of the loop is reached, looping does not
occur.


svn path=/branches/silverblade-audio/; revision=34512
2008-07-14 22:52:11 +00:00
Andrew Greenwood
87752494ae Added some more cases to wodMessage (wave out message handler). Also made the
WODM_CLOSE message return WAVERR_STILLPLAYING in the case where an application
tries to close a sound device before sending a WODM_RESET to stop it.


svn path=/branches/silverblade-audio/; revision=34510
2008-07-14 22:35:26 +00:00
Andrew Greenwood
4aa787161b Implemented support for buffer looping (WHDR_BEGINLOOP and WHDR_ENDLOOP of the
WAVEHDR structure.) I had a feeling this was going to be very nasty to
implement, but it was actually very easy. Resolved infinite loop where the same
buffer is used for the beginning and end, tested with varying numbers of loops.
Not sure if dwLoops=1 means play buffer twice as dwLoops=0 means play once through.


svn path=/branches/silverblade-audio/; revision=34509
2008-07-14 22:06:03 +00:00
Andrew Greenwood
816c49636f Partially implemented wave output reset (WODM_RESET) which sends a request to
the device to stop playing and (for now) drops the current buffer, which stops
the streaming mechanism from doing anything further. This will need to be done
more cleanly later. Think I've also fixed the bug where it was crashing on
exit.


svn path=/branches/silverblade-audio/; revision=34478
2008-07-13 23:32:00 +00:00
Andrew Greenwood
3bd7c85d28 Implemented functions required to make wave playback pause and resume function
(WODM_PAUSE and WODM_RESTART) using IOCTL_WAVE_SET_STATE. Modified internal
I/O control routine to deal with the fact the device does overlapped I/O.
Verified pause/resume functions, however there is a crash on exit if all
audio buffers are exhausted by the time WODM_CLOSE is issued.


svn path=/branches/silverblade-audio/; revision=34475
2008-07-13 22:53:53 +00:00
Andrew Greenwood
8e60614d1e Made parameter checks macro-based, and added other validation and debugging
code. Basically a code tidy-up with some additional code to prevent/detect
bugs.


svn path=/branches/silverblade-audio/; revision=34468
2008-07-13 20:48:50 +00:00
Andrew Greenwood
47ad3fa6a5 Store the open device handle in the instance structure rather than the device
structure, to allow devices to be opened multiple times.


svn path=/branches/silverblade-audio/; revision=34462
2008-07-13 16:26:02 +00:00
Andrew Greenwood
28f984948a Started implementing wave stream state checking/controlling (eg play/stop).
svn path=/branches/silverblade-audio/; revision=34459
2008-07-13 13:22:54 +00:00
Andrew Greenwood
bfa298f4cf Structural and formatting changes only. Moved all device-type-specific code
including MME entrypoint routines into relevantly-named directories and split
a few functions from files where they didn't really belong. Changed formatting
of comments at top of my source and header files to be the same as described
on the ReactOS wiki.


svn path=/branches/silverblade-audio/; revision=34440
2008-07-12 21:44:10 +00:00
Andrew Greenwood
b0945897d0 Having changed all the code to use DPRINT and subsequently DbgPrint, it
transpires that Win NT4 does not support the use of these functions in
user-mode, rendering them pretty much useless to me. Reverted to spewing
out macro'd printfs instead, so it shouldn't be hard to change the
debug output method when these components finally make it over to ReactOS.


svn path=/branches/silverblade-audio/; revision=34432
2008-07-12 00:49:34 +00:00
Andrew Greenwood
18508e78dd Removed custom debug printing macros and replaced with DPRINTs.
svn path=/branches/silverblade-audio/; revision=34431
2008-07-11 23:45:12 +00:00
Andrew Greenwood
805de20c77 Fixed bug that was causing crash when no more buffers were queued up. Turned out
to be a NULL pointer being read from (as it was set as the "current buffer").
Partial changeover from ugly custom printf/messagebox debug output to using the
proper tools (ie, DPRINT etc.) Issuing a WODM_CLOSE before playack is complete
results in memory leak and lots of errors at present (need to take care of this)


svn path=/branches/silverblade-audio/; revision=34429
2008-07-11 23:03:31 +00:00
Andrew Greenwood
024244b13e Replaced threaded wave stream playback code again, to overcome stuttering
playback issue caused by limiting playback to a single buffer at a time. This
was causing playback to only go smoothly when the buffer got split up (ie,
it became double-buffered). Need to fix a bug occuring when buffers are
exhausted still.


svn path=/branches/silverblade-audio/; revision=34416
2008-07-10 23:32:48 +00:00
Andrew Greenwood
207ecfb9d9 Rewrote sound threading code. No point in having a single thread per audio
device when all it's doing is swapping buffers over. Also rewrote the wave
streaming code. It can now stream multiple WAVEHDRs and split them up as
needed. Playback not very smooth in places - need to double-buffer the
audio data.


svn path=/branches/silverblade-audio/; revision=34398
2008-07-09 23:43:44 +00:00
Andrew Greenwood
a70b715ce7 Various adjustments to the wave audio playback code. Seems to work OK when
playing large buffers that require splitting up however doesn't work if
multiple buffers are sent in succession.


svn path=/branches/silverblade-audio/; revision=34395
2008-07-09 17:41:18 +00:00
Andrew Greenwood
d4745154b0 Wave buffers are now split up into chunks before being fed to the sound driver.
Testing by writing 65,536 bytes using an un-even block size of 16,383. Results
in 4 x 16,383 byte blocks and 1 x 4 byte block, as expected. Completion of
one buffer results in submission of the next. Doesn't handle multiple WAVEHDRs
yet.


svn path=/branches/silverblade-audio/; revision=34360
2008-07-07 22:59:45 +00:00
Andrew Greenwood
eb06f65f77 Sound device I/O completion abstraction. thread.c now handles the overlapped
I/O structure allocations etc. and gathers completed I/O requests, tagging
them with contextual information within the I/O completion APC. Once the APC
returns, the completed I/O requests are passed to a callback routine. This
allows wavethread.c to just supply "request" and "I/O completion" callbacks.
The I/O completion callback's context data is then cast to WAVEHDR...


svn path=/branches/silverblade-audio/; revision=34349
2008-07-06 23:12:29 +00:00
Andrew Greenwood
10175cb52c Some restructuring to avoid SOUND_DEVICE_INSTANCE containing members only
relevant to the a wave device thread. Now there are separate structures for
device, device instance, thread, and anything relevant to a wave thread.
Extended overlapped I/O structure so that the completion routine can identify
the device instance, completed wave buffer and thread-specific data.
The completion routine re-submits the same buffer repeatedly at present.


svn path=/branches/silverblade-audio/; revision=34340
2008-07-06 18:57:26 +00:00
Andrew Greenwood
8cd5a60155 Partial implementation of WODM_CLOSE and WODM_WRITE handling within MME-Buddy.
Test code added to sndblst.dll to mimics WinMM's behaviour. Seems OK so far.
WODM_WRITE just throws a single buffer at the Sound Blaster driver, needs a
lot more work. Don't yet support the WinMM open/close/data/done callbacks.


svn path=/branches/silverblade-audio/; revision=34338
2008-07-06 16:37:41 +00:00
Andrew Greenwood
2250652920 Added cleanup code to sndblst.dll (for DriverProc/DRV_FREE), and memory
allocation/free wrappers in MME-Buddy's utility module, to aid in checking for
memory leaks. As a result, found and fixed a memory leak in RemoveSoundDevice.


svn path=/branches/silverblade-audio/; revision=34333
2008-07-06 15:20:40 +00:00
Andrew Greenwood
40a087d111 Started work on the user-mode Sound Blaster component. Like mmdrv, this is
currently created as an executable to make initial testing easier. Fixed
bug in EnumerateNt4ServiceSoundDevices where *all* device types were being
sent to the detection callback (made this an optional feature instead).
Moved original test code from MME-Buddy into MMDrv (don't want it for sndblst)


svn path=/branches/silverblade-audio/; revision=34332
2008-07-06 14:30:40 +00:00
Andrew Greenwood
4880a9e602 Added callbacks for sound device open (CreateSoundDeviceInstance) and close
(DestroySoundDeviceInstance) to MME-Buddy, allowing modules using this
library to implement custom functionality. The default callbacks just
open and close a named kernel sound device. Various other adjustments made,
mostly to improve code structure.


svn path=/branches/silverblade-audio/; revision=34328
2008-07-06 12:49:03 +00:00
Andrew Greenwood
59043c4d08 Implemented threaded wave device buffer writing, along with test code. Some
hacks present to aid in ensuring things are done in the correct order. Under
NT4 with its own SNDBLST.SYS, this can successfully queue a wave buffer of
white-noise, have it played, and call the I/O completion routine. Result is
audible in NT4 within VirtualBox. More work required before actually usable.


svn path=/branches/silverblade-audio/; revision=34323
2008-07-06 10:22:42 +00:00
Andrew Greenwood
6053db5344 Added macros to ntddsnd.h to make device type checking easier (can now check
if a device is a wave device without comparing against wave in and wave out
individually). Renamed CreateSoundDevice to AddSoundDevice (doesn't actually
*create* devices!) and implemented wave format setting via IOCTL_WAVE_SET_FORMAT.


svn path=/branches/silverblade-audio/; revision=34317
2008-07-06 00:42:38 +00:00
Andrew Greenwood
895b07f01c Implemented routines for querying if a particular wave format is supported by
an audio device. This is done by sending IOCTL_WAVE_QUERY_FORMAT to the driver.
This has been tested with the NT4 Sound Blaster driver, which return success
for 22050Hz/16bit/Mono, and returns MMSYSERR_NOTSUPPORTED if the same request
is then sent with a request for an abnormally high number of channels.


svn path=/branches/silverblade-audio/; revision=34316
2008-07-06 00:15:43 +00:00
Andrew Greenwood
875d252a75 Sound worker request dispatcher thread partially implemented, along with
routines for starting/stopping the thread and submitting requests. This
allows wavethread (and, in future, midithread) to just get on with the
required work and leave thread handling to something else.

Also added macros to simplify allocation of memory for structures and wide strings.


svn path=/branches/silverblade-audio/; revision=34315
2008-07-05 23:23:50 +00:00
Andrew Greenwood
6872bbe415 Rename MME entrypoint files to avoid Windows issues with the aux.c file name.
Now it is called auxMessage.c - the other files have been renamed accordingly.


svn path=/branches/silverblade-audio/; revision=34304
2008-07-05 12:42:48 +00:00
Andrew Greenwood
1405ebcfbf mmdrv.dll reimplementation begins, with a majority of its functionality
shifted into a support library ("mmebuddy") for future reuse with sndblst
and likely the WDM audio system. Locating NT4 sound devices is possible by
2 methods (search devices belonging to specific service, and brute-force search).
Some of the code is very hacky and for testing this compiles as an EXE.

No doubt a few bugs are present, however at the moment I'm satisfied (by testing)
that the code is doing what it is supposed to do.


svn path=/branches/silverblade-audio/; revision=34299
2008-07-05 02:43:17 +00:00
Andrew Greenwood
ef073243ae Still not happy with my mmdrv from last year, so killed it. Starting again
with a better-structured approach...


svn path=/branches/silverblade-audio/; revision=34269
2008-07-02 22:27:45 +00:00
Andrew Greenwood
b81df9c1e5 Implemented routines for destroying legacy sound devices. Updated SB16_NT4
so that it may now correctly create and destroy devices. It can also
register and unregister an interrupt handler (currently hard-coded to IRQ 5
but will be selectable later).


svn path=/branches/silverblade-audio/; revision=34258
2008-07-02 12:28:32 +00:00
Andrew Greenwood
27df1dc062 Implemented Sound Blaster mixer register read/write. Tested ability to
set and get the master volume level, under VirtualBox. Appears to function
correctly. Temporary test code added to sb16_nt4.


svn path=/branches/silverblade-audio/; revision=34257
2008-07-02 10:23:18 +00:00
Andrew Greenwood
2f6704f2eb Splitting of audio support libraries, to avoid including un-needed code when
building actual audio drivers (eg, only NT4 requires named audio device files).
This allows sbdsp to be split into relevant source files rather than being a
single file.


svn path=/branches/silverblade-audio/; revision=34245
2008-07-02 02:16:51 +00:00
Andrew Greenwood
388b56f4a5 Fixed some bugs in previous commit, implemented validation of sample rate.
svn path=/branches/silverblade-audio/; revision=34244
2008-07-01 23:02:07 +00:00
Andrew Greenwood
8080bf79e0 Implemented sound library routines for obtaining Sound Blaster DSP chip
version, speaker on/off and DSP 4.xx sample rate configuration. Renamed
functions to shorter names. Updated test code in sb16_nt4. DSP version
is reported as 4.05 in VirtualBox - which seems to report invalid speaker
status... Finally, updated e-mail address.


svn path=/branches/silverblade-audio/; revision=34242
2008-07-01 22:02:54 +00:00
Andrew Greenwood
b96787d2ac Made header for sbdsp.c and begun adding some test code to sb16_nt4
svn path=/branches/silverblade-audio/; revision=34235
2008-07-01 16:32:36 +00:00
Andrew Greenwood
7e3d7d230d Split sb16_nt4 into a common sound static library and made sb16_nt4
compile against this (intention is to re-use the lib for portcls later on).


svn path=/branches/silverblade-audio/; revision=34234
2008-07-01 16:09:10 +00:00
Andrew Greenwood
2683a6fca9 Stub IRP handlers, implement device name construction (eg: \Device\WaveOut0)
and creation of device and symbolic DOS device link.

Also moved old sndblst out of the way since ultimately we will be known as
sndblst.


svn path=/branches/silverblade-audio/; revision=33702
2008-05-25 20:30:47 +00:00
Andrew Greenwood
f4a64f8b77 Added NTDDSND.H which defines IOCTL codes, structures and other definitions
for NT4 style audio drivers.
Cleaned out sb16_nt4 directory in preparation of rewrite.


svn path=/branches/silverblade-audio/; revision=33692
2008-05-25 10:32:57 +00:00
Colin Finck
2a25153505 Create a branch for silverblade's audio work
svn path=/branches/silverblade-audio/; revision=33617
2008-05-20 20:38:22 +00:00
15220 changed files with 7332 additions and 958759 deletions

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Some files were not shown because too many files have changed in this diff Show More