Author Topic: BASS.NET API 2.4.17.5  (Read 1134332 times)

sawo

  • Posts: 9
Re: BASS .NET API 2.3.1.5 !
« Reply #225 on: 11 Jun '07 - 21:31 »
Well for example i want to play file test.mod which is embedded as a resource (it has name just test in the resources.resx)
i have to use the following path: Schematrix.Properties.Resources.test (mainNamespace.folder.resources.fileName)
but i have to use string for filename and the project gives me an error that i cant use IO.Stream instead of the required string type (because usually the mod filename is specifidied as "test.mod" for example)
Can you point me to a guide or some sample where i can get some information about how to use embedded resource instead of the required file name as string?
VS 2005's music player support directly IO.Stream path but i cant use the syntax in that way with bass and so far i cant get any info on the web about that.. maybe i search wrong dunno
This is how i load bassmod.dll (C#):
Code: [Select]
        [DllImport("BASSMOD.dll")]
        private static extern bool BASSMOD_MusicLoad(
            bool mem,
            string file,
            uint offset,
            uint length,
            uint flags
        );
... and sry for my crappy english
« Last Edit: 11 Jun '07 - 21:35 by sawo »

radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.5 !
« Reply #226 on: 11 Jun '07 - 21:48 »
BASS is written in C, so it of course doesn't know anything about .Net specific Stream.IO members.
However, the method "BASSMOD_MusicLoad" can be used in two ways:
a) read a mod from a physical file - this is the overload you declared
In this case BASSMOD expects a physical file and you give with the "string file" parameter the location to it.
So that overload will definitly not work.
and...
b) it can be used with a memory location (when specifying "mem = true").
In this case your method declaration must look different:
either:
Code: [Select]
[DllImport("bassmod.dll", CharSet=CharSet.Auto)]
public static extern int BASSMOD_MusicLoad(
        [MarshalAs(UnmanagedType.Bool)] bool mem,
        IntPtr memory,
        uint offset,
        uint length,
        uint flags);
or
Code: [Select]
[DllImport("bassmod.dll", CharSet=CharSet.Auto)]
public static extern int BASSMOD_MusicLoad(
        [MarshalAs(UnmanagedType.Bool)] bool mem,
        [In][MarshalAs(UnmanagedType.LPArray)] byte[] memory,
        uint offset,
        uint length,
        uint flags);
In this case "memory" would point to the memory location from where BASSMOD should read the mod 'file'.

So you need to find a way to convert your resourse:
a) to a byte[] or to
b) an IntPtr.
« Last Edit: 11 Jun '07 - 21:57 by radio42 »

sawo

  • Posts: 9
Re: BASS .NET API 2.3.1.5 !
« Reply #227 on: 12 Jun '07 - 01:36 »
I used the second method so there was no need to convert to byte
Code: [Select]
BASSMOD_MusicLoad(true, NameSpace.Properties.Resources.ResourceNameWithoutExtension, 0, 0, 0);
many thanks for your help!
these days i will make sample player for C# using bassmod.dll (im noob to C# and it was hard to get all this working so i think it will be useful to someone... like me :D )

sawo

  • Posts: 9
Re: BASS .NET API 2.3.1.5 !
« Reply #228 on: 24 Jun '07 - 22:54 »
Ok i got almost everything working but how to make the xm/it files to loop?
I think everything is ok with .mod files but xm/it still causing poblems

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS .NET API 2.3.1.5 !
« Reply #229 on: 25 Jun '07 - 12:46 »
To loop a file, you should use the BASS_MUSIC_LOOP flag in the BASSMOD_MusicLoad or BASSMOD_MusicPlayEx call.

sawo

  • Posts: 9
Re: BASS .NET API 2.3.1.5 !
« Reply #230 on: 27 Jun '07 - 13:39 »
ok but what type should i use to define BASS_MUSIC_LOOP ?
i also tried BASSMOD_MusicPlayEx
Code: [Select]
        [DllImport("BASSMOD.DLL")]
        private static extern bool BASSMOD_MusicPlayEx(
        int pos,
        uint flags,
        bool reset
        );
