Skip to content

Commit

Permalink
KotlinIoOscSource.kt.kt, some non-osc standard reads removed (byte/sh…
Browse files Browse the repository at this point in the history
…ort)
  • Loading branch information
morisil committed Sep 4, 2024
1 parent 2c451ae commit ea1ce80
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 80 deletions.
48 changes: 0 additions & 48 deletions xemantic-osc-api/src/commonMain/kotlin/io/KotlinIoOscSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,54 +96,6 @@ public inline fun Source.readOscColor(): OscColor =
public inline fun Source.readOscMidiMessage(): OscMidiMessage =
OscMidiMessage(readUInt())

/**
* Removes 4 bytes from this source, interpreting the first
* byte as a byte value according to OSC protocol rules.
*
* @return the byte.
*/
public fun Source.readOscByte(): Byte {
val value = readByte()
skip(3)
return value
}

/**
* Removes 4 bytes from this source, interpreting the
* first byte as an unsigned byte according to OSC protocol rules.
*
* @return the unsigned byte.
*/
public fun Source.readOscUByte(): UByte {
val value = readUByte()
skip(3)
return value
}

/**
* Removes 4 bytes from this source, interpreting the first
* 2 bytes as a short value according to OSC protocol rules.
*
* @return the short.
*/
public fun Source.readOscShort(): Short {
val value = readShort()
skip(2)
return value
}

/**
* Removes 4 bytes from this source, interpreting the first
* 2 bytes as an unsigned short value according to OSC protocol rules.
*
* @return the unsigned short.
*/
public fun Source.readOscUShort(): UShort {
val value = readUShort()
skip(2)
return value
}

/**
* Creates a [Source] from supplied bytes.
* Useful for testing.
Expand Down
32 changes: 0 additions & 32 deletions xemantic-osc-api/src/commonTest/kotlin/io/KotlinIoOscSourceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -293,36 +293,4 @@ class KotlinIoOscSourceTest {
}
}

@Test
fun shouldReadOscByte() {
Source(42, 0, 0, 0).apply {
readOscByte() shouldBe 42
exhausted() shouldBe true
}
}

@Test
fun shouldReadOscUByte() {
Source(42, 0, 0, 0).apply {
readOscUByte() shouldBe 42u
exhausted() shouldBe true
}
}

@Test
fun shouldReadOscShort() {
Source(0, 42, 0, 0).apply {
readOscShort() shouldBe 42
exhausted() shouldBe true
}
}

@Test
fun shouldReadOscUShort() {
Source(0, 42, 0, 0).apply {
readOscUShort() shouldBe 42u
exhausted() shouldBe true
}
}

}

0 comments on commit ea1ce80

Please sign in to comment.