|
ken
Posts: 630
|
 |
« Reply #1100 on: 30 Jul '12 - 16:37 » |
Quote
|
A Metro style app must use references to another .NETCore or Portable Library binary only...it can NOT reference a full .NET 4.0
Thanks Bernd, I try to build my own DllImport wrapper. Init returns true, but I get Error 20 on CreateStreamURL. This is how I did, and I need your expert advice... [DllImport("bass.dll", CharSet = CharSet.Unicode)] public static extern bool BASS_Init(int device, int freq, int flags, int win, [MarshalAs(UnmanagedType.AsAny)] object clsid);
[DllImport("bass.dll", CharSet = CharSet.Unicode)] private static extern int BASS_StreamCreateURL(string url, int offset, int flags, [MarshalAs(UnmanagedType.AsAny)] object prog, int user);
bool _ret = BASS_Init(-1, 44100, 0, 0, null);
_stream = BASS_StreamCreateURL(url, 0, 0, null, 0);
int _err = BASS_ErrorGetCode();
BASS_ChannelPlay(_stream, false);
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1101 on: 30 Jul '12 - 23:09 » |
Quote
|
Have you tried using the BASS_UNICODE flag with your BASS_StreamCreateURL call? Like this: _stream = BASS_StreamCreateURL(url, 0, -2147483648, null, 0);
|
|
|
|
|
Logged
|
|
|
|
|
ken
Posts: 630
|
 |
« Reply #1102 on: 1 Aug '12 - 08:04 » |
Quote
|
Have you tried using the BASS_UNICODE flag with your BASS_StreamCreateURL call? Like this: _stream = BASS_StreamCreateURL(url, 0, -2147483648, null, 0); Thanks that works. I did some experiment and I can actually use Bass.Net.compact but I must use my own BASS_Init call... Now the biggest problem with Windows 8 Metro is that when my app loses focus the sound is faded down by the OS, so I can't run it in background. I haven't fond any docs on this yet.
|
|
|
|
|
Logged
|
|
|
|
|
LowEstring
Posts: 2
|
 |
« Reply #1103 on: 2 Aug '12 - 01:25 » |
Quote
|
I was reading through the Bass.NET help page "Interoperating with Unmanaged Code", and the section on Callbacks and Delegates and there is this piece of information: "A delegate is a class that can hold a reference to a method. But as a delegate is a class the same rules for garbage collection applies as for any other object - meaning delegates might a) be disposed (collected) or b) be re-located by the garbage collector!" But in the example following that of how to use delegates the RIGHT way, point b) might still occur because the callback isn't pinned using GCHandle.Alloc as described earlier. Is this wrong? I ask because I'm using callbacks in my app and wonder if I need to pin them so they aren't moved! Thanks 
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1104 on: 2 Aug '12 - 11:22 » |
Quote
|
No, the internal (Bass).Net marshaling already handles that for you when dealing with callback delegates (pointers to methods). So you don't have to pin those yourself.
It is enough/sufficient to keep a local reference to such callback delegate (e.g. within a regular member, as shown in the samples).
|
|
|
|
|
Logged
|
|
|
|
|
ken
Posts: 630
|
 |
