示例#1
0
文件: IoAudioMixer.c 项目: ADTSH/io
IoAudioMixer *IoAudioMixer_rawClone(IoAudioMixer *proto) 
{ 
	IoObject *self = IoObject_rawClonePrimitive(proto);
	self->data = cpalloc(proto->data, sizeof(IoAudioMixerData));
	
	DATA(self)->ioBuffer = IoSeq_new(IOSTATE);
	DATA(self)->buffer = IoSeq_rawUArray(DATA(self)->ioBuffer);
	DATA(proto)->mixBuffer = UArray_new();
	DATA(self)->writeMessage = 
		IoMessage_newWithName_label_(IOSTATE, 
							    IOSYMBOL("write"), 
							    IOSYMBOL("AudioMixer"));
	IoMessage_setCachedArg_to_(DATA(self)->writeMessage, 0, DATA(self)->ioBuffer);
	
	DATA(self)->nonBlockingWriteMessage = 
		IoMessage_newWithName_label_(IOSTATE, 
							    IOSYMBOL("nonBlockingWrite"), 
							    IOSYMBOL("AudioMixer"));
	IoMessage_setCachedArg_to_(DATA(self)->nonBlockingWriteMessage, 0, DATA(self)->ioBuffer);
	
	DATA(self)->sounds = List_new();
	DATA(self)->soundsToRemove = List_new();
	DATA(self)->events = List_new();
	DATA(self)->activeEvents = List_new();
	DATA(self)->volume = DATA(self)->volume;
	
	DATA(self)->soundTouch = SoundTouch_init();
	SoundTouch_setSampleRate(DATA(self)->soundTouch, 44100);
	SoundTouch_setChannels(DATA(self)->soundTouch, 2);
	DATA(self)->tempo = 1.0;
	IoState_addValue_(IOSTATE, self);
	return self; 
}
示例#2
0
文件: IoMP3Encoder.c 项目: Akiyah/io
IoMP3Encoder *IoMP3Encoder_rawClone(IoMP3Encoder *proto) 
{ 
    IoObject *self = IoObject_rawClonePrimitive(proto);
    self->data = cpalloc(proto->data, sizeof(IoMP3EncoderData));
    DATA(self)->outBuffer = IoBuffer_new(IOSTATE);
    DATA(self)->encoder = MP3Encoder_new();
    MP3Encoder_setExternalOutputUArray_(DATA(self)->encoder, 
					   IoBuffer_rawUArray(DATA(self)->outBuffer));
    IoState_addValue_(IOSTATE, self);
    return self; 
}
示例#3
0
文件: IoMP3Decoder.c 项目: Akiyah/io
IoMP3Decoder *IoMP3Decoder_rawClone(IoMP3Decoder *proto) 
{ 
	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, calloc(1, sizeof(IoMP3DecoderData)));
	
	DATA(self)->willProcessMessage = DATA(proto)->willProcessMessage;
	DATA(self)->didProcessMessage = DATA(proto)->didProcessMessage;
	DATA(self)->inputBuffer  = IOCLONE(DATA(proto)->inputBuffer);
	DATA(self)->outputBuffer = IOCLONE(DATA(proto)->outputBuffer);
	DATA(self)->tmpInputBa = UArray_new();
	
	IoState_addValue_(IOSTATE, self);
	return self; 
}
示例#4
0
IoSocket *IoSocket_new(void *state)
{
  IoTag *tag = IoState_tagWithInitFunction_((IoState*)state, IoSocket_initTagWithId_);
  IoSocket *self = (IoSocket *)malloc(sizeof(IoSocket));
  memset(self, 0x0, sizeof(IoSocket));
  self->tag = tag;
  self->color = IOVALUE_WHITE();
  self->socket = new InternalSocket();
  self->host = strdup("localhost");
  self->isConnected = false;
  self->lineRead = 0;
  self->activeConnect = 0;
  self->activeReadLine = 0;
  IoState_addValue_((IoState*)self->tag->state, (IoValue *)self);
  return self;
}