20 May '13 - 18:31 *
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 / BASS_ChannelGetData(chan, NULL,BASS_DATA_AVAILABLE); and ASIO on: 8 Jun '12 - 23:29
I have working code for playing back data I'm streaming with both regular and ASIO devices.

However, when I use  BASS_ChannelGetData(chan, NULL,BASS_DATA_AVAILABLE) with ASIO devices I get 4294967295 returned instead of something like 270336 (which get with a non ASIO device).

4294967295 is 32 bits of all ones.

This is a 6 channel stream, loaded via BASS_StreamPutData. I'm on windows 7.
ReplyReply Reply with quoteQuote
2  Developments / BASS / Re: Simultaneous record and play from different devices on: 28 May '12 - 21:19
OK so now my problem is I'm not getting anything back (except a zero return) from BASS_ChannelGetData, either with a specified length, or with the BASS_DATA_AVAILABLE flag, even though the recording started without errors.

If I switch to using a callback I get buffer lengths inside the callback, but I really wanted to use the BASS_ChannelGetData in a while loop as shown above.

Not sure how to debug from here, or how I would make a callback work with my existing flow. It seems to me that if you are using callback you have no choice but to process ALL the data, because new data will come in the next callback, where as I need to ask for a certain amount of data.

ReplyReply Reply with quoteQuote
3  Developments / BASS / Re: Simultaneous record and play from different devices on: 28 May '12 - 19:48
Ah, I see your point. I need to use valid values for the BASS play calls when I'm not using file io.

ReplyReply Reply with quoteQuote
4  Developments / BASS / Re: Simultaneous record and play from different devices on: 28 May '12 - 19:39
Well the libsndfile stuff isn't if "!live", which means recording, but channels = 2 and sample rate = 44100.

All the bass stuff is working when I do use libsndfile to do file io, vs. recording.

I'm on windows 7 64bit, but working in 32 bit apps.

Thanks,
Z
ReplyReply Reply with quoteQuote
5  Developments / BASS / Re: Simultaneous record and play from different devices on: 28 May '12 - 02:45

And how do you record with ASIO?
ReplyReply Reply with quoteQuote
6  Developments / BASS / Simultaneous record and play from different devices on: 26 May '12 - 18:17
I want to record from one device, do some processing, and play from another. Currently these are in the same thread.

I'm doing:


