AddAudioFrameEmbedded()

ShapeCollection::AddAudioFrameEmbedded(float, float, float, float, System::SharedPtr<System::IO::Stream>) method

Adds a new audio frame with embedded audio file to the end of a collection. Embedded audio file can be a WAV only. It adds new audio into Presentation::get_Audios list.

System::SharedPtr<IAudioFrame> Aspose::Slides::ShapeCollection::AddAudioFrameEmbedded(float x, float y, float width, float height, System::SharedPtr<System::IO::Stream> audio_stream) override

Arguments

ParameterTypeDescription
xfloatX coordinate of a new audio frame.
yfloatY coordinate of a new audio frame.
widthfloatWidth of a new audio frame.
heightfloatHeight of a new audio frame.
audio_streamSystem::SharedPtr<System::IO::Stream>Inout stream with audio data.

Return Value

Created AudioFrame object.

Remarks

The following examples shows how to create Audio Frame.

// Instantiates a presentation class that represents a presentation file
auto pres = System::MakeObject<Presentation>();

// Gets the first slide
auto slide = pres->get_Slides()->idx_get(0);
// Loads the the wav sound file to stream
System::SharedPtr<System::IO::FileStream> fstr = System::MakeObject<System::IO::FileStream>(u"sampleaudio.wav", System::IO::FileMode::Open, System::IO::FileAccess::Read);

// Adds the Audio Frame
System::SharedPtr<IAudioFrame> audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(50.0f, 150.0f, 100.0f, 100.0f, fstr);
// Sets the Play Mode and Volume of the Audio
audioFrame->set_PlayMode(AudioPlayModePreset::Auto);
audioFrame->set_Volume(AudioVolumeMode::Loud);

// Writes the PowerPoint file to disk
pres->Save(u"AudioFrameEmbed_out.pptx", SaveFormat::Pptx);

ShapeCollection::AddAudioFrameEmbedded(float, float, float, float, System::SharedPtr<IAudio>) method

Adds a new audio frame with embedded audio file to the end of a collection. It uses audio file from Presentation::get_Audios list.

System::SharedPtr<IAudioFrame> Aspose::Slides::ShapeCollection::AddAudioFrameEmbedded(float x, float y, float width, float height, System::SharedPtr<IAudio> audio) override

Arguments

ParameterTypeDescription
xfloatX coordinate of a new audio frame.
yfloatY coordinate of a new audio frame.
widthfloatWidth of a new audio frame.
heightfloatHeight of a new audio frame.
audioSystem::SharedPtr<IAudio>Audio from Presentation::get_Audios list.

Return Value

Created AudioFrame object.

See Also