« Reply #1105 on: 2 Aug '12 - 14:15 » |
Quote
|
No, the internal (Bass).Net marshaling already handles that for you when dealing with callback delegates (pointers to methods). So you don't have to pin those yourself.
It is enough/sufficient to keep a local reference to such callback delegate (e.g. within a regular member, as shown in the samples).
It could not be the garbage collector, when the my apps get focus again the playback continues. Windows 8 just fade down then playing audio when app is not showed and fades up the audio when I switch back to my app. Note this is a "Windows Metro Style App" (C#), I have not tested a "normal" WinForm or WPF app.
|
|
|
|
« Last Edit: 2 Aug '12 - 14:19 by ken »
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1106 on: 2 Aug '12 - 14:33 » |
Quote
|
I guess, that is a general Metro Style behaviour - which might be changed somewhere in the session settings. Sounds pretty much like the iPhone bahaviour - to avoid, that multiple 'parked' apps are all playing together.
|
|
|
|
|
Logged
|
|
|
|
|
ken
Posts: 630
|
 |
« Reply #1107 on: 2 Aug '12 - 15:10 » |
Quote
|
I guess, that is a general Metro Style behaviour - which might be changed somewhere in the session settings. Sounds pretty much like the iPhone bahaviour - to avoid, that multiple 'parked' apps are all playing together.
Yes gues that to. I found interface "IBackgroundTask", added that to my "AudioEngine" class, it worked once in background... I Think I have to Google some more.
|
|
|
|
|
Logged
|
|
|
|
|
Kmaa
Posts: 20
|
 |
« Reply #1108 on: 3 Aug '12 - 22:15 » |
Quote
|
Hello I have a little error with this command var libPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "binaries", Utils.Is64Bit ? "x64" : "x86"); LogFile.logMessage("Load Bass.Dll - " + libPath);
if (!Bass.LoadMe(libPath)) LogFile.logMessage("--" + Bass.BASS_ErrorGetCode()); if (!BassAsio.LoadMe(libPath)) LogFile.logMessage("--" + BassAsio.BASS_ASIO_ErrorGetCode());
In x86 the Command "BassAsio.LoadMe(libPath)" equal "BassAsio.LoadMe()" and dont load the bassasio.dll In x64 application, i havent this problem, and he load the good directory. Best Regard Kmaa
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1109 on: 6 Aug '12 - 09:29 » |
Quote
|
Please check the content of your "libPath". It should contain the fully qualified path (absolute) and not a relative one. E.g. try, if this works out: var libPath = Path.Combine(Application.ExecutablePath, "binaries", Utils.Is64Bit ? "x64" : "x86");
|
|
|
|
|
Logged
|
|
|
|
|
luke
Posts: 19
|
 |
« Reply #1110 on: 6 Aug '12 - 17:37 » |
Quote
|
A Metro style app must use references to another .NETCore or Portable Library binary only...it can NOT reference a full .NET 4.0 library because the Metro profile is not that large (and would fail store certification). Bass.Net however needs to use the full .Net Framework for its internal C++/CLI marshaling. As such Bass.Net can currently not be used to build Metro style apps. Looking at the Marshal class, to me it seems that it is almost completely available in portable librarys: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal%28v=vs.110%29.aspxUsing unsafe code is also allowed, so I do not see a reason why it should not be possible to create a Bass.NET PortableLibrary that will run on both "normal" .NET 4.0 (or 4.5) and on Metro apps. Is there any specific stuff that is missing? Be sure to uncheck windows phone / xbox and other stuff, and just select normal .NET and .NET for Metro apps when creating the portable library project in VS2012 RC.
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1111 on: 6 Aug '12 - 21:49 » |
Quote
|
In general that might be possible, but I tend to first wait on the official release before I release yet another build (a Bass.Net version compiled against the new PortableLibrary mode). However, the real issue with Metro-Style apps is a bit more complex. See here: http://www.un4seen.com/forum/?topic=13135and here: http://www.un4seen.com/forum/?topic=13753Basically a metro-style app should use the new WinRT API - and as such every Win32 method should be replaced by a WinRT method. This means bass.dll must be changed as well - so this is not only a pure Bass.Net task.
|
|
|
|
|
Logged
|
|
|
|
|
luke
Posts: 19
|
 |
« Reply #1112 on: 6 Aug '12 - 23:58 » |
Quote
|
Right, bass.dll would probably need quite some changes to be WinRT compliant. File and stream access will need to be changed to new IO functions. Only WASAPI playback is allowed in WinRT, "normal" playback would need to be disabled on WinRT builds. Addons that use deprecated APIs such as the DirectSound effects, DirectShow, ASIO cannot be used by a certified application...
|
|
|
|
|
Logged
|
|
|
|
|
LowEstring
Posts: 2
|
 |