if i use pos -1 the music doesnt even start
if i use pos 1/0 it start playing but just like the normal BASSMOD_MusicPlay()

Chris

  • Posts: 2217
Re: BASS .NET API 2.3.1.5 !
« Reply #231 on: 27 Jun '07 - 14:01 »
Hi
you must use BASS_MUSIC_LOOP as a flag
Greets Chris

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS .NET API 2.3.1.5 !
« Reply #232 on: 27 Jun '07 - 14:29 »
ok but what type should i use to define BASS_MUSIC_LOOP ?

If you're asking what the value of BASS_MUSIC_LOOP is, it is 4. You can find all the flag definitions in the included C/Delphi/VB APIs.

sawo

  • Posts: 9
Re: BASS .NET API 2.3.1.5 !
« Reply #233 on: 27 Jun '07 - 16:26 »
Well i code in C# .NET so if i want to use BASS_MUSIC_LOOP in BASSmOD_MusicLoad first i have to declare it just as i declared pos,flags and reset in BASSMOD_MusicPlayEx (check the code above)

My current code is:
Code: [Select]
        [DllImport((@"BASSMOD.DLL"), CharSet = CharSet.Auto)]
        private static extern bool BASSMOD_MusicLoad(
           [MarshalAs(UnmanagedType.Bool)] bool mem,
           [In][MarshalAs(UnmanagedType.LPArray)] byte[] memory,
            uint offset,
            uint length,
            uint flags
        );
and
Code: [Select]
BASSMOD_MusicLoad(true, NameSpace.Properties.Resources.File, 0, 0, 0);
So if i want to use BASS_MUSIC_LOOP here i should define its type first just like as i did for offset,length and flags (all uint)
Thats why im asking what type should i use for BASS_MUSIC_LOOP ?
Probably my bad english and poor coding skills are problem but i hope i asked the question as clear as possible.

sgdowney

  • Posts: 30
Re: BASS .NET API 2.3.1.5 !
« Reply #234 on: 27 Jun '07 - 18:56 »
If you are coding in C# you should use the Bass.NET API which has all these definitions in place already.  You shouldn't need to include the DLL Imports in your code and declare BASS_MUSIC_LOOP.

sawo

  • Posts: 9
Re: BASS .NET API 2.3.1.5 !
« Reply #235 on: 27 Jun '07 - 19:59 »
BASS.NET is too large compared to the bassmod.dll which i use.Also it include alot of features that i will never need.
If the developers make bassmod .NET i will be glad to use it, but until then i will stick with the standart dll :)

radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.5 !
« Reply #236 on: 27 Jun '07 - 23:51 »
OKi, here it comes... a "BassMOD.Net" version for .Net 2.0 ;-)

BassMOD20.Net20.zip

It contains the following files:
BassMOD.Net.dll : the .Net 2.0 wrapper for BASSMOD.dll
BassMOD.Net.xml : the xml 'documentation' file

No help file is planned, as it should be self-explained, since it uses exactly the same mechanisms as BASS.NET.
The namespace used is: "Un4seen.BassMOD". And it contains two classes:
- BassMOD : containing all static wrapper methods plus some additional overloads for conveniance
- Utils : containing some usefull helpers

Have fun and use it as you like ;-)

Note: It is not tested yet - so tell me, if there is something wrong.


