Skip to content

Commit

Permalink
quick audio file fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Apr 26, 2024
1 parent fb534d3 commit 63da898
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/myrobotlab/audio/PlaylistPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import java.util.Collections;
import java.util.List;

import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.service.AudioFile;
import org.slf4j.Logger;

public class PlaylistPlayer implements Runnable {

static final Logger log = LoggerFactory.getLogger(PlaylistPlayer.class);

private transient AudioFile audioFile = null;
private transient Thread player;
private boolean shuffle;
Expand All @@ -34,6 +38,7 @@ public void run() {
audioFile.play(list.get(i), true, null, track);
}
if (!repeat) {
log.info("finished playing playlist");
done = true;
}
}
Expand Down
14 changes: 2 additions & 12 deletions src/main/resources/resource/WebGui/app/service/js/AudioFileGui.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,9 @@ angular.module('mrlapp.service.AudioFileGui', []).controller('AudioFileGuiCtrl',
// playing paused stopped
$scope.activity = null

// $scope.playFile = function() {
// msg.send('playFile', $scope.selectedFile)
// }

$scope.play = function() {
// if (blah){
// $scope.selectedFile = selectedFiles[0]
// } else {
// $scope.selectedFile = selectedFiles[0]
// }
let playFile = $scope.selectedFile
msg.send('play', $scope.selectedFile)

}

$scope.setSelectedFileFromTrack = function(selected) {
Expand All @@ -29,15 +19,15 @@ angular.module('mrlapp.service.AudioFileGui', []).controller('AudioFileGuiCtrl',

$scope.startPlaylist = function() {
if ($scope.selectedPlaylist) {
msg.send('startPlaylist', $scope.selectedPlaylist[0])
msg.send('startPlaylist', $scope.selectedPlaylist)
} else {
msg.send('startPlaylist')
}
}

$scope.stopPlaylist = function() {
if ($scope.selectedPlaylist) {
msg.send('stopPlaylist', $scope.selectedPlaylist[0])
msg.send('stopPlaylist', $scope.selectedPlaylist)
msg.send('stop')
} else {
msg.send('stopPlaylist')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<button class="btn btn-default" ng-click="msg.setMute(!service.mute);msg.broadcastState()">
<span class="glyphicon glyphicon-volume-off" title="mute track"/>
</button>
<button class="btn btn-default" ng-click="msg.setVolume(service.volume - 0.01);msg.broadcastState()">
<button class="btn btn-default" ng-click="msg.setVolume(service.config.volume - 0.01);msg.broadcastState()">
<span class="glyphicon glyphicon-volume-down" title="pump up the volume"/>
</button>
<button class="btn btn-default" ng-click="msg.setVolume(service.volume + 0.01);msg.broadcastState()">
<button class="btn btn-default" ng-click="msg.setVolume(service.config.volume + 0.01);msg.broadcastState()">
<span class="glyphicon glyphicon-volume-up" title="pump up the volume"/>
</button>
</td>
Expand All @@ -47,7 +47,7 @@
</tr>
<tr>
<td>volume</td>
<td>{{service.volume.toFixed(2) * 100}}</td>
<td>{{service.config.volume.toFixed(2) * 100}}</td>
</tr>
<tr>
<td>peak volume multiplier</td>
Expand All @@ -69,7 +69,7 @@
<br/>
<!--Selected playlist: {{service.currentPlaylist}}<br/>-->
<table border="1" class="table table-hover table-condensed table-striped table-bordered">
<!--tr ng-repeat="(name, fileset) in service.playlists">
<!--tr ng-repeat="(name, fileset) in service.config.playlists">
<td>{{name}}{{fileset}}</td>
</tr-->
<tr>
Expand All @@ -79,10 +79,10 @@
<button class="btn btn-default" ng-click="msg.addPlaylist(service.currentPlaylist, directoryName);msg.broadcastState()">Add playlist</button>
<div class="form-group">
<label>select playlist:</label>
{{selectedPlaylist[0]}}
{{selectedPlaylist}}

<select multiple class="form-control vertical-menu" ng-change="setPlaylist(name)" ng-model="selectedPlaylist" id="service.playlists" title="select your playlist">
<option ng-repeat="(name, fileset) in service.playlists" ng-value="{{name}}">{{name}}</option>
<select size="8" class="form-control vertical-menu" ng-change="msg.send('setPlaylist', name)" ng-model="selectedPlaylist" id="service.config.playlists" title="select your playlist">
<option ng-repeat="(name, fileset) in service.config.playlists" ng-value="{{name}}">{{name}}</option>
</select>
</div>
<button class="btn btn-default" ng-click="startPlaylist()">
Expand All @@ -91,10 +91,10 @@
<button class="btn btn-default" ng-click="stopPlaylist()">
<span class="glyphicon glyphicon-stop" title="stop play list"/>
</button>
<div ng-show="service.playlists" class="form-group">
<div ng-show="service.config.playlists" class="form-group">
<label>select file:</label>
<select multiple class="form-control vertical-menu" ng-model="selectedFiles" ng-change="setSelectedFileFromTrack(selectedFiles[0])" title="select your track">
<option ng-repeat="(name, fileset) in service.playlists[selectedPlaylist]" ng-value="{{fileset}}">{{fileset}}</option>
<select size="8" class="form-control vertical-menu" ng-model="selectedFiles" ng-change="setSelectedFileFromTrack(selectedFiles)" title="select your track">
<option ng-repeat="(name, fileset) in service.config.playlists[selectedPlaylist] track by $index" ng-value="fileset">{{fileset}}</option>
</select>
</div>
</td>
Expand Down

0 comments on commit 63da898

Please sign in to comment.