removed rate modification of the song since I have nothing to rely on
This commit is contained in:
@@ -72,7 +72,6 @@ function getBaseAPIUrl() {
|
|||||||
}
|
}
|
||||||
return '/api';
|
return '/api';
|
||||||
}
|
}
|
||||||
console.log(process.env.EXPO_PUBLIC_API_URL);
|
|
||||||
if (process.env.EXPO_PUBLIC_API_URL) {
|
if (process.env.EXPO_PUBLIC_API_URL) {
|
||||||
return process.env.EXPO_PUBLIC_API_URL;
|
return process.env.EXPO_PUBLIC_API_URL;
|
||||||
}
|
}
|
||||||
@@ -782,7 +781,6 @@ export default class API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static getPartitionMelodyUrl(songId: number): string {
|
public static getPartitionMelodyUrl(songId: number): string {
|
||||||
// return 'https://cdn.discordapp.com/attachments/717080637038788731/1193948941914488862/Short1.mp3?ex=65ae929a&is=659c1d9a&hm=ea21e4b67f8f04388b67fe70e8de11e0110a1ac5c9b13714e21d921a08300992&';
|
|
||||||
return `${API.baseUrl}/song/${songId}/assets/melody`;
|
return `${API.baseUrl}/song/${songId}/assets/melody`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const PartitionMagic = ({
|
|||||||
if (melodySound.current) {
|
if (melodySound.current) {
|
||||||
melodySound.current.pauseAsync();
|
melodySound.current.pauseAsync();
|
||||||
melodySound.current.unloadAsync();
|
melodySound.current.unloadAsync();
|
||||||
|
melodySound.current = null;
|
||||||
}
|
}
|
||||||
if (piano.current) {
|
if (piano.current) {
|
||||||
piano.current.stop();
|
piano.current.stop();
|
||||||
@@ -138,18 +139,6 @@ const PartitionMagic = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shouldPlay) {
|
if (shouldPlay) {
|
||||||
melodySound.current.getStatusAsync().then((status) => {
|
|
||||||
const lastCur = data!.cursors[data!.cursors.length - 1]!;
|
|
||||||
const maxTs = lastCur.timestamp + lastCur.timing;
|
|
||||||
//@ts-expect-error error in the type
|
|
||||||
const newRate = status.durationMillis! / maxTs;
|
|
||||||
console.log('newRate', newRate);
|
|
||||||
if (newRate < 0 || newRate > 2) {
|
|
||||||
console.error('wrong rate');
|
|
||||||
} else {
|
|
||||||
melodySound.current?.setRateAsync(newRate, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
melodySound.current.playAsync().then(onPlay).catch(console.error);
|
melodySound.current.playAsync().then(onPlay).catch(console.error);
|
||||||
} else {
|
} else {
|
||||||
melodySound.current.pauseAsync().then(onPause).catch(console.error);
|
melodySound.current.pauseAsync().then(onPause).catch(console.error);
|
||||||
@@ -176,7 +165,6 @@ const PartitionMagic = ({
|
|||||||
currentCurIdx.current,
|
currentCurIdx.current,
|
||||||
timestamp + transitionDuration,
|
timestamp + transitionDuration,
|
||||||
(cursor, idx) => {
|
(cursor, idx) => {
|
||||||
console.log('cursor', cursor, status);
|
|
||||||
currentCurIdx.current = idx;
|
currentCurIdx.current = idx;
|
||||||
partitionOffset.value = withTiming(
|
partitionOffset.value = withTiming(
|
||||||
-(cursor.x - data!.cursors[0]!.x) / partitionDims[0],
|
-(cursor.x - data!.cursors[0]!.x) / partitionDims[0],
|
||||||
@@ -199,7 +187,6 @@ const PartitionMagic = ({
|
|||||||
currentCurIdx.current,
|
currentCurIdx.current,
|
||||||
timestamp + transitionDuration,
|
timestamp + transitionDuration,
|
||||||
(cursor, idx) => {
|
(cursor, idx) => {
|
||||||
console.log('cursor', cursor);
|
|
||||||
currentCurIdx.current = idx;
|
currentCurIdx.current = idx;
|
||||||
partitionOffset.value = withTiming(
|
partitionOffset.value = withTiming(
|
||||||
-(cursor.x - data!.cursors[0]!.x) / partitionDims[0],
|
-(cursor.x - data!.cursors[0]!.x) / partitionDims[0],
|
||||||
|
|||||||
Reference in New Issue
Block a user