Recent Posts

Pages: [1] 2 3 ... 10
1
BASS / Re: Midi Timecode Output
« Last post by KaleidonKep99 on 30 Mar '17 - 07:52 »
Hallo Forum.

Is ist possible to make an Midi Timecode Output?

Guenter
I usually do it like this with C#.

Code: [Select]
            long MIDILengthRAW = Bass.BASS_ChannelGetLength(MainWindow.KMCGlobals._recHandle);
            long MIDICurrentPosRAW = Bass.BASS_ChannelGetPosition(MainWindow.KMCGlobals._recHandle);
            double LenRAWToDouble = Bass.BASS_ChannelBytes2Seconds(MainWindow.KMCGlobals._recHandle, MIDILengthRAW);
            double CurRAWToDouble = Bass.BASS_ChannelBytes2Seconds(MainWindow.KMCGlobals._recHandle, MIDICurrentPosRAW);
            TimeSpan LenDoubleToSpan = TimeSpan.FromSeconds(LenRAWToDouble);
            TimeSpan CurDoubleToSpan = TimeSpan.FromSeconds(CurRAWToDouble);
            string MIDILengthString = String.Format("{0}:{1}:{2}",
                LenDoubleToSpan.Minutes.ToString().PadLeft(2, '0'),
                LenDoubleToSpan.Seconds.ToString().PadLeft(2, '0'),
                LenDoubleToSpan.Milliseconds.ToString().PadLeft(3, '0'));
            string MIDICurrentString = String.Format("{0}:{1}:{2}",
                CurDoubleToSpan.Minutes.ToString().PadLeft(2, '0'),
                CurDoubleToSpan.Seconds.ToString().PadLeft(2, '0'),
                CurDoubleToSpan.Milliseconds.ToString().PadLeft(3, '0'));

MIDILength is the total length of the MIDI, MIDICurrent is the current position of the stream.

It **ONLY** works with file-based streams. Real-time streams don't have an end.
2
BASS / Midi Timecode Output
« Last post by Guenter on 30 Mar '17 - 06:03 »
Hallo Forum.

Is ist possible to make an Midi Timecode Output?

Guenter
3
BASS / Re: BASSXA: XAudio2 rendering for BASS
« Last post by KaleidonKep99 on 29 Mar '17 - 23:05 »
And what is the real benefit/advantage of using XAudio2?
And if it is really better and has significant advantages over Wasapi or DirectSound... shouldn't it be supported natively by BASS?
The main advantage over BASSWASAPI, is that you don't need a whole lot of code to push data to it.
There's no need for a WasapiProc, it's just a "push data to sound out and it's done" matter. ;)

About latency, it relies on the operating system, as saga said.
DirectSound can achieve low latencies under XP, while it can't on Vista+ afaik, since it's emulated.
So yea, it'll be able to achieve low latency through DirectSound with XP, and WASAPI with Vista+.

It's a straightforward piece of software, that's all. ;D
4
BASS / Re: BASSXA: XAudio2 rendering for BASS
« Last post by saga on 29 Mar '17 - 22:27 »
Quote
And what is the real benefit/advantage of using XAudio2?
And if it is really better and has significant advantages over Wasapi or DirectSound... shouldn't it be supported natively by BASS?
On Windows, XAudio2 is just a wrapper around DirectSound (XP) or WASAPI (Vista and later), so it's just yet another layer of abstraction. XAudio2 does not magically give you lower latency than WASAPI. It's only really interesting if you already have existing XAudio2 code that you would like to use with BASS.
5
BASS / Re: BASSXA: XAudio2 rendering for BASS
« Last post by radio42 on 29 Mar '17 - 21:36 »
First a great thanks for this great add-on !!!

So far I haven't played much with XAudio2 - except that it should be the 'better/low latency' replacement for DirectSound.
However, there is also Wasapi...
Does XAudio2 work with any soundcard or are there any special requirements?

And what is the real benefit/advantage of using XAudio2?
And if it is really better and has significant advantages over Wasapi or DirectSound... shouldn't it be supported natively by BASS?
6
BASS / Re: BASSXA: XAudio2 rendering for BASS
« Last post by KaleidonKep99 on 29 Mar '17 - 21:13 »
Fixed it on version 1.2.0.3! Thank you Ian. ;D

