|
WACKA
Posts: 14
|
 |
« Reply #160 on: 24 Aug '11 - 15:18 » |
Quote
|
Hi Ian,
Many thanks for the speedy reply.
I can confirm there is a levels tab for the hdmi output.
However, thanks for the mixer tip, I will use this to set the volume.
Many thanks,
Conor
|
|
|
|
|
Logged
|
|
|
|
|
yosato
Posts: 6
|
 |
« Reply #161 on: 30 Aug '11 - 22:42 » |
Quote
|
public bool start(string outFile, int freq, int devNum) { int wasapiId, bassId;
if (devNum == -1) { wasapiId = defaultWasapiNum; bassId = defaultBassNum; } else { wasapiId = wasapiNums[devNum]; bassId = bassNums[devNum]; }
Bass.BASS_Init(bassId, freq, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
_wasapiHandler = new BassWasapiHandler(wasapiId, true, freq, 2, 2f, 0.5f); if (_wasapiHandler.Init()) { _recordStream = _wasapiHandler.InputChannel;
// double check, that the device is not muted externally if (_wasapiHandler.DeviceMute) _wasapiHandler.DeviceMute = false; // check, that the master volume is not 0 if (_wasapiHandler.DeviceVolume == 0f) _wasapiHandler.DeviceVolume = 1f;
_myDSPProc = new DSPPROC(MyRecording); Bass.BASS_ChannelSetDSP(_recordStream, _myDSPProc, IntPtr.Zero, 0);
bw = new BinaryWriter(File.Open(outFile, FileMode.Create));
// start WASAPI _wasapiHandler.Start(); return true; } else return false;
}
bool writing = false;
private void MyRecording(int handle, int channel, IntPtr buffer, int length, IntPtr user) { if (length > 0 && buffer != IntPtr.Zero && bw != null) { writing = true; for (int i = 0; i < length; i++) bw.Write(Marshal.ReadByte(buffer, i)); writing = false; } }
Hi Ian. This code works very well usually. But once in 20-30 hours, recording suddenly skips. How do you think about this trouble?
|
|
|
|
|
Logged
|
|
|
|
|
fmcoder
Posts: 386
|
 |
« Reply #162 on: 31 Aug '11 - 11:00 » |
Quote
|
Seems I found a bug. If I make a call to BASS_WASAPI_Init with negative device number, like -5, the call is successful and BASS_ErrorGetCode is 0, but soon an "Access Violation" error occurs.
|
|
|
|
|
Logged
|
|
|
|
|
yosato
Posts: 6
|
 |
« Reply #163 on: 31 Aug '11 - 12:47 » |
Quote
|
Thank you for your quick reply. But wasapi device number seems positive or zero. public void setDeviceList(BassRec bassRec) { recDevCnt = bassRec.recDevCnt(); wasapiNums = new int[recDevCnt]; bassNums = new int[recDevCnt]; devNames = new string[recDevCnt];
BASS_WASAPI_DEVICEINFO info = new BASS_WASAPI_DEVICEINFO();
for (int i = 0; BassWasapi.BASS_WASAPI_GetDeviceInfo(i, info); i++) { if (info.IsEnabled && info.IsInput && !info.IsLoopback) { if (info.IsDefault) defaultWasapiNum = i;
for (int recNum = 0; recNum < recDevCnt; recNum++) { if (bassRec.getDevName(recNum) == info.name) { wasapiNums[recNum] = i; devNames[recNum] = info.name; } } } }
BASS_DEVICEINFO devInfo = new BASS_DEVICEINFO();
for (int i = 0; Bass.BASS_GetDeviceInfo(i, devInfo); i++) { for (int recNum = 0; recNum < recDevCnt; recNum++) { if (bassRec.getDevName(recNum) == info.name) { bassNums[recNum] = i; if (info.IsDefault) defaultBassNum = i; } } }
}
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #164 on: 31 Aug '11 - 15:57 » |
Quote
|
This code works very well usually. But once in 20-30 hours, recording suddenly skips.
Is it just a single skip and then it continues as normal, or does it continue skipping? If you add some logging to the "MyRecording" function (eg. the entry/exit and parameters), do you notice anything different when the skipping occurs, eg. is it called less/more frequently or does it take longer between entry & exit, or does the "length" parameter change? Also, to eliminate possible causes, please try removing your DSP (the BASS_ChannelSetDSP call), ie. do nothing more than recording. Seems I found a bug. If I make a call to BASS_WASAPI_Init with negative device number, like -5, the call is successful and BASS_ErrorGetCode is 0, but soon an "Access Violation" error occurs.
BASS_WASAPI_Init currently treats any negative device number other than -2 as -1, ie. -2 = default input device, any other negative number = default output device. Does the AV not occur if you use -1 instead of -5? If the AV does still occur, please provide any details that you have on it.
|
|
|
|
|
Logged
|
|
|
|
|
yosato
Posts: 6
|
 |
« Reply #165 on: 31 Aug '11 - 23:18 » |
Quote
|
Thank you for your reply.
Skipping occurs a few times in one minute and then it continues as normal for 20-30 hours.
I will monitor "length" parameter. But it may be difficult. To detect skipping, I must listen to music for a long time.
After I remove BASS_ChannelSetDSP call, I have no idea to define the callback function which is necessary for recording.
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #166 on: 5 Sep '11 - 14:47 » |
Quote
|
After I remove BASS_ChannelSetDSP call, I have no idea to define the callback function which is necessary for recording.
Yep, you should actually keep that DSP function (and add the logging to it). I wasn't initially aware that a DSP function is used for input with BASS.Net's WASAPI handler.
|
|
|
|
|
Logged
|
|
|
|
|
fmcoder
Posts: 386
|
 |
« Reply #167 on: 25 Sep '11 - 23:18 » |
Quote
|
There's bassmix.dll file in the basswadsp package, what is it for? Should I use it, or IU may use the regular bassmix?
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #168 on: 26 Sep '11 - 17:00 » |
Quote
|
That sounds like you may have an old BASSWASAPI package? There was a BASSmix update included initially to provide the BASS_MIXER_POSEX/BASS_Mixer_ChannelGetPositionEx option, but it was no longer needed once BASSmix 2.4.5 was released including that option.
|
|
|
|
|
Logged
|
|
|
|
|
fmcoder
Posts: 386
|
 |
« Reply #169 on: 2 Oct '11 - 09:45 » |
Quote
|
Ahh... Yes, I unpacked new packages to the same folder, and there were files left from previous packages.
|
|
|
|
|
Logged
|
|
|
|
|
fmcoder
Posts: 386
|
 |
« Reply #170 on: 4 Oct '11 - 20:42 » |
Quote
|
New question. I have 2 apps which use the same input device. Problem is that 2nd app doesn't receive any data in the WASAPI proc. Why's that?
Is it some kind of limitation, that only one app can use the input device at a time?
|
|
|
|
|
Logged
|
|
|
|
|
fmcoder
Posts: 386
|
 |
« Reply #171 on: 4 Oct '11 - 21:09 » |
Quote
|
My bad. Those programs initizlized different input devices. Seems that it's sound card limitation - it can not record from 2 different sources simultaneously (records only from the first initialized, second doesn't get any data to the WASAPIProc). Sorry 
|
|
|
|
|
Logged
|
|
|
|
|
Smoov
Posts: 12
|
 |
« Reply #172 on: 5 Oct '11 - 13:14 » |
Quote
|
So Ian,
Do you fore see a new version of BASSWASAPI being released? Is it time to take it out of beta. I know it is working very well for us.
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #173 on: 5 Oct '11 - 14:12 » |
Quote
|
My bad. Those programs initizlized different input devices. Seems that it's sound card limitation - it can not record from 2 different sources simultaneously (records only from the first initialized, second doesn't get any data to the WASAPIProc). Sorry  Yep, most soundcards won't allow recording from multiple inputs (on the card) at the same time. Do you fore see a new version of BASSWASAPI being released? Is it time to take it out of beta. I know it is working very well for us.
No, there aren't any changes planned, and there haven't been any problems reported recently, so you're right, it probably is about time to take it out of beta. If anyone has any requests or problems, now is the time to give them 
|
|
|
|
|
Logged
|
|
|
|
|
AndyMK
Posts: 171
|
 |
