16 alDeleteSources(1, &id);
19 SourceState Source::get_state() const
22 alGetSourcei(id, AL_SOURCE_STATE, &state);
23 return static_cast<SourceState>(state);
26 void Source::set_position(float x, float y, float z)
28 alSource3f(id, AL_POSITION, x, y, z);
31 void Source::set_velocity(float x, float y, float z)
33 alSource3f(id, AL_VELOCITY, x, y, z);
36 void Source::set_looping(bool l)
38 alSourcei(id, AL_LOOPING, l);
41 void Source::set_gain(float g)
43 alSourcef(id, AL_GAIN, g);
46 void Source::set_rolloff_factor(float f)
48 alSourcef(id, AL_ROLLOFF_FACTOR, f);
51 void Source::set_buffer(const Buffer &buffer)
53 alSourcei(id, AL_BUFFER, buffer.get_id());
56 void Source::queue_buffers(const vector<const Buffer *> &buffers)
59 ids.reserve(buffers.size());
60 for(vector<const Buffer *>::const_iterator i=buffers.begin(); i!=buffers.end(); ++i)
61 ids.push_back((*i)->get_id());
62 alSourceQueueBuffers(id, ids.size(), &ids.front());
65 void Source::queue_buffer(const Buffer &buffer)
67 uint bid = buffer.get_id();
68 alSourceQueueBuffers(id, 1, &bid);
71 void Source::unqueue_buffers(const vector<const Buffer *> &buffers)
74 ids.reserve(buffers.size());
75 for(vector<const Buffer *>::const_iterator i=buffers.begin(); i!=buffers.end(); ++i)
76 ids.push_back((*i)->get_id());
77 alSourceUnqueueBuffers(id, ids.size(), &ids.front());
80 void Source::unqueue_buffer(const Buffer &buffer)
82 uint bid = buffer.get_id();
83 alSourceUnqueueBuffers(id, 1, &bid);
86 void Source::clear_buffers()
88 alSourcei(id, AL_BUFFER, AL_NONE);
91 unsigned Source::get_buffers_queued() const
94 alGetSourceiv(id, AL_BUFFERS_QUEUED, &n);
98 unsigned Source::get_buffers_processed() const
101 alGetSourceiv(id, AL_BUFFERS_PROCESSED, &n);
120 void Source::rewind()