Einzelnen Beitrag anzeigen

Benutzerbild von TERWI
TERWI

Registriert seit: 29. Mär 2008
Ort: D-49626
381 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: DirectSound multiple input

  Alt 3. Sep 2011, 14:26
... immer wieder interessant: Man sieht Bäume und versucht die umzuhauen, wo gar keine sind ...

Dazu dieser höchst lesenswerte Artikel: http://edn.embarcadero.com/article/20941
11 Jahre alt... immer noch in den Grundsätzen aktuell.

Meine irrige Annahme war bisher, das ein Sound-Renderer immer nur einen Stream verarbeitet.
Das ist auch in so weit richtig, als das dieses COM-Object jeweils nur einen Puffer bereitstellt, DirectSound jedoch jede Menge davon verarbeiten kann.
Zitat aus dem o.g. Artikel unter 'How Direct Sound Works':

Zitat:
DirectSound works off sound buffers. The secondary sound buffer object is were it all starts. It represents a single sound, whether it be a short sound that fits into the block of memory or a long sound that has to be streamed into the buffer. The buffer stores the sound sample in the form of pulse code modulation (PCM) data. You can have as many secondary sound buffer's as you like, and when you play them DirectSound will "mix" them on to the primary sound buffer, performing any conversions like -- converting the sample rate and adding 3D special effects. From the primary buffer the PCM data is sent to the output device.

Like all of the DirectX components DirectSound tries to use as much hardware acceleration as possible. Whenever possible it places as many buffers as it can in hardware memory and uses hardware mixing if available. If this is not possible then DirectSound will use hardware emulation to get the task done. The figure below illustrates this process.
Irgendwie logisch ... denn:
Verschiedene Media-Player mit verschiedenen Quellen gestartet gibt ein herrliches Sound-Kuddel-Muddel !
Schaut man sich - sofern möglich - die jeweiligen Graphen an (oder bastelt sich 'on the fly' mit z.B. Monogram Graphstudio selber welche), hat jeder so ein DirectSoundDevice drin.
Sprich: erzeugt jeweils einen Puffer für DirectSound.

1. Fazit:

In meinem Anwendungsfall 'knalle' ich halt so viele Audio-Renderer in den Ausgabe-Graph wie benötigt.
Man/ich muss dann halt nür dafür sorgen, das der/die Sounds im Audio-Pegel passend eingestellt sind.

Das DSPack hält für die Delphi-Freaks in den Demo's bereits einen passenden DS-Filter bereit -> DirectSound Renderer.
Dort hat man elementar den Zugriff auf Volume & Balance.

2. Fazit:

Normalerweise ist die 'Sache' damit erledigt.
Wenn man es 'schön' machen will, wäre so was wie ein Wrapper in Anlehnung zum VMR-9 / EVR mit seinen 'multiple-Inputs' eine feine Sache:
- ein Filter mit definierbarer (oder automatischer) Anzahl von Inputs (Audio, alle Formate)
- Zentrale Verwaltung der Sounds zu VOL & BAL
- Switching / Blending verfügbarer / aktiver Eingänge
- uws. etc. pp. was einem sonst noch so einfällt....

Hier gibts es auch noch was lesenswertes dazu: http://www.dsp-worx.de/?n=14
Allerdings habe ich den Sinn dieses FIlters noch nicht wirklich verstanden. Nocht nicht ...
Basiert auf dem 'DirectSound Renderer' des DSPack's - ist ja auch der gleiche Autor.

Hat jemand schon mal so was 'gebastelt', ist dabei, hat interesse was zu proggen ?
Ich bin dabei.
  Mit Zitat antworten Zitat