Code: [Select]
...
while (true) {
// Get data. If there's no data available, exit from the loop.
DWORD decoded;
decoded = BASS_ChannelGetData(ch, sndbf, BASS_DATA_FLOAT + newsndbfvalue * sizeof(float));
if (decoded == (DWORD)-1) break;

// Adjust volume.
for (unsigned i = 0, j = decoded / sizeof(float); i < j; i++) {
sndbf[i] *= sound_out_volume_float;
}

// Write to frame. If there's an error while writing the frame, exit from the loop.
if (!BASSXA_WriteFrame(XAudioStream, sndbf, decoded, BASSXA_FRAMEWAIT)) break;
}
...
7
BASS / Re: BASSXA: XAudio2 rendering for BASS
« Last post by Ian @ un4seen on 29 Mar '17 - 17:25 »
Nice :)

I noticed a couple of little things. If it can fail, the BASSXA_WriteFrame function should probably have a "BOOL" return value rather than "void". The example should also check the BASS_ChannelGetData return value, to prevent a crash when it reaches the end:

Code: [Select]
DWORD decoded;
decoded = BASS_ChannelGetData(ch, sndbf, BASS_DATA_FLOAT + newsndbfvalue * sizeof(float));
if (decoded == (DWORD)-1) break;
8
BASS / Re: ASIO: multiple play on same channel and other issues
« Last post by Ian @ un4seen on 29 Mar '17 - 17:24 »
You can use the BASSmix add-on to play multiple files on the same ASIO channels. Instead of calling BASS_ChannelGetData on a file decoder in your ASIOPROC function, you plug the decoder(s) into a mixer and call BASS_ChannelGetData on that. It could look something like this:

Code: [Select]
BASS_Init(0, 44100, 0, 0, 0); // initialize BASS "no sound" device

...

BASS_ASIO_ChannelEnable(FALSE, 0, AsioProc, 0); // enable processing of ASIO output channel 0
BASS_ASIO_ChannelJoin(FALSE, 1, 0); // join channel 1 to it
BASS_ASIO_ChannelSetFormat(FALSE, 0, BASS_ASIO_FORMAT_FLOAT); // set it to floating-point
rate=BASS_ASIO_GetRate(); // get the ASIO device's sample rate
mixer=BASS_Mixer_StreamCreate(rate, 2, BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE); // create a mixer with same format
BASS_Mixer_StreamAddChannel(mixer, source, 0); // plug a source into the mixer

...

DWORD CALLBACK AsioProc(BOOL input, DWORD channel, void *buffer, DWORD length, void *user)
{
DWORD c=BASS_ChannelGetData(mixer, buffer, length); // get some data from the mixer
if (c==-1) c=0; // an error, no data
return c;
}

Please see the documentation for details on the aforementioned functions.

Unfortunately VB6 isn't good for callbacks. Perhaps you could use VB.Net instead?
9
BASS / Re: Buffer Lost caused by anti-virus software?
« Last post by Ian @ un4seen on 29 Mar '17 - 17:19 »
That sounds strange. I suppose it could be possible for virus software to influence DirectSound to produce a BUFLOST error, but I'm not sure how. A BUFLOST error would usually be because the window handle passed to BASS_Init isn't valid, or the device is no longer available.
10
BASS / Re: BASS_ChannelGetLevelEx issue
« Last post by Ian @ un4seen on 29 Mar '17 - 17:17 »
An I/O delay in a stream's decoder will block a BASS_ChannelGetLevelEx call on the same stream. Unfortunately, I don't think there is any good solution for that currently. BASS_ChannelIsActive shouldn't be affected by that though. Are you calling BASS_ChannelIsActive in the same thread as BASS_ChannelGetLevelEx? If so, moving them to different threads should avoid BASS_ChannelIsActive getting delayed.

To reduce the chance of I/O delays causing problems, you can enable asynchronous file reading via the BASS_ASYNCFILE flag. See the BASS_StreamCreateFile documentation for details.
Pages: [1] 2 3 ... 10