2014-10-07 2 views
0

BASS.NET 라이브러리에서 오디오로 응용 프로그램을 만들려고하지만 "My First BASS Application"샘플에서 약간의 오류가 발생합니다. 나는 http://bass.radio42.com/help/에 주어진 방향을 따라,하지만 난 붙여 넣은 코드를 실행하려고하면 오류가이 라인에 온다 :"My First BASS Application"BASS.NET 응용 프로그램 오류

if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))

내가받을 오류는 다음과 같습니다

An unhandled exception of type 'System.TypeInitializationException' occurred in Bass Test.exe

I 모든 방향을 따르려고했지만 # 4 대신 bass.dll을 추가하는 대신 bass.net.dll이 오타라고 생각했습니다.

4.Copy the 'bass.dll' to your executable directory (e.g. .\bin\Debug).

샘플 코드는 다음과 같습니다 나는 코드가 잘하지만 오류의 원인이 뭐죠 내 컴퓨터의 출력 장치 인 것으로 추측하고있다

using System; 
using Un4seen.Bass; 

namespace MyFirstBass 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      // init BASS using the default output device 
      if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)) 
      { 
       // create a stream channel from a file 
       int stream = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT); 
       if (stream != 0) 
       { 
        // play the stream channel 
        Bass.BASS_ChannelPlay(stream, false); 
       } 
       else 
       { 
        // error creating the stream 
        Console.WriteLine("Stream error: {0}", Bass.BASS_ErrorGetCode()); 
       } 

       // wait for a key 
       Console.WriteLine("Press any key to exit"); 
       Console.ReadKey(false); 

       // free the stream 
       Bass.BASS_StreamFree(stream); 
       // free BASS 
       Bass.BASS_Free(); 
      } 
     } 
    } 
} 

.

+0

응용 프로그램을 디버깅하려고 했습니까? 오류는 어디에서 발생합니까? 예외는 필요한 모든 DLL을 찾을 수 없기 때문에 .NET에서 형식을 만들 수 없다고 말합니다. 'bass.net.dll' 파일이'bass.dll'에 대한 래퍼 일 뿐이라면 프로그램을 작동시키기 위해서 두 dll이 모두 필요할 것입니다. –

답변

3

BASS.NET은 BASS보다 얇은 래퍼이므로 bass.dll이 필요합니다. 당신이 제공하는 링크를 명시 적으로 경고 :

네이티브 BASS 라이브러리가 포함되어 있으며 별도로 다운로드 할 필요가있다 - (예 : 장소 그래서 BASS 라이브러리 및 필요한 추가 기능 프로젝트 실행 디렉토리에 라이브러리를 배치해야합니다 . \ bin \ Debug 폴더에 bass.dll).

이미 프로젝트에 대한 참조로 추가 했으므로 bass.net.dllDebug 폴더로 복사 할 필요가 없습니다.

+0

감사합니다. 나는 예제를 건너 뛰는 대신에 실제로 매뉴얼을 읽어야합니다. –