NetStream::NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket) : Stream() { unsigned int frequency=11025,buffersize=2048; ALenum format=AL_FORMAT_MONO8; if(controlsocket) { *controlsocket >> format; *controlsocket >> frequency; *controlsocket >> buffersize; } updater_=new NetUpdater(socket,controlsocket, buffername_,buffer2_->GetName(), format,frequency,buffersize*SampleSize(format)); }
NetStream::NetStream(ost::UDPSocket *socket,SampleFormat format, unsigned int frequency,unsigned int buffersize) : Stream() { ALenum alformat=0; switch(format) { case(Mono8): alformat=AL_FORMAT_MONO8; break; case(Mono16): alformat=AL_FORMAT_MONO16; break; case(Stereo8): alformat=AL_FORMAT_STEREO8; break; case(Stereo16): alformat=AL_FORMAT_STEREO16; break; } updater_=new NetUpdater(socket,NULL,buffername_,buffer2_->GetName(), alformat,frequency,buffersize*SampleSize(format)); }
bool ITSampleHeader::SaveSampleData(FILE* outfile, ITHeader* header, int headIndex, bool updateSampleOffset, bool saveSampleOffset, long offset) { // writes to current filepos, or offset if specified. // // if updateSampleOffset, the sampleOffset of this SampleHeader is updated to // where the sample data was written. // // if saveSampleOffset, then if a header and headIndex is specified, // the sample header is written again to its current position (to save // updated sampleOffset value) if (offset >= 0) if (fseek(outfile, offset, 0)) return FALSE; if (updateSampleOffset) sampleOffset = ftell(outfile); if ((saveSampleOffset) && (header != NULL)) { long curPosition = ftell(outfile); Save(outfile, NULL, 0, header->sampleOffset[headIndex]); if (fseek(outfile, curPosition, 0)) return FALSE; } if (length < 1) return TRUE; else return (fwrite(sampleData, SampleSize() * length, 1, outfile) > 0); }