Data type and stream format

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
.



Relevant Pages

  • C Implementation Of Java Interface Class
    ... class dog implements animal { ... typedef struct tagAnimal{ ... void deleteDog; ... same across the abstract data type and the concrete data type ...
    (comp.lang.c)
  • Portability question
    ... Below is some code I made to amuse myself and reverse bit order. ... comments or corrections are welcome, but I have some specific concerns. ... *ensure* that my data type had 32 bits? ... void print_binary ...
    (comp.lang.c)
  • Re: compile error about void*
    ... C++ a type-id looks exactly like a variable declaration with the ... Type-id you mean data type? ... Like, int, void, void*? ... I mean a syntactical construct used to name a ...
    (microsoft.public.vc.language)
  • Re: Testing type of void*
    ... The void* type can hold a pointer of any data type, ... contains some sort of self-identifying tag, ...
    (microsoft.public.dotnet.languages.vc)