Example #1
0
		static Ref<Sound> decode_pcm8s_codec (const Buffer * buf, ALint channel_count, ALint bits_per_sample, ALfloat sample_frequency)
		{
			DynamicBuffer copy;
			copy.assign(*buf);

			int8_t *d = (int8_t *)copy.begin();
			std::size_t i;

			for (i = 0; i < copy.size(); i++)
				d[i] += (int8_t) 128;

			return new Sound(data_format(channel_count, bits_per_sample), sample_frequency, &copy);
		}
Example #2
0
 static
 bool
 match(DynamicBuffer& db, char const(&s)[N])
 {
     using boost::asio::buffer;
     using boost::asio::buffer_copy;
     if(db.size() < N-1)
         return false;
     static_string<N-1> t;
     t.resize(N-1);
     buffer_copy(buffer(t.data(), t.size()),
                 db.data());
     if(t != s)
         return false;
     db.consume(N-1);
     return true;
 }