Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data type and stream format

1 view
Skip to first unread message

Barzo@Google

unread,
Sep 21, 2009, 5:24:30 AM9/21/09
to
Hi,

I'm sorry if the question seems to be stupid..
I'm working on a library that use another one (RtAudio) which is a
wrapper around ASIO and DirectSound.

Its use is quite simple: open a stream (device) and handle its
callback.
To the StreamOpen function the format (8, 16, 24, 32 bits) needs to be
passed.

Then, in the callback I need to cast the void pinter to the correct
data type.:

int call_back( void *outputBuffer,
void *inputBuffer,
unsigned int nBufferFrames,
double streamTime,
RtAudioStreamStatus status,
void *userData )
{
signed short* my_buffer = (signed short*)outputBuffer;
}

Ok, now my question is:
Regardless of the API used, Is possible to handle different formats
using the same data type?

Eg. If I have a buffer like: signed short* buffer;
Is possible to handle also unsigned 8-bit PCM frames?

I ask this because in my test, if I open a 16-bit wav it works well,
while if I open a 8-bit wave and I use 'signed short' like data type I
get memory exceptions!

Thanks,
Daniele.

0 new messages