Skip to content

Commit 83d5e02

Browse files
committed
update naming
1 parent a02bbcf commit 83d5e02

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

buildconfig/stubs/pygame/mixer.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Channel:
8383
def unpause(self) -> None: ...
8484
def fadeout(self, time: int) -> None: ...
8585
def queue(self, sound: Sound) -> None: ...
86-
def set_position(self, angle:int, distance:int) -> None: ...
86+
def set_source_location(self, angle:int, distance:int) -> None: ...
8787
@overload
8888
def set_volume(self, value: float) -> None: ...
8989
@overload

docs/reST/ref/mixer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,10 @@ change the default buffer by calling :func:`pygame.mixer.pre_init` before
480480

481481
.. ## Channel.fadeout ##
482482
483-
.. method:: set_position
483+
.. method:: set_source_location
484484

485485
| :sl:`set the position of a playing channel`
486-
| :sg:`set_volume(angle,distance) -> None`
486+
| :sg:`set_source_location(angle,distance) -> None`
487487
488488
Set the position (angle, distance) of a playing channel.
489489

@@ -493,7 +493,7 @@ change the default buffer by calling :func:`pygame.mixer.pre_init` before
493493

494494
.. versionadded:: 2.3.0
495495

496-
.. ## Channel.set_position ##
496+
.. ## Channel.set_source_location ##
497497
498498
.. method:: set_volume
499499

src_c/doc/mixer_doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define DOC_MIXER_CHANNEL_PAUSE "pause() -> None\ntemporarily stop playback of a channel"
3030
#define DOC_MIXER_CHANNEL_UNPAUSE "unpause() -> None\nresume pause playback of a channel"
3131
#define DOC_MIXER_CHANNEL_FADEOUT "fadeout(time) -> None\nstop playback after fading channel out"
32-
#define DOC_MIXER_CHANNEL_SETPOSITION "set_volume(angle,distance) -> None\nset the position of a playing channel"
32+
#define DOC_MIXER_CHANNEL_SETSOURCELOCATION "set_source_location(angle,distance) -> None\nset the position of a playing channel"
3333
#define DOC_MIXER_CHANNEL_SETVOLUME "set_volume(value) -> None\nset_volume(left, right) -> None\nset the volume of a playing channel"
3434
#define DOC_MIXER_CHANNEL_GETVOLUME "get_volume() -> value\nget the volume of the playing channel"
3535
#define DOC_MIXER_CHANNEL_GETBUSY "get_busy() -> bool\ncheck if the channel is active"

src_c/mixer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ chan_unpause(PyObject *self, PyObject *_null)
11611161
}
11621162

11631163
static PyObject *
1164-
chan_set_position(PyObject *self, PyObject *args)
1164+
chan_set_source_location(PyObject *self, PyObject *args)
11651165
{
11661166
int channelnum = pgChannel_AsInt(self);
11671167
Sint16 angle;
@@ -1311,8 +1311,8 @@ static PyMethodDef channel_methods[] = {
13111311
{"pause", (PyCFunction)chan_pause, METH_NOARGS, DOC_MIXER_CHANNEL_PAUSE},
13121312
{"unpause", (PyCFunction)chan_unpause, METH_NOARGS,
13131313
DOC_MIXER_CHANNEL_UNPAUSE},
1314-
{"set_position", chan_set_position, METH_VARARGS,
1315-
DOC_MIXER_CHANNEL_SETPOSITION},
1314+
{"set_source_location", chan_set_source_location, METH_VARARGS,
1315+
DOC_MIXER_CHANNEL_SETSOURCELOCATION},
13161316
{"set_volume", chan_set_volume, METH_VARARGS, DOC_MIXER_CHANNEL_SETVOLUME},
13171317
{"get_volume", (PyCFunction)chan_get_volume, METH_NOARGS,
13181318
DOC_MIXER_CHANNEL_GETVOLUME},

test/mixer_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,13 +911,13 @@ def setUp(self):
911911
filename = example_path(os.path.join("data", "house_lo.mp3"))
912912
self.snd = mixer.Sound(filename)
913913

914-
def test_set_position(self):
915-
prompt("Please wear earphones before the test for set_position() starts")
914+
def test_set_source_location(self):
915+
prompt("Please wear earphones before the test for set_source_location() starts")
916916
ch = self.snd.play()
917917
angle = 0
918918
distance = 100
919919
while ch.get_busy():
920-
ch.set_position(angle, distance)
920+
ch.set_source_location(angle, distance)
921921
angle += 1
922922
angle %= 360
923923
time.sleep(0.01)
@@ -929,7 +929,7 @@ def test_set_position(self):
929929
distance = 0
930930
direction = 0
931931
while ch.get_busy():
932-
ch.set_position(angle, distance)
932+
ch.set_source_location(angle, distance)
933933
if distance == 0 or distance == 255:
934934
direction = 1 - direction
935935
distance += 1 if direction else -1

0 commit comments

Comments
 (0)