21 May '13 - 07:12 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  Developments / BASS / Re: cd to flac, popup but no output on: 9 Jul '12 - 16:23
Hi Ian,

is exactly what I did! Tried to run that installer, saw nothing happening so renamed it. And ended up with the popup and no output.
It is all coming together nicely now!
Thanks!
ReplyReply Reply with quoteQuote
2  Developments / BASS / cd to flac, popup but no output on: 8 Jul '12 - 11:04
Hi,

I am trying to rip a cd to flac output, but for every track I get a pop-up warning me that the (flac 1.2.1b setup) "the installer is already running".
If that is not enough, the rip does start, but does not deliver an output file.

I am using this code:
_encoder = BassCd.BASS_CD_StreamCreate(driveNo, trackNr - 1, BASSFlag.BASS_STREAM_DECODE);

EncoderFLAC flac = new EncoderFLAC(_encoder );
flac.InputFile = null;
flac.OutputFile = [i]myFileName[/i];
flac.TAGs = [i]mytags[/i];

flac.Start(null, IntPtr.Zero, false);

byte[] buff = new byte[1048510];

while (Bass.BASS_ChannelIsActive(_encoder) == BASSActive.BASS_ACTIVE_PLAYING)
{
    ...
    int len = Bass.BASS_ChannelGetData(_encoder, buff, buff.Length);
    ...
}

BassEnc.BASS_Encode_Stop(_encoder);

Bass.BASS_StreamFree(_encoder); 

using the exact same code to rip to MP3 using Lame works as a charm. The only difference being:
EncoderLAME lame = new EncoderLAME(_encoder);


What am I doing wrong? Huh
ReplyReply Reply with quoteQuote
3  Developments / BASS / Re: Read and Encode CD Track into memory on: 23 Jun '12 - 22:09
I think I have to stop this post. Cry
My original plan was to read a cd track, encode in into memory and save it there for a while, and do the playback later on from memory as if it was a normal mp3 file. Basicaly feed the momory 'file' into the branches I already have that play mp3's. This would mean fast reading of the cd, take it out and still being able to play it.
After some more reading and searching it turns out that a 'normal' mp3 file has header information at the front of the file which is written by the encode at the last moment. Impossible to do while the encoded information in the meantime is led away to some place in memory. So what I would have in memory is a lot of encoded bytes that I would not be able to head or front from.
So I might as well give up before I waste any more of your time.
Ian, I apologise.

John
ReplyReply Reply with quoteQuote
4  Developments / BASS / Re: Read and Encode CD Track into memory on: 23 Jun '12 - 17:51
I now moved the lame.exe into the library which resulted in the Encoder starting! (Stupid me: I assumed the lame dll was enough Embarrassed).
Still, there was only one pass through the while loop, where BASS-ChannelGetData returns -1, untill I noticed I had been tinkering with the lame command as well.
Reset that to "lame.exe -" and off it went: looping like mad! Great.
Increased the buffer from 20k to 1Mb and it still went looping like mad.
A bit too much: I interrupted the loop after some 25000(!) passes and no callback yet! And 25000 Mb is a bit more than would fit on that cd...
(ok, now for some food and football).

Later..
ReplyReply Reply with quoteQuote
5  Developments / BASS / Re: Read and Encode CD Track into memory on: 22 Jun '12 - 22:02
Hi Ian,

quick reply!

I now changed my code to:
private ENCODEPROC _myEndoderProc;
 private void MyEncodingWriter(int handle, int channel, IntPtr buffer, int length, IntPtr user)
 {
  // copy from managed to unmanaged memory
  Marshal.Copy(buffer, _encbuffer, 0, length);
  // process the data in _encbuffer, e.g. write to disk or whatever
  m.Write(_encbuffer, 0, _encbuffer.Length);
  Console.WriteLine("callback with " + length);
 }

...and

 int _decoder = BassCd.BASS_CD_StreamCreate(ct.driveNo, ct.trackNr - 1, BASSFlag.BASS_STREAM_DECODE);
 _myEndoderProc = new ENCODEPROC(MyEncodingWriter);

 BassEnc.BASS_Encode_Start(_decoder, "lame -", BASSEncode.BASS_ENCODE_AUTOFREE, _myEndoderProc, IntPtr.Zero);
 m = new MemoryStream();
 while ((Bass.BASS_ChannelIsActive(_decoder) == BASSActive.BASS_ACTIVE_PLAYING)
     && (BassEnc.BASS_Encode_IsActive(_decoder) == BASSActive.BASS_ACTIVE_PLAYING))
 { // stream and encoder still running
   byte[] _encbuffer = new byte[20000]; // processing buffer
   Bass.BASS_ChannelGetData(_stream, _encbuffer, _encbuffer.Length); // send the buffered data to the encoder
 }
 Bass.BASS_StreamFree(_decoder); // free the decoder stream


(I changed the returntype of MyEncodingWriter to void because the compiler kept complaining)

But... the effect is still the same: jump straight over the while loop and do nothing.When I check the switches the Channel is active, but the Encoder is on stopped before the loop is entered.

Can it be an encoder problem? I downloaded the latest Lame (3.99.5) and put the lame_enc.dll in the directory, and used the PluginLoad directly after the init...

John


ReplyReply Reply with quoteQuote
6  Developments / BASS / Read and Encode CD Track into memory on: 22 Jun '12 - 16:29
Hi All,

since my first post as a very green newbee on Bass, I have come some way. I managed to play files from disk, files from an SQL database (mp3 as blobs) and CD tracks, and I thought to be ready for the next step, just combining my current 'victories'.

What I want now is get a CD track, read it and encode it using Lame into a byte array or memorystream to be played (much) later. Without any file creation.

so I get myself a stream:
_stream = BassCd.BASS_CD_StreamCreate(ct.driveNo, ct.trackNr - 1, BASSFlag.BASS_DEFAULT);

stick this into an encoder:
BassEnc.BASS_Encode_Start(_stream, "lame", BASSEncode.BASS_ENCODE_AUTOFREE, null, IntPtr.Zero)

and now all one needs to do is create the bytes:
MemoryStream m = new MemoryStream();
while (BassEnc.BASS_Encode_IsActive(_stream) != BASSActive.BASS_ACTIVE_STOPPED)
    byte[] buf = new byte[20000];                        // processing buffer
    BassEnc.BASS_Encode_Write(_stream, buf, buf.Length); // send the buffered data to the encoder
    m.Write(buf, 0, buf.Length);                         // append the stream
}
BassEnc.BASS_Encode_Stop(_stream); // close the encoder
and lo: I have a memorystream for later consumption.

I am afraid this was too easy, since the the loop to fill my memorystream never is entered.
Now I suspect it is 'just' setting the right switches, but for the life of me I cannot figure out which to use.

Does anyone have suggestion?

John
ReplyReply Reply with quoteQuote
7  Developments / BASS / Re: Newbee needs C# example for CD Read and Rip on: 20 Jun '12 - 16:20
Hi Ian,

thanks! This is just the simple start I need. I can work it out from here.


John
ReplyReply Reply with quoteQuote
8  Developments / BASS / Newbee needs C# example for CD Read and Rip on: 18 Jun '12 - 22:31
Hi All,

only just started with BASS (dotnet) and so far I'm well impressed!
Also the examples provided with the installation are very good starting points. There is only one I miss (if my eyes don't deceive me...): a simple example in c# to read and rip a cd (preferable using lame).
Over the last two days I have been plowing through the forum but can't find anything.

Can anyone provide such an example?
ReplyReply Reply with quoteQuote
Pages: [1]
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines