다음을 통해 공유


IDirectMusicSynthSink::Init method (dmusics.h)

The Init method initializes the synth-sink object.

Syntax

HRESULT Init(
  IDirectMusicSynth *pSynth
);

Parameters

pSynth

Pointer to the synth object that the synth-sink object is to connect to. This parameter is a valid, non-NULL pointer to a IDirectMusicSynth object.

Return value

Init returns S_OK if the call is successful. Otherwise, the method returns an appropriate error code.

Remarks

When a synthesizer is connected to a synth sink by a call to IDirectMusicSynth::SetSynthSink, the synthesizer calls the synth sink's Init method.

In order to avoid cyclical references, the IDirectMusicSynthSink does not increment the reference count of the IDirectMusicSynth synth object. Instead, it abides by the rule that IDirectMusicSynth object is always the parent and always releases the IDirectMusicSynthSink object when it is done with it.

Once connected, the synth sink needs to be activated with a call to IDirectMusicSynthSink::Activate. At this point it starts generating wave buffers, which it passes to the synthesizer by calling IDirectMusicSynth::Render.

The pSynth parameter follows the reference-counting conventions for COM objects.

For more information, see Synthesizers and Wave Sinks. Also see the description of the IDirectMusic interface in the Microsoft Windows SDK documentation.

Requirements

Requirement Value
Target Platform Desktop
Header dmusics.h (include Dmusics.h)

See also

IDirectMusicSynth

IDirectMusicSynth::Activate

IDirectMusicSynth::Render

IDirectMusicSynth::SetSynthSink

IDirectMusicSynthSink::Activate