![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
AllegroMP3 == chaos in my mind. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote: is a pack file really requiered and what is a packfile?? Yes, and its just a file handle. You use it to read and/or write to files. Quote: how is this data type built up? and what is the idea of having this thing Almp3 provides the type and builds it for you with 'almp3_create_mp3'. char data[x];//ok? what the hell is this? //why is the "data" stored as an char array? What type does almp3_create_mp3 take? char*? or void*? use which ever it happens to take, then follow the "len" directions. int len;//what is this?...Its the length of the mp3 data in bytes. Something like this should work: unsigned int len = file_size_ex("filename.ext"); void *data = malloc(len); if(data == NULL) { DIE A HORRIBLE DEATH! }
len = pack_fread(data, x, mp3file);//see above.. mp3file = pack_fopen(filename, F_READ);//this is obviously something packfile //related.. what should filename be? the path in char data type? ex: "muu.mp3".?? This really needs to go above the pack_fread. really. And the filename can be "whatever.mp3" or any C string. almp3_play_mp3stream(mp3, x, 255, 128);//trying to play it.. hth. -- |
Albin Engström
Member #8,110
December 2006
![]() |
Another attempt... i'm really grateful for the help, and i'm sorry i'm learning this so slowly - -.
Quote:
int almp3_poll_mp3(ALMP3_MP3 *mp3); I got the impression this was only used for streaming? This didn't work, it didn't crash, i just didn't play. It's funny how you sometimes want it to crash... at least that gives you a clue about whats wrong. Help appreciated! off-topic: how come pixels colored "0,0,1" display the underlying active mediaplayer window... in windowed mode. i use vlc mediaplayer. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote: I got the impression this was only used for streaming? What I and the others mean by streaming is incrementally loading the data of the disk and passing it into the decoder. I suppose you could call what almp3 does with non mp3stream's streaming, but best not, otherwise it can get confusing. almp3_poll_mp3 is used to tell almp3 to send some more data to the soundcard, a bit at a time, since you can't actually fit 40MB (decoded size of mp3 data) of sound data in most sound cards If almp3_poll_mp3 didn't poll in this fashion you'd need to decode all of the mp3 data into ram, and then place it into a SAMPLE, and play that. But that can eat up a lot of memory. So instead, it holds just the mp3 data, and when you poll, it decodes enough information to fill the buffer, and then queues it to play with allegro's sound system. -- |
Albin Engström
Member #8,110
December 2006
![]() |
Finally it worked!!. You're my hero Thomas!! thanks to all the other nice people too!! but i still have questions ^^: 2: malloc lets me use the memory however i want eh, |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote: 1: what is the sign used for? (unsigned signed stuff). If an integer is unsigned, its range is from 0 through 2^32 Quote: 2: malloc lets me use the memory however i want eh, It lets you get an arbitryily sized chunk of memory to use for just about anything. Dynamically allocating variables (int, char, arrays, structs, etc). Or whatever. -- |
|
1
2
|