-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from mappu/fix-qt6-multimedia
Qt6Multimedia: Fix compilation, add example
- Loading branch information
Showing
8 changed files
with
49 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The audio file `pixabay-public-domain-strong-hit-36455.mp3` in this directory was sourced from: https://pixabay.com/sound-effects/strong-hit-36455/ | ||
|
||
It was placed into the public domain by the author @axilirate . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"path/filepath" | ||
|
||
qt "github.com/mappu/miqt/qt6" | ||
"github.com/mappu/miqt/qt6/multimedia" | ||
) | ||
|
||
func main() { | ||
|
||
qt.NewQApplication(os.Args) | ||
|
||
srcFile, err := filepath.Abs("pixabay-public-domain-strong-hit-36455.mp3") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
player := multimedia.NewQMediaPlayer() | ||
output := multimedia.NewQAudioOutput() | ||
|
||
player.SetAudioOutput(output) | ||
player.SetSource(qt.QUrl_FromLocalFile(srcFile)) | ||
output.SetVolume(50) | ||
player.OnPlaybackStateChanged(func(s multimedia.QMediaPlayer__PlaybackState) { | ||
|
||
log.Printf("- Playback state: %v", s) | ||
|
||
if s == multimedia.QMediaPlayer__StoppedState { | ||
log.Printf("Playback complete.") | ||
qt.QCoreApplication_Exit() | ||
} | ||
}) | ||
|
||
log.Printf("Playback starting...") | ||
player.Play() | ||
|
||
qt.QApplication_Exec() | ||
} |
Binary file added
BIN
+21.6 KB
examples/libraries/qt6-multimedia/pixabay-public-domain-strong-hit-36455.mp3
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters