Show Posts
|
|
Pages: [1] 2 3
|
|
2
|
Developments / BASS / Re: problem encoding and decoding stream and sockets
|
on: 12 Mar '13 - 18:56
|
Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 1) Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 5)
Note the resulting BASS_CONFIG_BUFFER setting from that will actually be 101, as the minimum setting is BASS_CONFIG_UPDATEPERIOD+1 (and BASS_CONFIG_UPDATEPERIOD defaults to 100). Also note that these settings have no effect on recording, which appears to be what the rest of the code is doing. ok in the client1 all fine ( except the argument in the encode_start(...)) this is correct ? "lame --flush"
No, you still need the other parameters to set the input and output, and perhaps format/bitrate/etc too. I suggested you could add "--flush" to the LAME command-line, not replace it  Yep, that post gives the basic idea. I'm not a .Net user myself, so I'm afraid I can't advise on how to implement the network stuff there, but I guess there are some ready-made classes/methods available to handle that. If you still have trouble with it, you could perhaps try using BASSenc's built-in server option instead, eg. BASS_Encode_ServerInit; the client could then simply use BASS_StreamCreateURL to connect to the server. ok, i modified the const BASS_CONFIG_BUFFER and UPDATEPERIOD u have skype or other chat for contact you ?
|
Reply
Quote
|
|
|
3
|
Developments / BASS / Re: problem encoding and decoding stream and sockets
|
on: 11 Mar '13 - 18:46
|
but i have a question, how i can Decode, in the streamcreatepush ? (the idea is, the push work in the client receive data)
this is a little diagram
client 1--->speak--->encode--->send client 2---> receive---decode--->streampush for use the data received
If you want BASS to decode the data, then you should use BASS_StreamCreateFileUser instead of BASS_StreamCreatePush. You will also need to implement BASS_FILEPROCS callback functions to allow BASS to request file data from you. That could look something like this... BASS_FILEPROCS fileprocs={FileCloseProc, FileLenProc, FileReadProc}; // callback table stream=BASS_StreamCreateFileUser(STREAMFILE_BUFFER, 0, &fileprocs, 0); // create a "buffered" stream to play the received data if (!stream) ... // failed, cancel it (close conection/etc)
...
void CALLBACK FileCloseProc(void *user) { // close the connection }
QWORD CALLBACK FileLenProc(void *user) { return 0; // indeterminate length }
DWORD CALLBACK FileReadProc(void *buffer, DWORD length, void *user) { return recv(socket, buffer, length, 0); // read up to "length" bytes of data from the socket }
I would recommend starting with the STREAMFILE_BUFFER system first (as above), and get that working, before possibly switching to the STREAMFILE_BUFFERPUSH system and using BASS_StreamPutFileData. Please see the documentation for details on the aforementioned functions. i see this functions using search, but how to invoke,etc sorry is a little hard ok first, in the client1 (using the diagram) i use this methods ( i make the changes respect your first response) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim stream As Integer Dim encoder As Integer Bass.BASS_RecordInit(0) Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_REC_BUFFER, 1000) Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 1) Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 5) stream = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_DEFAULT Or BASSFlag.BASS_SAMPLE_FLOAT, Grabador, Nothing) encoder = BassEnc.BASS_Encode_Start(stream, "lame --flush", BASSEncode.BASS_ENCODE_DEFAULT, Encodeador, Nothing) end sub
Private Grabador As RECORDPROC = New RECORDPROC(AddressOf MiGrabacion)
Private Function MiGrabacion(ByVal handle As IntPtr, ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr) As Integer Return True End Function
Private Encodeador As ENCODEPROC = New ENCODEPROC(AddressOf MiEncodeador) Private data() As Byte ' local data buffer Private Function MiEncodeador(ByVal handle As IntPtr, ByVal channel As Integer, ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr) As Integer data = New Byte(length - 1) {} ' copy from managed to unmanaged memory Marshal.Copy(Buffer, data, 0, length) ... 'send to CLIENT2 Return True End Function
ok in the client1 all fine ( except the argument in the encode_start(...)) this is correct ? "lame --flush" in the client 2 is me hard dude :/ sorry i cant find good documentation for this case i see this post ---> http://www.un4seen.com/forum/?topic=12345.0but i have my dudes :S
|
Reply
Quote
|
|
|
4
|
Developments / BASS / Re: problem encoding and decoding stream and sockets
|
on: 11 Mar '13 - 17:07
|
Firstly, please note that BASS_MIXER_FILTER is not a valid flag for BASS_RecordStart or BASS_StreamCreatePush. Using an invalid flag can lead to unexpected results if its value coincides with another flag that is valid for the function. A list of valid flags can be found in each function's documentation.
A stream created with BASS_StreamCreatePush will be expecting to receive plain PCM sample data. When you have encoded data, you will need to either decode the data yourself before passing it to BASS_StreamPutData or use BASS_StreamCreateFileUser instead.
Also, I would suggest adding "--flush" to the LAME encoder's command-line to reduce the latency introduced by the encoding.
first, thx for help me but i have a question, how i can Decode, in the streamcreatepush ? (the idea is, the push work in the client receive data) this is a little diagram client 1--->speak--->encode--->send client 2---> receive---decode--->streampush for use the data received i have a little dude respect this A stream created with BASS_StreamCreatePush will be expecting to receive plain PCM sample data. When you have encoded data, you will need to either decode the data yourself before passing it to BASS_StreamPutData or use BASS_StreamCreateFileUser instead. and this i try change the argument in the encoder for this "--flush" and the callback not work :S
|
Reply
Quote
|
|
|
5
|
Developments / BASS / problem encoding and decoding stream and sockets
|
on: 9 Mar '13 - 23:51
|
hi, well i have this problem first i capture the stream audio of the mic using this in the CLIENT 1 (sender) Dim stream As Integer Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_REC_BUFFER, 1000) Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 1) Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 5) 'reproducir, e inicializar streams stream = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_DEFAULT Or BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_MIXER_FILTER, Grabador, Nothing) Bass.BASS_ChannelSetAttribute(Me.stream, BASSAttribute.BASS_ATTRIB_MUSIC_AMPLIFY, 100)
Private Grabador As RECORDPROC = New RECORDPROC(AddressOf MiGrabacion) Private Function MiGrabacion(ByVal handle As IntPtr, ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr) As Integer data = New Byte(length - 1) {} ' copy from managed to unmanaged memory Marshal.Copy(buffer, data, 0, length) Bass.BASS_StreamPutData(stream2, data, data.Length) Return True End Function
and in CLIENT 2 (receive) Dim stream2 As Integer stream2 = Bass.BASS_StreamCreatePush(44100, 2, BASSFlag.BASS_DEFAULT Or BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_MIXER_FILTER, Nothing) 'original Bass.BASS_ChannelSetAttribute(Me.stream2, BASSAttribute.BASS_ATTRIB_MUSIC_AMPLIFY, 100) Bass.BASS_ChannelPlay(stream2, False)
of course i test first in a unique app (in the function migrabacion i use) Bass.BASS_StreamPutData(stream2, data, data.Length) ok in this part FINE, but i find the first problem, i capture is the raw buffer, i need a encoded buffed ( for the lenght, i cant send in the sockets 60kb/miliS i try make this method Client 1 (encoding stream) Dim encoder As Integer encoder = BassEnc.BASS_Encode_Start(stream, "lame -", BASSEncode.BASS_ENCODE_DEFAULT, Encodeador, Nothing) 'lame -r -s 44100 -b 128 - Private Encodeador As ENCODEPROC = New ENCODEPROC(AddressOf MiEncodeador) Private Function MiEncodeador(ByVal handle As IntPtr, ByVal channel As Integer, ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr) As Integer data = New Byte(length - 1) {} ' copy from managed to unmanaged memory Marshal.Copy(Buffer, data, 0, length) Bass.BASS_StreamPutData(stream2, data, data.Length) Return True End Function
and of course i change in the client2 (receive, decoding stream) stream2 = Bass.BASS_StreamCreatePush(44100, 2, BASSFlag.BASS_DEFAULT Or BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_MIXER_FILTER or BASSFlag.BASS_STREAM_DECODE, Nothing) 'original
but not work  any suggestions ? NOTE = i try make a VOIP software ( a little skype or teamspeak or ventrilo )
|
Reply
Quote
|
|
|
6
|
Developments / BASS / Voice Chat Using bass Dudes
|
on: 23 Feb '13 - 21:11
|
|
good day
well i have a little questions
i can make a voice chat using server-client
i use Sockets, and i transfer in a array byte or buffer
exist a method for the bass, for make a voice chat :/ ?
|
Reply
Quote
|
|
|
7
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 22 Feb '13 - 22:45
|
i see this logic but if you can make a clear file is better  If FullSoundRange = True Then
If VisualisationType = 0 Then drawing.ScaleFactorLinear = 1 drawing.ScaleFactorLinearBoost = 0 drawing.ScaleFactorSqr = 1 drawing.ScaleFactorSqrBoost = 0 ElseIf VisualisationType = 1 Then drawing.ScaleFactorLinear = 3 drawing.ScaleFactorLinearBoost = 0.34 drawing.ScaleFactorSqr = 1 drawing.ScaleFactorSqrBoost = 0.04 ElseIf VisualisationType = 2 Then drawing.ScaleFactorLinear = 0.6 drawing.ScaleFactorLinearBoost = 0.1 drawing.ScaleFactorSqr = 1 drawing.ScaleFactorSqrBoost = 0 ElseIf VisualisationType = 3 Then drawing.ScaleFactorLinear = 1.5 drawing.ScaleFactorLinearBoost = 0.07 drawing.ScaleFactorSqr = 1 drawing.ScaleFactorSqrBoost = 0 ElseIf VisualisationType = 4 Then drawing.ScaleFactorLinear = 3 drawing.ScaleFactorLinearBoost = 0.7 drawing.ScaleFactorSqr = 1 drawing.ScaleFactorSqrBoost = 0.25 ElseIf VisualisationType = 5 Then drawing.ScaleFactorLinear = 3 drawing.ScaleFactorLinearBoost = 0.7 drawing.ScaleFactorSqr = 1 drawing.ScaleFactorSqrBoost = 0.25 ElseIf VisualisationType = 6 Then drawing.ScaleFactorLinear = 1 drawing.ScaleFactorLinearBoost = 0.14 drawing.ScaleFactorSqr = 0.6 drawing.ScaleFactorSqrBoost = 0.01 ElseIf VisualisationType = 7 Then drawing.ScaleFactorLinear = 0 drawing.ScaleFactorLinearBoost = 0 drawing.ScaleFactorSqr = 0 drawing.ScaleFactorSqrBoost = 0 End If
Else
If VisualisationType = 0 Then drawing.ScaleFactorLinear = 1 drawing.ScaleFactorLinearBoost = 0.1 drawing.ScaleFactorSqr = 0.6 drawing.ScaleFactorSqrBoost = 0 ElseIf VisualisationType = 1 Then drawing.ScaleFactorLinear = 9 drawing.ScaleFactorLinearBoost = 0.18 drawing.ScaleFactorSqr = 7 drawing.ScaleFactorSqrBoost = 0 ElseIf VisualisationType = 2 Then drawing.ScaleFactorLinear = 3 drawing.ScaleFactorLinearBoost = 0.06 drawing.ScaleFactorSqr = 2 drawing.ScaleFactorSqrBoost = 0.02 ElseIf VisualisationType = 3 Then drawing.ScaleFactorLinear = 4 drawing.ScaleFactorLinearBoost = 0.07 drawing.ScaleFactorSqr = 1.5 drawing.ScaleFactorSqrBoost = 0.2 ElseIf VisualisationType = 4 Then drawing.ScaleFactorLinear = 5.5 drawing.ScaleFactorLinearBoost = 0.23 drawing.ScaleFactorSqr = 2.5 drawing.ScaleFactorSqrBoost = 0.15 ElseIf VisualisationType = 5 Then drawing.ScaleFactorLinear = 5.5 drawing.ScaleFactorLinearBoost = 0.23 drawing.ScaleFactorSqr = 2.5 drawing.ScaleFactorSqrBoost = 0.15 ElseIf VisualisationType = 6 Then drawing.ScaleFactorLinear = 3 drawing.ScaleFactorLinearBoost = 0.025 drawing.ScaleFactorSqr = 2.3 drawing.ScaleFactorSqrBoost = 0.014 ElseIf VisualisationType = 7 Then drawing.ScaleFactorLinear = 0 drawing.ScaleFactorLinearBoost = 0 drawing.ScaleFactorSqr = 0 drawing.ScaleFactorSqrBoost = 0 End If
End If
is for CreateSpectrumLine or CreateSpectrumLinePeak or work for all types ? edit = thx for your help, but the value in the scales is the correct ? 
|
Reply
Quote
|
|
|
8
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 21 Feb '13 - 21:09
|
That would indeed help ;-) Source code plus the audio file used to 'test' it. In addition (as explained) several times - please also check the provided C# 'Simple' sample -as this works fine here !
Also note, that the 'Visuals' class is simply a nice add-on provided with Bass.Net - if you don't like it, you are still free to implement your own visuals.
i try test your samples  but i cant get again the curve in the spectrum (you can see the curve in the screens)
|
Reply
Quote
|
|
|
9
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 21 Feb '13 - 17:57
|
Two is not a lot. Why don't you guys simply show him your complete code instead of of re-iterating that it doesn't work? That will help him and you much more than pure complaints.
in the version 2.4.9.0 you can initializate and use easy the class visuals, only need set the stream audio but in the 2.4.9.1-later change and i no have documentation or well...
|
Reply
Quote
|
|
|
11
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 19 Feb '13 - 22:36
|
As said above, the provided 'Simple' sample works just fine here! So please show your code how you create an instance of the Visuals class and what exact code you are using the create the above shown image. Also note, that the display of the visuals depends on various factors and properties of the Visuals class, like: - the used FFT resolution (see 'MaxFFT') - the used frequency spectrum (see 'MaxFrequencySpectrum') - the used scaling factors (see 'ScaleFactorLinear', 'ScaleFactorLinearBoost', 'ScaleFactorSqr', 'ScaleFactorSqrBoost') - the format and resolution of the original audio being used (e.g. lossy formats typically don't contain much high-frequencies above 16kHz) - how you call the "Create..." methods (see the 'linear' and 'fullSpectrum' parameters)! The fact that high-frequencies are 'not' drawn resp. are not present in a resulting image might typically have the following reasons: - the high frequencies simply doesn't exist in the original audio - the image width is larger than the full frequency spectrum So try to play with the 'fullSpectrum' parameter when creating the image and also you might want to adjust the 'MaxFrequencySpectrum' property. Here is an example: private Visuals _vis = new Visuals(); ... _vis.MaxFFT = BASSData.BASS_DATA_FFT1024; // limit til 16kHz (assuming the original sample rate is 44.1kHz) _vis.MaxFrequencySpectrum = Utils.FFTFrequency2Index(16000, _vis.MaxFFTData, 44100); _vis.ScaleFactorLinear = 4; _vis.ScaleFactorSqr = 3; ... _vis.CreateSpectrumLinePeak(channelHandle, g, pictureEditVIS.ClientRectangle, Color.CornflowerBlue, Color.LightSteelBlue, Color.Orange, pictureEditVIS.BackColor, 3, 1, 2, 10, false, true, false);
work better but how i can reproduce the effect (see picture) in 2.4.9.0 ?
|
Reply
Quote
|
|
|
15
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 14 Feb '13 - 18:55
|
As said above a couple of new Properties has been added, which you might want to adjust. However, I just tried the provided 'Simple' example - which also contains various Visuals examples and they just work fine.
E.g. try to set the following (new) Properties to these values to achieve the old behaviour: ScaleFactorLinearBoost = 0.0f ScaleFactorSqrBoost = 0.0f
how to set the this property edit = ok i find, if i set to 2 this property i no get nothing, but i find a little info, i try get the old values and i get this info ScaleFactorLinearBoost =0.05 ScaleFactorSqrBoost =0.005 is normal ? i try change the value but i cant see diference in the visuals 2.4.9.0   see the bars, and i cant see the last bars...
|
Reply
Quote
|
|
|
16
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 13 Feb '13 - 02:20
|
Are you setting any other properties, e.g. when you create the "Me.spectrum" instance? Have you tried modifiying the above given properties?
is rare... if i use reference 2.4.9.0 (bass.net.dll) he work perfectly (using bass.DLL 2.4.9.19) but if i change the reference proyect to 2.4.9.1(bass.net.dll) he work bad and i no have idea :S but i not change nothing in my code
|
Reply
Quote
|
|
|
17
|
Developments / BASS / Re: problem with spectrum in version 2.4.9.1
|
on: 12 Feb '13 - 18:33
|
Can you please show your code, since in Bass.Net v2.4.9.1 a couple of new properties have been added to the visuals class: Namely... ScaleFactorLinear: Gets or Sets the scaling factor to apply when linear spectrum drawing is selected. (Default=9). ScaleFactorLinearBoost: Gets or Sets the boost factor for higher frequencies to apply when linear spectrum drawing is selected. (Default=0.05). ScaleFactorSqr: Gets or Sets the scaling factor to apply when non-linear spectrum drawing is selected to make low values more visible. (Default=4). ScaleFactorSqrBoost: Gets or Sets the boost factor for higher frequencies to apply when non-linear spectrum drawing is selected. (Default=0.005).
well in my actual version 2.4.9.0 i use this config me = instance visorspectrum = picturebox Select Case Me.DiseñoSpectro Case 0 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumLine(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, 8, 5, False, True, True) Case 1 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrum(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, False, True, True) Case 2 Dim a, r, g, b As Integer a = (Integer.Parse(color1.A) + Integer.Parse(color2.A)) / 2 r = (Integer.Parse(color1.R) + Integer.Parse(color2.R)) / 2 g = (Integer.Parse(color1.G) + Integer.Parse(color2.G)) / 2 b = (Integer.Parse(color1.B) + Integer.Parse(color2.B)) / 2 Dim p As Color = Color.FromArgb(a, r, g, b) Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumLinePeak(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, p, Color.Black, 4, 2, 1, 10, False, False, True) Case 3 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumDot(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, 8, 5, False, True, True) Case 4 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumEllipse(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, 8, 5, False, True, True) Case 5 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumText(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, "FDT", False, True, True) Case 6 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumWave(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, 5, False, True, True) Case 7 Me.visorSpectrum.Image = Me.spectrum.CreateSpectrumBean(Me.stream, Me.visorSpectrum.Width, Me.visorSpectrum.Height, Me.color1, Me.color2, Color.Black, 5, False, True, True) Case 8 Me.visorSpectrum.Image = Me.spectrum.CreateWaveForm(Me.stream, visorSpectrum.Width, visorSpectrum.Height, Me.color1, Me.color2, Color.Gray, Color.Black, 1, True, False, True) end select
and work perfect :/
|
Reply
Quote
|
|
|
19
|
Developments / BASS / Re: dude respect WASAPIPROC
|
on: 12 Feb '13 - 00:29
|
oki, when you now say how to get output sound (waveout) i try get sound of the speakers (i try capture game sounds)... this sounds like you don't want to use WASAPI for output, but instead want to capute the sound currently being played by any other application. If that is the case, you want to effectively record (input) via WASAPI - which is of course something differnt! So in such case you need to capture the sound from a WASAPI Loopback device! When enumerating your WASAPI devices (via "BassWasapi.BASS_WASAPI_GetDeviceInfos"), note, that the BASS_WASAPI_DEVICEINFO class contains a property "IsLoopback". You might use this property to identify the device id representing a Loopback device. A Loopback device is actualy a recording/capture device of a related output device (each regular output device has one related Loopback device, which might be used to recored 'what you hear'). When using the BassWasapiHandler with an input/loopback device you can use the "InputChannel" property to setup any encoding on it! So first identify you Lookback device you want to record from! Let's assume (in the example below your loopback device is id 12)... Private _wasapi As BassWasapiHandler Private _lame As EncoderLAME ... ' setup BASS - "no sound" device Bass.BASS_Init(0, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)
' assign WASAPI input in shared-mode _wasapi = new BassWasapiHandler(12, false, 44100, 2, 0f, 0f) _wasapi.Start()
' setup lame using the InputChannel _lame = New Un4seen.Bass.Misc.EncoderLAME(_wasapi.InputChannel) _lame.InputFile = Nothing _lame.OutputFile = Archivorepetido("output.mp3") _lame.LAME_Bitrate = EncoderLAME.BITRATE.kbps_192 _lame.LAME_Mode = EncoderLAME.LAMEMode.Stereo _lame.LAME_TargetSampleRate = EncoderLAME.SAMPLERATE.Hz_44100 _lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality _lame.Start(Nothing, IntPtr.Zero, False)
...
' _lame.Stop() ' _wasapi.Stop()
a other question how i can make 2 instances for bass ? because if i record (wasapi on,lame on) and i try start a sound in the bass i get this error in delegate We conducted a callback delegate type collected 'Bass.Net! Un4seen.BassWasapi.WASAPIPROC :: Invoke'. This can cause the application to crash, damage or loss of data. When passing delegates to unmanaged code, the application must keep them active to ensure that they will call back. oh well i change the local var basswasapi to global and work perfect, for now i use mixer stereo but my idea is capture audio for a specific process but well :p EDIT = (each regular output device has one related Loopback device, which might be used to recored 'what you hear'). i try use the device 3 (see me list in this post) he have loopback but the file result sound bad :S
|
Reply
Quote
|
|
|
20
|
Developments / BASS / Re: dude respect WASAPIPROC
|
on: 11 Feb '13 - 10:04
|
When you get an "Invalid device: BASS_ERROR_DEVICE" exception, this means you passed an invalid 'device' to the BassWasapiHandler.
Also, you are trying to use the "BassWasapiHandler.OutputChannel", but as the docs state: The OutputChannel gets the BASS output channel handle which is used with this WASAPI input handler in case of full-duplex monitoring. You must call the "SetFullDuplex" method in order to use this output channel.
So I guess you might want to use the "BassWasapiHandler.InternalMixer" for encoding: Which gets the internal mixer being used with this WASAPI handler (when used with an output device).
i know i get first the list of devices using Dim t() As BASS_WASAPI_DEVICEINFO = BassWasapi.BASS_WASAPI_GetDeviceInfos() and i get this Realtek Digital Output(Optical) (Realtek High Definition Audio) Realtek Digital Output(Optical) (Realtek High Definition Audio) Altavoces (Realtek High Definition Audio) Altavoces (Realtek High Definition Audio) Realtek Digital Output (Realtek High Definition Audio) Realtek Digital Output (Realtek High Definition Audio) Línea de entrada (Realtek High Definition Audio) Micrófono (Realtek High Definition Audio) Subwoofer (Realtek High Definition Audio) Center (Realtek High Definition Audio) Línea de entrada (Realtek High Definition Audio) Rear Green In (Realtek High Definition Audio) Front (Realtek High Definition Audio) Mezcla estéreo (Realtek High Definition Audio) FrontMic (Realtek High Definition Audio) Side (Realtek High Definition Audio) Micrófono (Realtek High Definition Audio) FrontMic (Realtek High Definition Audio) Rear (Realtek High Definition Audio)
of course i test using option 2 and 3 and nothing i cant get outputchannel ( i need capture the waveout of the speakers)... Dim w As New BassWasapiHandler(2, False, 44100, 2, 0, 0) w.Init() t2 = Bass.BASS_ErrorGetCode 'validation If w.DeviceMute Then w.DeviceMute = False End If w.Start() Lame = New Un4seen.Bass.Misc.EncoderLAME(w.InternalMixer) Lame.InputFile = Nothing Lame.OutputFile = Archivorepetido("output.mp3") Lame.LAME_Bitrate = EncoderLAME.BITRATE.kbps_192 Lame.LAME_Mode = EncoderLAME.LAMEMode.Stereo Lame.LAME_TargetSampleRate = EncoderLAME.SAMPLERATE.Hz_44100 Lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality Lame.Start(Nothing, IntPtr.Zero, False) ' Lame.Stop() lame create file, but no save nothing and if i use this method i can get the buffer RAW but i no have idea how to encode... (second method) Bass.BASS_PluginLoad("bassmix.dll") Bass.BASS_PluginLoad("basswasapi.dll") BassWasapi.BASS_WASAPI_Init(-1, 44100, 2, BASSWASAPIInit.BASS_WASAPI_AUTOFORMAT Or BASSWASAPIInit.BASS_WASAPI_SHARED, 0.5, 0, myRecordProc, Nothing) ' -1 default output BassWasapi.BASS_WASAPI_Start()
Public Function myRecord(ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr) As Integer If IsNothing(fs) = False Then If buffer = IntPtr.Zero Then ' finished downloading fs.Flush() fs.Close() Else ' increase the data buffer as needed If data Is Nothing OrElse data.Length < length Then data = New Byte(length) {} End If ' copy from managed to unmanaged memory Marshal.Copy(buffer, data, 0, length) ' write to file fs.Write(data, 0, length) End If End If End Function he work and get buffer RAW but i no have idea how to encode to mp3,etc you have a little example for how to get output sound (waveout) i try get sound of the speakers (i try capture game sounds)... WELLL i finally can  i get input of the mixer stereo BUTT... when i try test the mp3 in Windows media player i get bad duration time song ( or file).... is problem respect the lame or what ? 
|
Reply
Quote
|
|
|