P.S.: Just in case someone wonders...
All method signatures are CLS complient (e.g. 'int' instead of 'uint') so that this lib can also be used with any .Net language (C#, VB.Net, J# or even managed C++). As well the lib is strongly signed.
In addition play .Net code is used, so it should also work with Mono (even under Linux) - but this is not tested.
« Last Edit: 27 Jun '07 - 23:58 by radio42 »

BassFan

  • Guest
Re: BASS .NET API 2.3.1.5 !
« Reply #237 on: 4 Jul '07 - 11:52 »
any is wrong in NET API missing the entry

Quote
BASS_WMPVIS_Resize
Resize the size of the area that the plugin will render at.

--------------------------------------------------------------------------------
BOOL BASS_WMPVIS_Resize(
    DWORD SourceWidth
    DWORD Sourceheight
);

ParametersSourceWidth The new width of the rendered area.
SourceHeight The new height of the rendered area.


Return valueIf an error occurred then FALSE is returned, otherwise TRUE is returned. 


greets BassFan

radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.6 !
« Reply #238 on: 7 Jul '07 - 10:06 »
07.07.2007: Version 2.3.1.6 is out!

BASS: support for version 2.3.0.3 added
- see BASS doc for more info
BASS_VIS: support for version 2.3.1.1 added
Misc (DSP Framework): new DSP_BufferStream class added (synchronized decoding channel clones) - see help for details


BassFan

  • Guest
Re: BASS .NET API 2.3.1.6 !
« Reply #239 on: 7 Jul '07 - 10:59 »
07.07.2007: Version 2.3.1.6 is out!

BASS: support for version 2.3.0.3 added
- see BASS doc for more info
BASS_VIS: support for version 2.3.1.1 added
Misc (DSP Framework): new DSP_BufferStream class added (synchronized decoding channel clones) - see help for details



Thanks Radio42
Support for version 2.3.1.2 coming soon..

greets BassFan

riesm

  • Posts: 51
Re: BASS .NET API 2.3.1.6 !
« Reply #240 on: 13 Jul '07 - 16:55 »
A question about TAG_INFO (native tags). In Vista you can give ratings to all audio files in the explorer. All my MP3 tagger programs see this rating (MP3 Tagger calls it WMP RATING). However BASS.NET does not return this tag as native tag. Am I doing something wrong or is this not implemented? Would be great if it was!

Another question, would it be possible to implement a SAVE function for the TAG_INFO structure? I know of no other possibilities besides ancient ActiveX controls that can save tags back to files. Would be great if this could be managed in .NET directly. Hope to hear from you.

Cheers,
riesm

radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.6 !
« Reply #241 on: 13 Jul '07 - 17:47 »
The native tag list will contain all native tags present in the file - also the "Rating" tag - if present in the file.
So it must be set on a file explicitly. If it doesn't exist in the native tag list it is simply not there in the file ;-)

However, there are currently no plans to include TAG writing within BASS.NET.
I know this would be nice, but...
...you might do this by yourself :-)
Take a look to the WMASDK...there is plenty of .Net source code available which shows how to implement TAG writing using the WMASDK.

The reason, why I don't want to add TAG writing support is the following:
- I could also use the WMASDK stuff - but that would nail every application to have WMA support - and even the MediaPlayer installed on the system
- the WMASDK only supports WMA and MP3 ID3 tag writing...so what about the other formats
- I could try to implement some other formats myself...but...that would require to much work as of today
In essence:
There is good lib out there (AudioGenie) which is in fact an ActiveX control - but works nicely!
So I preffer to leave that task to some other folks :-(

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.7 !
« Reply #242 on: 25 Aug '07 - 15:09 »
I just started a project where I need ASIO.

But I can't get it to play??

I test "simple ASIO" but no... I add
Code: [Select]
BASS_ASIO_GetDeviceDescription for listing my devices and get:

Code: [Select]
ASIO 2.0 - ESI MAYA44
ASIO Digidesign Driver
ASIO for EWS88 MT/D
BCD3000 ASIO
Hercules DJ Console ASIO
Maya44 USBAudio ASIO driver

and when "init" ASIO i get back: 

Code: [Select]
if (Bass.BASS_Init(0, 48000, 0, 0, null) && BassAsio.BASS_ASIO_Init(comboBox1.SelectedIndex))
Code: [Select]
Name=BCD3000-1 , Group=0, Format=BASS_ASIO_FORMAT_16BIT
Name=BCD3000-2 , Group=0, Format=BASS_ASIO_FORMAT_16BIT
Name=BCD3000-3 , Group=0, Format=BASS_ASIO_FORMAT_16BIT
Name=BCD3000-4 , Group=0, Format=BASS_ASIO_FORMAT_16BIT

But I can't get it to play.  My devices works fine in ex ViryualDJ (in ASIO mode) and i restarded Windows (Win XP) but same resault.

And yes, I have the latest BASS, BASSasio, and BASS.NET  (downloaded today)

Any ideas?  Is ASIO that tricky?


radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.7 !
« Reply #243 on: 25 Aug '07 - 15:34 »
No, but it is a little different ;-)

Take a look to the BASS.NET provided C# sample called "SimpleAsio" or "SimpleAsioFX"...that will give you some hints I guess.

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.7 !
« Reply #244 on: 25 Aug '07 - 15:38 »
I just did!  They don't work.  I just tested the compiled c++ exaples that somed with BASSasio and they work.  I don't get it.

edit: Even the VB6 example for BASSasio, works..?

And your SimpleAsioFX, when "play" the VU meter move and position, but no sound. Have checked my ASIO control panel. Why???

« Last Edit: 25 Aug '07 - 16:00 by ken »

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.7 !
« Reply #245 on: 25 Aug '07 - 16:57 »
No, but it is a little different ;-)

Take a look to the BASS.NET provided C# sample called "SimpleAsio" or "SimpleAsioFX"...that will give you some hints I guess.

I found an older version of BASS.NET compiled, 2.3.0.6  and SimpleAsio works fine. But the not latest version 2.3.1.7.

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.7 !
« Reply #246 on: 25 Aug '07 - 17:26 »
Correction. In that older version. I also hade an older BASSasio.

If I take that older Bassasio and use with latest BASS.NET it works!  I dont know the version but I notised that the function "ChannelSetVolume is not in that bassasio.dll

Hope that helps  ???

radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.7 !
« Reply #247 on: 25 Aug '07 - 17:38 »
What compile error do you get? - seems I don't get any here!

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.7 !
« Reply #248 on: 25 Aug '07 - 17:46 »
No, I don't get any compile error.

I come to the conclution that the latest bassasio.dll don't work with BASS.NET (stangly works in VB6 and C++ example)

Strange this is also that your SimpleAsioFX app runs fine, the VU meters show signal and position is roling, but there is no sound.  But do I use a older version of bassasio.dll then I get sound. But in that version I get error when calling "BASS_ASIO_ChannelSetVolume" 

So mabey something wrong with volume handeling in BASS.NET vs latest bassasio  (version from 23 Aug '07)  ?

radio42

  • Posts: 4840
Re: BASS .NET API 2.3.1.7 !
« Reply #249 on: 26 Aug '07 - 18:35 »
Ahh, I didn't know, that Ian already released that new version for ASIO ;-)

Yes, the signature of the ASIOPROC has changed (it now expects a return value).
The advantage is, that now the user ASIOPROCs doesn't need to fill remaining buffer samples with 0's.

Here is the BASS.NET update for .Net 2.0:
.Net 2.0 build : Click here

Just copy it to your installation directory.

Pls note, that you also would need to change the sample code, e.g. in the "SimpleAsio" the AsioCallback now would lok like this:
Code: [Select]
// the main ASIO callback - filling the ASIO buffer with sample data to play...
private int AsioCallback(bool input, int channel, IntPtr buffer, int length, int user)
{
    // Note: 'user' contains the underlying stream channel
    int decLength = Bass.BASS_ChannelGetData(user, buffer, length);

    // on error, we need to set the return value to 0!
    if (decLength < 0)
        decLength = 0;
    return decLength;
}


P.S.: This update also adds a new feature to the EncoderOGG supporting oggenc2.2.84 !