AudioFrame

Inheritance: java.lang.Object, com.aspose.slides.Shape, com.aspose.slides.GeometryShape, com.aspose.slides.PictureFrame

All Implemented Interfaces: com.aspose.slides.IAudioFrame

public class AudioFrame extends PictureFrame implements IAudioFrame

Represents an audio clip on a slide.


The following examples shows how to change Audio Play Options.
  
 Presentation pres = new Presentation("AudioFrameEmbed_out.pptx");
 try {
     // Gets the AudioFrame shape
     AudioFrame audioFrame = (AudioFrame)pres.getSlides().get_Item(0).getShapes().get_Item(0);
     // Sets the Play mode to play on click
     audioFrame.setPlayMode(AudioPlayModePreset.OnClick);
     // Sets the volume to Low
     audioFrame.setVolume(AudioVolumeMode.Low);
     // Sets the audio to play across slides
     audioFrame.setPlayAcrossSlides(true);
     // Disables loop for the audio
     audioFrame.setPlayLoopMode(false);
     // Hides the AudioFrame during the slide show
     audioFrame.setHideAtShowing(true);
     // Rewinds the audio to start after playing
     audioFrame.setRewindAudio(true);
     // Saves the PowerPoint file to disk
     pres.save("AudioFrameEmbed_changed.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Methods

MethodDescription
getAudioCdStartTrack()Returns or sets a start track index.
setAudioCdStartTrack(int value)Returns or sets a start track index.
getAudioCdStartTrackTime()Returns or sets a start track time.
setAudioCdStartTrackTime(int value)Returns or sets a start track time.
getAudioCdEndTrack()Returns or sets a last track index Read/write int .
setAudioCdEndTrack(int value)Returns or sets a last track index Read/write int .
getAudioCdEndTrackTime()Returns or sets a last track time.
setAudioCdEndTrackTime(int value)Returns or sets a last track time.
getVolume()Returns or sets the audio volume.
setVolume(int value)Returns or sets the audio volume.
getPlayMode()Returns or sets the audio play mode.
setPlayMode(int value)Returns or sets the audio play mode.
getHideAtShowing()Determines whether an AudioFrame is hidden.
setHideAtShowing(boolean value)Determines whether an AudioFrame is hidden.
getPlayLoopMode()Determines whether an audio is looped.
setPlayLoopMode(boolean value)Determines whether an audio is looped.
getPlayAcrossSlides()Determines whether audio is playing across the slides.
setPlayAcrossSlides(boolean value)Determines whether audio is playing across the slides.
getRewindAudio()Determines whether audio is automatically rewinded to start after playing.
setRewindAudio(boolean value)Determines whether audio is automatically rewinded to start after playing.
getEmbedded()Determines whether a sound is embedded to a presentation.
getLinkPathLong()Returns or sets the name of an audio file which is linked to an AudioFrame.
setLinkPathLong(String value)Returns or sets the name of an audio file which is linked to an AudioFrame.
getEmbeddedAudio()Returns or sets embedded audio object.
setEmbeddedAudio(IAudio value)Returns or sets embedded audio object.
getFadeInDuration()Specifies the time duration for the starting fade of the media in milliseconds.
setFadeInDuration(float value)Specifies the time duration for the starting fade of the media in milliseconds.
getFadeOutDuration()Specifies the time duration for the ending fade of the media in milliseconds.
setFadeOutDuration(float value)Specifies the time duration for the ending fade of the media in milliseconds.
getVolumeValue()Returns or sets the audio volume in percents.
setVolumeValue(float value)Returns or sets the audio volume in percents.
getTrimFromStart()Specifies a duration of time to be removed from the start of the media during playback, in milliseconds.
setTrimFromStart(float value)Specifies a duration of time to be removed from the start of the media during playback, in milliseconds.
getTrimFromEnd()Specifies a duration of time to be removed from the end of the media during playback, in milliseconds.
setTrimFromEnd(float value)Specifies a duration of time to be removed from the end of the media during playback, in milliseconds.

getAudioCdStartTrack()

public final int getAudioCdStartTrack()

Returns or sets a start track index. Read/write int .

Returns: int

setAudioCdStartTrack(int value)

public final void setAudioCdStartTrack(int value)

Returns or sets a start track index. Read/write int .

Parameters:

ParameterTypeDescription
valueint

getAudioCdStartTrackTime()

public final int getAudioCdStartTrackTime()

Returns or sets a start track time. Read/write int .

Returns: int

setAudioCdStartTrackTime(int value)

public final void setAudioCdStartTrackTime(int value)

Returns or sets a start track time. Read/write int .

Parameters:

ParameterTypeDescription
valueint

getAudioCdEndTrack()

public final int getAudioCdEndTrack()

Returns or sets a last track index Read/write int .

Returns: int

setAudioCdEndTrack(int value)

public final void setAudioCdEndTrack(int value)

Returns or sets a last track index Read/write int .

Parameters:

ParameterTypeDescription
valueint

getAudioCdEndTrackTime()

public final int getAudioCdEndTrackTime()

Returns or sets a last track time. Read/write int .

Returns: int

setAudioCdEndTrackTime(int value)

public final void setAudioCdEndTrackTime(int value)

Returns or sets a last track time. Read/write int .

Parameters:

ParameterTypeDescription
valueint

getVolume()

public final int getVolume()

Returns or sets the audio volume. Read/write AudioVolumeMode.

Returns: int

setVolume(int value)

public final void setVolume(int value)

Returns or sets the audio volume. Read/write AudioVolumeMode.

Parameters:

ParameterTypeDescription
valueint

getPlayMode()

public final int getPlayMode()

Returns or sets the audio play mode. Read/write AudioPlayModePreset.

Returns: int

setPlayMode(int value)

public final void setPlayMode(int value)

Returns or sets the audio play mode. Read/write AudioPlayModePreset.

Parameters:

ParameterTypeDescription
valueint

getHideAtShowing()

public final boolean getHideAtShowing()

Determines whether an AudioFrame is hidden. Read/write boolean .

Returns: boolean

setHideAtShowing(boolean value)

public final void setHideAtShowing(boolean value)

Determines whether an AudioFrame is hidden. Read/write boolean .

Parameters:

ParameterTypeDescription
valueboolean

getPlayLoopMode()

public final boolean getPlayLoopMode()

Determines whether an audio is looped. Read/write boolean .

Returns: boolean

setPlayLoopMode(boolean value)

public final void setPlayLoopMode(boolean value)

Determines whether an audio is looped. Read/write boolean .

Parameters:

ParameterTypeDescription
valueboolean

getPlayAcrossSlides()

public final boolean getPlayAcrossSlides()

Determines whether audio is playing across the slides. Read/write boolean .


Presentation pres = new Presentation();
  try {
      ISlide slide = pres.getSlides().get_Item(0);
      // Add Audio Frame
      IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav");
      // Set Audio to play across the slides
      audioFrame.setPlayAcrossSlides(true);
      // Set Audio to automatically rewind to start after playing
      audioFrame.setRewindAudio(true);
      pres.save("AudioFrame_out.pptx", SaveFormat.Pptx);
  } finally {
      if (pres != null) pres.dispose();
  }

Returns: boolean

setPlayAcrossSlides(boolean value)

public final void setPlayAcrossSlides(boolean value)

Determines whether audio is playing across the slides. Read/write boolean .


Presentation pres = new Presentation();
  try {
      ISlide slide = pres.getSlides().get_Item(0);
      // Add Audio Frame
      IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav");
      // Set Audio to play across the slides
      audioFrame.setPlayAcrossSlides(true);
      // Set Audio to automatically rewind to start after playing
      audioFrame.setRewindAudio(true);
      pres.save("AudioFrame_out.pptx", SaveFormat.Pptx);
  } finally {
      if (pres != null) pres.dispose();
  }

Parameters:

ParameterTypeDescription
valueboolean

getRewindAudio()

public final boolean getRewindAudio()

Determines whether audio is automatically rewinded to start after playing. Read/write boolean .


Presentation pres = new Presentation();
  try {
      ISlide slide = pres.getSlides().get_Item(0);
      // Add Audio Frame
      IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav");
      // Set Audio to play across the slides
      audioFrame.setPlayAcrossSlides(true);
      // Set Audio to automatically rewind to start after playing
      audioFrame.setRewindAudio(true);
      pres.save("AudioFrame_out.pptx", SaveFormat.Pptx);
  } finally {
      if (pres != null) pres.dispose();
  }

Returns: boolean

setRewindAudio(boolean value)

public final void setRewindAudio(boolean value)

Determines whether audio is automatically rewinded to start after playing. Read/write boolean .


Presentation pres = new Presentation();
  try {
      ISlide slide = pres.getSlides().get_Item(0);
      // Add Audio Frame
      IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav");
      // Set Audio to play across the slides
      audioFrame.setPlayAcrossSlides(true);
      // Set Audio to automatically rewind to start after playing
      audioFrame.setRewindAudio(true);
      pres.save("AudioFrame_out.pptx", SaveFormat.Pptx);
  } finally {
      if (pres != null) pres.dispose();
  }

Parameters:

ParameterTypeDescription
valueboolean

getEmbedded()

public final boolean getEmbedded()

Determines whether a sound is embedded to a presentation. Read-only boolean .

Returns: boolean

getLinkPathLong()

public final String getLinkPathLong()

Returns or sets the name of an audio file which is linked to an AudioFrame. Read/write String.

Returns: java.lang.String

setLinkPathLong(String value)

public final void setLinkPathLong(String value)

Returns or sets the name of an audio file which is linked to an AudioFrame. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getEmbeddedAudio()

public final IAudio getEmbeddedAudio()

Returns or sets embedded audio object. Read/write IAudio.

Returns: IAudio

setEmbeddedAudio(IAudio value)

public final void setEmbeddedAudio(IAudio value)

Returns or sets embedded audio object. Read/write IAudio.

Parameters:

ParameterTypeDescription
valueIAudio

getFadeInDuration()

public final float getFadeInDuration()

Specifies the time duration for the starting fade of the media in milliseconds. Read/write float.


Example:
  
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the duration of the starting fade for 200ms
     audioFrame.setFadeInDuration(200f);
     pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: float

setFadeInDuration(float value)

public final void setFadeInDuration(float value)

Specifies the time duration for the starting fade of the media in milliseconds. Read/write float.


Example:
  
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the duration of the starting fade for 200ms
     audioFrame.setFadeInDuration(200f);
     pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuefloat

getFadeOutDuration()

public final float getFadeOutDuration()

Specifies the time duration for the ending fade of the media in milliseconds. Read/write float.


Example:
  
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the duration of the ending fade for 500ms
     audioFrame.setFadeOutDuration(500f);
     pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: float

setFadeOutDuration(float value)

public final void setFadeOutDuration(float value)

Specifies the time duration for the ending fade of the media in milliseconds. Read/write float.


Example:
  
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the duration of the ending fade for 500ms
     audioFrame.setFadeOutDuration(500f);
     pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuefloat

getVolumeValue()

public final float getVolumeValue()

Returns or sets the audio volume in percents. Read/write float.


Example:
  
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the audio volume for 85%
     audioFrame.setVolumeValue(85f);
     pres.save("AudioFrameValue_out.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: float

setVolumeValue(float value)

public final void setVolumeValue(float value)

Returns or sets the audio volume in percents. Read/write float.


Example:
  
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the audio volume for 85%
     audioFrame.setVolumeValue(85f);
     pres.save("AudioFrameValue_out.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuefloat

getTrimFromStart()

public final float getTrimFromStart()

Specifies a duration of time to be removed from the start of the media during playback, in milliseconds. Read/write float.


Example:
 
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the start trimming time 1.5 seconds
     audioFrame.setTrimFromStart(1500f);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: float

setTrimFromStart(float value)

public final void setTrimFromStart(float value)

Specifies a duration of time to be removed from the start of the media during playback, in milliseconds. Read/write float.


Example:
 
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the start trimming time 1.5 seconds
     audioFrame.setTrimFromStart(1500f);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuefloat

getTrimFromEnd()

public final float getTrimFromEnd()

Specifies a duration of time to be removed from the end of the media during playback, in milliseconds. Read/write float.


Example:
 
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the end trimming time 2 seconds
     audioFrame.setTrimFromEnd(2000f);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: float

setTrimFromEnd(float value)

public final void setTrimFromEnd(float value)

Specifies a duration of time to be removed from the end of the media during playback, in milliseconds. Read/write float.


Example:
 
 Presentation pres = new Presentation();
 try {
     FileInputStream audioStream = new FileInputStream("sampleaudio.mp3");
     IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease);
     IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio);
     // Set the end trimming time 2 seconds
     audioFrame.setTrimFromEnd(2000f);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
valuefloat