// input is an audio device
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
Error("An incorrect version of BASS was loaded");
return 1;
}
/*
if (!BASS_RecordSetDevice(rec_dn)) {
sprintf_s(message,"Failed to set input audio device. Error: %d\n",BASS_ErrorGetCode());
MessageBox(NULL, TEXT((LPCSTR)message), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
return 1;
}
*/
if (!BASS_RecordInit(rec_dn)){
MessageBox(NULL, TEXT("Could not initialize input audio device"), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
return 1;
}
if (!BASS_RecordGetDeviceInfo(rec_dn, &rec_device_info)) {
MessageBox(NULL, TEXT("Could not get info for input audio device"), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
return 1;
}
rec_handle = BASS_RecordStart(44100, 2, BASS_SAMPLE_FLOAT,NULL,0);  //NULL or RecordingCallback
if (!rec_handle) {
MessageBox(NULL, TEXT("Could not start input device"), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
return 1;
}

(Note that BASS_RecordSetDevice fails with error 23 and is commented out because it's not used in rectest anyway)

with device 0

Available Audio Input Devices:

        0: Line 1 (Virtual Audio Cable)
        1: Microphone (Saffire Audio)
        2: U46 Ch12 (U46 Audio driver)
        3: U46 Ch34 (U46 Audio driver)
        4: U46 Ch56 (U46 Audio driver)
        5: U46 Multi-6 ch (U46 Audio drive

Available Audio Output Devices:

        -1: default device
        0: No sound
        1: Line 1 (Virtual Audio Cable)
        2: U46 Ch12 (U46 Audio driver)
        3: U46 Ch56 (U46 Audio driver)
        4: Speakers (U46 Audio driver)
        5: Speakers (Saffire Audio)
        6: Realtek Digital Output (Realtek High Definition Audio)
        7: U46 Ch34 (U46 Audio driver)
        100: ASIO ASIO 2.0 - ESI U46
        101: ASIO ASIO Avid Driver
        102: ASIO ASIO DirectX Full Duplex Driver
        103: ASIO ASIO4ALL v2
        104: ASIO Generic Low Latency ASIO Driver
        105: ASIO JackRouter
        106: ASIO ASIO Saffire

And trying to play back with device 4 (or other).

When I try to use a non ASIO device BASS_StreamCreate fails with error -1 (failed to start 16bit stream popup):

When I try to use an ASIO device, depending on the device, I get Error (0) can't initialize device, or a crash in the driver. All the playback code is working with input from a file (vs. recording)


if ( dn < 100 ) {

//if (floatable) BASS_StreamFree(floatable); // floating-point channels are supported!
if (floatable) {
if (chan=BASS_StreamCreate(sfinfo.samplerate,6,BASS_SAMPLE_FLOAT,STREAMPROC_PUSH,user)) {
BASS_ChannelGetInfo(chan,&bci);
y = initial_y + 5;
SetPos(0,y);
printf("%s\rStarted float stream with %d inputs and %d outputs\r",blankln,bci.chans, bi.speakers);
}
else {
sprintf_s(message,"Failed to start float stream. Error: %d\n",BASS_ErrorGetCode());
MessageBox(NULL, TEXT((LPCSTR)message), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
//printf("samplerate: %d channels: %d\n",sfinfo.samplerate, sfinfo.channels);
return 1;
}
}
else {
if (chan=BASS_StreamCreate(sfinfo.samplerate, sfinfo.channels,0,STREAMPROC_PUSH,user)) {
BASS_ChannelGetInfo(chan,&bci);
y = initial_y + 5;
SetPos(0,y);
printf("%s\rStarted 16 bit stream with %d inputs and %d outputs\r",blankln,bci.chans, bi.speakers);
}
else {
sprintf_s(message,"Failed to start 16 bit stream. Error: %d\n",BASS_ErrorGetCode());
MessageBox(NULL, TEXT((LPCSTR)message), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
//printf("samplerate: %d channels: %d\n",sfinfo.samplerate, sfinfo.channels);
return 1;
}

}
}
else {
floatable = 1; //Assume all ASIO drivers are floatable
if (floatable != 0) {

if (chan=BASS_StreamCreate(sfinfo.samplerate, sfinfo.channels,BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE,STREAMPROC_PUSH,user)) {
BASS_ChannelGetInfo(chan,&bci);
y = initial_y + 5;
SetPos(0,y);
printf("%s\rStarted float stream with %d inputs and %d outputs\r",blankln,bci.chans, asio_info.outputs);
}
else {
sprintf_s(message,"Failed to start float stream. Error: %d ASIO Error: %d\n",BASS_ErrorGetCode(),BASS_ASIO_ErrorGetCode());
MessageBox(NULL, TEXT((LPCSTR)message), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
//printf("samplerate: %d channels: %d\n",sfinfo.samplerate, sfinfo.channels);
return 1;
}
}
else {
if (chan=BASS_StreamCreate(sfinfo.samplerate, sfinfo.channels,BASS_STREAM_DECODE,STREAMPROC_PUSH,user)) {
BASS_ChannelGetInfo(chan,&bci);
y = initial_y + 5;
SetPos(0,y);
printf("%s\rStarted 16 bit stream with %d inputs and %d outputs\r",blankln,bci.chans, asio_info.outputs);
}
else {
sprintf_s(message,"Failed to start 16 bit stream. Error: %d ASIO Error: %d\n",BASS_ErrorGetCode(),BASS_ASIO_ErrorGetCode());
MessageBox(NULL, TEXT((LPCSTR)message), TEXT("SpecCL"), MB_OK|MB_ICONEXCLAMATION);
//printf("samplerate: %d channels: %d\n",sfinfo.samplerate, sfinfo.channels);
return 1;
}

}

}

Do all the recording calls need to be in their own thread?

If so does calling BASS_ChannelGetData(rec_handle,inbuf,BASS_DATA_FLOAT) also have to be in the recording thread?

Right now I'm trying to do this:

while((sampsread = (!live)?sf_read_float(insndfile,inbuf,inbuflen):BASS_ChannelGetData(rec_handle,inbuf,BASS_DATA_FLOAT)) > 0){

where "live" is the switch between file based input (via libsndfile) and bass recording input.

Thanks
Z
ReplyReply Reply with quoteQuote
7  Developments / BASS / name of default device (-1) on: 13 Apr '12 - 23:16
I get the wrong name when I try to get the device name of device -1.

I get the last device instead of the default.


BASS_GetDeviceInfo(dn, &dinfo);
printf("%d: %s\n",dn, dinfo.name);

Is the default device always device 1?

ReplyReply Reply with quoteQuote
8  Developments / BASS / Re: ASIO with non decode stream on: 13 Apr '12 - 23:11
OK thanks. Have ASIO working now, but it's not floatable, again because of the no sound divice being used when I check for floatable?

I need to setup the stream before setting up ASIO so I'm confused has to how to check for floatable with ASIO.
ReplyReply Reply with quoteQuote
9  Developments / BASS / Error in "Floating-point channels" doc example on: 13 Apr '12 - 21:21

DWORD floatable; // floating-point channel support? 0 = no, else yes
...
floatable=BASS_StreamCreate(44100, BASS_SAMPLE_FLOAT, NULL, 0); // try creating FP stream
if (floatable) BASS_StreamFree(floatable); // floating-point channels are supported!

is missing a parameter ( the number of channels) in the BASS_StreamCreate call, yes?

ReplyReply Reply with quoteQuote
10  Developments / BASS / Re: Multiple BASS_StreamPutData not working on: 13 Apr '12 - 21:18
I stand corrected.

Thanks.
ReplyReply Reply with quoteQuote
11  Developments / BASS / Re: Multiple BASS_StreamPutData not working on: 13 Apr '12 - 17:38
It happens on the first put call too. Would the extra bytes represent the latency between starting play and the first put call?

ReplyReply Reply with quoteQuote
12  Developments / BASS / ASIO with non decode stream on: 13 Apr '12 - 00:51
The contest.c program in the ASIO examples initializes the no sound device before setting up a channel.

However I want to set up a push stream that is not decode. I read somewhere that the no sound device has to be used with a decode channel? At least I get error BASS_ERROR_NOTAVAIL if I try to use it with a non decode stream.

So, how do I use ASIO with a non decode push stream? My data is just PCM.
ReplyReply Reply with quoteQuote
13  Developments / BASS / Re: Multiple BASS_StreamPutData not working on: 12 Apr '12 - 21:30
OK I got it working. Thanks.

Still don't understand why the returned byte from put is more than I told it to put.
ReplyReply Reply with quoteQuote
14  Developments / BASS / Re: Multiple BASS_StreamPutData not working on: 12 Apr '12 - 20:27
And why is the first put returning more bytes than I told it to put?
ReplyReply Reply with quoteQuote
15  Developments / BASS / Re: Multiple BASS_StreamPutData not working on: 12 Apr '12 - 20:24
Looks like I had the printf format wrong on the bytes in and return for the put:

Started stream
pos: 000000000  time: 0:00      Read 15876000 Bytes      Put returned 15787804  Playing queued: 88196
pos: 000116788  time: 0:00      Read 15876000 Bytes     StreamPutData failed Error: 45  Playing queued: 77476
pos: 000239744  time: 0:01      Read 15876000 Bytes     StreamPutData failed Error: 45  Playing queued: 78016
pos: 000272128  time: 0:01      Read 3873744 Bytes      StreamPutData failed Error: 45  Playing queued: 80876
pos: 000282064  time: 0:01      done reading PCM data           Playing queued: 70968
pos: 000291928  time: 0:01      done reading PCM data           Playing queued: 78748
pos: 000302232  time: 0:01      done reading PCM data           Playing queued: 86080

So the put is failing. What does BASS_ERROR_ENDED mean?
ReplyReply Reply with quoteQuote
16  Developments / BASS / Re: Multiple BASS_StreamPutData not working on: 12 Apr '12 - 20:09
Looks like the return value from put is not incrementing properly. 

Opened input file C:\Users\dts350z\Music\BeeBop\10 - Ask DNA.flac.
Started stream
pos: 000000000  time: 0:00      Read 15876000l Bytes     Put returned 15787804l Playing queued: 88196
pos: 000220996  time: 0:01      Read 15876000l Bytes     Put returned 4294967295l       Playing queued: 80068
pos: 000402548  time: 0:02      Read 15876000l Bytes     Put returned 4294967295l       Playing queued: 71540
pos: 000439576  time: 0:02      Read 3873744l Bytes      Put returned 4294967295l       Playing queued: 72076
pos: 000451156  time: 0:02      done reading PCM data           Playing queued: 82932
pos: 000496856  time: 0:02      done reading PCM data           Playing queued: 79268
pos: 000531692  time: 0:03      done reading PCM data           Playing queued: 86920
pos: 000541700  time: 0:03      done reading PCM data           Playing queued: 76896
pos: 000551688  time: 0:03      done reading PCM data           Playing queued: 84396
pos: 000595192  time: 0:03      done reading PCM data           Playing queued: 76136
pos: 000605356  time: 0:03      done reading PCM data           Playing queued: 83820

snip

pos: 015781696  time: 1:29      done reading PCM data           Playing queued: 73240
pos: 015791884  time: 1:29      done reading PCM data           Playing queued: 80532
pos: 015802464  time: 1:29      done reading PCM data           Playing queued: 73412
pos: 015812540  time: 1:29      done reading PCM data           Playing queued: 63372
pos: 015822844  time: 1:29      done reading PCM data           Playing queued: 53080
pos: 015832852  time: 1:29      done reading PCM data           Playing queued: 43064
pos: 015842884  time: 1:29      done reading PCM data           Playing queued: 33008
pos: 015852900  time: 1:29      done reading PCM data           Playing queued: 23024
pos: 015863144  time: 1:29      done reading PCM data           Playing queued: 12784
pos: 015873328  time: 1:29      done reading PCM data           Playing queued: 2588
pos: 015876000  time: 1:30      done reading PCM data           Stopped queued: 0 Stopping Channel
pos: 000000000  time: 0:00      done reading PCM data           Stopped queued: 0 Stopping Channel
pos: 000000000  time: 0:00      done reading PCM data           Stopped queued: 0 Stopping Channel
pos: 000000000  time: 0:00      done reading PCM data           Stopped queued: 0 Stopping Channel
pos: 000000000  time: 0:00      done reading PCM data           Stopped queued: 0 Stopping Channel

ReplyReply Reply with quoteQuote
17  Developments / BASS / Multiple BASS_StreamPutData not working on: 12 Apr '12 - 01:32
Audio stops after the bytes in the first BASS_StreamPutData are used. I have: BASS_ChannelPlay(chan,false), so subsequent BASS_StreamPutData should continue to play, right?

BASS_ChannelGetData(chan, outbuf, BASS_DATA_AVAILABLE); shows there is data available but the audio stops.

ReplyReply Reply with quoteQuote
Pages: [1]
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines