![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0
![]() |
Streaming Sound Over a Socket
I am trying to stream sound over a socket. I am using the FMOD SoundSystem libraries to play the music. I am not expecting people to know FMOD, but maybe you guys could still help me out a bit. I can set up FMOD to stream the file when playing it, I just have to figure out how I can send the data through the socket in chucks and have FMOD playing the chunks while its doing the transferring.
I have the file sending through the socket in chunks working: // receiving end
char buf[1000] = "";
int n = 0;
std:: ofstream outFile("test.mp3", std::ios::binary);
while ((n = recv(socket, buf, sizeof(buf), 0)) > 0)
{
outFile.write(buf, n);
}
outFile.close();FMOD code to stream a file and play it: FMOD::System* system = 0;
FMOD_RESULT fres = FMOD::System_Create(&system);
fres = system->init(4, FMOD_INIT_NORMAL, 0);
FMOD::Sound* sound = 0;
fres = system->createStream("test.mp3", FMOD_CREATESTREAM, 0, &sound);
FMOD::Channel* channel = 0;
// there would be code here to set the stream buffer size accordingly.
fres = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);Any help at all on how to tackle this would be great.
__________________
I am Addicted to Linux! |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java socket Server compile errors.. | n3o_X | Java | 3 | Nov 18th, 2007 12:39 AM |
| .NET Socket Class | hbe02 | Show Off Your Open Source Projects | 1 | Oct 7th, 2006 11:00 AM |
| how to check if the socket is still connected? | myName | C++ | 1 | Jun 14th, 2006 6:27 AM |
| Socket Server | hbe02 | C++ | 19 | May 23rd, 2006 10:14 PM |
| Socket problem | Polyphemus_ | C++ | 3 | Feb 28th, 2006 2:01 PM |