« Reply #1113 on: 23 Aug '12 - 02:56 » |
Quote
|
This could well just be a .NET question, rather than bass specific... I'm using Bass.NET to retrieve an image for the spectrum/visualizer every 25ms (I haven't got my code in front of me so I can't remember which method exactly) and I've noticed that my programs memory usage goes up very fast, to around 1GB then drops down again, repeat cycle about every 5 seconds. I've changed the code slightly to dispose of the old image immediately after setting the new one, and it solves the memory problem  , but I'd just like to understand the behaviour Is the reason for the build up and drop off because the Garbage Collector hasn't done a sweep? While disposing it straight away causes it to be freed? Thanks!
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1114 on: 24 Aug '12 - 23:06 » |
Quote
|
Yes, more or less. An image within .Net is a kind of unmanaged resource and as such needs to be disposed explicitly. As such it can be garbage collected much quicker.
|
|
|
|
|
Logged
|
|
|
|
|
HarryHar
Posts: 135
|
 |
« Reply #1115 on: 19 Sep '12 - 20:00 » |
Quote
|
Hi, Can anybody tell me why the resulting MP3 is completly silent. If I use the FlacEncoder all works well. int channel = BassCd.BASS_CD_StreamCreate(driveNum, cddbTrack.TrackNumber-1, Un4seen.Bass.BASSFlag.BASS_STREAM_DECODE);
lameEncoder = new EncoderLAME(channel); lameEncoder.InputFile = null; //STDIN lameEncoder.OutputFile = "C:\\test.mp3"; lameEncoder.LAME_Bitrate = 320; lameEncoder.LAME_Mode = EncoderLAME.LAMEMode.Default; lameEncoder.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; lameEncoder.LAME_Quality = EncoderLAME.LAMEQuality.Q0; lameEncoder.Start(null, IntPtr.Zero, false);
while (Bass.BASS_ChannelIsActive(channel) != BASSActive.BASS_ACTIVE_STOPPED && !abort) { totalBytes += Bass.BASS_ChannelGetData(channel, buffer, dwBytes); progressHandler(((float)totalBytes / (float)length), ref abort); }
|
|
|
|
|
Logged
|
|
|
|
|
HarryHar
Posts: 135
|
 |
« Reply #1116 on: 19 Sep '12 - 22:08 » |
Quote
|
When is a New version of Bass.NET planned? At the moment it is not working with the new BassFX dll (BPM functions)
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1117 on: 20 Sep '12 - 09:22 » |
Quote
|
a) Sounds strange a quick test here revealed no problems. What verison of Lame.exe are you using?
b) Next release is planned for tomorrow!
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #1118 on: 20 Sep '12 - 17:18 » |
Quote
|
Or today ;-) 20.09.2012: Version 2.4.9.1 is out! BASS: added support for v2.4.9.6 BASS_FX: added support for v2.4.8.0 BASSMIDI: added support for v2.4.7.0 BASSOPUS: added support for v2.4.0.0 BASS_SPX: added support for v2.4.1.1 General: - Utils: Opus support added - Broadcast: new EncoderOPUS added - Broadcast: server ICEcast Opus support added - WaveForm: (De)Serialization bug-fix Note: - the v4.0 version also supports the v4.5 .Net Framework Full Install: www.un4seen.com/filez/4/Bass24.Net.zipLib only: www.un4seen.com/filez/4/Bass24.Net_update.zip
|
|
|
|
|
Logged
|
|
|
|
|
HarryHar
Posts: 135
|
 |
« Reply #1119 on: 20 Sep '12 - 20:02 » |
Quote
|
I was using Lame v3.96.1, after I upgraded to a more recent version all is working perfect now. Also thank you for the quick release of Bass.NET 
|
|
|
|
|
Logged
|
|
|
|
|