Skip to content

Commit f603d2d

Browse files
committed
initial commit
1 parent b4b5672 commit f603d2d

15 files changed

Lines changed: 788 additions & 19 deletions

File tree

.gitignore

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
1-
# Compiled class file
2-
*.class
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
.kotlin
37

4-
# Log file
5-
*.log
8+
### IntelliJ IDEA ###
9+
.idea/
10+
*.iws
11+
*.iml
12+
*.ipr
13+
out/
14+
!**/src/main/**/out/
15+
!**/src/test/**/out/
616

7-
# BlueJ files
8-
*.ctxt
17+
### Eclipse ###
18+
.apt_generated
19+
.classpath
20+
.factorypath
21+
.project
22+
.settings
23+
.springBeans
24+
.sts4-cache
25+
bin/
26+
!**/src/main/**/bin/
27+
!**/src/test/**/bin/
928

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
1235

13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
36+
### VS Code ###
37+
.vscode/
2138

22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
24-
replay_pid*
39+
### Mac OS ###
40+
.DS_Store
41+
42+
### Cmake ###
43+
cmake-build-debug
44+
cmake-build-release

CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
project(SMTC4J LANGUAGES CXX)
3+
4+
set(CMAKE_CXX_STANDARD 20)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
add_library(SMTC4J SHARED
8+
native/SMTC4J.cpp
9+
)
10+
11+
# JNI
12+
find_package(JNI REQUIRED)
13+
target_include_directories(SMTC4J PRIVATE ${JNI_INCLUDE_DIRS})
14+
15+
# Windows / WinRT
16+
target_compile_definitions(SMTC4J PRIVATE WIN32_LEAN_AND_MEAN)
17+
target_link_libraries(SMTC4J
18+
windowsapp
19+
)
20+
21+
# MSVC specifics
22+
if (MSVC)
23+
target_compile_options(SMTC4J PRIVATE /await)
24+
endif()

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SMTC4J
2+
Simple Java Library for getting information about the current playback from the windows system media transport controls (SMTC).
3+
4+
## Usage
5+
Load the native library
6+
```java
7+
SMTC4J.load();
8+
```
9+
10+
Start the automatic update thread
11+
12+
```java
13+
long updateIntervalMillis = 500; // e.g., update every 500ms
14+
SMTC4J.startUpdateThread(updateIntervalMillis);
15+
```
16+
17+
Access the cached information
18+
19+
Media info (title, artist, album, duration, cover, source app):
20+
```java
21+
MediaInfo mediaInfo = SMTC4J.getCachedMediaInfo();
22+
System.out.println("Title: " + mediaInfo.getTitle());
23+
```
24+
25+
Playback state (play/pause/stop code, position in seconds):
26+
27+
```java
28+
PlaybackState playbackState = SMTC4J.getCachedPlaybackState();
29+
System.out.println("State code: " + playbackState.getStateCode());
30+
System.out.println("Position: " + playbackState.getPosition());
31+
```

build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group = 'dev.codeman'
6+
version = '1.0-SNAPSHOT'
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
implementation 'com.google.code.gson:gson:2.13.2'
14+
}
15+
16+
java {
17+
toolchain {
18+
languageVersion = JavaLanguageVersion.of(21)
19+
}
20+
}

gradle/wrapper/gradle-wrapper.jar

59.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sun Jan 18 14:12:52 CET 2026
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

gradlew

Lines changed: 234 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)