22 May '13 - 10:23 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: [c#] playing and recording network stream, with dsp only on playing part  (Read 1438 times)
fuflo
Guest
« on: 18 Apr '09 - 18:49 »
Reply with quoteQuote

hey. so, basically i'm trying to do this:

1. play a wma stream
2. if chosen, record it to disk ( using flac.exe and the example from bass.net about encoders )
3. have a volume control on 1.
4. volume control doesn't affect the recorded data

right now everything works fine except for 4.

and it currently works like this:

1. play
2. press a button to record, and then this code is executed


        public void Record(string filename)
        {
            flacrec = new EncoderFLAC(_Stream);
            flacrec.InputFile = null;
            flacrec.OutputFile = filename;
            flacrec.FLAC_CompressionLevel = 8;

            flacrec.Start(null, IntPtr.Zero, false);
        }

where _Stream is my playing stream handle.
but then if i adjust the volume with DSP_Gain on the playing stream, that's the way it gets recorded, with lower volume.

so my question would be, how do i clone a stream without cloning the dsp that's set on it.
or something like that..

i checked the samples and bass.net help. tried with BASS_StreamCreatePush(), but either i don't get it or it's not suitable for me.

or maybe there's another method of making software volume mixer, not using dsps?
Logged
radio42
Posts: 4012


« Reply #1 on: 19 Apr '09 - 17:08 »
Reply with quoteQuote

Internally, the sending of sample data to the encoder is implemented via a DSP callback on the channel. That means when you play the channel (or call BASS_ChannelGetData if it's a decoding channel), the sample data will be sent to the encoder at the same time.
By default, the encoder DSP has a priority setting of -1000, which determines where in the DSP chain the encoding is performed. That can be changed via the BASS_CONFIG_ENCODE_PRIORITY config option.

So I don't know what priority you are using with your volume control?
If that priority is greater than -1000, e.g. 0 - then this volume DSP will be applied before the encoder DSP.
So set the priority of the volume DSP to a value smaller than -1000, e.g. -1001.

Logged
fuflo
Guest
« Reply #2 on: 19 Apr '09 - 18:03 »
Reply with quoteQuote

oh wow. cool. worked like a charm. thanks for the simple solution Smiley
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines