SoundPlayer.Load 메서드

정의

소리를 동기적으로 로드합니다.

public:
 void Load();
public void Load();
member this.Load : unit -> unit
Public Sub Load ()

예외

로드하는 동안 경과된 시간이 지정한 시간(밀리초)을 초과합니다 LoadTimeout.

지정한 SoundLocation 파일을 찾을 수 없습니다.

예제

다음 코드 예제에서는 클래스의 LoadAsync 인스턴스에 .wav 파일을 연결 하는 메서드를 SoundPlayer 사용 하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 SoundPlayer 일부입니다.

try
{
   
   // Assign the selected file's path to 
   // the SoundPlayer object.  
   player->SoundLocation = filepathTextbox->Text;
   
   // Load the .wav file.
   player->Load();
}
catch ( Exception^ ex ) 
{
   ReportStatus( ex->Message );
}
try
{
    // Assign the selected file's path to 
    // the SoundPlayer object.  
    player.SoundLocation = filepathTextbox.Text;

    // Load the .wav file.
    player.Load();
}
catch (Exception ex)
{
    ReportStatus(ex.Message);
}
Try
    ' Assign the selected file's path to the SoundPlayer object.
    player.SoundLocation = filepathTextbox.Text

    ' Load the .wav file.
    player.Load()
Catch ex As Exception
    ReportStatus(ex.Message)
End Try

설명

이 메서드는 Load 현재 스레드를 사용하여 .wav 파일을 로드하여 로드가 완료될 때까지 스레드가 다른 메시지를 처리하지 못하도록 합니다.

Caution

이 메서드는 Load 큰 .wav 파일을 로드하는 동안 지연을 생성할 수 있습니다. 또한 로드가 완료될 때까지 그리기 및 기타 이벤트가 차단됩니다. 메서드를 LoadAsync 사용하여 사운드를 비동기적으로 로드하면 호출 스레드가 중단 없이 계속할 수 있습니다.

이 메서드는 로드가 LoadCompleted 완료되었을 때 로드에 성공하지 못한 경우에도 이벤트를 발생합니다.

적용 대상

추가 정보