|
radio42
Posts: 4012
|
 |
« Reply #140 on: 27 Jul '11 - 08:39 » |
Quote
|
When you popuplate a combobox the items are objects! The combobox uses the 'ToString' overload of the item's class to display it's value. So simply implement the overload for the 'ToString' method for your 'AudioDevice' class: public class AudioDevice { public AudioDevice() { }
public int DeviceID { get; set; } public string DeviceName { get; set; }
public override string ToString() { return DeviceName; } }
The crash you experience when using cmbDevOut.Items.Add(_AudioDevice.DeviceName); instead of cmbDevOut.Items.Add(_AudioDevice); is probably due to the fact, that when you access the cmbDevOut.SelectedItem you cast this back to (AudioDevice). But when adding a string to the combobox item's you can not cast them back to an AudioDevice ;-)
|
|
|
|
|
Logged
|
|
|
|
|
BaseHead
Posts: 91
|
 |
« Reply #141 on: 27 Jul '11 - 08:56 » |
Quote
|
Whoo! You rock!!  I was just scratching my head cuz I thought for sure everyone would want real names filled in the combo boxes and I didn't see mention of it so I figure it was something wrong on my end till I popped it in a test app with the same results. all good now! thx! Steve
|
|
|
|
|
Logged
|
|
|
|
|
morcibacsi
Posts: 11
|
 |