« Reply #174 on: 14 Oct '11 - 20:27 » |
Quote
|
Hi guy's, just tried this lib and i'm finding the minimum latency a bit high but it sounds just as responsive as asio. The minimum buffer length returned for shared mode is 10584 and for exclusive mode 28224 (both using 0.03 for the buffer parameter as anything lower does not change the returned buffer size and exclusive mode returns a higher minimum for some reason) (10584/44100)*1000=240ms latency .. it sounds much lower than that. I tried this on a 1$ realtek chip and a Novation NIO 2|4 usb pro audio unit.
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #175 on: 19 Oct '11 - 15:45 » |
Quote
|
Are those buffer length numbers (eg. 10584) from the WASAPIPROC "length" parameter? If so, note that is in bytes (not samples), so the latency will actually be quite a bit lower than your calculation above shows  The WASAPIPROC "length" can be converted to seconds like this... float seconds = (float)length / freq / chans / sizeof(float);
The "freq" and "chans" values are available from BASS_WASAPI_GetInfo.
|
|
|
|
|
Logged
|
|
|
|
|
AndyMK
Posts: 171
|
 |
« Reply #176 on: 20 Oct '11 - 07:15 » |
Quote
|
Hi Ian, it's the buflen returned from the BASS_WASAPI_INFO structure which is in bytes. I thought it was samples, should have read more closely. I still find it strange that exclusive mode returns a higher minimum buffer size. What is the "sizeof" parameter that you are using as part of your calculation above?
|
|
|
|
« Last Edit: 20 Oct '11 - 07:28 by AndyMK »
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #177 on: 20 Oct '11 - 17:47 » |
Quote
|
Yep, the same calculation can be applied to the "buflen" value. The "sizeof(float)" value would be 4, the size of a "float"  Regarding shared and exclusive mode, one difference is that the BASS_WASAPI_Init "period" parameter restricts the device's buffer in exclusive mode but doesn't in shared mode. So lowering that should allow smaller buffer sizes to be used in exclusive mode.
|
|
|
|
|
Logged
|
|
|
|
|
Wishmaster
Posts: 124
|
 |
« Reply #178 on: 2 Nov '11 - 07:02 » |
Quote
|
Hi I’m trying to incorporate the basswasapi.dll into my project! BASS_WASAPI_Init is a little confusing I have several components in Delphi one for playback and one for recording…..
My problem is how can I record and play at the same time? Do I have to Call BASS_WASAPI_Init several times? I mean because of the WASAPIPROC one for Input and one Output
In BASS_WASAPI_Init> device how do I know whether the set device Nr. Is Input or Output
I guess the problem I have is to differentiate between input and output
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15269
|
 |
« Reply #179 on: 2 Nov '11 - 15:30 » |
Quote
|
Yes, you would call BASS_WASAPI_Init twice in that case: once for the input device and once for the output device. You can check whether a particular device is an input or output device by calling BASS_WASAPI_GetDeviceInfo and looking at its flags, ie. if the BASS_DEVICE_INPUT flag is present then it is an input device. It isn't Delphi, but the process will be basically the same in any language, so you could have a look at the LIST.C example source for a demonstration of enumerating the available devices.
|
|
|
|
|
Logged
|
|
|
|
|