Search Unity

Problems with bass.dll

Discussion in 'Scripting' started by eduh12, May 16, 2020.

  1. eduh12

    eduh12

    Joined:
    Oct 6, 2019
    Posts:
    1
    I am trying to make a radio system with bass.dll and i ve imported the library and the plugin in asset, but i have an error when i want to execute it

    The script code is:
    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using System.Runtime.InteropServices;
    5. using UnityEngine;
    6. using Un4seen.Bass;
    7.  
    8. public class testradio : MonoBehaviour
    9. {
    10.     public string url = "http://edge126.rdsnet.ro:84/profm/profm.mp3";
    11.  
    12.     private int stream;
    13.  
    14.     // Use this for initialization
    15.     void Start()
    16.     {
    17.         Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PLAYLIST, 0);
    18.  
    19.         Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
    20.  
    21.         stream = Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_DEFAULT, null, IntPtr.Zero);
    22.         PlayStream(url);
    23.     }
    24.  
    25.     public void PlayStream(string url)
    26.     {
    27.         if (stream != 0)
    28.         {
    29.             Bass.BASS_ChannelPlay(stream, false);
    30.         }
    31.         else
    32.         {
    33.             Debug.Log("BASS Error Code = " + Bass.BASS_ErrorGetCode());
    34.         }
    35.     }
    36.  
    37.     public void StopStream()
    38.     {
    39.         Bass.BASS_ChannelStop(stream);
    40.     }
    41.  
    42.     // Get the Channel Information
    43.     public string GetChannelInfo()
    44.     {
    45.         BASS_CHANNELINFO info = new BASS_CHANNELINFO();
    46.         Bass.BASS_ChannelGetInfo(stream, info);
    47.         return info.ToString();
    48.     }
    49.  
    50.     public void SetVolume(float value)
    51.     {
    52.         Bass.BASS_SetVolume(value);
    53.     }
    54.  
    55.     void OnApplicationQuit()
    56.     {
    57.         // free the stream
    58.         Bass.BASS_StreamFree(stream);
    59.         // free BASS
    60.         Bass.BASS_Free();
    61.     }
    62. }
    63.  
    and the error is DllNotFoundException: bass
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,694
    A lot of this might have to do with how that library is set up. Check that you put all the files in the right place in your Unity project, such as the native DLLs have to go in specific folders within the Plugins folder. Look for a general Unity FAQ on native libraries, and also look for specific documentation that came with bass.dll.
     
  3. antyvirus1

    antyvirus1

    Joined:
    Nov 13, 2017
    Posts:
    1
    Anyone found a solution for this?