« Reply #142 on: 28 Jul '11 - 21:02 » |
Quote
|
Hi! I'm trying to record from stereo mix and from mic using BassMix to an mp3 file with C#, but I could not get it to work. Tried to set things up using a BassWasapiHandler, and without it too, but due to the "new nature" of this stuff, I couldn't came up with nothing  There aren't as many examples as with regular BASS stuff  Could anybody give me a kickstart with the BassWasapiHandler and the encoder part please? :$ What I have so far: ... private EncoderLAME encoder; private int stereo_mixer; private int microphone; private int mixer; private BassWasapiHandler stereoHandler; private BassWasapiHandler micHandler; ... private void btStartWASAPI_Click(object sender, EventArgs e) { Bass.BASS_Init(-1, 48000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
stereoHandler = new BassWasapiHandler(int.Parse(textBox1.Text), false, 48000, 2, 0, 0); log(string.Format("smINIT: {0}", stereoHandler.Init())); stereoHandler.DeviceVolume = 1; stereoHandler.Volume = 1; int stereo_mixer = stereoHandler.InputChannel; log(string.Format("stereo mixer: {0} ({1})", stereo_mixer, Bass.BASS_ErrorGetCode())); // double check, that the device is not muted externally if (stereoHandler.DeviceMute) stereoHandler.DeviceMute = false; log(string.Format("smSTART: {0}", stereoHandler.Start())); log(string.Format("stereo mixer: {0} ({1})", stereo_mixer, Bass.BASS_ErrorGetCode()));
micHandler = new BassWasapiHandler(int.Parse(textBox2.Text), false, 48000, 2, 0, 0); log(string.Format("micInit: {0}", micHandler.Init())); micHandler.DeviceVolume = 1; micHandler.Volume = 1; int microphone = micHandler.InputChannel; log(string.Format("microphone: {0} ({1})", microphone, Bass.BASS_ErrorGetCode())); // double check, that the device is not muted externally if (micHandler.DeviceMute) micHandler.DeviceMute = false; log(string.Format("micSTART: {0}", micHandler.Start())); log(string.Format("microphone: {0} ({1})", microphone, Bass.BASS_ErrorGetCode()));
mixer = BassMix.BASS_Mixer_StreamCreate(48000, 2, BASSFlag.BASS_SAMPLE_FLOAT); log(string.Format("Mixer: {0} ({1})", mixer, Bass.BASS_ErrorGetCode()));
bool res = BassMix.BASS_Mixer_StreamAddChannel(mixer, stereo_mixer, BASSFlag.BASS_MIXER_END);// BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); log(string.Format("Channel1: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
res = BassMix.BASS_Mixer_StreamAddChannel(mixer, microphone, BASSFlag.BASS_MIXER_END);// BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); log(string.Format("Channel2: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
// mute the mixer, so that you don't hear it in the output to avoid echos! res = Bass.BASS_ChannelSetAttribute(mixer, BASSAttribute.BASS_ATTRIB_VOL, 0f); log(string.Format("ChannelSet: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
encoder = new EncoderLAME(mixer); encoder.InputFile = null; encoder.OutputFile = "out.mp3"; encoder.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; encoder.LAME_Mode = EncoderLAME.LAMEMode.Default; encoder.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; encoder.LAME_Quality = EncoderLAME.LAMEQuality.Quality;
res = encoder.Start(null, IntPtr.Zero, false); //new version log(string.Format("encodeStart: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
// start the mixer Bass.BASS_ChannelPlay(mixer, false); log(string.Format("ChannelPlay: {0} ({1})", res, Bass.BASS_ErrorGetCode())); }
private void btStopWASAPI_Click(object sender, EventArgs e) { encoder.Stop(); Bass.BASS_ChannelStop(mixer); stereoHandler.Stop(); micHandler.Stop();
|
|
|
|
« Last Edit: 28 Jul '11 - 22:23 by morcibacsi »
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #143 on: 29 Jul '11 - 18:52 » |
Quote
|
The problem are your "BassMix.BASS_Mixer_StreamAddChannel" calls. You are trying to add the "BassWasapiHandler.InputChannel" to a mixer. However, the "BassWasapiHandler.InputChannel" is a Dummy decoding stream which can not be added to a mixer itself. You can only use them to apply DSP/FX or encoders on it - but they can not be used in sub-sequent mixers!
What you can do is to set the 'full-duplex' option (see the "SetFullDuplex" method). You might use the 0 (no-sound) bass device together with the BASS_STREAM_DECODE flag when calling the "SetFullDuplex" method in order to create a custom decoding "OutputChannel" which might then be used as a source for a mixer channel! See the docs for details.
|
|
|
|
|
Logged
|
|
|
|
|
morcibacsi
Posts: 11
|
 |
« Reply #144 on: 30 Jul '11 - 21:09 » |
Quote
|
Thanks for the fast reply. Tried what you suggested, and inserted the SetFullDuplex method, after the init calls, and now using the OutputChannel for the mixer, but the SetFullDuplex calls return false, however the Bass.BASS_ErrorGetCode() says BASS_OK (and the OutpuChannel returns 0). I'm digging the help of the BassWasapiHandler, but I'm feeling I am missing something. What would it be?
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #145 on: 30 Jul '11 - 21:52 » |
Quote
|
pls post your updated code to take a look at
|
|
|
|
|
Logged
|
|
|
|
|
morcibacsi
Posts: 11
|
 |
« Reply #146 on: 30 Jul '11 - 21:59 » |
Quote
|
Here's the updated code: Bass.BASS_Init(-1, 48000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
stereoHandler = new BassWasapiHandler(int.Parse(textBox1.Text), false, 48000, 2, 0, 0); log(string.Format("smINIT: {0}", stereoHandler.Init())); log(string.Format("stereo mixer isInput: {0}", stereoHandler.IsInput)); stereoHandler.DeviceVolume = 1; stereoHandler.Volume = 1;
bool res = stereoHandler.SetFullDuplex(0, BASSFlag.BASS_STREAM_DECODE, false); log(string.Format("stereo mixer fullduplex: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
int stereo_mixer = stereoHandler.OutputChannel; log(string.Format("stereo mixer: {0} ({1})", stereo_mixer, Bass.BASS_ErrorGetCode()));
// double check, that the device is not muted externally if (stereoHandler.DeviceMute) stereoHandler.DeviceMute = false;
log(string.Format("smSTART: {0}", stereoHandler.Start())); log(string.Format("stereo mixer: {0} ({1})", stereo_mixer, Bass.BASS_ErrorGetCode())); //--------------------------------------------------------------------------------------------------------- micHandler = new BassWasapiHandler(int.Parse(textBox2.Text), false, 48000, 2, 0, 0); log(string.Format("micInit: {0}", micHandler.Init())); log(string.Format("microphone isInput: {0}", micHandler.IsInput)); micHandler.DeviceVolume = 1; micHandler.Volume = 1;
res = micHandler.SetFullDuplex(0, BASSFlag.BASS_STREAM_DECODE, false); log(string.Format("microphone fullduplex: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
int microphone = micHandler.OutputChannel; log(string.Format("microphone: {0} ({1})", microphone, Bass.BASS_ErrorGetCode())); // double check, that the device is not muted externally if (micHandler.DeviceMute) micHandler.DeviceMute = false; log(string.Format("micSTART: {0}", micHandler.Start())); log(string.Format("microphone: {0} ({1})", microphone, Bass.BASS_ErrorGetCode()));
mixer = BassMix.BASS_Mixer_StreamCreate(48000, 2, BASSFlag.BASS_SAMPLE_FLOAT); log(string.Format("Mixer: {0} ({1})", mixer, Bass.BASS_ErrorGetCode()));
res = BassMix.BASS_Mixer_StreamAddChannel(mixer, stereo_mixer, BASSFlag.BASS_MIXER_END);// BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); log(string.Format("Channel1: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
res = BassMix.BASS_Mixer_StreamAddChannel(mixer, microphone, BASSFlag.BASS_MIXER_END);// BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); log(string.Format("Channel2: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
// mute the mixer, so that you don't hear it in the output to avoid echos! res = Bass.BASS_ChannelSetAttribute(mixer, BASSAttribute.BASS_ATTRIB_VOL, 0f); log(string.Format("ChannelSet: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
encoder = new EncoderLAME(mixer); encoder.InputFile = null; encoder.OutputFile = "out.mp3"; encoder.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; encoder.LAME_Mode = EncoderLAME.LAMEMode.Default; encoder.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; encoder.LAME_Quality = EncoderLAME.LAMEQuality.Quality;
res = encoder.Start(null, IntPtr.Zero, false); //new version log(string.Format("encodeStart: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
// start the mixer Bass.BASS_ChannelPlay(mixer, false); log(string.Format("ChannelPlay: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
Thanks for your time 
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #147 on: 31 Jul '11 - 18:49 » |
Quote
|
Please check, if the "BassWasapiHandler.IsInput" returns TRUE! E.g. if "stereoHandler.IsInput" returns TRUE?
If that is not the case, you are dealing with an WASAPI output device and you can not use this with the "SetFullDuplex" function, as it is only supported for recording or loopback devices. I.e. you had passed a 'wrong' device id to the BassWasapiHandler constructor. Meaning the device must have the BASS_DEVICE_INPUT or the BASS_DEVICE_LOOPBACK flag set whan calling BASS_WASAPI_GetDeviceInfo.
|
|
|
|
|
Logged
|
|
|
|
|
morcibacsi
Posts: 11
|
 |
« Reply #148 on: 31 Jul '11 - 21:16 » |
Quote
|
I've checked them, both of them returns true. I'm passing device id 21 and 25 to the BassWasapiHandler's constructors. List.exe from the "basswasapi.zip\c\bin" shows these infos for the two ids: dev 21: Speaker (Creative SB Audigy) id: {0.0.0.00000000}.{ce78ef44-568a-4024-aebb-250021779435} flags: loopback input enabled (25) dev 25: Microphone (2 - Realtek High Definition Audio) id: {0.0.1.00000000}.{104927e3-ae98-4aa9-abed-813780fdaf37} flags: input enabled default (19)
|
|
|
|
« Last Edit: 31 Jul '11 - 21:18 by morcibacsi »
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #149 on: 1 Aug '11 - 09:19 » |
Quote
|
Are you actually calling "BASS_WASAPI_Init" somewhere (as I couldn't see that in your code)?! Note, that you need to call "BASS_Init" as well as "BASS_WASAPI_Init"!
|
|
|
|
|
Logged
|
|
|
|
|
morcibacsi
Posts: 11
|
 |
« Reply #150 on: 1 Aug '11 - 12:30 » |
Quote
|
Well, there was an BASS_WASAPI_Init call on application startup, but with device id 0. Maybe that was one of the problems. Another problem was, that I've passed null as the wasapiproc argument but as I understand from the help it has to be implemented, so I've fixed that too. Unfortunately these didn't fix the problem. Both BassWasapiHandler's Init methods return false, and Bass.BASS_ErrorGetCode() says BASS_ERROR_ALREADY. SetFullDuplex returns false too. Now the code looks like this (I've included the full code, it is just a quick sample application): using System; using System.Windows.Forms; using Un4seen.Bass; using Un4seen.Bass.AddOn.Enc; using Un4seen.Bass.Misc; using Un4seen.Bass.AddOn.Mix; using Un4seen.BassWasapi;
namespace WindowsFormsApplication4 { public partial class Form1 : Form { private EncoderLAME encoder; private int stereo_mixer; private int microphone; private int mixer; private BassWasapiHandler stereoHandler; private BassWasapiHandler micHandler; private WASAPIPROC smWasapiProc; private WASAPIPROC micWasapiProc;
public Form1() { InitializeComponent(); }
public void log(string msg) { richTextBox1.Text += String.Format("{0}\n", msg); }
public int MyWasapiProc(IntPtr buffer, int length, IntPtr user) { return 1; }
private void btStartWASAPI_Click(object sender, EventArgs e) { Bass.BASS_Init(-1, 48000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
smWasapiProc = new WASAPIPROC(MyWasapiProc); bool res = BassWasapi.BASS_WASAPI_Init(int.Parse(textBox1.Text), 0, 2, BASSWASAPIInit.BASS_WASAPI_AUTOFORMAT, 0, 0, smWasapiProc, IntPtr.Zero); log(string.Format("smWASAPI_Init: {0} ({1})", res, Bass.BASS_ErrorGetCode())); stereoHandler = new BassWasapiHandler(int.Parse(textBox1.Text), false, 48000, 2, 0, 0); log(string.Format("smInit: {0}", stereoHandler.Init())); log(Bass.BASS_ErrorGetCode().ToString()); log(string.Format("stereo mixer isInput: {0}", stereoHandler.IsInput)); stereoHandler.DeviceVolume = 1; stereoHandler.Volume = 1;
res = stereoHandler.SetFullDuplex(0, BASSFlag.BASS_STREAM_DECODE, false); log(string.Format("stereo mixer fullduplex: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
int stereo_mixer = stereoHandler.OutputChannel; log(string.Format("stereo mixer: {0} ({1})", stereo_mixer, Bass.BASS_ErrorGetCode()));
// double check, that the device is not muted externally if (stereoHandler.DeviceMute) stereoHandler.DeviceMute = false;
log(string.Format("smSTART: {0}", stereoHandler.Start())); log(string.Format("stereo mixer: {0} ({1})", stereo_mixer, Bass.BASS_ErrorGetCode())); //--------------------------------------------------------------------------------------------------------- micWasapiProc = new WASAPIPROC(MyWasapiProc); res = BassWasapi.BASS_WASAPI_Init(int.Parse(textBox2.Text), 0, 2, BASSWASAPIInit.BASS_WASAPI_AUTOFORMAT, 50, 50, micWasapiProc, IntPtr.Zero); log(string.Format("micWASAPI_Init: {0} ({1})", res, Bass.BASS_ErrorGetCode())); micHandler = new BassWasapiHandler(int.Parse(textBox2.Text), false, 48000, 2, 0, 0); log(string.Format("micInit: {0}", micHandler.Init())); log(Bass.BASS_ErrorGetCode().ToString()); log(string.Format("microphone isInput: {0}", micHandler.IsInput)); micHandler.DeviceVolume = 1; micHandler.Volume = 1;
res = micHandler.SetFullDuplex(0, BASSFlag.BASS_STREAM_DECODE, false); log(string.Format("microphone fullduplex: {0} ({1})", res, Bass.BASS_ErrorGetCode())); int microphone = micHandler.OutputChannel; log(string.Format("microphone: {0} ({1})", microphone, Bass.BASS_ErrorGetCode())); // double check, that the device is not muted externally if (micHandler.DeviceMute) micHandler.DeviceMute = false; log(string.Format("micSTART: {0}", micHandler.Start())); log(string.Format("microphone: {0} ({1})", microphone, Bass.BASS_ErrorGetCode()));
mixer = BassMix.BASS_Mixer_StreamCreate(48000, 2, BASSFlag.BASS_SAMPLE_FLOAT); log(string.Format("Mixer: {0} ({1})", mixer, Bass.BASS_ErrorGetCode()));
res = BassMix.BASS_Mixer_StreamAddChannel(mixer, stereo_mixer, BASSFlag.BASS_MIXER_END);// BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); log(string.Format("Channel1: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
res = BassMix.BASS_Mixer_StreamAddChannel(mixer, microphone, BASSFlag.BASS_MIXER_END);// BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); log(string.Format("Channel2: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
// mute the mixer, so that you don't hear it in the output to avoid echos! res = Bass.BASS_ChannelSetAttribute(mixer, BASSAttribute.BASS_ATTRIB_VOL, 0f); log(string.Format("ChannelSet: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
encoder = new EncoderLAME(mixer); encoder.InputFile = null; encoder.OutputFile = "out.mp3"; encoder.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; encoder.LAME_Mode = EncoderLAME.LAMEMode.Default; encoder.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; encoder.LAME_Quality = EncoderLAME.LAMEQuality.Quality;
res = encoder.Start(null, IntPtr.Zero, false); //new version log(string.Format("encodeStart: {0} ({1})", res, Bass.BASS_ErrorGetCode()));
// start the mixer Bass.BASS_ChannelPlay(mixer, false); log(string.Format("ChannelPlay: {0} ({1})", res, Bass.BASS_ErrorGetCode())); }
private void btStopWASAPI_Click(object sender, EventArgs e) { encoder.Stop(); Bass.BASS_ChannelStop(mixer); stereoHandler.Stop(); micHandler.Stop(); } } }
Program output is: smWASAPI_Init: True (BASS_OK) smInit: False BASS_ERROR_ALREADY stereo mixer isInput: True stereo mixer fullduplex: False (BASS_OK) stereo mixer: 0 (BASS_OK) smSTART: True stereo mixer: 0 (BASS_OK) micWASAPI_Init: True (BASS_OK) micInit: False BASS_ERROR_ALREADY microphone isInput: True microphone fullduplex: False (BASS_OK) microphone: 0 (BASS_OK) micSTART: True microphone: 0 (BASS_OK) Mixer: -1342177277 (BASS_OK) Channel1: False (BASS_ERROR_HANDLE) Channel2: False (BASS_ERROR_HANDLE) ChannelSet: True (BASS_OK) encodeStart: True (BASS_OK) ChannelPlay: True (BASS_OK)
Now I'm a little desperate, usually my codes are working 
|
|
|
|
|
Logged
|
|
|
|
|
radio42
Posts: 4012
|
 |
« Reply #151 on: 1 Aug '11 - 13:25 » |
Quote
|
No, maybe there was a missunderstanding - I ment the "BassWasapiHandler.Init()" method! There is no need to provide your own WASAPI proc - as the BassWasapiHandler handler implements them internally!
So here is the sequence for using the BassWasapiHandler handler: 1. call BASS_Init(...) 2. create an instance of the BassWasapiHandler handler (new BassWasapiHandler(...)) 3. Init the handler (call BassWasapiHandler.Init()) 4. Set the full-duplex option (call SetFullDuplex(...)) 5. Start the handler (call BassWasapiHandler.Start())
|
|
|
|
|
Logged
|
|
|
|
|
morcibacsi
Posts: 11
|
 |
« Reply #152 on: 1 Aug '11 - 20:10 » |
Quote
|
Well, then I can't figure out what could be the problem. The calls are in that order, what you suggested. The .Init methods are there, in logging lines. I've just tried the application on an another computer, but it does not work. (I suspected something is wrong with my PC) Modified the code to not to use the WasapiHandler. This way I got no error messages, everything returns true, and whatsoever, but the resulting file is only 1879 bytes long. I'm trying everything but really got stuck now.  private EncoderLAME encoder; private int stereo_mixer; private int microphone; private int mixer; private WASAPIPROC smWasapiProc; private WASAPIPROC micWasapiProc; ... public int MyMicWasapiProc(IntPtr buffer, int length, IntPtr user) { return 1; }
public int MySMWasapiProc(IntPtr buffer, int length, IntPtr user) { return 1; }
private void btStartWASAPI_Click(object sender, EventArgs e) { Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
mixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT);
smWasapiProc = new WASAPIPROC(MySMWasapiProc); bool res = BassWasapi.BASS_WASAPI_Init(int.Parse(textBox1.Text), 0, 0, 0, 1, 0, smWasapiProc, IntPtr.Zero); stereo_mixer = Bass.BASS_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE, BASSStreamProc.STREAMPROC_PUSH); res = BassMix.BASS_Mixer_StreamAddChannel(mixer, stereo_mixer, BASSFlag.BASS_MIXER_END);// BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_MIXER_FILTER); micWasapiProc = new WASAPIPROC(MyMicWasapiProc); res = BassWasapi.BASS_WASAPI_Init(int.Parse(textBox2.Text), 0, 0, 0, 1, 0, smWasapiProc, IntPtr.Zero); microphone = Bass.BASS_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE, BASSStreamProc.STREAMPROC_PUSH); res = BassMix.BASS_Mixer_StreamAddChannel(mixer, microphone, BASSFlag.BASS_MIXER_END);
BassWasapi.BASS_WASAPI_SetDevice(int.Parse(textBox1.Text)); res = BassWasapi.BASS_WASAPI_Start(); BassWasapi.BASS_WASAPI_SetDevice(int.Parse(textBox2.Text)); res = BassWasapi.BASS_WASAPI_Start();
// mute the mixer, so that you don't hear it in the output to avoid echos! res = Bass.BASS_ChannelSetAttribute(mixer, BASSAttribute.BASS_ATTRIB_VOL, 0f); res = Bass.BASS_ChannelPlay(mixer, false);
encoder = new EncoderLAME(mixer); encoder.InputFile = null; encoder.OutputFile = "out.mp3"; encoder.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; encoder.LAME_Mode = EncoderLAME.LAMEMode.Default; encoder.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; encoder.LAME_Quality = EncoderLAME.LAMEQuality.Quality;
res = encoder.Start(null, IntPtr.Zero, false); }
private void btStopWASAPI_Click(object sender, EventArgs e) { encoder.Stop(); Bass.BASS_ChannelStop(mixer); Bass.BASS_ChannelStop(stereo_mixer); Bass.BASS_ChannelStop(microphone); }
|
|
|
|
« Last Edit: 2 Aug '11 - 15:23 by morcibacsi »
|
Logged
|
|
|
|
|
tigera
Posts: 4
|
 |
« Reply #153 on: 7 Aug '11 - 11:54 » |
Quote
|
I am trying use BASSWASAPI, but BASS_ErrorGetCode() return error 5000. Why?
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #154 on: 8 Aug '11 - 13:40 » |
Quote
|
Error code 5000 is BASS_ERROR_WASAPI, which indicates that WASAPI is not available. What Windows version are you using? Please note that WASAPI was introduced with Vista and it isn't available on older Windows versions.
|
|
|
|
|
Logged
|
|
|
|
|
tigera
Posts: 4
|
 |
« Reply #155 on: 9 Aug '11 - 16:19 » |
Quote
|
My OS is WinXP 
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #156 on: 9 Aug '11 - 17:49 » |
Quote
|
OK. Unfortunately, WASAPI won't be available to you then, but perhaps you could ASIO instead (via BASSASIO). ASIO has basically the same capabilities as WASAPI.
|
|
|
|
|
Logged
|
|
|
|
|
Led
Posts: 40
|
 |
« Reply #157 on: 14 Aug '11 - 21:22 » |
Quote
|
How do I use Bass x64 with Wasapi in C# ?
I've added the Basswasapi.dll (x64 version from the Winx64 folder) to my project. Build Action=Content, Copy Always.
If I build my app and I go to the \bin\x64\Debug folder where the executable is compiled, I see that the basswasapi.dll is copied there. But when I run my executable, it's still a no-go : +$exception{"Unable to load DLL 'basswasapi.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} System.Exception {System.DllNotFoundException}
The dll is in the same place the executable is in. Somehow my executable either can't load the dll, or is looking somewhere else entirely. How can i figure out what's going wrong ?
|
|
|
|
|
Logged
|
|
|
|
|
WACKA
Posts: 14
|
 |
« Reply #158 on: 24 Aug '11 - 14:27 » |
Quote
|
Hi,
I am currently using BassWasapi and it is working very well, many thanks!!
I am having a minor problem with volume control when the sound is going over HDMI. I am outputting to a HDMI tv from my PC but the BASS_WASAPI_SetVolume has no affect on the volume of the playback.
However, if i output to speakers or a usb headset, the volume control works fine.
Has anyone else experienced this? Does anyone have a workaround?
Thanks,
Conor
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #159 on: 24 Aug '11 - 14:41 » |
Quote
|
It might be that the device doesn't have a volume control. To confirm whether that is the case, you can check in the Sound control panel, eg. does the device have a "Levels" tab?
If you're using a mixer (BASSmix) to feed the WASAPI output, you can control the volume of the sources via BASS_ChannelSetAttribute (BASS_ATTRIB_VOL). Otherwise, you could use the BASS_FX add-on's BASS_FX_BFX_VOLUME effect to do it.
|
|
|
|
|
Logged
|
|
|
|
|