SoundPlayer.Load 메서드

정의

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

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

예외

로딩 중 경과된 시간이 LoadTimeout으로 지정된 시간(밀리초)을 초과하는 경우

SoundLocation으로 지정된 파일을 찾을 수 없는 경우

예제

다음 코드 예제를 사용 하는 클래스의 LoadAsync instance SoundPlayer .wav 파일을 연결 하는 방법입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 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 파일을 로드하여 로드가 완료될 때까지 스레드가 다른 메시지를 처리하지 못하도록 합니다.

주의

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

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

적용 대상

추가 정보