Data type and stream format
- From: "Barzo@Google" <dbarzo@xxxxxxxxx>
- Date: Mon, 21 Sep 2009 02:24:30 -0700 (PDT)
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.
.
- Prev by Date: Truncated files when doing wave recording with MCI.
- Next by Date: Re: In Xp, USB audio devices capture or play with higher frequency than specified.
- Previous by thread: Truncated files when doing wave recording with MCI.
- Next by thread: Mapping a DirectSound device to a Windows mixer
- Index(es):
Relevant Pages
|