|
@@ -38,6 +38,8 @@ public class UserChannelContext {
|
|
|
|
|
|
private Integer subjectId;
|
|
|
|
|
|
+ private int beatDuration;
|
|
|
+
|
|
|
private int beatByteLength;
|
|
|
|
|
|
// 曲目与musicxml对应关系
|
|
@@ -65,9 +67,10 @@ public class UserChannelContext {
|
|
|
|
|
|
private HardLevelEnum hardLevel = HardLevelEnum.ADVANCED;
|
|
|
|
|
|
- public void init(String heardLevel, int subjectId, int beatByteLength) {
|
|
|
+ public void init(String heardLevel, int subjectId, int beatDuration) {
|
|
|
this.subjectId = subjectId;
|
|
|
- this.beatByteLength = WaveformWriter.SAMPLE_RATE * WaveformWriter.BITS_PER_SAMPLE / 8 * beatByteLength / 1000;
|
|
|
+ this.beatDuration = beatDuration;
|
|
|
+ this.beatByteLength = WaveformWriter.SAMPLE_RATE * WaveformWriter.BITS_PER_SAMPLE / 8 * beatDuration / 1000;
|
|
|
//hardLevel = HardLevelEnum.valueOf(heardLevel);
|
|
|
}
|
|
|
|
|
@@ -92,10 +95,6 @@ public class UserChannelContext {
|
|
|
this.recordId = recordId;
|
|
|
}
|
|
|
|
|
|
- public void setSubjectId(Integer subjectId) {
|
|
|
- this.subjectId = subjectId;
|
|
|
- }
|
|
|
-
|
|
|
public ConcurrentHashMap<Integer, MusicXmlBasicInfo> getSongMusicXmlMap() {
|
|
|
return songMusicXmlMap;
|
|
|
}
|
|
@@ -124,11 +123,8 @@ public class UserChannelContext {
|
|
|
return doneNoteAnalysisList;
|
|
|
}
|
|
|
|
|
|
- public int getBeatByteLength() {
|
|
|
- return beatByteLength;
|
|
|
- }
|
|
|
-
|
|
|
public void resetUserInfo() {
|
|
|
+ beatByteLength = WaveformWriter.SAMPLE_RATE * WaveformWriter.BITS_PER_SAMPLE / 8 * beatDuration / 1000;
|
|
|
waveFileProcessor = null;
|
|
|
processingNote = new NoteAnalysis(0,0,-1);
|
|
|
evaluatingSectionIndex = new AtomicInteger(0);
|
|
@@ -137,7 +133,6 @@ public class UserChannelContext {
|
|
|
doneSectionAnalysisList = new ArrayList<SectionAnalysis>();
|
|
|
chunkAnalysisList = new ArrayList<ChunkAnalysis>();
|
|
|
recordId = null;
|
|
|
- subjectId = null;
|
|
|
playTime = 0;
|
|
|
receivedTime = 0;
|
|
|
lastChunkAnalysisList = new ArrayList<ChunkAnalysis>();
|
|
@@ -287,7 +282,7 @@ public class UserChannelContext {
|
|
|
|
|
|
if (playTime >= (musicXmlNote.getDuration() + musicXmlNote.getTimeStamp())) {
|
|
|
|
|
|
- LOGGER.info("------ Frequency:{} splDb:{} Power:{} amplitude:{} ------", playFrequency, splDb, power, amplitude);
|
|
|
+ LOGGER.info("------ Frequency:{} splDb:{} Power:{} amplitude:{} time:{}------", playFrequency, splDb, power, amplitude, playTime);
|
|
|
|
|
|
ChunkAnalysis lastChunkAnalysis = new ChunkAnalysis(playTime - durationTime, playTime, playFrequency, splDb, power, amplitude);
|
|
|
if(Math.abs(chunkAnalysisList.get(chunkAnalysisList.size() - 1).getFrequency() - lastChunkAnalysis.getFrequency()) > hardLevel.getFrequencyOffset()){
|